PageSourceSearch

https://abuz4-videolands-api.hf.space/assets/vendor-firebase-UPzGN_Th.js

js abuz4-videolands-api.hf.space collected 2026-10-03 16:36:46 UTC 718,946 bytes, 42 lines download raw bytes

1import{r as l7,_ as h7,W as d7}from"./vendor-capacitor-CDn4S9f2.js";const f7=()=>{};var xd={};const ap=function(r){const e=[];let t=0;for(let n=0;n<r.length;n++){let s=r.charCodeAt(n);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&n+1<r.length&&(r.charCodeAt(n+1)&64512)===56320?(s=65536+((s&1023)<<10)+(r.charCodeAt(++n)&1023),e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},p7=function(r){const e=[];let t=0,n=0;for(;t<r.length;){const s=r[t++];if(s<128)e[n++]=String.fromCharCode(s);else if(s>191&&s<224){const i=r[t++];e[n++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=r[t++],o=r[t++],a=r[t++],u=((s&7)<<18|(i&63)<<12|(o&63)<<6|a&63)-65536;e[n++]=String.fromCharCode(55296+(u>>10)),e[n++]=String.fromCharCode(56320+(u&1023))}else{const i=r[t++],o=r[t++];e[n++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},cp={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:typeof atob=="function",encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let s=0;s<r.length;s+=3){const i=r[s],o=s+1<r.length,a=o?r[s+1]:0,u=s+2<r.length,l=u?r[s+2]:0,d=i>>2,p=(i&3)<<4|a>>4;let g=(a&15)<<2|l>>6,I=l&63;u||(I=64,o||(g=64)),n.push(t[d],t[p],t[g],t[I])}return n.join("")},encodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(r):this.encodeByteArray(ap(r),e)},decodeString(r,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(r):p7(this.decodeStringToByteArray(r,e))},decodeStringToByteArray(r,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let s=0;s<r.length;){const i=t[r.charAt(s++)],a=s<r.length?t[r.charAt(s)]:0;++s;const l=s<r.length?t[r.charAt(s)]:64;++s;const p=s<r.length?t[r.charAt(s)]:64;if(++s,i==null||a==null||l==null||p==null)throw new m7;const g=i<<2|a>>4;if(n.push(g),l!==64){const I=a<<4&240|l>>2;if(n.push(I),p!==64){const v=l<<6&192|p;n.push(v)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r<this.ENCODED_VALS.length;r++)this.byteToCharMap_[r]=this.ENCODED_VALS.charAt(r),this.charToByteMap_[this.byteToCharMap_[r]]=r,this.byteToCharMapWebSafe_[r]=this.ENCODED_VALS_WEBSAFE.charAt(r),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[r]]=r,r>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}};class m7 extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const g7=function(r){const e=ap(r);return cp.encodeByteArray(e,!0)},Ja=function(r){return g7(r).replace(/\./g,"")},up=function(r){try{return cp.decodeString(r,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function lp(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}const _7=()=>lp().__FIREBASE_DEFAULTS__,y7=()=>{if(typeof process>"u"||typeof xd>"u")return;const r=xd.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},E7=()=>
1{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=r&&up(r[1]);return e&&JSON.parse(e)},Pc=()=>{try{return f7()||_7()||y7()||E7()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},hp=r=>Pc()?.emulatorHosts?.[r],dp=r=>{const e=hp(r);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const n=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),n]:[e.substring(0,t),n]},fp=()=>Pc()?.config,pp=r=>Pc()?.[`_${r}`];class mp{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,n))}}}function I7(r,e){if(r.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const t={alg:"none",type:"JWT"},n=e||"demo-project",s=r.iat||0,i=r.sub||r.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o={iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...r};return[Ja(JSON.stringify(t)),Ja(JSON.stringify(o)),""].join(".")}function He(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function w7(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(He())}function gp(){const r=Pc()?.forceEnvironment;if(r==="node")return!0;if(r==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function T7(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function A7(){const r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function R7(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function v7(){const r=He();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function _p(){return!gp()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function yp(){return!gp()&&!!navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}function Ep(){try{return typeof indexedDB=="object"}catch{return!1}}function S7(){return new Promise((r,e)=>{try{let t=!0;const n="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(n);s.onsuccess=()=>{s.result.close(),t||self.indexedDB.deleteDatabase(n),r(!0)},s.onupgradeneeded=()=>{t=!1},s.onerror=()=>{e(s.error?.message||"")}}catch(t){e(t)}})}const P7="FirebaseError";class mn extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name=P7,Object.setPrototypeOf(this,mn.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,qo.prototype.create)}}class qo{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?C7(i,n):"Error",a=`${this.serviceName}: ${o} (${s}).`;return new mn(s,a,n)}}function C7(r,e){return r.replace(b7,(t,n)=>{const s=e[n];return s!=null?String(s):`<${n}?>`})}const b7=/\{\$([^}]+)}/g;function N7(r){for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}function Kt(r,e){if(r===e)return!0;const t=Object.keys(r),n=Object.keys(e);for(const s of t){if(!n.includes(s))return!1;const i=r[s],o=e[s];if(Ld(i)&&Ld(o)){if(!Kt(i,o))return!1}else if(i!==o)return!1}for(const s of n)if(!t.includes(s))return!1;return!0}function Ld(r){return r!==null&&typeof r=="object"}function ai(r){const e=[];for(const[t,n]of Object.entries(r))Array.isArray(n)?n.forEach(s=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(n));return e.length?"&"+e.join("&"):""}function Ji(r){const e={};return r.replace(/^\?/,"").split("&").forEach(n=>{if(n){const[s,i]=n.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function Xi(r){const e=r.indexOf("?");if(!e)return"";const t=r.indexOf("#",e);return r.substring(e,t>0?t:void 0)}function V7(r,e){const t=new O7(r,e);return t.subscribe.bind(t)}class O7{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Prom
1ise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(n=>{this.error(n)})}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,n){let s;if(e===void 0&&t===void 0&&n===void 0)throw new Error("Missing Observer.");D7(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:n},s.next===void 0&&(s.next=Bu),s.error===void 0&&(s.error=Bu),s.complete===void 0&&(s.complete=Bu);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&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(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(n){typeof console<"u"&&console.error&&console.error(n)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function D7(r,e){if(typeof r!="object"||r===null)return!1;for(const t of e)if(t in r&&typeof r[t]=="function")return!0;return!1}function Bu(){}function ee(r){return r&&r._delegate?r._delegate:r}function Tr(r){try{return(r.startsWith("http://")||r.startsWith("https://")?new URL(r).hostname:r).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Cc(r){return(await fetch(r,{credentials:"include"})).ok}class lr{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,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}}const xr="[DEFAULT]";class k7{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){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const n=new mp;if(this.instancesDeferred.set(t,n),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&n.resolve(s)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){const t=this.normalizeInstanceIdentifier(e?.identifier),n=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(s){if(n)return null;throw s}else{if(n)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(L7(e))try{this.getOrInitializeService({instanceIdentifier:xr})}catch{}for(const[t,n]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(t);try{const i=this.getOrInitializeService({instanceIdentifier:s});n.resolve(i)}catch{}}}}clearInstance(e=xr){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=xr){return this.instances.has(e)}getOptions(e=xr){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[i,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(i);n===a&&o.resolve(s)}return s}onInit(e,t){const n=this.normalizeInstanceIdentifier(t),s=this.onInitCallbacks.get(n)??new Set;s.add(e),this.onInitCallbacks.set(n,s);const i=this.instances.get(n);return i&&e(i,n),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const s of n)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:x7(e),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch{}return n||null}normalizeInstanceIdentifier(e=xr){return this.component?this.component.multipleInstances?e:xr:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function x7(r){return r===xr?void 0:r}function L7(r){return r.instantiationMode==="EAGER"}class M7{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new 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);const t=new k7(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}var ce;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(ce||(ce={}));const F7={debug:ce.DEBUG,verbose:ce.VERBOSE,info:ce.INFO,warn:ce.WARN,error:ce.ERROR,silent:ce.SILENT},U7=ce.INFO,B7={[ce.DEBUG]:"log",[ce.VERBOSE]:"log",[ce.INFO]:"info",[ce.WARN]:"warn",[ce.ERROR]:"error"},q7=(r,e,...t)=>{if(e<r.logLevel)return;const n=new Date().toISOString(),s=B7[e];if(s)console[s](`[${n}]  ${r.name}:`,...t);
vendor: 4,140 bytes, line 1
1else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class Hl{constructor(e){this.name=e,this._logLevel=U7,this._logHandler=q7,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in ce))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?F7[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,ce.DEBUG,...e),this._logHandler(this,ce.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,ce.VERBOSE,...e),this._logHandler(this,ce.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,ce.INFO,...e),this._logHandler(this,ce.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,ce.WARN,...e),this._logHandler(this,ce.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,ce.ERROR,...e),this._logHandler(this,ce.ERROR,...e)}}const G7=(r,e)=>e.some(t=>r instanceof t);let Md,Fd;function $7(){return Md||(Md=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function j7(){return Fd||(Fd=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ip=new WeakMap,il=new WeakMap,wp=new WeakMap,qu=new WeakMap,Wl=new WeakMap;function z7(r){const e=new Promise((t,n)=>{const s=()=>{r.removeEventListener("success",i),r.removeEventListener("error",o)},i=()=>{t(rr(r.result)),s()},o=()=>{n(r.error),s()};r.addEventListener("success",i),r.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Ip.set(t,r)}).catch(()=>{}),Wl.set(e,r),e}function H7(r){if(il.has(r))return;const e=new Promise((t,n)=>{const s=()=>{r.removeEventListener("complete",i),r.removeEventListener("error",o),r.removeEventListener("abort",o)},i=()=>{t(),s()},o=()=>{n(r.error||new DOMException("AbortError","AbortError")),s()};r.addEventListener("complete",i),r.addEventListener("error",o),r.addEventListener("abort",o)});il.set(r,e)}let ol={get(r,e,t){if(r instanceof IDBTransaction){if(e==="done")return il.get(r);if(e==="objectStoreNames")return r.objectStoreNames||wp.get(r);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return rr(r[e])},set(r,e,t){return r[e]=t,!0},has(r,e){return r instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in r}};function W7(r){ol=r(ol)}function K7(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const n=r.call(Gu(this),e,...t);return wp.set(n,e.sort?e.sort():[e]),rr(n)}:j7().includes(r)?function(...e){return r.apply(Gu(this),e),rr(Ip.get(this))}:function(...e){return rr(r.apply(Gu(this),e))}}function Q7(r){return typeof r=="function"?K7(r):(r instanceof IDBTransaction&&H7(r),G7(r,$7())?new Proxy(r,ol):r)}function rr(r){if(r instanceof IDBRequest)return z7(r);if(qu.has(r))return qu.get(r);const e=Q7(r);return e!==r&&(qu.set(r,e),Wl.set(e,r)),e}const Gu=r=>Wl.get(r);function Y7(r,e,{blocked:t,upgrade:n,blocking:s,terminated:i}={}){const o=indexedDB.open(r,e),a=rr(o);return n&&o.addEventListener("upgradeneeded",u=>{n(rr(o.result),u.oldVersion,u.newVersion,rr(o.transaction),u)}),t&&o.addEventListener("blocked",u=>t(u.oldVersion,u.newVersion,u)),a.then(u=>{i&&u.addEventListener("close",()=>i()),s&&u.addEventListener("versionchange",l=>s(l.oldVersion,l.newVersion,l))}).catch(()=>{}),a}const J7=["get","getKey","getAll","getAllKeys","count"],X7=["put","add","delete","clear"],$u=new Map;function Ud(r,e){if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e=="string"))return;if($u.get(e))return $u.get(e);const t=e.replace(/FromIndex$/,""),n=e!==t,s=X7.includes(t);if(!(t in(n?IDBIndex:IDBObjectStore).prototype)||!(s||J7.includes(t)))return;const i=async function(o,...a){const u=this.transaction(o,s?"readwrite":"readonly");let l=u.store;
1return n&&(l=l.index(a.shift())),(await Promise.all([l[t](...a),s&&u.done]))[0]};return $u.set(e,i),i}W7(r=>({...r,get:(e,t,n)=>Ud(e,t)||r.get(e,t,n),has:(e,t)=>!!Ud(e,t)||r.has(e,t)}));class Z7{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(e4(t)){const n=t.getImmediate();return`${n.library}/${n.version}`}else return null}).filter(t=>t).join(" ")}}function e4(r){return r.getComponent()?.type==="VERSION"}const al="@firebase/app",Bd="0.15.0";const Sn=new Hl("@firebase/app"),t4="@firebase/app-compat",n4="@firebase/analytics-compat",r4="@firebase/analytics",s4="@firebase/app-check-compat",i4="@firebase/app-check",o4="@firebase/auth",a4="@firebase/auth-compat",c4="@firebase/database",u4="@firebase/data-connect",l4="@firebase/database-compat",h4="@firebase/functions",d4="@firebase/functions-compat",f4="@firebase/installations",p4="@firebase/installations-compat",m4="@firebase/messaging",g4="@firebase/messaging-compat",_4="@firebase/performance",y4="@firebase/performance-compat",E4="@firebase/remote-config",I4="@firebase/remote-config-compat",w4="@firebase/storage",T4="@firebase/storage-compat",A4="@firebase/firestore",R4="@firebase/ai",v4="@firebase/firestore-compat",S4="firebase",P4="12.15.0";const Xa="[DEFAULT]",C4={[al]:"fire-core",[t4]:"fire-core-compat",[r4]:"fire-analytics",[n4]:"fire-analytics-compat",[i4]:"fire-app-check",[s4]:"fire-app-check-compat",[o4]:"fire-auth",[a4]:"fire-auth-compat",[c4]:"fire-rtdb",[u4]:"fire-data-connect",[l4]:"fire-rtdb-compat",[h4]:"fire-fn",[d4]:"fire-fn-compat",[f4]:"fire-iid",[p4]:"fire-iid-compat",[m4]:"fire-fcm",[g4]:"fire-fcm-compat",[_4]:"fire-perf",[y4]:"fire-perf-compat",[E4]:"fire-rc",[I4]:"fire-rc-compat",[w4]:"fire-gcs",[T4]:"fire-gcs-compat",[A4]:"fire-fst",[v4]:"fire-fst-compat",[R4]:"fire-vertex","fire-js":"fire-js",[S4]:"fire-js-all"};const Za=new Map,b4=new Map,cl=new Map;function qd(r,e){try{r.container.addComponent(e)}catch(t){Sn.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`,t)}}function Qr(r){const e=r.name;if(cl.has(e))return Sn.debug(`There were multiple attempts to register component ${e}.`),!1;cl.set(e,r);for(const t of Za.values())qd(t,r);for(const t of b4.values())qd(t,r);return!0}function ci(r,e){const t=r.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),r.container.getProvider(e)}function N4(r,e,t=Xa){ci(r,e).clearInstance(t)}function Be(r){return r==null?!1:r.settings!==void 0}const V4={"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.","invali
1d-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."},sr=new qo("app","Firebase",V4);class O4{constructor(e,t,n){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new lr("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 sr.create("app-deleted",{appName:this._name})}}const ui=P4;function D4(r,e={}){let t=r;typeof e!="object"&&(e={name:e});const n={name:Xa,automaticDataCollectionEnabled:!0,...e},s=n.name;if(typeof s!="string"||!s)throw sr.create("bad-app-name",{appName:String(s)});if(t||(t=fp()),!t)throw sr.create("no-options");const i=Za.get(s);if(i){if(Kt(t,i.options)&&Kt(n,i.config))return i;throw sr.create("duplicate-app",{appName:s})}const o=new M7(s);for(const u of cl.values())o.addComponent(u);const a=new O4(t,n,o);return Za.set(s,a),a}function Kl(r=Xa){const e=Za.get(r);if(!e&&r===Xa&&fp())return D4();if(!e)throw sr.create("no-app",{appName:r});return e}function on(r,e,t){let n=C4[r]??r;t&&(n+=`-${t}`);const s=n.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const o=[`Unable to register library "${n}" with version "${e}":`];s&&o.push(`library name "${n}" contains illegal characters (whitespace or "/")`),s&&i&&o.push("and"),i&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Sn.warn(o.join(" "));return}Qr(new lr(`${n}-version`,()=>({library:n,version:e}),"VERSION"))}const k4="firebase-heartbeat-database",x4=1,Ao="firebase-heartbeat-store";let ju=null;function Tp(){return ju||(ju=Y7(k4,x4,{upgrade:(r,e)=>{switch(e){case 0:try{r.createObjectStore(Ao)}catch(t){console.warn(t)}}}}).catch(r=>{throw sr.create("idb-open",{originalErrorMessage:r.message})})),ju}async function L4(r){try{const t=(await Tp()).transaction(Ao),n=await t.objectStore(Ao).get(Ap(r));return await t.done,n}catch(e){if(e instanceof mn)Sn.warn(e.message);else{const t=sr.create("idb-get",{originalErrorMessage:e?.message});Sn.warn(t.message)}}}async function Gd(r,e){try{const n=(await Tp()).transaction(Ao,"readwrite");await n.objectStore(Ao).put(e,Ap(r)),await n.done}catch(t){if(t instanceof mn)Sn.warn(t.message);else{const n=sr.create("idb-set",{originalErrorMessage:t?.message});Sn.warn(n.message)}}}function Ap(r){return`${r.name}!${r.options.appId}`}const M4=1024,F4=30;class U4{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new q4(t),this._heartbeatsCachePromise=this._storage.read().then(n=>(this._heartbeatsCache=n,n))}async triggerHeartbeat(){try{const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),n=$d();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===n||this._heartbeatsCache.heartbeats.some(s=>s.date===n))return;if(this._heartbeatsCache.heartbeats.push({date:n,agent:t}),this._heartbeatsCache.heartbeats.length>F4){const s=G4(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(s,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){Sn.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";const e=$d(),{heartbeatsToSend:t,unsentEntries:n}=B4(this._heartbeatsCache.heartbeats),s=Ja(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(e){return Sn.warn(e),""}}}function $d(){return new Date().toISOString().substring(0,10)}function B4(r,e=M4){const t=[];let n=r.slice();for(const s of r){const i=t.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),jd(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),jd(t)>e){t.pop();break}n=n.slice(1)}return{heartbeatsToSend:t,unsentEntries:n}}class q4{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Ep()?S7().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await L4(this.app);return t?.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const n=await this.read();return Gd(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const n=await this.read();return Gd(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}else return}}
vendor: 6,750 bytes, line 1
1function jd(r){return Ja(JSON.stringify({version:2,heartbeats:r})).length}function G4(r){if(r.length===0)return-1;let e=0,t=r[0].date;for(let n=1;n<r.length;n++)r[n].date<t&&(t=r[n].date,e=n);return e}function $4(r){Qr(new lr("platform-logger",e=>new Z7(e),"PRIVATE")),Qr(new lr("heartbeat",e=>new U4(e),"PRIVATE")),on(al,Bd,r),on(al,Bd,"esm2020"),on("fire-js","")}$4("");var j4="firebase",z4="12.15.0";on(j4,z4,"app");var zd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};var ir,Rp;(function(){var r;function e(T,_){function w(){}w.prototype=_.prototype,T.F=_.prototype,T.prototype=new w,T.prototype.constructor=T,T.D=function(S,R,V){for(var E=Array(arguments.length-2),Et=2;Et<arguments.length;Et++)E[Et-2]=arguments[Et];return _.prototype[R].apply(S,E)}}function t(){this.blockSize=-1}function n(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}e(n,t),n.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function s(T,_,w){w||(w=0);const S=Array(16);if(typeof _=="string")for(var R=0;R<16;++R)S[R]=_.charCodeAt(w++)|_.charCodeAt(w++)<<8|_.charCodeAt(w++)<<16|_.charCodeAt(w++)<<24;else for(R=0;R<16;++R)S[R]=_[w++]|_[w++]<<8|_[w++]<<16|_[w++]<<24;_=T.g[0],w=T.g[1],R=T.g[2];let V=T.g[3],E;E=_+(V^w&(R^V))+S[0]+3614090360&4294967295,_=w+(E<<7&4294967295|E>>>25),E=V+(R^_&(w^R))+S[1]+3905402710&4294967295,V=_+(E<<12&4294967295|E>>>20),E=R+(w^V&(_^w))+S[2]+606105819&4294967295,R=V+(E<<17&4294967295|E>>>15),E=w+(_^R&(V^_))+S[3]+3250441966&4294967295,w=R+(E<<22&4294967295|E>>>10),E=_+(V^w&(R^V))+S[4]+4118548399&4294967295,_=w+(E<<7&4294967295|E>>>25),E=V+(R^_&(w^R))+S[5]+1200080426&4294967295,V=_+(E<<12&4294967295|E>>>20),E=R+(w^V&(_^w))+S[6]+2821735955&4294967295,R=V+(E<<17&4294967295|E>>>15),E=w+(_^R&(V^_))+S[7]+4249261313&4294967295,w=R+(E<<22&4294967295|E>>>10),E=_+(V^w&(R^V))+S[8]+1770035416&4294967295,_=w+(E<<7&4294967295|E>>>25),E=V+(R^_&(w^R))+S[9]+2336552879&4294967295,V=_+(E<<12&4294967295|E>>>20),E=R+(w^V&(_^w))+S[10]+4294925233&4294967295,R=V+(E<<17&4294967295|E>>>15),E=w+(_^R&(V^_))+S[11]+2304563134&4294967295,w=R+(E<<22&4294967295|E>>>10),E=_+(V^w&(R^V))+S[12]+1804603682&4294967295,_=w+(E<<7&4294967295|E>>>25),E=V+(R^_&(w^R))+S[13]+4254626195&4294967295,V=_+(E<<12&4294967295|E>>>20),E=R+(w^V&(_^w))+S[14]+2792965006&4294967295,R=V+(E<<17&4294967295|E>>>15),E=w+(_^R&(V^_))+S[15]+1236535329&4294967295,w=R+(E<<22&4294967295|E>>>10),E=_+(R^V&(w^R))+S[1]+4129170786&4294967295,_=w+(E<<5&4294967295|E>>>27),E=V+(w^R&(_^w))+S[6]+3225465664&4294967295,V=_+(E<<9&4294967295|E>>>23),E=R+(_^w&(V^_))+S[11]+643717713&4294967295,R=V+(E<<14&4294967295|E>>>18),E=w+(V^_&(R^V))+S[0]+3921069994&4294967295,w=R+(E<<20&4294967295|E>>>12),E=_+(R^V&(w^R))+S[5]+3593408605&4294967295,_=w+(E<<5&4294967295|E>>>27),E=V+(w^R&(_^w))+S[10]+38016083&4294967295,V=_+(E<<9&4294967295|E>>>23),E=R+(_^w&(V^_))+S[15]+3634488961&4294967295,R=V+(E<<14&4294967295|E>>>18),E=w+(V^_&(R^V))+S[4]+3889429448&4294967295,w=R+(E<<20&4294967295|E>>>12),E=_+(R^V&(w^R))+S[9]+568446438&4294967295,_=w+(E<<5&4294967295|E>>>27),E=V+(w^R&(_^w))+S[14]+3275163606&4294967295,V=_+(E<<9&4294967295|E>>>23),E=R+(_^w&(V^_))+S[3]+4107603335&4294967295,R=V+(E<<14&4294967295|E>>>18),E=w+(V^_&(R^V))+S[8]+1163531501&4294967295,w=R+(E<<20&4294967295|E>>>12),E=_+(R^V&(w^R))+S[13]+2850285829&4294967295,_=w+(E<<5&4294967295|E>>>27),E=V+(w^R&(_^w))+S[2]+4243563512&4294967295,V=_+(E<<9&4294967295|E>>>23),E=R+(_^w&(V^_))+S[7]+1735328473&4294967295,R=V+(E<<14&4294967295|E>>>18),E=w+(V^_&(R^V))+S[12]+2368359562&4294967295,w=R+(E<<20&4294967295|E>>>12),E=_+(w^R^V)+S[5]+4294588738&4294967295,_=w+(E<<4&4294967295|E>>>28),E=V+(_^w^R)+S[8]+2272392833&4294967295,V=_+(E<<11&4294967295|E>>>21),E=R+(V^_^w)+S[11]+1839030562&4294967295,R=V+(E<<16&4294967295|E>>>16),E=w+(R^V^_)+S[14]+4259657740&4294967295,w=R+(E<<23&4294967295|E>>>9),E=_+(w^R^V)+S[1]+2763975236&4294967295,_=w+(E<<4&4294967295|E>>>28),E=V+(_^w^R)+S[4]+1272893353&4294967295,V=_+(E<<11&4294967295|E>>>21),E=R+(V^_^w)+S[7]+4139469664&4294967295,R=V+(E<<16&4294967295|E>>>16),E=w+(R^V^_)+S[10]+3200236656&4294967295,w=R+(E<<23&4294967295|E>>>9),E=_+(w^R^V)+S[13]+681279174&4294967295,_=w+(E<<4&4294967295|E>>>28),E=V+(_^w^R)+S[0]+3936430074&4294967295,V=_+(E<<11&4294967295|E>>>21),E=R+(V^_^w)+S[3]+3572445317&4294967295,R=V+(E<<16&4294967295|E>>>16),E=w+(R^V^_)+S[6]+76029189&4294967295,w=R+(E<<23&4294967295|E>>>9),E=_+(w^R^V)+S[9]+3654602809&4294967295,_=w+(E<<4&4294967295|E>>>28),E=V+(_^w^R)+S[12]+3873151461&4294967295,V=_+(E<<11&4294967295|E>>>21),E=R+(V^_^w)+S[15]+530742520&4294967295,R=V+(E<<16&4294967295|E>>>16),E=w+(R^V^_)+S[2]+3299628645&4294967295,w=R+(E<<23&4294967295|E>>>9),E=_+(R^(w|~V))+S[0]+4096336452&4294967295,_=w+(E<<6&4294967295|E>>>26),E=V+(w^(_|~R))+S[7]+1126891415&4294967295,V=_+(E<<10&4294967295|E>>>22),E=R+(_^(V|~w))+S[14]+2878612391&4294967295,R=V+(E<<15&4294967295|E>>>17),E=w+(V^(R|~_))+S[5]+4237533241&4294967295,w=R+(E<<21&4294967295|E>>>11),E=_+(R^(w|~V))+S[12]+1700485571&4294967295,_=w+(E<<6&4294967295|E>>>26),E=V+(w^(_|~R))+S[3]+2399980690&4294967295,V=_+(E<<10&4294967295|E>>>22),E=R+(_^(V|~w))+S[10]+4293915773&4294967295,R=V+(E<<15&4294967295|E>>>17),E=w+(V^(R|~_))+S[1]+2240044497&4294967295,w=R+(E<<21&4294967295|E>>>11),E=_+(R^(w|~V))+S[8]+1873313359&4294967295,_=w+(E<<6&4294967295|E>>>26),E=V+(w^(_|~R))+S[15]+4264355552&4294967295,V=_+(E<<10&4294967295|E>>>22),E=R+(_^(V|~w))+S[6]+2734768916&4294967295,R=V+(E<<15&4294967295|E>>>17),E=w+(V^(R|~_))+S[13]+1309151649&4294967295,w=R+(E<<21&4294967295|E>>>11),E=_+(R^(w|~V))+S[4]+4149444226&4294967295,_=w+(E<<6&4294967295|E>>>26),E=V+(w^(_|~R))+S[11]+3174756917&4294967295,V=_+(E<<10&4294967295|E>>>22),E=R+(_^(V|~w))+S[2]+718787259&4294967295,R=V+(E<<15&4294967295|E>>>17),E=w+(V^(R|~_))+S[9]+3951481745&4294967295,T.g[0]=T.g[0]+_&4294967295,T.g[1]=T.g[1]+(R+(E<<21&4294967295|E>>>11))&4294967295,T.g[2]=T.g[2]+R&4294967295,T.g[3]=T.g[3]+V&4294967295}n.prototype.v=function(T,_){_===void 0&&(_=T.length);const w=_-this.blockSize,S=this.C;let R=this.h,V=0;for(;V<_;){if(R==0)for(;V<=w;)s(this,T,V),V+=this.blockSize;if(typeof T=="string"){for(;V<_;)if(S[R++]=T.charCodeAt(V++),R==this.blockSize){s(this,S),R=0;break}}else for(;V<_;)if(S[R++]=T[V++],R==this.blockSize){s(this,S),R=0;break}}this.h=R,this.o+=_},n.prototype.A=function(){var T=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);T[0]=128;for(var _=1;_<T.length-8;++_)T[_]=0;_=this.o*8;for(var w=T.length-8;w<T.length;++w)T[w]=_&255,_/=256;for(this.v(T),T=Array(16),_=0,w=0;w<4;++w)for(let S=0;S<32;S+=8)T[_++]=this.g[w]>>>S&255;return T};function i(T,_){var w=a;
vendor: 1,709 bytes, line 1
1return Object.prototype.hasOwnProperty.call(w,T)?w[T]:w[T]=_(T)}function o(T,_){this.h=_;const w=[];let S=!0;for(let R=T.length-1;R>=0;R--){const V=T[R]|0;S&&V==_||(w[R]=V,S=!1)}this.g=w}var a={};function u(T){return-128<=T&&T<128?i(T,function(_){return new o([_|0],_<0?-1:0)}):new o([T|0],T<0?-1:0)}function l(T){if(isNaN(T)||!isFinite(T))return p;if(T<0)return F(l(-T));const _=[];let w=1;for(let S=0;T>=w;S++)_[S]=T/w|0,w*=4294967296;return new o(_,0)}function d(T,_){if(T.length==0)throw Error("number format error: empty string");if(_=_||10,_<2||36<_)throw Error("radix out of range: "+_);if(T.charAt(0)=="-")return F(d(T.substring(1),_));if(T.indexOf("-")>=0)throw Error('number format error: interior "-" character');const w=l(Math.pow(_,8));let S=p;for(let V=0;V<T.length;V+=8){var R=Math.min(8,T.length-V);const E=parseInt(T.substring(V,V+R),_);R<8?(R=l(Math.pow(_,R)),S=S.j(R).add(l(E))):(S=S.j(w),S=S.add(l(E)))}return S}var p=u(0),g=u(1),I=u(16777216);r=o.prototype,r.m=function(){if(k(this))return-F(this).m();let T=0,_=1;for(let w=0;w<this.g.length;w++){const S=this.i(w);T+=(S>=0?S:4294967296+S)*_,_*=4294967296}return T},r.toString=function(T){if(T=T||10,T<2||36<T)throw Error("radix out of range: "+T);if(v(this))return"0";if(k(this))return"-"+F(this).toString(T);const _=l(Math.pow(T,6));var w=this;let S="";for(;;){const R=me(w,_).g;w=W(w,R.j(_));let V=((w.g.length>0?w.g[0]:w.h)>>>0).toString(T);if(w=R,v(w))return V+S;for(;V.length<6;)V="0"+V;S=V+S}},r.i=function(T){return T<0?0:T<this.g.length?this.g[T]:this.h};function v(T){if(T.h!=0)return!1;for(let _=0;_<T.g.length;_++)if(T.g[_]!=0)return!1;return!0}function k(T){return T.h==-1}r.l=function(T){return T=W(this,T),k(T)?-1:v(T)?0:1}
1;function F(T){const _=T.g.length,w=[];for(let S=0;S<_;S++)w[S]=~T.g[S];return new o(w,~T.h).add(g)}r.abs=function(){return k(this)?F(this):this},r.add=function(T){const _=Math.max(this.g.length,T.g.length),w=[];let S=0;for(let R=0;R<=_;R++){let V=S+(this.i(R)&65535)+(T.i(R)&65535),E=(V>>>16)+(this.i(R)>>>16)+(T.i(R)>>>16);S=E>>>16,V&=65535,E&=65535,w[R]=E<<16|V}return new o(w,w[w.length-1]&-2147483648?-1:0)};function W(T,_){return T.add(F(_))}r.j=function(T){if(v(this)||v(T))return p;if(k(this))return k(T)?F(this).j(F(T)):F(F(this).j(T));if(k(T))return F(this.j(F(T)));if(this.l(I)<0&&T.l(I)<0)return l(this.m()*T.m());const _=this.g.length+T.g.length,w=[];for(var S=0;S<2*_;S++)w[S]=0;for(S=0;S<this.g.length;S++)for(let R=0;R<T.g.length;R++){const V=this.i(S)>>>16,E=this.i(S)&65535,Et=T.i(R)>>>16,br=T.i(R)&65535;w[2*S+2*R]+=E*br,J(w,2*S+2*R),w[2*S+2*R+1]+=V*br,J(w,2*S+2*R+1),w[2*S+2*R+1]+=E*Et,J(w,2*S+2*R+1),w[2*S+2*R+2]+=V*Et,J(w,2*S+2*R+2)}for(T=0;T<_;T++)w[T]=w[2*T+1]<<16|w[2*T];for(T=_;T<2*_;T++)w[T]=0;return new o(w,0)};function J(T,_){for(;(T[_]&65535)!=T[_];)T[_+1]+=T[_]>>>16,T[_]&=65535,_++}function Y(T,_){this.g=T,this.h=_}function me(T,_){if(v(_))throw Error("division by zero");if(v(T))return new Y(p,p);if(k(T))return _=me(F(T),_),new Y(F(_.g),F(_.h));if(k(_))return _=me(T,F(_)),new Y(F(_.g),_.h);if(T.g.length>30){if(k(T)||k(_))throw Error("slowDivide_ only works with positive integers.");for(var w=g,S=_;S.l(T)<=0;)w=Ie(w),S=Ie(S);var R=pe(w,1),V=pe(S,1);for(S=pe(S,2),w=pe(w,2);!v(S);){var E=V.add(S);E.l(T)<=0&&(R=R.add(w),V=E),S=pe(S,1),w=pe(w,1)}return _=W(T,R.j(_)),new Y(R,_)}for(R=p;T.l(_)>=0;){for(w=Math.max(1,Math.floor(T.m()/_.m())),S=Math.ceil(Math.log(w)/Math.LN2),S=S<=48?1:Math.pow(2,S-48),V=l(w),E=V.j(_);k(E)||E.l(T)>0;)w-=S,V=l(w),E=V.j(_);v(V)&&(V=g),R=R.add(V),T=W(T,E)}return new Y(R,T)}r.B=function(T){return me(this,T).h},r.and=function(T){const _=Math.max(this.g.length,T.g.length),w=[];for(let S=0;S<_;S++)w[S]=this.i(S)&T.i(S);return new o(w,this.h&T.h)},r.or=function(T){const _=Math.max(this.g.length,T.g.length),w=[];for(let S=0;S<_;S++)w[S]=this.i(S)|T.i(S);return new o(w,this.h|T.h)},r.xor=function(T){const _=Math.max(this.g.length,T.g.length),w=[];for(let S=0;S<_;S++)w[S]=this.i(S)^T.i(S);return new o(w,this.h^T.h)};function Ie(T){const _=T.g.length+1,w=[];for(let S=0;S<_;S++)w[S]=T.i(S)<<1|T.i(S-1)>>>31;return new o(w,T.h)}function pe(T,_){const w=_>>5;_%=32;const S=T.g.length-w,R=[];for(let V=0;V<S;V++)R[V]=_>0?T.i(V+w)>>>_|T.i(V+w+1)<<32-_:T.i(V+w);return new o(R,T.h)}n.prototype.digest=n.prototype.A,n.prototype.reset=n.prototype.u,n.prototype.update=n.prototype.v,Rp=n,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=l,o.fromString=d,ir=o}).apply(typeof zd<"u"?zd:typeof self<"u"?self:typeof window<"u"?window:{});var Ra=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};var vp,Zi,Sp,Ma,ul,Pp,Cp,bp;(function(){var r,e=Object.defineProperty;function t(c){c=[typeof globalThis=="object"&&globalThis,c,typeof window=="object"&&window,typeof self=="object"&&self,typeof Ra=="object"&&Ra];for(var h=0;h<c.length;++h){var f=c[h];if(f&&f.Math==Math)return f}throw Error("Cannot find global object")}var n=t(this);function s(c,h){if(h)e:{var f=n;c=c.split(".");for(var m=0;m<c.length-1;m++){var b=c[m];if(!(b in f))break e;f=f[b]}c=c[c.length-1],m=f[c],h=h(m),h!=m&&h!=null&&e(f,c,{configurable:!0,writable:!0,value:h})}}s("Symbol.dispose",function(c){return c||Symbol("Symbol.dispose")}),s("Array.prototype.values",function(c){return c||function(){return this[Symbol.iterator]()}}),s("Object.entries",function(c){return c||function(h){var f=[],m;for(m in h)Object.prototype.hasOwnProperty.call(h,m)&&f.push([m,h[m]]);return f}});var i=i||{},o=this||self;function a(c){var h=typeof c;return h=="object"&&c!=null||h=="function"}function u(c,h,f){return c.call.apply(c.bind,arguments)}function l(c,h,f){return l=u,l.apply(null,arguments)}
1function d(c,h){var f=Array.prototype.slice.call(arguments,1);return function(){var m=f.slice();return m.push.apply(m,arguments),c.apply(this,m)}}function p(c,h){function f(){}f.prototype=h.prototype,c.Z=h.prototype,c.prototype=new f,c.prototype.constructor=c,c.Ob=function(m,b,D){for(var $=Array(arguments.length-2),ie=2;ie<arguments.length;ie++)$[ie-2]=arguments[ie];return h.prototype[b].apply(m,$)}}var g=typeof AsyncContext<"u"&&typeof AsyncContext.Snapshot=="function"?c=>c&&AsyncContext.Snapshot.wrap(c):c=>c;function I(c){const h=c.length;if(h>0){const f=Array(h);for(let m=0;m<h;m++)f[m]=c[m];return f}return[]}function v(c,h){for(let m=1;m<arguments.length;m++){const b=arguments[m];var f=typeof b;if(f=f!="object"?f:b?Array.isArray(b)?"array":f:"null",f=="array"||f=="object"&&typeof b.length=="number"){f=c.length||0;const D=b.length||0;c.length=f+D;for(let $=0;$<D;$++)c[f+$]=b[$]}else c.push(b)}}class k{constructor(h,f){this.i=h,this.j=f,this.h=0,this.g=null}get(){let h;return this.h>0?(this.h--,h=this.g,this.g=h.next,h.next=null):h=this.i(),h}}function F(c){o.setTimeout(()=>{throw c},0)}function W(){var c=T;let h=null;return c.g&&(h=c.g,c.g=c.g.next,c.g||(c.h=null),h.next=null),h}class J{constructor(){this.h=this.g=null}add(h,f){const m=Y.get();m.set(h,f),this.h?this.h.next=m:this.g=m,this.h=m}}var Y=new k(()=>new me,c=>c.reset());class me{constructor(){this.next=this.g=this.h=null}set(h,f){this.h=h,this.g=f,this.next=null}reset(){this.next=this.g=this.h=null}}let Ie,pe=!1,T=new J,_=()=>{const c=Promise.resolve(void 0);Ie=()=>{c.then(w)}};function w(){for(var c;c=W();){try{c.h.call(c.g)}catch(f){F(f)}var h=Y;h.j(c),h.h<100&&(h.h++,c.next=h.g,h.g=c)}pe=!1}function S(){this.u=this.u,this.C=this.C}S.prototype.u=!1,S.prototype.dispose=function(){this.u||(this.u=!0,this.N())},S.prototype[Symbol.dispose]=function(){this.dispose()},S.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function R(c,h){this.type=c,this.g=this.target=h,this.defaultPrevented=!1}R.prototype.h=function(){this.defaultPrevented=!0};var V=(function(){if(!o.addEventListener||!Object.defineProperty)return!1;var c=!1,h=Object.defineProperty({},"passive",{get:function(){c=!0}});try{const f=()=>{};o.addEventListener("test",f,h),o.removeEventListener("test",f,h)}catch{}return c})();function E(c){return/^[\s\xa0]*$/.test(c)}function Et(c,h){R.call(this,c?c.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,c&&this.init(c,h)}p(Et,R),Et.prototype.init=function(c,h){const f=this.type=c.type,m=c.changedTouches&&c.changedTouches.length?c.changedTouches[0]:null;this.target=c.target||c.srcElement,this.g=h,h=c.relatedTarget,h||(f=="mouseover"?h=c.fromElement:f=="mouseout"&&(h=c.toElement)),this.relatedTarget=h,m?(this.clientX=m.clientX!==void 0?m.clientX:m.pageX,this.clientY=m.clientY!==void 0?m.clientY:m.pageY,this.screenX=m.screenX||0,this.screenY=m.screenY||0):(this.clientX=c.clientX!==void 0?c.clientX:c.pageX,this.clientY=c.clientY!==void 0?c.clientY:c.pageY,this.screenX=c.screenX||0,this.screenY=c.screenY||0),this.button=c.button,this.key=c.key||"",this.ctrlKey=c.ctrlKey,this.altKey=c.altKey,this.shiftKey=c.shiftKey,this.metaKey=c.metaKey,this.pointerId=c.pointerId||0,this.pointerType=c.pointerType,this.state=c.state,this.i=c,c.defaultPrevented&&Et.Z.h.call(this)},Et.prototype.h=function(){Et.Z.h.call(this);const c=this.i;c.preventDefault?c.preventDefault():c.returnValue=!1};var br="closure_listenable_"+(Math.random()*1e6|0),Og=0;function Dg(c,h,f,m,b){this.listener=c,this.proxy=null,this.src=h,this.type=f,this.capture=!!m,this.ha=b,this.key=++Og,this.da=this.fa=!1}function ua(c){c.da=!0,c.listener=null,c.proxy=null,c.src=null,c.ha=null}function la(c,h,f){for(const m in c)h.call(f,c[m],m,c)}function kg(c,h){for(const f in c)h.call(void 0,c[f],f,c)}function kh(c){const h={};for(const f in c)h[f]=c[f];return h}const xh="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
1ing toString valueOf".split(" ");function Lh(c,h){let f,m;for(let b=1;b<arguments.length;b++){m=arguments[b];for(f in m)c[f]=m[f];for(let D=0;D<xh.length;D++)f=xh[D],Object.prototype.hasOwnProperty.call(m,f)&&(c[f]=m[f])}}function ha(c){this.src=c,this.g={},this.h=0}ha.prototype.add=function(c,h,f,m,b){const D=c.toString();c=this.g[D],c||(c=this.g[D]=[],this.h++);const $=_u(c,h,m,b);return $>-1?(h=c[$],f||(h.fa=!1)):(h=new Dg(h,this.src,D,!!m,b),h.fa=f,c.push(h)),h};function gu(c,h){const f=h.type;if(f in c.g){var m=c.g[f],b=Array.prototype.indexOf.call(m,h,void 0),D;(D=b>=0)&&Array.prototype.splice.call(m,b,1),D&&(ua(h),c.g[f].length==0&&(delete c.g[f],c.h--))}}function _u(c,h,f,m){for(let b=0;b<c.length;++b){const D=c[b];if(!D.da&&D.listener==h&&D.capture==!!f&&D.ha==m)return b}return-1}var yu="closure_lm_"+(Math.random()*1e6|0),Eu={};function Mh(c,h,f,m,b){if(Array.isArray(h)){for(let D=0;D<h.length;D++)Mh(c,h[D],f,m,b);return null}return f=Bh(f),c&&c[br]?c.J(h,f,a(m)?!!m.capture:!1,b):xg(c,h,f,!1,m,b)}function xg(c,h,f,m,b,D){if(!h)throw Error("Invalid event type");const $=a(b)?!!b.capture:!!b;let ie=wu(c);if(ie||(c[yu]=ie=new ha(c)),f=ie.add(h,f,m,$,D),f.proxy)return f;if(m=Lg(),f.proxy=m,m.src=c,m.listener=f,c.addEventListener)V||(b=$),b===void 0&&(b=!1),c.addEventListener(h.toString(),m,b);else if(c.attachEvent)c.attachEvent(Uh(h.toString()),m);else if(c.addListener&&c.removeListener)c.addListener(m);else throw Error("addEventListener and attachEvent are unavailable.");return f}function Lg(){function c(f){return h.call(c.src,c.listener,f)}const h=Mg;return c}function Fh(c,h,f,m,b){if(Array.isArray(h))for(var D=0;D<h.length;D++)Fh(c,h[D],f,m,b);else m=a(m)?!!m.capture:!!m,f=Bh(f),c&&c[br]?(c=c.i,D=String(h).toString(),D in c.g&&(h=c.g[D],f=_u(h,f,m,b),f>-1&&(ua(h[f]),Array.prototype.splice.call(h,f,1),h.length==0&&(delete c.g[D],c.h--)))):c&&(c=wu(c))&&(h=c.g[h.toString()],c=-1,h&&(c=_u(h,f,m,b)),(f=c>-1?h[c]:null)&&Iu(f))}function Iu(c){if(typeof c!="number"&&c&&!c.da){var h=c.src;if(h&&h[br])gu(h.i,c);else{var f=c.type,m=c.proxy;h.removeEventListener?h.removeEventListener(f,m,c.capture):h.detachEvent?h.detachEvent(Uh(f),m):h.addListener&&h.removeListener&&h.removeListener(m),(f=wu(h))?(gu(f,c),f.h==0&&(f.src=null,h[yu]=null)):ua(c)}}}function Uh(c){return c in Eu?Eu[c]:Eu[c]="on"+c}function Mg(c,h){if(c.da)c=!0;else{h=new Et(h,this);const f=c.listener,m=c.ha||c.src;c.fa&&Iu(c),c=f.call(m,h)}return c}function wu(c){return c=c[yu],c instanceof ha?c:null}var Tu="__closure_events_fn_"+(Math.random()*1e9>>>0);function Bh(c){return typeof c=="function"?c:(c[Tu]||(c[Tu]=function(h){return c.handleEvent(h)}),c[Tu])}function ot(){S.call(this),this.i=new ha(this),this.M=this,this.G=null}p(ot,S),ot.prototype[br]=!0,ot.prototype.removeEventListener=function(c,h,f,m){Fh(this,c,h,f,m)};function mt(c,h){var f,m=c.G;if(m)for(f=[];m;m=m.G)f.push(m);if(c=c.M,m=h.type||h,typeof h=="string")h=new R(h,c);else if(h instanceof R)h.target=h.target||c;else{var b=h;h=new R(m,c),Lh(h,b)}b=!0;let D,$;if(f)for($=f.length-1;$>=0;$--)D=h.g=f[$],b=da(D,m,!0,h)&&b;if(D=h.g=c,b=da(D,m,!0,h)&&b,b=da(D,m,!1,h)&&b,f)for($=0;$<f.length;$++)D=h.g=f[$],b=da(D,m,!1,h)&&b}ot.prototype.N=function(){if(ot.Z.N.call(this),this.i){var c=this.i;for(const h in c.g){const f=c.g[h];for(let m=0;m<f.length;m++)ua(f[m]);delete c.g[h],c.h--}}this.G=null},ot.prototype.J=function(c,h,f,m){return this.i.add(String(c),h,!1,f,m)},ot.prototype.K=function(c,h,f,m){return this.i.add(String(c),h,!0,f,m)};function da(c,h,f,m){if(h=c.i.g[String(h)],!h)return!0;h=h.concat();let b=!0;for(let D=0;D<h.length;++D){const $=h[D];if($&&!$.da&&$.capture==f){const ie=$.listener,je=$.ha||$.src;$.fa&&gu(c.i,$),b=ie.call(je,m)!==!1&&b}}return b&&!m.defaultPrevented}function Fg(c,h){if(typeof c!="function")if(c&&typeof c.handleEvent=="function")c=l(c.handleEvent,c);else throw Error("Invalid listener argument");return Number(h)>2147483647?-1:o.setTimeout(c,h||0)}function qh(c){c.g=Fg(()=>{c.g=null,c.i&&(c.i=!1,qh(c))},c.l);const h=c.h;c.h=null,c.m.apply(null,h)}class Ug extends S{constructor(h,f){super(),this.m=h,this.l=f,this.h=null,this.i=!1,this.g=null}j(h){this.h=arguments,this.g?this.i=!0:qh(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Ci(c){S.call(this),this.h=c,this.g={}}p(Ci,S);var Gh=[];function $h(c){la(c.g,function(h,f){this.g.hasOwnProperty(f)&&Iu(h)},c),c.g={}}Ci.prototype.N=function(){Ci.Z.N.call(this),$h(this)},Ci.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Au=o.JSON.stringify,Bg=o.JSON.parse,qg=class{stringify(c){return o.JSON.stringify(c,void 0)}parse(c){return o.JSON.parse(c,void 0)}};function jh(){}function zh(){}var bi={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function Ru(){R.call(this,"d")}p(Ru,R);function vu(){R.call(this,"c")}p(vu,R);var Nr={},Hh=null;function fa(){return Hh=Hh||new ot}Nr.Ia="serverreachability";function Wh(c){R.call(this,Nr.Ia,c)}p(Wh,R);function Ni(c){const h=fa();mt(h,new Wh(h))}Nr.STAT_EVENT="statevent";function Kh(c,h){R.call(this,Nr.STAT_EVENT,c),this.stat=h}p(Kh,R);function gt(c){const h=fa();mt(h,new Kh(h,c))}Nr.Ja="timingevent";function Qh(c,h){R.call(this,Nr.Ja,c),this.size=h}p(Qh,R);function Vi(c,h){if(typeof c!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){c()},h)}function Oi(){this.g=!0}Oi.prototype.ua=function(){this.g=!1};function Gg(c,h,f,m,b,D){c.info(function(){if(c.g)if(D){var $="",ie=D.split("&");for(let Te=0;Te<ie.length;Te++){var je=ie[Te].split("=");if(je.length>1){const Xe=je[0];je=je[1];const Jt=Xe.split("_");$=Jt.length>=2&&Jt[1]=="type"?$+(Xe+"="+je+"&"):$+(Xe+"=redacted&")}}}else $=null;else $=D;return"XMLHTTP REQ ("+m+") [attempt "+b+"]: "+h+`
2`+f+`
3`+$})}function $g(c,h,f,m,b,D,$){c.info(function(){return"XMLHTTP RESP ("+m+") [ attempt "+b+"]: "+h+`
4`+f+`
5`+D+" "+$})}function ms(c,h,f,m){c.info(function(){return"XMLHTTP TEXT ("+h+"): "+zg(c,f)+(m?" "+m:"")})}function jg(c,h){c.info(function(){return"TIMEOUT: "+h})}Oi.prototype.info=function(){};function zg(c,h){if(!c.g)return h;
5if(!h)return null;try{const D=JSON.parse(h);if(D){for(c=0;c<D.length;c++)if(Array.isArray(D[c])){var f=D[c];if(!(f.length<2)){var m=f[1];if(Array.isArray(m)&&!(m.length<1)){var b=m[0];if(b!="noop"&&b!="stop"&&b!="close")for(let $=1;$<m.length;$++)m[$]=""}}}}return Au(D)}catch{return h}}var pa={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},Yh={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"},Jh;function Su(){}p(Su,jh),Su.prototype.g=function(){return new XMLHttpRequest},Jh=new Su;function Di(c){return encodeURIComponent(String(c))}function Hg(c){var h=1;c=c.split(":");const f=[];for(;h>0&&c.length;)f.push(c.shift()),h--;return c.length&&f.push(c.join(":")),f}function Un(c,h,f,m){this.j=c,this.i=h,this.l=f,this.S=m||1,this.V=new Ci(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Xh}function Xh(){this.i=null,this.g="",this.h=!1}var Zh={},Pu={};function Cu(c,h,f){c.M=1,c.A=ga(Yt(h)),c.u=f,c.R=!0,ed(c,null)}function ed(c,h){c.F=Date.now(),ma(c),c.B=Yt(c.A);var f=c.B,m=c.S;Array.isArray(m)||(m=[String(m)]),fd(f.i,"t",m),c.C=0,f=c.j.L,c.h=new Xh,c.g=Vd(c.j,f?h:null,!c.u),c.P>0&&(c.O=new Ug(l(c.Y,c,c.g),c.P)),h=c.V,f=c.g,m=c.ba;var b="readystatechange";Array.isArray(b)||(b&&(Gh[0]=b.toString()),b=Gh);for(let D=0;D<b.length;D++){const $=Mh(f,b[D],m||h.handleEvent,!1,h.h||h);if(!$)break;h.g[$.key]=$}h=c.J?kh(c.J):{},c.u?(c.v||(c.v="POST"),h["Content-Type"]="application/x-www-form-urlencoded",c.g.ea(c.B,c.v,c.u,h)):(c.v="GET",c.g.ea(c.B,c.v,null,h)),Ni(),Gg(c.i,c.v,c.B,c.l,c.S,c.u)}Un.prototype.ba=function(c){c=c.target;const h=this.O;h&&Gn(c)==3?h.j():this.Y(c)},Un.prototype.Y=function(c){try{if(c==this.g)e:{const ie=Gn(this.g),je=this.g.ya(),Te=this.g.ca();if(!(ie<3)&&(ie!=3||this.g&&(this.h.h||this.g.la()||Id(this.g)))){this.K||ie!=4||je==7||(je==8||Te<=0?Ni(3):Ni(2)),bu(this);var h=this.g.ca();this.X=h;var f=Wg(this);if(this.o=h==200,$g(this.i,this.v,this.B,this.l,this.S,ie,h),this.o){if(this.U&&!this.L){t:{if(this.g){var m,b=this.g;if((m=b.g?b.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!E(m)){var D=m;break t}}D=null}if(c=D)ms(this.i,this.l,c,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,Nu(this,c);else{this.o=!1,this.m=3,gt(12),Vr(this),ki(this);break e}}if(this.R){c=!0;let Xe;for(;!this.K&&this.C<f.length;)if(Xe=Kg(this,f),Xe==Pu){ie==4&&(this.m=4,gt(14),c=!1),ms(this.i,this.l,null,"[Incomplete Response]");break}else if(Xe==Zh){this.m=4,gt(15),ms(this.i,this.l,f,"[Invalid Chunk]"),c=!1;break}else ms(this.i,this.l,Xe,null),Nu(this,Xe);if(td(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),ie!=4||f.length!=0||this.h.h||(this.m=1,gt(16),c=!1),this.o=this.o&&c,!c)ms(this.i,this.l,f,"[Invalid Chunked Response]"),Vr(this),ki(this);else if(f.length>0&&!this.W){this.W=!0;var $=this.j;$.g==this&&$.aa&&!$.P&&($.j.info("Great, no buffering proxy detected. Bytes received: "+f.length),Fu($),$.P=!0,gt(11))}}else ms(this.i,this.l,f,null),Nu(this,f);ie==4&&Vr(this),this.o&&!this.K&&(ie==4?Pd(this.j,this):(this.o=!1,ma(this)))}else c7(this.g),h==400&&f.indexOf("Unknown SID")>0?(this.m=3,gt(12)):(this.m=0,gt(13)),Vr(this),ki(this)}}}catch{}};function Wg(c){if(!td(c))return c.g.la();const h=Id(c.g);if(h==="")return"";let f="";const m=h.length,b=Gn(c.g)==4;if(!c.h.i){if(typeof TextDecoder>"u")return Vr(c),ki(c),"";c.h.i=new o.TextDecoder}for(let D=0;D<m;D++)c.h.h=!0,f+=c.h.i.decode(h[D],{stream:!(b&&D==m-1)});return h.length=0,c.h.g+=f,c.C=0,c.h.g}function td(c){return c.g?c.v=="GET"&&c.M!=2&&c.j.Aa:!1}function Kg(c,h){var f=c.C,m=h.indexOf(`
6`,f);return m==-1?Pu:(f=Number(h.substring(f,m)),isNaN(f)?Zh:(m+=1,m+f>h.length?Pu:(h=h.slice(m,m+f),c.C=m+f,h)))}Un.prototype.cancel=function(){this.K=!0,Vr(this)};function ma(c){c.T=Date.now()+c.H,nd(c,c.H)}function nd(c,h){if(c.D!=null)throw Error("WatchDog timer not null");c.D=Vi(l(c.aa,c),h)}function bu(c){c.D&&(o.clearTimeout(c.D),c.D=null)}Un.prototype.aa=function(){this.D=null;const c=Date.now();c-this.T>=0?(jg(this.i,this.B),this.M!=2&&(Ni(),gt(17)),Vr(this),this.m=2,ki(this)):nd(this,this.T-c)};function ki(c){c.j.I==0||c.K||Pd(c.j,c)}function Vr(c){bu(c);var h=c.O;h&&typeof h.dispose=="function"&&h.dispose(),c.O=null,$h(c.V),c.g&&(h=c.g,c.g=null,h.abort(),h.dispose())}function Nu(c,h){try{var f=c.j;if(f.I!=0&&(f.g==c||Vu(f.h,c))){if(!c.L&&Vu(f.h,c)&&f.I==3){try{var m=f.Ba.g.parse(h)}catch{m=null}if(Array.isArray(m)&&m.length==3){var b=m;if(b[0]==0){e:if(!f.v){if(f.g)if(f.g.F+3e3<c.F)wa(f),Ea(f);else break e;Mu(f),gt(18)}}else f.xa=b[1],0<f.xa-f.K&&b[2]<37500&&f.F&&f.A==0&&!f.C&&(f.C=Vi(l(f.Va,f),6e3));id(f.h)<=1&&f.ta&&(f.ta=void 0)}else Dr(f,11)}else if((c.L||f.g==c)&&wa(f),!E(h))for(b=f.Ba.g.parse(h),h=0;h<b.length;h++){let Te=b[h];const Xe=Te[0];if(!(Xe<=f.K))if(f.K=Xe,Te=Te[1],f.I==2)if(Te[0]=="c"){f.M=Te[1],f.ba=Te[2];const Jt=Te[3];Jt!=null&&(f.ka=Jt,f.j.info("VER="+f.ka));const kr=Te[4];kr!=null&&(f.za=kr,f.j.info("SVER="+f.za));const $n=Te[5];$n!=null&&typeof $n=="number"&&$n>0&&(m=1.5*$n,f.O=m,f.j.info("backChannelRequestTimeoutMs_="+m)),m=f;const jn=c.g;if(jn){const Aa=jn.g?jn.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Aa){var D=m.h;D.g||Aa.indexOf("spdy")==-1&&Aa.indexOf("quic")==-1&&Aa.indexOf("h2")==-1||(D.j=D.l,D.g=new Set,D.h&&(Ou(D,D.h),D.h=null))}if(m.G){const Uu=jn.g?jn.g.getResponseHeader("X-HTTP-Session-Id"):null;
6Uu&&(m.wa=Uu,Pe(m.J,m.G,Uu))}}f.I=3,f.l&&f.l.ra(),f.aa&&(f.T=Date.now()-c.F,f.j.info("Handshake RTT: "+f.T+"ms")),m=f;var $=c;if(m.na=Nd(m,m.L?m.ba:null,m.W),$.L){od(m.h,$);var ie=$,je=m.O;je&&(ie.H=je),ie.D&&(bu(ie),ma(ie)),m.g=$}else vd(m);f.i.length>0&&Ia(f)}else Te[0]!="stop"&&Te[0]!="close"||Dr(f,7);else f.I==3&&(Te[0]=="stop"||Te[0]=="close"?Te[0]=="stop"?Dr(f,7):Lu(f):Te[0]!="noop"&&f.l&&f.l.qa(Te),f.A=0)}}Ni(4)}catch{}}var Qg=class{constructor(c,h){this.g=c,this.map=h}};function rd(c){this.l=c||10,o.PerformanceNavigationTiming?(c=o.performance.getEntriesByType("navigation"),c=c.length>0&&(c[0].nextHopProtocol=="hq"||c[0].nextHopProtocol=="h2")):c=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=c?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function sd(c){return c.h?!0:c.g?c.g.size>=c.j:!1}function id(c){return c.h?1:c.g?c.g.size:0}function Vu(c,h){return c.h?c.h==h:c.g?c.g.has(h):!1}function Ou(c,h){c.g?c.g.add(h):c.h=h}function od(c,h){c.h&&c.h==h?c.h=null:c.g&&c.g.has(h)&&c.g.delete(h)}rd.prototype.cancel=function(){if(this.i=ad(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const c of this.g.values())c.cancel();this.g.clear()}};function ad(c){if(c.h!=null)return c.i.concat(c.h.G);if(c.g!=null&&c.g.size!==0){let h=c.i;for(const f of c.g.values())h=h.concat(f.G);return h}return I(c.i)}var cd=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Yg(c,h){if(c){c=c.split("&");for(let f=0;f<c.length;f++){const m=c[f].indexOf("=");let b,D=null;m>=0?(b=c[f].substring(0,m),D=c[f].substring(m+1)):b=c[f],h(b,D?decodeURIComponent(D.replace(/\+/g," ")):"")}}}function Bn(c){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let h;c instanceof Bn?(this.l=c.l,xi(this,c.j),this.o=c.o,this.g=c.g,Li(this,c.u),this.h=c.h,Du(this,pd(c.i)),this.m=c.m):c&&(h=String(c).match(cd))?(this.l=!1,xi(this,h[1]||"",!0),this.o=Mi(h[2]||""),this.g=Mi(h[3]||"",!0),Li(this,h[4]),this.h=Mi(h[5]||"",!0),Du(this,h[6]||"",!0),this.m=Mi(h[7]||"")):(this.l=!1,this.i=new Ui(null,this.l))}Bn.prototype.toString=function(){const c=[];var h=this.j;h&&c.push(Fi(h,ud,!0),":");var f=this.g;return(f||h=="file")&&(c.push("//"),(h=this.o)&&c.push(Fi(h,ud,!0),"@"),c.push(Di(f).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),f=this.u,f!=null&&c.push(":",String(f))),(f=this.h)&&(this.g&&f.charAt(0)!="/"&&c.push("/"),c.push(Fi(f,f.charAt(0)=="/"?Zg:Xg,!0))),(f=this.i.toString())&&c.push("?",f),(f=this.m)&&c.push("#",Fi(f,t7)),c.join("")},Bn.prototype.resolve=function(c){const h=Yt(this);let f=!!c.j;f?xi(h,c.j):f=!!c.o,f?h.o=c.o:f=!!c.g,f?h.g=c.g:f=c.u!=null;var m=c.h;if(f)Li(h,c.u);else if(f=!!c.h){if(m.charAt(0)!="/")if(this.g&&!this.h)m="/"+m;else{var b=h.h.lastIndexOf("/");b!=-1&&(m=h.h.slice(0,b+1)+m)}if(b=m,b==".."||b==".")m="";else if(b.indexOf("./")!=-1||b.indexOf("/.")!=-1){m=b.lastIndexOf("/",0)==0,b=b.split("/");const D=[];for(let $=0;$<b.length;){const ie=b[$++];ie=="."?m&&$==b.length&&D.push(""):ie==".."?((D.length>1||D.length==1&&D[0]!="")&&D.pop(),m&&$==b.length&&D.push("")):(D.push(ie),m=!0)}m=D.join("/")}else m=b}return f?h.h=m:f=c.i.toString()!=="",f?Du(h,pd(c.i)):f=!!c.m,f&&(h.m=c.m),h};function Yt(c){return new Bn(c)}function xi(c,h,f){c.j=f?Mi(h,!0):h,c.j&&(c.j=c.j.replace(/:$/,""))}function Li(c,h){if(h){if(h=Number(h),isNaN(h)||h<0)throw Error("Bad port number "+h);c.u=h}else c.u=null}function Du(c,h,f){h instanceof Ui?(c.i=h,n7(c.i,c.l)):(f||(h=Fi(h,e7)),c.i=new Ui(h,c.l))}function Pe(c,h,f){c.i.set(h,f)}function ga(c){return Pe(c,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),c}function Mi(c,h){return c?h?decodeURI(c.replace(/%25/g,"%2525")):decodeURIComponent(c):""}function Fi(c,h,f){return typeof c=="string"?(c=encodeURI(c).replace(h,Jg),f&&(c=c.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c):null}function Jg(c){return c=c.charCodeAt(0),"%"+(c>>4&15).toString(16)+(c&15).toString(16)}var ud=/[#\/\?@]/g,Xg=/[#\?:]/g,Zg=/[#\?]/g,e7=/[#\?@]/g,t7=/#/g;function Ui(c,h){this.h=this.g=null,this.i=c||null,this.j=!!h}function Or(c){c.g||(c.g=new Map,c.h=0,c.i&&Yg(c.i,function(h,f){c.add(decodeURIComponent(h.replace(/\+/g," ")),f)}))}r=Ui.prototype,r.add=function(c,h){Or(this),this.i=null,c=gs(this,c);let f=this.g.get(c);return f||this.g.set(c,f=[]),f.push(h),this.h+=1,this};function ld(c,h){Or(c),h=gs(c,h),c.g.has(h)&&(c.i=null,c.h-=c.g.get(h).length,c.g.delete(h))}function hd(c,h){return Or(c),h=gs(c,h),c.g.has(h)}r.forEach=function(c,h){Or(this),this.g.forEach(function(f,m){f.forEach(function(b){c.call(h,b,m,this)},this)},this)};function dd(c,h){Or(c);let f=[];
vendor: 8,495 bytes, lines 6-9
6if(typeof h=="string")hd(c,h)&&(f=f.concat(c.g.get(gs(c,h))));else for(c=Array.from(c.g.values()),h=0;h<c.length;h++)f=f.concat(c[h]);return f}r.set=function(c,h){return Or(this),this.i=null,c=gs(this,c),hd(this,c)&&(this.h-=this.g.get(c).length),this.g.set(c,[h]),this.h+=1,this},r.get=function(c,h){return c?(c=dd(this,c),c.length>0?String(c[0]):h):h};function fd(c,h,f){ld(c,h),f.length>0&&(c.i=null,c.g.set(gs(c,h),I(f)),c.h+=f.length)}r.toString=function(){if(this.i)return this.i;if(!this.g)return"";const c=[],h=Array.from(this.g.keys());for(let m=0;m<h.length;m++){var f=h[m];const b=Di(f);f=dd(this,f);for(let D=0;D<f.length;D++){let $=b;f[D]!==""&&($+="="+Di(f[D])),c.push($)}}return this.i=c.join("&")};function pd(c){const h=new Ui;return h.i=c.i,c.g&&(h.g=new Map(c.g),h.h=c.h),h}function gs(c,h){return h=String(h),c.j&&(h=h.toLowerCase()),h}function n7(c,h){h&&!c.j&&(Or(c),c.i=null,c.g.forEach(function(f,m){const b=m.toLowerCase();m!=b&&(ld(this,m),fd(this,b,f))},c)),c.j=h}function r7(c,h){const f=new Oi;if(o.Image){const m=new Image;m.onload=d(qn,f,"TestLoadImage: loaded",!0,h,m),m.onerror=d(qn,f,"TestLoadImage: error",!1,h,m),m.onabort=d(qn,f,"TestLoadImage: abort",!1,h,m),m.ontimeout=d(qn,f,"TestLoadImage: timeout",!1,h,m),o.setTimeout(function(){m.ontimeout&&m.ontimeout()},1e4),m.src=c}else h(!1)}function s7(c,h){const f=new Oi,m=new AbortController,b=setTimeout(()=>{m.abort(),qn(f,"TestPingServer: timeout",!1,h)},1e4);fetch(c,{signal:m.signal}).then(D=>{clearTimeout(b),D.ok?qn(f,"TestPingServer: ok",!0,h):qn(f,"TestPingServer: server error",!1,h)}).catch(()=>{clearTimeout(b),qn(f,"TestPingServer: error",!1,h)})}function qn(c,h,f,m,b){try{b&&(b.onload=null,b.onerror=null,b.onabort=null,b.ontimeout=null),m(f)}catch{}}function i7(){this.g=new qg}function ku(c){this.i=c.Sb||null,this.h=c.ab||!1}p(ku,jh),ku.prototype.g=function(){return new _a(this.i,this.h)};function _a(c,h){ot.call(this),this.H=c,this.o=h,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}p(_a,ot),r=_a.prototype,r.open=function(c,h){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=c,this.D=h,this.readyState=1,qi(this)},r.send=function(c){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const h={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};c&&(h.body=c),(this.H||o).fetch(new Request(this.D,h)).then(this.Pa.bind(this),this.ga.bind(this))},r.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,Bi(this)),this.readyState=0},r.Pa=function(c){if(this.g&&(this.l=c,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=c.headers,this.readyState=2,qi(this)),this.g&&(this.readyState=3,qi(this),this.g)))if(this.responseType==="arraybuffer")c.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in c){if(this.j=c.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;md(this)}else c.text().then(this.Oa.bind(this),this.ga.bind(this))};function md(c){c.j.read().then(c.Ma.bind(c)).catch(c.ga.bind(c))}r.Ma=function(c){if(this.g){if(this.o&&c.value)this.response.push(c.value);else if(!this.o){var h=c.value?c.value:new Uint8Array(0);(h=this.B.decode(h,{stream:!c.done}))&&(this.response=this.responseText+=h)}c.done?Bi(this):qi(this),this.readyState==3&&md(this)}},r.Oa=function(c){this.g&&(this.response=this.responseText=c,Bi(this))},r.Na=function(c){this.g&&(this.response=c,Bi(this))},r.ga=function(){this.g&&Bi(this)};function Bi(c){c.readyState=4,c.l=null,c.j=null,c.B=null,qi(c)}r.setRequestHeader=function(c,h){this.A.append(c,h)},r.getResponseHeader=function(c){return this.h&&this.h.get(c.toLowerCase())||""},r.getAllResponseHeaders=function(){if(!this.h)return"";const c=[],h=this.h.entries();for(var f=h.next();!f.done;)f=f.value,c.push(f[0]+": "+f[1]),f=h.next();return c.join(`\r
7`)};function qi(c){c.onreadystatechange&&c.onreadystatechange.call(c)}Object.defineProperty(_a.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(c){this.m=c?"include":"same-origin"}});function gd(c){let h="";return la(c,function(f,m){h+=m,h+=":",h+=f,h+=`\r
8`}),h}function xu(c,h,f){e:{for(m in f){var m=!1;break e}m=!0}m||(f=gd(f),typeof c=="string"?f!=null&&Di(f):Pe(c,h,f))}function Ve(c){ot.call(this),this.headers=new Map,this.L=c||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}p(Ve,ot);var o7=/^https?$/i,a7=["POST","PUT"];r=Ve.prototype,r.Fa=function(c){this.H=c},r.ea=function(c,h,f,m){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+c);h=h?h.toUpperCase():"GET",this.D=c,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Jh.g(),this.g.onreadystatechange=g(l(this.Ca,this));try{this.B=!0,this.g.open(h,String(c),!0),this.B=!1}catch(D){_d(this,D);return}if(c=f||"",f=new Map(this.headers),m)if(Object.getPrototypeOf(m)===Object.prototype)for(var b in m)f.set(b,m[b]);else if(typeof m.keys=="function"&&typeof m.get=="function")for(const D of m.keys())f.set(D,m.get(D));else throw Error("Unknown input type for opt_headers: "+String(m));m=Array.from(f.keys()).find(D=>D.toLowerCase()=="content-type"),b=o.FormData&&c instanceof o.FormData,!(Array.prototype.indexOf.call(a7,h,void 0)>=0)||m||b||f.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[D,$]of f)this.g.setRequestHeader(D,$);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(c),this.v=!1}catch(D){_d(this,D)}};function _d(c,h){c.h=!1,c.g&&(c.j=!0,c.g.abort(),c.j=!1),c.l=h,c.o=5,yd(c),ya(c)}function yd(c){c.A||(c.A=!0,mt(c,"complete"),mt(c,"error"))}r.abort=function(c){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=c||7,mt(this,"complete"),mt(this,"abort"),ya(this))},r.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),ya(this,!0)),Ve.Z.N.call(this)},r.Ca=function(){this.u||(this.B||this.v||this.j?Ed(this):this.Xa())},r.Xa=function(){Ed(this)};function Ed(c){if(c.h&&typeof i<"u"){if(c.v&&Gn(c)==4)setTimeout(c.Ca.bind(c),0);else if(mt(c,"readystatechange"),Gn(c)==4){c.h=!1;try{const D=c.ca();e:switch(D){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var h=!0;break e;default:h=!1}var f;if(!(f=h)){var m;if(m=D===0){let $=String(c.D).match(cd)[1]||null;!$&&o.self&&o.self.location&&($=o.self.location.protocol.slice(0,-1)),m=!o7.test($?$.toLowerCase():"")}f=m}if(f)mt(c,"complete"),mt(c,"success");else{c.o=6;try{var b=Gn(c)>2?c.g.statusText:""}catch{b=""}c.l=b+" ["+c.ca()+"]",yd(c)}}finally{ya(c)}}}}function ya(c,h){if(c.g){c.m&&(clearTimeout(c.m),c.m=null);const f=c.g;c.g=null,h||mt(c,"ready");try{f.onreadystatechange=null}catch{}}}r.isActive=function(){return!!this.g};function Gn(c){return c.g?c.g.readyState:0}r.ca=function(){try{return Gn(this)>2?this.g.status:-1}catch{return-1}},r.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},r.La=function(c){if(this.g){var h=this.g.responseText;return c&&h.indexOf(c)==0&&(h=h.substring(c.length)),Bg(h)}};function Id(c){try{if(!c.g)return null;if("response"in c.g)return c.g.response;switch(c.F){case"":case"text":return c.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in c.g)return c.g.mozResponseArrayBuffer}return null}catch{return null}}function c7(c){const h={};c=(c.g&&Gn(c)>=2&&c.g.getAllResponseHeaders()||"").split(`\r
9`);for(let m=0;m<c.length;m++){if(E(c[m]))continue;var f=Hg(c[m]);const b=f[0];if(f=f[1],typeof f!="string")continue;f=f.trim();const D=h[b]||[];h[b]=D,D.push(f)}kg(h,function(m){return m.join(", ")})}r.ya=function(){return this.o},r.Ha=function(){return typeof this.l=="string"?this.l:String(this.l)};
vendor: 4,168 bytes, line 9
9function Gi(c,h,f){return f&&f.internalChannelParams&&f.internalChannelParams[c]||h}function wd(c){this.za=0,this.i=[],this.j=new Oi,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=Gi("failFast",!1,c),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Gi("baseRetryDelayMs",5e3,c),this.Za=Gi("retryDelaySeedMs",1e4,c),this.Ta=Gi("forwardChannelMaxRetries",2,c),this.va=Gi("forwardChannelRequestTimeoutMs",2e4,c),this.ma=c&&c.xmlHttpFactory||void 0,this.Ua=c&&c.Rb||void 0,this.Aa=c&&c.useFetchStreams||!1,this.O=void 0,this.L=c&&c.supportsCrossDomainXhr||!1,this.M="",this.h=new rd(c&&c.concurrentRequestLimit),this.Ba=new i7,this.S=c&&c.fastHandshake||!1,this.R=c&&c.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=c&&c.Pb||!1,c&&c.ua&&this.j.ua(),c&&c.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&c&&c.detectBufferingProxy||!1,this.ia=void 0,c&&c.longPollingTimeout&&c.longPollingTimeout>0&&(this.ia=c.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}r=wd.prototype,r.ka=8,r.I=1,r.connect=function(c,h,f,m){gt(0),this.W=c,this.H=h||{},f&&m!==void 0&&(this.H.OSID=f,this.H.OAID=m),this.F=this.X,this.J=Nd(this,null,this.W),Ia(this)};function Lu(c){if(Td(c),c.I==3){var h=c.V++,f=Yt(c.J);if(Pe(f,"SID",c.M),Pe(f,"RID",h),Pe(f,"TYPE","terminate"),$i(c,f),h=new Un(c,c.j,h),h.M=2,h.A=ga(Yt(f)),f=!1,o.navigator&&o.navigator.sendBeacon)try{f=o.navigator.sendBeacon(h.A.toString(),"")}catch{}!f&&o.Image&&(new Image().src=h.A,f=!0),f||(h.g=Vd(h.j,null),h.g.ea(h.A)),h.F=Date.now(),ma(h)}bd(c)}function Ea(c){c.g&&(Fu(c),c.g.cancel(),c.g=null)}function Td(c){Ea(c),c.v&&(o.clearTimeout(c.v),c.v=null),wa(c),c.h.cancel(),c.m&&(typeof c.m=="number"&&o.clearTimeout(c.m),c.m=null)}function Ia(c){if(!sd(c.h)&&!c.m){c.m=!0;var h=c.Ea;Ie||_(),pe||(Ie(),pe=!0),T.add(h,c),c.D=0}}function u7(c,h){return id(c.h)>=c.h.j-(c.m?1:0)?!1:c.m?(c.i=h.G.concat(c.i),!0):c.I==1||c.I==2||c.D>=(c.Sa?0:c.Ta)?!1:(c.m=Vi(l(c.Ea,c,h),Cd(c,c.D)),c.D++,!0)}r.Ea=function(c){if(this.m)if(this.m=null,this.I==1){if(!c){this.V=Math.floor(Math.random()*1e5),c=this.V++;const b=new Un(this,this.j,c);let D=this.o;if(this.U&&(D?(D=kh(D),Lh(D,this.U)):D=this.U),this.u!==null||this.R||(b.J=D,D=null),this.S)e:{for(var h=0,f=0;f<this.i.length;f++){t:{var m=this.i[f];if("__data__"in m.map&&(m=m.map.__data__,typeof m=="string")){m=m.length;break t}m=void 0}if(m===void 0)break;if(h+=m,h>4096){h=f;break e}if(h===4096||f===this.i.length-1){h=f+1;break e}}h=1e3}else h=1e3;h=Rd(this,b,h),f=Yt(this.J),Pe(f,"RID",c),Pe(f,"CVER",22),this.G&&Pe(f,"X-HTTP-Session-Id",this.G),$i(this,f),D&&(this.R?h="headers="+Di(gd(D))+"&"+h:this.u&&xu(f,this.u,D)),Ou(this.h,b),this.Ra&&Pe(f,"TYPE","init"),this.S?(Pe(f,"$req",h),Pe(f,"SID","null"),b.U=!0,Cu(b,f,null)):Cu(b,f,h),this.I=2}}else this.I==3&&(c?Ad(this,c):this.i.length==0||sd(this.h)||Ad(this))};function Ad(c,h){var f;h?f=h.l:f=c.V++;const m=Yt(c.J);Pe(m,"SID",c.M),Pe(m,"RID",f),Pe(m,"AID",c.K),$i(c,m),c.u&&c.o&&xu(m,c.u,c.o),f=new Un(c,c.j,f,c.D+1),c.u===null&&(f.J=c.o),h&&(c.i=h.G.concat(c.i)),h=Rd(c,f,1e3),f.H=Math.round(c.va*.5)+Math.round(c.va*.5*Math.random()),Ou(c.h,f),Cu(f,m,h)}function $i(c,h){c.H&&la(c.H,function(f,m){Pe(h,m,f)}),c.l&&la({},function(f,m){Pe(h,m,f)})}function Rd(c,h,f){f=Math.min(c.i.length,f);const m=c.l?l(c.l.Ka,c.l,c):null;e:{var b=c.i;let ie=-1;for(;;){const je=["count="+f];ie==-1?f>0?(ie=b[0].g,je.push("ofs="+ie)):ie=0:je.push("ofs="+ie);let Te=!0;for(let Xe=0;Xe<f;Xe++){var D=b[Xe].g;const Jt=b[Xe].map;if(D-=ie,D<0)ie=Math.max(0,b[Xe].g-100),Te=!1;else try{D="req"+D+"_"||"";try{var $=Jt instanceof Map?Jt:Object.entries(Jt);for(const[kr,$n]of $){let jn=$n;a($n)&&(jn=Au($n)),je.push(D+kr+"="+encodeURIComponent(jn))}}catch(kr){throw je.push(D+"type="+encodeURIComponent("_badmap")),kr}}catch{m&&m(Jt)}}if(Te){$=je.join("&");break e}}$=void 0}return c=c.i.splice(0,f),h.G=c,$}function vd(c){if(!c.g&&!c.v){c.Y=1;var h=c.Da;Ie||_(),pe||(Ie(),pe=!0),T.add(h,c),c.A=0}}function Mu(c){return c.g||c.v||c.A>=3?!1:(c.Y++,c.v=Vi(l(c.Da,c),Cd(c,c.A)),c.A++,!0)}
vendor: 4,847 bytes, line 9
9r.Da=function(){if(this.v=null,Sd(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var c=4*this.T;this.j.info("BP detection timer enabled: "+c),this.B=Vi(l(this.Wa,this),c)}},r.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,gt(10),Ea(this),Sd(this))};function Fu(c){c.B!=null&&(o.clearTimeout(c.B),c.B=null)}function Sd(c){c.g=new Un(c,c.j,"rpc",c.Y),c.u===null&&(c.g.J=c.o),c.g.P=0;var h=Yt(c.na);Pe(h,"RID","rpc"),Pe(h,"SID",c.M),Pe(h,"AID",c.K),Pe(h,"CI",c.F?"0":"1"),!c.F&&c.ia&&Pe(h,"TO",c.ia),Pe(h,"TYPE","xmlhttp"),$i(c,h),c.u&&c.o&&xu(h,c.u,c.o),c.O&&(c.g.H=c.O);var f=c.g;c=c.ba,f.M=1,f.A=ga(Yt(h)),f.u=null,f.R=!0,ed(f,c)}r.Va=function(){this.C!=null&&(this.C=null,Ea(this),Mu(this),gt(19))};function wa(c){c.C!=null&&(o.clearTimeout(c.C),c.C=null)}function Pd(c,h){var f=null;if(c.g==h){wa(c),Fu(c),c.g=null;var m=2}else if(Vu(c.h,h))f=h.G,od(c.h,h),m=1;else return;if(c.I!=0){if(h.o)if(m==1){f=h.u?h.u.length:0,h=Date.now()-h.F;var b=c.D;m=fa(),mt(m,new Qh(m,f)),Ia(c)}else vd(c);else if(b=h.m,b==3||b==0&&h.X>0||!(m==1&&u7(c,h)||m==2&&Mu(c)))switch(f&&f.length>0&&(h=c.h,h.i=h.i.concat(f)),b){case 1:Dr(c,5);break;case 4:Dr(c,10);break;case 3:Dr(c,6);break;default:Dr(c,2)}}}function Cd(c,h){let f=c.Qa+Math.floor(Math.random()*c.Za);return c.isActive()||(f*=2),f*h}function Dr(c,h){if(c.j.info("Error code "+h),h==2){var f=l(c.bb,c),m=c.Ua;const b=!m;m=new Bn(m||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||xi(m,"https"),ga(m),b?r7(m.toString(),f):s7(m.toString(),f)}else gt(2);c.I=0,c.l&&c.l.pa(h),bd(c),Td(c)}r.bb=function(c){c?(this.j.info("Successfully pinged google.com"),gt(2)):(this.j.info("Failed to ping google.com"),gt(1))};function bd(c){if(c.I=0,c.ja=[],c.l){const h=ad(c.h);(h.length!=0||c.i.length!=0)&&(v(c.ja,h),v(c.ja,c.i),c.h.i.length=0,I(c.i),c.i.length=0),c.l.oa()}}function Nd(c,h,f){var m=f instanceof Bn?Yt(f):new Bn(f);if(m.g!="")h&&(m.g=h+"."+m.g),Li(m,m.u);else{var b=o.location;m=b.protocol,h=h?h+"."+b.hostname:b.hostname,b=+b.port;const D=new Bn(null);m&&xi(D,m),h&&(D.g=h),b&&Li(D,b),f&&(D.h=f),m=D}return f=c.G,h=c.wa,f&&h&&Pe(m,f,h),Pe(m,"VER",c.ka),$i(c,m),m}function Vd(c,h,f){if(h&&!c.L)throw Error("Can't create secondary domain capable XhrIo object.");return h=c.Aa&&!c.ma?new Ve(new ku({ab:f})):new Ve(c.ma),h.Fa(c.L),h}r.isActive=function(){return!!this.l&&this.l.isActive(this)};function Od(){}r=Od.prototype,r.ra=function(){},r.qa=function(){},r.pa=function(){},r.oa=function(){},r.isActive=function(){return!0},r.Ka=function(){};function Ta(){}Ta.prototype.g=function(c,h){return new bt(c,h)};function bt(c,h){ot.call(this),this.g=new wd(h),this.l=c,this.h=h&&h.messageUrlParams||null,c=h&&h.messageHeaders||null,h&&h.clientProtocolHeaderRequired&&(c?c["X-Client-Protocol"]="webchannel":c={"X-Client-Protocol":"webchannel"}),this.g.o=c,c=h&&h.initMessageHeaders||null,h&&h.messageContentType&&(c?c["X-WebChannel-Content-Type"]=h.messageContentType:c={"X-WebChannel-Content-Type":h.messageContentType}),h&&h.sa&&(c?c["X-WebChannel-Client-Profile"]=h.sa:c={"X-WebChannel-Client-Profile":h.sa}),this.g.U=c,(c=h&&h.Qb)&&!E(c)&&(this.g.u=c),this.A=h&&h.supportsCrossDomainXhr||!1,this.v=h&&h.sendRawJson||!1,(h=h&&h.httpSessionIdParam)&&!E(h)&&(this.g.G=h,c=this.h,c!==null&&h in c&&(c=this.h,h in c&&delete c[h])),this.j=new _s(this)}p(bt,ot),bt.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},bt.prototype.close=function(){Lu(this.g)},bt.prototype.o=function(c){var h=this.g;if(typeof c=="string"){var f={};f.__data__=c,c=f}else this.v&&(f={},f.__data__=Au(c),c=f);h.i.push(new Qg(h.Ya++,c)),h.I==3&&Ia(h)},bt.prototype.N=function(){this.g.l=null,delete this.j,Lu(this.g),delete this.g,bt.Z.N.call(this)};function Dd(c){Ru.call(this),c.__headers__&&(this.headers=c.__headers__,this.statusCode=c.__status__,delete c.__headers__,delete c.__status__);var h=c.__sm__;if(h){e:{for(const f in h){c=f;break e}c=void 0}(this.i=c)&&(c=this.i,h=h!==null&&c in h?h[c]:void 0),this.data=h}else this.data=c}p(Dd,Ru);function kd(){vu.call(this),this.status=1}p(kd,vu);function _s(c){this.g=c}p(_s,Od),_s.prototype.ra=function(){mt(this.g,"a")},_s.prototype.qa=function(c){mt(this.g,new Dd(c))},_s.prototype.pa=function(c){mt(this.g,new kd)},_s.prototype.oa=function(){mt(this.g,"b")},Ta.prototype.createWebChannel=Ta.prototype.g,bt.prototype.send=bt.prototype.o,bt.prototype.open=bt.prototype.m,bt.prototype.close=bt.prototype.close,bp=function(){return new Ta},Cp=function(){return fa()},Pp=Nr,ul={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},pa.NO_ERROR=0,pa.TIMEOUT=8,pa.HTTP_ERROR=6,Ma=pa,Yh.COMPLETE="complete",
9Sp=Yh,zh.EventType=bi,bi.OPEN="a",bi.CLOSE="b",bi.ERROR="c",bi.MESSAGE="d",ot.prototype.listen=ot.prototype.J,Zi=zh,Ve.prototype.listenOnce=Ve.prototype.K,Ve.prototype.getLastError=Ve.prototype.Ha,Ve.prototype.getLastErrorCode=Ve.prototype.ya,Ve.prototype.getStatus=Ve.prototype.ca,Ve.prototype.getResponseJson=Ve.prototype.La,Ve.prototype.getResponseText=Ve.prototype.la,Ve.prototype.send=Ve.prototype.ea,Ve.prototype.setWithCredentials=Ve.prototype.Fa,vp=Ve}).apply(typeof Ra<"u"?Ra:typeof self<"u"?self:typeof window<"u"?window:{});class j{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=j.CLASS_NL|j.DOT_NL;static PERL=j.CLASS_NL|j.ONE_LINE|j.PERL_X|j.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2}class O{static CODES=new Map([["\x07",7],["\b",8],["	",9],[`
10`,10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]);static toUpperCase(e){const t=String.fromCodePoint(e).toUpperCase();if(t.length>1)return e;const n=String.fromCodePoint(t.codePointAt(0)).toLowerCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){const t=String.fromCodePoint(e).toLowerCase();if(t.length>1)return e;const n=String.fromCodePoint(t.codePointAt(0)).toUpperCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}}class y{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66
10755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[937
1077,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=[[0,31,1],[127,159,1],[173,888,715],[889,896,7],[897,899,1],[907,909,2],[930,1328,398],[1367,1368,1],[1419,1420,1],[1424,1480,56],[1481,1487,1],[1515,1518,1],[1525,1541,1],[1564,1757,193],[1806,1807,1],[1867,1868,1],[1970,1983,1],[2043,2044,1],[2094,2095,1],[2111,2140,29],[2141,2143,2],[2155,2159,1],[2191,2199,1],[2274,2436,162],[2445,2446,1],[2449,2450,1],[2473,2481,8],[2483,2485,1],[2490,2491,1],[2501,2502,1],[2505,2506,1],[2511,2518,1],[2520,2523,1],[2526,2532,6],[2533,2559,26],[2560,2564,4],[2571,2574,1],[2577,2578,1],[2601,2609,8],[2612,2618,3],[2619,2621,2],[2627,2630,1],[2633,2634,1],[2638,2640,1],[2642,2648,1],[2653,2655,2],[2656,2661,1],[2679,2688,1],[2692,2702,10],[2706,2729,23],[2737,2740,3],[2746,2747,1],[2758,2766,4],[2767,2769,2],[2770,2783,1],[2788,2789,1],[2802,2808,1],[2816,2820,4],[2829,2830,1],[2833,2834,1],[2857,2865,8],[2868,2874,6],[2875,2885,10],[2886,2889,3],[2890,2894,4],[2895,2900,1],[2904,2907,1],[2910,2916,6],[2917,2936,19],[2937,2945,1],[2948,2955,7],[2956,2957,1],[2961,2966,5],[2967,2968,1],[2971,2973,2],[2976,2978,1],[2981,2983,1],[2987,2989,1],[3002,3005,1],[3011,3013,1],[3017,3022,5],[3023,3025,2],[3026,3030,1],[3032,3045,1],[3067,3071,1],[3085,3089,4],[3113,3130,17],[3131,3141,10],[3145,3150,5],[3151,3156,1],[3159,3163,4],[3164,3166,2],[3167,3172,5],[3173,3184,11],[3185,3190,1],[3213,3217,4],[3241,3252,11],[3258,3259,1],[3269,3273,4],[3278,3284,1],[3287,3292,1],[3295,3300,5],[3301,3312,11],[3316,3327,1],[3341,3345,4],[3397,3401,4],[3408,3411,1],[3428,3429,1],[3456,3460,4],[3479,3481,1],[3506,3516,10],[3518,3519,1],[3527,3529,1],[3531,3534,1],[3541,3543,2],[3552,3557,1],[3568,3569,1],[3573,3584,1],[3643,3646,1],[3676,3712,1],[3715,3717,2],[3723,3748,25],[3750,3774,24],[3775,3781,6],[3783,3791,8],[3802,3803,1],[3808,3839,1],[3912,3949,37],[3950,3952,1],[3992,4029,37],[4045,4059,14],[4060,4095,1],[4294,4296,2],[4297,4300,1],[4302,4303,1],[4681,4686,5],[4687,4695,8],[4697,4702,5],[4703,4745,42],[4750,4751,1],[4785,4790,5],[4791,4799,8],[4801,4806,5],[4807,4823,16],[4881,4886,5],[4887,4955,68],[4956,4989,33],[4990,4991,1],[5018,5023,1],[5110,5111,1],[5118,5119,1],[5789,5791,1],[5881,5887,1],[5910,5918,1],[5943,5951,1],[5972,5983,1],[5997,6001,4],[6004,6015,1],[6110,6111,1],[6122,6127,1],[6138,6143,1],[6158,6170,12],[6171,6175,1],[6265,6271,1],[6315,6319,1],[6390,6399,1],[6431,6444,13],[6445,6447,1],[6460,6463,1],[6465,6467,1],[6510,6511,1],[6517,6527,1],[6572,6575,1],[6602,6607,1],[6619,6621,1],[6684,6685,1],[6751,6781,30],[6782,6794,12],[6795,6799,1],[6810,6815,1],[6830,6831,1],[6863,6911,1],[6989,6991,1],[7039,7156,117],[7157,7163,1],[7224,7226,1],[7242,7244,1],[7305,7311,1],[7355,7356,1],[7368,7375,1],[7419,7423,1],[7958,7959,1],[7966,7967,1],[8006,8007,1],[8014,8015,1],[8024,8030,2],[8062,8063,1],[8117,8133,16],[8148,8149,1],[8156,8176,20],[8177,8181,4],[8191,8203,12],[8204,8207,1],[8234,8238,1],[8288,8303,1],[8306,8307,1],[8335,8349,14],[8350,8351,1],[8385,8399,1],[8433,8447,1],[8588,8591,1],[9255,9279,1],[9291,9311,1],[11124,11125,1],[11158,11508,350],[11509,11512,1],[11558,11560,2],[11561,11564,1],[11566,11567,1],[11624,11630,1],[11633,11646,1],[11671,11679,1],[11687,11743,8],[11870,11903,1],[11930,12020,90],[12021,12031,1],[12246,12271,1],[12352,12439,87],[12440,12544,104],[12545,12548,1],[12592,12687,95],[12772,12782,1],[12831,42125,29294],[42126,42127,1],[42183,42191,1],[42540,42559,1],[42744,42751,1],[42955,42959,1],[42962,42964,2],[42970,42993,1],[43053,43055,1],[43066,43071,1],[43128,43135,1],[43206,43213,1],[43226,43231,1],[43348,43358,1],[43389,43391,1],[43470,43482,12],[43483,43485,1],[43519,43575,56],[43576,43583,1],[43598,43599,1],[43610,43611,1],[43715,43738,1],[43767,43776,1],[43783,43784,1],[43791,43792,1],[43799,43807,1],[43815,43823,8],[43884,43887,1],[44014,44015,1],[44026,44031,1],[55204,55215,1],[55239,55242,1],[55292,63743,1],[64110,64111,1],[64218,64255,1],[64263,64274,1],[64280,64284,1],[64311,64317,6],[64319,64325,3],[64451,64466,1],[64912,64913,1],[64968,64974,1],[64976,65007,1],[65050,65055,1],[65107,65127,20],[65132,65135,1],[65141,65277,136],[65278,65280,1],[65471,65473,1],[65480,65481,1],[65488,65489,1],[65496,65497,1],[65501,65503,1],[65511,65519,8],[65520,65531,1],[65534,65535,1],[65548,65575,27],[65595,65598,3],[65614,65615,1],[65630,65663,1],[65787,65791,1],[65795,65798,1],[65844,65846,1],[65935,65949,14],[65950,65951,1],[65953,65999,1],[66046,66175,1],[66205,66207,1],[66257,66271,1],[66300,66303,1],[66340,66348,1],[66379,66383,1],[66427,66431,1],[66462,66500,38],[66501,66503,1],[66518,66559,1],[66718,66719,1],[66730,66735,1],[66772,66775,1],[66812,66815,1],[66856,66863,1],[66916,66926,1],[66939,66955,16],[66963,66966,3],[66978,66994,16],[67002,67005,3],[67006,67071,1],[67383,67391,1],[67414,67423,1],[67432,67455,1],[67462,67505,43],[67515,67583,1],[67590,67591,1],[67593,67638,45],[67641,67643,1],[67645,67646,1],[67670,67743,73],[67744,67750,1],[67760,67807,1],[67827,67830,3],[67831,67834,1],[67868,67870,1],[67898,67902,1],[67904,67967,1],[68024,68027,1],[68048,68049,1],[68100,68103,3],[68104,68107,1],[68116,68120,4],[68150,68151,1],[68155,68158,1],[68169,68175,1],[68185,68191,1],[68256,68287,1],[68327,68330,1],[68343,68351,1],[68406,68408,1],[68438,68439,1],[68467,68471,1],[68498,68504,1],[68509,68520,1],[68528,68607,1],[68681,68735,1],[68787,68799,1],[68851,68857,1],[68904,68911,1],[68922,69215,1],[69247,69290,43],[69294,69295,1],[69298,69372,1],[69416,69423,1],[69466,69487,1],[69514,69551,1],[69580,69599,1],[69623,69631,1],[69710,69713,1],[69750,69758,1],[69821,69827,6],[69828,69839,1],[69865,69871,1],[69882,69887,1],[69941,69960,19],[69961,69967,1],[70007,70015,1],[70112,70133,21],[70134,70143,1],[70162,70210,48],[70211,70271,1],[70279,70281,2],[70286,70302,16],[70314,70319,1],[70379,70383,1],[70394,70399,1],[70404,70413,9],[70414,70417,3],[70418,70441,23],[70449,70452,3],[70458,70469,11],[70470,70473,3],[70474,70478,4],[70479,70481,2],[70482,70486,1],[70488,70492,1],[70500,70501,1],[70509,70511,
101],[70517,70655,1],[70748,70754,6],[70755,70783,1],[70856,70863,1],[70874,71039,1],[71094,71095,1],[71134,71167,1],[71237,71247,1],[71258,71263,1],[71277,71295,1],[71354,71359,1],[71370,71423,1],[71451,71452,1],[71468,71471,1],[71495,71679,1],[71740,71839,1],[71923,71934,1],[71943,71944,1],[71946,71947,1],[71956,71959,3],[71990,71993,3],[71994,72007,13],[72008,72015,1],[72026,72095,1],[72104,72105,1],[72152,72153,1],[72165,72191,1],[72264,72271,1],[72355,72367,1],[72441,72447,1],[72458,72703,1],[72713,72759,46],[72774,72783,1],[72813,72815,1],[72848,72849,1],[72872,72887,15],[72888,72959,1],[72967,72970,3],[73015,73017,1],[73019,73022,3],[73032,73039,1],[73050,73055,1],[73062,73065,3],[73103,73106,3],[73113,73119,1],[73130,73439,1],[73465,73471,1],[73489,73531,42],[73532,73533,1],[73562,73647,1],[73649,73663,1],[73714,73726,1],[74650,74751,1],[74863,74869,6],[74870,74879,1],[75076,77711,1],[77811,77823,1],[78896,78911,1],[78934,82943,1],[83527,92159,1],[92729,92735,1],[92767,92778,11],[92779,92781,1],[92863,92874,11],[92875,92879,1],[92910,92911,1],[92918,92927,1],[92998,93007,1],[93018,93026,8],[93048,93052,1],[93072,93759,1],[93851,93951,1],[94027,94030,1],[94088,94094,1],[94112,94175,1],[94181,94191,1],[94194,94207,1],[100344,100351,1],[101590,101631,1],[101641,110575,1],[110580,110588,8],[110591,110883,292],[110884,110897,1],[110899,110927,1],[110931,110932,1],[110934,110947,1],[110952,110959,1],[111356,113663,1],[113771,113775,1],[113789,113791,1],[113801,113807,1],[113818,113819,1],[113824,118527,1],[118574,118575,1],[118599,118607,1],[118724,118783,1],[119030,119039,1],[119079,119080,1],[119155,119162,1],[119275,119295,1],[119366,119487,1],[119508,119519,1],[119540,119551,1],[119639,119647,1],[119673,119807,1],[119893,119965,72],[119968,119969,1],[119971,119972,1],[119975,119976,1],[119981,119994,13],[119996,120004,8],[120070,120075,5],[120076,120085,9],[120093,120122,29],[120127,120133,6],[120135,120137,1],[120145,120486,341],[120487,120780,293],[120781,121484,703],[121485,121498,1],[121504,121520,16],[121521,122623,1],[122655,122660,1],[122667,122879,1],[122887,122905,18],[122906,122914,8],[122917,122923,6],[122924,122927,1],[122990,123022,1],[123024,123135,1],[123181,123183,1],[123198,123199,1],[123210,123213,1],[123216,123535,1],[123567,123583,1],[123642,123646,1],[123648,124111,1],[124154,124895,1],[124903,124908,5],[124911,124927,16],[125125,125126,1],[125143,125183,1],[125260,125263,1],[125274,125277,1],[125280,126064,1],[126133,126208,1],[126270,126463,1],[126468,126496,28],[126499,126501,2],[126502,126504,2],[126515,126520,5],[126522,126524,2],[126525,126529,1],[126531,126534,1],[126536,126540,2],[126544,126547,3],[126549,126550,1],[126552,126560,2],[126563,126565,2],[126566,126571,5],[126579,126589,5],[126591,126602,11],[126620,126624,1],[126628,126634,6],[126652,126703,1],[126706,126975,1],[127020,127023,1],[127124,127135,1],[127151,127152,1],[127168,127184,16],[127222,127231,1],[127406,127461,1],[127491,127503,1],[127548,127551,1],[127561,127567,1],[127570,127583,1],[127590,127743,1],[128728,128731,1],[128749,128751,1],[128765,128767,1],[128887,128890,1],[128986,128991,1],[129004,129007,1],[129009,129023,1],[129036,129039,1],[129096,129103,1],[129114,129119,1],[129160,129167,1],[129198,129199,1],[129202,129279,1],[129620,129631,1],[129646,129647,1],[129661,129663,1],[129673,129679,1],[129726,129734,8],[129735,129741,1],[129756,129759,1],[129769,129775,1],[129785,129791,1],[129939,129995,56],[129996,130031,1],[130042,131071,1],[173792,173823,1],[177978,177983,1],[178206,178207,1],[183970,183983,1],[191457,191471,1],[192094,194559,1],[195102,196607,1],[201547,201551,1],[205744,917759,1],[918e3,1114111,1]];static Cc=[[0,31,1],[127,159,1]];static Cf=[[173,1536,1363],[1537,1541,1],[1564,1757,193],[1807,2192,385],[2193,2274,81],[6158,8203,2045],[8204,8207,1],[8234,8238,1],[8288,8292,1],[8294,8303,1],[65279,65529,250],[65530,65531,1],[69821,69837,16],[78896,78911,1],[113824,113827,1],[119155,119162,1],[917505,917536,31],[917537,917631,1]];static Co=[[57344,63743,1],[983040,1048573,1],[1048576,1114109,1]];static Cs=[[55296,57343,1]];static L=[[65,90,1],[97,122,1],[170,181,11],[186,192,6],[193,214,1],[216,246,1],[248,705,1],[710,721,1],[736,740,1],[748,750,2],[880,884,1],[886,887,1],[890,893,1],[895,902,7],[904,906,1],[908,910,2],[911,929,1],[931,1013,1],[1015,1153,1],[1162,1327,1],[1329,1366,1],[1369,1376,7
10],[1377,1416,1],[1488,1514,1],[1519,1522,1],[1568,1610,1],[1646,1647,1],[1649,1747,1],[1749,1765,16],[1766,1774,8],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2036,2037,1],[2042,2048,6],[2049,2069,1],[2074,2084,10],[2088,2112,24],[2113,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2249,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2417,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3654,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3782,3804,22],[3805,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4256,18],[4257,4293,1],[4295,4301,6],[4304,4346,1],[4348,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5024,5109,1],[5112,5117,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6103,6108,5],[6176,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6823,6917,94],[6918,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7293,1],[7296,7304,1],[7312,7354,1],[7357,7359,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,7424,6],[7425,7615,1],[7680,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8124,1],[8126,8130,4],[8131,8132,1],[8134,8140,1],[8144,8147,1],[8150,8155,1],[8160,8172,1],[8178,8180,1],[8182,8188,1],[8305,8319,14],[8336,8348,1],[8450,8455,5],[8458,8467,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8495,8505,1],[8508,8511,1],[8517,8521,1],[8526,8579,53],[8580,11264,2684],[11265,11492,1],[11499,11502,1],[11506,11507,1],[11520,11557,1],[11559,11565,6],[11568,11623,1],[11631,11648,17],[11649,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[11823,12293,470],[12294,12337,43],[12338,12341,1],[12347,12348,1],[12353,12438,1],[12445,12447,1],[12449,12538,1],[12540,12543,1],[12549,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,42124,1],[42192,42237,1],[42240,42508,1],[42512,42527,1],[42538,42539,1],[42560,42606,1],[42623,42653,1],[42656,42725,1],[42775,42783,1],[42786,42888,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43471,43488,17],[43489,43492,1],[43494,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43741,1],[43744,43754,1],[43762,43764,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43824,43866,1],[43868,43881,1],[43888,44002,1],[44032,55203,1],[55216,55238,1],[55243,5
105291,1],[63744,64109,1],[64112,64217,1],[64256,64262,1],[64275,64279,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65313,65338,1],[65345,65370,1],[65382,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66560,66717,1],[66736,66771,1],[66776,66811,1],[66816,66855,1],[66864,66915,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68736,68786,1],[68800,68850,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71840,71903,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[92992,92995,1],[93027,93047,1],[93053,93071,1],[93760,93823,1],[93952,94026,1],[94032,94099,67],[94100,94111,1],[94176,94177,1],[94179,94208,29],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120512,1],[120514,120538,1],[120540,120570,1],[120572,120596,1],[120598,120628,1],[120630,120654,1],[120656,120686,1],[120688,120712,1],[120714,120744,1],[120746,120770,1],[120772,120779,1],[122624,122654,1],[122661,122666,1],[122928,122989,1],[123136,123180,1],[123191,123197,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124139,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[125184,125251,1],[125259,126464,1205],[126465,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static foldL=[[837,837,1]];static Ll=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,311,2],[312,328,2],[329,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[397,402,5],[405,409,4],[410,411,1],[414,417,3],[419,421,2],[424,426,2],[427,429,2],[432,436,4],[438,441,3],[442,445,3],[446,447,1],[454,460,3],[462,476,2],[477,495,2],[496,499,3],[501,505,4],[507,563,2],[564,569,1],[572,575,3],[576,578,2],[583,591,2],[592,659,1],[661,687,1],[881,883,2],[887,891,4],[892,893,1],[912,940,28],[941,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1020,1072,52],[1073,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1376,1416,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7424,7467,1],[7531,7543,1],[7545,7578,1],[7681,7829,2],[7830,7837,1],[7839,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8016,8023,1],[8032,8039,1],[8048,8061,1],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8112,8116,1],[8118,8119,1],[8126,8130,4],[8131,8132,1],[8134,8135,1],[8144,8147,1],[8150,8151,1],[8160,8167,1],[8178,8180,1],[8182,8183,1],[8458,8462,4],[8463,8467,4],[8495,8505,5],[8508,8509,1],[8518,8521,1],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11377,11379,2],[11380,11382,2],[11383,11387,1],[11393,11491,2],[11492,11500,8],[11502,11507,5],[11520,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42800,42801,1],[42803,42865,2],[42866,42872,1],[42874,42876,2],[42879,42887,2],[42892,42894,2],[42897,42899,2],[42900,42901,1],[42903,42921,2],[42927,42933,6],[42935,42947,2],[42952,42954,2],[42961,42969,2],[42998,43002,4],[43824,43866,1],[43872,43880,1],[43888,43967,1],[64256,64262,1],[64275,64279,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[119834,119859,1],[119886,119892,1],[119894,119911,1],[119938,119963,1],[119990,119993,1],[119995,119997,2],[119998,120003,1],[120005,120015,1],[120042,120067,1],[120094,120119,1],[120146,120171,1],[120198,120223,1],[120250,12
100275,1],[120302,120327,1],[120354,120379,1],[120406,120431,1],[120458,120485,1],[120514,120538,1],[120540,120545,1],[120572,120596,1],[120598,120603,1],[120630,120654,1],[120656,120661,1],[120688,120712,1],[120714,120719,1],[120746,120770,1],[120772,120777,1],[120779,122624,1845],[122625,122633,1],[122635,122654,1],[122661,122666,1],[125218,125251,1]];static foldLl=[[65,90,1],[192,214,1],[216,222,1],[256,302,2],[306,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,453,1],[455,456,1],[458,459,1],[461,475,2],[478,494,2],[497,498,1],[500,502,2],[503,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[837,880,43],[882,886,4],[895,902,7],[904,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,984,9],[986,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8072,8079,1],[8088,8095,1],[8104,8111,1],[8120,8124,1],[8136,8140,1],[8152,8155,1],[8168,8172,1],[8184,8188,1],[8486,8490,4],[8491,8498,7],[8579,11264,2685],[11265,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[125184,125217,1]];static Lm=[[688,705,1],[710,721,1],[736,740,1],[748,750,2],[884,890,6],[1369,1600,231],[1765,1766,1],[2036,2037,1],[2042,2074,32],[2084,2088,4],[2249,2417,168],[3654,3782,128],[4348,6103,1755],[6211,6823,612],[7288,7293,1],[7468,7530,1],[7544,7579,35],[7580,7615,1],[8305,8319,14],[8336,8348,1],[11388,11389,1],[11631,11823,192],[12293,12337,44],[12338,12341,1],[12347,12445,98],[12446,12540,94],[12541,12542,1],[40981,42232,1251],[42233,42237,1],[42508,42623,115],[42652,42653,1],[42775,42783,1],[42864,42888,24],[42994,42996,1],[43e3,43001,1],[43471,43494,23],[43632,43741,109],[43763,43764,1],[43868,43871,1],[43881,65392,21511],[65438,65439,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[92992,92995,1],[94099,94111,1],[94176,94177,1],[94179,110576,16397],[110577,110579,1],[110581,110587,1],[110589,110590,1],[122928,122989,1],[123191,123197,1],[124139,125259,1120]];static Lo=[[170,186,16],[443,448,5],[449,451,1],[660,1488,828],[1489,1514,1],[1519,1522,1],[1568,1599,1],[1601,1610,1],[1646,1647,1],[1649,1747,1],[1749,1774,25],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2048,2069,1],[2112,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2248,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2418,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3653,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3804,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4352,114],[4353,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6108,6176,68],[6177,6210,1],[6212,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6917,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7287,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,8501,1083],[8502,8504,1],[11568,11623,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11
10742,1],[12294,12348,54],[12353,12438,1],[12447,12449,2],[12450,12538,1],[12543,12549,6],[12550,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,40980,1],[40982,42124,1],[42192,42231,1],[42240,42507,1],[42512,42527,1],[42538,42539,1],[42606,42656,50],[42657,42725,1],[42895,42999,104],[43003,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43488,43492,1],[43495,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43631,1],[43633,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43740,1],[43744,43754,1],[43762,43777,15],[43778,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43968,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65382,65391,1],[65393,65437,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66640,66717,1],[66816,66855,1],[66864,66915,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[93027,93047,1],[93053,93071,1],[93952,94026,1],[94032,94208,176],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[122634,123136,502],[123137,123180,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124138,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static Lt=[[453,459,3],[498,8072,7574],[8073,8079,1],[8088,8095,1],[8104,8111,1],[8124,8140,16],[8188,8188,1]];static foldLt=[[452,454,2],[455,457,2],[458,460,2],[497,499,2],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8115,8131,16],[8179,8179,1]];static Lu=[[65,90,1],[192,214,1],[216,222,1],[256,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,461,3],[463,475,2],[478,494,2],[497,500,3],[502,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[880,882,2],[886,895,9],[902,904,2],[905,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,978,3],[979,980,1],[984,1006,2],[1012,1015,3],[1017,1018,1],[1021,10
1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8120,8123,1],[8136,8139,1],[8152,8155,1],[8168,8172,1],[8184,8187,1],[8450,8455,5],[8459,8461,1],[8464,8466,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8496,8499,1],[8510,8511,1],[8517,8579,62],[11264,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[119808,119833,1],[119860,119885,1],[119912,119937,1],[119964,119966,2],[119967,119973,3],[119974,119977,3],[119978,119980,1],[119982,119989,1],[120016,120041,1],[120068,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120120,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120172,120197,1],[120224,120249,1],[120276,120301,1],[120328,120353,1],[120380,120405,1],[120432,120457,1],[120488,120512,1],[120546,120570,1],[120604,120628,1],[120662,120686,1],[120720,120744,1],[120778,125184,4406],[125185,125217,1]];static Upper=this.Lu;static foldLu=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,303,2],[307,311,2],[314,328,2],[331,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[402,405,3],[409,410,1],[414,417,3],[419,421,2],[424,429,5],[432,436,4],[438,441,3],[445,447,2],[453,454,1],[456,457,1],[459,460,1],[462,476,2],[477,495,2],[498,499,1],[501,505,4],[507,543,2],[547,563,2],[572,575,3],[576,578,2],[583,591,2],[592,596,1],[598,599,1],[601,603,2],[604,608,4],[609,613,2],[614,616,2],[617,620,1],[623,625,2],[626,629,3],[637,640,3],[642,643,1],[647,652,1],[658,669,11],[670,837,167],[881,883,2],[887,891,4],[892,893,1],[940,943,1],[945,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1072,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1377,1414,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7545,7549,4],[7566,7681,115],[7683,7829,2],[7835,7841,6],[7843,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8017,8023,2],[8032,8039,1],[8048,8061,1],[8112,8113,1],[8126,8144,18],[8145,8160,15],[8161,8165,4],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11379,11382,3],[11393,11491,2],[11500,11502,2],[11507,11520,13],[11521,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42803,42863,2],[42874,42876,2],[42879,42887,2],[42892,42897,5],[42899,42900,1],[42903,42921,2],[42933,42947,2],[42952,42954,2],[42961,42967,6],[42969,42998,29],[43859,43888,29],[43889,43967,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[125218,125251,1]];static M=[[768,879,1],[1155,1161,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2307,1],[2362,2364,1],[2366,2383,1],[2385,2391,1],[2402,2403,1],[2433,2435,1],[2492,2494,2],[2495,2500,1],[2503,2504,1],[2507,2509,1],[2519,2530,11],[2531,2558,27],[2561,2563,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2672,31],[2673,2677,4],[2689,2691,1],[2748,2750,2],[2751,2757,1],[2759,2761,1],[2763,2765,1],[2786,2787,1],[2810,2815,1],[2817,2819,1],[2876,2878,2],[2879,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2914,2915,1],[2946,3006,60],[3007,3010,1],[3014,3016,1],[3018,3021,1],[3031,3072,41],[3073,3076,1],[3132,3134,2],[3135,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3203,1],[3260,3262,2],[3263,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3298,3299,1],[3315,3328,13],[3329,3331,1],[3387,3388,1],[3390,3396,1],[3398,3400,1],[3402,3405,1],[3415,3426,11],[3427,3457,30],[3458,3459,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3570,3571,1],[3633,3636,3],[3637,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3902,3903,1],[3953,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4139,101],[4140,4158,1],[4182,4185,1],[4190,4192,1],[4194,4196,1],[4199,4205,1],[4209,4212,1],[4226,4237,1],[4239,4250,11],[4251,4253,1],[4957,4959,1],[5906,5909,1],[5938,5940,1],[5970,5971,1],[6002,6003,1],[6068,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6443,1],[6448,6459,1],[6679,6683,1],[6741,6750,1],[6752,6780,1],[6783,6832,49],[6833,6862,1],[6912,6916,1],[6964,6980,1],[7019,7027,1],[7040,7042,1],[7073,7085,
101],[7142,7155,1],[7204,7223,1],[7376,7378,1],[7380,7400,1],[7405,7412,7],[7415,7417,1],[7616,7679,1],[8400,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12335,1],[12441,12442,1],[42607,42610,1],[42612,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43043,24],[43044,43047,1],[43052,43136,84],[43137,43188,51],[43189,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43347,1],[43392,43395,1],[43443,43456,1],[43493,43561,68],[43562,43574,1],[43587,43596,9],[43597,43643,46],[43644,43645,1],[43696,43698,2],[43699,43700,1],[43703,43704,1],[43710,43711,1],[43713,43755,42],[43756,43759,1],[43765,43766,1],[44003,44010,1],[44012,44013,1],[64286,65024,738],[65025,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69632,69634,1],[69688,69702,1],[69744,69747,3],[69748,69759,11],[69760,69762,1],[69808,69818,1],[69826,69888,62],[69889,69890,1],[69927,69940,1],[69957,69958,1],[70003,70016,13],[70017,70018,1],[70067,70080,1],[70089,70092,1],[70094,70095,1],[70188,70199,1],[70206,70209,3],[70367,70378,1],[70400,70403,1],[70459,70460,1],[70462,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70502,3],[70503,70508,1],[70512,70516,1],[70709,70726,1],[70750,70832,82],[70833,70851,1],[71087,71093,1],[71096,71104,1],[71132,71133,1],[71216,71232,1],[71339,71351,1],[71453,71467,1],[71724,71738,1],[71984,71989,1],[71991,71992,1],[71995,71998,1],[72e3,72002,2],[72003,72145,142],[72146,72151,1],[72154,72160,1],[72164,72193,29],[72194,72202,1],[72243,72249,1],[72251,72254,1],[72263,72273,10],[72274,72283,1],[72330,72345,1],[72751,72758,1],[72760,72767,1],[72850,72871,1],[72873,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73098,67],[73099,73102,1],[73104,73105,1],[73107,73111,1],[73459,73462,1],[73472,73473,1],[73475,73524,49],[73525,73530,1],[73534,73538,1],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94033,2],[94034,94087,1],[94095,94098,1],[94180,94192,12],[94193,113821,19628],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119141,119145,1],[119149,119154,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldM=[[921,953,32],[8126,8126,1]];static Mc=[[2307,2363,56],[2366,2368,1],[2377,2380,1],[2382,2383,1],[2434,2435,1],[2494,2496,1],[2503,2504,1],[2507,2508,1],[2519,2563,44],[2622,2624,1],[2691,2750,59],[2751,2752,1],[2761,2763,2],[2764,2818,54],[2819,2878,59],[2880,2887,7],[2888,2891,3],[2892,2903,11],[3006,3007,1],[3009,3010,1],[3014,3016,1],[3018,3020,1],[3031,3073,42],[3074,3075,1],[3137,3140,1],[3202,3203,1],[3262,3264,2],[3265,3268,1],[3271,3272,1],[3274,3275,1],[3285,3286,1],[3315,3330,15],[3331,3390,59],[3391,3392,1],[3398,3400,1],[3402,3404,1],[3415,3458,43],[3459,3535,76],[3536,3537,1],[3544,3551,1],[3570,3571,1],[3902,3903,1],[3967,4139,172],[4140,4145,5],[4152,4155,3],[4156,4182,26],[4183,4194,11],[4195,4196,1],[4199,4205,1],[4227,4228,1],[4231,4236,1],[4239,4250,11],[4251,4252,1],[5909,5940,31],[6070,6078,8],[6079,6085,1],[6087,6088,1],[6435,6438,1],[6441,6443,1],[6448,6449,1],[6451,6456,1],[6681,6682,1],[6741,6743,2],[6753,6755,2],[6756,6765,9],[6766,6770,1],[6916,6965,49],[6971,6973,2],[6974,6977,1],[6979,6980,1],[7042,7073,31],[7078,7079,1],[7082,7143,61],[7146,7148,1],[7150,7154,4],[7155,7204,49],[7205,7211,1],[7220,7221,1],[7393,7415,22],[12334,12335,1],[43043,43044,1],[43047,43136,89],[43137,43188,51],[43189,43203,1],[43346,43347,1],[43395,43444,49],[43445,43450,5],[43451,43454,3],[43455,43456,1],[43567,43568,1],[43571,43572,1],[43597,43643,46],[43645,43755,110],[43758,43759,1],[43765,44003,238],[44004,44006,2],[44007,44009,2],[44010,44012,2],[69632,69634,2],[69762,69808,46],[69809,69810,1],[69815,69816,1],[69932,69957,25],[69958,70018,60],[70067,70069,1],[70079,70080,1],[70094,70188,94],[70189,70190,1],[70194,70195,1],[70197,70368,171],[70369,70370,1],[70402,70403,1],[70462,70463,1],[70465,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70709,210],[70710,70711,1],[70720,70721,1],[70725,70832,107],[70833,70834,1],[70841,70843,2],[70844,70846,1],[70849,71087,238],[71088,71089,1],[71096,71099,1],[71102,71216,114],[71217,71218,1],[71227,71228,1],[71230,71340,110],[71342,71343,1],[71350,71456,106],[71457,71462,5],[71724,71726,1],[71736,71984,248],[71985,71989,1],[71991,71992,1],[71997,72e3,3],[72002,72145,143],[72146,72147,1],[72156,72159,1],[72164,72249,85],[72279,72280,1],[72343,72751,408],[72766,72873,107],[72881,72884,3],[73098,73102,1],[73107,73108,1],[73110,73461,351],[73462,73475,13],[73524,73525,1],[73534,73535,1],[73537,94033,20496],[94034,94087,1],[94192,94193,1],[119141,119142,1],[119149,119154,1]];static Me=[[1160,1161,1],[6846,8413,1567],[8414,8416,1],[8418,8420,1],[42608,42610,1]];static Mn=[[768,879,1],[1155,1159,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,
101],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2306,1],[2362,2364,2],[2369,2376,1],[2381,2385,4],[2386,2391,1],[2402,2403,1],[2433,2492,59],[2497,2500,1],[2509,2530,21],[2531,2558,27],[2561,2562,1],[2620,2625,5],[2626,2631,5],[2632,2635,3],[2636,2637,1],[2641,2672,31],[2673,2677,4],[2689,2690,1],[2748,2753,5],[2754,2757,1],[2759,2760,1],[2765,2786,21],[2787,2810,23],[2811,2815,1],[2817,2876,59],[2879,2881,2],[2882,2884,1],[2893,2901,8],[2902,2914,12],[2915,2946,31],[3008,3021,13],[3072,3076,4],[3132,3134,2],[3135,3136,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3260,59],[3263,3270,7],[3276,3277,1],[3298,3299,1],[3328,3329,1],[3387,3388,1],[3393,3396,1],[3405,3426,21],[3427,3457,30],[3530,3538,8],[3539,3540,1],[3542,3633,91],[3636,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3953,3966,1],[3968,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4141,103],[4142,4144,1],[4146,4151,1],[4153,4154,1],[4157,4158,1],[4184,4185,1],[4190,4192,1],[4209,4212,1],[4226,4229,3],[4230,4237,7],[4253,4957,704],[4958,4959,1],[5906,5908,1],[5938,5939,1],[5970,5971,1],[6002,6003,1],[6068,6069,1],[6071,6077,1],[6086,6089,3],[6090,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6434,1],[6439,6440,1],[6450,6457,7],[6458,6459,1],[6679,6680,1],[6683,6742,59],[6744,6750,1],[6752,6754,2],[6757,6764,1],[6771,6780,1],[6783,6832,49],[6833,6845,1],[6847,6862,1],[6912,6915,1],[6964,6966,2],[6967,6970,1],[6972,6978,6],[7019,7027,1],[7040,7041,1],[7074,7077,1],[7080,7081,1],[7083,7085,1],[7142,7144,2],[7145,7149,4],[7151,7153,1],[7212,7219,1],[7222,7223,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8400,8412,1],[8417,8421,4],[8422,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12333,1],[12441,12442,1],[42607,42612,5],[42613,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43045,26],[43046,43052,6],[43204,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43345,1],[43392,43394,1],[43443,43446,3],[43447,43449,1],[43452,43453,1],[43493,43561,68],[43562,43566,1],[43569,43570,1],[43573,43574,1],[43587,43596,9],[43644,43696,52],[43698,43700,1],[43703,43704,1],[43710,43711,1],[43713,43756,43],[43757,43766,9],[44005,44008,3],[44013,64286,20273],[65024,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69633,69688,55],[69689,69702,1],[69744,69747,3],[69748,69759,11],[69760,69761,1],[69811,69814,1],[69817,69818,1],[69826,69888,62],[69889,69890,1],[69927,69931,1],[69933,69940,1],[70003,70016,13],[70017,70070,53],[70071,70078,1],[70089,70092,1],[70095,70191,96],[70192,70193,1],[70196,70198,2],[70199,70206,7],[70209,70367,158],[70371,70378,1],[70400,70401,1],[70459,70460,1],[70464,70502,38],[70503,70508,1],[70512,70516,1],[70712,70719,1],[70722,70724,1],[70726,70750,24],[70835,70840,1],[70842,70847,5],[70848,70850,2],[70851,71090,239],[71091,71093,1],[71100,71101,1],[71103,71104,1],[71132,71133,1],[71219,71226,1],[71229,71231,2],[71232,71339,107],[71341,71344,3],[71345,71349,1],[71351,71453,102],[71454,71455,1],[71458,71461,1],[71463,71467,1],[71727,71735,1],[71737,71738,1],[71995,71996,1],[71998,72003,5],[72148,72151,1],[72154,72155,1],[72160,72193,33],[72194,72202,1],[72243,72248,1],[72251,72254,1],[72263,72273,10],[72274,72278,1],[72281,72283,1],[72330,72342,1],[72344,72345,1],[72752,72758,1],[72760,72765,1],[72767,72850,83],[72851,72871,1],[72874,72880,1],[72882,72883,1],[72885,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73104,73],[73105,73109,4],[73111,73459,348],[73460,73472,12],[73473,73526,53],[73527,73530,1],[73536,73538,2],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94095,64],[94096,94098,1],[94180,113821,19641],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldMn=[[921,953,32],[8126,8126,1]];static N=[[48,57,1],[178,179,1],[185,188,3],[189,190,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2548,2553,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[2930,2935,1],[3046,3058,1],[3174,3183,1],[3192,3198,1],[3302,3311,1],[3416,3422,1],[3430,3448,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3891,1],[4160,4169,1],[4240,4249,1],[4969,4988,1],[5870,5872,1],[6112,6121,1],[6128,6137,1],[6160,6169,1],[6470,6479,1],[6608,6618,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[8304,8308,4],[8309,8313,1],[8320,8329,1],[8528,8578,1],[8581,8585,1],[9312,9371,1],[9450,9471,1],[10102,10131,1],[11517,12295,778],[12321,12329,1],[12344,12346,1],[12690,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[42528,42537,1],[42726,42735,1],[43056,43061,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[65799,65843,1],[65856,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[66369,66378,9],[66513,66517,1],[66720,66729,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[68912,68921,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70113,70132,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71483,1],[71904,71922,1],[72016,72025,1],[72784,72812,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[73664,73684,1],[74752,74862,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125127,125135,1],[125264,125273,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1],[130032,130041,1]];static Nd=[[48,57,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[3046,3055,1],[3174,3183,1],[3302,3311,1],[3430,3439,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3881,1],[4160,4169,1],[4240,4249,1],[6112,6121,1],[6160,6169,1],[6470,6479,1],[6608,6617,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[42528,42537,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[66720,66729,1],[68912,68921,1],[69734,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71481,1],[71904,71913,1],[72016,72025,1],[72784,72793,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125264,125273,1],[130032,130041,1]];static Nl=[[5870,5872,1],[8544,8578,1],[8581,8584,1],[12295,12321,26],[12322,12329,1],[12344,12346,1],[42726,42735,1],[65856,65908,1],[66369,66378,9],[66513,66517,1],[74752,74862,1]];
10static No=[[178,179,1],[185,188,3],[189,190,1],[2548,2553,1],[2930,2935,1],[3056,3058,1],[3192,3198,1],[3416,3422,1],[3440,3448,1],[3882,3891,1],[4969,4988,1],[6128,6137,1],[6618,8304,1686],[8308,8313,1],[8320,8329,1],[8528,8543,1],[8585,9312,727],[9313,9371,1],[9450,9471,1],[10102,10131,1],[11517,12690,1173],[12691,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[43056,43061,1],[65799,65843,1],[65909,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69733,1],[70113,70132,1],[71482,71483,1],[71914,71922,1],[72794,72812,1],[73664,73684,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[125127,125135,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1]];static P=[[33,35,1],[37,42,1],[44,47,1],[58,59,1],[63,64,1],[91,93,1],[95,123,28],[125,161,36],[167,171,4],[182,183,1],[187,191,4],[894,903,9],[1370,1375,1],[1417,1418,1],[1470,1472,2],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3898,38],[3899,3901,1],[3973,4048,75],[4049,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5120,5742,622],[5787,5788,1],[5867,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8208,829],[8209,8231,1],[8240,8259,1],[8261,8273,1],[8275,8286,1],[8317,8318,1],[8333,8334,1],[8968,8971,1],[9001,9002,1],[10088,10101,1],[10181,10182,1],[10214,10223,1],[10627,10648,1],[10712,10715,1],[10748,10749,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11822,1],[11824,11855,1],[11858,11869,1],[12289,12291,1],[12296,12305,1],[12308,12319,1],[12336,12349,13],[12448,12539,91],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,64830,20819],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65121,1],[65123,65128,5],[65130,65131,1],[65281,65283,1],[65285,65290,1],[65292,65295,1],[65306,65307,1],[65311,65312,1],[65339,65341,1],[65343,65371,28],[65373,65375,2],[65376,65381,1],[65792,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69293,69461,168],[69462,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Pc=[[95,8255,8160],[8256,8276,20],[65075,65076,1],[65101,65103,1],[65343,65343,1]];static Pd=[[45,1418,1373],[1470,5120,3650],[6150,8208,2058],[8209,8213,1],[11799,11802,3],[11834,11835,1],[11840,11869,29],[12316,12336,20],[12448,65073,52625],[65074,65112,38],[65123,65293,170],[69293,69293,1]];static Pe=[[41,93,52],[125,3899,3774],[3901,5788,1887],[8262,8318,56],[8334,8969,635],[8971,9002,31],[10089,10101,2],[10182,10215,33],[10217,10223,2],[10628,10648,2],[10713,10715,2],[10749,11811,1062],[11813,11817,2],[11862,11868,2],[12297,12305,2],[12309,12315,2],[12318,12319,1],[64830,65048,218],[65078,65092,2],[65096,65114,18],[65116,65118,2],[65289,65341,52],[65373,65379,3]];static Pf=[[187,8217,8030],[8221,8250,29],[11779,11781,2],[11786,11789,3],[11805,11809,4]];static Pi=[[171,8216,8045],[8219,8220,1],[8223,8249,26],[11778,11780,2],[11785,11788,3],[11804,11808,4]];static Po=[[33,35,1],[37,39,1],[42,46,2],[47,58,11],[59,63,4],[64,92,28],[161,167,6],[182,183,1],[191,894,703],[903,1370,467],[1371,1375,1],[1417,1472,55],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,3
1068],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3973,113],[4048,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5742,5867,125],[5868,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6149,1],[6151,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8214,835],[8215,8224,9],[8225,8231,1],[8240,8248,1],[8251,8254,1],[8257,8259,1],[8263,8273,1],[8275,8277,2],[8278,8286,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11782,5],[11783,11784,1],[11787,11790,3],[11791,11798,1],[11800,11801,1],[11803,11806,3],[11807,11818,11],[11819,11822,1],[11824,11833,1],[11836,11839,1],[11841,11843,2],[11844,11855,1],[11858,11860,1],[12289,12291,1],[12349,12539,190],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,65040,21029],[65041,65046,1],[65049,65072,23],[65093,65094,1],[65097,65100,1],[65104,65106,1],[65108,65111,1],[65119,65121,1],[65128,65130,2],[65131,65281,150],[65282,65283,1],[65285,65287,1],[65290,65294,2],[65295,65306,11],[65307,65311,4],[65312,65340,28],[65377,65380,3],[65381,65792,411],[65793,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69461,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Ps=[[40,91,51],[123,3898,3775],[3900,5787,1887],[8218,8222,4],[8261,8317,56],[8333,8968,635],[8970,9001,31],[10088,10100,2],[10181,10214,33],[10216,10222,2],[10627,10647,2],[10712,10714,2],[10748,11810,1062],[11812,11816,2],[11842,11861,19],[11863,11867,2],[12296,12304,2],[12308,12314,2],[12317,64831,52514],[65047,65077,30],[65079,65091,2],[65095,65113,18],[65115,65117,2],[65288,65339,51],[65371,65375,4],[65378,65378,1]];static S=[[36,43,7],[60,62,1],[94,96,2],[124,126,2],[162,166,1],[168,169,1],[172,174,2],[175,177,1],[180,184,4],[215,247,32],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,1014,113],[1154,1421,267],[1422,1423,1],[1542,1544,1],[1547,1550,3],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2046,2047,1],[2184,2546,362],[2547,2554,7],[2555,2801,246],[2928,3059,131],[3060,3066,1],[3199,3407,208],[3449,3647,198],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6107,366],[6464,6622,158],[6623,6655,1],[7009,7018,1],[7028,7036,1],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8352,8384,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8472,1],[8478,8483,1],[8485,8489,2],[8494,8506,12],[8507,8512,5],[8513,8516,1],[8522,8525,1],[8527,8586,59],[8587,8592,5],[8593,8967,1],[8972,9e3,1],[9003,9254,1],[9280,9290,1],[9372,9449,1],[9472,10087,1],[10132,10180,1],[10183,10213,1],[10224,10626,1],[10649,10711,1],[10716,10747,1],[10750,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12443,12444,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,
101],[12992,13311,1],[19904,19967,1],[42128,42182,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43048,43051,1],[43062,43065,1],[43639,43641,1],[43867,43882,15],[43883,64297,20414],[64434,64450,1],[64832,64847,1],[64975,65020,45],[65021,65023,1],[65122,65124,2],[65125,65126,1],[65129,65284,155],[65291,65308,17],[65309,65310,1],[65342,65344,2],[65372,65374,2],[65504,65510,1],[65512,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,123647,432],[126124,126128,4],[126254,126704,450],[126705,126976,271],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Sc=[[36,162,126],[163,165,1],[1423,1547,124],[2046,2047,1],[2546,2547,1],[2555,2801,246],[3065,3647,582],[6107,8352,2245],[8353,8384,1],[43064,65020,21956],[65129,65284,155],[65504,65505,1],[65509,65510,1],[73693,73696,1],[123647,126128,2481]];static Sk=[[94,96,2],[168,175,7],[180,184,4],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,2184,1283],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[12443,12444,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43867,43882,15],[43883,64434,20551],[64435,64450,1],[65342,65344,2],[65507,127995,62488],[127996,127999,1]];static Sm=[[43,60,17],[61,62,1],[124,126,2],[172,177,5],[215,247,32],[1014,1542,528],[1543,1544,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8472,8512,40],[8513,8516,1],[8523,8592,69],[8593,8596,1],[8602,8603,1],[8608,8614,3],[8622,8654,32],[8655,8658,3],[8660,8692,32],[8693,8959,1],[8992,8993,1],[9084,9115,31],[9116,9139,1],[9180,9185,1],[9655,9665,10],[9720,9727,1],[9839,10176,337],[10177,10180,1],[10183,10213,1],[10224,10239,1],[10496,10626,1],[10649,10711,1],[10716,10747,1],[10750,11007,1],[11056,11076,1],[11079,11084,1],[64297,65122,825],[65124,65126,1],[65291,65308,17],[65309,65310,1],[65372,65374,2],[65506,65513,7],[65514,65516,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[126704,126705,1]];static So=[[166,169,3],[174,176,2],[1154,1421,267],[1422,1550,128],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2554,2928,374],[3059,3064,1],[3066,3199,133],[3407,3449,42],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6464,723],[6622,6655,1],[7009,7018,1],[7028,7036,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8478,7],[8479,8483,1],[8485,8489,2],[8494,8506,12],[8507,8522,15],[8524,8525,1],[8527,8586,59],[8587,8597,10],[8598,8601,1],[8604,8607,1],[8609,8610,1],[8612,8613,1],[8615,8621,1],[8623,8653,1],[8656,8657,1],[8659,8661,2],[8662,8691,1],[8960,8967,1],[8972,8991,1],[8994,9e3,1],[9003,9083,1],[9085,9114,1],[9140,9179,1],[9186,9254,1],[9280,9290,1],[9372,9449,1],[9472,9654,1],[9656,9664,1],[9666,9719,1],[9728,9838,1],[9840,10087,1],[10132,10175,1],[10240,10495,1],[11008,11055,1],[11077,11078,1],[11085,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,
101],[12992,13311,1],[19904,19967,1],[42128,42182,1],[43048,43051,1],[43062,43063,1],[43065,43639,574],[43640,43641,1],[64832,64847,1],[64975,65021,46],[65022,65023,1],[65508,65512,4],[65517,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73692,1],[73697,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,126124,2909],[126254,126976,722],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,127994,1],[128e3,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Z=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8232,8233,1],[8239,8287,48],[12288,12288,1]];static Zl=[[8232,8232,1]];static Zp=[[8233,8233,1]];static Zs=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8239,8287,48],[12288,12288,1]];static Adlam=[[125184,125259,1],[125264,125273,1],[125278,125279,1]];static Ahom=[[71424,71450,1],[71453,71467,1],[71472,71494,1]];static Anatolian_Hieroglyphs=[[82944,83526,1]];static Arabic=[[1536,1540,1],[1542,1547,1],[1549,1562,1],[1564,1566,1],[1568,1599,1],[1601,1610,1],[1622,1647,1],[1649,1756,1],[1758,1791,1],[1872,1919,1],[2160,2190,1],[2192,2193,1],[2200,2273,1],[2275,2303,1],[64336,64450,1],[64467,64829,1],[64832,64911,1],[64914,64967,1],[64975,65008,33],[65009,65023,1],[65136,65140,1],[65142,65276,1],[69216,69246,1],[69373,69375,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[126704,126705,1]];static Armenian=[[1329,1366,1],[1369,1418,1],[1421,1423,1],[64275,64279,1]];static Avestan=[[68352,68405,1],[68409,68415,1]];static Balinese=[[6912,6988,1],[6992,7038,1]];static Bamum=[[42656,42743,1],[92160,92728,1]];static Bassa_Vah=[[92880,92909,1],[92912,92917,1]];static Batak=[[7104,7155,1],[7164,7167,1]];static Bengali=[[2432,2435,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2492,2500,1],[2503,2504,1],[2507,2510,1],[2519,2524,5],[2525,2527,2],[2528,2531,1],[2534,2558,1]];static Bhaiksuki=[[72704,72712,1],[72714,72758,1],[72760,72773,1],[72784,72812,1]];static Bopomofo=[[746,747,1],[12549,12591,1],[12704,12735,1]];static Brahmi=[[69632,69709,1],[69714,69749,1],[69759,69759,1]];static Braille=[[10240,10495,1]];static Buginese=[[6656,6683,1],[6686,6687,1]];static Buhid=[[5952,5971,1]];static Canadian_Aboriginal=[[5120,5759,1],[6320,6389,1],[72368,72383,1]];static Carian=[[66208,66256,1]];static Caucasian_Albanian=[[66864,66915,1],[66927,66927,1]];static Chakma=[[69888,69940,1],[69942,69959,1]];static Cham=[[43520,43574,1],[43584,43597,1],[43600,43609,1],[43612,43615,1]];static Cherokee=[[5024,5109,1],[5112,5117,1],[43888,43967,1]];static Chorasmian=[[69552,69579,1]];static Common=[[0,64,1],[91,96,1],[123,169,1],[171,185,1],[187,191,1],[215,247,32],[697,735,1],[741,745,1],[748,767,1],[884,894,10],[901,903,2],[1541,1548,7],[1563,1567,4],[1600,1757,157],[2274,2404,130],[2405,3647,1242],[4053,4056,1],[4347,5867,1520],[5868,5869,1],[5941,5942,1],[6146,6147,1],[6149,7379,1230],[7393,7401,8],[7402,7404,1],[7406,7411,1],[7413,7415,1],[7418,8192,774],[8193,8203,1],[8206,8292,1],[8294,8304,1],[8308,8318,1],[8320,8334,1],[8352,8384,1],[8448,8485,1],[8487,8489,1],[8492,8497,1],[8499,8525,1],[8527,8543,1],[8585,8587,1],[8592,9254,1],[9280,9290,1],[9312,10239,1],[10496,11123,1],[11126,11157,1],[11159,11263,1],[11776,11869,1],[12272,12292,1],[12294,12296,2],[12297,12320,1],[12336,12343,1],[12348,12351,1],[12443,12444,1],[12448,12539,91],[12540,12688,148],[12689,12703,1],[12736,12771,1],[12783,12832,49],[12833,12895,1],[12927,13007,1],[13055,13144,89],[13145,13311,1],[19904,19967,1],[42752,42785,1],[42888,42890,1],[43056,43065,1],[43310,43471,161],[43867,43882,15],[43883,64830,20947],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65126,1],[65128,65131,1],[65279,65281,2],[65282,65312,1],[65339,65344,1],[65371,65381,1],[65392,65438,46],[65439,65504,65],[65505,65510,1],[65512,65518,1],[65529,65533,1],[65792,65794,1],[65799,65843,1],[65847,65855,1],[65936,65948,1],[66e3,66044,1],[66273,66299,1],[113824,113827,1],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119142,1],[119146,119162,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119488,119507,1],[119520,119539,1],[119552,119638,1],[119648,119672,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,
10119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120779,1],[120782,120831,1],[126065,126132,1],[126209,126269,1],[126976,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127232,127405,1],[127462,127487,1],[127489,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1],[130032,130041,1],[917505,917536,31],[917537,917631,1]];static foldCommon=[[924,956,32]];static Coptic=[[994,1007,1],[11392,11507,1],[11513,11519,1]];static Cuneiform=[[73728,74649,1],[74752,74862,1],[74864,74868,1],[74880,75075,1]];static Cypriot=[[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3]];static Cypro_Minoan=[[77712,77810,1]];static Cyrillic=[[1024,1156,1],[1159,1327,1],[7296,7304,1],[7467,7544,77],[11744,11775,1],[42560,42655,1],[65070,65071,1],[122928,122989,1],[123023,123023,1]];static Deseret=[[66560,66639,1]];static Devanagari=[[2304,2384,1],[2389,2403,1],[2406,2431,1],[43232,43263,1],[72448,72457,1]];static Dives_Akuru=[[71936,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71989,1],[71991,71992,1],[71995,72006,1],[72016,72025,1]];static Dogra=[[71680,71739,1]];static Duployan=[[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[113820,113823,1]];static Egyptian_Hieroglyphs=[[77824,78933,1]];static Elbasan=[[66816,66855,1]];static Elymaic=[[69600,69622,1]];static Ethiopic=[[4608,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4957,4988,1],[4992,5017,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1]];static Georgian=[[4256,4293,1],[4295,4301,6],[4304,4346,1],[4348,4351,1],[7312,7354,1],[7357,7359,1],[11520,11557,1],[11559,11565,6]];static Glagolitic=[[11264,11359,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1]];static Gothic=[[66352,66378,1]];static Grantha=[[70400,70403,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70460,70468,1],[70471,70472,1],[70475,70477,1],[70480,70487,7],[70493,70499,1],[70502,70508,1],[70512,70516,1]];static Greek=[[880,883,1],[885,887,1],[890,893,1],[895,900,5],[902,904,2],[905,906,1],[908,910,2],[911,929,1],[931,993,1],[1008,1023,1],[7462,7466,1],[7517,7521,1],[7526,7530,1],[7615,7936,321],[7937,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8132,1],[8134,8147,1],[8150,8155,1],[8157,8175,1],[8178,8180,1],[8182,8190,1],[8486,43877,35391],[65856,65934,1],[65952,119296,53344],[119297,119365,1]];static foldGreek=[[181,837,656]];static Gujarati=[[2689,2691,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2748,2757,1],[2759,2761,1],[2763,2765,1],[2768,2784,16],[2785,2787,1],[2790,2801,1],[2809,2815,1]];static Gunjala_Gondi=[[73056,73061,1],[73063,73064,1],[73066,73102,1],[73104,73105,1],[73107,73112,1],[73120,73129,1]];static Gurmukhi=[[2561,2563,1],[2565,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2649,8],[2650,2652,1],[2654,2662,8],[2663,2678,1]];static Han=[[11904,11929,1],[11931,12019,1],[12032,12245,1],[12293,12295,2],[12321,12329,1],[12344,12347,1],[13312,19903,1],[19968,40959,1],[63744,64109,1],[64112,64217,1],[94178,94179,1],[94192,94193,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];
10static Hangul=[[4352,4607,1],[12334,12335,1],[12593,12686,1],[12800,12830,1],[12896,12926,1],[43360,43388,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1]];static Hanifi_Rohingya=[[68864,68903,1],[68912,68921,1]];static Hanunoo=[[5920,5940,1]];static Hatran=[[67808,67826,1],[67828,67829,1],[67835,67839,1]];static Hebrew=[[1425,1479,1],[1488,1514,1],[1519,1524,1],[64285,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64335,1]];static Hiragana=[[12353,12438,1],[12445,12447,1],[110593,110879,1],[110898,110928,30],[110929,110930,1],[127488,127488,1]];static Imperial_Aramaic=[[67648,67669,1],[67671,67679,1]];static Inherited=[[768,879,1],[1157,1158,1],[1611,1621,1],[1648,2385,737],[2386,2388,1],[6832,6862,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8204,8205,1],[8400,8432,1],[12330,12333,1],[12441,12442,1],[65024,65039,1],[65056,65069,1],[66045,66272,227],[70459,118528,48069],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[917760,917999,1]];static foldInherited=[[921,953,32],[8126,8126,1]];static Inscriptional_Pahlavi=[[68448,68466,1],[68472,68479,1]];static Inscriptional_Parthian=[[68416,68437,1],[68440,68447,1]];static Javanese=[[43392,43469,1],[43472,43481,1],[43486,43487,1]];static Kaithi=[[69760,69826,1],[69837,69837,1]];static Kannada=[[3200,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3260,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3293,3294,1],[3296,3299,1],[3302,3311,1],[3313,3315,1]];static Katakana=[[12449,12538,1],[12541,12543,1],[12784,12799,1],[13008,13054,1],[13056,13143,1],[65382,65391,1],[65393,65437,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110880,288],[110881,110882,1],[110933,110948,15],[110949,110951,1]];static Kawi=[[73472,73488,1],[73490,73530,1],[73534,73561,1]];static Kayah_Li=[[43264,43309,1],[43311,43311,1]];static Kharoshthi=[[68096,68099,1],[68101,68102,1],[68108,68115,1],[68117,68119,1],[68121,68149,1],[68152,68154,1],[68159,68168,1],[68176,68184,1]];static Khitan_Small_Script=[[94180,101120,6940],[101121,101589,1]];static Khmer=[[6016,6109,1],[6112,6121,1],[6128,6137,1],[6624,6655,1]];static Khojki=[[70144,70161,1],[70163,70209,1]];static Khudawadi=[[70320,70378,1],[70384,70393,1]];static Lao=[[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3773,1],[3776,3780,1],[3782,3784,2],[3785,3790,1],[3792,3801,1],[3804,3807,1]];static Latin=[[65,90,1],[97,122,1],[170,186,16],[192,214,1],[216,246,1],[248,696,1],[736,740,1],[7424,7461,1],[7468,7516,1],[7522,7525,1],[7531,7543,1],[7545,7614,1],[7680,7935,1],[8305,8319,14],[8336,8348,1],[8490,8491,1],[8498,8526,28],[8544,8584,1],[11360,11391,1],[42786,42887,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43007,1],[43824,43866,1],[43868,43876,1],[43878,43881,1],[64256,64262,1],[65313,65338,1],[65345,65370,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[122624,122654,1],[122661,122666,1]];static Lepcha=[[7168,7223,1],[7227,7241,1],[7245,7247,1]];static Limbu=[[6400,6430,1],[6432,6443,1],[6448,6459,1],[6464,6468,4],[6469,6479,1]];static Linear_A=[[67072,67382,1],[67392,67413,1],[67424,67431,1]];static Linear_B=[[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1]];static Lisu=[[42192,42239,1],[73648,73648,1]];static Lycian=[[66176,66204,1]];static Lydian=[[67872,67897,1],[67903,67903,1]];static Mahajani=[[69968,70006,1]];static Makasar=[[73440,73464,1]];static Malayalam=[[3328,3340,1],[3342,3344,1],[3346,3396,1],[3398,3400,1],[3402,3407,1],[3412,3427,1],[3430,3455,1]];static Mandaic=[[2112,2139,1],[2142,2142,1]];static Manichaean=[[68288,68326,1],[68331,68342,1]];static Marchen=[[72816,72847,1],[72850,72871,1],[72873,72886,1]];static Masaram_Gondi=[[72960,72966,1],[72968,72969,1],[72971,73014,1],[73018,73020,2],[73021,73023,2],[73024,73031,1],[73040,73049,1]];static Medefaidrin=[[93760,93850,1]];static Meetei_Mayek=[[43744,43766,1],[43968,44013,1],[44016,44025,1]];static Mende_Kikakui=[[124928,125124,1],[125127,125142,1]];static Meroitic_Cursive=[[68e3,68023,1],[68028,68047,1],[68050,68095,1]];static Meroitic_Hieroglyphs=[[67968,67999,1]];static Miao=[[93952,94026,1],[94031,94087,1],[94095,94111,1]];static Modi=[[71168,71236,1],[71248,71257,1]];static Mongolian=[[6144,6145,1],[6148,6150,2],[6151,6169,1],[6176,6264,1],[6272,6314,1],[71264,71276,1]];static Mro=[[92736,92766,1],[92768,92777,1],[92782,92783,1]];static Multani=[[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70313,1]];static Myanmar=[[4096,4255,1],[43488,43518,1],[43616,43647,1]];static Nabataean=[[67712,67742,1],[67751,67759,1]];static Nag_Mundari=[[124112,124153,1]];static Nandinagari=[[72096,72103,1],[72106,72151,1],[72154,72164,1]];static New_Tai_Lue=[[6528,6571,1],[6576,6601,1],[6608,6618,1],[6622,6623,1]];static Newa=[[70656,70747,1],[70749,70753,1]];static Nko=[[1984,2042,1],[2045,2047,1]];
10static Nushu=[[94177,110960,16783],[110961,111355,1]];static Nyiakeng_Puachue_Hmong=[[123136,123180,1],[123184,123197,1],[123200,123209,1],[123214,123215,1]];static Ogham=[[5760,5788,1]];static Ol_Chiki=[[7248,7295,1]];static Old_Hungarian=[[68736,68786,1],[68800,68850,1],[68858,68863,1]];static Old_Italic=[[66304,66339,1],[66349,66351,1]];static Old_North_Arabian=[[68224,68255,1]];static Old_Permic=[[66384,66426,1]];static Old_Persian=[[66464,66499,1],[66504,66517,1]];static Old_Sogdian=[[69376,69415,1]];static Old_South_Arabian=[[68192,68223,1]];static Old_Turkic=[[68608,68680,1]];static Old_Uyghur=[[69488,69513,1]];static Oriya=[[2817,2819,1],[2821,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2876,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2908,2909,1],[2911,2915,1],[2918,2935,1]];static Osage=[[66736,66771,1],[66776,66811,1]];static Osmanya=[[66688,66717,1],[66720,66729,1]];static Pahawh_Hmong=[[92928,92997,1],[93008,93017,1],[93019,93025,1],[93027,93047,1],[93053,93071,1]];static Palmyrene=[[67680,67711,1]];static Pau_Cin_Hau=[[72384,72440,1]];static Phags_Pa=[[43072,43127,1]];static Phoenician=[[67840,67867,1],[67871,67871,1]];static Psalter_Pahlavi=[[68480,68497,1],[68505,68508,1],[68521,68527,1]];static Rejang=[[43312,43347,1],[43359,43359,1]];static Runic=[[5792,5866,1],[5870,5880,1]];static Samaritan=[[2048,2093,1],[2096,2110,1]];static Saurashtra=[[43136,43205,1],[43214,43225,1]];static Sharada=[[70016,70111,1]];static Shavian=[[66640,66687,1]];static Siddham=[[71040,71093,1],[71096,71133,1]];static SignWriting=[[120832,121483,1],[121499,121503,1],[121505,121519,1]];static Sinhala=[[3457,3459,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3558,3567,1],[3570,3572,1],[70113,70132,1]];static Sogdian=[[69424,69465,1]];static Sora_Sompeng=[[69840,69864,1],[69872,69881,1]];static Soyombo=[[72272,72354,1]];static Sundanese=[[7040,7103,1],[7360,7367,1]];static Syloti_Nagri=[[43008,43052,1]];static Syriac=[[1792,1805,1],[1807,1866,1],[1869,1871,1],[2144,2154,1]];static Tagalog=[[5888,5909,1],[5919,5919,1]];static Tagbanwa=[[5984,5996,1],[5998,6e3,1],[6002,6003,1]];static Tai_Le=[[6480,6509,1],[6512,6516,1]];static Tai_Tham=[[6688,6750,1],[6752,6780,1],[6783,6793,1],[6800,6809,1],[6816,6829,1]];static Tai_Viet=[[43648,43714,1],[43739,43743,1]];static Takri=[[71296,71353,1],[71360,71369,1]];static Tamil=[[2946,2947,1],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3006,3010,1],[3014,3016,1],[3018,3021,1],[3024,3031,7],[3046,3066,1],[73664,73713,1],[73727,73727,1]];static Tangsa=[[92784,92862,1],[92864,92873,1]];static Tangut=[[94176,94208,32],[94209,100343,1],[100352,101119,1],[101632,101640,1]];static Telugu=[[3072,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3132,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3160,3162,1],[3165,3168,3],[3169,3171,1],[3174,3183,1],[3191,3199,1]];static Thaana=[[1920,1969,1]];static Thai=[[3585,3642,1],[3648,3675,1]];static Tibetan=[[3840,3911,1],[3913,3948,1],[3953,3991,1],[3993,4028,1],[4030,4044,1],[4046,4052,1],[4057,4058,1]];static Tifinagh=[[11568,11623,1],[11631,11632,1],[11647,11647,1]];static Tirhuta=[[70784,70855,1],[70864,70873,1]];static Toto=[[123536,123566,1]];static Ugaritic=[[66432,66461,1],[66463,66463,1]];static Vai=[[42240,42539,1]];static Vithkuqi=[[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1]];static Wancho=[[123584,123641,1],[123647,123647,1]];static Warang_Citi=[[71840,71922,1],[71935,71935,1]];static Yezidi=[[69248,69289,1],[69291,69293,1],[69296,69297,1]];static Yi=[[40960,42124,1],[42128,42182,1]];static Zanabazar_Square=[[72192,72263,1]];static CATEGORIES=new Map([["C",y.C],["Cc",y.Cc],["Cf",y.Cf],["Co",y.Co],["Cs",y.Cs],["L",y.L],["Ll",y.Ll],["Lm",y.Lm],["Lo",y.Lo],["Lt",y.Lt],["Lu",y.Lu],["M",y.M],["Mc",y.Mc],["Me",y.Me],["Mn",y.Mn],["N",y.N],["Nd",y.Nd],["Nl",y.Nl],["No",y.No],["P",y.P],["Pc",y.Pc],["Pd",y.Pd],["Pe",y.Pe],["Pf",y.Pf],["Pi",y.Pi],["Po",y.Po],["Ps",y.Ps],["S",y.S],["Sc",y.Sc],["Sk",y.Sk],["Sm",y.Sm],["So",y.So],["Z",y.Z],["Zl",y.Zl],["Zp",y.Zp],["Zs",y.Zs]]);static SCRIPTS=new Map([["Adlam",y.Adlam],["Ahom",y.Ahom],["Anatolian_Hieroglyphs",y.Anatolian_Hieroglyphs],["Arabic",y.Arabic],["Armenian",y.Armenian],["Avestan",y.Avestan],["Balinese",y.Balinese],["Bamum",y.Bamum],["Bassa_Vah",y.Bassa_Vah],["Batak",y.Batak],["Bengali",y.Bengali],["Bhaiksuki",y.Bhaiksuki],["Bopomofo",y.Bopomofo],["Brahmi",y.Brahmi],["Braille",y.Braille],["Buginese",y.Buginese],["Buhid",y.Buhid],["Canadian_Aboriginal",y.Canadian_Aboriginal],["Carian",y.Carian],["Caucasian_Albanian",y.Caucasian_Albanian],["Chakma",y.Chakma],["Cham",y.Cham],["Cherokee",y.Cherokee],["Chorasmian",y.Chorasmian],["Common",y.Common],["Coptic",y.Coptic],["Cuneiform",y.Cuneiform],["Cypriot",y.Cypriot],["Cypro_Minoan",y.Cypro_Minoan],["Cyrillic",y.Cyrillic
10],["Deseret",y.Deseret],["Devanagari",y.Devanagari],["Dives_Akuru",y.Dives_Akuru],["Dogra",y.Dogra],["Duployan",y.Duployan],["Egyptian_Hieroglyphs",y.Egyptian_Hieroglyphs],["Elbasan",y.Elbasan],["Elymaic",y.Elymaic],["Ethiopic",y.Ethiopic],["Georgian",y.Georgian],["Glagolitic",y.Glagolitic],["Gothic",y.Gothic],["Grantha",y.Grantha],["Greek",y.Greek],["Gujarati",y.Gujarati],["Gunjala_Gondi",y.Gunjala_Gondi],["Gurmukhi",y.Gurmukhi],["Han",y.Han],["Hangul",y.Hangul],["Hanifi_Rohingya",y.Hanifi_Rohingya],["Hanunoo",y.Hanunoo],["Hatran",y.Hatran],["Hebrew",y.Hebrew],["Hiragana",y.Hiragana],["Imperial_Aramaic",y.Imperial_Aramaic],["Inherited",y.Inherited],["Inscriptional_Pahlavi",y.Inscriptional_Pahlavi],["Inscriptional_Parthian",y.Inscriptional_Parthian],["Javanese",y.Javanese],["Kaithi",y.Kaithi],["Kannada",y.Kannada],["Katakana",y.Katakana],["Kawi",y.Kawi],["Kayah_Li",y.Kayah_Li],["Kharoshthi",y.Kharoshthi],["Khitan_Small_Script",y.Khitan_Small_Script],["Khmer",y.Khmer],["Khojki",y.Khojki],["Khudawadi",y.Khudawadi],["Lao",y.Lao],["Latin",y.Latin],["Lepcha",y.Lepcha],["Limbu",y.Limbu],["Linear_A",y.Linear_A],["Linear_B",y.Linear_B],["Lisu",y.Lisu],["Lycian",y.Lycian],["Lydian",y.Lydian],["Mahajani",y.Mahajani],["Makasar",y.Makasar],["Malayalam",y.Malayalam],["Mandaic",y.Mandaic],["Manichaean",y.Manichaean],["Marchen",y.Marchen],["Masaram_Gondi",y.Masaram_Gondi],["Medefaidrin",y.Medefaidrin],["Meetei_Mayek",y.Meetei_Mayek],["Mende_Kikakui",y.Mende_Kikakui],["Meroitic_Cursive",y.Meroitic_Cursive],["Meroitic_Hieroglyphs",y.Meroitic_Hieroglyphs],["Miao",y.Miao],["Modi",y.Modi],["Mongolian",y.Mongolian],["Mro",y.Mro],["Multani",y.Multani],["Myanmar",y.Myanmar],["Nabataean",y.Nabataean],["Nag_Mundari",y.Nag_Mundari],["Nandinagari",y.Nandinagari],["New_Tai_Lue",y.New_Tai_Lue],["Newa",y.Newa],["Nko",y.Nko],["Nushu",y.Nushu],["Nyiakeng_Puachue_Hmong",y.Nyiakeng_Puachue_Hmong],["Ogham",y.Ogham],["Ol_Chiki",y.Ol_Chiki],["Old_Hungarian",y.Old_Hungarian],["Old_Italic",y.Old_Italic],["Old_North_Arabian",y.Old_North_Arabian],["Old_Permic",y.Old_Permic],["Old_Persian",y.Old_Persian],["Old_Sogdian",y.Old_Sogdian],["Old_South_Arabian",y.Old_South_Arabian],["Old_Turkic",y.Old_Turkic],["Old_Uyghur",y.Old_Uyghur],["Oriya",y.Oriya],["Osage",y.Osage],["Osmanya",y.Osmanya],["Pahawh_Hmong",y.Pahawh_Hmong],["Palmyrene",y.Palmyrene],["Pau_Cin_Hau",y.Pau_Cin_Hau],["Phags_Pa",y.Phags_Pa],["Phoenician",y.Phoenician],["Psalter_Pahlavi",y.Psalter_Pahlavi],["Rejang",y.Rejang],["Runic",y.Runic],["Samaritan",y.Samaritan],["Saurashtra",y.Saurashtra],["Sharada",y.Sharada],["Shavian",y.Shavian],["Siddham",y.Siddham],["SignWriting",y.SignWriting],["Sinhala",y.Sinhala],["Sogdian",y.Sogdian],["Sora_Sompeng",y.Sora_Sompeng],["Soyombo",y.Soyombo],["Sundanese",y.Sundanese],["Syloti_Nagri",y.Syloti_Nagri],["Syriac",y.Syriac],["Tagalog",y.Tagalog],["Tagbanwa",y.Tagbanwa],["Tai_Le",y.Tai_Le],["Tai_Tham",y.Tai_Tham],["Tai_Viet",y.Tai_Viet],["Takri",y.Takri],["Tamil",y.Tamil],["Tangsa",y.Tangsa],["Tangut",y.Tangut],["Telugu",y.Telugu],["Thaana",y.Thaana],["Thai",y.Thai],["Tibetan",y.Tibetan],["Tifinagh",y.Tifinagh],["Tirhuta",y.Tirhuta],["Toto",y.Toto],["Ugaritic",y.Ugaritic],["Vai",y.Vai],["Vithkuqi",y.Vithkuqi],["Wancho",y.Wancho],["Warang_Citi",y.Warang_Citi],["Yezidi",y.Yezidi],["Yi",y.Yi],["Zanabazar_Square",y.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([["L",y.foldL],["Ll",y.foldLl],["Lt",y.foldLt],["Lu",y.foldLu],["M",y.foldM],["Mn",y.foldMn]]);static FOLD_SCRIPT=new Map([["Common",y.foldCommon],["Greek",y.foldGreek],["Inherited",y.foldInherited]])}class se{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(e,t){let n=0,s=e.length;for(;n<s;){let i=n+Math.floor((s-n)/2),o=e[i];if(o[0]<=t&&t<=o[1])return(t-o[0])%o[2]===0;t<o[0]?s=i:n=i+1}return!1}static is(e,t){if(t<=this.MAX_LATIN1){for(let n of e)if(!(t>n[1]))return t<n[0]?!1:(t-n[0])%n[2]===0;return!1}return e.length>0&&t>=e[0][0]&&this.is32(e,t)}static isUpper(e){if(e<=this.MAX_LATIN1){const t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return this.is(y.Upper,e)}static isPrint(e){return e<=this.MAX_LATIN1?e>=32&&e<127||e>=161&&e!==173:this.is(y.L,e)||this.is(y.M,e)||this.is(y.N,e)||this.is(y.P,e)||this.is(y.S,e)}static simpleFold(e){if(y.CASE_ORBIT.has(e))return y.CASE_ORBIT.get(e);const t=O.toLowerCase(e);return t!==e?t:O.toUpperCase(e)}static equalsIgnoreCase(e,t){if(e<0||t<0||e===t)return!0;
10if(e<=this.MAX_ASCII&&t<=this.MAX_ASCII)return O.CODES.get("A")<=e&&e<=O.CODES.get("Z")&&(e|=32),O.CODES.get("A")<=t&&t<=O.CODES.get("Z")&&(t|=32),e===t;for(let n=this.simpleFold(e);n!==e;n=this.simpleFold(n))if(n===t)return!0;return!1}}class fe{static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(e){return O.CODES.get("0")<=e&&e<=O.CODES.get("9")||O.CODES.get("a")<=e&&e<=O.CODES.get("z")||O.CODES.get("A")<=e&&e<=O.CODES.get("Z")}static unhex(e){return O.CODES.get("0")<=e&&e<=O.CODES.get("9")?e-O.CODES.get("0"):O.CODES.get("a")<=e&&e<=O.CODES.get("f")?e-O.CODES.get("a")+10:O.CODES.get("A")<=e&&e<=O.CODES.get("F")?e-O.CODES.get("A")+10:-1}static escapeRune(e){let t="";if(se.isPrint(e))this.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+="\\"),t+=String.fromCodePoint(e);else switch(e){case O.CODES.get('"'):t+='\\"';break;case O.CODES.get("\\"):t+="\\\\";break;case O.CODES.get("	"):t+="\\t";break;case O.CODES.get(`
11`):t+="\\n";break;case O.CODES.get("\r"):t+="\\r";break;case O.CODES.get("\b"):t+="\\b";break;case O.CODES.get("\f"):t+="\\f";break;default:{let n=e.toString(16);e<256?(t+="\\x",n.length===1&&(t+="0"),t+=n):t+=`\\x{${n}}`;break}}return t}static stringToRunes(e){return String(e).split("").map(t=>t.codePointAt(0))}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return O.CODES.get("a")<=e&&e<=O.CODES.get("z")||O.CODES.get("A")<=e&&e<=O.CODES.get("Z")||O.CODES.get("0")<=e&&e<=O.CODES.get("9")||e===O.CODES.get("_")}static emptyOpContext(e,t){let n=0;return e<0&&(n|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),e===O.CODES.get(`
12`)&&(n|=this.EMPTY_BEGIN_LINE),t<0&&(n|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),t===O.CODES.get(`
13`)&&(n|=this.EMPTY_END_LINE),this.isWordRune(e)!==this.isWordRune(t)?n|=this.EMPTY_WORD_BOUNDARY:n|=this.EMPTY_NO_WORD_BOUNDARY,n}static quoteMeta(e){return e.split("").map(t=>this.METACHARACTERS.indexOf(t)>=0?`\\${t}`:t).join("")}static charCount(e){return e>se.MAX_BMP?2:1}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(e));{let t=[],n=0;for(let s=0;s<e.length;s++){let i=e.charCodeAt(s);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)===55296&&s+1<e.length&&(e.charCodeAt(s+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++s)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array(e));{let t=[],n=0,s=0;for(;n<e.length;){let i=e[n++];if(i<128)t[s++]=String.fromCharCode(i);else if(i>191&&i<224){let o=e[n++];t[s++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){let o=e[n++],a=e[n++],u=e[n++],l=((i&7)<<18|(o&63)<<12|(a&63)<<6|u&63)-65536;t[s++]=String.fromCharCode(55296+(l>>10)),t[s++]=String.fromCharCode(56320+(l&1023))}else{let o=e[n++],a=e[n++];t[s++]=String.fromCharCode((i&15)<<12|(o&63)<<6|a&63)}}return t.join("")}}}const Np=(r=[],e=0)=>{const t={};for(let n=0;n<r.length;n++){const s=r[n],i=e+n;t[s]=i,t[i]=s}return Object.freeze(t)};class Pn{static Encoding=Np(["UTF_16","UTF_8"]);getEncoding(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===Pn.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===Pn.Encoding.UTF_16}}class Hd extends Pn{constructor(e=null){super(),this.bytes=e}getEncoding(){return Pn.Encoding.UTF_8}asCharSequence(){return fe.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}}class H4 extends Pn{constructor(e=null){super(),this.charSequence=e}getEncoding(){return Pn.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split("").map(e=>e.codePointAt(0))}length(){return this.charSequence.length}}class ec{static utf16(e){return new H4(e)}static utf8(e){return Array.isArray(e)?new Hd(e):new Hd(fe.stringToUtf8ByteArray(e))}}
13class bc extends Error{constructor(e){super(e),this.name="RE2JSException"}}class De extends bc{constructor(e,t=null){let n=`error parsing regexp: ${e}`;t&&(n+=`: \`${t}\``),super(n),this.name="RE2JSSyntaxException",this.message=n,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}}class W4 extends bc{constructor(e){super(e),this.name="RE2JSCompileException"}}class _n extends bc{constructor(e){super(e),this.name="RE2JSGroupException"}}class K4 extends bc{constructor(e){super(e),this.name="RE2JSFlagsException"}}class Q4{static quoteReplacement(e){return e.indexOf("\\")<0&&e.indexOf("$")<0?e:e.split("").map(t=>{const n=t.codePointAt(0);return n===O.CODES["\\"]||n===O.CODES.$?`\\${t}`:t}).join("")}constructor(e,t){if(e===null)throw new Error("pattern is null");this.patternInput=e;const n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,t instanceof Pn?this.resetMatcherInput(t):Array.isArray(t)?this.resetMatcherInput(ec.utf8(t)):this.resetMatcherInput(ec.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(e===null)throw new Error("input is null");return this.matcherInput=e,this.reset(),this}start(e=0){if(typeof e=="string"){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new _n(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if(typeof e=="string"){const t=this.namedGroups[e];if(!Number.isFinite(t))throw new _n(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}group(e=0){if(typeof e=="string"){const s=this.namedGroups[e];if(!Number.isFinite(s))throw new _n(`group '${e}' not found`);e=s}const t=this.start(e),n=this.end(e);return t<0&&n<0?null:this.substring(t,n)}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new _n(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new _n("perhaps no match attempted");if(e===0||this.hasGroups)return;let t=this.groups[1]+1;t>this.matcherInputLength&&(t=this.matcherInputLength);const n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!n[0])throw new _n("inconsistency in matching group data");this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,j.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,j.ANCHOR_START)}find(e=null){if(e!==null){if(e<0||e>this.matcherInputLength)throw new _n(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}return e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1]&&e++),this.genMatch(e,j.UNANCHORED)}genMatch(e,t){const n=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return n[0]?(this.groups=n[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=t,!0):!1}substring(e,t){return this.matcherInput.isUTF8Encoding()?fe.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let n="";const s=this.start(),i=this.end();return this.appendPos<s&&(n+=this.substring(this.appendPos,s)),this.appendPos=i,n+=t?this.appendReplacementInternalPerl(e):this.appendReplacementInternal(e),n}appendReplacementInternal(e){let t="",n=0;const s=e.length;for(let i=0;i<s-1;i++){if(e.codePointAt(i)===O.CODES.get("\\")){n<i&&(t+=e.substring(n,i)),i++,n=i;continue}if(e.codePointAt(i)===O.CODES.get("$")){let o=e.codePointAt(i+1);if(O.CODES.get("0")<=o&&o<=O.CODES.get("9")){let a=o-O.CODES.get("0");for(n<i&&(t+=e.substring(n,i)),i+=2;i<s&&(o=e.codePointAt(i),!(o<O.CODES.get("0")||o>O.CODES.get("9")||a*10+o-O.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-O.CODES.get("0");if(a>this.patternGroupCount)throw new _n(`n > number of groups: ${a}`);const u=this.group(a);u!==null&&(t+=u),n=i,i--;continue}else if(o===O.CODES.get("{")){n<i&&(t+=e.substring(n,i)),i++;let a=i+1;for(;a<e.length&&e.codePointAt(a)!==O.CODES.get("}")&&e.codePointAt(a)!==O.CODES.get(" ");)a++;if(a===e.length||e.codePointAt(a)!==O.CODES.get("}"))throw new _n("named capture group is missing trailing '}'");const u=e.substring(i+1,a);t+=this.group(u),n=a+1}}}return n<s&&(t+=e.substring(n,s)),t}appendReplacementInternalPerl(e){let t="",n=0;const s=e.length;for(let i=0;i<s-1;i++)if(e.codePointAt(i)===O.CODES.get("$")){let o=e.codePointAt(i+1);if(O.CODES.get("$")===o){n<i&&(t+=e.substring(n,i)),t+="$",i++,n=i+1;continue}else if(O.CODES.get("&")===o){n<i&&(t+=e.substring(n,i));const a=this.group(0);a!==null?t+=a:t+="$&",i++,n=i+1;continue}else if(O.CODES.get("1")<=o&&o<=O.CODES.get("9")){let a=o-O.CODES.get("0");for(n<i&&(t+=e.substring(n,i)),i+=2;i<s&&(o=e.codePointAt(i),!(o<O.CODES.get("0")||o>O.CODES.get("9")||a*10+o-O.CODES.get("0")>this.patternGroupCount));i++)a=a*10+o-O.CODES.get("0");if(a>this.patternGroupCount){t+=`$${a}`,n=i,i--;continue}const u=this.group(a);u!==null&&(t+=u),n=i,i--;continue}
13else if(o===O.CODES.get("<")){n<i&&(t+=e.substring(n,i)),i++;let a=i+1;for(;a<e.length&&e.codePointAt(a)!==O.CODES.get(">")&&e.codePointAt(a)!==O.CODES.get(" ");)a++;if(a===e.length||e.codePointAt(a)!==O.CODES.get(">")){t+=e.substring(i-1,a+1),n=a+1;continue}const u=e.substring(i+1,a);Object.prototype.hasOwnProperty.call(this.namedGroups,u)?t+=this.group(u):t+=`$<${u}>`,n=a+1}}return n<s&&(t+=e.substring(n,s)),t}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(e,t=!0,n=!1){let s="";for(this.reset();this.find()&&(s+=this.appendReplacement(e,n),!!t););return s+=this.appendTail(),s}}class Jn{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}}class Y4 extends Jn{constructor(e,t=0,n=e.length){super(),this.bytes=e,this.start=t,this.end=n}step(e){if(e+=this.start,e>=this.end)return Jn.EOF();let t=this.bytes[e++]&255;return(t&128)===0?t<<3|1:(t&224)===192?(t=t&31,e>=this.end?Jn.EOF():(t=t<<6|this.bytes[e++]&63,t<<3|2)):(t&240)===224?(t=t&15,e+1>=this.end?Jn.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|3)):(t=t&7,e+2>=this.end?Jn.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|4))}index(e,t){t+=this.start;const n=this.indexOf(this.bytes,e.prefixUTF8,t);return n<0?n:n-t}context(e){e+=this.start;let t=-1;if(e>this.start&&e<=this.end){let s=e-1;if(t=this.bytes[s--],t>=128){let i=e-4;for(i<this.start&&(i=this.start);s>=i&&(this.bytes[s]&192)===128;)s--;s<this.start&&(s=this.start),t=this.step(s)>>3}}const n=e<this.end?this.step(e)>>3:-1;return fe.emptyOpContext(t,n)}indexOf(e,t,n=0){let s=t.length;if(s===0)return-1;let i=e.length;for(let o=n;o<=i-s;o++)for(let a=0;a<s&&e[o+a]===t[a];a++)if(a===s-1)return o;return-1}}class J4 extends Jn{constructor(e,t=0,n=e.length){super(),this.charSequence=e,this.start=t,this.end=n}step(e){if(e+=this.start,e<this.end){const t=this.charSequence.codePointAt(e);return t<<3|fe.charCount(t)}else return Jn.EOF()}index(e,t){t+=this.start;const n=this.charSequence.indexOf(e.prefix,t);return n<0?n:n-t}context(e){e+=this.start;const t=e>0&&e<=this.charSequence.length?this.charSequence.codePointAt(e-1):-1,n=e<this.charSequence.length?this.charSequence.codePointAt(e):-1;return fe.emptyOpContext(t,n)}}class ke{static fromUTF8(e,t=0,n=e.length){return new Y4(e,t,n)}static fromUTF16(e,t=0,n=e.length){return new J4(e,t,n)}}class P{static Op=Np(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]);static isPseudoOp(e){return e>=P.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===O.CODES.get("-")?"\\":""}static fromRegexp(e){const t=new P(e.op);return t.flags=e.flags,t.subs=e.subs,t.runes=e.runes,t.cap=e.cap,t.min=e.min,t.max=e.max,t.name=e.name,t.namedGroups=e.namedGroups,t}constructor(e){this.op=e,this.flags=0,this.subs=P.emptySubs(),this.runes=null,this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=P.emptySubs(),this.runes=null,this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let e="";switch(this.op){case P.Op.NO_MATCH:e+="[^\\x00-\\x{10FFFF}]";break;case P.Op.EMPTY_MATCH:e+="(?:)";break;case P.Op.STAR:case P.Op.PLUS:case P.Op.QUEST:case P.Op.REPEAT:{const t=this.subs[0];switch(t.op>P.Op.CAPTURE||t.op===P.Op.LITERAL&&t.runes.length>1?e+=`(?:${t.appendTo()})`:e+=t.appendTo(),this.op){case P.Op.STAR:e+="*";break;case P.Op.PLUS:e+="+";break;case P.Op.QUEST:e+="?";break;case P.Op.REPEAT:e+=`{${this.min}`,this.min!==this.max&&(e+=",",this.max>=0&&(e+=this.max)),e+="}";break}(this.flags&j.NON_GREEDY)!==0&&(e+="?");break}case P.Op.CONCAT:{for(let t of this.subs)t.op===P.Op.ALTERNATE?e+=`(?:${t.appendTo()})`:e+=t.appendTo();break}case P.Op.ALTERNATE:{let t="";for(let n of this.subs)e+=t,t="|",e+=n.appendTo();break}case P.Op.LITERAL:(this.flags&j.FOLD_CASE)!==0&&(e+="(?i:");for(let t of this.runes)e+=fe.escapeRune(t);(this.flags&j.FOLD_CASE)!==0&&(e+=")");break;case P.Op.ANY_CHAR_NOT_NL:e+="(?-s:.)";break;case P.Op.ANY_CHAR:e+="(?s:.)";break;case P.Op.CAPTURE:this.name===null||this.name.length===0?e+="(":e+=`(?P<${this.name}>
13`,this.subs[0].op!==P.Op.EMPTY_MATCH&&(e+=this.subs[0].appendTo()),e+=")";break;case P.Op.BEGIN_TEXT:e+="\\A";break;case P.Op.END_TEXT:(this.flags&j.WAS_DOLLAR)!==0?e+="(?-m:$)":e+="\\z";break;case P.Op.BEGIN_LINE:e+="^";break;case P.Op.END_LINE:e+="$";break;case P.Op.WORD_BOUNDARY:e+="\\b";break;case P.Op.NO_WORD_BOUNDARY:e+="\\B";break;case P.Op.CHAR_CLASS:if(this.runes.length%2!==0){e+="[invalid char class]";break}if(e+="[",this.runes.length===0)e+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===se.MAX_RUNE){e+="^";for(let t=1;t<this.runes.length-1;t+=2){const n=this.runes[t]+1,s=this.runes[t+1]-1;e+=P.quoteIfHyphen(n),e+=fe.escapeRune(n),n!==s&&(e+="-",e+=P.quoteIfHyphen(s),e+=fe.escapeRune(s))}}else for(let t=0;t<this.runes.length;t+=2){const n=this.runes[t],s=this.runes[t+1];e+=P.quoteIfHyphen(n),e+=fe.escapeRune(n),n!==s&&(e+="-",e+=P.quoteIfHyphen(s),e+=fe.escapeRune(s))}e+="]";break;default:e+=this.op;break}return e}maxCap(){let e=0;if(this.op===P.Op.CAPTURE&&(e=this.cap),this.subs!==null)for(let t of this.subs){const n=t.maxCap();e<n&&(e=n)}return e}equals(e){if(!(e!==null&&e instanceof P)||this.op!==e.op)return!1;switch(this.op){case P.Op.END_TEXT:{if((this.flags&j.WAS_DOLLAR)!==(e.flags&j.WAS_DOLLAR))return!1;break}case P.Op.LITERAL:case P.Op.CHAR_CLASS:{if(this.runes===null&&e.runes===null)break;if(this.runes===null||e.runes===null||this.runes.length!==e.runes.length)return!1;for(let t=0;t<this.runes.length;t++)if(this.runes[t]!==e.runes[t])return!1;break}case P.Op.ALTERNATE:case P.Op.CONCAT:{if(this.subs.length!==e.subs.length)return!1;for(let t=0;t<this.subs.length;++t)if(!this.subs[t].equals(e.subs[t]))return!1;break}case P.Op.STAR:case P.Op.PLUS:case P.Op.QUEST:{if((this.flags&j.NON_GREEDY)!==(e.flags&j.NON_GREEDY)||!this.subs[0].equals(e.subs[0]))return!1;break}case P.Op.REPEAT:{if((this.flags&j.NON_GREEDY)!==(e.flags&j.NON_GREEDY)||this.min!==e.min||this.max!==e.max||!this.subs[0].equals(e.subs[0]))return!1;break}case P.Op.CAPTURE:{if(this.cap!==e.cap||(this.name===null?e.name!==null:this.name!==e.name)||!this.subs[0].equals(e.subs[0]))return!1;break}}return!0}}class Q{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(e){return Q.RUNE<=e&&e<=Q.RUNE_ANY_NOT_NL}static escapeRunes(e){let t='"';for(let n of e)t+=fe.escapeRune(n);return t+='"',t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=null}matchRune(e){if(this.runes.length===1){const s=this.runes[0];return(this.arg&j.FOLD_CASE)!==0?se.equalsIgnoreCase(s,e):e===s}for(let s=0;s<this.runes.length&&s<=8;s+=2){if(e<this.runes[s])return!1;if(e<=this.runes[s+1])return!0}let t=0,n=this.runes.length/2|0;for(;t<n;){const s=t+((n-t)/2|0);if(this.runes[2*s]<=e){if(e<=this.runes[2*s+1])return!0;t=s+1}else n=s}return!1}toString(){switch(this.op){case Q.ALT:return`alt -> ${this.out}, ${this.arg}`;case Q.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case Q.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case Q.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case Q.MATCH:return"match";case Q.FAIL:return"fail";case Q.NOP:return`nop -> ${this.out}`;case Q.RUNE:return this.runes===null?"rune <null>":["rune ",Q.escapeRunes(this.runes),(this.arg&j.FOLD_CASE)!==0?"/i":""," -> ",this.out].join("");case Q.RUNE1:return`rune1 ${Q.escapeRunes(this.runes)} -> ${this.out}`;case Q.RUNE_ANY:return`any -> ${this.out}`;case Q.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw new Error("unhandled case in Inst.toString")}}}class X4{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new Q(e))}skipNop(e){let t=this.inst[e];for(;t.op===Q.NOP||t.op===Q.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e="",t=this.skipNop(this.start);if(!Q.isRuneOp(t.op)||t.runes.length!==1)return[t.op===Q.MATCH,e];for(;Q.isRuneOp(t.op)&&t.runes.length===1&&(t.arg&j.FOLD_CASE)===0;)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===Q.MATCH,e]}startCond(){let e=0,t=this.start;e:for(;;){const n=this.inst[t];switch(n.op){case Q.EMPTY_WIDTH:e|=n.arg;break;case Q.FAIL:return-1;case Q.CAPTURE:case Q.NOP:break;default:break e}t=n.out}return e}next(e){const t=this.inst[e>>1];return(e&1)===0?t.out:t.arg}patch(e,t){for(;e!==0;){const n=this.inst[e>>1];(e&1)===0?(e=n.out,n.out=t):(e=n.arg,n.arg=t)}}append(e,t){if(e===0)return t;if(t===0)return e;let n=e;for(;;){const i=this.next(n);if(i===0)break;n=i}const s=this.inst[n>>1];return(n&1)===0?s.out=t:s.arg=t,e}toString(){let e="";for(let t=0;t<this.inst.length;t++){const n=e.length;e+=t,t===this.start&&(e+="*"),e+="        ".substring(e.length-n),e+=this.inst[t],e+=`
14`}return e}}class va{constructor(e=0,t=0,n=!1){this.i=e,this.out=t,this.nullable=n}}class so{static ANY_RUNE_NOT_NL(){return[0,O.CODES.get(`
15`)-1,O.CODES.get(`
16`)+1,se.MAX_RUNE]}static ANY_RUNE(){return[0,se.MAX_RUNE]}static compileRegexp(e){const t=new so,n=t.compile(e);return t.prog.patch(n.out,t.newInst(Q.MATCH).i),t.prog.start=n.i,t.prog}constructor(){this.prog=new X4,this.newInst(Q.FAIL)}newInst(e){return this.prog.addInst(e),new va(this.prog.numInst()-1,0,!0)}nop(){const e=this.newInst(Q.NOP);return e.out=e.i<<1,e}fail(){return new va}cap(e){const t=this.newInst(Q.CAPTURE);return t.out=t.i<<1,this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return e.i===0||t.i===0?this.fail():(this.prog.patch(e.out,t.i),new va(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(e.i===0)return t;if(t.i===0)return e;const n=this.newInst(Q.ALT),s=this.prog.getInst(n.i);return s.out=e.i,s.arg=t.i,n.out=this.prog.append(e.out,t.out),n.nullable=e.nullable||t.nullable,n}loop(e,t){const n=this.newInst(Q.ALT),s=this.prog.getInst(n.i);return t?(s.arg=e.i,n.out=n.i<<1):(s.out=e.i,n.out=n.i<<1|1),this.prog.patch(e.out,n.i),n}quest(e,t){const n=this.newInst(Q.ALT),s=this.prog.getInst(n.i);return t?(s.arg=e.i,n.out=n.i<<1):(s.out=e.i,n.out=n.i<<1|1),n.out=this.prog.append(n.out,e.out),n}star(e,t){return e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return new va(e.i,this.loop(e,t).out,e.nullable)}empty(e){const t=this.newInst(Q.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=t.i<<1,t}rune(e,t){const n=this.newInst(Q.RUNE);n.nullable=!1;const s=this.prog.getInst(n.i);return s.runes=e,t&=j.FOLD_CASE,(e.length!==1||se.simpleFold(e[0])===e[0])&&(t&=-2),s.arg=t,n.out=n.i<<1,(t&j.FOLD_CASE)===0&&e.length===1||e.length===2&&e[0]===e[1]?s.op=Q.RUNE1:e.length===2&&e[0]===0&&e[1]===se.MAX_RUNE?s.op=Q.RUNE_ANY:e.length===4&&e[0]===0&&e[1]===O.CODES.get(`
17`)-1&&e[2]===O.CODES.get(`
18`)+1&&e[3]===se.MAX_RUNE&&(s.op=Q.RUNE_ANY_NOT_NL),n}compile(e){switch(e.op){case P.Op.NO_MATCH:return this.fail();case P.Op.EMPTY_MATCH:return this.nop();case P.Op.LITERAL:if(e.runes.length===0)return this.nop();{let t=null;for(let n of e.runes){const s=this.rune([n],e.flags);t=t===null?s:this.cat(t,s)}return t}case P.Op.CHAR_CLASS:return this.rune(e.runes,e.flags);case P.Op.ANY_CHAR_NOT_NL:return this.rune(so.ANY_RUNE_NOT_NL(),0);case P.Op.ANY_CHAR:return this.rune(so.ANY_RUNE(),0);case P.Op.BEGIN_LINE:return this.empty(fe.EMPTY_BEGIN_LINE);case P.Op.END_LINE:return this.empty(fe.EMPTY_END_LINE);case P.Op.BEGIN_TEXT:return this.empty(fe.EMPTY_BEGIN_TEXT);case P.Op.END_TEXT:return this.empty(fe.EMPTY_END_TEXT);case P.Op.WORD_BOUNDARY:return this.empty(fe.EMPTY_WORD_BOUNDARY);case P.Op.NO_WORD_BOUNDARY:return this.empty(fe.EMPTY_NO_WORD_BOUNDARY);case P.Op.CAPTURE:{const t=this.cap(e.cap<<1),n=this.compile(e.subs[0]),s=this.cap(e.cap<<1|1);return this.cat(this.cat(t,n),s)}case P.Op.STAR:return this.star(this.compile(e.subs[0]),(e.flags&j.NON_GREEDY)!==0);case P.Op.PLUS:return this.plus(this.compile(e.subs[0]),(e.flags&j.NON_GREEDY)!==0);case P.Op.QUEST:return this.quest(this.compile(e.subs[0]),(e.flags&j.NON_GREEDY)!==0);case P.Op.CONCAT:{if(e.subs.length===0)return this.nop();{let t=null;for(let n of e.subs){const s=this.compile(n);t=t===null?s:this.cat(t,s)}return t}}case P.Op.ALTERNATE:{if(e.subs.length===0)return this.nop();{let t=null;for(let n of e.subs){const s=this.compile(n);t=t===null?s:this.alt(t,s)}return t}}default:throw new W4("regexp: unhandled case in compile")}}}class $t{static simplify(e){if(e===null)return null;switch(e.op){case P.Op.CAPTURE:case P.Op.CONCAT:case P.Op.ALTERNATE:{let t=e;for(let n=0;n<e.subs.length;n++){const s=e.subs[n],i=$t.simplify(s);t===e&&i!==s&&(t=P.fromRegexp(e),t.runes=null,t.subs=e.subs.slice(0,e.subs.length)),t!==e&&(t.subs[n]=i)}return t}case P.Op.STAR:case P.Op.PLUS:case P.Op.QUEST:{const t=$t.simplify(e.subs[0]);return $t.simplify1(e.op,e.flags,t,e)}case P.Op.REPEAT:{if(e.min===0&&e.max===0)return new P(P.Op.EMPTY_MATCH);const t=$t.simplify(e.subs[0]);if(e.max===-1){if(e.min===0)return $t.simplify1(P.Op.STAR,e.flags,t,null);if(e.min===1)return $t.simplify1(P.Op.PLUS,e.flags,t,null);const s=new P(P.Op.CONCAT),i=[];for(let o=0;o<e.min-1;o++)i.push(t);return i.push($t.simplify1(P.Op.PLUS,e.flags,t,null)),s.subs=i.slice(0),s}if(e.min===1&&e.max===1)return t;let n=null;if(e.min>0){n=[];for(let s=0;s<e.min;s++)n.push(t)}if(e.max>e.min){let s=$t.simplify1(P.Op.QUEST,e.flags,t,null);for(let i=e.min+1;i<e.max;i++){const o=new P(P.Op.CONCAT);o.subs=[t,s],s=$t.simplify1(P.Op.QUEST,e.flags,o,null)}if(n===null)return s;n.push(s)}if(n!==null){const s=new P(P.Op.CONCAT);return s.subs=n.slice(0),s}return new P(P.Op.NO_MATCH)}}return e}static simplify1(e,t,n,s){return n.op===P.Op.EMPTY_MATCH||e===n.op&&(t&j.NON_GREEDY)===(n.flags&j.NON_GREEDY)?n:(s!==null&&s.op===e&&(s.flags&j.NON_GREEDY)===(t&j.NON_GREEDY)&&n===s.subs[
180]||(s=new P(e),s.flags=t,s.subs=[n]),s)}}class he{constructor(e,t){this.sign=e,this.cls=t}}const Wd=[48,57],Kd=[9,10,12,13,32,32],Qd=[48,57,65,90,95,95,97,122],Yd=new Map([["\\d",new he(1,Wd)],["\\D",new he(-1,Wd)],["\\s",new he(1,Kd)],["\\S",new he(-1,Kd)],["\\w",new he(1,Qd)],["\\W",new he(-1,Qd)]]),Jd=[48,57,65,90,97,122],Xd=[65,90,97,122],Zd=[0,127],ef=[9,9,32,32],tf=[0,31,127,127],nf=[48,57],rf=[33,126],sf=[97,122],of=[32,126],af=[33,47,58,64,91,96,123,126],cf=[9,13,32,32],uf=[65,90],lf=[48,57,65,90,95,95,97,122],hf=[48,57,65,70,97,102],df=new Map([["[:alnum:]",new he(1,Jd)],["[:^alnum:]",new he(-1,Jd)],["[:alpha:]",new he(1,Xd)],["[:^alpha:]",new he(-1,Xd)],["[:ascii:]",new he(1,Zd)],["[:^ascii:]",new he(-1,Zd)],["[:blank:]",new he(1,ef)],["[:^blank:]",new he(-1,ef)],["[:cntrl:]",new he(1,tf)],["[:^cntrl:]",new he(-1,tf)],["[:digit:]",new he(1,nf)],["[:^digit:]",new he(-1,nf)],["[:graph:]",new he(1,rf)],["[:^graph:]",new he(-1,rf)],["[:lower:]",new he(1,sf)],["[:^lower:]",new he(-1,sf)],["[:print:]",new he(1,of)],["[:^print:]",new he(-1,of)],["[:punct:]",new he(1,af)],["[:^punct:]",new he(-1,af)],["[:space:]",new he(1,cf)],["[:^space:]",new he(-1,cf)],["[:upper:]",new he(1,uf)],["[:^upper:]",new he(-1,uf)],["[:word:]",new he(1,lf)],["[:^word:]",new he(-1,lf)],["[:xdigit:]",new he(1,hf)],["[:^xdigit:]",new he(-1,hf)]]);class ct{static charClassToString(e,t){let n="[";for(let s=0;s<t;s+=2){s>0&&(n+=" ");const i=e[s],o=e[s+1];i===o?n+=`0x${i.toString(16)}`:n+=`0x${i.toString(16)}-0x${o.toString(16)}`}return n+="]",n}static cmp(e,t,n,s){const i=e[t]-n;return i!==0?i:s-e[t+1]}static qsortIntPair(e,t,n){const s=((t+n)/2|0)&-2,i=e[s],o=e[s+1];let a=t,u=n;for(;a<=u;){for(;a<n&&ct.cmp(e,a,i,o)<0;)a+=2;for(;u>t&&ct.cmp(e,u,i,o)>0;)u-=2;if(a<=u){if(a!==u){let l=e[a];e[a]=e[u],e[u]=l,l=e[a+1],e[a+1]=e[u+1],e[u+1]=l}a+=2,u-=2}}t<u&&ct.qsortIntPair(e,t,u),a<n&&ct.qsortIntPair(e,a,n)}constructor(e=fe.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;ct.qsortIntPair(this.r,0,this.len-2);let e=2;for(let t=2;t<this.len;t+=2){const n=this.r[t],s=this.r[t+1];if(n<=this.r[e-1]+1){s>this.r[e-1]&&(this.r[e-1]=s);continue}this.r[e]=n,this.r[e+1]=s,e+=2}return this.len=e,this}appendLiteral(e,t){return(t&j.FOLD_CASE)!==0?this.appendFoldedRange(e,e):this.appendRange(e,e)}appendRange(e,t){if(this.len>0){for(let n=2;n<=4;n+=2)if(this.len>=n){const s=this.r[this.len-n],i=this.r[this.len-n+1];if(e<=i+1&&s<=t+1)return e<s&&(this.r[this.len-n]=e),t>i&&(this.r[this.len-n+1]=t),this}}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=se.MIN_FOLD&&t>=se.MAX_FOLD)return this.appendRange(e,t);if(t<se.MIN_FOLD||e>se.MAX_FOLD)return this.appendRange(e,t);e<se.MIN_FOLD&&(this.appendRange(e,se.MIN_FOLD-1),e=se.MIN_FOLD),t>se.MAX_FOLD&&(this.appendRange(se.MAX_FOLD+1,t),t=se.MAX_FOLD);for(let n=e;n<=t;n++){this.appendRange(n,n);for(let s=se.simpleFold(n);s!==n;s=se.simpleFold(s))this.appendRange(s,s)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let n=0;n<e.length;n+=2){const s=e[n],i=e[n+1];t<=s-1&&this.appendRange(t,s-1),t=i+1}return t<=se.MAX_RUNE&&this.appendRange(t,se.MAX_RUNE),this}appendTable(e){for(let t of e){const n=t[0],s=t[1],i=t[2];if(i===1){this.appendRange(n,s);continue}for(let o=n;o<=s;o+=i)this.appendRange(o,o)}return this}appendNegatedTable(e){let t=0;for(let n of e){const s=n[0],i=n[1],o=n[2];if(o===1){t<=s-1&&this.appendRange(t,s-1),t=i+1;continue}for(let a=s;a<=i;a+=o)t<=a-1&&this.appendRange(t,a-1),t=a+1}return t<=se.MAX_RUNE&&this.appendRange(t,se.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let n=0;n<this.len;n+=2){const s=this.r[n],i=this.r[n+1];e<=s-1&&(this.r[t]=e,this.r[t+1]=s-1,t+=2),e=i+1}return this.len=t,e<=se.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=se.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(e,t){let n=e.cls;return t&&(n=new ct().appendFoldedClass(n).cleanClass().toArray()),this.appendClassWithSign(n,e.sign)}toString(){return ct.charClassToString(this.r,this.len)}}class io{static of(e,t){return new io(e,t)}constructor(e,t){this.first=e,this.second=t}}class Z4{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){const e=this.str.codePointAt(this.position);return this.position+=fe.charCount(e),e}lookingAt(e){return this.rest().startsWith(e)}
18rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}}class te{static ERR_INTERNAL_ERROR="regexp/syntax: internal error";static ERR_INVALID_CHAR_RANGE="invalid character class range";static ERR_INVALID_ESCAPE="invalid escape sequence";static ERR_INVALID_NAMED_CAPTURE="invalid named capture";static ERR_INVALID_PERL_OP="invalid or unsupported Perl syntax";static ERR_INVALID_REPEAT_OP="invalid nested repetition operator";static ERR_INVALID_REPEAT_SIZE="invalid repeat count";static ERR_MISSING_BRACKET="missing closing ]";static ERR_MISSING_PAREN="missing closing )";static ERR_MISSING_REPEAT_ARGUMENT="missing argument to repetition operator";static ERR_TRAILING_BACKSLASH="trailing backslash at end of expression";static ERR_DUPLICATE_NAMED_CAPTURE="duplicate capture group name";static ANY_TABLE(){return[[0,se.MAX_RUNE,1]]}static unicodeTable(e){return e==="Any"?io.of(te.ANY_TABLE(),te.ANY_TABLE()):y.CATEGORIES.has(e)?io.of(y.CATEGORIES.get(e),y.FOLD_CATEGORIES.get(e)):y.SCRIPTS.has(e)?io.of(y.SCRIPTS.get(e),y.FOLD_SCRIPT.get(e)):null}static minFoldRune(e){if(e<se.MIN_FOLD||e>se.MAX_FOLD)return e;let t=e;const n=e;for(e=se.simpleFold(e);e!==n;e=se.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===P.Op.EMPTY_MATCH)return null;if(e.op===P.Op.CONCAT&&e.subs.length>0){const t=e.subs[0];return t.op===P.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){const n=new P(P.Op.LITERAL);return n.flags=t,n.runes=fe.stringToRunes(e),n}static parse(e,t){return new te(e,t).parseInternal()}static parseRepeat(e){const t=e.pos();if(!e.more()||!e.lookingAt("{"))return-1;e.skip(1);const n=te.parseInt(e);if(n===-1||!e.more())return-1;let s;if(!e.lookingAt(","))s=n;else{if(e.skip(1),!e.more())return-1;if(e.lookingAt("}"))s=-1;else if((s=te.parseInt(e))===-1)return-1}if(!e.more()||!e.lookingAt("}"))return-1;if(e.skip(1),n<0||n>1e3||s===-2||s>1e3||s>=0&&n>s)throw new De(te.ERR_INVALID_REPEAT_SIZE,e.from(t));return n<<16|s&se.MAX_BMP}static isValidCaptureName(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){const n=e.codePointAt(t);if(n!==O.CODES.get("_")&&!fe.isalnum(n))return!1}return!0}static parseInt(e){const t=e.pos();for(;e.more()&&e.peek()>=O.CODES.get("0")&&e.peek()<=O.CODES.get("9");)e.skip(1);const n=e.from(t);return n.length===0||n.length>1&&n.codePointAt(0)===O.CODES.get("0")?-1:n.length>8?-2:parseFloat(n,10)}static isCharClass(e){return e.op===P.Op.LITERAL&&e.runes.length===1||e.op===P.Op.CHAR_CLASS||e.op===P.Op.ANY_CHAR_NOT_NL||e.op===P.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case P.Op.LITERAL:return e.runes.length===1&&e.runes[0]===t;case P.Op.CHAR_CLASS:for(let n=0;n<e.runes.length;n+=2)if(e.runes[n]<=t&&t<=e.runes[n+1])return!0;return!1;case P.Op.ANY_CHAR_NOT_NL:return t!==O.CODES.get(`
19`);case P.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(e,t){switch(e.op){case P.Op.ANY_CHAR:break;case P.Op.ANY_CHAR_NOT_NL:te.matchRune(t,O.CODES.get(`
20`))&&(e.op=P.Op.ANY_CHAR);break;case P.Op.CHAR_CLASS:t.op===P.Op.LITERAL?e.runes=new ct(e.runes).appendLiteral(t.runes[0],t.flags).toArray():e.runes=new ct(e.runes).appendClass(t.runes).toArray();break;case P.Op.LITERAL:if(t.runes[0]===e.runes[0]&&t.flags===e.flags)break;e.op=P.Op.CHAR_CLASS,e.runes=new ct().appendLiteral(e.runes[0],e.flags).appendLiteral(t.runes[0],t.flags).toArray();break}}static parseEscape(e){const t=e.pos();if(e.skip(1),!e.more())throw new De(te.ERR_TRAILING_BACKSLASH);let n=e.pop();e:switch(n){case O.CODES.get("1"):case O.CODES.get("2"):case O.CODES.get("3"):case O.CODES.get("4"):case O.CODES.get("5"):case O.CODES.get("6"):case O.CODES.get("7"):if(!e.more(
20)||e.peek()<O.CODES.get("0")||e.peek()>O.CODES.get("7"))break;case O.CODES.get("0"):{let s=n-O.CODES.get("0");for(let i=1;i<3&&!(!e.more()||e.peek()<O.CODES.get("0")||e.peek()>O.CODES.get("7"));i++)s=s*8+e.peek()-O.CODES.get("0"),e.skip(1);return s}case O.CODES.get("x"):{if(!e.more())break;if(n=e.pop(),n===O.CODES.get("{")){let o=0,a=0;for(;;){if(!e.more())break e;if(n=e.pop(),n===O.CODES.get("}"))break;const u=fe.unhex(n);if(u<0||(a=a*16+u,a>se.MAX_RUNE))break e;o++}if(o===0)break e;return a}const s=fe.unhex(n);if(!e.more())break;n=e.pop();const i=fe.unhex(n);if(s<0||i<0)break;return s*16+i}case O.CODES.get("a"):return O.CODES.get("\x07");case O.CODES.get("f"):return O.CODES.get("\f");case O.CODES.get("n"):return O.CODES.get(`
21`);case O.CODES.get("r"):return O.CODES.get("\r");case O.CODES.get("t"):return O.CODES.get("	");case O.CODES.get("v"):return O.CODES.get("\v");default:if(!fe.isalnum(n))return n;break}throw new De(te.ERR_INVALID_ESCAPE,e.from(t))}static parseClassChar(e,t){if(!e.more())throw new De(te.ERR_MISSING_BRACKET,e.from(t));return e.lookingAt("\\")?te.parseEscape(e):e.pop()}static concatRunes(e,t){return[...e,...t]}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null}newRegexp(e){let t=this.free;return t!==null&&t.subs!==null&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):t=new P(e),t}reuse(e){e.subs!==null&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}pop(){return this.stack.pop()}popToPseudo(){const e=this.stack.length;let t=e;for(;t>0&&!P.isPseudoOp(this.stack[t-1].op);)t--;const n=this.stack.slice(t,e);return this.stack=this.stack.slice(0,t),n}push(e){if(e.op===P.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],this.flags&-2))return null;e.op=P.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags&-2}else if(e.op===P.Op.CHAR_CLASS&&e.runes.length===4&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&se.simpleFold(e.runes[0])===e.runes[2]&&se.simpleFold(e.runes[2])===e.runes[0]||e.op===P.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]+1===e.runes[1]&&se.simpleFold(e.runes[0])===e.runes[1]&&se.simpleFold(e.runes[1])===e.runes[0]){if(this.maybeConcat(e.runes[0],this.flags|j.FOLD_CASE))return null;e.op=P.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|j.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),e}maybeConcat(e,t){const n=this.stack.length;if(n<2)return!1;const s=this.stack[n-1],i=this.stack[n-2];
21return s.op!==P.Op.LITERAL||i.op!==P.Op.LITERAL||(s.flags&j.FOLD_CASE)!==(i.flags&j.FOLD_CASE)?!1:(i.runes=te.concatRunes(i.runes,s.runes),e>=0?(s.runes=[e],s.flags=t,!0):(this.pop(),this.reuse(s),!1))}newLiteral(e,t){const n=this.newRegexp(P.Op.LITERAL);return n.flags=t,(t&j.FOLD_CASE)!==0&&(e=te.minFoldRune(e)),n.runes=[e],n}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){const t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(e,t,n,s,i,o){let a=this.flags;if((a&j.PERL_X)!==0&&(i.more()&&i.lookingAt("?")&&(i.skip(1),a^=j.NON_GREEDY),o!==-1))throw new De(te.ERR_INVALID_REPEAT_OP,i.from(o));const u=this.stack.length;if(u===0)throw new De(te.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));const l=this.stack[u-1];if(P.isPseudoOp(l.op))throw new De(te.ERR_MISSING_REPEAT_ARGUMENT,i.from(s));const d=this.newRegexp(e);d.min=t,d.max=n,d.flags=a,d.subs=[l],this.stack[u-1]=d}concat(){this.maybeConcat(-1,0);const e=this.popToPseudo();return e.length===0?this.push(this.newRegexp(P.Op.EMPTY_MATCH)):this.push(this.collapse(e,P.Op.CONCAT))}alternate(){const e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),e.length===0?this.push(this.newRegexp(P.Op.NO_MATCH)):this.push(this.collapse(e,P.Op.ALTERNATE))}cleanAlt(e){e.op===P.Op.CHAR_CLASS&&(e.runes=new ct(e.runes).cleanClass().toArray(),e.runes.length===2&&e.runes[0]===0&&e.runes[1]===se.MAX_RUNE?(e.runes=null,e.op=P.Op.ANY_CHAR):e.runes.length===4&&e.runes[0]===0&&e.runes[1]===O.CODES.get(`
22`)-1&&e.runes[2]===O.CODES.get(`
23`)+1&&e.runes[3]===se.MAX_RUNE&&(e.runes=null,e.op=P.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(e.length===1)return e[0];let n=0;for(let a of e)n+=a.op===t?a.subs.length:1;let s=new Array(n).fill(null),i=0;for(let a of e)a.op===t?(s.splice(i,a.subs.length,...a.subs),i+=a.subs.length,this.reuse(a)):s[i++]=a;let o=this.newRegexp(t);if(o.subs=s,t===P.Op.ALTERNATE&&(o.subs=this.factor(o.subs),o.subs.length===1)){const a=o;o=o.subs[0],this.reuse(a)}return o}factor(e){if(e.length<2)return e;let t=0,n=e.length,s=0,i=null,o=0,a=0,u=0;for(let d=0;d<=n;d++){let p=null,g=0,I=0;if(d<n){let v=e[t+d];if(v.op===P.Op.CONCAT&&v.subs.length>0&&(v=v.subs[0]),v.op===P.Op.LITERAL&&(p=v.runes,g=v.runes.length,I=v.flags&j.FOLD_CASE),I===a){let k=0;for(;k<o&&k<g&&i[k]===p[k];)k++;if(k>0){o=k;continue}}}if(d!==u)if(d===u+1)e[s++]=e[t+u];else{const v=this.newRegexp(P.Op.LITERAL);v.flags=a,v.runes=i.slice(0,o);for(let W=u;W<d;W++)e[t+W]=this.removeLeadingString(e[t+W],o);const k=this.collapse(e.slice(t+u,t+d),P.Op.ALTERNATE),F=this.newRegexp(P.Op.CONCAT);F.subs=[v,k],e[s++]=F}u=d,i=p,o=g,a=I}n=s,t=0,u=0,s=0;let l=null;for(let d=0;d<=n;d++){let p=null;if(!(d<n&&(p=te.leadingRegexp(e[t+d]),l!==null&&l.equals(p)&&(te.isCharClass(l)||l.op===P.Op.REPEAT&&l.min===l.max&&te.isCharClass(l.subs[0]))))){if(d!==u)if(d===u+1)e[s++]=e[t+u];else{const g=l;for(let k=u;k<d;k++){const F=k!==u;e[t+k]=this.removeLeadingRegexp(e[t+k],F)}const I=this.collapse(e.slice(t+u,t+d),P.Op.ALTERNATE),v=this.newRegexp(P.Op.CONCAT);v.subs=[g,I],e[s++]=v}u=d,l=p}}n=s,t=0,u=0,s=0;for(let d=0;d<=n;d++)if(!(d<n&&te.isCharClass(e[t+d]))){if(d!==u)if(d===u+1)e[s++]=e[t+u];else{let p=u;for(let I=u+1;I<d;I++){const v=e[t+p],k=e[t+I];(v.op<k.op||v.op===k.op&&(v.runes!==null?v.runes.length:0)<(k.runes!==null?k.runes.length:0))&&(p=I)}const g=e[t+u];e[t+u]=e[t+p],e[t+p]=g;for(let I=u+1;I<d;I++)te.mergeCharClass(e[t+u],e[t+I]),this.reuse(e[t+I]);this.cleanAlt(e[t+u]),e[s++]=e[t+u]}d<n&&(e[s++]=e[t+d]),u=d+1}n=s,t=0,u=0,s=0;for(let d=0;d<n;++d)d+1<n&&e[t+d].op===P.Op.EMPTY_MATCH&&e[t+d+1].op===P.Op.EMPTY_MATCH||(e[s++]=e[t+d]);return n=s,t=0,e.slice(t,n)}removeLeadingString(e,t){if(e.op===P.Op.CONCAT&&e.subs.length>0){const n=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=n,n.op===P.Op.EMPTY_MATCH)switch(this.reuse(n),e.subs.length){case 0:case 1:e.op=P.Op.EMPTY_MATCH,e.subs=null;break;case 2:{const s=e;e=e.subs[1],this.reuse(s);break}default:e.subs=e.subs.slice(1,e.subs.length);break}return e}return e.op===P.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),e.runes.length===0&&(e.op=P.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===P.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:{e.op=P.Op.EMPTY_MATCH,e.subs=P.emptySubs();break}case 1:{const n=e;e=e.subs[0],this.reuse(n);break}}return e}return t&&this.reuse(e),this.newRegexp(P.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&j.LITERAL)!==0)return te.literalRegexp(this.wholeRegexp,this.flags);let e=-1,t=-1,n=-1;
23const s=new Z4(this.wholeRegexp);for(;s.more();){let o=-1;e:switch(s.peek()){case O.CODES.get("("):if((this.flags&j.PERL_X)!==0&&s.lookingAt("(?")){this.parsePerlFlags(s);break}this.op(P.Op.LEFT_PAREN).cap=++this.numCap,s.skip(1);break;case O.CODES.get("|"):this.parseVerticalBar(),s.skip(1);break;case O.CODES.get(")"):this.parseRightParen(),s.skip(1);break;case O.CODES.get("^"):(this.flags&j.ONE_LINE)!==0?this.op(P.Op.BEGIN_TEXT):this.op(P.Op.BEGIN_LINE),s.skip(1);break;case O.CODES.get("$"):(this.flags&j.ONE_LINE)!==0?this.op(P.Op.END_TEXT).flags|=j.WAS_DOLLAR:this.op(P.Op.END_LINE),s.skip(1);break;case O.CODES.get("."):(this.flags&j.DOT_NL)!==0?this.op(P.Op.ANY_CHAR):this.op(P.Op.ANY_CHAR_NOT_NL),s.skip(1);break;case O.CODES.get("["):this.parseClass(s);break;case O.CODES.get("*"):case O.CODES.get("+"):case O.CODES.get("?"):{o=s.pos();let a=null;switch(s.pop()){case O.CODES.get("*"):a=P.Op.STAR;break;case O.CODES.get("+"):a=P.Op.PLUS;break;case O.CODES.get("?"):a=P.Op.QUEST;break}this.repeat(a,t,n,o,s,e);break}case O.CODES.get("{"):{o=s.pos();const a=te.parseRepeat(s);if(a<0){s.rewindTo(o),this.literal(s.pop());break}t=a>>16,n=(a&se.MAX_BMP)<<16>>16,this.repeat(P.Op.REPEAT,t,n,o,s,e);break}case O.CODES.get("\\"):{const a=s.pos();if(s.skip(1),(this.flags&j.PERL_X)!==0&&s.more())switch(s.pop()){case O.CODES.get("A"):this.op(P.Op.BEGIN_TEXT);break e;case O.CODES.get("b"):this.op(P.Op.WORD_BOUNDARY);break e;case O.CODES.get("B"):this.op(P.Op.NO_WORD_BOUNDARY);break e;case O.CODES.get("C"):throw new De(te.ERR_INVALID_ESCAPE,"\\C");case O.CODES.get("Q"):{let p=s.rest();const g=p.indexOf("\\E");g>=0&&(p=p.substring(0,g)),s.skipString(p),s.skipString("\\E");let I=0;for(;I<p.length;){const v=p.codePointAt(I);this.literal(v),I+=fe.charCount(v)}break e}case O.CODES.get("z"):this.op(P.Op.END_TEXT);break e;default:s.rewindTo(a);break}const u=this.newRegexp(P.Op.CHAR_CLASS);if(u.flags=this.flags,s.lookingAt("\\p")||s.lookingAt("\\P")){const d=new ct;if(this.parseUnicodeClass(s,d)){u.runes=d.toArray(),this.push(u);break e}}const l=new ct;if(this.parsePerlClassEscape(s,l)){u.runes=l.toArray(),this.push(u);break e}s.rewindTo(a),this.reuse(u),this.literal(te.parseEscape(s));break}default:this.literal(s.pop());break}e=o}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new De(te.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(e){const t=e.pos(),n=e.rest();if(n.startsWith("(?P<")||n.startsWith("(?<")){const a=n.charAt(2)==="P"?4:3,u=n.indexOf(">");if(u<0)throw new De(te.ERR_INVALID_NAMED_CAPTURE,n);const l=n.substring(a,u);if(e.skipString(l),e.skip(a+1),!te.isValidCaptureName(l))throw new De(te.ERR_INVALID_NAMED_CAPTURE,n.substring(0,u+1));const d=this.op(P.Op.LEFT_PAREN);if(d.cap=++this.numCap,this.namedGroups[l])throw new De(te.ERR_DUPLICATE_NAMED_CAPTURE,l);this.namedGroups[l]=this.numCap,d.name=l;return}e.skip(2);let s=this.flags,i=1,o=!1;e:for(;e.more();){const a=e.pop();switch(a){case O.CODES.get("i"):s|=j.FOLD_CASE,o=!0;break;case O.CODES.get("m"):s&=-17,o=!0;break;case O.CODES.get("s"):s|=j.DOT_NL,o=!0;break;case O.CODES.get("U"):s|=j.NON_GREEDY,o=!0;break;case O.CODES.get("-"):if(i<0)break e;i=-1,s=~s,o=!1;break;case O.CODES.get(":"):case O.CODES.get(")"):if(i<0){if(!o)break e;s=~s}a===O.CODES.get(":")&&this.op(P.Op.LEFT_PAREN),this.flags=s;return;default:break e}}throw new De(te.ERR_INVALID_PERL_OP,e.from(t))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(P.Op.VERTICAL_BAR)}swapVerticalBar(){const e=this.stack.length;if(e>=3&&this.stack[e-2].op===P.Op.VERTICAL_BAR&&te.isCharClass(this.stack[e-1])&&te.isCharClass(this.stack[e-3])){let t=this.stack[e-1],n=this.stack[e-3];if(t.op>n.op){const s=n;n=t,t=s,this.stack[e-3]=n}return te.mergeCharClass(n,t),this.reuse(t),this.pop(),!0}if(e>=2){const t=this.stack[e-1],n=this.stack[e-2];if(n.op===P.Op.VERTICAL_BAR)return e>=3&&this.cleanAlt(this.stack[e-3]),this.stack[e-2]=t,this.stack[e-1]=n,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new De(te.ERR_INTERNAL_ERROR,"stack underflow");const t=this.pop(),n=this.pop();if(n.op!==P.Op.LEFT_PAREN)throw new De(te.ERR_MISSING_PAREN,this.wholeRegexp);this.flags=n.flags,n.cap===0?this.push(t):(n.op=P.Op.CAPTURE,n.subs=[t],this.push(n))}parsePerlClassEscape(e,t){const n=e.pos();if((this.flags&j.PERL_X)===0||!e.more()||e.pop()!==O.CODES.get("\\")||!e.more())return!1;e.pop();const s=e.from(n),i=Yd.has(s)?Yd.get(s):null;return i===null?!1:(t.appendGroup(i,(this.flags&j.FOLD_CASE)!==0),!0)}parseNamedClass(e,t){const n=e.rest(),s=n.indexOf(":]");if(s<0)return!1;const i=n.substring(0,s+2);
23e.skipString(i);const o=df.has(i)?df.get(i):null;if(o===null)throw new De(te.ERR_INVALID_CHAR_RANGE,i);return t.appendGroup(o,(this.flags&j.FOLD_CASE)!==0),!0}parseUnicodeClass(e,t){const n=e.pos();if((this.flags&j.UNICODE_GROUPS)===0||!e.lookingAt("\\p")&&!e.lookingAt("\\P"))return!1;e.skip(1);let s=1,i=e.pop();if(i===O.CODES.get("P")&&(s=-1),!e.more())throw e.rewindTo(n),new De(te.ERR_INVALID_CHAR_RANGE,e.rest());i=e.pop();let o;if(i!==O.CODES.get("{"))o=fe.runeToString(i);else{const d=e.rest(),p=d.indexOf("}");if(p<0)throw e.rewindTo(n),new De(te.ERR_INVALID_CHAR_RANGE,e.rest());o=d.substring(0,p),e.skipString(o),e.skip(1)}o.length!==0&&o.codePointAt(0)===O.CODES.get("^")&&(s=0-s,o=o.substring(1));const a=te.unicodeTable(o);if(a===null)throw new De(te.ERR_INVALID_CHAR_RANGE,e.from(n));const u=a.first,l=a.second;if((this.flags&j.FOLD_CASE)===0||l===null)t.appendTableWithSign(u,s);else{const d=new ct().appendTable(u).appendTable(l).cleanClass().toArray();t.appendClassWithSign(d,s)}return!0}parseClass(e){const t=e.pos();e.skip(1);const n=this.newRegexp(P.Op.CHAR_CLASS);n.flags=this.flags;const s=new ct;let i=1;e.more()&&e.lookingAt("^")&&(i=-1,e.skip(1),(this.flags&j.CLASS_NL)===0&&s.appendRange(O.CODES.get(`
24`),O.CODES.get(`
25`)));let o=!0;for(;!e.more()||e.peek()!==O.CODES.get("]")||o;){if(e.more()&&e.lookingAt("-")&&(this.flags&j.PERL_X)===0&&!o){const d=e.rest();if(d==="-"||!d.startsWith("-]"))throw e.rewindTo(t),new De(te.ERR_INVALID_CHAR_RANGE,e.rest())}o=!1;const a=e.pos();if(e.lookingAt("[:")){if(this.parseNamedClass(e,s))continue;e.rewindTo(a)}if(this.parseUnicodeClass(e,s)||this.parsePerlClassEscape(e,s))continue;e.rewindTo(a);const u=te.parseClassChar(e,t);let l=u;if(e.more()&&e.lookingAt("-")){if(e.skip(1),e.more()&&e.lookingAt("]"))e.skip(-1);else if(l=te.parseClassChar(e,t),l<u)throw new De(te.ERR_INVALID_CHAR_RANGE,e.from(a))}(this.flags&j.FOLD_CASE)===0?s.appendRange(u,l):s.appendFoldedRange(u,l)}e.skip(1),s.cleanClass(),i<0&&s.negateClass(),n.runes=s.toArray(),this.push(n)}}class e_{constructor(){this.inst=null,this.cap=[]}}class ff{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(e){const t=this.sparse[e];return t<this.size&&this.densePcs[t]===e}isEmpty(){return this.size===0}add(e){const t=this.size++;return this.sparse[e]=t,this.denseThreads[t]=null,this.densePcs[t]=e,t}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let e="{";for(let t=0;t<this.size;t++)t!==0&&(e+=", "),e+=this.densePcs[t];return e+="}",e}}class Cs{static fromRE2(e){const t=new Cs;return t.prog=e.prog,t.re2=e,t.q0=new ff(t.prog.numInst()),t.q1=new ff(t.prog.numInst()),t.pool=[],t.poolSize=0,t.matched=!1,t.matchcap=Array(t.prog.numCap<2?2:t.prog.numCap).fill(0),t.ncap=0,t}static fromMachine(e){const t=new Cs;return t.re2=e.re2,t.prog=e.prog,t.q0=e.q0,t.q1=e.q1,t.pool=e.pool,t.poolSize=e.poolSize,t.matched=e.matched,t.matchcap=e.matchcap,t.ncap=e.ncap,t}init(e){this.ncap=e,e>this.matchcap.length?this.initNewCap(e):this.resetCap(e)}resetCap(e){for(let t=0;t<this.poolSize;t++){const n=this.pool[t];n.cap=Array(e).fill(0)}}initNewCap(e){for(let t=0;t<this.poolSize;t++){const n=this.pool[t];n.cap=Array(e).fill(0)}this.matchcap=Array(e).fill(0)}submatches(){return this.ncap===0?fe.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(e){let t;return this.poolSize>0?(this.poolSize--,t=this.pool[this.poolSize]):t=new e_,t.inst=e,t}freeQueue(e,t=0){const n=e.size-t,s=this.poolSize+n;this.pool.length<s&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,s)));for(let i=t;i<e.size;i++){const o=e.denseThreads[i];o!==null&&(this.pool[this.poolSize]=o,this.poolSize++)}e.clear()}freeThread(e){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=e,this.poolSize++}match(e,t,n){const s=this.re2.cond;if(s===fe.EMPTY_ALL||(n===j.ANCHOR_START||n===j.ANCHOR_BOTH)&&t!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,o=this.q1,a=e.step(t),u=a>>3,l=a&7,d=-1,p=0;a!==Jn.EOF()&&(a=e.step(t+l),d=a>>3,p=a&7);let g;for(t===0?g=fe.emptyOpContext(-1,u):g=e.context(t);;){if(i.isEmpty()){if((s&fe.EMPTY_BEGIN_TEXT)!==0&&t!==0||this.matched)break;if(this.re2.prefix.length!==0&&d!==this.re2.prefixRune&&e.canCheckPrefix()){const k=e.index(this.re2,t);if(k<0)break;t+=k,a=e.step(t),u=a>>3,l=a&7,a=e.step(t+l),d=a>>3,p=a&7}}!this.matched&&(t===0||n===j.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=t),this.add(i,this.prog.start,t,this.matchcap,g,null));const I=t+l;if(g=e.context(I),this.step(i,o,t,I,u,g,n,t===e.endPos()),l===0||this.ncap===0&&this.matched)break;t+=l,u=d,l=p,u!==-1&&(a=e.step(t+l),d=a>>3,p=a&7);const v=i;i=o,o=v}return this.freeQueue(o),this.matched}step(e,t,n,s,i,o,a,u){const l=this.re2.longest;for(let d=0;d<e.size;d++){let p=e.denseThreads[d];if(p===null)continue;if(l&&this.matched&&this.ncap>0&&this.matchcap[0]<p.cap[0]){this.freeThread(p);continue}const g=p.inst;let I=!1;switch(g.op){case Q.MATCH:if(a===j.ANCHOR_BOTH&&!u)break;this.ncap>0&&(!l||!this.matched||this.matchcap[1]<n)&&(p.cap[1]=n,this.matchcap=p.cap.slice(0,this.ncap)),l||this.freeQueue(e,d+1),this.matched=!0;break;case Q.RUNE:I=g.matchRune(i);break;case Q.RUNE1:I=i===g.runes[0];break;case Q.RUNE_ANY:I=!0;break;case Q.RUNE_ANY_NOT_NL:I=i!==O.CODES.get(`
26`);break;default:throw new Error("bad inst")}I&&(p=this.add(t,g.out,s,p.cap,o,p)),p!==null&&(this.freeThread(p),e.denseThreads[d]=null)}e.clear()}add(e,t,n,s,i,o){if(t===0||e.contains(t))return o;const a=e.add(t),u=this.prog.inst[t];switch(u.op){case Q.FAIL:break;case Q.ALT:case Q.ALT_MATCH:o=this.add(e,u.out,n,s,i,o),o=this.add(e,u.arg,n,s,i,o);break;case Q.EMPTY_WIDTH:(u.arg&~i)===0&&(o=this.add(e,u.out,n,s,i,o));break;case Q.NOP:o=this.add(e,u.out,n,s,i,o);break;case Q.CAPTURE:if(u.arg<this.ncap){const l=s[u.arg];s[u.arg]=n,this.add(e,u.out,n,s,i,null),s[u.arg]=l}else o=this.add(e,u.out,n,s,i,o);break;case Q.MATCH:case Q.RUNE:case Q.RUNE1:case Q.RUNE_ANY:case Q.RUNE_ANY_NOT_NL:o===null?o=this.alloc(u):o.inst=u,this.ncap>0&&o.cap!==s&&(o.cap=s.slice(0,this.ncap)),e.denseThreads[a]=o,o=null;break;default:throw new Error("unhandled")}return o}}class t_{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}compareAndSet(e,t){return this.value===e?(this.value=t,!0):!1}}class Yn{static initTest(e){const t=Yn.compile(e),n=new Yn(t.expr,t.prog,t.numSubexp,t.longest);return n.cond=t.cond,n.prefix=t.prefix,n.prefixUTF8=t.prefixUTF8,n.prefixComplete=t.prefixComplete,n.prefixRune=t.prefixRune,n}static compile(e){return Yn.compileImpl(e,j.PERL,!1)}static compilePOSIX(e){return Yn.compileImpl(e,j.POSIX,!0)}static compileImpl(e,t,n){let s=te.parse(e,t);const i=s.maxCap();s=$t.simplify(s);const o=so.compileRegexp(s),a=new Yn(e,o,i,n),[u,l]=o.prefix();return a.prefixComplete=u,a.prefix=l,a.prefixUTF8=fe.stringToUtf8ByteArray(a.prefix),a.prefix.length>0&&(a.prefixRune=a.prefix.codePointAt(0)),a.namedGroups=s.namedGroups,a}static match(e,t){return Yn.compile(e).match(t)}constructor(e,t,n=0,s=0){this.expr=e,this.prog=t,this.numSubexp=n,this.longest=s,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new t_}numberOfCapturingGroups(){return this.numSubexp}get(){let e;do e=this.pooled.get();while(e&&!this.pooled.compareAndSet(e,e.next));return e}reset(){this.pooled.set(null)}put(e,t){let n=this.pooled.get();do n=this.pooled.get(),!t&&n&&(e=Cs.fromMachine(e),t=!0),e.next!==n&&(e.next=n);while(!this.pooled.compareAndSet(n,e))}toString(){return this.expr}doExecute(e,t,n,s){let i=this.get(),o=!1;i?i.next!==null&&(i=Cs.fromMachine(i),o=!0):(i=Cs.fromRE2(this),o=!0),i.init(s);
26const a=i.match(e,t,n)?i.submatches():null;return this.put(i,o),a}match(e){return this.doExecute(ke.fromUTF16(e),0,j.UNANCHORED,0)!==null}matchWithGroup(e,t,n,s,i){return e instanceof Pn||(e=ec.utf16(e)),this.matchMachineInput(e,t,n,s,i)}matchMachineInput(e,t,n,s,i){if(t>n)return[!1,null];const o=e.isUTF16Encoding()?ke.fromUTF16(e.asCharSequence(),0,n):ke.fromUTF8(e.asBytes(),0,n),a=this.doExecute(o,t,s,2*i);return a===null?[!1,null]:[!0,a]}matchUTF8(e){return this.doExecute(ke.fromUTF8(e),0,j.UNANCHORED,0)!==null}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,n){let s=0,i=0,o="";const a=ke.fromUTF16(e);let u=0;for(;i<=e.length;){const l=this.doExecute(a,i,j.UNANCHORED,2);if(l===null||l.length===0)break;o+=e.substring(s,l[0]),(l[1]>s||l[0]===0)&&(o+=t(e.substring(l[0],l[1])),u++),s=l[1];const d=a.step(i)&7;if(i+d>l[1]?i+=d:i+1>l[1]?i++:i=l[1],u>=n)break}return o+=e.substring(s),o}pad(e){if(e===null)return null;let t=(1+this.numSubexp)*2;if(e.length<t){let n=new Array(t).fill(-1);for(let s=0;s<e.length;s++)n[s]=e[s];e=n}return e}allMatches(e,t,n=s=>s){let s=[];const i=e.endPos();t<0&&(t=i+1);let o=0,a=0,u=-1;for(;a<t&&o<=i;){const l=this.doExecute(e,o,j.UNANCHORED,this.prog.numCap);if(l===null||l.length===0)break;let d=!0;if(l[1]===o){l[0]===u&&(d=!1);const p=e.step(o);p<0?o=i+1:o+=p&7}else o=l[1];u=l[1],d&&(s.push(n(this.pad(l))),a++)}return s}findUTF8(e){const t=this.doExecute(ke.fromUTF8(e),0,j.UNANCHORED,2);return t===null?null:e.slice(t[0],t[1])}findUTF8Index(e){const t=this.doExecute(ke.fromUTF8(e),0,j.UNANCHORED,2);return t===null?null:t.slice(0,2)}find(e){const t=this.doExecute(ke.fromUTF16(e),0,j.UNANCHORED,2);return t===null?"":e.substring(t[0],t[1])}findIndex(e){return this.doExecute(ke.fromUTF16(e),0,j.UNANCHORED,2)}findUTF8Submatch(e){const t=this.doExecute(ke.fromUTF8(e),0,j.UNANCHORED,this.prog.numCap);if(t===null)return null;const n=new Array(1+this.numSubexp).fill(null);for(let s=0;s<n.length;s++)2*s<t.length&&t[2*s]>=0&&(n[s]=e.slice(t[2*s],t[2*s+1]));return n}findUTF8SubmatchIndex(e){return this.pad(this.doExecute(ke.fromUTF8(e),0,j.UNANCHORED,this.prog.numCap))}findSubmatch(e){const t=this.doExecute(ke.fromUTF16(e),0,j.UNANCHORED,this.prog.numCap);if(t===null)return null;const n=new Array(1+this.numSubexp).fill(null);for(let s=0;s<n.length;s++)2*s<t.length&&t[2*s]>=0&&(n[s]=e.substring(t[2*s],t[2*s+1]));return n}findSubmatchIndex(e){return this.pad(this.doExecute(ke.fromUTF16(e),0,j.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){const n=this.allMatches(ke.fromUTF8(e),t,s=>e.slice(s[0],s[1]));return n.length===0?null:n}findAllUTF8Index(e,t){const n=this.allMatches(ke.fromUTF8(e),t,s=>s.slice(0,2));return n.length===0?null:n}findAll(e,t){const n=this.allMatches(ke.fromUTF16(e),t,s=>e.substring(s[0],s[1]));return n.length===0?null:n}findAllIndex(e,t){const n=this.allMatches(ke.fromUTF16(e),t,s=>s.slice(0,2));return n.length===0?null:n}findAllUTF8Submatch(e,t){const n=this.allMatches(ke.fromUTF8(e),t,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=e.slice(s[2*o],s[2*o+1]));return i});return n.length===0?null:n}findAllUTF8SubmatchIndex(e,t){const n=this.allMatches(ke.fromUTF8(e),t);return n.length===0?null:n}findAllSubmatch(e,t){const n=this.allMatches(ke.fromUTF16(e),t,s=>{let i=new Array(s.length/2|0).fill(null);for(let o=0;o<i.length;o++)s[2*o]>=0&&(i[o]=e.substring(s[2*o],s[2*o+1]));return i});return n.length===0?null:n}findAllSubmatchIndex(e,t){const n=this.allMatches(ke.fromUTF16(e),t);return n.length===0?null:n}}class xt{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(e){return fe.quoteMeta(e)}static compile(e,t=0){let n=e;if((t&xt.CASE_INSENSITIVE)!==0&&(n=`(?i)${n}`),(t&xt.DOTALL)!==0&&(n=`(?s)${n}`),(t&xt.MULTILINE)!==0&&(n=`(?m)${n}`),(t&-32)!==0)throw new K4("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH");let s=j.PERL;(t&xt.DISABLE_UNICODE_GROUPS)!==0&&(s&=-129);const i=new xt(e,t);return i.re2Input=Yn.compileImpl(n,s,(t&xt.LONGEST_MATCH)!==0),i}static matches(e,t){return xt.compile(e).matcher(t).matches()}static initTest(e,t,n){if(e==null)throw new Error("pattern is null");if(n==null)throw new Error("re2 is null");const s=new xt(e,t);return s.re2Input=n,s}
26constructor(e,t){this.patternInput=e,this.flagsInput=t}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.matcher(e).matches()}matcher(e){return Array.isArray(e)&&(e=ec.utf8(e)),new Q4(this,e)}split(e,t=0){const n=this.matcher(e),s=[];let i=0,o=0;for(;n.find();){if(o===0&&n.end()===0){o=n.end();continue}if(t>0&&s.length===t-1)break;if(o===n.start()){if(t===0){i+=1,o=n.end();continue}}else for(;i>0;)s.push(""),i-=1;s.push(n.substring(o,n.start())),o=n.end()}if(t===0&&o!==n.inputLength()){for(;i>0;)s.push(""),i-=1;s.push(n.substring(o,n.inputLength()))}return(t!==0||s.length===0)&&s.push(n.substring(o,n.inputLength())),s}toString(){return this.patternInput}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e?!0:e===null||this.constructor!==e.constructor?!1:this.flagsInput===e.flagsInput&&this.patternInput===e.patternInput}}class et{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}et.UNAUTHENTICATED=new et(null),et.GOOGLE_CREDENTIALS=new et("google-credentials-uid"),et.FIRST_PARTY=new et("first-party-uid"),et.MOCK_USER=new et("mock-user");let li="12.15.0";function n_(r){li=r}const hr=new Hl("@firebase/firestore");function vs(){return hr.logLevel}function r_(r){hr.setLogLevel(r)}function M(r,...e){if(hr.logLevel<=ce.DEBUG){const t=e.map(Ql);hr.debug(`Firestore (${li}): ${r}`,...t)}}function Le(r,...e){if(hr.logLevel<=ce.ERROR){const t=e.map(Ql);hr.error(`Firestore (${li}): ${r}`,...t)}}function We(r,...e){if(hr.logLevel<=ce.WARN){const t=e.map(Ql);hr.warn(`Firestore (${li}): ${r}`,...t)}}function Ql(r){if(typeof r=="string")return r;try{return(function(t){return JSON.stringify(t)})(r)}catch{return r}}function H(r,e,t){let n="Unexpected state";typeof e=="string"?n=e:t=e,Vp(r,n,t)}function Vp(r,e,t){let n=`FIRESTORE (${li}) INTERNAL ASSERTION FAILED: ${e} (ID: ${r.toString(16)})`;if(t!==void 0)try{n+=" CONTEXT: "+JSON.stringify(t)}catch{n+=" CONTEXT: "+t}throw Le(n),new Error(n)}function U(r,e,t,n){let s="Unexpected state";typeof t=="string"?s=t:n=t,r||Vp(e,s,n)}function s_(r,e){r||H(57014,e)}function G(r,e){return r}const N={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class L extends mn{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class nt{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class Op{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Dp{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(et.UNAUTHENTICATED)))}shutdown(){}}class i_{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 o_{constructor(e){this.t=e,this.currentUser=et.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){U(this.o===void 0,42304);let n=this.i;const s=u=>this.i!==n?(n=this.i,t(u)):Promise.resolve();let i=new nt;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new nt,e.enqueueRetryable((()=>s(this.currentUser)))};const o=()=>{const u=i;e.enqueueRetryable((async()=>{await u.promise,await s(this.currentUser)}))},a=u=>{M("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=u,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit((u=>a(u))),setTimeout((()=>
vendor: 1,949 bytes, line 26
26{if(!this.auth){const u=this.t.getImmediate({optional:!0});u?a(u):(M("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new nt)}}),0),o()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((n=>this.i!==e?(M("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):n?(U(typeof n.accessToken=="string",31837,{l:n}),new Op(n.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return U(e===null||typeof e=="string",2055,{h:e}),new et(e)}}class a_{constructor(e,t,n){this.T=e,this.P=t,this.R=n,this.type="FirstParty",this.user=et.FIRST_PARTY,this.I=new Map}A(){return this.R?this.R():null}get headers(){this.I.set("X-Goog-AuthUser",this.T);const e=this.A();return e&&this.I.set("Authorization",e),this.P&&this.I.set("X-Goog-Iam-Authorization-Token",this.P),this.I}}class c_{constructor(e,t,n){this.T=e,this.P=t,this.R=n}getToken(){return Promise.resolve(new a_(this.T,this.P,this.R))}start(e,t){e.enqueueRetryable((()=>t(et.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class ll{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 u_{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Be(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){U(this.o===void 0,3512);const n=i=>{i.error!=null&&M("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const o=i.token!==this.m;return this.m=i.token,M("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?t(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable((()=>
vendor: 4,446 bytes, line 26
26n(i)))};const s=i=>{M("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((i=>s(i))),setTimeout((()=>{if(!this.appCheck){const i=this.V.getImmediate({optional:!0});i?s(i):M("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new ll(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((t=>t?(U(typeof t.token=="string",44558,{tokenResult:t}),this.m=t.token,new ll(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}class l_{getToken(){return Promise.resolve(new ll(""))}invalidateToken(){}start(e,t){}shutdown(){}}function h_(r){const e=typeof self<"u"&&(self.crypto||self.msCrypto),t=new Uint8Array(r);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let n=0;n<r;n++)t[n]=Math.floor(256*Math.random());return t}class Nc{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(4.129032258064516);let n="";for(;n.length<20;){const s=h_(40);for(let i=0;i<s.length;++i)n.length<20&&s[i]<t&&(n+=e.charAt(s[i]%62))}return n}}function Z(r,e){return r<e?-1:r>e?1:0}function hl(r,e){const t=Math.min(r.length,e.length);for(let n=0;n<t;n++){const s=r.charAt(n),i=e.charAt(n);if(s!==i)return zu(s)===zu(i)?Z(s,i):zu(s)?1:-1}return Z(r.length,e.length)}const d_=55296,f_=57343;function zu(r){const e=r.charCodeAt(0);return e>=d_&&e<=f_}function Ls(r,e,t){return r.length===e.length&&r.every(((n,s)=>t(n,e[s])))}function kp(r){return r+"\0"}const en="__name__";class Xt{constructor(e,t,n){t===void 0?t=0:t>e.length&&H(637,{offset:t,range:e.length}),n===void 0?n=e.length-t:n>e.length-t&&H(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return Xt.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Xt?e.forEach((n=>{t.push(n)})):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?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 this.length===0}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,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const n=Math.min(e.length,t.length);for(let s=0;s<n;s++){const i=Xt.compareSegments(e.get(s),t.get(s));if(i!==0)return i}return Z(e.length,t.length)}static compareSegments(e,t){const n=Xt.isNumericId(e),s=Xt.isNumericId(t);return n&&!s?-1:!n&&s?1:n&&s?Xt.extractNumericId(e).compare(Xt.extractNumericId(t)):hl(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return ir.fromString(e.substring(4,e.length-2))}}class re extends Xt{construct(e,t,n){return new re(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const n of e){if(n.indexOf("//")>=0)throw new L(N.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter((s=>s.length>0)))}return new re(t)}static emptyPath(){return new re([])}}const p_=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Ae extends Xt{construct(e,t,n){return new Ae(e,t,n)}static isValidIdentifier(e){return p_.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Ae.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===en}static keyField(){return new Ae([en])}static fromServerFormat(e){const t=[];let n="",s=0;const i=()=>
vendor: 4,756 bytes, line 26
26{if(n.length===0)throw new L(N.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let o=!1;for(;s<e.length;){const a=e[s];if(a==="\\"){if(s+1===e.length)throw new L(N.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const u=e[s+1];if(u!=="\\"&&u!=="."&&u!=="`")throw new L(N.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=u,s+=2}else a==="`"?(o=!o,s++):a!=="."||o?(n+=a,s++):(i(),s++)}if(i(),o)throw new L(N.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new Ae(t)}static emptyPath(){return new Ae([])}}class B{constructor(e){this.path=e}static fromPath(e){return new B(re.fromString(e))}static fromName(e){return new B(re.fromString(e).popFirst(5))}static empty(){return new B(re.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 e!==null&&re.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return re.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new B(new re(e.slice()))}}function Yl(r,e,t){if(!t)throw new L(N.INVALID_ARGUMENT,`Function ${r}() cannot be called with an empty ${e}.`)}function xp(r,e,t,n){if(e===!0&&n===!0)throw new L(N.INVALID_ARGUMENT,`${r} and ${t} cannot be used together.`)}function pf(r){if(!B.isDocumentKey(r))throw new L(N.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${r} has ${r.length}.`)}function mf(r){if(B.isDocumentKey(r))throw new L(N.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${r} has ${r.length}.`)}function Go(r){return typeof r=="object"&&r!==null&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}function Vc(r){if(r===void 0)return"undefined";if(r===null)return"null";if(typeof r=="string")return r.length>20&&(r=`${r.substring(0,20)}...`),JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean")return""+r;if(typeof r=="object"){if(r instanceof Array)return"an array";{const e=(function(n){return n.constructor?n.constructor.name:null})(r);return e?`a custom ${e} object`:"an object"}}return typeof r=="function"?"a function":H(12329,{type:typeof r})}function oe(r,e){if("_delegate"in r&&(r=r._delegate),!(r instanceof e)){if(e.name===r.constructor.name)throw new L(N.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=Vc(r);throw new L(N.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return r}function Lp(r,e){if(e<=0)throw new L(N.INVALID_ARGUMENT,`Function ${r}() requires a positive number, but it was: ${e}.`)}function Ge(r,e){const t={typeString:r};return e&&(t.value=e),t}function os(r,e){if(!Go(r))throw new L(N.INVALID_ARGUMENT,"JSON must be an object");let t;for(const n in e)if(e[n]){const s=e[n].typeString,i="value"in e[n]?{value:e[n].value}:void 0;if(!(n in r)){t=`JSON missing required field: '${n}'`;break}const o=r[n];if(s&&typeof o!==s){t=`JSON field '${n}' must be a ${s}.`;break}if(i!==void 0&&o!==i.value){t=`Expected '${n}' field to equal '${i.value}'`;break}}if(t)throw new L(N.INVALID_ARGUMENT,t);return!0}const gf=-62135596800,_f=1e6;class ge{static now(){return ge.fromMillis(Date.now())}static fromDate(e){return ge.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*_f);return new ge(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new L(N.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new L(N.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<gf)throw new L(N.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new L(N.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/_f}_compareTo(e){return this.seconds===e.seconds?Z(this.nanoseconds,e.nanoseconds):Z(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:ge._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(os(e,ge._jsonSchema))return new ge(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-gf;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}
vendor: 5,435 bytes, line 26
26}ge._jsonSchemaVersion="firestore/timestamp/1.0",ge._jsonSchema={type:Ge("string",ge._jsonSchemaVersion),seconds:Ge("number"),nanoseconds:Ge("number")};class K{static fromTimestamp(e){return new K(e)}static min(){return new K(new ge(0,0))}static max(){return new K(new ge(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}const Ms=-1;class Fs{constructor(e,t,n,s){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=s}}function dl(r){return r.fields.find((e=>e.kind===2))}function Lr(r){return r.fields.filter((e=>e.kind!==2))}function m_(r,e){let t=Z(r.collectionGroup,e.collectionGroup);if(t!==0)return t;for(let n=0;n<Math.min(r.fields.length,e.fields.length);++n)if(t=g_(r.fields[n],e.fields[n]),t!==0)return t;return Z(r.fields.length,e.fields.length)}Fs.UNKNOWN_ID=-1;class Hr{constructor(e,t){this.fieldPath=e,this.kind=t}}function g_(r,e){const t=Ae.comparator(r.fieldPath,e.fieldPath);return t!==0?t:Z(r.kind,e.kind)}class Us{constructor(e,t){this.sequenceNumber=e,this.offset=t}static empty(){return new Us(0,Dt.min())}}function Mp(r,e){const t=r.toTimestamp().seconds,n=r.toTimestamp().nanoseconds+1,s=K.fromTimestamp(n===1e9?new ge(t+1,0):new ge(t,n));return new Dt(s,B.empty(),e)}function Fp(r){return new Dt(r.readTime,r.key,Ms)}class Dt{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new Dt(K.min(),B.empty(),Ms)}static max(){return new Dt(K.max(),B.empty(),Ms)}}function Jl(r,e){let t=r.readTime.compareTo(e.readTime);return t!==0?t:(t=B.comparator(r.documentKey,e.documentKey),t!==0?t:Z(r.largestBatchId,e.largestBatchId))}const Up="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Bp{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}async function Ar(r){if(r.code!==N.FAILED_PRECONDITION||r.message!==Up)throw r;M("LocalStore","Unexpectedly lost primary lease")}class C{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&H(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new C(((n,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(n,s)},this.catchCallback=i=>{this.wrapFailure(t,i).next(n,s)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{const t=e();return t instanceof C?t:C.resolve(t)}catch(t){return C.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction((()=>e(t))):C.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction((()=>e(t))):C.reject(t)}static resolve(e){return new C(((t,n)=>{t(e)}))}static reject(e){return new C(((t,n)=>{n(e)}))}static waitFor(e){return new C(((t,n)=>{let s=0,i=0,o=!1;e.forEach((a=>{++s,a.next((()=>{++i,o&&i===s&&t()}),(u=>n(u)))})),o=!0,i===s&&t()}))}static or(e){let t=C.resolve(!1);for(const n of e)t=t.next((s=>s?C.resolve(s):n()));return t}static forEach(e,t){const n=[];return e.forEach(((s,i)=>{n.push(t.call(this,s,i))})),this.waitFor(n)}static mapArray(e,t){return new C(((n,s)=>{const i=e.length,o=new Array(i);let a=0;for(let u=0;u<i;u++){const l=u;t(e[l]).next((d=>{o[l]=d,++a,a===i&&n(o)}),(d=>s(d)))}}))}static doWhile(e,t){return new C(((n,s)=>{const i=()=>{e()===!0?t().next((()=>{i()}),s):n()};i()}))}}const Vt="SimpleDb";class Oc{static open(e,t,n,s){try{return new Oc(t,e.transaction(s,n))}catch(i){throw new oo(t,i)}}constructor(e,t){this.action=e,this.transaction=t,this.aborted=!1,this.v=new nt,this.transaction.oncomplete=()=>{this.v.resolve()},this.transaction.onabort=()=>{t.error?this.v.reject(new oo(e,t.error)):this.v.resolve()},this.transaction.onerror=n=>{const s=Xl(n.target.error);this.v.reject(new oo(e,s))}}get S(){return this.v.promise}abort(e){e&&this.v.reject(e),this.aborted||(M(Vt,"Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}D(){const e=this.transaction;this.aborted||typeof e.commit!="function"||e.commit()}store(e){const t=this.transaction.objectStore(e);return new y_(t)}}class an{static delete(e){return M(Vt,"Removing database:",e),Fr(lp().indexedDB.deleteDatabase(e)).toPromise()}static C(){if(!Ep())return!1;if(an.F())return!0;const e=He(),t=an.O(e),n=0<t&&t<10,s=qp(e),i=0<s&&s<4.5;return!(e.indexOf("MSIE ")>0||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||n||i)}static F(){return typeof process<"u"&&process.__PRIVATE_env?.__PRIVATE_USE_MOCK_PERSISTENCE==="YES"}static M(e,t){return e.store(t)}static O(e){const t=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(n)}constructor(e,t,n){this.name=e,this.version=t,this.N=n,this.L=null,an.O(He())===12.2&&Le("Firestore persistence suffers from a bug in 
26iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}async B(e){return this.db||(M(Vt,"Opening database:",this.name),this.db=await new Promise(((t,n)=>{const s=indexedDB.open(this.name,this.version);s.onsuccess=i=>{const o=i.target.result;t(o)},s.onblocked=()=>{n(new oo(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},s.onerror=i=>{const o=i.target.error;o.name==="VersionError"?n(new L(N.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):o.name==="InvalidStateError"?n(new L(N.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+o)):n(new oo(e,o))},s.onupgradeneeded=i=>{M(Vt,'Database "'+this.name+'" requires upgrade from version:',i.oldVersion);const o=i.target.result;this.N.U(o,s.transaction,i.oldVersion,this.version).next((()=>{M(Vt,"Database upgrade to version "+this.version+" complete")}))}}))),this.k&&(this.db.onversionchange=t=>this.k(t)),this.db}q(e){this.k=e,this.db&&(this.db.onversionchange=t=>e(t))}async runTransaction(e,t,n,s){const i=t==="readonly";let o=0;for(;;){++o;try{this.db=await this.B(e);const a=Oc.open(this.db,e,i?"readonly":"readwrite",n),u=s(a).next((l=>(a.D(),l))).catch((l=>(a.abort(l),C.reject(l)))).toPromise();return u.catch((()=>{})),await a.S,u}catch(a){const u=a,l=u.name!=="FirebaseError"&&o<3;if(M(Vt,"Transaction failed with error:",u.message,"Retrying:",l),this.close(),!l)return Promise.reject(u)}}}close(){this.db&&this.db.close(),this.db=void 0}}function qp(r){const e=r.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}class __{constructor(e){this.$=e,this.K=!1,this.W=null}get isDone(){return this.K}get G(){return this.W}set cursor(e){this.$=e}done(){this.K=!0}j(e){this.W=e}delete(){return Fr(this.$.delete())}}class oo extends L{constructor(e,t){super(N.UNAVAILABLE,`IndexedDB transaction '${e}' failed: ${t}`),this.name="IndexedDbTransactionError"}}function Rr(r){return r.name==="IndexedDbTransactionError"}class y_{constructor(e){this.store=e}put(e,t){let n;return t!==void 0?(M(Vt,"PUT",this.store.name,e,t),n=this.store.put(t,e)):(M(Vt,"PUT",this.store.name,"<auto-key>",e),n=this.store.put(e)),Fr(n)}add(e){return M(Vt,"ADD",this.store.name,e,e),Fr(this.store.add(e))}get(e){return Fr(this.store.get(e)).next((t=>(t===void 0&&(t=null),M(Vt,"GET",this.store.name,e,t),t)))}delete(e){return M(Vt,"DELETE",this.store.name,e),Fr(this.store.delete(e))}count(){return M(Vt,"COUNT",this.store.name),Fr(this.store.count())}H(e,t){const n=this.options(e,t),s=n.index?this.store.index(n.index):this.store;if(typeof s.getAll=="function"){const i=s.getAll(n.range);return new C(((o,a)=>{i.onerror=u=>{a(u.target.error)},i.onsuccess=u=>{o(u.target.result)}}))}{const i=this.cursor(n),o=[];return this.J(i,((a,u)=>{o.push(u)})).next((()=>o))}}Y(e,t){const n=this.store.getAll(e,t===null?void 0:t);return new C(((s,i)=>{n.onerror=o=>{i(o.target.error)},n.onsuccess=o=>{s(o.target.result)}}))}Z(e,t){M(Vt,"DELETE ALL",this.store.name);const n=this.options(e,t);n.X=!1;const s=this.cursor(n);return this.J(s,((i,o,a)=>a.delete()))}ee(e,t){let n;t?n=e:(n={},t=e);const s=this.cursor(n);return this.J(s,t)}te(e){const t=this.cursor({});return new C(((n,s)=>{t.onerror=i=>{const o=Xl(i.target.error);s(o)},t.onsuccess=i=>{const o=i.target.result;o?e(o.primaryKey,o.value).next((a=>{a?o.continue():n()})):n()}}))}J(e,t){const n=[];return new C(((s,i)=>{e.onerror=o=>{i(o.target.error)},e.onsuccess=o=>{const a=o.target.result;if(!a)return void s();const u=new __(a),l=t(a.primaryKey,a.value,u);if(l instanceof C){const d=l.catch((p=>(u.done(),C.reject(p))));n.push(d)}u.isDone?s():u.G===null?a.continue():a.continue(u.G)}})).next((()=>C.waitFor(n)))}options(e,t){let n;return e!==void 0&&(typeof e=="string"?n=e:t=e),{index:n,range:t}}cursor(e){let t="next";if(e.reverse&&(t="prev"),e.index){const n=this.store.index(e.index);return e.X?n.openKeyCursor(e.range,t):n.openCursor(e.range,t)}return this.store.openCursor(e.range,t)}}function Fr(r){return new C(((e,t)=>{r.onsuccess=n=>{const s=n.target.result;e(s)},r.onerror=n=>{const s=Xl(n.target.error);t(s)}}))}let yf=!1;function Xl(r){const e=an.O(He());if(e>=12.2&&e<13){const t="An internal error was encountered in the Indexed Database server";if(r.message.indexOf(t)>=0){const n=new L("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${t}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return yf||(yf=!0,setTimeout((()=>{throw n}),0)),n}}return r}const ao="IndexBackfiller";class E_{constructor(e,t){this.asyncQueue=e,this.ne=t,this.task=null}start(){this.re(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return this.task!==null}re(e){M(ao,`Scheduled in ${e}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,(async()=>{this.task=null;try{const t=await this.ne.ie();M(ao,`Documents written: ${t}`)}catch(t){Rr(t)?M(ao,"Ignoring IndexedDB error during index backfill: ",t):await Ar(t)}await this.re(6e4)}))}}class I_{constructor(e,t){this.localStore=e,this.persistence=t}async ie(e=50){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",(t=>this.se(t,e)))}se(e,t){const n=new Set;let s=t,i=!0;
vendor: 4,174 bytes, line 26
26return C.doWhile((()=>i===!0&&s>0),(()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(e).next((o=>{if(o!==null&&!n.has(o))return M(ao,`Processing collection: ${o}`),this._e(e,o,s).next((a=>{s-=a,n.add(o)}));i=!1})))).next((()=>t-s))}_e(e,t,n){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(e,t).next((s=>this.localStore.localDocuments.getNextDocuments(e,t,s,n).next((i=>{const o=i.changes;return this.localStore.indexManager.updateIndexEntries(e,o).next((()=>this.oe(s,i))).next((a=>(M(ao,`Updating offset: ${a}`),this.localStore.indexManager.updateCollectionGroup(e,t,a)))).next((()=>o.size))}))))}oe(e,t){let n=e;return t.changes.forEach(((s,i)=>{const o=Fp(i);Jl(o,n)>0&&(n=o)})),new Dt(n.readTime,n.documentKey,Math.max(t.batchId,e.largestBatchId))}}class wt{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=n=>this.ae(n),this.ue=n=>t.writeSequenceNumber(n))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}wt.ce=-1;const or=-1;function $o(r){return r==null}function Bs(r){return r===0&&1/r==-1/0}function Gp(r){return typeof r=="number"&&Number.isInteger(r)&&!Bs(r)&&r<=Number.MAX_SAFE_INTEGER&&r>=Number.MIN_SAFE_INTEGER}function w_(r){return typeof r=="string"}const tc="�";function ht(r){let e="";for(let t=0;t<r.length;t++)e.length>0&&(e=Ef(e)),e=T_(r.get(t),e);return Ef(e)}function T_(r,e){let t=e;const n=r.length;for(let s=0;s<n;s++){const i=r.charAt(s);switch(i){case"\0":t+="��";break;case tc:t+="��";break;default:t+=i}}return t}function Ef(r){return r+tc+"�"}function tn(r){const e=r.length;if(U(e>=2,64408,{path:r}),e===2)return U(r.charAt(0)===tc&&r.charAt(1)==="�",56145,{path:r}),re.emptyPath();const t=e-2,n=[];let s="";for(let i=0;i<e;){const o=r.indexOf(tc,i);switch((o<0||o>t)&&H(50515,{path:r}),r.charAt(o+1)){case"�":const a=r.substring(i,o);let u;s.length===0?u=a:(s+=a,u=s,s=""),n.push(u);break;case"�":s+=r.substring(i,o),s+="\0";break;case"�":s+=r.substring(i,o+1);break;default:H(61167,{path:r})}i=o+2}return new re(n)}const Mr="remoteDocuments",jo="owner",ys="owner",Ro="mutationQueues",A_="userId",jt="mutations",If="batchId",$r="userMutationsIndex",wf=["userId","batchId"];function Fa(r,e){return[r,ht(e)]}function $p(r,e,t){return[r,ht(e),t]}const R_={},qs="documentMutations",nc="remoteDocumentsV14",v_=["prefixPath","collectionGroup","readTime","documentId"],Ua="documentKeyIndex",S_=["prefixPath","collectionGroup","documentId"],jp="collectionGroupIndex",P_=["collectionGroup","readTime","prefixPath","documentId"],vo="remoteDocumentGlobal",fl="remoteDocumentGlobalKey",Gs="targets",zp="queryTargetsIndex",C_=["canonicalId","targetId"],$s="targetDocuments",b_=["targetId","path"],Zl="documentTargetsIndex",N_=["path","targetId"],rc="targetGlobalKey",Wr="targetGlobal",So="collectionParents",V_=["collectionId","parent"],js="clientMetadata",O_="clientId",Dc="bundles",D_="bundleId",kc="namedQueries",k_="name",e1="indexConfiguration",x_="indexId",pl="collectionGroupIndex",L_="collectionGroup",co="indexState",M_=["indexId","uid"],Hp="sequenceNumberIndex",F_=["uid","sequenceNumber"],uo="indexEntries",U_=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],Wp="documentKeyIndex",B_=["indexId","uid","orderedDocumentKey"],xc="documentOverlays",q_=["userId","collectionPath","documentId"],ml="collectionPathOverlayIndex",G_=["userId","collectionPath","largestBatchId"],Kp="collectionGroupOverlayIndex",$_=["userId","collectionGroup","largestBatchId"],t1="globals",j_="name",Qp=[Ro,jt,qs,Mr,Gs,jo,Wr,$s,js,vo,So,Dc,kc],z_=[...Qp,xc],Yp=[Ro,jt,qs,nc,Gs,jo,Wr,$s,js,vo,So,Dc,kc,xc],Jp=Yp,n1=[...Jp,e1,co,uo],H_=n1,Xp=[...n1,t1],W_=Xp;class gl extends Bp{constructor(e,t){super(),this.le=e,this.currentSequenceNumber=t}}function Qe(r,e){const t=G(r);return an.M(t.le,e)}class Re{constructor(e,t){this.comparator=e,this.root=t||st.EMPTY}insert(e,t){return new Re(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,st.BLACK,null,null))}remove(e){return new Re(this.comparator,this.root.remove(e,this.comparator).copy(null,null,st.BLACK,null,
vendor: 4,433 bytes, line 26
26null))}get(e){let t=this.root;for(;!t.isEmpty();){const n=this.comparator(e,t.key);if(n===0)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){const s=this.comparator(e,n.key);if(s===0)return t+n.left.size;s<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((t,n)=>(e(t,n),!1)))}toString(){const e=[];return this.inorderTraversal(((t,n)=>(e.push(`${t}:${n}`),!1))),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new Sa(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Sa(this.root,e,this.comparator,!1)}getReverseIterator(){return new Sa(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Sa(this.root,e,this.comparator,!0)}}class Sa{constructor(e,t,n,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?n(e.key,t):1,t&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const 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(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class st{constructor(e,t,n,s,i){this.key=e,this.value=t,this.color=n??st.RED,this.left=s??st.EMPTY,this.right=i??st.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,s,i){return new st(e??this.key,t??this.value,n??this.color,s??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let s=this;const i=n(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,t,n),null):i===0?s.copy(null,t,null,null,null):s.copy(null,null,null,null,s.right.insert(e,t,n)),s.fixUp()}removeMin(){if(this.left.isEmpty())return st.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),e.fixUp()}remove(e,t){let n,s=this;if(t(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,t),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),t(e,s.key)===0){if(s.right.isEmpty())return st.EMPTY;n=s.right.min(),s=s.copy(n.key,n.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,t))}return s.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.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,st.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,st.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const 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(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw H(43730,{key:this.key,value:this.value});if(this.right.isRed())throw H(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw H(27949);return e+(this.isRed()?0:1)}}st.EMPTY=null,st.RED=!0,st.BLACK=!1;
vendor: 6,728 bytes, line 26
26st.EMPTY=new class{constructor(){this.size=0}get key(){throw H(57766)}get value(){throw H(16141)}get color(){throw H(16727)}get left(){throw H(29726)}get right(){throw H(36894)}copy(e,t,n,s,i){return this}insert(e,t,n){return new st(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 ye{constructor(e){this.comparator=e,this.data=new Re(this.comparator)}has(e){return this.data.get(e)!==null}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,n)=>(e(t),!1)))}forEachInRange(e,t){const n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){const s=n.getNext();if(this.comparator(s.key,e[1])>=0)return;t(s.key)}}forEachWhile(e,t){let n;for(n=t!==void 0?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Tf(this.data.getIterator())}getIteratorFrom(e){return new Tf(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach((n=>{t=t.add(n)})),t}isEqual(e){if(!(e instanceof ye)||this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=n.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){const e=[];return this.forEach((t=>{e.push(t)})),e}toString(){const e=[];return this.forEach((t=>e.push(t))),"SortedSet("+e.toString()+")"}copy(e){const t=new ye(this.comparator);return t.data=e,t}}class Tf{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}function Es(r){return r.hasNext()?r.getNext():void 0}class Tt{constructor(e){this.fields=e,e.sort(Ae.comparator)}static empty(){return new Tt([])}unionWith(e){let t=new ye(Ae.comparator);for(const n of this.fields)t=t.add(n);for(const n of e)t=t.add(n);return new Tt(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Ls(this.fields,e.fields,((t,n)=>t.isEqual(n)))}}function sc(r){let e=0;for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&e++;return e}function vr(r,e){for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&e(t,r[t])}function r1(r,e){const t=[];for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.push(e(r[n],n,r));return t}function Zp(r){for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e))return!1;return!0}class e6 extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}function K_(){return typeof atob<"u"}class Se{constructor(e){this.binaryString=e}static fromBase64String(e){const t=(function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new e6("Invalid base64 string: "+i):i}})(e);return new Se(t)}static fromUint8Array(e){const t=(function(s){let i="";for(let o=0;o<s.length;++o)i+=String.fromCharCode(s[o]);return i})(e);return new Se(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return(function(t){return btoa(t)})(this.binaryString)}toUint8Array(){return(function(t){const n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Z(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Se.EMPTY_BYTE_STRING=new Se("");const Q_=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Cn(r){if(U(!!r,39018),typeof r=="string"){let e=0;const t=Q_.exec(r);if(U(!!t,46558,{timestamp:r}),t[1]){let s=t[1];s=(s+"000000000").substr(0,9),e=Number(s)}const n=new Date(r);return{seconds:Math.floor(n.getTime()/1e3),nanos:e}}return{seconds:ve(r.seconds),nanos:ve(r.nanos)}}function ve(r){return typeof r=="number"?r:typeof r=="string"?Number(r):0}function bn(r){return typeof r=="string"?Se.fromBase64String(r):Se.fromUint8Array(r)}const t6="server_timestamp",n6="__type__",r6="__previous_value__",s6="__local_write_time__";function zo(r){return(r?.mapValue?.fields||{})[n6]?.stringValue===t6}function Ho(r){const e=r.mapValue.fields[r6];return zo(e)?Ho(e):e}function zs(r){const e=Cn(r.mapValue.fields[s6].timestampValue);return new ge(e.seconds,e.nanos)}class Y_{constructor(e,t,n,s,i,o,a,u,l,d,p){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=s,this.ssl=i,this.forceLongPolling=o,this.autoDetectLongPolling=a,this.longPollingOptions=u,this.useFetchStreams=l,this.isUsingEmulator=d,this.apiKey=p}}const Po="(default)";class dr{constructor(e,t){this.projectId=e,this.database=t||Po}static empty(){return new dr("","")}get isDefaultDatabase(){return this.database===Po}isEqual(e){return e instanceof dr&&e.projectId===this.projectId&&e.database===this.database}}function J_(r,e){if(!Object.prototype.hasOwnProperty.apply(r.options,["projectId"]))throw new L(N.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new dr(r.options.projectId,e)}const s1="__type__",i6="__max__",er={mapValue:{fields:{__type__:{stringValue:i6}}}},i1="__vector__",Yr="value",cn={nullValue:"NULL_VALUE"},Pt={booleanValue:!0},tt={booleanValue:!1};function $e(r){return"nullValue"in r?0:"booleanValue"in r?1:"integerValue"in r||"doubleValue"in r?2:"timestampValue"in r?3:"stringValue"in r?5:"bytesValue"in r?6:"referenceValue"in r?7:"geoPointValue"in r?8:"arrayValue"in r?9:"mapValue"in r?zo(r)?4:o6(r)?9007199254740991:Xr(r)?10:11:H(28295,{value:r})}function qt(r,e,t){if(r===e)return!0;const n=$e(r);if(n!==$e(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return r.booleanValue===e.booleanValue;case 4:return zs(r).isEqual(zs(e));case 3:return(function(i,o){if(typeof i.timestampValue=="string"&&typeof o.timestampValue=="string"&&i.timestampValue.length===o.timestampValue.length)return i.timestampValue===o.timestampValue;const a=Cn(i.timestampValue),u=Cn(o.timestampValue);return a.seconds===u.seconds&&a.nanos===u.nanos})(r,e);case 5:return r.stringValue===e.stringValue;case 6:return(function(i,o){return bn(i.bytesValue).isEqual(bn(o.bytesValue))})(r,e);case 7:return r.referenceValue===e.referenceValue;case 8:return(function(i,o){return ve(i.geoPointValue.latitude)===ve
26(o.geoPointValue.latitude)&&ve(i.geoPointValue.longitude)===ve(o.geoPointValue.longitude)})(r,e);case 2:return(function(i,o,a){if("integerValue"in i&&"integerValue"in o)return ve(i.integerValue)===ve(o.integerValue);let u,l;if("doubleValue"in i&&"doubleValue"in o)u=ve(i.doubleValue),l=ve(o.doubleValue);else{if(!a?.Ee)return!1;u=ve(i.integerValue??i.doubleValue),l=ve(o.integerValue??o.doubleValue)}return u===l?!!a?.he||Bs(u)===Bs(l):!!(a===void 0||a.Te)&&isNaN(u)&&isNaN(l)})(r,e,t);case 9:return Ls(r.arrayValue.values||[],e.arrayValue.values||[],((s,i)=>qt(s,i,t)));case 10:case 11:return(function(i,o,a){const u=i.mapValue.fields||{},l=o.mapValue.fields||{};if(sc(u)!==sc(l))return!1;for(const d in u)if(u.hasOwnProperty(d)&&(l[d]===void 0||!qt(u[d],l[d],a)))return!1;return!0})(r,e,t);default:return H(52216,{left:r})}}function Co(r,e){return(r.values||[]).find((t=>qt(t,e)))!==void 0}function ft(r,e){if(r===e)return 0;const t=$e(r),n=$e(e);if(t!==n)return Z(t,n);switch(t){case 0:case 9007199254740991:return 0;case 1:return Z(r.booleanValue,e.booleanValue);case 2:return(function(i,o){const a=ve(i.integerValue||i.doubleValue),u=ve(o.integerValue||o.doubleValue);return a<u?-1:a>u?1:a===u?0:isNaN(a)?isNaN(u)?0:-1:1})(r,e);case 3:return Af(r.timestampValue,e.timestampValue);case 4:return Af(zs(r),zs(e));case 5:return hl(r.stringValue,e.stringValue);case 6:return(function(i,o){const a=bn(i),u=bn(o);return a.compareTo(u)})(r.bytesValue,e.bytesValue);case 7:return(function(i,o){const a=i.split("/"),u=o.split("/");for(let l=0;l<a.length&&l<u.length;l++){const d=Z(a[l],u[l]);if(d!==0)return d}return Z(a.length,u.length)})(r.referenceValue,e.referenceValue);case 8:return(function(i,o){const a=Z(ve(i.latitude),ve(o.latitude));return a!==0?a:Z(ve(i.longitude),ve(o.longitude))})(r.geoPointValue,e.geoPointValue);case 9:return Rf(r.arrayValue,e.arrayValue);case 10:return(function(i,o){const a=i.fields||{},u=o.fields||{},l=a[Yr]?.arrayValue,d=u[Yr]?.arrayValue,p=Z(l?.values?.length||0,d?.values?.length||0);return p!==0?p:Rf(l,d)})(r.mapValue,e.mapValue);case 11:return(function(i,o){if(i===er.mapValue&&o===er.mapValue)return 0;if(i===er.mapValue)return 1;if(o===er.mapValue)return-1;const a=i.fields||{},u=Object.keys(a),l=o.fields||{},d=Object.keys(l);u.sort(),d.sort();for(let p=0;p<u.length&&p<d.length;++p){const g=hl(u[p],d[p]);if(g!==0)return g;const I=ft(a[u[p]],l[d[p]]);if(I!==0)return I}return Z(u.length,d.length)})(r.mapValue,e.mapValue);default:throw H(23264,{Pe:t})}}function Af(r,e){if(typeof r=="string"&&typeof e=="string"&&r.length===e.length)return Z(r,e);const t=Cn(r),n=Cn(e),s=Z(t.seconds,n.seconds);return s!==0?s:Z(t.nanos,n.nanos)}function Rf(r,e){const t=r.values||[],n=e.values||[];for(let s=0;s<t.length&&s<n.length;++s){const i=ft(t[s],n[s]);if(i!==void 0&&i!==0)return i}return Z(t.length,n.length)}function Hs(r){return _l(r)}function _l(r){return"nullValue"in r?"null":"booleanValue"in r?""+r.booleanValue:"integerValue"in r?""+r.integerValue:"doubleValue"in r?""+r.doubleValue:"timestampValue"in r?(function(t){const n=Cn(t);return`time(${n.seconds},${n.nanos})`})(r.timestampValue):"stringValue"in r?r.stringValue:"bytesValue"in r?(function(t){return bn(t).toBase64()})(r.bytesValue):"referenceValue"in r?(function(t){return B.fromName(t).toString()})(r.referenceValue):"geoPointValue"in r?(function(t){return`geo(${t.latitude},${t.longitude})`})(r.geoPointValue):"arrayValue"in r?(function(t){let n="[",s=!0;for(const i of t.values||[])s?s=!1:n+=",",n+=_l(i);return n+"]"})(r.arrayValue):"mapValue"in r?(function(t){const n=Object.keys(t.fields||{}).sort();let s="{",i=!0;for(const o of n)i?i=!1:s+=",",s+=`${o}:${_l(t.fields[o])}`;return s+"}"})(r.mapValue):H(61005,{value:r})}function Ba(r){switch($e(r)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=Ho(r);return e?16+Ba(e):16;case 5:return 2*r.stringValue.length;case 6:return bn(r.bytesValue).approximateByteSize();case 7:return r.referenceValue.length;case 9:return(function(n){return(n.values||[]).reduce(((s,i)=>s+Ba(i)),0)})(r.arrayValue);case 10:case 11:return(function(n){let s=0;
vendor: 3,743 bytes, line 26
26return vr(n.fields,((i,o)=>{s+=i.length+Ba(o)})),s})(r.mapValue);default:throw H(13486,{value:r})}}function Jr(r,e){return{referenceValue:`projects/${r.projectId}/databases/${r.database}/documents/${e.path.canonicalString()}`}}function nn(r){return!!r&&"integerValue"in r}function jr(r){return!!r&&"doubleValue"in r}function fr(r){return nn(r)||jr(r)}function pr(r){return!!r&&"arrayValue"in r}function Ot(r){return!!r&&"nullValue"in r}function Ct(r){return!!r&&"doubleValue"in r&&isNaN(Number(r.doubleValue))}function Kr(r){return!!r&&"mapValue"in r}function Xr(r){return(r?.mapValue?.fields||{})[s1]?.stringValue===i1}function yl(r){return(r?.mapValue?.fields||{})[Yr]?.arrayValue}function lo(r){if(r.geoPointValue)return{geoPointValue:{...r.geoPointValue}};if(r.timestampValue&&typeof r.timestampValue=="object")return{timestampValue:{...r.timestampValue}};if(r.mapValue){const e={mapValue:{fields:{}}};return vr(r.mapValue.fields,((t,n)=>e.mapValue.fields[t]=lo(n))),e}if(r.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(r.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=lo(r.arrayValue.values[t]);return e}return{...r}}function o6(r){return(((r.mapValue||{}).fields||{}).__type__||{}).stringValue===i6}const a6={mapValue:{fields:{[s1]:{stringValue:i1},[Yr]:{arrayValue:{}}}}};function X_(r){return"nullValue"in r?cn:"booleanValue"in r?{booleanValue:!1}:"integerValue"in r||"doubleValue"in r?{doubleValue:NaN}:"timestampValue"in r?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in r?{stringValue:""}:"bytesValue"in r?{bytesValue:""}:"referenceValue"in r?Jr(dr.empty(),B.empty()):"geoPointValue"in r?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in r?{arrayValue:{}}:"mapValue"in r?Xr(r)?a6:{mapValue:{}}:H(35942,{value:r})}function Z_(r){return"nullValue"in r?{booleanValue:!1}:"booleanValue"in r?{doubleValue:NaN}:"integerValue"in r||"doubleValue"in r?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in r?{stringValue:""}:"stringValue"in r?{bytesValue:""}:"bytesValue"in r?Jr(dr.empty(),B.empty()):"referenceValue"in r?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in r?{arrayValue:{}}:"arrayValue"in r?a6:"mapValue"in r?Xr(r)?{mapValue:{}}:er:H(61959,{value:r})}function vf(r,e){const t=ft(r.value,e.value);return t!==0?t:r.inclusive&&!e.inclusive?-1:!r.inclusive&&e.inclusive?1:0}function Sf(r,e){const t=ft(r.value,e.value);return t!==0?t:r.inclusive&&!e.inclusive?1:!r.inclusive&&e.inclusive?-1:0}class ze{constructor(e){this.value=e}static empty(){return new ze({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!Kr(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=lo(t)}setAll(e){let t=Ae.emptyPath(),n={},s=[];e.forEach(((o,a)=>{if(!t.isImmediateParentOf(a)){const u=this.getFieldsMap(t);this.applyChanges(u,n,s),n={},s=[],t=a.popLast()}o?n[a.lastSegment()]=lo(o):s.push(a.lastSegment())}));const i=this.getFieldsMap(t);this.applyChanges(i,n,s)}delete(e){const t=this.field(e.popLast());Kr(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return qt(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let s=t.mapValue.fields[e.get(n)];Kr(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,n){vr(t,((s,i)=>e[s]=i));for(const s of n)delete e[s]}clone(){return new ze(lo(this.value))}}function c6(r){const e=[];return vr(r.fields,((t,n)=>{const s=new Ae([t]);if(Kr(n)){const i=c6(n.mapValue).fields;
26if(i.length===0)e.push(s);else for(const o of i)e.push(s.child(o))}else e.push(s)})),new Tt(e)}function Lc(r,e){if(r.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Bs(e)?"-0":e}}function o1(r){return{integerValue:""+r}}function hi(r,e,t){return Number.isInteger(e)&&t?.preferIntegers||Gp(e)?o1(e):Lc(r,e)}class Mc{constructor(){this._=void 0}}function e3(r,e,t){return r instanceof Ws?(function(s,i){const o={fields:{[n6]:{stringValue:t6},[s6]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&zo(i)&&(i=Ho(i)),i&&(o.fields[r6]=i),{mapValue:o}})(t,e):r instanceof Zr?l6(r,e):r instanceof es?h6(r,e):r instanceof ts?(function(s,i){const o=u6(s,i),a=ic(o)+ic(s.Re);return nn(o)&&nn(s.Re)?o1(a):Lc(s.serializer,a)})(r,e):r instanceof Ks?(function(s,i){return Pf(s,i,Math.min)})(r,e):r instanceof Qs?(function(s,i){return Pf(s,i,Math.max)})(r,e):void 0}function t3(r,e,t){return r instanceof Zr?l6(r,e):r instanceof es?h6(r,e):t}function u6(r,e){return r instanceof ts?fr(e)?e:{integerValue:0}:null}class Ws extends Mc{}class Zr extends Mc{constructor(e){super(),this.elements=e}}function l6(r,e){const t=d6(e);for(const n of r.elements)t.some((s=>qt(s,n)))||t.push(n);return{arrayValue:{values:t}}}class es extends Mc{constructor(e){super(),this.elements=e}}function h6(r,e){let t=d6(e);for(const n of r.elements)t=t.filter((s=>!qt(s,n)));return{arrayValue:{values:t}}}class a1 extends Mc{constructor(e,t){super(),this.serializer=e,this.Re=t}}class ts extends a1{}class Ks extends a1{}class Qs extends a1{}function Pf(r,e,t){if(!fr(e))return r.Re;const n=t(ic(e),ic(r.Re));return nn(e)&&nn(r.Re)?o1(n):Lc(r.serializer,n)}function ic(r){return ve(r.integerValue||r.doubleValue)}function d6(r){return pr(r)&&r.arrayValue.values?r.arrayValue.values.slice():[]}class as{constructor(e,t){this.field=e,this.transform=t}}function n3(r,e){return r.field.isEqual(e.field)&&(function(n,s){return n instanceof Zr&&s instanceof Zr||n instanceof es&&s instanceof es?Ls(n.elements,s.elements,qt):n instanceof ts&&s instanceof ts||n instanceof Ks&&s instanceof Ks||n instanceof Qs&&s instanceof Qs?qt(n.Re,s.Re):n instanceof Ws&&s instanceof Ws})(r.transform,e.transform)}class r3{constructor(e,t){this.version=e,this.transformResults=t}}class be{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new be}static exists(e){return new be(void 0,e)}static updateTime(e){return new be(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function qa(r,e){return r.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(r.updateTime):r.exists===void 0||r.exists===e.isFoundDocument()}class Fc{}function f6(r,e){if(!r.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return r.isNoDocument()?new fi(r.key,be.none()):new di(r.key,r.data,be.none());{const t=r.data,n=ze.empty();let s=new ye(Ae.comparator);for(let i of e.fields)if(!s.has(i)){let o=t.field(i);o===null&&i.length>1&&(i=i.popLast(),o=t.field(i)),o===null?n.delete(i):n.set(i,o),s=s.add(i)}return new kn(r.key,n,new Tt(s.toArray()),be.none())}}function s3(r,e,t){r instanceof di?(function(s,i,o){const a=s.value.clone(),u=bf(s.fieldTransforms,i,o.transformResults);a.setAll(u),i.convertToFoundDocument(o.version,a).setHasCommittedMutations()})(r,e,t):r instanceof kn?(function(s,i,o){if(!qa(s.precondition,i))return void i.convertToUnknownDocument(o.version);const a=bf(s.fieldTransforms,i,o.transformResults),u=i.data;u.setAll(p6(s)),u.setAll(a),i.convertToFoundDocument(o.version,u).setHasCommittedMutations()})(r,e,t):(function(s,i,o){i.convertToNoDocument(o.version).setHasCommittedMutations()})(0,e,t)}function ho(r,e,t,n){return r instanceof di?(function(i,o,a,u){if(!qa(i.precondition,o))return a;const l=i.value.clone(),d=Nf(i.fieldTransforms,u,o);return l.setAll(d),o.convertToFoundDocument(o.version,l).setHasLocalMutations(),null})(r,e,t,n):r instanceof kn?(function(i,o,a,u){if(!qa(i.precondition,o))return a;const l=Nf(i.fieldTransforms,u,o),d=o.data;return d.setAll(p6(i)),d.setAll(l),o.convertToFoundDocument(o.version,d).setHasLocalMutations(),a===null?null:a.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map((p=>p.field)))})(r,e,t,n):(function(i,o,a){return qa(i.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a})(r,e,t)}function i3(r,e){let t=null;for(const n of r.fieldTransforms){const s=e.data.field(n.field),i=u6(n.transform,s||null);i!=null&&(t===null&&(t=ze.empty()),t.set(n.field,i))}return t||null}function Cf(r,e){return r.type===e.type&&!!r.key.isEqual(e.key)&&!!r.precondition.isEqual(e.precondition)&&!!(function(n,s){return n===void 0&&s===void 0||!(!n||!s)&&Ls(n,s,((i,o)=>n3(i,o)))})(r.fieldTransforms,e.fieldTransforms)&&(r.type===0?r.value.isEqual(e.value):r.type!==1||r.data.isEqual(e.data)&&r.fieldMask.isEqual(e.fieldMask))}class di extends Fc{constructor(e,t,n,s=[]){super(),this.key=e,this.value=t,this.prec
26ondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class kn extends Fc{constructor(e,t,n,s,i=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function p6(r){const e=new Map;return r.fieldMask.fields.forEach((t=>{if(!t.isEmpty()){const n=r.data.field(t);e.set(t,n)}})),e}function bf(r,e,t){const n=new Map;U(r.length===t.length,32656,{Ie:t.length,Ae:r.length});for(let s=0;s<t.length;s++){const i=r[s],o=i.transform,a=e.data.field(i.field);n.set(i.field,t3(o,a,t[s]))}return n}function Nf(r,e,t){const n=new Map;for(const s of r){const i=s.transform,o=t.data.field(s.field);n.set(s.field,e3(i,o,e))}return n}class fi extends Fc{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class c1 extends Fc{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class m6{constructor(e,t,n){this.alias=e,this.aggregateType=t,this.fieldPath=n}}class mr{constructor(e,t){this.position=e,this.inclusive=t}}function Vf(r,e,t){let n=0;for(let s=0;s<r.position.length;s++){const i=e[s],o=r.position[s];if(i.field.isKeyField()?n=B.comparator(B.fromName(o.referenceValue),t.key):n=ft(o,t.data.field(i.field)),i.dir==="desc"&&(n*=-1),n!==0)break}return n}function Of(r,e){if(r===null)return e===null;if(e===null||r.inclusive!==e.inclusive||r.position.length!==e.position.length)return!1;for(let t=0;t<r.position.length;t++)if(!qt(r.position[t],e.position[t]))return!1;return!0}class g6{}class ue extends g6{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?t==="in"||t==="not-in"?this.createKeyFieldInFilter(e,t,n):new o3(e,t,n):t==="array-contains"?new u3(e,n):t==="in"?new T6(e,n):t==="not-in"?new l3(e,n):t==="array-contains-any"?new h3(e,n):new ue(e,t,n)}static createKeyFieldInFilter(e,t,n){return t==="in"?new a3(e,n):new c3(e,n)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&t.nullValue===void 0&&this.matchesComparison(ft(t,this.value)):t!==null&&$e(this.value)===$e(t)&&this.matchesComparison(ft(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return H(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Ee extends g6{constructor(e,t){super(),this.filters=e,this.op=t,this.Ve=null}static create(e,t){return new Ee(e,t)}matches(e){return Ys(this)?this.filters.find((t=>!t.matches(e)))===void 0:this.filters.find((t=>t.matches(e)))!==void 0}getFlattenedFilters(){return this.Ve!==null||(this.Ve=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.Ve}getFilters(){return Object.assign([],this.filters)}}function Ys(r){return r.op==="and"}function El(r){return r.op==="or"}function u1(r){return _6(r)&&Ys(r)}function _6(r){for(const e of r.filters)if(e instanceof Ee)return!1;return!0}function Il(r){if(r instanceof ue)return r.field.canonicalString()+r.op.toString()+Hs(r.value);if(u1(r))return r.filters.map((e=>Il(e))).join(",");{const e=r.filters.map((t=>Il(t))).join(",");return`${r.op}(${e})`}}function y6(r,e){return r instanceof ue?(function(n,s){return s instanceof ue&&n.op===s.op&&n.field.isEqual(s.field)&&qt(n.value,s.value)})(r,e):r instanceof Ee?(function(n,s){return s instanceof Ee&&n.op===s.op&&n.filters.length===s.filters.length?n.filters.reduce(((i,o,a)=>i&&y6(o,s.filters[a])),!0):!1})(r,e):void H(19439)}function E6(r,e){const t=r.filters.concat(e);return Ee.create(t,r.op)}function I6(r){return r instanceof ue?(function(t){return`${t.field.canonicalString()} ${t.op} ${Hs(t.value)}`})(r):r instanceof Ee?(function(t){return t.op.toString()+" {"+t.getFilters().map(I6).join(" ,")+"}"})(r):"Filter"}class o3 extends ue{constructor(e,t,n){super(e,t,n),this.key=B.fromName(n.referenceValue)}matches(e){const t=B.comparator(e.key,this.key);return this.matchesComparison(t)}}class a3 extends ue{constructor(e,t){super(e,"in",t),this.keys=w6("in",t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}}class c3 extends ue{constructor(e,t){super(e,"not-in",t),this.keys=w6("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}}function w6(r,e){return(e.arrayValue?.values||[]).map((t=>B.fromName(t.referenceValue)))}class u3 extends ue{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return pr(t)&&Co(t.arrayValue,this.value)}}class T6 extends ue{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&Co(this.value.arrayValue,t)}}class l3 extends ue{constructor(e,t){super(e,"not-in",t)}matches(e){if(Co(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&t.nullValue===void 0&&!Co(this.value.arrayValue,t)}}class h3 extends ue{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!pr(t)||!t.arrayValue.values)&&t.arrayValue.values.some((n=>Co(this.value.arrayValue,n)))}}class bo{constructor(e,t="asc"){this.field=e,this.dir=t}}function d3(r,e){return r.dir===e.dir&&r.field.isEqual(e.field)}class Ce{constructor(e,t,n,s,i,o,a){this.key=e,this.documentType=t,this.version=n,this.readTime=s,this.createTime=i,this.data=o,this.documentState=a}static newInvalidDocument(e){return new Ce(e,0,K.min(),K.min(),K.min(),ze.empty(),0)}static newFoundDocument(e,t,n,s){return new Ce(e,1,t,K.min(),n,s,0)}static newNoDocument(e,t){return new Ce(e,2,t,K.min(),K.min(),ze.empty(),0)}static newUnknownDocument(e,t){return new Ce(e,3,t,K.min(),K.min(),ze.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(K.min())||this.documentType!==2&&this.documentType!==0||(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=ze.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=ze.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=K.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof Ce&&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 Ce(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}})`}}
26class f3{constructor(e,t=null,n=[],s=[],i=null,o=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=s,this.limit=i,this.startAt=o,this.endAt=a,this.de=null}}function wl(r,e=null,t=[],n=[],s=null,i=null,o=null){return new f3(r,e,t,n,s,i,o)}function oc(r){const e=G(r);if(e.de===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((n=>Il(n))).join(","),t+="|ob:",t+=e.orderBy.map((n=>(function(i){return i.field.canonicalString()+i.dir})(n))).join(","),$o(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((n=>Hs(n))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((n=>Hs(n))).join(",")),e.de=t}return e.de}function l1(r,e){if(r.limit!==e.limit||r.orderBy.length!==e.orderBy.length)return!1;for(let t=0;t<r.orderBy.length;t++)if(!d3(r.orderBy[t],e.orderBy[t]))return!1;if(r.filters.length!==e.filters.length)return!1;for(let t=0;t<r.filters.length;t++)if(!y6(r.filters[t],e.filters[t]))return!1;return r.collectionGroup===e.collectionGroup&&!!r.path.isEqual(e.path)&&!!Of(r.startAt,e.startAt)&&Of(r.endAt,e.endAt)}function En(r){return!!r.isCorePipeline}function h1(r){return!!r.path&&B.isDocumentKey(r.path)&&r.collectionGroup===null&&r.filters.length===0}function ac(r,e){return r.filters.filter((t=>t instanceof ue&&t.field.isEqual(e)))}function Df(r,e,t){let n=cn,s=!0;for(const i of ac(r,e)){let o=cn,a=!0;switch(i.op){case"<":case"<=":o=X_(i.value);break;case"==":case"in":case">=":o=i.value;break;case">":o=i.value,a=!1;break;case"!=":case"not-in":o=cn}vf({value:n,inclusive:s},{value:o,inclusive:a})<0&&(n=o,s=a)}if(t!==null){for(let i=0;i<r.orderBy.length;++i)if(r.orderBy[i].field.isEqual(e)){const o=t.position[i];vf({value:n,inclusive:s},{value:o,inclusive:t.inclusive})<0&&(n=o,s=t.inclusive);break}}return{value:n,inclusive:s}}function kf(r,e,t){let n=er,s=!0;for(const i of ac(r,e)){let o=er,a=!0;switch(i.op){case">=":case">":o=Z_(i.value),a=!1;break;case"==":case"in":case"<=":o=i.value;break;case"<":o=i.value,a=!1;break;case"!=":case"not-in":o=er}Sf({value:n,inclusive:s},{value:o,inclusive:a})>0&&(n=o,s=a)}if(t!==null){for(let i=0;i<r.orderBy.length;++i)if(r.orderBy[i].field.isEqual(e)){const o=t.position[i];Sf({value:n,inclusive:s},{value:o,inclusive:t.inclusive})>0&&(n=o,s=t.inclusive);break}}return{value:n,inclusive:s}}class xn{constructor(e,t=null,n=[],s=[],i=null,o="F",a=null,u=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=s,this.limit=i,this.limitType=o,this.startAt=a,this.endAt=u,this.fe=null,this.me=null,this.pe=null,this.startAt,this.endAt}}function A6(r,e,t,n,s,i,o,a){return new xn(r,e,t,n,s,i,o,a)}function pi(r){return new xn(r)}function xf(r){return r.filters.length===0&&r.limit===null&&r.startAt==null&&r.endAt==null&&(r.explicitOrderBy.length===0||r.explicitOrderBy.length===1&&r.explicitOrderBy[0].field.isKeyField())}function p3(r){return B.isDocumentKey(r.path)&&r.collectionGroup===null&&r.filters.length===0}function d1(r){return r.collectionGroup!==null}function bs(r){const e=G(r);if(e.fe===null){e.fe=[];const t=new Set;for(const i of e.explicitOrderBy)e.fe.push(i),t.add(i.field.canonicalString());const n=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new ye(Ae.comparator);return o.filters.forEach((u=>{u.getFlattenedFilters().forEach((l=>{l.isInequality()&&(a=a.add(l.field))}))})),a})(e).forEach((i=>{t.has(i.canonicalString())||i.isKeyField()||e.fe.push(new bo(i,n))})),t.has(Ae.keyField().canonicalString())||e.fe.push(new bo(Ae.keyField(),n))}return e.fe}function dt(r){const e=G(r);return e.me||(e.me=v6(e,bs(r))),e.me}function R6(r){const e=G(r);return e.pe||(e.pe=v6(e,r.explicitOrderBy)),e.pe}function v6(r,e){if(r.limitType==="F")return wl(r.path,r.collectionGroup,e,r.filters,r.limit,r.startAt,r.endAt);{e=e.map((s=>{const i=s.dir==="desc"?"asc":"desc";return new bo(s.field,i)}));const t=r.endAt?new mr(r.endAt.position,r.endAt.inclusive):null,n=r.startAt?new mr(r.startAt.position,r.startAt.inclusive):null;return wl(r.path,r.collectionGroup,e,r.filters,r.limit,t,n)}}function Tl(r,e){const t=r.filters.concat([e]);return new xn(r.path,r.collectionGroup,r.explicitOrderBy.slice(),t,r.limit,r.limitType,r.startAt,r.endAt)}function m3(r,e){const t=r.explicitOrderBy.concat([e]);return new xn(r.path,r.collectionGroup,t,r.filters.slice(),r.limit,r.limitType,r.startAt,r.endAt)}function cc(r,e,t){return new xn(r.path,r.collectionGroup,r.explicitOrderBy.slice(),r.filters.slice(),e,t,r.startAt,r.endAt)}function g3(r,e){return new xn(r.path,r.collectionGroup,r.explicitOrderBy.slice(),r.filters.slice(),r.limit,r.limitType,e,r.endAt)}function _3(r,e){return new xn(r.path,r.collectionGroup,r.explicitOrderBy.slice(),r.filters.slice(),r.limit,r.limitType,r.startAt,e)}function S6(r,e){return l1(dt(r),dt(e))&&r.limitType===e.limitType}function fo(r){return`Query(target=${(function(t){let n=t.path.canonicalString();return t.collectionGroup!==null&&(n+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(n+=`, filters: [${t.filters.map((s=>I6(s))).join(", ")}]`),$o(t.limit)||(n+=", limit: "+t.limit),t.orderBy.length>0&&(n+=`, orderBy: [${t.orderBy.map((s=>(function(o){return`${o.field.canonicalString()} (${o.dir})`})(s))).join(", ")}]`),t.startAt&&(n+=", startAt: ",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map((s=>Hs(s))).join(",")),t.endAt&&(n+=", endAt: ",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map((s=>Hs(s))).join(",")),`Target(${n})`})(dt(r))}; limitType=${r.limitType})`}
26function Uc(r,e){return e.isFoundDocument()&&(function(n,s){const i=s.key.path;return n.collectionGroup!==null?s.key.hasCollectionId(n.collectionGroup)&&n.path.isPrefixOf(i):B.isDocumentKey(n.path)?n.path.isEqual(i):n.path.isImmediateParentOf(i)})(r,e)&&(function(n,s){for(const i of bs(n))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0})(r,e)&&(function(n,s){for(const i of n.filters)if(!i.matches(s))return!1;return!0})(r,e)&&(function(n,s){return!(n.startAt&&!(function(o,a,u){const l=Vf(o,a,u);return o.inclusive?l<=0:l<0})(n.startAt,bs(n),s)||n.endAt&&!(function(o,a,u){const l=Vf(o,a,u);return o.inclusive?l>=0:l>0})(n.endAt,bs(n),s))})(r,e)}function f1(r){return(e,t)=>{let n=!1;for(const s of bs(r)){const i=y3(s,e,t);if(i!==0)return i;n=n||s.field.isKeyField()}return 0}}function y3(r,e,t){const n=r.field.isKeyField()?B.comparator(e.key,t.key):(function(i,o,a){const u=o.data.field(i),l=a.data.field(i);return u!==null&&l!==null?ft(u,l):H(42886)})(r.field,e,t);switch(r.dir){case"asc":return n;case"desc":return-1*n;default:return H(19790,{direction:r.dir})}}class E3{constructor(e,t){this.count=e,this.unchangedNames=t}}var Fe,le;function P6(r){switch(r){case N.OK:return H(64938);case N.CANCELLED:case N.UNKNOWN:case N.DEADLINE_EXCEEDED:case N.RESOURCE_EXHAUSTED:case N.INTERNAL:case N.UNAVAILABLE:case N.UNAUTHENTICATED:return!1;case N.INVALID_ARGUMENT:case N.NOT_FOUND:case N.ALREADY_EXISTS:case N.PERMISSION_DENIED:case N.FAILED_PRECONDITION:case N.ABORTED:case N.OUT_OF_RANGE:case N.UNIMPLEMENTED:case N.DATA_LOSS:return!0;default:return H(15467,{code:r})}}function C6(r){if(r===void 0)return Le("GRPC error has no .code"),N.UNKNOWN;switch(r){case Fe.OK:return N.OK;case Fe.CANCELLED:return N.CANCELLED;case Fe.UNKNOWN:return N.UNKNOWN;case Fe.DEADLINE_EXCEEDED:return N.DEADLINE_EXCEEDED;case Fe.RESOURCE_EXHAUSTED:return N.RESOURCE_EXHAUSTED;case Fe.INTERNAL:return N.INTERNAL;case Fe.UNAVAILABLE:return N.UNAVAILABLE;case Fe.UNAUTHENTICATED:return N.UNAUTHENTICATED;case Fe.INVALID_ARGUMENT:return N.INVALID_ARGUMENT;case Fe.NOT_FOUND:return N.NOT_FOUND;case Fe.ALREADY_EXISTS:return N.ALREADY_EXISTS;case Fe.PERMISSION_DENIED:return N.PERMISSION_DENIED;case Fe.FAILED_PRECONDITION:return N.FAILED_PRECONDITION;case Fe.ABORTED:return N.ABORTED;case Fe.OUT_OF_RANGE:return N.OUT_OF_RANGE;case Fe.UNIMPLEMENTED:return N.UNIMPLEMENTED;case Fe.DATA_LOSS:return N.DATA_LOSS;default:return H(39323,{code:r})}}(le=Fe||(Fe={}))[le.OK=0]="OK",le[le.CANCELLED=1]="CANCELLED",le[le.UNKNOWN=2]="UNKNOWN",le[le.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",le[le.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",le[le.NOT_FOUND=5]="NOT_FOUND",le[le.ALREADY_EXISTS=6]="ALREADY_EXISTS",le[le.PERMISSION_DENIED=7]="PERMISSION_DENIED",le[le.UNAUTHENTICATED=16]="UNAUTHENTICATED",le[le.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",le[le.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",le[le.ABORTED=10]="ABORTED",le[le.OUT_OF_RANGE=11]="OUT_OF_RANGE",le[le.UNIMPLEMENTED=12]="UNIMPLEMENTED",le[le.INTERNAL=13]="INTERNAL",le[le.UNAVAILABLE=14]="UNAVAILABLE",le[le.DATA_LOSS=15]="DATA_LOSS";class Ln{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),n=this.inner[t];if(n!==void 0){for(const[s,i]of n)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,t){const n=this.mapKeyFn(e),s=this.inner[n];if(s===void 0)return this.inner[n]=[[e,t]],void this.innerSize++;for(let i=0;i<s.length;i++)if(this.equalsFn(s[i][0],e))return void(s[i]=[e,t]);s.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(n===void 0)return!1;for(let s=0;s<n.length;s++)if(this.equalsFn(n[s][0],e))return n.length===1?delete this.inner[t]:n.splice(s,1),this.innerSize--,!0;return!1}forEach(e){vr(this.inner,((t,n)=>{for(const[s,i]of n)e(s,i)}))}isEmpty(){return Zp(this.inner)}size(){return this.innerSize}}const I3=new Re(B.comparator);function qe(){return I3}const b6=new Re(B.comparator);function Ur(...r){let e=b6;for(const t of r)e=e.insert(t.key,t);return e}function N6(r){let e=b6;return r.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Lt(){return po()}function V6(){return po()}function po(){return new Ln((r=>r.toString()),((r,e)=>r.isEqual(e)))}const w3=new Re(B.comparator),T3=new ye(B.comparator);function ne(...r){let e=T3;for(const t of r)e=e.add(t);return e}const A3=new ye(Z);function p1(){return A3}let Al=null;function R3(r){if(Al)throw new Error("a TestingHooksSpi instance is already set");Al=r}function O6(){return new TextEncoder}const v3=new ir([4294967295,4294967295],0);function Lf(r){const e=O6().encode(r),t=new Rp;return t.update(e),new Uint8Array(t.digest())}function Mf(r){const e=new DataView(r.buffer),t=e.getUint32(0,!0),n=e.getUint32(4,!0),s=e.getUint32(8,!0),i=e.getUint32(12,!0);
vendor: 10,094 bytes, line 26
26return[new ir([t,n],0),new ir([s,i],0)]}class m1{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new eo(`Invalid padding: ${t}`);if(n<0)throw new eo(`Invalid hash count: ${n}`);if(e.length>0&&this.hashCount===0)throw new eo(`Invalid hash count: ${n}`);if(e.length===0&&t!==0)throw new eo(`Invalid padding when bitmap length is 0: ${t}`);this.ge=8*e.length-t,this.ye=ir.fromNumber(this.ge)}we(e,t,n){let s=e.add(t.multiply(ir.fromNumber(n)));return s.compare(v3)===1&&(s=new ir([s.getBits(0),s.getBits(1)],0)),s.modulo(this.ye).toNumber()}be(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;const t=Lf(e),[n,s]=Mf(t);for(let i=0;i<this.hashCount;i++){const o=this.we(n,s,i);if(!this.be(o))return!1}return!0}static create(e,t,n){const s=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),o=new m1(i,s,t);return n.forEach((a=>o.insert(a))),o}insert(e){if(this.ge===0)return;const t=Lf(e),[n,s]=Mf(t);for(let i=0;i<this.hashCount;i++){const o=this.we(n,s,i);this.ve(o)}}ve(e){const t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}}class eo extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}class mi{constructor(e,t,n,s,i,o){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=s,this.augmentedDocumentUpdates=i,this.resolvedLimboDocuments=o}static createSynthesizedRemoteEventForCurrentChange(e,t,n){const s=new Map;return s.set(e,Wo.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new mi(K.min(),s,new Re(Z),qe(),qe(),ne())}}class Wo{constructor(e,t,n,s,i){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=s,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new Wo(n,t,ne(),ne(),ne())}}class Ga{constructor(e,t,n,s){this.Se=e,this.removedTargetIds=t,this.key=n,this.De=s}}class D6{constructor(e,t){this.targetId=e,this.xe=t}}class k6{constructor(e,t,n=Se.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=s}}class Ff{constructor(e){this.targetId=e,this.Ce=0,this.Fe=Uf(),this.Oe=Se.EMPTY_BYTE_STRING,this.Me=!1,this.Ne=!0}get current(){return this.Me}get resumeToken(){return this.Oe}get Le(){return this.Ce!==0}get Be(){return this.Ne}Ue(e){e.approximateByteSize()>0&&(this.Ne=!0,this.Oe=e)}ke(){let e=ne(),t=ne(),n=ne();return this.Fe.forEach(((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:t=t.add(s);break;case 1:n=n.add(s);break;default:H(38017,{changeType:i})}})),new Wo(this.Oe,this.Me,e,t,n)}qe(){this.Ne=!1,this.Fe=Uf()}$e(e,t){this.Ne=!0,this.Fe=this.Fe.insert(e,t)}Ke(e){this.Ne=!0,this.Fe=this.Fe.remove(e)}We(){this.Ce+=1}Qe(){this.Ce-=1,U(this.Ce>=0,3241,{Ce:this.Ce,targetId:this.targetId})}Ge(){this.Ne=!0,this.Me=!0}}const ji="WatchChangeAggregator";class S3{constructor(e){this.ze=e,this.je=new Map,this.He=qe(),this.Je=Pa(),this.Ye=qe(),this.Ze=Pa(),this.Xe=new Re(Z)}et(e){for(const t of e.Se)e.De&&e.De.isFoundDocument()?this.tt(t,e.De):this.nt(t,e.key,e.De);for(const t of e.removedTargetIds)this.nt(t,e.key,e.De)}rt(e){this.forEachTarget(e,(t=>{const n=this.je.get(t);if(n)switch(e.state){case 0:this.it(t)&&n.Ue(e.resumeToken);break;case 1:n.Qe(),n.Le||n.qe(),n.Ue(e.resumeToken);break;case 2:n.Qe(),n.Le||this.removeTarget(t);break;case 3:this.it(t)&&(n.Ge(),n.Ue(e.resumeToken));break;case 4:this.it(t)&&(this.st(t),n.Ue(e.resumeToken));break;default:H(56790,{state:e.state})}else M(ji,`handleTargetChange received targetChange for untracked target ID (${t}) with state (${e.state})`)}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.je.forEach(((n,s)=>{this.it(s)&&t(s)}))}_t(e){return En(e)?e.getPipelineSourceType()==="documents"&&e.getPipelineDocuments()?.length===1:h1(e)}ot(e){const t=e.targetId,n=e.xe.count,s=this.ut(t);if(s){const i=s.target;if(this._t(i))if(n===0){const o=new B(En(i)?re.fromString(i.getPipelineDocuments()[0]):i.path);this.nt(t,o,Ce.newNoDocument(o,K.min()))}else U(n===1,20013,"Single document existence filter with count: "+n);else{const o=this.ct(t);if(o!==n){const a=this.lt(e),u=a?this.Et(a,e,o):1;if(u!==0){this.st(t);const l=u===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Xe=this.Xe.insert(t,l)}Al?.u((function(d,p,g,I,v){const k={localCacheCount:d,existenceFilterCount:p.count,databaseId:g.database,projectId:g.projectId},F=p.unchangedNames;return F&&(k.bloomFilter={applied:v===0,hashCount:F?.hashCount??0,bitmapLength:F?.bits?.bitmap?.length??0,padding:F?.bits?.padding??0,mightContain:W=>I?.mightContain(W)??!1}),k})(o,e.xe,this.ze.Tt(),a,u))}}}}lt(e){const t=e.xe.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:n="",padding:s=0},hashCount:i=0}=t;let o,a;try{o=bn(n).toUint8Array()}catch(u){if(u instanceof e6)return We("Decoding the base64 bloom filter in existence filter failed ("+u.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw u}try{a=new m1(o,s,i)}catch(u){return We(u instanceof eo?"BloomFilter error: ":"Applying bloom filter failed: ",u),null}return a.ge===0?null:a}Et(e,t,n){return t.xe.count===n-this.Pt(e,t.targetId)?0:2}Pt(e,t){const n=this.ze.getRemoteKeysForTarget(t);let s=0;return n.forEach((i=>{const o=this.ze.Tt(),a=`projects/${o.projectId}/databases/${o.database}/documents/${i.path.canonicalString()}`;e.mightContain(a)||(this.nt(t,i,null),s++)})),s}Rt(e){const t=new Map;this.je.forEach(((i,o)=>{const a=this.ut(o);if(a){if(i.current&&this._t(a.target)){const u=En(a.target)?re.fromString(a.target.getPipelineDocuments()[0]):a.target.path,l=new B(u);this.It(l).has(o)||this.At(o,l)||this.nt(o,l,Ce.newNoDocument(l,e))}i.Be&&(t.set(o,i.ke()),i.qe())}}));let n=ne();this.Ze.forEach(((i,o)=>{let a=!0;o.forEachWhile((u=>{const l=this.ut(u);return!l||l.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)})),a&&(n=n.add(i))})),this.He.forEach(((i,o)=>o.setReadTime(e))),this.Ye.forEach(((i,o)=>o.setReadTime(e)));const s=new mi(e,t,this.Xe,this.He,this.Ye,n);return this.He=qe(),this.Je=Pa(),this.Ye=qe(),this.Ze=Pa(),this.Xe=new Re(Z),s}tt(e,t){const n=this.je.get(e);if(!n||!this.it(e))return void M(ji,`addDocumentToTarget received document for unknown inactive target (${e})`);const s=this.At(e,t.key)?2:0;n.$e(t.key,s),En(this.ut(e).target)&&this.ut(e).target.getPipelineFlavor()!=="exact"?this.Ye=this.Ye.insert(t.key,t):this.He=this.He.insert(t.key,t),this.Je=this.Je.insert(t.key,this.It(t.key).add(e)),this.Ze=this.Ze.insert(t.key,this.Vt(t.key).add(e))}nt(e,t,n){const s=this.je.get(e);s&&this.it(e)?(this.At(e,t)?s.$e(t,1):s.Ke(t),this.Ze=this.Ze.insert(t,this.Vt(t).delete(e)),this.Ze=this.Ze.insert(t,this.Vt(t).add(e)),n&&(En(this.ut(e).target)&&this.ut(e).target.getPipelineFlavor()!=="exact"?this.Ye=this.Ye.insert(t,n):this.He=this.He.insert(t,n))):M(ji,`removeDocumentFromTarget received document for unknown or inactive target (${e})`)}removeTarget(e){this.je.delete(e)}ct(e){const t=this.je.get(e);if(!t)return 0;const n=t.ke();return this.ze.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}We(e){let t=this.je.get(e);t||(M(ji,`recordPendingTargetRequest set up tracking for target ID ${e}`),t=new Ff(e),this.je.set(e,t)),t.We()}Vt(e){let t=this.Ze.get(e);return t||(t=new ye(Z),this.Ze=this.Ze.insert(e,t)),t}It(e){let t=this.Je.get(e);return t||(t=new ye(Z),this.Je=this.Je.insert(e,t)),t}it(e){const t=this.ut(e)!==null;return t||M(ji,"Detected inactive target",e),t}ut(e){const t=this.je.get(e);return t===void 0||t.Le?null:this.ze.dt(e)}st(e){this.je.set(e,new Ff(e)),this.ze.getRemoteKeysForTarget(e).forEach((t=>{this.nt(e,t,null)}))}At(e,t){return this.ze.getRemoteKeysForTarget(e).has(t)}}function Pa(){return new Re(B.comparator)}function Uf(){return new Re(B.comparator)}const P3={asc:"ASCENDING",desc:"DESCENDING"},C3={"<":"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"},b3={and:"AND",or:"OR"};class N3{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Rl(r,e){return r.useProto3Json||$o(e)?e:{value:e}}function Js(r,e){return r.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function g1(r){const e=Cn(r);return new ge(e.seconds,e.nanos)}function x6(r,e){return r.useProto3Json?e.toBase64():e.toUint8Array()}function $a(r,e){return Js(r,e.toTimestamp())}function Me(r){return U(!!r,49232),K.fromTimestamp(g1(r))}function _1(r,e){return vl(r,e).canonicalString()}function vl(r,e){const t=(function(s){return new re(["projects",s.projectId,"databases",s.database])})(r).child("documents");return e===void 0?t:t.child(e)}function L6(r){const e=re.fromString(r);return U(H6(e),10190,{key:e.toString()}),e}function Xs(r,e){return _1(r.databaseId,e.path)}function un(r,e){const t=L6(e);if(t.get(1)!==r.databaseId.projectId)throw new L(N.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+t.get(1)+" vs "+r.databaseId.projectId);if(t.get(3)!==r.databaseId.database)throw new L(N.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+r.databaseId.database);return new B(U6(t))}function M6(r,e){return _1(r.databaseId,e)}function F6(r){const e=L6(r);return e.length===4?re.emptyPath():U6(e)}function Sl(r){return new re(["projects",r.databaseId.projectId,"databases",r.databaseId.database]).canonicalString()}function U6(r){return U(r.length>4&&r.get(4)==="documents",29091,{key:r.toString()}),r.popFirst(5)}function Bf(r,e,t){return{name:Xs(r,e),fields:t.value.mapValue.fields}}function Bc(r,e,t){const n=un(r,e.name),s=Me(e.updateTime),i=e.createTime?Me(e.createTime):K.min(),o=new ze({mapValue:{fields:e.fields}}),a=Ce.newFoundDocument(n,s,i,o);return t&&a.setHasCommittedMutations(),t?a.setHasCommittedMutations():a}function V3(r,e){return"found"in e?(function(n,s){U(!!s.found,43571),s.found.name,s.found.updateTime;
26const i=un(n,s.found.name),o=Me(s.found.updateTime),a=s.found.createTime?Me(s.found.createTime):K.min(),u=new ze({mapValue:{fields:s.found.fields}});return Ce.newFoundDocument(i,o,a,u)})(r,e):"missing"in e?(function(n,s){U(!!s.missing,3894),U(!!s.readTime,22933);const i=un(n,s.missing),o=Me(s.readTime);return Ce.newNoDocument(i,o)})(r,e):H(7234,{result:e})}function O3(r,e){let t;if("targetChange"in e){e.targetChange;const n=(function(l){return l==="NO_CHANGE"?0:l==="ADD"?1:l==="REMOVE"?2:l==="CURRENT"?3:l==="RESET"?4:H(39313,{state:l})})(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=(function(l,d){return l.useProto3Json?(U(d===void 0||typeof d=="string",58123),Se.fromBase64String(d||"")):(U(d===void 0||d instanceof Buffer||d instanceof Uint8Array,16193),Se.fromUint8Array(d||new Uint8Array))})(r,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&(function(l){const d=l.code===void 0?N.UNKNOWN:C6(l.code);return new L(d,l.message||"")})(o);t=new k6(n,s,i,a||null)}else if("documentChange"in e){e.documentChange;const n=e.documentChange;n.document,n.document.name,n.document.updateTime;const s=un(r,n.document.name),i=Me(n.document.updateTime),o=n.document.createTime?Me(n.document.createTime):K.min(),a=new ze({mapValue:{fields:n.document.fields}}),u=Ce.newFoundDocument(s,i,o,a),l=n.targetIds||[],d=n.removedTargetIds||[];t=new Ga(l,d,u.key,u)}else if("documentDelete"in e){e.documentDelete;const n=e.documentDelete;n.document;const s=un(r,n.document),i=n.readTime?Me(n.readTime):K.min(),o=Ce.newNoDocument(s,i),a=n.removedTargetIds||[];t=new Ga([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const n=e.documentRemove;n.document;const s=un(r,n.document),i=n.removedTargetIds||[];t=new Ga([],i,s,null)}else{if(!("filter"in e))return H(11601,{ft:e});{e.filter;const n=e.filter;n.targetId;const{count:s=0,unchangedNames:i}=n,o=new E3(s,i),a=n.targetId;t=new D6(a,o)}}return t}function No(r,e){let t;if(e instanceof di)t={update:Bf(r,e.key,e.value)};else if(e instanceof fi)t={delete:Xs(r,e.key)};else if(e instanceof kn)t={update:Bf(r,e.key,e.data),updateMask:F3(e.fieldMask)};else{if(!(e instanceof c1))return H(16599,{gt:e.type});t={verify:Xs(r,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map((n=>(function(i,o){const a=o.transform;if(a instanceof Ws)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Zr)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof es)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof ts)return{fieldPath:o.field.canonicalString(),increment:a.Re};if(a instanceof Ks)return{fieldPath:o.field.canonicalString(),minimum:a.Re};if(a instanceof Qs)return{fieldPath:o.field.canonicalString(),maximum:a.Re};throw H(20930,{transform:o.transform})})(0,n)))),e.precondition.isNone||(t.currentDocument=(function(s,i){return i.updateTime!==void 0?{updateTime:$a(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:H(27497)})(r,e.precondition)),t}function Pl(r,e){const t=e.currentDocument?(function(i){return i.updateTime!==void 0?be.updateTime(Me(i.updateTime)):i.exists!==void 0?be.exists(i.exists):be.none()})(e.currentDocument):be.none(),n=e.updateTransforms?e.updateTransforms.map((s=>(function(o,a){let u=null;if("setToServerValue"in a)U(a.setToServerValue==="REQUEST_TIME",16630,{proto:a}),u=new Ws;else if("appendMissingElements"in a){const d=a.appendMissingElements.values||[];u=new Zr(d)}else if("removeAllFromArray"in a){const d=a.removeAllFromArray.values||[];u=new es(d)}else"increment"in a?u=new ts(o,a.increment):"minimum"in a?u=new Ks(o,a.minimum):"maximum"in a?u=new Qs(o,a.maximum):H(16584,{proto:a});const l=Ae.fromServerFormat(a.fieldPath);return new as(l,u)})(r,s))):[];if(e.update){e.update.name;const s=un(r,e.update.name),i=new ze({mapValue:{fields:e.update.fields}});if(e.updateMask){const o=(function(u){const l=u.fieldPaths||[];return new Tt(l.map((d=>Ae.fromServerFormat(d))))})(e.updateMask);return new kn(s,i,o,t,n)}return new di(s,i,t,n)}if(e.delete){const s=un(r,e.delete);return new fi(s,t)}if(e.verify){const s=un(r,e.verify);return new c1(s,t)}return H(1463,{proto:e})}function D3(r,e){return r&&r.length>0?(U(e!==void 0,14353),r.map((t=>(function(s,i){let o=s.updateTime?Me(s.updateTime):Me(i);return o.isEqual(K.min())&&(o=Me(i)),new r3(o,s.transformResults||[])})(t,e)))):[]}function B6(r,e){return{documents:[M6(r,e.path)]}}function qc(r,e){const t={structuredQuery:{}},n=e.path;let s;e.collectionGroup!==null?(s=n,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=n.popLast(),t.structuredQuery.from=[{collectionId:n.lastSegment()}]),t.parent=M6(r,s);const i=(function(l){if(l.length!==0)return z6(Ee.create(l,"and"))})(e.filters);i&&(t.structuredQuery.where=i);const o=(function(l){if(l.length!==0)return l.map((d=>(function(g){return{field:Xn(g.field),direction:x3(g.dir)}})(d)))})(e.orderBy);o&&(t.structuredQuery.orderBy=o);const a=Rl(r,e.limit);return a!==null&&(t.structuredQuery.limit=a),e.startAt&&(t.structuredQuery.startAt=(function(l){return{before:l.inclusive,values:l.position}})(e.startAt)),e.endAt&&(t.structuredQuery.endAt=(function(l){return{before:!l.inclusive,values:l.position}})(e.endAt)),{yt:t,parent:s}}function q6(r,e,t,n){const{yt:s,parent:i}=qc(r,e),o={},a=[];let u=0;return t.forEach((l=>{const d=n?l.alias:"aggregate_"+u++;o[d]=l.alias,l.aggregateType==="count"?a.push({alias:d,count:{}}):l.aggregateType==="avg"?a.push({alias:d,avg:{field:Xn(l.fieldPath)}}):l.aggregateType==="sum"&&a.push({alias:d,sum:{field:Xn(l.fieldPath)}})}
26)),{request:{structuredAggregationQuery:{aggregations:a,structuredQuery:s.structuredQuery},parent:s.parent},wt:o,parent:i}}function G6(r){let e=F6(r.parent);const t=r.structuredQuery,n=t.from?t.from.length:0;let s=null;if(n>0){U(n===1,65062);const d=t.from[0];d.allDescendants?s=d.collectionId:e=e.child(d.collectionId)}let i=[];t.where&&(i=(function(p){const g=j6(p);return g instanceof Ee&&u1(g)?g.getFilters():[g]})(t.where));let o=[];t.orderBy&&(o=(function(p){return p.map((g=>(function(v){return new bo(Ss(v.field),(function(F){switch(F){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(v.direction))})(g)))})(t.orderBy));let a=null;t.limit&&(a=(function(p){let g;return g=typeof p=="object"?p.value:p,$o(g)?null:g})(t.limit));let u=null;t.startAt&&(u=(function(p){const g=!!p.before,I=p.values||[];return new mr(I,g)})(t.startAt));let l=null;return t.endAt&&(l=(function(p){const g=!p.before,I=p.values||[];return new mr(I,g)})(t.endAt)),A6(e,s,o,i,a,"F",u,l)}function k3(r,e){const t=(function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return H(28987,{purpose:s})}})(e.purpose);return t==null?null:{"goog-listen-tags":t}}function $6(r,e){return{structuredPipeline:{pipeline:{stages:e.stages.map((t=>t._toProto(r)))}}}}function j6(r){return r.unaryFilter!==void 0?(function(t){switch(t.unaryFilter.op){case"IS_NAN":const n=Ss(t.unaryFilter.field);return ue.create(n,"==",{doubleValue:NaN});case"IS_NULL":const s=Ss(t.unaryFilter.field);return ue.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=Ss(t.unaryFilter.field);return ue.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=Ss(t.unaryFilter.field);return ue.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return H(61313);default:return H(60726)}})(r):r.fieldFilter!==void 0?(function(t){return ue.create(Ss(t.fieldFilter.field),(function(s){switch(s){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 H(58110);default:return H(50506)}})(t.fieldFilter.op),t.fieldFilter.value)})(r):r.compositeFilter!==void 0?(function(t){return Ee.create(t.compositeFilter.filters.map((n=>j6(n))),(function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return H(1026)}})(t.compositeFilter.op))})(r):H(30097,{filter:r})}function x3(r){return P3[r]}function L3(r){return C3[r]}function M3(r){return b3[r]}function Xn(r){return{fieldPath:r.canonicalString()}}function Ss(r){return Ae.fromServerFormat(r.fieldPath)}function z6(r){return r instanceof ue?(function(t){if(t.op==="=="){if(Ct(t.value))return{unaryFilter:{field:Xn(t.field),op:"IS_NAN"}};if(Ot(t.value))return{unaryFilter:{field:Xn(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(Ct(t.value))return{unaryFilter:{field:Xn(t.field),op:"IS_NOT_NAN"}};if(Ot(t.value))return{unaryFilter:{field:Xn(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Xn(t.field),op:L3(t.op),value:t.value}}})(r):r instanceof Ee?(function(t){const n=t.getFilters().map((s=>z6(s)));return n.length===1?n[0]:{compositeFilter:{op:M3(t.op),filters:n}}})(r):H(54877,{filter:r})}function F3(r){const e=[];return r.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function H6(r){return r.length>=4&&r.get(0)==="projects"&&r.get(2)==="databases"}function W6(r){return!!r&&typeof r._toProto=="function"&&r._protoValueType==="ProtoValue"}function Vo(r,e){const t={fields:{}};return e.forEach(((n,s)=>{if(typeof s!="string")throw new Error(`Cannot encode map with non-string key: ${s}`);t.fields[s]=n._toProto(r)})),{mapValue:t}}function K6(r){return{stringValue:r}}function cs(r){return new N3(r,!0)}class It{constructor(e){this._byteString=e}static fromBase64String(e){try{return new It(Se.fromBase64String(e))}catch(t){throw new L(N.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new It(Se.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)}toJSON(){return{type:It._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(os(e,It._jsonSchema))return It.fromBase64String(e.bytes)}}
vendor: 14,246 bytes, line 26
26It._jsonSchemaVersion="firestore/bytes/1.0",It._jsonSchema={type:Ge("string",It._jsonSchemaVersion),bytes:Ge("string")};class us{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new L(N.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Ae(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}function Q6(){return new us(en)}class gn{constructor(e){this._methodName=e}}class Ht{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new L(N.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new L(N.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}_compareTo(e){return Z(this._lat,e._lat)||Z(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:Ht._jsonSchemaVersion}}static fromJSON(e){if(os(e,Ht._jsonSchema))return new Ht(e.latitude,e.longitude)}}function Y6(r){const e={};return r.timeoutSeconds!==void 0&&(e.timeoutSeconds=r.timeoutSeconds),e}Ht._jsonSchemaVersion="firestore/geoPoint/1.0",Ht._jsonSchema={type:Ge("string",Ht._jsonSchemaVersion),latitude:Ge("number"),longitude:Ge("number")};class U3{bt(e){}shutdown(){}}const qf="ConnectivityMonitor";class Gf{constructor(){this.vt=()=>this.St(),this.Dt=()=>this.xt(),this.Ct=[],this.Ft()}bt(e){this.Ct.push(e)}shutdown(){window.removeEventListener("online",this.vt),window.removeEventListener("offline",this.Dt)}Ft(){window.addEventListener("online",this.vt),window.addEventListener("offline",this.Dt)}St(){M(qf,"Network connectivity changed: AVAILABLE");for(const e of this.Ct)e(0)}xt(){M(qf,"Network connectivity changed: UNAVAILABLE");for(const e of this.Ct)e(1)}static C(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}let Ca=null;function Cl(){return Ca===null?Ca=(function(){return 268435456+Math.round(2147483648*Math.random())})():Ca++,"0x"+Ca.toString(16)}const Hu="RestConnection",B3={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class q3{get Ot(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Mt=t+"://"+e.host,this.Nt=`projects/${n}/databases/${s}`,this.Lt=this.databaseId.database===Po?`project_id=${n}`:`project_id=${n}&database_id=${s}`}Bt(e,t,n,s,i){const o=Cl(),a=this.Ut(e,t.toUriEncodedString());M(Hu,`Sending RPC '${e}' ${o}:`,a,n);const u={"google-cloud-resource-prefix":this.Nt,"x-goog-request-params":this.Lt};this.kt(u,s,i);const{host:l}=new URL(a),d=Tr(l);return this.qt(e,a,u,n,d).then((p=>(M(Hu,`Received RPC '${e}' ${o}: `,p),p)),(p=>{throw We(Hu,`RPC '${e}' ${o} failed with error: `,p,"url: ",a,"request:",n),p}))}$t(e,t,n,s,i,o){return this.Bt(e,t,n,s,i)}kt(e,t,n){e["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+li})(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach(((s,i)=>e[i]=s)),n&&n.headers.forEach(((s,i)=>e[i]=s))}Ut(e,t){const n=B3[e];let s=`${this.Mt}/v1/${t}:${n}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}class G3{constructor(e){this.Kt=e.Kt,this.Wt=e.Wt}Qt(e){this.Gt=e}zt(e){this.jt=e}Ht(e){this.Jt=e}onMessage(e){this.Yt=e}close(){this.Wt()}send(e){this.Kt(e)}Zt(){this.Gt()}Xt(){this.jt()}en(e){this.Jt(e)}tn(e){this.Yt(e)}}const at="WebChannelConnection",zi=(r,e,t)=>{r.listen(e,(n=>{try{t(n)}catch(s){setTimeout((()=>{throw s}),0)}}))};class Ns extends q3{constructor(e){super(e),this.nn=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static rn(){if(!Ns.sn){const e=Cp();zi(e,Pp.STAT_EVENT,(t=>{t.stat===ul.PROXY?M(at,"STAT_EVENT: detected buffering proxy"):t.stat===ul.NOPROXY&&M(at,"STAT_EVENT: detected no buffering proxy")})),Ns.sn=!0}}qt(e,t,n,s,i){const o=Cl();return new Promise(((a,u)=>{const l=new vp;l.setWithCredentials(!0),l.listenOnce(Sp.COMPLETE,(()=>{try{switch(l.getLastErrorCode()){case Ma.NO_ERROR:const p=l.getResponseJson();M(at,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(p)),a(p);break;case Ma.TIMEOUT:M(at,`RPC '${e}' ${o} timed out`),u(new L(N.DEADLINE_EXCEEDED,"Request time out"));break;case Ma.HTTP_ERROR:const g=l.getStatus();if(M(at,`RPC '${e}' ${o} failed with status:`,g,"response text:",l.getResponseText()),g>0){let I=l.getResponseJson();Array.isArray(I)&&(I=I[0]);const v=I?.error;if(v&&v.status&&v.message){const k=(function(W){const J=W.toLowerCase().replace(/_/g,"-");return Object.values(N).indexOf(J)>=0?J:N.UNKNOWN})(v.status);u(new L(k,v.message))}else u(new L(N.UNKNOWN,"Server responded with status "+l.getStatus()))}else u(new L(N.UNAVAILABLE,"Connection failed."));break;default:H(9055,{_n:e,streamId:o,an:l.getLastErrorCode(),un:l.getLastError()})}}finally{M(at,`RPC '${e}' ${o} completed.`)}}));const d=JSON.stringify(s);M(at,`RPC '${e}' ${o} sending request:`,s),l.send(t,"POST",d,n,15)}))}cn(e,t,n){const s=Cl(),i=[this.Mt,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=this.createWebChannelTransport(),a={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},u=this.longPollingOptions.timeoutSeconds;u!==void 0&&(a.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(a.useFetchStreams=!0),this.kt(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const l=i.join("");M(at,`Creating RPC '${e}' stream ${s}: ${l}`,a);const d=o.createWebChannel(l,a);this.En(d);let p=!1,g=!1;const I=new G3({Kt:v=>{g?M(at,`Not sending because RPC '${e}' stream ${s} is closed:`,v):(p||(M(at,`Opening RPC '${e}' stream ${s} transport.`),d.open(),p=!0),M(at,`RPC '${e}' stream ${s} sending:`,v),d.send(v))},Wt:()=>d.close()});return zi(d,Zi.EventType.OPEN,(()=>{g||(M(at,`RPC '${e}' stream ${s} transport opened.`),I.Zt())})),zi(d,Zi.EventType.CLOSE,(()=>{g||(g=!0,M(at,`RPC '${e}' stream ${s} transport closed`),I.en(),this.hn(d))})),zi(d,Zi.EventType.ERROR,(v=>{g||(g=!0,We(at,`RPC '${e}' stream ${s} transport errored. Name:`,v.name,"Message:",v.message),I.en(new L(N.UNAVAILABLE,"The operation could not be completed")))})),zi(d,Zi.EventType.MESSAGE,(v=>{if(!g){const k=v.data[0];U(!!k,16349);const F=k,W=F?.error||F[0]?.error;if(W){M(at,`RPC '${e}' stream ${s} received error:`,W);const J=W.status;let Y=(function(pe){const T=Fe[pe];if(T!==void 0)return C6(T)})(J),me=W.message;J==="NOT_FOUND"&&me.includes("database")&&me.includes("does not exist")&&me.includes(this.databaseId.database)&&We(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),Y===void 0&&(Y=N.INTERNAL,me="Unknown error status: "+J+" with message "+W.message),g=!0,I.en(new L(Y,me)),d.close()}else M(at,`RPC '${e}' stream ${s} received:`,k),I.tn(k)}})),Ns.rn(),setTimeout((()=>{I.Xt()}),0),I}terminate(){this.nn.forEach((e=>e.close())),this.nn=[]}En(e){this.nn.push(e)}hn(e){this.nn=this.nn.filter((t=>t===e))}kt(e,t,n){super.kt(e,t,n),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return bp()}}function $3(r){return new Ns(r)}Ns.sn=!1;class y1{constructor(e,t,n=1e3,s=1.5,i=6e4){this.Tn=e,this.timerId=t,this.Pn=n,this.Rn=s,this.In=i,this.An=0,this.Vn=null,this.dn=Date.now(),this.reset()}reset(){this.An=0}fn(){this.An=this.In}mn(e){this.cancel();const t=Math.floor(this.An+this.pn()),n=Math.max(0,Date.now()-this.dn),s=Math.max(0,t-n);s>0&&M("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.An} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Vn=this.Tn.enqueueAfterDelay(this.timerId,s,(()=>(this.dn=Date.now(),e()))),this.An*=this.Rn,this.An<this.Pn&&(this.An=this.Pn),this.An>this.In&&(this.An=this.In)}gn(){this.Vn!==null&&(this.Vn.skipDelay(),this.Vn=null)}cancel(){this.Vn!==null&&(this.Vn.cancel(),this.Vn=null)}pn(){return(Math.random()-.5)*this.An}}const $f="PersistentStream";class J6{constructor(e,t,n,s,i,o,a,u){this.Tn=e,this.yn=n,this.wn=s,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=u,this.state=0,this.bn=0,this.vn=null,this.Sn=null,this.stream=null,this.Dn=0,this.xn=new y1(e,t)}Cn(){return this.state===1||this.state===5||this.Fn()}Fn(){return this.state===2||this.state===3}start(){this.Dn=0,this.state!==4?this.auth():this.On()}async stop(){this.Cn()&&await this.close(0)}Mn(){this.state=0,this.xn.reset()}Nn(){this.Fn()&&this.vn===null&&(this.vn=this.Tn.enqueueAfterDelay(this.yn,6e4,(()=>this.Ln())))}Bn(e){this.Un(),this.stream.send(e)}async Ln(){if(this.Fn())return this.close(0)}Un(){this.vn&&(this.vn.cancel(),this.vn=null)}kn(){this.Sn&&(this.Sn.cancel(),this.Sn=null)}async close(e,t){this.Un(),this.kn(),this.xn.cancel(),this.bn++,e!==4?this.xn.reset():t&&t.code===N.RESOURCE_EXHAUSTED?(Le(t.toString()),Le("Using maximum backoff delay to prevent overloading the backend."),this.xn.fn()):t&&t.code===N.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.qn(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Ht(t)}qn(){}auth(){this.state=1;const e=this.$n(this.bn),t=this.bn;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([n,s])=>{this.bn===t&&this.Kn(n,s)}),(n=>{e((()=>{const s=new L(N.UNKNOWN,"Fetching auth token failed: "+n.message);return this.Wn(s)}))}))}Kn(e,t){const n=this.$n(this.bn);this.stream=this.Qn(e,t),this.stream.Qt((()=>{n((()=>this.listener.Qt()))})),this.stream.zt((()=>{n((()=>(this.state=2,this.Sn=this.Tn.enqueueAfterDelay(this.wn,1e4,(()=>(this.Fn()&&(this.state=3),Promise.resolve()))),this.listener.zt())))})),this.stream.Ht((s=>{n((()=>this.Wn(s)))})),this.stream.onMessage((s=>{n((()=>++this.Dn==1?this.Gn(s):this.onNext(s)))}))}On(){this.state=5,this.xn.mn((async()=>{this.state=0,this.start()}))}Wn(e){return M($f,`close with error: ${e}`),this.stream=null,this.close(4,e)}$n(e){return t=>{this.Tn.enqueueAndForget((()=>this.bn===e?t():(M($f,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class j3 extends J6{constructor(e,t,n,s,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,s,o),this.serializer=i}Qn(e,t){return this.connection.cn("Listen",e,t)}Gn(e){return this.onNext(e)}onNext(e){this.xn.reset();const t=O3(this.serializer,e),n=(function(i){if(!("targetChange"in i))return K.min();const o=i.targetChange;return o.targetIds&&o.targetIds.length?K.min():o.readTime?Me(o.readTime):K.min()})(e);return this.listener.zn(t,n)}jn(e){const t={};t.database=Sl(this.serializer),t.addTarget=(function(i,o){let a;const u=o.target;if(a=En(u)?{pipelineQuery:$6(i,u)}:h1(u)?{documents:B6(i,u)}:{query:qc(i,u).yt},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=x6(i,o.resumeToken);const l=Rl(i,o.expectedCount);l!==null&&(a.expectedCount=l)}else if(o.snapshotVersion.compareTo(K.min())>0){a.readTime=Js(i,o.snapshotVersion.toTimestamp());const l=Rl(i,o.expectedCount);l!==null&&(a.expectedCount=l)}return a})(this.serializer,e);const n=k3(this.serializer,e);n&&(t.labels=n),this.Bn(t)}Hn(e){const t={};t.database=Sl(this.serializer),t.removeTarget=e,this.Bn(t)}}class z3 extends J6{constructor(e,t,n,s,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,s,o),this.serializer=i}get Jn(){return this.Dn>0}start(){this.lastStreamToken=void 0,super.start()}qn(){this.Jn&&this.Yn([])}Qn(e,t){return this.connection.cn("Write",e,t)}Gn(e){return U(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,U(!e.writeResults||e.writeResults.length===0,55816),this.listener.Zn()}onNext(e){U(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.xn.reset();const t=D3(e.writeResults,e.commitTime),n=Me(e.commitTime);return this.listener.Xn(n,t)}er(){const e={};e.database=Sl(this.serializer),this.Bn(e)}Yn(e){const t={streamToken:this.lastStreamToken,writes:e.map((n=>No(this.serializer,n)))};this.Bn(t)}}class H3{}class W3 extends H3{constructor(e,t,n,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=s,this.tr=!1}nr(){if(this.tr)throw new L(N.FAILED_PRECONDITION,"The client has already been terminated.")}Bt(e,t,n,s){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,o])=>this.connection.Bt(e,vl(t,n),s,i,o))).catch((i=>{throw i.name==="FirebaseError"?(i.code===N.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new L(N.UNKNOWN,i.toString())}))}$t(e,t,n,s,i){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([o,a])=>this.connection.$t(e,vl(t,n),s,o,a,i))).catch((o=>{throw o.name==="FirebaseError"?(o.code===N.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new L(N.UNKNOWN,o.toString())}))}terminate(){this.tr=!0,this.connection.terminate()}}function K3(r,e,t,n){return new W3(r,e,t,n)}const Q3="ComponentProvider",jf=new Map;function Y3(r,e,t,n,s){return new Y_(r,e,t,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,Y6(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,n)}const zf={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},X6=41943040;class ut{static withCacheSize(e){return new ut(e,ut.DEFAULT_COLLECTION_PE
26RCENTILE,ut.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}}ut.DEFAULT_COLLECTION_PERCENTILE=10,ut.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,ut.DEFAULT=new ut(X6,ut.DEFAULT_COLLECTION_PERCENTILE,ut.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),ut.DISABLED=new ut(-1,0,0);const Hf="LruGarbageCollector",Z6=1048576;function Wf([r,e],[t,n]){const s=Z(r,t);return s===0?Z(e,n):s}class J3{constructor(e){this.rr=e,this.buffer=new ye(Wf),this.ir=0}sr(){return++this.ir}_r(e){const t=[e,this.sr()];if(this.buffer.size<this.rr)this.buffer=this.buffer.add(t);else{const n=this.buffer.last();Wf(t,n)<0&&(this.buffer=this.buffer.delete(n).add(t))}}get maxValue(){return this.buffer.last()[0]}}class em{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.ar=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.ur(6e4)}stop(){this.ar&&(this.ar.cancel(),this.ar=null)}get started(){return this.ar!==null}ur(e){M(Hf,`Garbage collection scheduled in ${e}ms`),this.ar=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,(async()=>{this.ar=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){Rr(t)?M(Hf,"Ignoring IndexedDB error during garbage collection: ",t):await Ar(t)}await this.ur(3e5)}))}}class X3{constructor(e,t){this.cr=e,this.params=t}calculateTargetCount(e,t){return this.cr.lr(e).next((n=>Math.floor(t/100*n)))}nthSequenceNumber(e,t){if(t===0)return C.resolve(wt.ce);const n=new J3(t);return this.cr.forEachTarget(e,(s=>n._r(s.sequenceNumber))).next((()=>this.cr.Er(e,(s=>n._r(s))))).next((()=>n.maxValue))}removeTargets(e,t,n){return this.cr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.cr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(M("LruGarbageCollector","Garbage collection skipped; disabled"),C.resolve(zf)):this.getCacheSize(e).next((n=>n<this.params.cacheSizeCollectionThreshold?(M("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),zf):this.hr(e,t)))}getCacheSize(e){return this.cr.getCacheSize(e)}hr(e,t){let n,s,i,o,a,u,l;const d=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((p=>(p>this.params.maximumSequenceNumbersToCollect?(M("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${p}`),s=this.params.maximumSequenceNumbersToCollect):s=p,o=Date.now(),this.nthSequenceNumber(e,s)))).next((p=>(n=p,a=Date.now(),this.removeTargets(e,n,t)))).next((p=>(i=p,u=Date.now(),this.removeOrphanedDocuments(e,n)))).next((p=>(l=Date.now(),vs()<=ce.DEBUG&&M("LruGarbageCollector",`LRU Garbage Collection
27	Counted targets in ${o-d}ms
28	Determined least recently used ${s} in `+(a-o)+`ms
29	Removed ${i} targets in `+(u-a)+`ms
30	Removed ${p} documents in `+(l-u)+`ms
31Total Duration: ${l-d}ms`),C.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:p}))))}}function tm(r,e){return new X3(r,e)}const nm="firestore.googleapis.com",Kf=!0;class Qf{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new L(N.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=nm,this.ssl=Kf}else this.host=e.host,this.ssl=e.ssl??Kf;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=X6;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<Z6)throw new L(N.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}xp("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Y6(e.experimentalLongPollingOptions??{}),(function(n){if(n.timeoutSeconds!==void 0){if(isNaN(n.timeoutSeconds))throw new L(N.INVALID_ARGUMENT,`invalid long polling timeout: ${n.timeoutSeconds} (must not be NaN)`);if(n.timeoutSeconds<5)throw new L(N.INVALID_ARGUMENT,`invalid long polling timeout: ${n.timeoutSeconds} (minimum allowed value is 5)`);if(n.timeoutSeconds>30)throw new L(N.INVALID_ARGUMENT,`invalid long polling timeout: ${n.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){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&&(function(n,s){return n.timeoutSeconds===s.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Ko{constructor(e,t,n,s){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Qf({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new L(N.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new L(N.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 Qf(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(n){if(!n)return new Dp;switch(n.type){case"firstParty":return new c_(n.sessionIndex||"0",n.iamToken||null,n.authTokenFactory||null);case"provider":return n.client;default:throw new L(N.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invali
31d credential type")}})(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(t){const n=jf.get(t);n&&(M(Q3,"Removing Datastore"),jf.delete(t),n.terminate())})(this),Promise.resolve()}}function rm(r,e,t,n={}){r=oe(r,Ko);const s=Tr(e),i=r._getSettings(),o={...i,emulatorOptions:r._getEmulatorOptions()},a=`${e}:${t}`;s&&Cc(`https://${a}`),i.host!==nm&&i.host!==a&&We("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const u={...i,host:a,ssl:s,emulatorOptions:n};if(!Kt(u,o)&&(r._setSettings(u),n.mockUserToken)){let l,d;if(typeof n.mockUserToken=="string")l=n.mockUserToken,d=et.MOCK_USER;else{l=I7(n.mockUserToken,r._app?.options.projectId);const p=n.mockUserToken.sub||n.mockUserToken.user_id;if(!p)throw new L(N.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");d=new et(p)}r._authCredentials=new i_(new Op(l,d))}}class Ke{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new Ke(this.firestore,e,this._query)}}class _e{constructor(e,t,n){this.converter=t,this._key=n,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 Wt(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new _e(this.firestore,e,this._key)}toJSON(){return{type:_e._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(os(t,_e._jsonSchema))return new _e(e,n||null,new B(re.fromString(t.referencePath)))}}_e._jsonSchemaVersion="firestore/documentReference/1.0",_e._jsonSchema={type:Ge("string",_e._jsonSchemaVersion),referencePath:Ge("string")};class Wt extends Ke{constructor(e,t,n){super(e,t,pi(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new _e(this.firestore,null,new B(e))}withConverter(e){return new Wt(this.firestore,e,this._path)}}function Z3(r,e,...t){if(r=ee(r),Yl("collection","path",e),r instanceof Ko){const n=re.fromString(e,...t);return mf(n),new Wt(r,null,n)}{if(!(r instanceof _e||r instanceof Wt))throw new L(N.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const n=r._path.child(re.fromString(e,...t));return mf(n),new Wt(r.firestore,null,n)}}function e9(r,e){if(r=oe(r,Ko),Yl("collectionGroup","collection id",e),e.indexOf("/")>=0)throw new L(N.INVALID_ARGUMENT,`Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);return new Ke(r,null,(function(n){return new xn(re.emptyPath(),n)})(e))}function sm(r,e,...t){if(r=ee(r),arguments.length===1&&(e=Nc.newId()),Yl("doc","path",e),r instanceof Ko){const n=re.fromString(e,...t);return pf(n),new _e(r,null,new B(n))}{if(!(r instanceof _e||r instanceof Wt))throw new L(N.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const n=r._path.child(re.fromString(e,...t));return pf(n),new _e(r.firestore,r instanceof Wt?r.converter:null,new B(n))}}function t9(r,e){return r=ee(r),e=ee(e),(r instanceof _e||r instanceof Wt)&&(e instanceof _e||e instanceof Wt)&&r.firestore===e.firestore&&r.path===e.path&&r.converter===e.converter}function E1(r,e){return r=ee(r),e=ee(e),r instanceof Ke&&e instanceof Ke&&r.firestore===e.firestore&&S6(r._query,e._query)&&r.converter===e.converter}class _t{constructor(e){this._values=(e||[]).map((t=>t))}toArray(){return this._values.map((e=>e))}isEqual(e){return(function(n,s){if(n.length!==s.length)return!1;for(let i=0;i<n.length;++i)if(n[i]!==s[i])return!1;return!0})(this._values,e._values)}toJSON(){return{type:_t._jsonSchemaVersion,vectorValues:this._values}}
vendor: 6,105 bytes, line 31
31static fromJSON(e){if(os(e,_t._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every((t=>typeof t=="number")))return new _t(e.vectorValues);throw new L(N.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}_t._jsonSchemaVersion="firestore/vectorValue/1.0",_t._jsonSchema={type:Ge("string",_t._jsonSchemaVersion),vectorValues:Ge("object")};const n9=/^__.*__$/;class r9{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return this.fieldMask!==null?new kn(e,this.data,this.fieldMask,t,this.fieldTransforms):new di(e,this.data,t,this.fieldTransforms)}}class im{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return new kn(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function om(r){switch(r){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw H(40011,{dataSource:r})}}class Gc{constructor(e,t,n,s,i,o){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=s,i===void 0&&this.validatePath(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(e){return new Gc({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){const t=this.path?.child(e),n=this.contextWith({path:t,arrayElement:!1});return n.validatePathSegment(e),n}childContextForFieldPath(e){const t=this.path?.child(e),n=this.contextWith({path:t,arrayElement:!1});return n.validatePath(),n}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return uc(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find((t=>e.isPrefixOf(t)))!==void 0||this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))!==void 0}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(e.length===0)throw this.createError("Document fields must not be empty");if(om(this.dataSource)&&n9.test(e))throw this.createError('Document fields cannot begin and end with "__"')}}class s9{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||cs(e)}createContext(e,t,n,s=!1){return new Gc({dataSource:e,methodName:t,targetDoc:n,path:Ae.emptyPath(),arrayElement:!1,hasConverter:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function ls(r){const e=r._freezeSettings(),t=cs(r._databaseId);return new s9(r._databaseId,!!e.ignoreUndefinedProperties,t)}function $c(r,e,t,n,s,i={}){const o=r.createContext(i.merge||i.mergeFields?2:0,e,t,s);C1("Data must be an object, but it was:",o,n);const a=um(n,o);let u,l;if(i.merge)u=new Tt(o.fieldMask),l=o.fieldTransforms;else if(i.mergeFields){const d=[];for(const p of i.mergeFields){const g=Qt(e,p,t);if(!o.contains(g))throw new L(N.INVALID_ARGUMENT,`Field '${g}' is specified in your field mask but missing from your input data.`);hm(d,g)||d.push(g)}u=new Tt(d),l=o.fieldTransforms.filter((p=>u.covers(p.field)))}else u=null,l=o.fieldTransforms;return new r9(new ze(a),u,l)}class Qo extends gn{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.createError(`${this._methodName}() can only appear at the top level of your update data`):e.createError(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Qo}}function am(r,e,t){return new Gc({dataSource:3,targetDoc:e.settings.targetDoc,methodName:r._methodName,arrayElement:t},e.databaseId,e.serializer,e.ignoreUndefinedProperties)}class I1 extends gn{_toFieldTransform(e){return new as(e.path,new Ws)}isEqual(e){return e instanceof I1}}class w1 extends gn{constructor(e,t){super(e),this.Tr=t}_toFieldTransform(e){const t=am(this,e,!0),n=this.Tr.map((i=>ln(i,t))),s=new Zr(n);return new as(e.path,s)}isEqual(e){return e instanceof w1&&Kt(this.Tr,e.Tr)}}class T1 extends gn{constructor(e,t){super(e),this.Tr=t}_toFieldTransform(e){const t=am(this,e,!0),n=this.Tr.map((i=>ln(i,t))),s=new es(n);return new as(e.path,s)}isEqual(e){return e instanceof T1&&Kt(this.Tr,e.Tr)}}class A1 extends gn{constructor(e,t){super(e),this.Pr=t}_toFieldTransform(e){const t=new ts(e.serializer,hi(e.serializer,this.Pr));return new as(e.path,t)}isEqual(e){return e instanceof A1&&(this.Pr===e.Pr||Number.isNaN(this.Pr)&&Number.isNaN(e.Pr))}}class R1 extends gn{constructor(e,t){super(e),this.Pr=t}_toFieldTransform(e){const t=new Ks(e.serializer,hi(e.serializer,this.Pr));return new as(e.path,t)}isEqual(e){return e instanceof R1&&(this.Pr===e.Pr||Number.isNaN(this.Pr)&&Number.isNaN(e.Pr))}}class v1 extends gn{constructor(e,t){super(e),this.Pr=t}_toFieldTransform(e){const t=new Qs(e.serializer,hi(e.serializer,this.Pr));return new as(e.path,t)}isEqual(e){return e instanceof v1&&(this.Pr===e.Pr||Number.isNaN(this.Pr)&&Number.isNaN(e.Pr))}}function S1(r,e,t,n){const s=r.createContext(1,e,t);C1("Data must be an object, but it was:",s,n);const i=[],o=ze.empty();vr(n,((u,l)=>{const d=b1(e,u,t);l=ee(l);const p=s.childContextForFieldPath(d);if(l instanceof Qo)i.push(d);else{const g=ln(l,p);g!=null&&(i.push(d),o.set(d,g))}}));const a=new Tt(i);return new im(o,a,s.fieldTransforms)}function P1(r,e,t,n,s,i){const o=r.createContext(1,e,t),a=[Qt(e,n,t)],u=[s];if(i.length%2!=0)throw new L(N.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let g=0;g<i.length;g+=2)a.push(Qt(e,i[g])),u.push(i[g+1]);const l=[],d=ze.empty();for(let g=a.length-1;g>=0;--g)if(!hm(l,a[g])){const I=a[g];let v=u[g];v=ee(v);const k=o.childContextForFieldPath(I);if(v instanceof Qo)l.push(I);else{const F=ln(v,k);F!=null&&(l.push(I),d.set(I,F))}}const p=new Tt(l);return new im(d,p,o.fieldTransforms)}function cm(r,e,t,n=!1){return ln(t,r.createContext(n?4:3,e))}function ln(r,e,t){if(lm(r=ee(r)))return C1("Unsupported field value:",e,r),um(r,e);
31if(r instanceof gn)return(function(s,i){if(!om(i.dataSource))throw i.createError(`${s._methodName}() can only be used with update() and set()`);if(!i.path)throw i.createError(`${s._methodName}() is not currently supported inside arrays`);const o=s._toFieldTransform(i);o&&i.fieldTransforms.push(o)})(r,e),null;if(r===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),r instanceof Array){if(e.settings.arrayElement&&e.dataSource!==4)throw e.createError("Nested arrays are not supported");return(function(s,i){const o=[];let a=0;for(const u of s){let l=ln(u,i.childContextForArray(a));l==null&&(l={nullValue:"NULL_VALUE"}),o.push(l),a++}return{arrayValue:{values:o}}})(r,e)}return(function(s,i,o){if((s=ee(s))===null)return{nullValue:"NULL_VALUE"};if(typeof s=="number")return hi(i.serializer,s,o);if(typeof s=="boolean")return{booleanValue:s};if(typeof s=="string")return{stringValue:s};if(s instanceof Date){const a=ge.fromDate(s);return{timestampValue:Js(i.serializer,a)}}if(s instanceof ge){const a=new ge(s.seconds,1e3*Math.floor(s.nanoseconds/1e3));return{timestampValue:Js(i.serializer,a)}}if(s instanceof Ht)return{geoPointValue:{latitude:s.latitude,longitude:s.longitude}};if(s instanceof It)return{bytesValue:x6(i.serializer,s._byteString)};if(s instanceof _e){const a=i.databaseId,u=s.firestore._databaseId;if(!u.isEqual(a))throw i.createError(`Document reference is for database ${u.projectId}/${u.database} but should be for database ${a.projectId}/${a.database}`);return{referenceValue:_1(s.firestore._databaseId||i.databaseId,s._key.path)}}if(s instanceof _t)return(function(u,l){const d=u instanceof _t?u.toArray():u;return{mapValue:{fields:{[s1]:{stringValue:i1},[Yr]:{arrayValue:{values:d.map((g=>{if(typeof g!="number")throw l.createError("VectorValues must only contain numeric values.");return Lc(l.serializer,g)}))}}}}}})(s,i);if(W6(s))return s._toProto(i.serializer);throw i.createError(`Unsupported field value: ${Vc(s)}`)})(r,e,t)}function um(r,e){const t={};return Zp(r)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):vr(r,((n,s)=>{const i=ln(s,e.childContextForField(n));i!=null&&(t[n]=i)})),{mapValue:{fields:t}}}function lm(r){return!(typeof r!="object"||r===null||r instanceof Array||r instanceof Date||r instanceof ge||r instanceof Ht||r instanceof It||r instanceof _e||r instanceof gn||r instanceof _t||W6(r))}function C1(r,e,t){if(!lm(t)||!Go(t)){const n=Vc(t);throw n==="an object"?e.createError(r+" a custom object"):e.createError(r+" "+n)}}function Qt(r,e,t){if((e=ee(e))instanceof us)return e._internalPath;if(typeof e=="string")return b1(r,e);throw uc("Field path arguments must be of type string or ",r,!1,void 0,t)}const i9=new RegExp("[~\\*/\\[\\]]");function b1(r,e,t){if(e.search(i9)>=0)throw uc(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,r,!1,void 0,t);try{return new us(...e.split("."))._internalPath}catch{throw uc(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,r,!1,void 0,t)}}function uc(r,e,t,n,s){const i=n&&!n.isEmpty(),o=s!==void 0;let a=`Function ${e}() called with invalid data`;t&&(a+=" (via `toFirestore()`)"),a+=". ";let u="";return(i||o)&&(u+=" (found",i&&(u+=` in field ${n}`),o&&(u+=` in document ${s}`),u+=")"),new L(N.INVALID_ARGUMENT,a+r+u)}function hm(r,e){return r.some((t=>t.isEqual(e)))}function dm(r){return typeof r._readUserData=="function"}class pt{constructor(e){this.optionDefinitions=e}_getKnownOptions(e,t){const n=ze.empty();for(const s in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(s)){const i=this.optionDefinitions[s];if(s in e){const o=e[s];let a;i.nestedOptions&&Go(o)?a={mapValue:{fields:new pt(i.nestedOptions).getOptionsProto(t,o)}}:o&&(a=ln(o,t)??void 0),a&&n.set(Ae.fromServerFormat(i.serverName),a)}}return n}getOptionsProto(e,t,n){const s=this._getKnownOptions(t,e);if(n){const i=new Map(r1(n,((o,a)=>[Ae.fromServerFormat(a),o!==void 0?ln(o,e):null])));s.setAll(i)}return s.value.mapValue.fields??{}}}function o9(r){return typeof r=="object"&&r!==null&&!!("nullValue"in r&&(r.nullValue===null||r.nullValue==="NULL_VALUE")||"booleanValue"in r&&(r.booleanValue===null||typeof r.booleanValue=="boolean")||"integerValue"in r&&(r.integerValue===null||typeof r.integerValue=="number"||typeof r.integerValue=="string")||"doubleValue"in r&&(r.doubleValue===null||typeof r.doubleValue=="number")||"timestampValue"in r&&(r.timestampValue===null||(function(t){return typeof t=="object"&&t!==null&&"seconds"in t&&(t.seconds===null||typeof t.seconds=="number"||typeof t.seconds=="str
31ing")&&"nanos"in t&&(t.nanos===null||typeof t.nanos=="number")})(r.timestampValue))||"stringValue"in r&&(r.stringValue===null||typeof r.stringValue=="string")||"bytesValue"in r&&(r.bytesValue===null||r.bytesValue instanceof Uint8Array)||"referenceValue"in r&&(r.referenceValue===null||typeof r.referenceValue=="string")||"geoPointValue"in r&&(r.geoPointValue===null||(function(t){return typeof t=="object"&&t!==null&&"latitude"in t&&(t.latitude===null||typeof t.latitude=="number")&&"longitude"in t&&(t.longitude===null||typeof t.longitude=="number")})(r.geoPointValue))||"arrayValue"in r&&(r.arrayValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("values"in t)||t.values!==null&&!Array.isArray(t.values))})(r.arrayValue))||"mapValue"in r&&(r.mapValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("fields"in t)||t.fields!==null&&!Go(t.fields))})(r.mapValue))||"fieldReferenceValue"in r&&(r.fieldReferenceValue===null||typeof r.fieldReferenceValue=="string")||"functionValue"in r&&(r.functionValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("name"in t)||t.name!==null&&typeof t.name!="string"||!("args"in t)||t.args!==null&&!Array.isArray(t.args))})(r.functionValue))||"pipelineValue"in r&&(r.pipelineValue===null||(function(t){return typeof t=="object"&&t!==null&&!(!("stages"in t)||t.stages!==null&&!Array.isArray(t.stages))})(r.pipelineValue)))}function a9(){return new Qo("deleteField")}function c9(){return new I1("serverTimestamp")}function u9(...r){return new w1("arrayUnion",r)}function l9(...r){return new T1("arrayRemove",r)}function h9(r){return new A1("increment",r)}function d9(r){return new R1("minimum",r)}function f9(r){return new v1("maximum",r)}function fm(r){return new _t(r)}function q(r){let e;return r instanceof hs?r:(e=Go(r)?y9(r):r instanceof Array?E9(r):pm(r,void 0),e)}function Wu(r){if(r instanceof hs)return r;if(r instanceof _t)return Oo(r);if(Array.isArray(r))return Oo(fm(r));throw new Error("Unsupported value: "+typeof r)}function N1(r){return w_(r)?ja(r):q(r)}class hs{constructor(){this._protoValueType="ProtoValue"}add(e){return new x("add",[this,q(e)],"add")}asBoolean(){if(this instanceof gr)return this;if(this instanceof fs)return new gm(this);if(this instanceof ds)return new _9(this);if(this instanceof x)return new mm(this);throw new L("invalid-argument",`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(e){return new x("subtract",[this,q(e)],"subtract")}multiply(e){return new x("multiply",[this,q(e)],"multiply")}divide(e){return new x("divide",[this,q(e)],"divide")}mod(e){return new x("mod",[this,q(e)],"mod")}equal(e){return new x("equal",[this,q(e)],"equal").asBoolean()}notEqual(e){return new x("not_equal",[this,q(e)],"notEqual").asBoolean()}lessThan(e){return new x("less_than",[this,q(e)],"lessThan").asBoolean()}lessThanOrEqual(e){return new x("less_than_or_equal",[this,q(e)],"lessThanOrEqual").asBoolean()}greaterThan(e){return new x("greater_than",[this,q(e)],"greaterThan").asBoolean()}greaterThanOrEqual(e){return new x("greater_than_or_equal",[this,q(e)],"greaterThanOrEqual").asBoolean()}arrayConcat(e,...t){const n=[e,...t].map((s=>q(s)));return new x("array_concat",[this,...n],"arrayConcat")}arrayContains(e){return new x("array_contains",[this,q(e)],"arrayContains").asBoolean()}arrayContainsAll(e){const t=Array.isArray(e)?new to(e.map(q),"arrayContainsAll"):e;return new x("array_contains_all",[this,t],"arrayContainsAll").asBoolean()}arrayContainsAny(e){const t=Array.isArray(e)?new to(e.map(q),"arrayContainsAny"):e;return new x("array_contains_any",[this,t],"arrayContainsAny").asBoolean()}arrayReverse(){return new x("array_reverse",[this])}arrayLength(){return new x("array_length",[this],"arrayLength")}equalAny(e){const t=Array.isArray(e)?new to(e.map(q),"equalAny"):e;return new x("equal_any",[this,t],"equalAny").asBoolean()}notEqualAny(e){const t=Array.isArray(e)?new to(e.map(q),"notEqualAny"):e;return new x("not_equal_any",[this,t],"notEqualAny").asBoolean()}exists(){return new x("exists",[this],"exists").asBoolean()}charLength(){return new x("char_length",[this],"charLength")}like(e){return new x("like",[this,q(e)],"like").asBoolean()}regexContains(e){return new x("regex_contains",[this,q(e)],"regexContains").asBoolean()}regexFind(e){return new x("regex_find",[this,q(e)],"regexFind")}regexFindAll(e){return new x("regex_find_all",[this,q(e)],"regexFindAll")}regexMatch(e){return new x("regex_match",[this,q(e)],"regexMatch").asBoolean()}stringContains(e){return new x("string_contains",[this,q(e)],"stringContains").asBoolean()}startsWith(e){return new x("starts_with",[this,q(e)],"startsWith").asBoolean()}endsWith(e){return new x("ends_with",[this,q(e)],"endsWith").asBoolean()}toLower(){return new x("to_lower",[this],"toLower")}toUpper(){return new x("to_upper",[this],"toUpper")}trim(e){const t=[this];return e&&t.push(q(e)),new x("trim",t,"trim")}ltrim(e){const t=[this];return e&&t.push(q(e)),new x("ltrim",t,"ltrim")}rtrim(e){const t=[this];return e&&t.push(q(e)),new x("rtrim",t,"rtrim")}type(){return new x("type",[this])}isType(e){return new x("is_type",[this,Oo(e)],"isType").asBoolean()}stringConcat(e,...t){const n=[e,...t].map(q);return new x("string_concat",[this,...n],"stringConcat")}stringIndexOf(e){return new x("string_index_of",[this,q(e)],"stringIndexOf")}stringRepeat(e){return new x("string_repeat",[this,q(e)],"stringRepeat")}stringReplaceAll(e,t){return new x("string_replace_all",[this,q(e),q(t)],"stringReplaceAll")}stringReplaceOne(e,t){return new x("string_replace_one",[this,q(e),q(t)],"stringReplaceOne")}concat(e,...t){const n=[e,...t].map(q);return new x("concat",[this,...n],"concat")}reverse(){return new x("reverse",[this],"reverse")}arrayFilter(e,t){return new x("array_filter",[this,q(e),t],"arrayFilter")}arrayTransform(e,t){return new x("array_transform",[this,q(e),t],"arrayTransform")}arrayTransformWithIndex(e,t,n){return new x("array_transform",[this,q(e),q(t),n],"arrayTransformWithIndex")}arraySlice(e,t){const n=[this,q(e)];return t!==void 0&&n.push(q(t)),new x("array_slice",n,"arraySlice")}arrayFirst(){return new x("array_first",[this],"arrayFirst")}arrayFirstN(e){return new x("array_first_n",[this,q(e)],"arrayFirstN")}arrayLast(){return new x("array_last",[this],"arrayLast")}arrayLastN(e){return new x("array_last_n",[this,q(e)],"arrayLastN")}arrayMaximum(){return new x("maximum",[this],"arrayMaximum")}arrayMaximumN(e){return new x("maximum_n",[this,q(e)],"arrayMaximumN")}arrayMinimum(){return new x("minimum",[this],"arrayMinimum")}arrayMinimumN(e){return new x("minimum_n",[this,q(e)],"arrayMinimumN")}arrayIndexOf(e){return new x("array_index_of",[this,q(e),q("first")],"arrayIndexOf")}arrayLastIndexOf(e){return new x("array_index_of",[this,q(e),q("last")],"arrayLastIndexOf")}arrayIndexOfAll(e){return new x("array_index_of_all",[this,q(e)],"arrayIndexOfAll")}byteLength(){return new x("byte_length",[this],"byteLength")}ceil(){return new x("ceil",[this])}floor(){return new x("floor",[this])}abs(){return new x("abs",[this])}exp(){return new x("exp",[this])}mapGet(e){return new x("map_get",[this,Oo(e)],"mapGet")}mapSet(e,t,...n){const s=[this,q(e),q(t),...n.map(q)];return new x("map_set",s,"mapSet")}mapKeys(){return new x("map_keys",[this],"mapKeys")}mapValues(){return new x("map_values",[this],"mapValues")}mapEntries(){return new x("map_entries",[this],"mapEntries")}getField(e){return new x("get_field",[this,q(e)],"get_field")}count(){return Nt._create("count",[this],"count")}sum(){return Nt._create("sum",[this],"sum")}average(){return Nt._create("average",[this],"average")}minimum(){return Nt._create("minimum",[this],"minimum")}maximum(){return Nt._create("maximum",[this],"maximum")}first(){return Nt._create("first",[this],"first")}last(){return Nt._create("last",[this],"last")}arrayAgg(){return Nt._create("array_agg",[this],"arrayAgg")}arrayAggDistinct(){return Nt._create("array_agg_distinct",[this],"arrayAggDistinct")}countDistinct(){return Nt._create("count_distinct",[this],"countDistinct")}logicalMaximum(e,...t){const n=[e,...t];return new x("maximum",[this,...n.map(q)],"logicalMaximum")}logicalMinimum(e,...t){const n=[e,...t];return new x("minimum",[this,...n.map(q)],"minimum")}vectorLength(){return new x("vector_length",[this],"vectorLength")}
vendor: 11,027 bytes, line 31
31cosineDistance(e){return new x("cosine_distance",[this,Wu(e)],"cosineDistance")}dotProduct(e){return new x("dot_product",[this,Wu(e)],"dotProduct")}euclideanDistance(e){return new x("euclidean_distance",[this,Wu(e)],"euclideanDistance")}unixMicrosToTimestamp(){return new x("unix_micros_to_timestamp",[this],"unixMicrosToTimestamp")}timestampToUnixMicros(){return new x("timestamp_to_unix_micros",[this],"timestampToUnixMicros")}unixMillisToTimestamp(){return new x("unix_millis_to_timestamp",[this],"unixMillisToTimestamp")}timestampToUnixMillis(){return new x("timestamp_to_unix_millis",[this],"timestampToUnixMillis")}unixSecondsToTimestamp(){return new x("unix_seconds_to_timestamp",[this],"unixSecondsToTimestamp")}timestampToUnixSeconds(){return new x("timestamp_to_unix_seconds",[this],"timestampToUnixSeconds")}timestampAdd(e,t){return new x("timestamp_add",[this,q(e),q(t)],"timestampAdd")}timestampSubtract(e,t){return new x("timestamp_subtract",[this,q(e),q(t)],"timestampSubtract")}timestampDiff(e,t){return new x("timestamp_diff",[this,N1(e),q(t)],"timestampDiff")}timestampExtract(e,t){const n=[this,q(e)];return t&&n.push(q(t)),new x("timestamp_extract",n,"timestampExtract")}documentId(){return new x("document_id",[this],"documentId")}parent(){return new x("parent",[this],"parent")}substring(e,t){const n=q(e);return new x("substring",t===void 0?[this,n]:[this,n,q(t)],"substring")}arrayGet(e){return new x("array_get",[this,q(e)],"arrayGet")}isError(){return new x("is_error",[this],"isError").asBoolean()}ifError(e){const t=new x("if_error",[this,q(e)],"ifError");return e instanceof gr?t.asBoolean():t}isAbsent(){return new x("is_absent",[this],"isAbsent").asBoolean()}mapRemove(e){return new x("map_remove",[this,q(e)],"mapRemove")}mapMerge(e,...t){const n=q(e),s=t.map(q);return new x("map_merge",[this,n,...s],"mapMerge")}pow(e){return new x("pow",[this,q(e)])}trunc(e){return e===void 0?new x("trunc",[this]):new x("trunc",[this,q(e)],"trunc")}round(e){return e===void 0?new x("round",[this]):new x("round",[this,q(e)],"round")}collectionId(){return new x("collection_id",[this])}length(){return new x("length",[this])}ln(){return new x("ln",[this])}sqrt(){return new x("sqrt",[this])}stringReverse(){return new x("string_reverse",[this])}ifAbsent(e){return new x("if_absent",[this,q(e)],"ifAbsent")}ifNull(e){return new x("if_null",[this,q(e)],"ifNull")}coalesce(e,...t){return new x("coalesce",[this,q(e),...t.map(q)],"coalesce")}join(e){return new x("join",[this,q(e)],"join")}log10(){return new x("log10",[this])}arraySum(){return new x("sum",[this])}split(e){return new x("split",[this,q(e)])}timestampTruncate(e,t){const n=[this,q(e)];return t&&n.push(q(t)),new x("timestamp_trunc",n)}ascending(){return I9(this)}descending(){return w9(this)}as(e){return new m9(this,e,"as")}}class Nt{constructor(e,t){this.name=e,this.params=t,this.exprType="AggregateFunction",this._protoValueType="ProtoValue"}static _create(e,t,n){const s=new Nt(e,t);return s._methodName=n,s}as(e){return new p9(this,e,"as")}_toProto(e){return{functionValue:{name:this.name,args:this.params.map((t=>t._toProto(e)))}}}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach((t=>t._readUserData(e)))}}class p9{constructor(e,t,n){this.aggregate=e,this.alias=t,this._methodName=n}_readUserData(e){this.aggregate._readUserData(e)}}class m9{constructor(e,t,n){this.expr=e,this.alias=t,this._methodName=n,this.exprType="AliasedExpression",this.selectable=!0}_readUserData(e){this.expr._readUserData(e)}}class to extends hs{constructor(e,t){super(),this.Rr=e,this._methodName=t,this.expressionType="ListOfExpressions"}_toProto(e){return{arrayValue:{values:this.Rr.map((t=>t._toProto(e)))}}}_readUserData(e){this.Rr.forEach((t=>t._readUserData(e)))}}class ds extends hs{constructor(e,t){super(),this.fieldPath=e,this._methodName=t,this.expressionType="Field",this.selectable=!0}get _fieldPath(){return this.fieldPath}get fieldName(){return this.fieldPath.canonicalString()}get alias(){return this.fieldName}get expr(){return this}geoDistance(e){return new x("geo_distance",[this,q(e)],"geoDistance")}_toProto(e){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(e){}}function ja(r){return g9(r,"field")}function g9(r,e){return new ds(typeof r=="string"?en===r?Q6()._internalPath:Qt("field",r):r._internalPath,e)}class fs extends hs{constructor(e,t){super(),this.value=e,this._methodName=t,this.expressionType="Constant"}static _fromProto(e){const t=new fs(e,void 0);return t._protoValue=e,t}_toProto(e){return U(this._protoValue!==void 0,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,o9(this._protoValue)||(this._protoValue=ln(this.value,e))}}function Oo(r,e){return pm(r,"constant")}function pm(r,e){const t=new fs(r,e);return typeof r=="boolean"?new gm(t):t}class x extends hs{constructor(e,t,n,s){super(),this.name=e,this.params=t,this.expressionType="Function",this._optionsProto=void 0,n!==void 0&&(this._methodName=n),s!==void 0&&(this._options=s)}get _optionsUtil(){return new pt({})}_toProto(e){const t={functionValue:{name:this.name,args:this.params.map((n=>n._toProto(e)))}};return this._optionsProto&&(t.functionValue.options=this._optionsProto),t}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach((t=>t._readUserData(e))),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(e,this._options))}}class gr extends hs{get _methodName(){return this._expr._methodName}countIf(){return Nt._create("count_if",[this],"countIf")}not(){return new x("not",[this],"not").asBoolean()}conditional(e,t){return new x("conditional",[this,e,t],"conditional")}ifError(e){const t=q(e),n=new x("if_error",[this,t],"ifError");return t instanceof gr?n.asBoolean():n}_toProto(e){return this._expr._toProto(e)}_readUserData(e){this._expr._readUserData(e)}}class mm extends gr{constructor(e){super(),this._expr=e,this.expressionType="Function"}}class gm extends gr{constructor(e){super(),this._expr=e,this.expressionType="Constant"}_getValue(){return this._expr._getValue()}}class _9 extends gr{constructor(e){super(),this._expr=e,this.expressionType="Field"}}function y9(r,e){const t=[];for(const n in r)if(Object.prototype.hasOwnProperty.call(r,n)){const s=r[n];t.push(Oo(n)),t.push(q(s))}return new x("map",t,"map")}function E9(r){return(function(t,n){return new x("array",t.map((s=>q(s))),n)})(r,"array")}function I9(r){return new V1(N1(r),"ascending","ascending")}function w9(r){return new V1(N1(r),"descending","descending")}class V1{constructor(e,t,n){this.expr=e,this.direction=t,this._methodName=n,this._protoValueType="ProtoValue"}_toProto(e){return{mapValue:{fields:{direction:K6(this.direction),expression:this.expr._toProto(e)}}}}_readUserData(e){this.expr._readUserData(e)}}class kt{constructor(e){this.optionsProto=void 0,{rawOptions:this.rawOptions,...this.knownOptions}=e}_readUserData(e){this.optionsProto=this._optionsUtil.getOptionsProto(e,this.knownOptions,this.rawOptions)}_toProto(e){return{name:this._name,options:this.optionsProto}}}class _m extends kt{get _name(){return"add_fields"}get _optionsUtil(){return new pt({})}constructor(e,t){super(t),this.fields=e}_toProto(e){return{...super._toProto(e),args:[Vo(e,this.fields)]}}_readUserData(e){super._readUserData(e),yr(this.fields,e)}}class ym extends kt{get _name(){return"aggregate"}get _optionsUtil(){return new pt({})}constructor(e,t,n){super(n),this.groups=e,this.accumulators=t}_toProto(e){return{...super._toProto(e),args:[Vo(e,this.accumulators),Vo(e,this.groups)]}}_readUserData(e){super._readUserData(e),yr(this.groups,e),yr(this.accumulators,e)}}class Em extends kt{get _name(){return"distinct"}get _optionsUtil(){return new pt({})}constructor(e,t){super(t),this.groups=e}_toProto(e){return{...super._toProto(e),args:[Vo(e,this.groups)]}}_readUserData(e){super._readUserData(e),yr(this.groups,e)}}class Yo extends kt{get _name(){return"collection"}get _optionsUtil(){return new pt({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.Vr=e.startsWith("/")?e:"/"+e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:this.Vr}]}}_readUserData(e){super._readUserData(e)}}class Jo extends kt{get _name(){return"collection_group"}get _optionsUtil(){return new pt({forceIndex:{serverName:"force_index"}})}constructor(e,t){super(t),this.collectionId=e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:""},{stringValue:this.collectionId}]}}_readUserData(e){super._readUserData(e)}}class jc extends kt{get _name(){return"database"}get _optionsUtil(){return new pt({})}_toProto(e){return{...super._toProto(e)}}_readUserData(e){super._readUserData(e)}}class zc extends kt{get _name(){return"documents"}get _optionsUtil(){return new pt({})}constructor(e,t){if(super(t),!e||e.length===0)throw new L(N.INVALID_ARGUMENT,"Empty document paths are not allowed in DocumentsSource");const n=e.map((i=>i.startsWith("/")?i:"/"+i)),s=new Set(n);if(s.size!==n.length)throw new L(N.INVALID_ARGUMENT,"Duplicate document paths are not allowed in DocumentsSource");this.dr=n,this.mr=s}_toProto(e){return{...super._toProto(e),args:this.dr.map((t=>({referenceValue:t})))}}_readUserData(e){super._readUserData(e)}}class Xo extends kt{get _name(){return"where"}get _optionsUtil(){return new pt({})}constructor(e,t){super(t),this.condition=e}_toProto(e){return{...super._toProto(e),args:[this.condition._toProto(e)]}}_readUserData(e){super._readUserData(e),yr(this.condition,e)}}class _r extends kt{get _name(){return"limit"}get _optionsUtil(){return new pt({})}constructor(e,t){U(!isNaN(e)&&e!==1/0&&e!==-1/0,34860),super(t),this.limit=e}_toProto(e){return{...super._toProto(e),args:[hi(e,this.limit)]}}}class Yf extends kt{get _name(){return"offset"}get _optionsUtil(){return new pt({})}constructor(e,t){super(t),this.offset=e}_toProto(e){return{...super._toProto(e),args:[hi(e,this.offset)]}}}class T9 extends kt{get _name(){return"select"}get _optionsUtil(){return new pt({})}constructor(e,t){super(t),this.selections=e}_toProto(e){return{...super._toProto(e),args:[Vo(e,this.selections)]}}_readUserData(e){super._readUserData(e),yr(this.selections,e)}}class rn extends kt{get _name(){return"sort"}get _optionsUtil(){return new pt({})}constructor(e,t){super(t),this.orderings=e}_toProto(e){return{...super._toProto(e),args:this.orderings.map((t=>t._toProto(e)))}}_readUserData(e){super._readUserData(e),yr(this.orderings,e)}}class O1 extends kt{get _name(){return"replace_with"}get _optionsUtil(){return new pt({})}constructor(e,t){super(t),this.map=e}_toProto(e){return{...super._toProto(e),args:[this.map._toProto(e),K6(O1.pr)]}}_readUserData(e){super._readUserData(e),yr(this.map,e)}}O1.pr="full_replace";function yr(r,e){return dm(r)?r._readUserData(e):Array.isArray(r)?r.forEach((t=>t._readUserData(e))):r instanceof Map?r.forEach((t=>t._readUserData(e))):Object.values(r).forEach((t=>t._readUserData(e))),r}
31class lt{constructor(e,t,n){this.serializer=e,this.stages=t,this.listenOptions=n,this.isCorePipeline=!0}getPipelineCollection(){return Zo(this)}getPipelineCollectionGroup(){return D1(this)}getPipelineCollectionId(){return Im(this)}getPipelineDocuments(){return lc(this)}getPipelineFlavor(){return(function(t){let n="exact";return t.stages.forEach(((s,i)=>{s._name!==Em.name&&s._name!==ym.name||(n="keyless"),s._name===T9.name&&n==="exact"&&(n="augmented"),s._name===_m.name&&i<t.stages.length-1&&n==="exact"&&(n="augmented")})),n})(this)}getPipelineSourceType(){return Rn(this)}}function Rn(r){const e=r.stages[0];return e instanceof Yo||e instanceof Jo||e instanceof jc||e instanceof zc?e._name:"unknown"}function Zo(r){if(Rn(r)==="collection")return r.stages[0].Vr}function D1(r){if(Rn(r)==="collection_group")return r.stages[0].collectionId}function Im(r){switch(Rn(r)){case"collection":return re.fromString(Zo(r)).lastSegment();case"collection_group":return D1(r);default:return}}function lc(r){if(Rn(r)==="documents")return r.stages[0].dr}class mo{constructor(e,t,n,s){this._db=e,this.userDataReader=t,this._userDataWriter=n,this.stages=s}wr(e,t){const n=this.userDataReader.createContext(3,e);return dm(t)?t._readUserData(n):Array.isArray(t)?t.forEach((s=>s._readUserData(n))):t.forEach((s=>s._readUserData(n))),t}where(e){const t=this.stages.map((n=>n));return this.wr("where",e),t.push(new Xo(e,{})),new mo(this._db,this.userDataReader,this._userDataWriter,t)}limit(e){const t=this.stages.map((n=>n));return t.push(new _r(e,{})),new mo(this._db,this.userDataReader,this._userDataWriter,t)}sort(e,...t){const n=this.stages.map((s=>s));return"orderings"in e?n.push(new rn(this.wr("sort",e.orderings),{})):n.push(new rn(this.wr("sort",[e,...t]),{})),new mo(this._db,this.userDataReader,this._userDataWriter,n)}br(e){return{pipeline:{stages:this.stages.map((t=>t._toProto(e)))}}}}class A{constructor(e,t){this.type=e,this.value=t}static vr(){return new A("ERROR",void 0)}static Sr(){return new A("UNSET",void 0)}static Dr(){return new A("NULL",cn)}static newValue(e){return Ot(e)?new A("NULL",cn):(function(n){return!!n&&"booleanValue"in n})(e)?new A("BOOLEAN",e):nn(e)?new A("INT",e):jr(e)?new A("DOUBLE",e):(function(n){return!!n&&"timestampValue"in n&&!!n.timestampValue})(e)?new A("TIMESTAMP",e):(function(n){return!!n&&"stringValue"in n})(e)?new A("STRING",e):(function(n){return!!n&&"bytesValue"in n})(e)?new A("BYTES",e):e.referenceValue?new A("REFERENCE",e):e.geoPointValue?new A("GEO_POINT",e):pr(e)?new A("ARRAY",e):Xr(e)?new A("VECTOR",e):Kr(e)?new A("MAP",e):new A("ERROR",void 0)}Cr(){return this.type==="ERROR"||this.type==="UNSET"}Fr(){return this.type==="NULL"}}function go(r){if(!r.Cr())return r.value}function wm(r){return r instanceof gr?r._expr:r}function X(r){if((r=wm(r))instanceof ds)return new A9(r);if(r instanceof fs)return new R9(r);if(r instanceof to)return new v9(r);if(r instanceof x){if(r.name==="add")return new C9(r);if(r.name==="subtract")return new b9(r);if(r.name==="multiply")return new N9(r);if(r.name==="divide")return new V9(r);if(r.name==="mod")return new O9(r);if(r.name==="and")return new D9(r);if(r.name==="equal")return new z9(r);if(r.name==="not_equal")return new H9(r);if(r.name==="less_than")return new W9(r);if(r.name==="less_than_or_equal")return new K9(r);if(r.name==="greater_than")return new Q9(r);if(r.name==="greater_than_or_equal")return new Y9(r);if(r.name==="array_concat")return new J9(r);if(r.name==="array_reverse")return new X9(r);if(r.name==="array_contains")return new Z9(r);if(r.name==="array_contains_all")return new e8(r);if(r.name==="array_contains_any")return new t8(r);if(r.name==="array_length")return new n8(r);if(r.name==="array_element")return new r8(r);if(r.name==="equal_any")return new Tm(r);if(r.name==="not_equal_any")return new x9(r);if(r.name==="is_nan")return new L9(r);if(r.name==="is_not_nan")return new M9(r);if(r.name==="is_null")return new F9(r);if(r.name==="is_not_null")return new U9(r);
vendor: 47,019 bytes, lines 31-34
31if(r.name==="is_error")return new B9(r);if(r.name==="exists")return new q9(r);if(r.name==="not")return new Hc(r);if(r.name==="or")return new k9(r);if(r.name==="xor")return new k1(r);if(r.name==="conditional")return new G9(r);if(r.name==="maximum")return new $9(r);if(r.name==="minimum")return new j9(r);if(r.name==="reverse")return new s8(r);if(r.name==="replace_first")return new i8(r);if(r.name==="replace_all")return new o8(r);if(r.name==="char_length")return new a8(r);if(r.name==="byte_length")return new c8(r);if(r.name==="like")return new u8(r);if(r.name==="regex_contains")return new l8(r);if(r.name==="regex_match")return new h8(r);if(r.name==="string_contains")return new d8(r);if(r.name==="starts_with")return new f8(r);if(r.name==="ends_with")return new p8(r);if(r.name==="to_lower")return new m8(r);if(r.name==="to_upper")return new g8(r);if(r.name==="trim")return new _8(r);if(r.name==="string_concat")return new y8(r);if(r.name==="map_get")return new E8(r);if(r.name==="cosine_distance")return new I8(r);if(r.name==="dot_product")return new w8(r);if(r.name==="euclidean_distance")return new T8(r);if(r.name==="vector_length")return new A8(r);if(r.name==="unix_micros_to_timestamp")return new C8(r);if(r.name==="timestamp_to_unix_micros")return new V8(r);if(r.name==="unix_millis_to_timestamp")return new b8(r);if(r.name==="timestamp_to_unix_millis")return new O8(r);if(r.name==="unix_seconds_to_timestamp")return new N8(r);if(r.name==="timestamp_to_unix_seconds")return new D8(r);if(r.name==="timestamp_add")return new k8(r);if(r.name==="timestamp_subtract")return new x8(r)}throw new Error(`Unknown Expr : ${r}`)}class A9{constructor(e){this.expr=e}evaluate(e,t){if(this.expr.fieldName===en)return A.newValue({referenceValue:Xs(e.serializer,t.key)});if(this.expr.fieldName==="__update_time__")return A.newValue({timestampValue:$a(e.serializer,t.version)});if(this.expr.fieldName==="__create_time__")return A.newValue({timestampValue:$a(e.serializer,t.createTime)});const n=t.data.field(this.expr._fieldPath);return n?zo(n)?A.newValue((function(i,o){if(i.serverTimestampBehavior==="estimate")return{timestampValue:$a(i.serializer,K.fromTimestamp(zs(o)))};if(i.serverTimestampBehavior==="previous"){const a=Ho(o);if(a)return a}return{nullValue:"NULL_VALUE"}})(e,n)):A.newValue(n):A.Sr()}}class R9{constructor(e){this.expr=e}evaluate(e,t){return A.newValue(this.expr._getValue())}}class v9{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.Rr.map((s=>X(s).evaluate(e,t)));return n.some((s=>s.Cr()))?A.vr():A.newValue({arrayValue:{values:n.map((s=>s.value))}})}}function it(r){return jr(r)?Number(r.doubleValue):Number(r.integerValue)}function hn(r){return BigInt(r.integerValue)}const S9=BigInt("0x7fffffffffffffff"),P9=-BigInt("0x8000000000000000");class ea{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length>=2,24778);const n=X(this.expr.params[0]).evaluate(e,t),s=X(this.expr.params[1]).evaluate(e,t);let i=this.Or(n,s);for(const o of this.expr.params.slice(2)){const a=X(o).evaluate(e,t);i=this.Or(i,a)}return i}Or(e,t){if(e.Cr()||t.Cr())return A.vr();if(e.Fr()||t.Fr())return A.Dr();const n=e.value,s=t.value;if(!jr(n)&&!nn(n)||!jr(s)&&!nn(s))return A.vr();if(jr(n)||jr(s)){const i=this.Mr(n,s);return i?A.newValue(i):A.vr()}if(nn(n)&&nn(s)){const i=this.Nr(n,s);return i===void 0?A.vr():typeof i=="number"?A.newValue({doubleValue:i}):i<P9||i>S9?A.vr():A.newValue({integerValue:`${i}`})}return A.vr()}}function Nn(r,e){return $e(r)!==$e(e)?"TYPE_MISMATCH":Ct(r)||Ct(e)?"NOT_EQ":Ot(r)&&Ot(e)?"EQ":Ot(r)||Ot(e)?"NULL":pr(r)&&pr(e)?(function(n,s){if(n.values?.length!==s.values?.length)return"NOT_EQ";let i=!1;for(let o=0;o<(n.values?.length??0);o++){const a=n.values[o],u=s.values[o];switch(Nn(a,u)){case"EQ":break;case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":i=!0;break;default:H(44609,{Lr:a,Br:u})}}return i?"NULL":"EQ"})(r.arrayValue,e.arrayValue):Xr(r)&&Xr(e)||Kr(r)&&Kr(e)?(function(n,s){const i=n.fields||{},o=s.fields||{};if(sc(i)!==sc(o))return"NOT_EQ";let a=!1;for(const u in i)if(i.hasOwnProperty(u)){if(o[u]===void 0)return"NOT_EQ";switch(Nn(i[u],o[u])){case"NOT_EQ":case"TYPE_MISMATCH":return"NOT_EQ";case"NULL":a=!0}}return a?"NULL":"EQ"})(r.mapValue,e.mapValue):(function(n,s){return qt(n,s,{Te:!1,Ee:!0,he:!0})})(r,e)?"EQ":"NOT_EQ"}class C9 extends ea{Nr(e,t){return hn(e)+hn(t)}Mr(e,t){return{doubleValue:it(e)+it(t)}}}class b9 extends ea{constructor(e){super(e),this.expr=e}Nr(e,t){return hn(e)-hn(t)}Mr(e,t){return{doubleValue:it(e)-it(t)}}}class N9 extends ea{constructor(e){super(e),this.expr=e}Nr(e,t){return hn(e)*hn(t)}Mr(e,t){return{doubleValue:it(e)*it(t)}}}class V9 extends ea{constructor(e){super(e),this.expr=e}Nr(e,t){const n=hn(t);if(n!==BigInt(0))return hn(e)/n}Mr(e,t){const n=it(t);return n===0?{doubleValue:Bs(n)?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY}:{doubleValue:it(e)/n}}}class O9 extends ea{constructor(e){super(e),this.expr=e}Nr(e,t){const n=hn(t);if(n!==BigInt(0))return hn(e)%n}Mr(e,t){const n=it(t);if(n!==0)return{doubleValue:it(e)%n}}}class D9{constructor(e){this.expr=e}evaluate(e,t){let n=!1,s=!1;for(const i of this.expr.params){const o=X(i).evaluate(e,t);switch(o.type){case"BOOLEAN":if(!o.value?.booleanValue)return A.newValue(tt);break;case"NULL":s=!0;break;default:n=!0}}return n?A.vr():s?A.Dr():A.newValue(Pt)}}class Hc{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,9634);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BOOLEAN":return A.newValue({booleanValue:!n.value?.booleanValue});case"NULL":return A.Dr();default:return A.vr()}}}class k9{constructor(e){this.expr=e}evaluate(e,t){let n=!1,s=!1;for(const i of this.expr.params){const o=X(i).evaluate(e,t);switch(o.type){case"BOOLEAN":if(o.value?.booleanValue)return A.newValue(Pt);break;case"NULL":s=!0;break;default:n=!0}}return n?A.vr():s?A.Dr():A.newValue(tt)}}class k1{constructor(e){this.expr=e}evaluate(e,t){let n=!1,s=!1;for(const i of this.expr.params){const o=X(i).evaluate(e,t);switch(o.type){case"BOOLEAN":n=k1.xor(n,!!o.value?.booleanValue);break;case"NULL":s=!0;break;default:return A.vr()}}return s?A.Dr():A.newValue({booleanValue:n})}static xor(e,t){return(e||t)&&!(e&&t)}}class Tm{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===2,55094);let n=!1;const s=X(this.expr.params[0]).evaluate(e,t);switch(s.type){case"NULL":n=!0;break;case"ERROR":case"UNSET":return A.vr()}const i=X(this.expr.params[1]).evaluate(e,t);switch(i.type){case"ARRAY":break;case"NULL":n=!0;break;default:return A.vr()}if(n)return A.Dr();for(const o of i.value?.arrayValue?.values??[])switch(Ot(s.value)&&Ot(o)?"EQ":Nn(s.value,o)){case"EQ":return A.newValue(Pt);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:H(44608,{value:s.value,candidate:o})}return n?A.Dr():A.newValue(tt)}}class x9{constructor(e){this.expr=e}evaluate(e,t){return new Hc(new x("not",[new x("equal_any",this.expr.params)])).evaluate(e,t)}}class L9{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,23322);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"INT":return A.newValue(tt);case"DOUBLE":return A.newValue({booleanValue:isNaN(it(n.value))});case"NULL":return A.Dr();default:return A.vr()}}}class M9{constructor(e){this.expr=e}evaluate(e,t){return U(this.expr.params.length===1,50406),new Hc(new x("not",[new x("is_nan",this.expr.params)])).evaluate(e,t)}}class F9{constructor(e){this.expr=e}evaluate(e,t){switch(U(this.expr.params.length===1,23123),X(this.expr.params[0]).evaluate(e,t).type){case"NULL":return A.newValue(Pt);case"UNSET":case"ERROR":return A.vr();default:return A.newValue(tt)}}}class U9{constructor(e){this.expr=e}evaluate(e,t){return U(this.expr.params.length===1,23167),new Hc(new x("not",[new x("is_null",this.expr.params)])).evaluate(e,t)}}class B9{constructor(e){this.expr=e}evaluate(e,t){return U(this.expr.params.length===1,5228),X(this.expr.params[0]).evaluate(e,t).type==="ERROR"?A.newValue(Pt):A.newValue(tt)}}class q9{constructor(e){this.expr=e}evaluate(e,t){switch(U(this.expr.params.length===1,6877),X(this.expr.params[0]).evaluate(e,t).type){case"ERROR":return A.vr();case"UNSET":return A.newValue(tt);default:return A.newValue(Pt)}}}class G9{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===3,11706);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BOOLEAN":return n.value?.booleanValue?X(this.expr.params[1]).evaluate(e,t):X(this.expr.params[2]).evaluate(e,t);case"NULL":return X(this.expr.params[2]).evaluate(e,t);default:return A.vr()}}}class $9{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map((i=>X(i).evaluate(e,t)));let s;for(const i of n)switch(i.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=s===void 0||ft(i.value,s.value)>0?i:s}return s===void 0?A.Dr():s}}class j9{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map((i=>X(i).evaluate(e,t)));let s;for(const i of n)switch(i.type){case"ERROR":case"UNSET":case"NULL":continue;default:s=s===void 0||ft(i.value,s.value)<0?i:s}return s===void 0?A.Dr():s}}class gi{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===2,31033,`${this.expr.name}() function should have exactly 2 params`);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"ERROR":case"UNSET":return A.vr()}const s=X(this.expr.params[1]).evaluate(e,t);switch(s.type){case"ERROR":case"UNSET":return A.vr()}return this.Ur(n,s)}}class z9 extends gi{constructor(e){super(e),this.expr=e}Ur(e,t){if(e.Fr()&&t.Fr())return A.newValue(Pt);if(e.Fr()||t.Fr()||Ct(e.value)||Ct(t.value)||$e(e.value)!==$e(t.value))return A.newValue(tt);switch(Nn(e.value,t.value)){case"EQ":return A.newValue(Pt);case"NOT_EQ":return A.newValue(tt);case"NULL":return A.Dr();default:H(44615,{left:e,right:t})}}}class H9 extends gi{constructor(e){super(e),this.expr=e}Ur(e,t){switch(Nn(e.value,t.value)){case"EQ":return A.newValue(tt);case"NOT_EQ":case"TYPE_MISMATCH":return A.newValue(Pt);case"NULL":return A.Dr();default:H(44614,{left:e,right:t})}}}class W9 extends gi{constructor(e){super(e),this.expr=e}Ur(e,t){return $e(e.value)!==$e(t.value)||Ct(e.value)||Ct(t.value)?A.newValue(tt):A.newValue({booleanValue:ft(e.value,t.value)<0})}}class K9 extends gi{constructor(e){super(e),this.expr=e}Ur(e,t){return $e(e.value)!==$e(t.value)||Ct(e.value)||Ct(t.value)?A.newValue(tt):Nn(e.value,t.value)==="EQ"?A.newValue(Pt):A.newValue({booleanValue:ft(e.value,t.value)<0})}}class Q9 extends gi{constructor(e){super(e),this.expr=e}Ur(e,t){return $e(e.value)!==$e(t.value)||Ct(e.value)||Ct(t.value)?A.newValue(tt):A.newValue({booleanValue:ft(e.value,t.value)>0})}}class Y9 extends gi{constructor(e){super(e),this.expr=e}Ur(e,t){return $e(e.value)!==$e(t.value)||Ct(e.value)||Ct(t.value)?A.newValue(tt):Nn(e.value,t.value)==="EQ"?A.newValue(Pt):A.newValue({booleanValue:ft(e.value,t.value)>0})}}class J9{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class X9{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,216);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return A.Dr();case"ARRAY":{const s=n.value.arrayValue?.values??[];return A.newValue({arrayValue:{values:[...s].reverse()}})}default:return A.vr()}}}class Z9{constructor(e){this.expr=e}evaluate(e,t){return U(this.expr.params.length===2,52884),new Tm(new x("eq_any",[this.expr.params[1],this.expr.params[0]])).evaluate(e,t)}}class e8{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===2,1392);let n=!1;const s=X(this.expr.params[0]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return A.vr()}const i=X(this.expr.params[1]).evaluate(e,t);switch(i.type){case"ARRAY":break;case"NULL":n=!0;break;default:return A.vr()}if(n)return A.Dr();const o=i.value?.arrayValue?.values??[],a=s.value?.arrayValue?.values??[];for(const u of o){let l=!1;n=!1;for(const d of a){switch(Ot(u)&&Ot(d)?"EQ":Nn(u,d)){case"EQ":l=!0;break;case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:H(44613,{value:d,search:u})}if(l)break}if(!l)return A.newValue(tt)}return A.newValue(Pt)}}class t8{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===2,2680);let n=!1;const s=X(this.expr.params[0]).evaluate(e,t);switch(s.type){case"ARRAY":break;case"NULL":n=!0;break;default:return A.vr()}const i=X(this.expr.params[1]).evaluate(e,t);switch(i.type){case"ARRAY":break;case"NULL":n=!0;break;default:return A.vr()}if(n)return A.Dr();const o=i.value?.arrayValue?.values??[],a=s.value?.arrayValue?.values??[];for(const u of a)for(const l of o)switch(Ot(u)&&Ot(l)?"EQ":Nn(u,l)){case"EQ":return A.newValue(Pt);case"NOT_EQ":case"TYPE_MISMATCH":break;case"NULL":n=!0;break;default:H(44608,{value:u,search:l})}return n?A.Dr():A.newValue(tt)}}class n8{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,38605);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return A.Dr();case"ARRAY":return A.newValue({integerValue:`${n.value?.arrayValue?.values?.length??0}`});default:return A.vr()}}}class r8{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class s8{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,1508);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return A.Dr();case"BYTES":{const s=n.value?.bytesValue;if(typeof s=="string"){const i=Se.fromBase64String(s).toUint8Array();return i.reverse(),A.newValue({bytesValue:Se.fromUint8Array(i).toBase64()})}return A.newValue({bytesValue:new Uint8Array(s).reverse()})}case"STRING":{const s=n.value?.stringValue,i=new Intl.__PRIVATE_Segmenter(void 0,{granularity:"grapheme"}).segment(s),o=Array.from(i,(a=>a.segment)).reverse();return A.newValue({stringValue:o.join("")})}default:return A.vr()}}}class i8{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class o8{constructor(e){this.expr=e}evaluate(e,t){throw new Error("Unimplemented")}}class a8{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,19400);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"NULL":return A.Dr();case"STRING":{const s=(function(o){let a=0;for(let u=0;u<o.length;u++){const l=o.codePointAt(u);if(l===void 0)return;if(l<=65535)if(l>=55296&&l<=57343)if(l<=56319){const d=o.codePointAt(u+1);d!==void 0&&d>=56320&&d<=57343?(a+=1,u++):a+=1}else a+=1;else a+=1;else{if(!(l<=1114111))return;a+=1,u++}}return a})(n.value.stringValue);return s===void 0?A.vr():A.newValue({integerValue:s})}default:return A.vr()}}}class c8{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,8486);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"BYTES":{const s=n.value?.bytesValue;return typeof s=="string"?A.newValue({integerValue:Se.fromBase64String(s).toUint8Array().length}):A.newValue({integerValue:new Uint8Array(s).length})}case"STRING":{const s=(function(o){let a=0;for(let u=0;u<o.length;u++){const l=o.codePointAt(u);if(l===void 0)return;if(l>=55296&&l<=57343){if(!(l<=56319))return;{const d=o.codePointAt(u+1);if(d===void 0||!(d>=56320&&d<=57343))return;a+=4,u++}}else if(l<=127)a+=1;else if(l<=2047)a+=2;else if(l<=65535)a+=3;else{if(!(l<=1114111))return;a+=4,u++}}return a})(n.value?.stringValue);return s===void 0?A.vr():A.newValue({integerValue:s})}case"NULL":return A.Dr();default:return A.vr()}}}class _i{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===2,39773,`${this.expr.name}() function should have exactly two parameters`);let n=!1;const s=X(this.expr.params[0]).evaluate(e,t);switch(s.type){case"STRING":break;case"NULL":n=!0;break;default:return A.vr()}const i=X(this.expr.params[1]).evaluate(e,t);switch(i.type){case"STRING":break;case"NULL":n=!0;break;default:return A.vr()}return n?A.Dr():this.kr(s.value?.stringValue,i.value?.stringValue)}}class u8 extends _i{kr(e,t){try{const n=(function(o){let a="";for(let u=0;u<o.length;u++){const l=o.charAt(u);switch(l){case"_":a+=".";break;case"%":a+=".*";break;case"\\":case".":case"*":case"?":case"+":case"^":case"$":case"|":case"(":case")":case"[":case"]":case"{":case"}":a+="\\"+l;break;default:a+=l}}return"^"+a+"$"})(t),s=xt.compile(n);return A.newValue({booleanValue:s.matches(e)})}catch(n){return We(`Invalid LIKE pattern converted to regex: ${t}, returning error. Error: ${n}`),A.vr()}}}class l8 extends _i{kr(e,t){try{const n=xt.compile(t);return A.newValue({booleanValue:n.matcher(e).find()})}catch{return We(`Invalid regex pattern found in regex_contains: ${t}, returning error`),A.vr()}}}class h8 extends _i{kr(e,t){try{return A.newValue({booleanValue:xt.compile(t).matches(e)})}catch{return We(`Invalid regex pattern found in regex_match: ${t}, returning error`),A.vr()}}}class d8 extends _i{kr(e,t){return A.newValue({booleanValue:e.includes(t)})}}class f8 extends _i{kr(e,t){return A.newValue({booleanValue:e.startsWith(t)})}}class p8 extends _i{kr(e,t){return A.newValue({booleanValue:e.endsWith(t)})}}class m8{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,29079);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return A.newValue({stringValue:n.value?.stringValue?.toLowerCase()});case"NULL":return A.Dr();default:return A.vr()}}}class g8{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,60487);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return A.newValue({stringValue:n.value?.stringValue?.toUpperCase()});case"NULL":return A.Dr();default:return A.vr()}}}class _8{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,28544);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"STRING":return A.newValue({stringValue:n.value?.stringValue?.trim()});case"NULL":return A.Dr();default:return A.vr()}}}class y8{constructor(e){this.expr=e}evaluate(e,t){const n=this.expr.params.map((o=>X(o).evaluate(e,t)));let s="",i=!1;for(const o of n)switch(o.type){case"STRING":s+=o.value.stringValue;break;case"NULL":i=!0;break;default:return A.vr()}return i?A.Dr():A.newValue({stringValue:s})}}class E8{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===2,4483);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"UNSET":return A.Sr();case"MAP":break;default:return A.vr()}const s=X(this.expr.params[1]).evaluate(e,t);if(s.type!=="STRING")return A.vr();const i=n.value?.mapValue?.fields?.[s.value?.stringValue];return i===void 0?A.Sr():A.newValue(i)}}class x1{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===2,25231,`${this.expr.name}() function should have exactly 2 params`);let n=!1;const s=X(this.expr.params[0]).evaluate(e,t);switch(s.type){case"VECTOR":break;case"NULL":n=!0;break;default:return A.vr()}const i=X(this.expr.params[1]).evaluate(e,t);switch(i.type){case"VECTOR":break;case"NULL":n=!0;break;default:return A.vr()}if(n)return A.Dr();const o=yl(s.value),a=yl(i.value);if(o===void 0||a===void 0||o.values?.length!==a.values?.length)return A.vr();const u=this.qr(o,a);return u===void 0||isNaN(u)?A.vr():A.newValue({doubleValue:u})}}class I8 extends x1{qr(e,t){const n=e?.values??[],s=t?.values??[];if(n.length===0)return;let i=0,o=0,a=0;for(let l=0;l<n.length;l++){if(!fr(n[l])||!fr(s[l]))return;const d=it(n[l]),p=it(s[l]);i+=d*p,o+=d*d,a+=p*p}const u=Math.sqrt(o)*Math.sqrt(a);if(u!==0)return 1-Math.max(-1,Math.min(1,i/u))}}class w8 extends x1{qr(e,t){const n=e?.values??[],s=t?.values??[];if(n.length===0)return 0;let i=0;for(let o=0;o<n.length;o++){if(!fr(n[o])||!fr(s[o]))return;i+=it(n[o])*it(s[o])}return i}}class T8 extends x1{qr(e,t){const n=e?.values??[],s=t?.values??[];if(n.length===0)return 0;let i=0;for(let o=0;o<n.length;o++){if(!fr(n[o])||!fr(s[o]))return;const a=it(n[o]),u=it(s[o]);i+=Math.pow(a-u,2)}return Math.sqrt(i)}}class A8{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,39044);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"VECTOR":{const s=yl(n.value);return A.newValue({integerValue:s?.values?.length??0})}case"NULL":return A.Dr();default:return A.vr()}}}const Do=BigInt(-62135596800),ko=BigInt(253402300799),hc=BigInt(1e3),ar=BigInt(1e6),R8=Do*hc,v8=ko*hc+BigInt(999),S8=Do*ar,P8=ko*ar+BigInt(999999);function L1(r){return r>=S8&&r<=P8}function Am(r){return r>=Do&&r<=ko}function xo(r,e){const t=BigInt(r);return!(t<Do||t>ko)&&!(e<0||e>=1e9)&&(t!==Do||e===0)&&!(t===ko&&e>999999999)}function Rm(r,e){return e<0?{seconds:r-1,nanos:e+1e9}:{seconds:r,nanos:e}}function M1(r){return BigInt(r.seconds)*ar+BigInt(Math.trunc(r.nanoseconds/1e3))}class F1{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,49262,`${this.expr.name}() function should have exactly one parameter`);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"INT":return this.toTimestamp(BigInt(n.value.integerValue));case"NULL":return A.Dr();default:return A.vr()}}}class C8 extends F1{toTimestamp(e){if(!L1(e))return A.vr();let t=Number(e/ar),n=Number(e%ar*BigInt(1e3));const s=Rm(t,n);return t=s.seconds,n=s.nanos,xo(t,n)?A.newValue({timestampValue:{seconds:t,nanos:n}}):A.vr()}}class b8 extends F1{toTimestamp(e){if(!(function(o){return o>=R8&&o<=v8})(e))return A.vr();let t=Number(e/hc),n=Number(e%hc*BigInt(1e6));const s=Rm(t,n);return t=s.seconds,n=s.nanos,xo(t,n)?A.newValue({timestampValue:{seconds:t,nanos:n}}):A.vr()}}class N8 extends F1{toTimestamp(e){if(!Am(e))return A.vr();const t=Number(e);return A.newValue({timestampValue:{seconds:t,nanos:0}})}}class U1{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===1,1265,`${this.expr.name}() function should have exactly one parameter`);const n=X(this.expr.params[0]).evaluate(e,t);switch(n.type){case"TIMESTAMP":break;case"NULL":return A.Dr();default:return A.vr()}const s=g1(n.value.timestampValue);return xo(s.seconds,s.nanoseconds)?this.$r(s):A.vr()}}class V8 extends U1{$r(e){const t=M1(e);return L1(t)?A.newValue({integerValue:`${t.toString()}`}):A.vr()}}class O8 extends U1{$r(e){const t=M1(e),n=t/BigInt(1e3),s=t%BigInt(1e3);return n>BigInt(0)||s===BigInt(0)?A.newValue({integerValue:n.toString()}):A.newValue({integerValue:(n-BigInt(1)).toString()})}}class D8 extends U1{$r(e){const t=BigInt(e.seconds);return Am(t)?A.newValue({integerValue:t.toString()}):A.vr()}}class vm{constructor(e){this.expr=e}evaluate(e,t){U(this.expr.params.length===3,2775,`${this.expr.name}() function should have exactly 3 parameters`);let n=!1;const s=X(this.expr.params[0]).evaluate(e,t);switch(s.type){case"TIMESTAMP":break;case"NULL":n=!0;break;default:return A.vr()}const i=X(this.expr.params[1]).evaluate(e,t);let o;switch(i.type){case"STRING":if(o=(function(J){switch(J){case"microsecond":return"microsecond";case"millisecond":return"millisecond";case"second":return"second";case"minute":return"minute";case"hour":return"hour";case"day":return"day";default:return}})(i.value.stringValue),o===void 0)return A.vr();break;case"NULL":n=!0;break;default:return A.vr()}const a=X(this.expr.params[2]).evaluate(e,t);switch(a.type){case"INT":break;case"NULL":n=!0;break;default:return A.vr()}if(n)return A.Dr();const u=BigInt(a.value.integerValue);let l;try{switch(o){case"microsecond":l=u;break;case"millisecond":l=u*BigInt(1e3);break;case"second":l=u*BigInt(1e6);break;case"minute":l=u*BigInt(6e7);break;case"hour":l=u*BigInt(36e8);break;case"day":l=u*BigInt(864e8);break;default:return A.vr()}if(o!=="microsecond"&&u!==BigInt(0)&&l/u!==BigInt(this.Kr(o)))return A.vr()}catch(W){return We(`Error during timestamp arithmetic: ${W}`),A.vr()}const d=g1(s.value.timestampValue);if(!xo(d.seconds,d.nanoseconds))return A.vr();const p=M1(d),g=this.Wr(p,l);if(!L1(g))return A.vr();const I=Number(g/ar),v=g%ar,k=Number((v<0?v+ar:v)*BigInt(1e3)),F=v<0?I-1:I;return xo(F,k)?A.newValue({timestampValue:{seconds:F,nanos:k}}):A.vr()}Kr(e){switch(e){case"millisecond":return 1e3;case"second":return 1e6;case"minute":return 6e7;case"hour":return 36e8;case"day":return 864e8;default:return 1}}}class k8 extends vm{Wr(e,t){return e+t}}class x8 extends vm{Wr(e,t){return e-t}}function Lo(r){if((r=wm(r))instanceof ds)return`fld(${r.fieldName})`;if(r instanceof fs)return`cst(${(function(t){return t===null?"null":typeof t=="number"?t.toString():typeof t=="string"?`"${t}"`:t instanceof _e?`ref(${t.path})`:t instanceof _t?`vec(${JSON.stringify(t)})`:JSON.stringify(t)})(r.value)})`;if(r instanceof x)return`fn(${r.name},[${r.params.map(Lo).join(",")}])`;if(r.expressionType==="ListOfExpressions")return`list([${r.Rr.map(Lo).join(",")}])`;throw new Error(`Unrecognized expr ${JSON.stringify(r,null,2)}`)}function L8(r){if(r instanceof _m)return`${r._name}(${ba(r.fields)})`;if(r instanceof ym){let e=`${r._name}(${ba(r.accumulators)})`;return r.groups.size>0&&(e+=`grouping(${ba(r.groups)})`),e}if(r instanceof Em)return`${r._name}(${ba(r.groups)})`;if(r instanceof Yo)return`${r._name}(${r.Vr})`;if(r instanceof Jo)return`${r._name}(${r.collectionId})`;if(r instanceof jc)return`${r._name}()`;if(r instanceof zc)return`${r._name}(${r.dr.sort()})`;if(r instanceof Xo)return`${r._name}(${Lo(r.condition)})`;if(r instanceof _r)return`${r._name}(${r.limit})`;if(r instanceof rn)return`${r._name}(${(function(t){return t.map((n=>`${Lo(n.expr)}${n.direction}`)).join(",")})(r.orderings)})`;throw new Error(`Unrecognized stage ${r._name}`)}function ba(r){return`${Array.from(r.entries()).sort().map((([e,t])=>`${e}=${Lo(t)}`)).join(",")}`}function vn(r){return r.stages.map((e=>L8(e))).join("|")}function Sm(r,e){return vn(r)===vn(e)}function Oe(r){return r instanceof lt}function Jf(r){return Oe(r)?vn(r):fo(r)}function Pm(r){return Oe(r)?vn(r):(function(t){return`${oc(dt(t))}|lt:${t.limitType}`})(r)}function Wc(r,e){return r instanceof lt&&e instanceof lt?Sm(r,e):!(r instanceof lt&&!(e instanceof lt)||!(r instanceof lt)&&e instanceof lt)&&S6(r,e)}function Kc(r){return En(r)?vn(r):oc(r)}function B1(r,e){return r instanceof lt&&e instanceof lt?Sm(r,e):!(r instanceof lt&&!(e instanceof lt)||!(r instanceof lt)&&e instanceof lt)&&l1(r,e)}function M8(r,e){const t=(function(s){let i=!1;const o=[];for(const a of s)if(a instanceof rn)if(i=!0,a.orderings.some((u=>u.expr instanceof ds&&u.expr.fieldName===en)))o.push(a);else{const u=a.orderings.map((l=>l));u.push(ja(en).ascending()),o.push(new rn(u,{}))}else a instanceof _r&&(i||(o.push(new rn([ja(en).ascending()],{})),i=!0)),o.push(a);return i||o.push(new rn([ja(en).ascending()],{})),o})(r.stages);if(r.userDataReader){const n=r.userDataReader.createContext(3,"toCorePipeline");t.forEach((s=>s._readUserData(n)))}return new lt(r.userDataReader.serializer,t,e)}class q1{constructor(e,t,n,s){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=s}applyToRemoteDocument(e,t){const n=t.mutationResults;for(let s=0;s<this.mutations.length;s++){const i=this.mutations[s];i.key.isEqual(e.key)&&s3(i,e,n[s])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=ho(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=ho(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=V6();return this.mutations.forEach((s=>{const i=e.get(s.key),o=i.overlayedDocument;let a=this.applyToLocalView(o,i.mutatedFields);a=t.has(s.key)?null:a;const u=f6(o,a);u!==null&&n.set(s.key,u),o.isValidDocument()||o.convertToNoDocument(K.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),ne())}isEqual(e){return this.batchId===e.batchId&&Ls(this.mutations,e.mutations,((t,n)=>Cf(t,n)))&&Ls(this.baseMutations,e.baseMutations,((t,n)=>Cf(t,n)))}}class G1{constructor(e,t,n,s){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=s}static from(e,t,n){U(e.mutations.length===n.length,58842,{Qr:e.mutations.length,Gr:n.length});let s=(function(){return w3})();const i=e.mutations;for(let o=0;o<i.length;o++)s=s.insert(i[o].key,n[o].version);return new G1(e,t,n,s)}}class $1{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
32      largestBatchId: ${this.largestBatchId},
33      mutation: ${this.mutation.toString()}
34    }`}}class sn{constructor(e,t,n,s,i=K.min(),o=K.min(),a=Se.EMPTY_BYTE_STRING,u=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=u}withSequenceNumber(e){return new sn(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new sn(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new sn(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new sn(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class Cm{constructor(e){this.zr=e}}function F8(r,e){let t;if(e.document)t=Bc(r.zr,e.document,!!e.hasCommittedMutations);else if(e.noDocument){const n=B.fromSegments(e.noDocument.path),s=rs(e.noDocument.readTime);t=Ce.newNoDocument(n,s),e.hasCommittedMutations&&t.setHasCommittedMutations()}else{if(!e.unknownDocument)return H(56709);{const n=B.fromSegments(e.unknownDocument.path),s=rs(e.unknownDocument.version);t=Ce.newUnknownDocument(n,s)}}return e.readTime&&t.setReadTime((function(s){const i=new ge(s[0],s[1]);return K.fromTimestamp(i)})(e.readTime)),t}function Xf(r,e){const t=e.key,n={prefixPath:t.getCollectionPath().popLast().toArray(),collectionGroup:t.collectionGroup,documentId:t.path.lastSegment(),readTime:dc(e.readTime),hasCommittedMutations:e.hasCommittedMutations};if(e.isFoundDocument())n.document=(function(i,o){return{name:Xs(i,o.key),fields:o.data.value.mapValue.fields,updateTime:Js(i,o.version.toTimestamp()),createTime:Js(i,o.createTime.toTimestamp())}})(r.zr,e);else if(e.isNoDocument())n.noDocument={path:t.path.toArray(),readTime:ns(e.version)};else{if(!e.isUnknownDocument())return H(57904,{document:e});n.unknownDocument={path:t.path.toArray(),version:ns(e.version)}}return n}function dc(r){const e=r.toTimestamp();return[e.seconds,e.nanoseconds]}function ns(r){const e=r.toTimestamp();return{seconds:e.seconds,nanoseconds:e.nanoseconds}}function rs(r){const e=new ge(r.seconds,r.nanoseconds);return K.fromTimestamp(e)}function Br(r,e){const t=(e.baseMutations||[]).map((i=>Pl(r.zr,i)));for(let i=0;i<e.mutations.length-1;++i){const o=e.mutations[i];if(i+1<e.mutations.length&&e.mutations[i+1].transform!==void 0){const a=e.mutations[i+1];o.updateTransforms=a.transform.fieldTransforms,e.mutations.splice(i+1,1),++i}}const n=e.mutations.map((i=>Pl(r.zr,i))),s=ge.fromMillis(e.localWriteTimeMs);return new q1(e.batchId,s,t,n)}function no(r,e){const t=rs(e.readTime),n=e.lastLimboFreeSnapshotVersion!==void 0?rs(e.lastLimboFreeSnapshotVersion):K.min();let s;return s=(function(o){return o.structuredPipeline!==void 0})(e.query)?(function(o,a){const u=o.structuredPipeline;U((u?.pipeline?.stages??[]).length>0,1845);const l=u?.pipeline?.stages.map(U8);return new lt(a,l)})(e.query,r.zr):(function(o){return o.documents!==void 0})(e.query)?(function(o){const a=o.documents.length;return U(a===1,1966,{count:a}),dt(pi(F6(o.documents[0])))})(e.query):(function(o){return dt(G6(o))})(e.query),new sn(s,e.targetId,"TargetPurposeListen",e.lastListenSequenceNumber,t,n,Se.fromBase64String(e.resumeToken))}function bm(r,e){const t=ns(e.snapshotVersion),n=ns(e.lastLimboFreeSnapshotVersion);let s;s=En(e.target)?$6(r.zr,e.target):h1(e.target)?B6(r.zr,e.target):qc(r.zr,e.target).yt;const i=e.resumeToken.toBase64();return{targetId:e.targetId,canonicalId:Kc(e.target),readTime:t,resumeToken:i,lastListenSequenceNumber:e.sequenceNumber,lastLimboFreeSnapshotVersion:n,query:s}}function Qc(r){const e=G6({parent:r.parent,structuredQuery:r.structuredQuery});return r.limitType==="LAST"?cc(e,e.limit,"L"):e}function Na(r,e){return new $1(e.largestBatchId,Pl(r.zr,e.overlayMutation))}function Zf(r,e){const t=e.path.lastSegment();return[r,ht(e.path.popLast()),t]}function e2(r,e,t,n){return{indexId:r,uid:e,sequenceNumber:t,readTime:ns(n.readTime),documentKey:ht(n.documentKey.path),largestBatchId:n.largestBatchId}}function U8(r){switch(r.name){case"collection":return new Yo(r.args[0].referenceValue,{});case"collection_group":return new Jo(r.args[1].stringValue,{});case"database":return new jc({});case"documents":return new zc(r.args.map((e=>e.referenceValue)),{});case"where":return new Xo(bl(r.args[0]),{});case"limit":{const e=r.args[0].integerValue??r.args[0].doubleValue;return new _r(typeof e=="number"?e:Number(e),{})}case"sort":return new rn(r.args.map((e=>(function(n){const s=n.mapValue?.fields;return new V1(bl(s.expression),s.direction?.stringValue,"orderingFromProto")})(e))),{});default:throw new Error(`Stage type: ${r.name} not supported.`)}}function bl(r){return r.fieldReferenceValue?new ds(Qt("_exprFromProto",r.fieldReferenceValue),"_exprFromProto"):r.functionValue?(function(t){return new x(t.functionValue.name,t.functionValue.args?.map(bl)||[])})(r):fs._fromProto(r)}class B8{getBundleMetadata(e,t){return t2(e).get(t).next((n=>{if(n)return(function(i){return{id:i.bundleId,createTime:rs(i.createTime),version:i.version}})(n)}))}saveBundleMetadata(e,t){return t2(e).put((function(s){return{bundleId:s.id,createTime:ns(Me(s.createTime)),version:s.version}})(t))}getNamedQuery(e,t){return n2(e).get(t).next((n=>{if(n)return(function(i){return{name:i.name,query:Qc(i.bundledQuery),readTime:rs(i.readTime)}})(n)}))}saveNamedQuery(e,t){return n2(e).put((function(s){return{name:s.name,readTime:ns(Me(s.readTime)),bundledQuery:s.bundledQuery}})(t))}}function t2(r){return Qe(r,Dc)}function n2(r){return Qe(r,kc)}class Yc{constructor(e,t){this.serializer=e,this.userId=t}static jr(e,t){const n=t.uid||"";return new Yc(e,n)}getOverlay(e,t){return Is(e).get(Zf(this.userId,t)).next((n=>n?Na(this.serializer,n):null))}getOverlays(e,t){const n=Lt();return C.forEach(t,(s=>this.getOverlay(e,s).next((i=>{i!==null&&n.set(s,i)})))).next((()=>n))}getAllOverlays(e,t){const n=Lt();return Is(e).ee(((s,i)=>{const o=Na(this.serializer,i);o.largestBatchId>t&&n.set(o.getKey(),o)})).next((()=>n))}saveOverlays(e,t,n){const s=[];return n.forEach(((i,o)=>{const a=new $1(t,o);s.push(this.Hr(e,a))})),C.waitFor(s)}removeOverlaysForBatchId(e,t,n){const s=new Set;t.forEach((o=>s.add(ht(o.getCollectionPath()))));const i=[];return s.forEach((o=>{const a=IDBKeyRange.bound([this.userId,o,n],[this.userId,o,n+1],!1,!0);i.push(Is(e).Z(ml,a))})),C.waitFor(i)}getOverlaysForCollection(e,t,n){const s=Lt(),i=ht(t),o=IDBKeyRange.bound([this.userId,i,n],[this.userId,i,Number.POSITIVE_INFINITY],!0);return Is(e).H(ml,o).next((a=>{for(const u of a){const l=Na(this.serializer,u);s.set(l.getKey(),l)}return s}))}getOverlaysForCollectionGroup(e,t,n,s){const i=Lt();let o;const a=IDBKeyRange.bound([this.userId,t,n],[this.userId,t,Number.POSITIVE_INFINITY],!0);return Is(e).ee({index:Kp,range:a},((u,l,d)=>{const p=Na(this.serializer,l);i.size()<s||p.largestBatchId===o?(i.set(p.getKey(),p),o=p.largestBatchId):d.done()})).next((()=>i))}Hr(e,t){return Is(e).put((function(s,i,o){const[a,u,l]=Zf(i,o.mutation.key);return{userId:i,collectionPath:u,documentId:l,collectionGroup:o.mutation.key.getCollectionGroup(),largestBatchId:o.largestBatchId,overlayMutation:No(s.zr,o.mutation)}})(this.serializer,this.userId,t))}}function Is(r){return Qe(r,xc)}class q8{Jr(e){return Qe(e,t1)}getSessionToken(e){return this.Jr(e).get("sessionToken").next((t=>{const n=t?.value;return n?Se.fromUint8Array(n):Se.EMPTY_BYTE_STRING}))}setSessionToken(e,t){return this.Jr(e).put({name:"sessionToken",value:t.toUint8Array()})}}class qr{constructor(){}Yr(e,t){this.Zr(e,t),t.Xr()}Zr(e,t){if("nullValue"in e)this.ei(t,5);else if("booleanValue"in e)this.ei(t,10),t.ti(e.booleanValue?1:0);else if("integerValue"in e)this.ei(t,15),t.ti(ve(e.integerValue));else if("doubleValue"in e){const n=ve(e.doubleValue);isNaN(n)?this.ei(t,13):(this.ei(t,15),Bs(n)?t.ti(0):t.ti(n))}else if("timestampValue"in e){let n=e.timestampValue;this.ei(t,20),typeof n=="string"&&(n=Cn(n)),t.ni(`${n.seconds||""}`),t.ti(n.nanos||0)}else if("stringValue"in e)this.ri(e.stringValue,t),this.ii(t);else if("bytesValue"in e)this.ei(t,30),t.si(bn(e.bytesValue)),this.ii(t);else if("referenceValue"in e)this._i(e.referenceValue,t);else if("geoPointValue"in e){const n=e.geoPointValue;this.ei(t,45),t.ti(n.latitude||0),t.ti(n.longitude||0)}else"mapValue"in e?o6(e)?this.ei(t,Number.MAX_SAFE_INTEGER):Xr(e)?this.oi(e.mapValue,t):(this.ai(e.mapValue,t),this.ii(t)):"arrayValue"in e?(this.ui(e.arrayValue,t),this.ii(t)):H(19022,{ci:e})}ri(e,t){this.ei(t,25),this.li(e,t)}li(e,t){t.ni(e)}ai(e,t){const n=e.fields||{};this.ei(t,55);for(const s of Object.keys(n))this.ri(s,t),this.Zr(n[s],t)}oi(e,t){const n=e.fields||{};this.ei(t,53);const s=Yr,i=n[s].arrayValue?.values?.length||0;this.ei(t,15),t.ti(ve(i)),this.ri(s,t),this.Zr(n[s],t)}ui(e,t){const n=e.values||[];this.ei(t,50);for(const s of n)this.Zr(s,t)}_i(e,t){this.ei(t,37),B.fromName(e).path.forEach((n=>{this.ei(t,60),this.li(n,t)}))}ei(e,t){e.ti(t)}ii(e){e.ti(2)}}qr.Ei=new qr;const ws=255;function G8(r){if(r===0)return 8;let e=0;return r>>4||(e+=4,r<<=4),r>>6||(e+=2,r<<=2),r>>7||(e+=1),e}function r2(r){const e=64-(function(n){let s=0;for(let i=0;i<8;++i){const o=G8(255&n[i]);if(s+=o,o!==8)break}return s})(r);return Math.ceil(e/8)}class $8{constructor(){this.buffer=new Uint8Array(1024),this.position=0}hi(e){const t=e[Symbol.iterator]();let n=t.next();for(;!n.done;)this.Ti(n.value),n=t.next();this.Pi()}Ri(e){const t=e[Symbol.iterator]();let n=t.next();for(;!n.done;)this.Ii(n.value),n=t.next();this.Ai()}Vi(e){for(const t of e){const n=t.charCodeAt(0);if(n<128)this.Ti(n);else if(n<2048)this.Ti(960|n>>>6),this.Ti(128|63&n);else if(t<"\uD800"||"\uDBFF"<t)this.Ti(480|n>>>12),this.Ti(128|63&n>>>6),this.Ti(128|63&n);else{const s=t.codePointAt(0);this.Ti(240|s>>>18),this.Ti(128|63&s>>>12),this.Ti(128|63&s>>>6),this.Ti(128|63&s)}}this.Pi()}di(e){for(const t of e){const n=t.charCodeAt(0);if(n<128)this.Ii(n);else if(n<2048)this.Ii(960|n>>>6),this.Ii(128|63&n);else if(t<"\uD800"||"\uDBFF"<t)this.Ii(480|n>>>12),this.Ii(128|63&n>>>6),this.Ii(128|63&n);else{const s=t.codePointAt(0);this.Ii(240|s>>>18),this.Ii(128|63&s>>>12),this.Ii(128|63&s>>>6),this.Ii(128|63&s)}}this.Ai()}fi(e){const t=this.mi(e),n=r2(t);this.pi(1+n),this.buffer[this.position++]=255&n;for(let s=t.length-n;s<t.length;++s)this.buffer[this.position++]=255&t[s]}gi(e){const t=this.mi(e),n=r2(t);this.pi(1+n),this.buffer[this.position++]=~(255&n);for(let s=t.length-n;s<t.length;++s)this.buffer[this.position++]=~(255&t[s])}yi(){this.wi(ws),this.wi(255)}bi(){this.Si(ws),this.Si(255)}reset(){this.position=0}seed(e){this.pi(e.length),this.buffer.set(e,this.position),this.position+=e.length}Di(){return this.buffer.slice(0,this.position)}mi(e){const t=(function(i){const o=new DataView(new ArrayBuffer(8));return o.setFloat64(0,i,!1),new Uint8Array(o.buffer)})(e),n=!!(128&t[0]);t[0]^=n?255:128;for(let s=1;s<t.length;++s)t[s]^=n?255:0;return t}Ti(e){const t=255&e;t===0?(this.wi(0),this.wi(255)):t===ws?(this.wi(ws),this.wi(0)):this.wi(t)}Ii(e){const t=255&e;t===0?(this.Si(0),this.Si(255)):t===ws?(this.Si(ws),this.Si(0)):this.Si(e)}Pi(){this.wi(0),this.wi(1)}Ai(){this.Si(0),this.Si(1)}wi(e){this.pi(1),this.buffer[this.position++]=e}Si(e){this.pi(1),this.buffer[this.position++]=~e}pi(e){const t=e+this.position;if(t<=this.buffer.length)return;let n=2*this.buffer.length;n<t&&(n=t);const s=new Uint8Array(n);s.set(this.buffer),this.buffer=s}}class j8{constructor(e){this.xi=e}si(e){this.xi.hi(e)}ni(e){this.xi.Vi(e)}ti(e){this.xi.fi(e)}Xr(){this.xi.yi()}}class z8{constructor(e){this.xi=e}si(e){this.xi.Ri(e)}ni(e){this.xi.di(e)}ti(e){this.xi.gi(e)}Xr(){this.xi.bi()}}class Hi{constructor(){this.xi=new $8,this.ascending=new j8(this.xi),this.descending=new z8(this.xi)}seed(e){this.xi.seed(e)}Ci(e){return e===0?this.ascending:this.descending}Di(){return this.xi.Di()}reset(){this.xi.reset()}}class Gr{constructor(e,t,n,s){this.Fi=e,this.Oi=t,this.Mi=n,this.Ni=s}Li(){const e=this.Ni.length,t=e===0||this.Ni[e-1]===255?e+1:e,n=new Uint8Array(t);return n.set(this.Ni,0),t!==e?n.set([0],this.Ni.length):++n[n.length-1],new Gr(this.Fi,this.Oi,this.Mi,n)}Bi(e,t,n){return{indexId:this.Fi,uid:e,arrayValue:za(this.Mi),directionalValue:za(this.Ni),orderedDocumentKey:za(t),documentKey:n.path.toArray()}}Ui(e,t,n){const s=this.Bi(e,t,n);return[s.indexId,s.uid,s.arrayValue,s.directionalValue,s.orderedDocumentKey,s.documentKey]}}function zn(r,e){let t=r.Fi-e.Fi;return t!==0?t:(t=s2(r.Mi,e.Mi),t!==0?t:(t=s2(r.Ni,e.Ni),t!==0?t:B.comparator(r.Oi,e.Oi)))}function s2(r,e){for(let t=0;t<r.length&&t<e.length;++t){const n=r[t]-e[t];if(n!==0)return n}return r.length-e.length}function za(r){return yp()?(function(t){let n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return n})(r):r}function i2(r){return typeof r!="string"?r:(function(t){const n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n})(r)}class o2{constructor(e){this.ki=new ye(((t,n)=>Ae.comparator(t.field,n.field))),this.collectionId=e.collectionGroup!=null?e.collectionGroup:e.path.lastSegment(),this.qi=e.orderBy,this.$i=[];for(const t of e.filters){const n=t;n.isInequality()?this.ki=this.ki.add(n):this.$i.push(n)}}get Ki(){return this.ki.size>1}Wi(e){if(U(e.collectionGroup===this.collectionId,49279),this.Ki)return!1;const t=dl(e);if(t!==void 0&&!this.Qi(t))return!1;const n=Lr(e);let s=new Set,i=0,o=0;for(;i<n.length&&this.Qi(n[i]);++i)s=s.add(n[i].fieldPath.canonicalString());if(i===n.length)return!0;if(this.ki.size>0){const a=this.ki.getIterator().getNext();if(!s.has(a.field.canonicalString())){const u=n[i];if(!this.Gi(a,u)||!this.zi(this.qi[o++],u))return!1}++i}for(;i<n.length;++i){const a=n[i];if(o>=this.qi.length||!this.zi(this.qi[o++],a))return!1}return!0}ji(){if(this.Ki)return null;let e=new ye(Ae.comparator);const t=[];for(const n of this.$i)if(!n.field.isKeyField())if(n.op==="array-contains"||n.op==="array-contains-any")t.push(new Hr(n.field,2));else{if(e.has(n.field))continue;e=e.add(n.field),t.push(new Hr(n.field,0))}for(const n of this.qi)n.field.isKeyField()||e.has(n.field)||(e=e.add(n.field),t.push(new Hr(n.field,n.dir==="asc"?0:1)));return new Fs(Fs.UNKNOWN_ID,this.collectionId,t,Us.empty())}Qi(e){for(const t of this.$i)if(this.Gi(t,e))return!0;return!1}Gi(e,t){if(e===void 0||!e.field.isEqual(t.fieldPath))return!1;const n=e.op==="array-contains"||e.op==="array-contains-any";return t.kind===2===n}zi(e,t){return!!e.field.isEqual(t.fieldPath)&&(t.kind===0&&e.dir==="asc"||t.kind===1&&e.dir==="desc")}}function Nm(r){if(U(r instanceof ue||r instanceof Ee,20012),r instanceof ue){if(r instanceof T6){const t=r.value.arrayValue?.values?.map((n=>ue.create(r.field,"==",n)))||[];return Ee.create(t,"or")}return r}const e=r.filters.map((t=>Nm(t)));return Ee.create(e,r.op)}function H8(r){if(r.getFilters().length===0)return[];const e=Ol(Nm(r));return U(Vm(e),7391),Nl(e)||Vl(e)?[e]:e.getFilters()}function Nl(r){return r instanceof ue}function Vl(r){return r instanceof Ee&&u1(r)}function Vm(r){return Nl(r)||Vl(r)||(function(t){if(t instanceof Ee&&El(t)){for(const n of t.getFilters())if(!Nl(n)&&!Vl(n))return!1;return!0}return!1})(r)}function Ol(r){if(U(r instanceof ue||r instanceof Ee,34018),r instanceof ue)return r;if(r.filters.length===1)return Ol(r.filters[0]);const e=r.filters.map((n=>Ol(n)));let t=Ee.create(e,r.op);return t=fc(t),Vm(t)?t:(U(t instanceof Ee,64498),U(Ys(t),40251),U(t.filters.length>1,57927),t.filters.reduce(((n,s)=>j1(n,s))))}function j1(r,e){let t;return U(r instanceof ue||r instanceof Ee,38388),U(e instanceof ue||e instanceof Ee,25473),t=r instanceof ue?e instanceof ue?(function(s,i){return Ee.create([s,i],"and")})(r,e):a2(r,e):e instanceof ue?a2(e,r):(function(s,i){if(U(s.filters.length>0&&i.filters.length>0,48005),Ys(s)&&Ys(i))return E6(s,i.getFilters());const o=El(s)?s:i,a=El(s)?i:s,u=o.filters.map((l=>j1(l,a)));return Ee.create(u,"or")})(r,e),fc(t)}function a2(r,e){if(Ys(e))return E6(e,r.getFilters());{const t=e.filters.map((n=>j1(r,n)));return Ee.create(t,"or")}}function fc(r){if(U(r instanceof ue||r instanceof Ee,11850),r instanceof ue)return r;const e=r.getFilters();if(e.length===1)return fc(e[0]);if(_6(r))return r;const t=e.map((s=>fc(s))),n=[];return t.forEach((s=>{s instanceof ue?n.push(s):s instanceof Ee&&(s.op===r.op?n.push(...s.filters):n.push(s))})),n.length===1?n[0]:Ee.create(n,r.op)}class W8{constructor(){this.Hi=new z1}addToCollectionParentIndex(e,t){return this.Hi.add(t),C.resolve()}getCollectionParents(e,t){return C.resolve(this.Hi.getEntries(t))}addFieldIndex(e,t){return C.resolve()}deleteFieldIndex(e,t){return C.resolve()}deleteAllFieldIndexes(e){return C.resolve()}createTargetIndexes(e,t){return C.resolve()}getDocumentsMatchingTarget(e,t){return C.resolve(null)}getIndexType(e,t){return C.resolve(0)}getFieldIndexes(e,t){return C.resolve([])}getNextCollectionGroupToUpdate(e){return C.resolve(null)}getMinOffset(e,t){return C.resolve(Dt.min())}getMinOffsetFromCollectionGroup(e,t){return C.resolve(Dt.min())}updateCollectionGroup(e,t,n){return C.resolve()}updateIndexEntries(e,t){return C.resolve()}}class z1{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),s=this.index[t]||new ye(re.comparator),i=!s.has(n);return this.index[t]=s.add(n),i}has(e){const t=e.lastSegment(),n=e.popLast(),s=this.index[t];return s&&s.has(n)}getEntries(e){return(this.index[e]||new ye(re.comparator)).toArray()}}const c2="IndexedDbIndexManager",Va=new Uint8Array(0);class K8{constructor(e,t){this.databaseId=t,this.Ji=new z1,this.Yi=new Ln((n=>oc(n)),((n,s)=>l1(n,s))),this.uid=e.uid||""}addToCollectionParentIndex(e,t){if(!this.Ji.has(t)){const n=t.lastSegment(),s=t.popLast();e.addOnCommittedListener((()=>{this.Ji.add(t)}));const i={collectionId:n,parent:ht(s)};return u2(e).put(i)}return C.resolve()}getCollectionParents(e,t){const n=[],s=IDBKeyRange.bound([t,""],[kp(t),""],!1,!0);return u2(e).H(s).next((i=>{for(const o of i){if(o.collectionId!==t)break;n.push(tn(o.parent))}return n}))}addFieldIndex(e,t){const n=Wi(e),s=(function(a){return{indexId:a.indexId,collectionGroup:a.collectionGroup,fields:a.fields.map((u=>[u.fieldPath.canonicalString(),u.kind]))}})(t);delete s.indexId;const i=n.add(s);if(t.indexState){const o=As(e);return i.next((a=>{o.put(e2(a,this.uid,t.indexState.sequenceNumber,t.indexState.offset))}))}return i.next()}deleteFieldIndex(e,t){const n=Wi(e),s=As(e),i=Ts(e);return n.delete(t.indexId).next((()=>s.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0)))).next((()=>i.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0))))}deleteAllFieldIndexes(e){const t=Wi(e),n=Ts(e),s=As(e);return t.Z().next((()=>n.Z())).next((()=>s.Z()))}
34createTargetIndexes(e,t){return C.forEach(this.Zi(t),(n=>this.getIndexType(e,n).next((s=>{if(s===0||s===1){const i=new o2(n).ji();if(i!=null)return this.addFieldIndex(e,i)}}))))}getDocumentsMatchingTarget(e,t){const n=Ts(e);let s=!0;const i=new Map;return C.forEach(this.Zi(t),(o=>this.Xi(e,o).next((a=>{s&&(s=!!a),i.set(o,a)})))).next((()=>{if(s){let o=ne();const a=[];return C.forEach(i,((u,l)=>{M(c2,`Using index ${(function(Y){return`id=${Y.indexId}|cg=${Y.collectionGroup}|f=${Y.fields.map((me=>`${me.fieldPath}:${me.kind}`)).join(",")}`})(u)} to execute ${oc(t)}`);const d=(function(Y,me){const Ie=dl(me);if(Ie===void 0)return null;for(const pe of ac(Y,Ie.fieldPath))switch(pe.op){case"array-contains-any":return pe.value.arrayValue.values||[];case"array-contains":return[pe.value]}return null})(l,u),p=(function(Y,me){const Ie=new Map;for(const pe of Lr(me))for(const T of ac(Y,pe.fieldPath))switch(T.op){case"==":case"in":Ie.set(pe.fieldPath.canonicalString(),T.value);break;case"not-in":case"!=":return Ie.set(pe.fieldPath.canonicalString(),T.value),Array.from(Ie.values())}return null})(l,u),g=(function(Y,me){const Ie=[];let pe=!0;for(const T of Lr(me)){const _=T.kind===0?Df(Y,T.fieldPath,Y.startAt):kf(Y,T.fieldPath,Y.startAt);Ie.push(_.value),pe&&(pe=_.inclusive)}return new mr(Ie,pe)})(l,u),I=(function(Y,me){const Ie=[];let pe=!0;for(const T of Lr(me)){const _=T.kind===0?kf(Y,T.fieldPath,Y.endAt):Df(Y,T.fieldPath,Y.endAt);Ie.push(_.value),pe&&(pe=_.inclusive)}return new mr(Ie,pe)})(l,u),v=this.es(u,l,g),k=this.es(u,l,I),F=this.ts(u,l,p),W=this.ns(u.indexId,d,v,g.inclusive,k,I.inclusive,F);
vendor: 1,075 bytes, line 34
34return C.forEach(W,(J=>n.Y(J,t.limit).next((Y=>{Y.forEach((me=>{const Ie=B.fromSegments(me.documentKey);o.has(Ie)||(o=o.add(Ie),a.push(Ie))}))}))))})).next((()=>a))}return C.resolve(null)}))}Zi(e){let t=this.Yi.get(e);return t||(e.filters.length===0?t=[e]:t=H8(Ee.create(e.filters,"and")).map((n=>wl(e.path,e.collectionGroup,e.orderBy,n.getFilters(),e.limit,e.startAt,e.endAt))),this.Yi.set(e,t),t)}ns(e,t,n,s,i,o,a){const u=(t!=null?t.length:1)*Math.max(n.length,i.length),l=u/(t!=null?t.length:1),d=[];for(let p=0;p<u;++p){const g=t?this.rs(t[p/l]):Va,I=this.ss(e,g,n[p%l],s),v=this._s(e,g,i[p%l],o),k=a.map((F=>this.ss(e,g,F,!0)));d.push(...this.createRange(I,v,k))}return d}ss(e,t,n,s){const i=new Gr(e,B.empty(),t,n);return s?i:i.Li()}_s(e,t,n,s){const i=new Gr(e,B.empty(),t,n);return s?i.Li():i}Xi(e,t){const n=new o2(t),s=t.collectionGroup!=null?t.collectionGroup:t.path.lastSegment();return this.getFieldIndexes(e,s).next((i=>{let o=null;for(const a of i)n.Wi(a)&&(!o||a.fields.length>o.fields.length)&&(o=a);return o}))}getIndexType(e,t){let n=2;const s=this.Zi(t);
34return C.forEach(s,(i=>this.Xi(e,i).next((o=>{o?n!==0&&o.fields.length<(function(u){let l=new ye(Ae.comparator),d=!1;for(const p of u.filters)for(const g of p.getFlattenedFilters())g.field.isKeyField()||(g.op==="array-contains"||g.op==="array-contains-any"?d=!0:l=l.add(g.field));for(const p of u.orderBy)p.field.isKeyField()||(l=l.add(p.field));return l.size+(d?1:0)})(i)&&(n=1):n=0})))).next((()=>(function(o){return o.limit!==null})(t)&&s.length>1&&n===2?1:n))}us(e,t){const n=new Hi;for(const s of Lr(e)){const i=t.data.field(s.fieldPath);if(i==null)return null;const o=n.Ci(s.kind);qr.Ei.Yr(i,o)}return n.Di()}rs(e){const t=new Hi;return qr.Ei.Yr(e,t.Ci(0)),t.Di()}cs(e,t){const n=new Hi;return qr.Ei.Yr(Jr(this.databaseId,t),n.Ci((function(i){const o=Lr(i);return o.length===0?0:o[o.length-1].kind})(e))),n.Di()}ts(e,t,n){if(n===null)return[];let s=[];s.push(new Hi);let i=0;for(const o of Lr(e)){const a=n[i++];for(const u of s)if(this.ls(t,o.fieldPath)&&pr(a))s=this.Es(s,o,a);else{const l=u.Ci(o.kind);qr.Ei.Yr(a,l)}}return this.hs(s)}es(e,t,n){return this.ts(e,t,n.position)}hs(e){const t=[];for(let n=0;n<e.length;++n)t[n]=e[n].Di();return t}Es(e,t,n){const s=[...e],i=[];for(const o of n.arrayValue.values||[])for(const a of s){const u=new Hi;u.seed(a.Di()),qr.Ei.Yr(o,u.Ci(t.kind)),i.push(u)}return i}ls(e,t){return!!e.filters.find((n=>n instanceof ue&&n.field.isEqual(t)&&(n.op==="in"||n.op==="not-in")))}getFieldIndexes(e,t){const n=Wi(e),s=As(e);return(t?n.H(pl,IDBKeyRange.bound(t,t)):n.H()).next((i=>{const o=[];
vendor: 10,635 bytes, line 34
34return C.forEach(i,(a=>s.get([a.indexId,this.uid]).next((u=>{o.push((function(d,p){const g=p?new Us(p.sequenceNumber,new Dt(rs(p.readTime),new B(tn(p.documentKey)),p.largestBatchId)):Us.empty(),I=d.fields.map((([v,k])=>new Hr(Ae.fromServerFormat(v),k)));return new Fs(d.indexId,d.collectionGroup,I,g)})(a,u))})))).next((()=>o))}))}getNextCollectionGroupToUpdate(e){return this.getFieldIndexes(e).next((t=>t.length===0?null:(t.sort(((n,s)=>{const i=n.indexState.sequenceNumber-s.indexState.sequenceNumber;return i!==0?i:Z(n.collectionGroup,s.collectionGroup)})),t[0].collectionGroup)))}updateCollectionGroup(e,t,n){const s=Wi(e),i=As(e);return this.Ts(e).next((o=>s.H(pl,IDBKeyRange.bound(t,t)).next((a=>C.forEach(a,(u=>i.put(e2(u.indexId,this.uid,o,n))))))))}updateIndexEntries(e,t){const n=new Map;return C.forEach(t,((s,i)=>{const o=n.get(s.collectionGroup);return(o?C.resolve(o):this.getFieldIndexes(e,s.collectionGroup)).next((a=>(n.set(s.collectionGroup,a),C.forEach(a,(u=>this.Ps(e,s,u).next((l=>{const d=this.Rs(i,u);return l.isEqual(d)?C.resolve():this.Is(e,i,u,l,d)})))))))}))}As(e,t,n,s){return Ts(e).put(s.Bi(this.uid,this.cs(n,t.key),t.key))}Vs(e,t,n,s){return Ts(e).delete(s.Ui(this.uid,this.cs(n,t.key),t.key))}Ps(e,t,n){const s=Ts(e);let i=new ye(zn);return s.ee({index:Wp,range:IDBKeyRange.only([n.indexId,this.uid,za(this.cs(n,t))])},((o,a)=>{i=i.add(new Gr(n.indexId,t,i2(a.arrayValue),i2(a.directionalValue)))})).next((()=>i))}Rs(e,t){let n=new ye(zn);const s=this.us(t,e);if(s==null)return n;const i=dl(t);if(i!=null){const o=e.data.field(i.fieldPath);if(pr(o))for(const a of o.arrayValue.values||[])n=n.add(new Gr(t.indexId,e.key,this.rs(a),s))}else n=n.add(new Gr(t.indexId,e.key,Va,s));return n}Is(e,t,n,s,i){M(c2,"Updating index entries for document '%s'",t.key);const o=[];return(function(u,l,d,p,g){const I=u.getIterator(),v=l.getIterator();let k=Es(I),F=Es(v);for(;k||F;){let W=!1,J=!1;if(k&&F){const Y=d(k,F);Y<0?J=!0:Y>0&&(W=!0)}else k!=null?J=!0:W=!0;W?(p(F),F=Es(v)):J?(g(k),k=Es(I)):(k=Es(I),F=Es(v))}})(s,i,zn,(a=>{o.push(this.As(e,t,n,a))}),(a=>{o.push(this.Vs(e,t,n,a))})),C.waitFor(o)}Ts(e){let t=1;return As(e).ee({index:Hp,reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},((n,s,i)=>{i.done(),t=s.sequenceNumber+1})).next((()=>t))}createRange(e,t,n){n=n.sort(((o,a)=>zn(o,a))).filter(((o,a,u)=>!a||zn(o,u[a-1])!==0));const s=[];s.push(e);for(const o of n){const a=zn(o,e),u=zn(o,t);if(a===0)s[0]=e.Li();else if(a>0&&u<0)s.push(o),s.push(o.Li());else if(u>0)break}s.push(t);const i=[];for(let o=0;o<s.length;o+=2){if(this.ds(s[o],s[o+1]))return[];const a=s[o].Ui(this.uid,Va,B.empty()),u=s[o+1].Ui(this.uid,Va,B.empty());i.push(IDBKeyRange.bound(a,u))}return i}ds(e,t){return zn(e,t)>0}getMinOffsetFromCollectionGroup(e,t){return this.getFieldIndexes(e,t).next(l2)}getMinOffset(e,t){return C.mapArray(this.Zi(t),(n=>this.Xi(e,n).next((s=>s||H(44426))))).next(l2)}}function u2(r){return Qe(r,So)}function Ts(r){return Qe(r,uo)}function Wi(r){return Qe(r,e1)}function As(r){return Qe(r,co)}function l2(r){U(r.length!==0,28825);let e=r[0].indexState.offset,t=e.largestBatchId;for(let n=1;n<r.length;n++){const s=r[n].indexState.offset;Jl(s,e)<0&&(e=s),t<s.largestBatchId&&(t=s.largestBatchId)}return new Dt(e.readTime,e.documentKey,t)}function Om(r,e,t){const n=r.store(jt),s=r.store(qs),i=[],o=IDBKeyRange.only(t.batchId);let a=0;const u=n.ee({range:o},((d,p,g)=>(a++,g.delete())));i.push(u.next((()=>{U(a===1,47070,{batchId:t.batchId})})));const l=[];for(const d of t.mutations){const p=$p(e,d.key.path,t.batchId);i.push(s.delete(p)),l.push(d.key)}return C.waitFor(i).next((()=>l))}function pc(r){if(!r)return 0;let e;if(r.document)e=r.document;else if(r.unknownDocument)e=r.unknownDocument;else{if(!r.noDocument)throw H(14731);e=r.noDocument}return JSON.stringify(e).length}class Jc{constructor(e,t,n,s){this.userId=e,this.serializer=t,this.indexManager=n,this.referenceDelegate=s,this.fs={}}static jr(e,t,n,s){U(e.uid!=="",64387);const i=e.isAuthenticated()?e.uid:"";return new Jc(i,t,n,s)}checkEmpty(e){let t=!0;const n=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return Hn(e).ee({index:$r,range:n},((s,i,o)=>{t=!1,o.done()})).next((()=>t))}addMutationBatch(e,t,n,s){const i=Ps(e),o=Hn(e);return o.add({}).next((a=>{U(typeof a=="number",49019);const u=new q1(a,t,n,s),l=(function(I,v,k){const F=k.baseMutations.map((J=>No(I.zr,J))),W=k.mutations.map((J=>No(I.zr,J)));return{userId:v,batchId:k.batchId,localWriteTimeMs:k.localWriteTime.toMillis(),baseMutations:F,mutations:W}})(this.serializer,this.userId,u),d=[];let p=new ye(((g,I)=>Z(g.canonicalString(),I.canonicalString())));for(const g of s){const I=$p(this.userId,g.key.path,a);p=p.add(g.key.path.popLast()),d.push(o.put(l)),d.push(i.put(I,R_))}return p.forEach((g=>{d.push(this.indexManager.addToCollectionParentIndex(e,g))})),e.addOnCommittedListener((()=>{this.fs[a]=u.keys()})),C.waitFor(d).next((()=>u))}))}lookupMutationBatch(e,t){return Hn(e).get(t).next((n=>n?(U(n.userId===this.userId,48,"Unexpected user for mutation batch",{userId:n.userId,batchId:t}),Br(this.serializer,n)):null))}ps(e,t){return this.fs[t]?C.resolve(this.fs[t]):this.lookupMutationBatch(e,t).next((n=>{if(n){const s=n.keys();return this.fs[t]=s,s}return null}))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,s=IDBKeyRange.lowerBound([this.userId,n]);let i=null;return Hn(e).ee({index:$r,range:s},((o,a,u)=>{a.userId===this.userId&&(U(a.batchId>=n,47524,{gs:n}),i=Br(this.serializer,a)),u.done()})).next((()=>i))}getHighestUnacknowledgedBatchId(e){const t=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]);let n=or;return Hn(e).ee({index:$r,range:t,reverse:!0},((s,i,o)=>{n=i.batchId,o.done()})).next((()=>n))}getAllMutationBatches(e){const t=IDBKeyRange.bound([this.userId,or],[this.userId,Number.POSITIVE_INFINITY]);return Hn(e).H($r,t).next((n=>n.map((s=>Br(this.serializer,s)))))}getAllMutationBatchesAffectingDocumentKey(e,t){const n=Fa(this.userId,t.path),s=IDBKeyRange.lowerBound(n),i=[];return Ps(e).ee({range:s},((o,a,u)=>{const[l,d,p]=o,g=tn(d);if(l===this.userId&&t.path.isEqual(g))return Hn(e).get(p).next((I=>{if(!I)throw H(61480,{ys:o,batchId:p});U(I.userId===this.userId,10503,"Unexpected user for mutation batch",{userId:I.userId,batchId:p}),i.push(Br(this.serializer,I))}));u.done()})).next((()=>i))}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new ye(Z);const s=[];return t.forEach((i=>{const o=Fa(this.userId,i.path),a=IDBKeyRange.lowerBound(o),u=Ps(e).ee({range:a},((l,d,p)=>{const[g,I,v]=l,k=tn(I);g===this.userId&&i.path.isEqual(k)?n=n.add(v):p.done()}));s.push(u)})),C.waitFor(s).next((()=>this.ws(e,n)))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,s=n.length+1,i=Fa(this.userId,n),o=IDBKeyRange.lowerBound(i);let a=new ye(Z);return Ps(e).ee({range:o},((u,l,d)=>{const[p,g,I]=u,v=tn(g);p===this.userId&&n.isPrefixOf(v)?v.length===s&&(a=a.add(I)):d.done()})).next((()=>this.ws(e,a)))}ws(e,t){const n=[],s=[];return t.forEach((i=>{s.push(Hn(e).get(i).next((o=>{if(o===null)throw H(35274,{batchId:i});U(o.userId===this.userId,9748,"Unexpected user for mutation batch",{userId:o.userId,batchId:i}),n.push(Br(this.serializer,o))})))})),C.waitFor(s).next((()=>n))}removeMutationBatch(e,t){return Om(e.le,this.userId,t).next((n=>(e.addOnCommittedListener((()=>{this.bs(t.batchId)})),C.forEach(n,(s=>this.referenceDelegate.markPotentiallyOrphaned(e,s))))))}bs(e){delete this.fs[e]}performConsistencyCheck(e){return this.checkEmpty(e).next((t=>{if(!t)return C.resolve();const n=IDBKeyRange.lowerBound((function(o){return[o]})(this.userId)),s=[];return Ps(e).ee({range:n},((i,o,a)=>{if(i[0]===this.userId){const u=tn(i[1]);s.push(u)}else a.done()})).next((()=>{U(s.length===0,56720,{vs:s.map((i=>i.canonicalString()))})}))}))}containsKey(e,t){return Dm(e,this.userId,t)}Ss(e){return km(e).get(this.userId).next((t=>t||{userId:this.userId,lastAcknowledgedBatchId:or,lastStreamToken:""}))}}function Dm(r,e,t){const n=Fa(e,t.path),s=n[1],i=IDBKeyRange.lowerBound(n);let o=!1;return Ps(r).ee({range:i,X:!0},((a,u,l)=>{const[d,p,g]=a;d===e&&p===s&&(o=!0),l.done()})).next((()=>o))}function Hn(r){return Qe(r,jt)}function Ps(r){return Qe(r,qs)}function km(r){return Qe(r,Ro)}class Vn{constructor(e){this.Ds=e}next(){return this.Ds+=2,this.Ds}static xs(){return new Vn(0)}static Cs(){return new Vn(-1)}}class Q8{constructor(e,t){this.referenceDelegate=e,this.serializer=t}allocateTargetId(e){return this.Fs(e).next((t=>{const n=new Vn(t.highestTargetId);return t.highestTargetId=n.next(),this.Os(e,t).next((()=>t.highestTargetId))}))}getLastRemoteSnapshotVersion(e){return this.Fs(e).next((t=>K.fromTimestamp(new ge(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))))}getHighestSequenceNumber(e){return this.Fs(e).next((t=>t.highestListenSequenceNumber))}setTargetsMetadata(e,t,n){return this.Fs(e).next((s=>(s.highestListenSequenceNumber=t,n&&(s.lastRemoteSnapshotVersion=n.toTimestamp()),t>s.highestListenSequenceNumber&&(s.highestListenSequenceNumber=t),this.Os(e,s))))}addTargetData(e,t){return this.Ms(e,t).next((()=>this.Fs(e).next((n=>(n.targetCount+=1,this.Ns(t,n),this.Os(e,n))))))}updateTargetData(e,t){return this.Ms(e,t)}removeTargetData(e,t){return this.removeMatchingKeysForTargetId(e,t.targetId).next((()=>Rs(e).delete(t.targetId))).next((()=>this.Fs(e))).next((n=>(U(n.targetCount>0,8065),n.targetCount-=1,this.Os(e,n))))}removeTargets(e,t,n){let s=0;const i=[];return Rs(e).ee(((o,a)=>{const u=no(this.serializer,a);u.sequenceNumber<=t&&n.get(u.targetId)===null&&(s++,i.push(this.removeTargetData(e,u)))})).next((()=>C.waitFor(i))).next((()=>s))}forEachTarget(e,t){return Rs(e).ee(((n,s)=>{const i=no(this.serializer,s);t(i)}))}Fs(e){return h2(e).get(rc).next((t=>(U(t!==null,2888),t)))}Os(e,t){return h2(e).put(rc,t)}Ms(e,t){return Rs(e).put(bm(this.serializer,t))}Ns(e,t){let n=!1;return e.targetId>t.highestTargetId&&(t.highestTargetId=e.targetId,n=!0),e.sequenceNumber>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=e.sequenceNumber,n=!0),n}getTargetCount(e){return this.Fs(e).next((t=>t.targetCount))}getTargetData(e,t){const n=Kc(t),s=IDBKeyRange.bound([n,Number.NEGATIVE_INFINITY],[n,Number.POSITIVE_INFINITY]);let i=null;return Rs(e).ee({range:s,index:zp},((o,a,u)=>{const l=no(this.serializer,a);B1(t,l.target)&&(i=l,u.done())})).next((()=>i))}addMatchingKeys(e,t,n){const s=[],i=Zn(e);return t.forEach((o=>{const a=ht(o.path);s.push(i.put({targetId:n,path:a})),s.push(this.referenceDelegate.addReference(e,n,o))})),C.waitFor(s)}removeMatchingKeys(e,t,n){const s=Zn(e);
34return C.forEach(t,(i=>{const o=ht(i.path);return C.waitFor([s.delete([n,o]),this.referenceDelegate.removeReference(e,n,i)])}))}removeMatchingKeysForTargetId(e,t){const n=Zn(e),s=IDBKeyRange.bound([t],[t+1],!1,!0);return n.delete(s)}getMatchingKeysForTargetId(e,t){const n=IDBKeyRange.bound([t],[t+1],!1,!0),s=Zn(e);let i=ne();return s.ee({range:n,X:!0},((o,a,u)=>{const l=tn(o[1]),d=new B(l);i=i.add(d)})).next((()=>i))}containsKey(e,t){const n=ht(t.path),s=IDBKeyRange.bound([n],[kp(n)],!1,!0);let i=0;return Zn(e).ee({index:Zl,X:!0,range:s},(([o,a],u,l)=>{o!==0&&(i++,l.done())})).next((()=>i>0))}dt(e,t){return Rs(e).get(t).next((n=>n?no(this.serializer,n):null))}}function Rs(r){return Qe(r,Gs)}function h2(r){return Qe(r,Wr)}function Zn(r){return Qe(r,$s)}class Y8{constructor(e,t){this.db=e,this.garbageCollector=tm(this,t)}lr(e){const t=this.Ls(e);return this.db.getTargetCache().getTargetCount(e).next((n=>t.next((s=>n+s))))}Ls(e){let t=0;return this.Er(e,(n=>{t++})).next((()=>t))}forEachTarget(e,t){return this.db.getTargetCache().forEachTarget(e,t)}Er(e,t){return this.Bs(e,((n,s)=>t(s)))}addReference(e,t,n){return Oa(e,n)}removeReference(e,t,n){return Oa(e,n)}removeTargets(e,t,n){return this.db.getTargetCache().removeTargets(e,t,n)}markPotentiallyOrphaned(e,t){return Oa(e,t)}Us(e,t){return(function(s,i){let o=!1;return km(s).te((a=>Dm(s,a,i).next((u=>(u&&(o=!0),C.resolve(!u)))))).next((()=>o))})(e,t)}removeOrphanedDocuments(e,t){const n=this.db.getRemoteDocumentCache().newChangeBuffer(),s=[];let i=0;return this.Bs(e,((o,a)=>{if(a<=t){const u=this.Us(e,o).next((l=>{if(!l)return i++,n.getEntry(e,o).next((()=>(n.removeEntry(o,K.min()),Zn(e).delete((function(p){return[0,ht(p.path)]})(o)))))}));s.push(u)}})).next((()=>C.waitFor(s))).next((()=>n.apply(e))).next((()=>i))}removeTarget(e,t){const n=t.withSequenceNumber(e.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(e,n)}updateLimboDocument(e,t){return Oa(e,t)}Bs(e,t){const n=Zn(e);let s,i=wt.ce;return n.ee({index:Zl},(([o,a],{path:u,sequenceNumber:l})=>{o===0?(i!==wt.ce&&t(new B(tn(s)),i),i=l,s=u):i=wt.ce})).next((()=>{i!==wt.ce&&t(new B(tn(s)),i)}))}getCacheSize(e){return this.db.getRemoteDocumentCache().getSize(e)}}function Oa(r,e){return Zn(r).put((function(n,s){return{targetId:0,path:ht(n.path),sequenceNumber:s}})(e,r.currentSequenceNumber))}function xm(r,e){let t=e;for(const n of r.stages)t=J8({serializer:r.serializer,serverTimestampBehavior:r.listenOptions?.serverTimestampBehavior},n,t);return t}function Xc(r,e){return xm(r,[e]).length>0}function Lm(r,e){return Oe(r)?Xc(r,e):Uc(r,e)}function J8(r,e,t){if(e instanceof Yo)return(function(s,i,o){return o.filter((a=>a.isFoundDocument()&&`/${a.key.getCollectionPath().canonicalString()}`===i.Vr))})(0,e,t);if(e instanceof Xo)return(function(s,i,o){return o.filter((a=>{const u=go(X(i.condition).evaluate(s,a));return u!==void 0&&qt(u,Pt)}))})(r,e,t);if(e instanceof Jo)return(function(s,i,o){return o.filter((a=>a.isFoundDocument()&&a.key.getCollectionPath().lastSegment()===i.collectionId))})(0,e,t);if(e instanceof jc)return(function(s,i,o){return o.filter((a=>a.isFoundDocument()))})(0,0,t);if(e instanceof zc)return(function(s,i,o){return o.filter((a=>a.isFoundDocument()&&i.mr.has(a.key.path.toStringWithLeadingSlash())))})(0,e,t);if(e instanceof _r)return(function(s,i,o){return o.slice(0,i.limit)})(0,e,t);if(e instanceof rn)return(function(s,i,o){const a=i.orderings.map((u=>({ks:X(u.expr),direction:u.direction})));return[...o].sort(((u,l)=>{for(const{ks:d,direction:p}of a){const g=go(d.evaluate(s,u)),I=go(d.evaluate(s,l)),v=ft(g??cn,I??cn);if(v!==0)return p==="ascending"?v:-v}return 0}))})(r,e,t);throw new Error(`Unknown stage: ${e._name}`)}function Dl(r){const e=(function(n){for(let s=n.stages.length-1;s>=0;s--){const i=n.stages[s];if(i instanceof rn)return i.orderings}throw new Error("Pipeline must contain at least one Sort stage")})(r);return(t,n)=>{for(const s of e){const i=go(X(s.expr).evaluate({serializer:r.serializer},t)),o=go(X(s.expr).evaluate({serializer:r.serializer},n)),a=ft(i||cn,o||cn);if(a!==0)return s.direction==="ascending"?a:-a}return 0}}function Ku(r){for(let e=r.stages.length-1;e>=0;e--){const t=r.stages[e];if(t instanceof _r)return{limit:t.limit}}}class Mm{constructor(){this.changes=new Ln((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,Ce.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return n!==void 0?C.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}
vendor: 22,152 bytes, line 34
34assertNotApplied(){}}class X8{constructor(e){this.serializer=e}setIndexManager(e){this.indexManager=e}addEntry(e,t,n){return Wn(e).put(n)}removeEntry(e,t,n){return Wn(e).delete((function(i,o){const a=i.path.toArray();return[a.slice(0,a.length-2),a[a.length-2],dc(o),a[a.length-1]]})(t,n))}updateMetadata(e,t){return this.getMetadata(e).next((n=>(n.byteSize+=t,this.qs(e,n))))}getEntry(e,t){let n=Ce.newInvalidDocument(t);return Wn(e).ee({index:Ua,range:IDBKeyRange.only(Ki(t))},((s,i)=>{n=this.$s(t,i)})).next((()=>n))}Ks(e,t){let n={size:0,document:Ce.newInvalidDocument(t)};return Wn(e).ee({index:Ua,range:IDBKeyRange.only(Ki(t))},((s,i)=>{n={document:this.$s(t,i),size:pc(i)}})).next((()=>n))}getEntries(e,t){let n=qe();return this.Ws(e,t,((s,i)=>{const o=this.$s(s,i);n=n.insert(s,o)})).next((()=>n))}getAllEntries(e){let t=qe();return Wn(e).ee(((n,s)=>{const i=this.$s(B.fromSegments(s.prefixPath.concat(s.collectionGroup,s.documentId)),s);t=t.insert(i.key,i)})).next((()=>t))}Qs(e,t){let n=qe(),s=new Re(B.comparator);return this.Ws(e,t,((i,o)=>{const a=this.$s(i,o);n=n.insert(i,a),s=s.insert(i,pc(o))})).next((()=>({documents:n,Gs:s})))}Ws(e,t,n){if(t.isEmpty())return C.resolve();let s=new ye(p2);t.forEach((u=>s=s.add(u)));const i=IDBKeyRange.bound(Ki(s.first()),Ki(s.last())),o=s.getIterator();let a=o.getNext();return Wn(e).ee({index:Ua,range:i},((u,l,d)=>{const p=B.fromSegments([...l.prefixPath,l.collectionGroup,l.documentId]);for(;a&&p2(a,p)<0;)n(a,null),a=o.getNext();a&&a.isEqual(p)&&(n(a,l),a=o.hasNext()?o.getNext():null),a?d.j(Ki(a)):d.done()})).next((()=>{for(;a;)n(a,null),a=o.hasNext()?o.getNext():null}))}getDocumentsMatchingQuery(e,t,n,s,i){const o=Oe(t)?re.fromString(Zo(t)):t.path,a=[o.popLast().toArray(),o.lastSegment(),dc(n.readTime),n.documentKey.path.isEmpty()?"":n.documentKey.path.lastSegment()],u=[o.popLast().toArray(),o.lastSegment(),[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],""];return Wn(e).H(IDBKeyRange.bound(a,u,!0)).next((l=>{i?.incrementDocumentReadCount(l.length);let d=qe();for(const p of l){const g=this.$s(B.fromSegments(p.prefixPath.concat(p.collectionGroup,p.documentId)),p);g.isFoundDocument()&&(Lm(t,g)||s.has(g.key))&&(d=d.insert(g.key,g))}return d}))}getAllFromCollectionGroup(e,t,n,s){let i=qe();const o=f2(t,n),a=f2(t,Dt.max());return Wn(e).ee({index:jp,range:IDBKeyRange.bound(o,a,!0)},((u,l,d)=>{const p=this.$s(B.fromSegments(l.prefixPath.concat(l.collectionGroup,l.documentId)),l);i=i.insert(p.key,p),i.size===s&&d.done()})).next((()=>i))}newChangeBuffer(e){return new Z8(this,!!e&&e.trackRemovals)}getSize(e){return this.getMetadata(e).next((t=>t.byteSize))}getMetadata(e){return d2(e).get(fl).next((t=>(U(!!t,20021),t)))}qs(e,t){return d2(e).put(fl,t)}$s(e,t){if(t){const n=F8(this.serializer,t);if(!(n.isNoDocument()&&n.version.isEqual(K.min())))return n}return Ce.newInvalidDocument(e)}}function Fm(r){return new X8(r)}class Z8 extends Mm{constructor(e,t){super(),this.zs=e,this.trackRemovals=t,this.js=new Ln((n=>n.toString()),((n,s)=>n.isEqual(s)))}applyChanges(e){const t=[];let n=0,s=new ye(((i,o)=>Z(i.canonicalString(),o.canonicalString())));return this.changes.forEach(((i,o)=>{const a=this.js.get(i);if(t.push(this.zs.removeEntry(e,i,a.readTime)),o.isValidDocument()){const u=Xf(this.zs.serializer,o);s=s.add(i.path.popLast());const l=pc(u);n+=l-a.size,t.push(this.zs.addEntry(e,i,u))}else if(n-=a.size,this.trackRemovals){const u=Xf(this.zs.serializer,o.convertToNoDocument(K.min()));t.push(this.zs.addEntry(e,i,u))}})),s.forEach((i=>{t.push(this.zs.indexManager.addToCollectionParentIndex(e,i))})),t.push(this.zs.updateMetadata(e,n)),C.waitFor(t)}getFromCache(e,t){return this.zs.Ks(e,t).next((n=>(this.js.set(t,{size:n.size,readTime:n.document.readTime}),n.document)))}getAllFromCache(e,t){return this.zs.Qs(e,t).next((({documents:n,Gs:s})=>(s.forEach(((i,o)=>{this.js.set(i,{size:o,readTime:n.get(i).readTime})})),n)))}}function d2(r){return Qe(r,vo)}function Wn(r){return Qe(r,nc)}function Ki(r){const e=r.path.toArray();return[e.slice(0,e.length-2),e[e.length-2],e[e.length-1]]}function f2(r,e){const t=e.documentKey.path.toArray();return[r,dc(e.readTime),t.slice(0,t.length-2),t.length>0?t[t.length-1]:""]}function p2(r,e){const t=r.path.toArray(),n=e.path.toArray();let s=0;for(let i=0;i<t.length-2&&i<n.length-2;++i)if(s=Z(t[i],n[i]),s)return s;return s=Z(t.length,n.length),s||(s=Z(t[t.length-2],n[n.length-2]),s||Z(t[t.length-1],n[n.length-1]))}class e5{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class Um{constructor(e,t,n,s){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=s}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next((s=>(n=s,this.remoteDocumentCache.getEntry(e,t)))).next((s=>(n!==null&&ho(n.mutation,s,Tt.empty(),ge.now()),s)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((n=>this.getLocalViewOfDocuments(e,n,ne()).next((()=>n))))}getLocalViewOfDocuments(e,t,n=ne()){const s=Lt();return this.populateOverlays(e,s,t).next((()=>this.computeViews(e,t,s,n).next((i=>{let o=Ur();return i.forEach(((a,u)=>{o=o.insert(a,u.overlayedDocument)})),o}))))}getOverlayedDocuments(e,t){const n=Lt();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,ne())))}populateOverlays(e,t,n){const s=[];return n.forEach((i=>{t.has(i)||s.push(i)})),this.documentOverlayCache.getOverlays(e,s).next((i=>{i.forEach(((o,a)=>{t.set(o,a)}))}))}computeViews(e,t,n,s){let i=qe();const o=po(),a=(function(){return po()})();return t.forEach(((u,l)=>{const d=n.get(l.key);s.has(l.key)&&(d===void 0||d.mutation instanceof kn)?i=i.insert(l.key,l):d!==void 0?(o.set(l.key,d.mutation.getFieldMask()),ho(d.mutation,l,d.mutation.getFieldMask(),ge.now())):o.set(l.key,Tt.empty())})),this.recalculateAndSaveOverlays(e,i).next((u=>(u.forEach(((l,d)=>o.set(l,d))),t.forEach(((l,d)=>a.set(l,new e5(d,o.get(l)??null)))),a)))}recalculateAndSaveOverlays(e,t){const n=po();let s=new Re(((o,a)=>o-a)),i=ne();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((o=>{for(const a of o)a.keys().forEach((u=>{const l=t.get(u);if(l===null)return;let d=n.get(u)||Tt.empty();d=a.applyToLocalView(l,d),n.set(u,d);const p=(s.get(a.batchId)||ne()).add(u);s=s.insert(a.batchId,p)}))})).next((()=>{const o=[],a=s.getReverseIterator();for(;a.hasNext();){const u=a.getNext(),l=u.key,d=u.value,p=V6();d.forEach((g=>{if(!i.has(g)){const I=f6(t.get(g),n.get(g));I!==null&&p.set(g,I),i=i.add(g)}})),o.push(this.documentOverlayCache.saveOverlays(e,l,p))}return C.waitFor(o)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((n=>this.recalculateAndSaveOverlays(e,n)))}getDocumentsMatchingQuery(e,t,n,s){return Oe(t)?this.getDocumentsMatchingPipeline(e,t,n,s):p3(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):d1(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,s):this.getDocumentsMatchingCollectionQuery(e,t,n,s)}getNextDocuments(e,t,n,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,s).next((i=>{const o=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,s-i.size):C.resolve(Lt());let a=Ms,u=i;return o.next((l=>C.forEach(l,((d,p)=>(a<p.largestBatchId&&(a=p.largestBatchId),i.get(d)?C.resolve():this.remoteDocumentCache.getEntry(e,d).next((g=>{u=u.insert(d,g)}))))).next((()=>this.populateOverlays(e,l,i))).next((()=>this.computeViews(e,u,l,ne()))).next((d=>({batchId:a,changes:N6(d)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new B(t)).next((n=>{let s=Ur();return n.isFoundDocument()&&(s=s.insert(n.key,n)),s}))}getDocumentsMatchingCollectionGroupQuery(e,t,n,s){const i=t.collectionGroup;let o=Ur();return this.indexManager.getCollectionParents(e,i).next((a=>C.forEach(a,(u=>{const l=(function(p,g){return new xn(g,null,p.explicitOrderBy.slice(),p.filters.slice(),p.limit,p.limitType,p.startAt,p.endAt)})(t,u.child(i));return this.getDocumentsMatchingCollectionQuery(e,l,n,s).next((d=>{d.forEach(((p,g)=>{o=o.insert(p,g)}))}))})).next((()=>o))))}getDocumentsMatchingCollectionQuery(e,t,n,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,s)))).next((o=>this.retrieveMatchingLocalDocuments(i,o,(a=>Uc(t,a)))))}getDocumentsMatchingPipeline(e,t,n,s){if(Rn(t)==="collection_group"){const i=D1(t);let o=Ur();return this.indexManager.getCollectionParents(e,i).next((a=>C.forEach(a,(u=>{const l=(function(p,g){const I=p.stages.map((v=>v instanceof Jo?new Yo(g.canonicalString(),{}):v));return new lt(p.serializer,I)})(t,u.child(i));return this.getDocumentsMatchingPipeline(e,l,n,s).next((d=>{d.forEach(((p,g)=>{o=o.insert(p,g)}))}))})).next((()=>o))))}{let i;return this.getOverlaysForPipeline(e,t,n.largestBatchId).next((o=>{switch(i=o,Rn(t)){case"collection":return this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,s);case"documents":let a=ne();for(const u of lc(t))a=a.add(B.fromPath(u));return this.remoteDocumentCache.getEntries(e,a);case"database":return this.remoteDocumentCache.getAllEntries(e);default:throw new L("invalid-argument",`Invalid pipeline source to execute offline: ${vn(t)}`)}})).next((o=>this.retrieveMatchingLocalDocuments(i,o,(a=>Xc(t,a)))))}}retrieveMatchingLocalDocuments(e,t,n){e.forEach(((i,o)=>{const a=o.getKey();t.get(a)===null&&(t=t.insert(a,Ce.newInvalidDocument(a)))}));let s=Ur();return t.forEach(((i,o)=>{const a=e.get(i);a!==void 0&&ho(a.mutation,o,Tt.empty(),ge.now()),n(o)&&(s=s.insert(i,o))})),s}getOverlaysForPipeline(e,t,n){switch(Rn(t)){case"collection":return this.documentOverlayCache.getOverlaysForCollection(e,re.fromString(Zo(t)),n);case"collection_group":throw new L("invalid-argument",`Unexpected collection group pipeline: ${vn(t)}`);case"documents":return this.documentOverlayCache.getOverlays(e,lc(t).map((s=>B.fromPath(s))));case"database":return this.documentOverlayCache.getAllOverlays(e,n);default:throw new L("invalid-argument",`Failed to get overlays for pipeline: ${vn(t)}`)}}}class t5{constructor(e){this.serializer=e,this.Hs=new Map,this.Js=new Map}getBundleMetadata(e,t){return C.resolve(this.Hs.get(t))}saveBundleMetadata(e,t){return this.Hs.set(t.id,(function(s){return{id:s.id,version:s.version,createTime:Me(s.createTime)}})(t)),C.resolve()}getNamedQuery(e,t){return C.resolve(this.Js.get(t))}saveNamedQuery(e,t){return this.Js.set(t.name,(function(s){return{name:s.name,query:Qc(s.bundledQuery),readTime:Me(s.readTime)}})(t)),C.resolve()}}class n5{constructor(){this.overlays=new Re(B.comparator),this.Ys=new Map}getOverlay(e,t){return C.resolve(this.overlays.get(t))}getOverlays(e,t){const n=Lt();return C.forEach(t,(s=>this.getOverlay(e,s).next((i=>{i!==null&&n.set(s,i)})))).next((()=>n))}getAllOverlays(e,t){const n=Lt();return this.overlays.forEach(((s,i)=>{i.largestBatchId>t&&n.set(s,i)})),C.resolve(n)}saveOverlays(e,t,n){return n.forEach(((s,i)=>{this.Hr(e,t,i)})),C.resolve()}removeOverlaysForBatchId(e,t,n){const s=this.Ys.get(n);return s!==void 0&&(s.forEach((i=>this.overlays=this.overlays.remove(i))),this.Ys.delete(n)),C.resolve()}getOverlaysForCollection(e,t,n){const s=Lt(),i=t.length+1,o=new B(t.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const u=a.getNext().value,l=u.getKey();if(!t.isPrefixOf(l.path))break;l.path.length===i&&u.largestBatchId>n&&s.set(u.getKey(),u)}return C.resolve(s)}getOverlaysForCollectionGroup(e,t,n,s){let i=new Re(((l,d)=>l-d));const o=this.overlays.getIterator();for(;o.hasNext();){const l=o.getNext().value;if(l.getKey().getCollectionGroup()===t&&l.largestBatchId>n){let d=i.get(l.largestBatchId);d===null&&(d=Lt(),i=i.insert(l.largestBatchId,d)),d.set(l.getKey(),l)}}const a=Lt(),u=i.getIterator();for(;u.hasNext()&&(u.getNext().value.forEach(((l,d)=>a.set(l,d))),!(a.size()>=s)););return C.resolve(a)}Hr(e,t,n){const s=this.overlays.get(n.key);if(s!==null){const o=this.Ys.get(s.largestBatchId).delete(n.key);this.Ys.set(s.largestBatchId,o)}this.overlays=this.overlays.insert(n.key,new $1(t,n));let i=this.Ys.get(t);i===void 0&&(i=ne(),this.Ys.set(t,i)),this.Ys.set(t,i.add(n.key))}}class r5{constructor(){this.sessionToken=Se.EMPTY_BYTE_STRING}getSessionToken(e){return C.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,C.resolve()}}class H1{constructor(){this.Zs=new ye(Ze.Xs),this.e_=new ye(Ze.t_)}isEmpty(){return this.Zs.isEmpty()}addReference(e,t){const n=new Ze(e,t);this.Zs=this.Zs.add(n),this.e_=this.e_.add(n)}n_(e,t){e.forEach((n=>this.addReference(n,t)))}removeReference(e,t){this.r_(new Ze(e,t))}i_(e,t){e.forEach((n=>this.removeReference(n,t)))}s_(e){const t=new B(new re([])),n=new Ze(t,e),s=new Ze(t,e+1),i=[];return this.e_.forEachInRange([n,s],(o=>{this.r_(o),i.push(o.key)})),i}__(){this.Zs.forEach((e=>this.r_(e)))}r_(e){this.Zs=this.Zs.delete(e),this.e_=this.e_.delete(e)}o_(e){const t=new B(new re([])),n=new Ze(t,e),s=new Ze(t,e+1);let i=ne();return this.e_.forEachInRange([n,s],(o=>{i=i.add(o.key)})),i}containsKey(e){const t=new Ze(e,0),n=this.Zs.firstAfterOrEqual(t);return n!==null&&e.isEqual(n.key)}}class Ze{constructor(e,t){this.key=e,this.a_=t}static Xs(e,t){return B.comparator(e.key,t.key)||Z(e.a_,t.a_)}static t_(e,t){return Z(e.a_,t.a_)||B.comparator(e.key,t.key)}}class s5{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.gs=1,this.u_=new ye(Ze.Xs)}checkEmpty(e){return C.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,n,s){const i=this.gs;this.gs++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new q1(i,t,n,s);this.mutationQueue.push(o);for(const a of s)this.u_=this.u_.add(new Ze(a.key,i)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return C.resolve(o)}lookupMutationBatch(e,t){return C.resolve(this.c_(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,s=this.l_(n),i=s<0?0:s;return C.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return C.resolve(this.mutationQueue.length===0?or:this.gs-1)}getAllMutationBatches(e){return C.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new Ze(t,0),s=new Ze(t,Number.POSITIVE_INFINITY),i=[];return this.u_.forEachInRange([n,s],(o=>{const a=this.c_(o.a_);i.push(a)})),C.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new ye(Z);return t.forEach((s=>{const i=new Ze(s,0),o=new Ze(s,Number.POSITIVE_INFINITY);this.u_.forEachInRange([i,o],(a=>{n=n.add(a.a_)}))})),C.resolve(this.E_(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,s=n.length+1;let i=n;B.isDocumentKey(i)||(i=i.child(""));const o=new Ze(new B(i),0);let a=new ye(Z);return this.u_.forEachWhile((u=>{const l=u.key.path;return!!n.isPrefixOf(l)&&(l.length===s&&(a=a.add(u.a_)),!0)}),o),C.resolve(this.E_(a))}E_(e){const t=[];return e.forEach((n=>{const s=this.c_(n);s!==null&&t.push(s)})),t}removeMutationBatch(e,t){U(this.h_(t.batchId,"removed")===0,55003),this.mutationQueue.shift();let n=this.u_;return C.forEach(t.mutations,(s=>{const i=new Ze(s.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)})).next((()=>{this.u_=n}))}bs(e){}containsKey(e,t){const n=new Ze(t,0),s=this.u_.firstAfterOrEqual(n);return C.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,C.resolve()}h_(e,t){return this.l_(e)}l_(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}c_(e){const t=this.l_(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class i5{constructor(e){this.T_=e,this.docs=(function(){return new Re(B.comparator)})(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,s=this.docs.get(n),i=s?s.size:0,o=this.T_(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:o}),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return C.resolve(n?n.document.mutableCopy():Ce.newInvalidDocument(t))}getEntries(e,t){let n=qe();return t.forEach((s=>{const i=this.docs.get(s);n=n.insert(s,i?i.document.mutableCopy():Ce.newInvalidDocument(s))})),C.resolve(n)}getAllEntries(e){let t=qe();return this.docs.forEach(((n,s)=>{t=t.insert(n,s.document)})),C.resolve(t)}getDocumentsMatchingQuery(e,t,n,s){let i,o;Oe(t)?(i=re.fromString(Zo(t)),o=d=>Xc(t,d)):(i=t.path,o=d=>Uc(t,d));let a=qe();const u=new B(i.child("__id-9223372036854775808__")),l=this.docs.getIteratorFrom(u);for(;l.hasNext();){const{key:d,value:{document:p}}=l.getNext();if(!i.isPrefixOf(d.path))break;d.path.length>i.length+1||Jl(Fp(p),n)<=0||(s.has(p.key)||o(p))&&(a=a.insert(p.key,p.mutableCopy()))}return C.resolve(a)}getAllFromCollectionGroup(e,t,n,s){H(9500)}P_(e,t){return C.forEach(this.docs,(n=>t(n)))}newChangeBuffer(e){return new o5(this)}getSize(e){return C.resolve(this.size)}}class o5 extends Mm{constructor(e){super(),this.zs=e}applyChanges(e){const t=[];return this.changes.forEach(((n,s)=>{s.isValidDocument()?t.push(this.zs.addEntry(e,s)):this.zs.removeEntry(n)})),C.waitFor(t)}getFromCache(e,t){return this.zs.getEntry(e,t)}getAllFromCache(e,t){return this.zs.getEntries(e,t)}}class a5{constructor(e){this.persistence=e,this.R_=new Ln((t=>Kc(t)),B1),this.lastRemoteSnapshotVersion=K.min(),this.highestTargetId=0,this.I_=0,this.A_=new H1,this.targetCount=0,this.V_=Vn.xs()}forEachTarget(e,t){return this.R_.forEach(((n,s)=>t(s))),C.resolve()}getLastRemoteSnapshotVersion(e){return C.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return C.resolve(this.I_)}allocateTargetId(e){return this.highestTargetId=this.V_.next(),C.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.I_&&(this.I_=t),C.resolve()}Ms(e){this.R_.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.V_=new Vn(t),this.highestTargetId=t),e.sequenceNumber>this.I_&&(this.I_=e.sequenceNumber)}addTargetData(e,t){return this.Ms(t),this.targetCount+=1,C.resolve()}updateTargetData(e,t){return this.Ms(t),C.resolve()}removeTargetData(e,t){return this.R_.delete(t.target),this.A_.s_(t.targetId),this.targetCount-=1,C.resolve()}removeTargets(e,t,n){let s=0;const i=[];return this.R_.forEach(((o,a)=>{a.sequenceNumber<=t&&n.get(a.targetId)===null&&(this.R_.delete(o),i.push(this.removeMatchingKeysForTargetId(e,a.targetId)),s++)})),C.waitFor(i).next((()=>s))}getTargetCount(e){return C.resolve(this.targetCount)}getTargetData(e,t){const n=this.R_.get(t)||null;return C.resolve(n)}addMatchingKeys(e,t,n){return this.A_.n_(t,n),C.resolve()}removeMatchingKeys(e,t,n){this.A_.i_(t,n);const s=this.persistence.referenceDelegate,i=[];return s&&t.forEach((o=>{i.push(s.markPotentiallyOrphaned(e,o))})),C.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.A_.s_(t),C.resolve()}getMatchingKeysForTargetId(e,t){const n=this.A_.o_(t);return C.resolve(n)}containsKey(e,t){return C.resolve(this.A_.containsKey(t))}}class W1{constructor(e,t){this.d_={},this.overlays={},this.f_=new wt(0),this.m_=!1,this.m_=!0,this.p_=new r5,this.referenceDelegate=e(this),this.g_=new a5(this),this.indexManager=new W8,this.remoteDocumentCache=(function(s){return new i5(s)})((n=>this.referenceDelegate.y_(n))),this.serializer=new Cm(t),this.w_=new t5(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.m_=!1,Promise.resolve()}get started(){return this.m_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new n5,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.d_[e.toKey()];return n||(n=new s5(t,this.referenceDelegate),this.d_[e.toKey()]=n),n}getGlobalsCache(){return this.p_}getTargetCache(){return this.g_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.w_}runTransaction(e,t,n){M("MemoryPersistence","Starting transaction:",e);const s=new c5(this.f_.next());return this.referenceDelegate.b_(),n(s).next((i=>this.referenceDelegate.v_(s).next((()=>i)))).toPromise().then((i=>(s.raiseOnCommittedEvent(),i)))}S_(e,t){return C.or(Object.values(this.d_).map((n=>()=>n.containsKey(e,t))))}}class c5 extends Bp{constructor(e){super(),this.currentSequenceNumber=e}}class Zc{constructor(e){this.persistence=e,this.D_=new H1,this.x_=null}static C_(e){return new Zc(e)}get F_(){if(this.x_)return this.x_;throw H(60996)}addReference(e,t,n){return this.D_.addReference(n,t),this.F_.delete(n.toString()),C.resolve()}removeReference(e,t,n){return this.D_.removeReference(n,t),this.F_.add(n.toString()),C.resolve()}markPotentiallyOrphaned(e,t){return this.F_.add(t.toString()),C.resolve()}removeTarget(e,t){this.D_.s_(t.targetId).forEach((s=>this.F_.add(s.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((s=>{s.forEach((i=>this.F_.add(i.toString())))})).next((()=>n.removeTargetData(e,t)))}b_(){this.x_=new Set}v_(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return C.forEach(this.F_,(n=>{const s=B.fromPath(n);return this.O_(e,s).next((i=>{i||t.removeEntry(s,K.min())}))})).next((()=>(this.x_=null,t.apply(e))))}updateLimboDocument(e,t){return this.O_(e,t).next((n=>{n?this.F_.delete(t.toString()):this.F_.add(t.toString())}))}y_(e){return 0}O_(e,t){return C.or([()=>C.resolve(this.D_.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.S_(e,t)])}}class mc{constructor(e,t){this.persistence=e,this.M_=new Ln((n=>ht(n.path)),((n,s)=>n.isEqual(s))),this.garbageCollector=tm(this,t)}static C_(e,t){return new mc(e,t)}b_(){}v_(e){return C.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}lr(e){const t=this.Ls(e);return this.persistence.getTargetCache().getTargetCount(e).next((n=>t.next((s=>n+s))))}Ls(e){let t=0;return this.Er(e,(n=>{t++})).next((()=>t))}
34Er(e,t){return C.forEach(this.M_,((n,s)=>this.Us(e,n,s).next((i=>i?C.resolve():t(s)))))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0;const s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.P_(e,(o=>this.Us(e,o,t).next((a=>{a||(n++,i.removeEntry(o,K.min()))})))).next((()=>i.apply(e))).next((()=>n))}markPotentiallyOrphaned(e,t){return this.M_.set(t,e.currentSequenceNumber),C.resolve()}removeTarget(e,t){const n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.M_.set(n,e.currentSequenceNumber),C.resolve()}removeReference(e,t,n){return this.M_.set(n,e.currentSequenceNumber),C.resolve()}updateLimboDocument(e,t){return this.M_.set(t,e.currentSequenceNumber),C.resolve()}y_(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=Ba(e.data.value)),t}Us(e,t,n){return C.or([()=>this.persistence.S_(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const s=this.M_.get(t);return C.resolve(s!==void 0&&s>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}class u5{constructor(e){this.serializer=e}U(e,t,n,s){const i=new Oc("createOrUpgrade",t);n<1&&s>=1&&((function(u){u.createObjectStore(jo)})(e),(function(u){u.createObjectStore(Ro,{keyPath:A_}),u.createObjectStore(jt,{keyPath:If,autoIncrement:!0}).createIndex($r,wf,{unique:!0}),u.createObjectStore(qs)})(e),m2(e),(function(u){u.createObjectStore(Mr)})(e));let o=C.resolve();return n<3&&s>=3&&(n!==0&&((function(u){u.deleteObjectStore($s),u.deleteObjectStore(Gs),u.deleteObjectStore(Wr)})(e),m2(e)),o=o.next((()=>(function(u){const l=u.store(Wr),d={highestTargetId:0,highestListenSequenceNumber:0,lastRemoteSnapshotVersion:K.min().toTimestamp(),targetCount:0};return l.put(rc,d)})(i)))),n<4&&s>=4&&(n!==0&&(o=o.next((()=>(function(u,l){return l.store(jt).H().next((p=>{u.deleteObjectStore(jt),u.createObjectStore(jt,{keyPath:If,autoIncrement:!0}).createIndex($r,wf,{unique:!0});const g=l.store(jt),I=p.map((v=>g.put(v)));return C.waitFor(I)}))})(e,i)))),o=o.next((()=>{(function(u){u.createObjectStore(js,{keyPath:O_})})(e)}))),n<5&&s>=5&&(o=o.next((()=>this.N_(i)))),n<6&&s>=6&&(o=o.next((()=>((function(u){u.createObjectStore(vo)})(e),this.L_(i))))),n<7&&s>=7&&(o=o.next((()=>this.B_(i)))),n<8&&s>=8&&(o=o.next((()=>this.U_(e,i)))),n<9&&s>=9&&(o=o.next((()=>{(function(u){u.objectStoreNames.contains("remoteDocumentChanges")&&u.deleteObjectStore("remoteDocumentChanges")})(e)}))),n<10&&s>=10&&(o=o.next((()=>this.k_(i)))),n<11&&s>=11&&(o=o.next((()=>{(function(u){u.createObjectStore(Dc,{keyPath:D_})})(e),(function(u){u.createObjectStore(kc,{keyPath:k_})})(e)}))),n<12&&s>=12&&(o=o.next((()=>{(function(u){const l=u.createObjectStore(xc,{keyPath:q_});l.createIndex(ml,G_,{unique:!1}),l.createIndex(Kp,$_,{unique:!1})})(e)}))),n<13&&s>=13&&(o=o.next((()=>(function(u){const l=u.createObjectStore(nc,{keyPath:v_});l.createIndex(Ua,S_),l.createIndex(jp,P_)})(e))).next((()=>this.q_(e,i))).next((()=>e.deleteObjectStore(Mr)))),n<14&&s>=14&&(o=o.next((()=>this.K_(e,i)))),n<15&&s>=15&&(o=o.next((()=>(function(u){u.createObjectStore(e1,{keyPath:x_,autoIncrement:!0}).createIndex(pl,L_,{unique:!1}),u.createObjectStore(co,{keyPath:M_}).createIndex(Hp,F_,{unique:!1}),u.createObjectStore(uo,{keyPath:U_}).createIndex(Wp,B_,{unique:!1})})(e)))),n<16&&s>=16&&(o=o.next((()=>{t.objectStore(co).clear()})).next((()=>{t.objectStore(uo).clear()}))),n<17&&s>=17&&(o=o.next((()=>{(function(u){u.createObjectStore(t1,{keyPath:j_})})(e)}))),n<18&&s>=18&&yp()&&(o=o.next((()=>{t.objectStore(co).clear()})).next((()=>{t.objectStore(uo).clear()}))),o}L_(e){let t=0;return e.store(Mr).ee(((n,s)=>{t+=pc(s)})).next((()=>{const n={byteSize:t};return e.store(vo).put(fl,n)}))}N_(e){const t=e.store(Ro),n=e.store(jt);return t.H().next((s=>C.forEach(s,(i=>{const o=IDBKeyRange.bound([i.userId,or],[i.userId,i.lastAcknowledgedBatchId]);return n.H($r,o).next((a=>C.forEach(a,(u=>{U(u.userId===i.userId,18650,"Cannot process batch from unexpected user",{batchId:u.batchId});const l=Br(this.serializer,u);return Om(e,i.userId,l).next((()=>{}))}))))}
vendor: 14,963 bytes, line 34
34))))}B_(e){const t=e.store($s),n=e.store(Mr);return e.store(Wr).get(rc).next((s=>{const i=[];return n.ee(((o,a)=>{const u=new re(o),l=(function(p){return[0,ht(p)]})(u);i.push(t.get(l).next((d=>d?C.resolve():(p=>t.put({targetId:0,path:ht(p),sequenceNumber:s.highestListenSequenceNumber}))(u))))})).next((()=>C.waitFor(i)))}))}U_(e,t){e.createObjectStore(So,{keyPath:V_});const n=t.store(So),s=new z1,i=o=>{if(s.add(o)){const a=o.lastSegment(),u=o.popLast();return n.put({collectionId:a,parent:ht(u)})}};return t.store(Mr).ee({X:!0},((o,a)=>{const u=new re(o);return i(u.popLast())})).next((()=>t.store(qs).ee({X:!0},(([o,a,u],l)=>{const d=tn(a);return i(d.popLast())}))))}k_(e){const t=e.store(Gs);return t.ee(((n,s)=>{const i=no(this.serializer,s),o=bm(this.serializer,i);return t.put(o)}))}q_(e,t){const n=t.store(Mr),s=[];return n.ee(((i,o)=>{const a=t.store(nc),u=(function(p){return p.document?new B(re.fromString(p.document.name).popFirst(5)):p.noDocument?B.fromSegments(p.noDocument.path):p.unknownDocument?B.fromSegments(p.unknownDocument.path):H(36783)})(o).path.toArray(),l={prefixPath:u.slice(0,u.length-2),collectionGroup:u[u.length-2],documentId:u[u.length-1],readTime:o.readTime||[0,0],unknownDocument:o.unknownDocument,noDocument:o.noDocument,document:o.document,hasCommittedMutations:!!o.hasCommittedMutations};s.push(a.put(l))})).next((()=>C.waitFor(s)))}K_(e,t){const n=t.store(jt),s=Fm(this.serializer),i=new W1(Zc.C_,this.serializer.zr);return n.H().next((o=>{const a=new Map;return o.forEach((u=>{let l=a.get(u.userId)??ne();Br(this.serializer,u).keys().forEach((d=>l=l.add(d))),a.set(u.userId,l)})),C.forEach(a,((u,l)=>{const d=new et(l),p=Yc.jr(this.serializer,d),g=i.getIndexManager(d),I=Jc.jr(d,this.serializer,g,i.referenceDelegate);return new Um(s,I,p,g).recalculateAndSaveOverlaysForDocumentKeys(new gl(t,wt.ce),u).next()}))}))}}function m2(r){r.createObjectStore($s,{keyPath:b_}).createIndex(Zl,N_,{unique:!0}),r.createObjectStore(Gs,{keyPath:"targetId"}).createIndex(zp,C_,{unique:!0}),r.createObjectStore(Wr)}const Kn="IndexedDbPersistence",Qu=18e5,Yu=5e3,Ju="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",Bm="main";class K1{constructor(e,t,n,s,i,o,a,u,l,d,p=18){if(this.allowTabSynchronization=e,this.persistenceKey=t,this.clientId=n,this.Tn=i,this.window=o,this.document=a,this.W_=l,this.Q_=d,this.G_=p,this.f_=null,this.m_=!1,this.isPrimary=!1,this.networkEnabled=!0,this.z_=null,this.inForeground=!1,this.j_=null,this.H_=null,this.J_=Number.NEGATIVE_INFINITY,this.Y_=g=>Promise.resolve(),!K1.C())throw new L(N.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new Y8(this,s),this.Z_=t+Bm,this.serializer=new Cm(u),this.X_=new an(this.Z_,this.G_,new u5(this.serializer)),this.p_=new q8,this.g_=new Q8(this.referenceDelegate,this.serializer),this.remoteDocumentCache=Fm(this.serializer),this.w_=new B8,this.window&&this.window.localStorage?this.eo=this.window.localStorage:(this.eo=null,d===!1&&Le(Kn,"LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}start(){return this.no().then((()=>{if(!this.isPrimary&&!this.allowTabSynchronization)throw new L(N.FAILED_PRECONDITION,Ju);return this.ro(),this.io(),this.so(),this.runTransaction("getHighestListenSequenceNumber","readonly",(e=>this.g_.getHighestSequenceNumber(e)))})).then((e=>{this.f_=new wt(e,this.W_)})).then((()=>{this.m_=!0})).catch((e=>(this.X_&&this.X_.close(),Promise.reject(e))))}_o(e){return this.Y_=async t=>{if(this.started)return e(t)},e(this.isPrimary)}setDatabaseDeletedListener(e){this.X_.q((async t=>{t.newVersion===null&&await e()}))}setNetworkEnabled(e){this.networkEnabled!==e&&(this.networkEnabled=e,this.Tn.enqueueAndForget((async()=>{this.started&&await this.no()})))}no(){return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",(e=>Da(e).put({clientId:this.clientId,updateTimeMs:Date.now(),networkEnabled:this.networkEnabled,inForeground:this.inForeground}).next((()=>{if(this.isPrimary)return this.oo(e).next((t=>{t||(this.isPrimary=!1,this.Tn.enqueueRetryable((()=>this.Y_(!1))))}))})).next((()=>this.ao(e))).next((t=>this.isPrimary&&!t?this.uo(e).next((()=>!1)):!!t&&this.co(e).next((()=>!0)))))).catch((e=>{if(Rr(e))return M(Kn,"Failed to extend owner lease: ",e),this.isPrimary;if(!this.allowTabSynchronization)throw e;return M(Kn,"Releasing owner lease after error during lease refresh",e),!1})).then((e=>{this.isPrimary!==e&&this.Tn.enqueueRetryable((()=>this.Y_(e))),this.isPrimary=e}))}oo(e){return Qi(e).get(ys).next((t=>C.resolve(this.lo(t))))}Eo(e){return Da(e).delete(this.clientId)}async ho(){if(this.isPrimary&&!this.To(this.J_,Qu)){this.J_=Date.now();const e=await this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",(t=>{const n=Qe(t,js);return n.H().next((s=>{const i=this.Po(s,Qu),o=s.filter((a=>i.indexOf(a)===-1));return C.forEach(o,(a=>n.delete(a.clientId))).next((()=>o))}))})).catch((()=>[]));if(this.eo)for(const t of e)this.eo.removeItem(this.Ro(t.clientId))}}so(){this.H_=this.Tn.enqueueAfterDelay("client_metadata_refresh",4e3,(()=>this.no().then((()=>this.ho())).then((()=>this.so()))))}lo(e){return!!e&&e.ownerId===this.clientId}ao(e){return this.Q_?C.resolve(!0):Qi(e).get(ys).next((t=>{if(t!==null&&this.To(t.leaseTimestampMs,Yu)&&!this.Io(t.ownerId)){if(this.lo(t)&&this.networkEnabled)return!0;if(!this.lo(t)){if(!t.allowTabSynchronization)throw new L(N.FAILED_PRECONDITION,Ju);return!1}}return!(!this.networkEnabled||!this.inForeground)||Da(e).H().next((n=>this.Po(n,Yu).find((s=>{if(this.clientId!==s.clientId){const i=!this.networkEnabled&&s.networkEnabled,o=!this.inForeground&&s.inForeground,a=this.networkEnabled===s.networkEnabled;if(i||o&&a)return!0}return!1}))===void 0))})).next((t=>(this.isPrimary!==t&&M(Kn,`Client ${t?"is":"is not"} eligible for a primary lease.`),t)))}async shutdown(){this.m_=!1,this.Ao(),this.H_&&(this.H_.cancel(),this.H_=null),this.Vo(),this.fo(),await this.X_.runTransaction("shutdown","readwrite",[jo,js],(e=>{const t=new gl(e,wt.ce);return this.uo(t).next((()=>this.Eo(t)))})),this.X_.close(),this.mo()}Po(e,t){return e.filter((n=>this.To(n.updateTimeMs,t)&&!this.Io(n.clientId)))}po(){return this.runTransaction("getActiveClients","readonly",(e=>Da(e).H().next((t=>this.Po(t,Qu).map((n=>n.clientId))))))}get started(){return this.m_}getGlobalsCache(){return this.p_}getMutationQueue(e,t){return Jc.jr(e,this.serializer,t,this.referenceDelegate)}getTargetCache(){return this.g_}getRemoteDocumentCache(){return this.remoteDocumentCache}getIndexManager(e){return new K8(e,this.serializer.zr.databaseId)}getDocumentOverlayCache(e){return Yc.jr(this.serializer,e)}getBundleCache(){return this.w_}runTransaction(e,t,n){M(Kn,"Starting transaction:",e);const s=t==="readonly"?"readonly":"readwrite",i=(function(u){return u===18?W_:u===17?Xp:u===16?H_:u===15?n1:u===14?Jp:u===13?Yp:u===12?z_:u===11?Qp:void H(60245)})(this.G_);let o;return this.X_.runTransaction(e,s,i,(a=>(o=new gl(a,this.f_?this.f_.next():wt.ce),t==="readwrite-primary"?this.oo(o).next((u=>!!u||this.ao(o))).next((u=>{if(!u)throw Le(`Failed to obtain primary lease for action '${e}'.`),this.isPrimary=!1,this.Tn.enqueueRetryable((()=>this.Y_(!1))),new L(N.FAILED_PRECONDITION,Up);return n(o)})).next((u=>this.co(o).next((()=>u)))):this.yo(o).next((()=>n(o)))))).then((a=>(o.raiseOnCommittedEvent(),a)))}yo(e){return Qi(e).get(ys).next((t=>{if(t!==null&&this.To(t.leaseTimestampMs,Yu)&&!this.Io(t.ownerId)&&!this.lo(t)&&!(this.Q_||this.allowTabSynchronization&&t.allowTabSynchronization))throw new L(N.FAILED_PRECONDITION,Ju)}))}co(e){const t={ownerId:this.clientId,allowTabSynchronization:this.allowTabSynchronization,leaseTimestampMs:Date.now()};return Qi(e).put(ys,t)}static C(){return an.C()}uo(e){const t=Qi(e);return t.get(ys).next((n=>this.lo(n)?(M(Kn,"Releasing primary lease."),t.delete(ys)):C.resolve()))}To(e,t){const n=Date.now();return!(e<n-t)&&(!(e>n)||(Le(`Detected an update time that is in the future: ${e} > ${n}`),!1))}ro(){this.document!==null&&typeof this.document.addEventListener=="function"&&(this.j_=()=>{this.Tn.enqueueAndForget((()=>(this.inForeground=this.document.visibilityState==="visible",this.no())))},this.document.addEventListener("visibilitychange",this.j_),this.inForeground=this.document.visibilityState==="visible")}Vo(){this.j_&&(this.document.removeEventListener("visibilitychange",this.j_),this.j_=null)}io(){typeof this.window?.addEventListener=="function"&&(this.z_=()=>{this.Ao();const e=/(?:Version|Mobile)\/1[456]/;_p()&&(navigator.appVersion.match(e)||navigator.userAgent.match(e))&&this.Tn.enterRestrictedMode(!0),this.Tn.enqueueAndForget((()=>this.shutdown()))},this.window.addEventListener("pagehide",this.z_))}fo(){this.z_&&(this.window.removeEventListener("pagehide",this.z_),this.z_=null)}Io(e){try{const t=this.eo?.getItem(this.Ro(e))!==null;return M(Kn,`Client '${e}' ${t?"is":"is not"} zombied in LocalStorage`),t}catch(t){return Le(Kn,"Failed to get zombied client id.",t),!1}}Ao(){if(this.eo)try{this.eo.setItem(this.Ro(this.clientId),String(Date.now()))}catch(e){Le("Failed to set zombie client id.",e)}}mo(){if(this.eo)try{this.eo.removeItem(this.Ro(this.clientId))}catch{}}Ro(e){return`firestore_zombie_${this.persistenceKey}_${e}`}}function Qi(r){return Qe(r,jo)}function Da(r){return Qe(r,js)}function Q1(r,e){let t=r.projectId;return r.isDefaultDatabase||(t+="."+r.database),"firestore/"+e+"/"+t+"/"}class Y1{constructor(e,t,n,s){this.targetId=e,this.fromCache=t,this.wo=n,this.bo=s}static vo(e,t){let n=ne(),s=ne();for(const i of t.docChanges)switch(i.type){case 0:n=n.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new Y1(e,t.fromCache,n,s)}}function l5(r,e){return B.comparator(r.key,e.key)}class h5{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class qm{constructor(){this.So=!1,this.Do=!1,this.xo=100,this.Co=(function(){return _p()?8:qp(He())>0?6:4})()}initialize(e,t){this.Fo=e,this.indexManager=t,this.So=!0}getDocumentsMatchingQuery(e,t,n,s){const i={result:null};return this.Oo(e,t).next((o=>{i.result=o})).next((()=>{if(!i.result)return this.Mo(e,t,s,n).next((o=>{i.result=o}))})).next((()=>{if(i.result)return;const o=new h5;return this.No(e,t,o).next((a=>{if(i.result=a,this.Do)return this.Lo(e,t,o,a.size)}))})).next((()=>i.result))}Lo(e,t,n,s){return Oe(t)?C.resolve():n.documentReadCount<this.xo?(vs()<=ce.DEBUG&&M("QueryEngine","SDK will not create cache indexes for query:",fo(t),"since it only creates cache indexes for collection contains","more than or equal to",this.xo,"documents"),C.resolve()):(vs()<=ce.DEBUG&&M("QueryEngine","Query:",fo(t),"scans",n.documentReadCount,"local documents and returns",s,"documents as results."),n.documentReadCount>this.Co*s?(vs()<=ce.DEBUG&&M("QueryEngine","The SDK decides to create cache indexes for query:",fo(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,dt(t))):C.resolve())}Oo(e,t){if(Oe(t))return C.resolve(null);let n=t;if(xf(n))return C.resolve(null);let s=dt(n);return this.indexManager.getIndexType(e,s).next((i=>i===0?null:(n.limit!==null&&i===1&&(n=cc(n,null,"F"),s=dt(n)),this.indexManager.getDocumentsMatchingTarget(e,s).next((o=>{const a=ne(...o);return this.Fo.getDocuments(e,a).next((u=>this.indexManager.getMinOffset(e,s).next((l=>{const d=this.Bo(n,u);return this.Uo(n,d,a,l.readTime)?this.Oo(e,cc(n,null,"F")):this.ko(e,d,n,l)}))))})))))}Mo(e,t,n,s){return(Oe(t)?(function(o){for(const a of o.stages){if(a instanceof _r||a instanceof Yf)return!1;if(a instanceof Xo){if(a.condition instanceof mm&&a.condition._expr.name==="exists"&&a.condition._expr.params[0]instanceof ds&&a.condition._expr.params[0].fieldName===en)continue;return!1}}return!0})(t):xf(t))||s.isEqual(K.min())?C.resolve(null):this.Fo.getDocuments(e,n).next((i=>{const o=this.Bo(t,i);return this.Uo(t,o,n,s)?C.resolve(null):(vs()<=ce.DEBUG&&M("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),Jf(t)),this.ko(e,o,t,Mp(s,Ms)).next((a=>a)))}))}Bo(e,t){let n,s;return Oe(e)?(n=new ye(l5),s=i=>Xc(e,i)):(n=new ye(f1(e)),s=i=>Uc(e,i)),t.forEach(((i,o)=>{s(o)&&(n=n.add(o))})),n}Uo(e,t,n,s){if(Oe(e))return(function(a){return a.stages.some((u=>u instanceof _r||u instanceof Yf))})(e);if(e.limit===null)return!1;if(n.size!==t.size)return!0;const i=e.limitType==="F"?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}No(e,t,n){return vs()<=ce.DEBUG&&M("QueryEngine","Using full collection scan to execute query:",Jf(t)),this.Fo.getDocumentsMatchingQuery(e,t,Dt.min(),n)}ko(e,t,n,s){return this.Fo.getDocumentsMatchingQuery(e,n,s).next((i=>(t.forEach((o=>{i=i.insert(o.key,o)})),i)))}}const J1="LocalStore",d5=3e8;class f5{constructor(e,t,n,s){this.persistence=e,this.qo=t,this.serializer=s,this.$o=new Re(Z),this.Ko=new Ln((i=>Kc(i)),B1),this.Wo=new Map,this.Qo=e.getRemoteDocumentCache(),this.g_=e.getTargetCache(),this.w_=e.getBundleCache(),this.Go(n)}Go(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Um(this.Qo,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Qo.setIndexManager(this.indexManager),this.qo.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(t=>e.collect(t,this.$o)))}}function Gm(r,e,t,n){return new f5(r,e,t,n)}async function $m(r,e){const t=G(r);return await t.persistence.runTransaction("Handle user change","readonly",(n=>{let s;return t.mutationQueue.getAllMutationBatches(n).next((i=>(s=i,t.Go(e),t.mutationQueue.getAllMutationBatches(n)))).next((i=>{const o=[],a=[];let u=ne();for(const l of s){o.push(l.batchId);for(const d of l.mutations)u=u.add(d.key)}for(const l of i){a.push(l.batchId);for(const d of l.mutations)u=u.add(d.key)}return t.localDocuments.getDocuments(n,u).next((l=>({zo:l,removedBatchIds:o,addedBatchIds:a})))}))}))}function p5(r,e){const t=G(r);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",(n=>{const s=e.batch.keys(),i=t.Qo.newChangeBuffer({trackRemovals:!0});return(function(a,u,l,d){const p=l.batch,g=p.keys();let I=C.resolve();return g.forEach((v=>{I=I.next((()=>d.getEntry(u,v))).next((k=>{const F=l.docVersions.get(v);U(F!==null,48541),k.version.compareTo(F)<0&&(p.applyToRemoteDocument(k,l),k.isValidDocument()&&
34(k.setReadTime(l.commitVersion),d.addEntry(k)))}))})),I.next((()=>a.mutationQueue.removeMutationBatch(u,p)))})(t,n,e,i).next((()=>i.apply(n))).next((()=>t.mutationQueue.performConsistencyCheck(n))).next((()=>t.documentOverlayCache.removeOverlaysForBatchId(n,s,e.batch.batchId))).next((()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(n,(function(a){let u=ne();for(let l=0;l<a.mutationResults.length;++l)a.mutationResults[l].transformResults.length>0&&(u=u.add(a.batch.mutations[l].key));return u})(e)))).next((()=>t.localDocuments.getDocuments(n,s)))}))}function jm(r){const e=G(r);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.g_.getLastRemoteSnapshotVersion(t)))}function m5(r,e){const t=G(r),n=e.snapshotVersion;let s=t.$o;return t.persistence.runTransaction("Apply remote event","readwrite-primary",(i=>{const o=t.Qo.newChangeBuffer({trackRemovals:!0});s=t.$o;const a=[];e.targetChanges.forEach(((d,p)=>{const g=s.get(p);if(!g)return;a.push(t.g_.removeMatchingKeys(i,d.removedDocuments,p).next((()=>t.g_.addMatchingKeys(i,d.addedDocuments,p))));let I=g.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(p)!==null?I=I.withResumeToken(Se.EMPTY_BYTE_STRING,K.min()).withLastLimboFreeSnapshotVersion(K.min()):d.resumeToken.approximateByteSize()>0&&(I=I.withResumeToken(d.resumeToken,n)),s=s.insert(p,I),(function(k,F,W){return k.resumeToken.approximateByteSize()===0||F.snapshotVersion.toMicroseconds()-k.snapshotVersion.toMicroseconds()>=d5?!0:W.addedDocuments.size+W.modifiedDocuments.size+W.removedDocuments.size>0})(g,I,d)&&a.push(t.g_.updateTargetData(i,I))}));let u=qe(),l=ne();if(e.documentUpdates.forEach((d=>{e.resolvedLimboDocuments.has(d)&&a.push(t.persistence.referenceDelegate.updateLimboDocument(i,d))})),a.push(zm(i,o,e.documentUpdates).next((d=>{u=d.jo,l=d.Ho}))),!n.isEqual(K.min())){const d=t.g_.getLastRemoteSnapshotVersion(i).next((p=>t.g_.setTargetsMetadata(i,i.currentSequenceNumber,n)));a.push(d)}return C.waitFor(a).next((()=>o.apply(i))).next((()=>t.localDocuments.getLocalViewOfDocuments(i,u,l))).next((()=>u))})).then((i=>(t.$o=s,i)))}function zm(r,e,t){let n=ne(),s=ne();return t.forEach((i=>n=n.add(i))),e.getEntries(r,n).next((i=>{let o=qe();return t.forEach(((a,u)=>{const l=i.get(a);u.isFoundDocument()!==l.isFoundDocument()&&(s=s.add(a)),u.isNoDocument()&&u.version.isEqual(K.min())?(e.removeEntry(a,u.readTime),o=o.insert(a,u)):!l.isValidDocument()||u.version.compareTo(l.version)>0||u.version.compareTo(l.version)===0&&l.hasPendingWrites?(e.addEntry(u),o=o.insert(a,u)):M(J1,"Ignoring outdated watch update for ",a,". Current version:",l.version," Watch version:",u.version)})),{jo:o,Ho:s}}))}function g5(r,e){const t=G(r);return t.persistence.runTransaction("Get next mutation batch","readonly",(n=>(e===void 0&&(e=or),t.mutationQueue.getNextMutationBatchAfterBatchId(n,e))))}function Zs(r,e){const t=G(r);return t.persistence.runTransaction("Allocate target","readwrite",(n=>{let s;return t.g_.getTargetData(n,e).next((i=>i?(s=i,C.resolve(s)):t.g_.allocateTargetId(n).next((o=>(s=new sn(e,o,"TargetPurposeListen",n.currentSequenceNumber),t.g_.addTargetData(n,s).next((()=>s)))))))})).then((n=>{const s=t.$o.get(n.targetId);return(s===null||n.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(t.$o=t.$o.insert(n.targetId,n),t.Ko.set(e,n.targetId)),n}))}async function ei(r,e,t){const n=G(r),s=n.$o.get(e),i=t?"readwrite":"readwrite-primary";try{t||await n.persistence.runTransaction("Release target",i,(o=>n.persistence.referenceDelegate.removeTarget(o,s)))}catch(o){if(!Rr(o))throw o;M(J1,`Failed to update sequence numbers for target ${e}: ${o}`)}n.$o=n.$o.remove(e),n.Ko.delete(s.target)}function gc(r,e,t){const n=G(r);let s=K.min(),i=ne();return n.persistence.runTransaction("Execute query","readwrite",(o=>(function(u,l,d){const p=G(u),g=p.Ko.get(d);return g!==void 0?C.resolve(p.$o.get(g)):p.g_.getTargetData(l,d)})(n,o,Oe(e)?e:dt(e)).next((a=>{if(a)return s=a.lastLimboFreeSnapshotVersion,n.g_.getMatchingKeysForTargetId(o,a.targetId).next((u=>{i=u}))})).next((()=>
vendor: 11,536 bytes, lines 34-35
34n.qo.getDocumentsMatchingQuery(o,e,t?s:K.min(),t?i:ne()))).next((a=>(Wm(n,a),{documents:a,Jo:i})))))}function Hm(r,e){const t=G(r),n=G(t.g_),s=t.$o.get(e);return s?Promise.resolve(s.target??null):t.persistence.runTransaction("Get target data","readonly",(i=>n.dt(i,e).next((o=>o?.target??null))))}function kl(r,e){const t=G(r),n=t.Wo.get(e)||K.min();return t.persistence.runTransaction("Get new document changes","readonly",(s=>t.Qo.getAllFromCollectionGroup(s,e,Mp(n,Ms),Number.MAX_SAFE_INTEGER))).then((s=>(Wm(t,s),s)))}function Wm(r,e){e.forEach(((t,n)=>{const s=n.key.getCollectionGroup(),i=r.Wo.get(s)||K.min();n.readTime.compareTo(i)>0&&r.Wo.set(s,n.readTime)}))}async function _5(r,e,t,n){const s=G(r);let i=ne(),o=qe();for(const l of t){const d=e.Yo(l.metadata.name);l.document&&(i=i.add(d));const p=e.Zo(l);p.setReadTime(e.Xo(l.metadata.readTime)),o=o.insert(d,p)}const a=s.Qo.newChangeBuffer({trackRemovals:!0}),u=await Zs(s,(function(d){return dt(pi(re.fromString(`__bundle__/docs/${d}`)))})(n));return s.persistence.runTransaction("Apply bundle documents","readwrite",(l=>zm(l,a,o).next((d=>(a.apply(l),d))).next((d=>s.g_.removeMatchingKeysForTargetId(l,u.targetId).next((()=>s.g_.addMatchingKeys(l,i,u.targetId))).next((()=>s.localDocuments.getLocalViewOfDocuments(l,d.jo,d.Ho))).next((()=>d.jo))))))}async function y5(r,e,t=ne()){const n=await Zs(r,dt(Qc(e.bundledQuery))),s=G(r);return s.persistence.runTransaction("Save named query","readwrite",(i=>{const o=Me(e.readTime);if(n.snapshotVersion.compareTo(o)>=0)return s.w_.saveNamedQuery(i,e);const a=n.withResumeToken(Se.EMPTY_BYTE_STRING,o);return s.$o=s.$o.insert(a.targetId,a),s.g_.updateTargetData(i,a).next((()=>s.g_.removeMatchingKeysForTargetId(i,n.targetId))).next((()=>s.g_.addMatchingKeys(i,t,n.targetId))).next((()=>s.w_.saveNamedQuery(i,e)))}))}const Km="firestore_clients";function g2(r,e){return`${Km}_${r}_${e}`}const Qm="firestore_mutations";function _2(r,e,t){let n=`${Qm}_${r}_${t}`;return e.isAuthenticated()&&(n+=`_${e.uid}`),n}const Ym="firestore_targets";function Xu(r,e){return`${Ym}_${r}_${e}`}const Zt="SharedClientState";class _c{constructor(e,t,n,s){this.user=e,this.batchId=t,this.state=n,this.error=s}static ea(e,t,n){const s=JSON.parse(n);let i,o=typeof s=="object"&&["pending","acknowledged","rejected"].indexOf(s.state)!==-1&&(s.error===void 0||typeof s.error=="object");return o&&s.error&&(o=typeof s.error.message=="string"&&typeof s.error.code=="string",o&&(i=new L(s.error.code,s.error.message))),o?new _c(e,t,s.state,i):(Le(Zt,`Failed to parse mutation state for ID '${t}': ${n}`),null)}ta(){const e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}}class _o{constructor(e,t,n){this.targetId=e,this.state=t,this.error=n}static ea(e,t){const n=JSON.parse(t);let s,i=typeof n=="object"&&["not-current","current","rejected"].indexOf(n.state)!==-1&&(n.error===void 0||typeof n.error=="object");return i&&n.error&&(i=typeof n.error.message=="string"&&typeof n.error.code=="string",i&&(s=new L(n.error.code,n.error.message))),i?new _o(e,n.state,s):(Le(Zt,`Failed to parse target state for ID '${e}': ${t}`),null)}ta(){const e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}}class yc{constructor(e,t){this.clientId=e,this.activeTargetIds=t}static ea(e,t){const n=JSON.parse(t);let s=typeof n=="object"&&n.activeTargetIds instanceof Array,i=p1();for(let o=0;s&&o<n.activeTargetIds.length;++o)s=Gp(n.activeTargetIds[o]),i=i.add(n.activeTargetIds[o]);return s?new yc(e,i):(Le(Zt,`Failed to parse client data for instance '${e}': ${t}`),null)}}class X1{constructor(e,t){this.clientId=e,this.onlineState=t}static ea(e){const t=JSON.parse(e);return typeof t=="object"&&["Unknown","Online","Offline"].indexOf(t.onlineState)!==-1&&typeof t.clientId=="string"?new X1(t.clientId,t.onlineState):(Le(Zt,`Failed to parse online state: ${e}`),null)}}class xl{constructor(){this.activeTargetIds=p1()}na(e){this.activeTargetIds=this.activeTargetIds.add(e)}ra(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ta(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class Zu{constructor(e,t,n,s,i){this.window=e,this.Tn=t,this.persistenceKey=n,this.ia=s,this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null,this.sa=this._a.bind(this),this.oa=new Re(Z),this.started=!1,this.aa=[];const o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=i,this.ua=g2(this.persistenceKey,this.ia),this.ca=(function(u){return`firestore_sequence_number_${u}`})(this.persistenceKey),this.oa=this.oa.insert(this.ia,new xl),this.la=new RegExp(`^${Km}_${o}_([^_]*)$`),this.Ea=new RegExp(`^${Qm}_${o}_(\\d+)(?:_(.*))?$`),this.ha=new RegExp(`^${Ym}_${o}_(\\d+)$`),this.Ta=(function(u){return`firestore_online_state_${u}`})(this.persistenceKey),this.Pa=(function(u){return`firestore_bundle_loaded_v2_${u}`})(this.persistenceKey),this.window.addEventListener("storage",this.sa)}static C(e){return!(!e||!e.localStorage)}async start(){const e=await this.syncEngine.po();for(const n of e){if(n===this.ia)continue;const s=this.getItem(g2(this.persistenceKey,n));if(s){const i=yc.ea(n,s);i&&(this.oa=this.oa.insert(i.clientId,i))}}this.Ra();const t=this.storage.getItem(this.Ta);if(t){const n=this.Ia(t);n&&this.Aa(n)}for(const n of this.aa)this._a(n);this.aa=[],this.window.addEventListener("pagehide",(()=>this.shutdown())),this.started=!0}writeSequenceNumber(e){this.setItem(this.ca,JSON.stringify(e))}getAllActiveQueryTargets(){return this.Va(this.oa)}isActiveQueryTarget(e){let t=!1;return this.oa.forEach(((n,s)=>{s.activeTargetIds.has(e)&&(t=!0)})),t}addPendingMutation(e){this.da(e,"pending")}updateMutationState(e,t,n){this.da(e,t,n),this.fa(e)}addLocalQueryTarget(e,t=!0){let n="not-current";if(this.isActiveQueryTarget(e)){const s=this.storage.getItem(Xu(this.persistenceKey,e));if(s){const i=_o.ea(e,s);i&&(n=i.state)}}return t&&this.ma.na(e),this.Ra(),n}removeLocalQueryTarget(e){this.ma.ra(e),this.Ra()}isLocalQueryTarget(e){return this.ma.activeTargetIds.has(e)}clearQueryState(e){this.removeItem(Xu(this.persistenceKey,e))}updateQueryState(e,t,n){this.pa(e,t,n)}handleUserChange(e,t,n){t.forEach((s=>{this.fa(s)})),this.currentUser=e,n.forEach((s=>{this.addPendingMutation(s)}))}setOnlineState(e){this.ga(e)}notifyBundleLoaded(e){this.ya(e)}shutdown(){this.started&&(this.window.removeEventListener("storage",this.sa),this.removeItem(this.ua),this.started=!1)}getItem(e){const t=this.storage.getItem(e);return M(Zt,"READ",e,t),t}setItem(e,t){M(Zt,"SET",e,t),this.storage.setItem(e,t)}removeItem(e){M(Zt,"REMOVE",e),this.storage.removeItem(e)}_a(e){const t=e;if(t.storageArea===this.storage){if(M(Zt,"EVENT",t.key,t.newValue),t.key===this.ua)return void Le("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.Tn.enqueueRetryable((async()=>{if(this.started){if(t.key!==null){if(this.la.test(t.key)){if(t.newValue==null){const n=this.wa(t.key);return this.ba(n,null)}{const n=this.va(t.key,t.newValue);if(n)return this.ba(n.clientId,n)}}else if(this.Ea.test(t.key)){if(t.newValue!==null){const n=this.Sa(t.key,t.newValue);if(n)return this.Da(n)}}else if(this.ha.test(t.key)){if(t.newValue!==null){const n=this.xa(t.key,t.newValue);if(n)return this.Ca(n)}}else if(t.key===this.Ta){if(t.newValue!==null){const n=this.Ia(t.newValue);if(n)return this.Aa(n)}}else if(t.key===this.ca){const n=(function(i){let o=wt.ce;if(i!=null)try{const a=JSON.parse(i);U(typeof a=="number",30636,{Fa:i}),o=a}catch(a){Le(Zt,"Failed to read sequence number from WebStorage",a)}return o})(t.newValue);n!==wt.ce&&this.sequenceNumberHandler(n)}else if(t.key===this.Pa){const n=this.Oa(t.newValue);await Promise.all(n.map((s=>this.syncEngine.Ma(s))))}}}else this.aa.push(t)}))}}get ma(){return this.oa.get(this.ia)}Ra(){this.setItem(this.ua,this.ma.ta())}da(e,t,n){const s=new _c(this.currentUser,e,t,n),i=_2(this.persistenceKey,this.currentUser,e);this.setItem(i,s.ta())}fa(e){const t=_2(this.persistenceKey,this.currentUser,e);this.removeItem(t)}ga(e){const t={clientId:this.ia,onlineState:e};this.storage.setItem(this.Ta,JSON.stringify(t))}pa(e,t,n){const s=Xu(this.persistenceKey,e),i=new _o(e,t,n);this.setItem(s,i.ta())}ya(e){const t=JSON.stringify(Array.from(e));this.setItem(this.Pa,t)}wa(e){const t=this.la.exec(e);return t?t[1]:null}va(e,t){const n=this.wa(e);return yc.ea(n,t)}Sa(e,t){const n=this.Ea.exec(e),s=Number(n[1]),i=n[2]!==void 0?n[2]:null;return _c.ea(new et(i),s,t)}xa(e,t){const n=this.ha.exec(e),s=Number(n[1]);return _o.ea(s,t)}Ia(e){return X1.ea(e)}Oa(e){return JSON.parse(e)}async Da(e){if(e.user.uid===this.currentUser.uid)return this.syncEngine.Na(e.batchId,e.state,e.error);M(Zt,`Ignoring mutation for non-active user ${e.user.uid}`)}Ca(e){return this.syncEngine.La(e.targetId,e.state,e.error)}ba(e,t){const n=t?this.oa.insert(e,t):this.oa.remove(e),s=this.Va(this.oa),i=this.Va(n),o=[],a=[];return i.forEach((u=>{s.has(u)||o.push(u)})),s.forEach((u=>{i.has(u)||a.push(u)})),this.syncEngine.Ba(o,a).then((()=>{this.oa=n}))}Aa(e){this.oa.get(e.clientId)&&this.onlineStateHandler(e.onlineState)}Va(e){let t=p1();return e.forEach(((n,s)=>{t=t.unionWith(s.activeTargetIds)})),t}}class Jm{constructor(){this.Ua=new xl,this.ka={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Ua.na(e),this.ka[e]||"not-current"}updateQueryState(e,t,n){this.ka[e]=t}removeLocalQueryTarget(e){this.Ua.ra(e)}isLocalQueryTarget(e){return this.Ua.activeTargetIds.has(e)}clearQueryState(e){delete this.ka[e]}getAllActiveQueryTargets(){return this.Ua.activeTargetIds}isActiveQueryTarget(e){return this.Ua.activeTargetIds.has(e)}start(){return this.Ua=new xl,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}function Xm(){return typeof window<"u"?window:null}function Ha(){return typeof document<"u"?document:null}class E5{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.qa=0,this.$a=null,this.Ka=!0}Wa(){this.qa===0&&(this.Qa("Unknown"),this.$a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.$a=null,this.Ga("Backend didn't respond within 10 seconds."),this.Qa("Offline"),Promise.resolve()))))}za(e){this.state==="Online"?this.Qa("Unknown"):(this.qa++,this.qa>=1&&(this.ja(),this.Ga(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.Qa("Offline")))}set(e){this.ja(),this.qa=0,e==="Online"&&(this.Ka=!1),this.Qa(e)}Qa(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}Ga(e){const t=`Could not reach Cloud Firestore backend. ${e}
35This 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.Ka?(Le(t),this.Ka=!1):M("OnlineStateTracker",t)}ja(){this.$a!==null&&(this.$a.cancel(),this.$a=null)}}const dn="RemoteStore";class I5{constructor(e,t,n,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Ha=[],this.Ja=new Map,this.Ya=new Map,this.Za=new Map,this.Xa=new Vn(1e3),this.eu=new Vn(1001),this.tu=new Set,this.nu=[],this.ru=i,this.ru.bt((o=>{n.enqueueAndForget((async()=>
35{Sr(this)&&(M(dn,"Restarting streams for network reachability change."),await(async function(u){const l=G(u);l.tu.add(4),await yi(l),l.iu.set("Unknown"),l.tu.delete(4),await ta(l)})(this))}))})),this.iu=new E5(n,s)}}async function ta(r){if(Sr(r))for(const e of r.nu)await e(!0)}async function yi(r){for(const e of r.nu)await e(!1)}function Ll(r,e){return r.Ya.get(e)||void 0}function eu(r,e){const t=G(r),n=Ll(t,e.targetId);if(n!==void 0&&t.Ja.has(n))return;const s=(function(a,u){const l=Ll(a,u);l!==void 0&&a.Za.delete(l);const d=(function(g,I){return I%2!=0?g.eu.next():g.Xa.next()})(a,u);return a.Ya.set(u,d),a.Za.set(d,u),d})(t,e.targetId);M(dn,"remoteStoreListen mapping SDK target ID to remote",e.targetId,s);const i=new sn(e.target,s,e.purpose,e.sequenceNumber,e.snapshotVersion,e.lastLimboFreeSnapshotVersion,e.resumeToken);t.Ja.set(s,i),th(t)?eh(t):Ii(t).Fn()&&Z1(t,i)}function ti(r,e){const t=G(r),n=Ii(t),s=Ll(t,e);M(dn,"remoteStoreUnlisten removing mapping of SDK target ID to remote",e,s),t.Ja.delete(s),t.Ya.delete(e),t.Za.delete(s),n.Fn()&&Zm(t,s),t.Ja.size===0&&(n.Fn()?n.Nn():Sr(t)&&t.iu.set("Unknown"))}function Z1(r,e){if(r.su.We(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(K.min())>0){const t=r.Za.get(e.targetId);if(t===void 0)return void M(dn,"SDK target ID not found for remote ID: "+e.targetId);const n=r.remoteSyncer.getRemoteKeysForTarget(t).size;e=e.withExpectedCount(n)}Ii(r).jn(e)}function Zm(r,e){r.su.We(e),Ii(r).Hn(e)}function eh(r){r.su=new S3({getRemoteKeysForTarget:e=>{const t=r.Za.get(e);return t!==void 0?r.remoteSyncer.getRemoteKeysForTarget(t):ne()},dt:e=>r.Ja.get(e)||null,Tt:()=>r.datastore.serializer.databaseId}),Ii(r).start(),r.iu.Wa()}function th(r){return Sr(r)&&!Ii(r).Cn()&&r.Ja.size>0}function Sr(r){return G(r).tu.size===0}function e0(r){r.su=void 0}async function w5(r){r.iu.set("Online")}async function T5(r){r.Ja.forEach(((e,t)=>{Z1(r,e)}))}async function A5(r,e){e0(r),th(r)?(r.iu.za(e),eh(r)):r.iu.set("Unknown")}async function R5(r,e,t){if(r.iu.set("Online"),e instanceof k6&&e.state===2&&e.cause)try{await(async function(s,i){const o=i.cause;for(const a of i.targetIds){if(s.Ja.has(a)){const u=s.Za.get(a);u!==void 0&&(await s.remoteSyncer.rejectListen(u,o),s.Ya.delete(u),s.Za.delete(a)),s.Ja.delete(a)}s.su.removeTarget(a)}})(r,e)}catch(n){M(dn,"Failed to remove targets %s: %s ",e.targetIds.join(","),n),await Ec(r,n)}else if(e instanceof Ga?r.su.et(e):e instanceof D6?r.su.ot(e):r.su.rt(e),!t.isEqual(K.min()))try{const n=await jm(r.localStore);t.compareTo(n)>=0&&await(function(i,o){const a=i.su.Rt(o);
vendor: 17,393 bytes, lines 35-38
35a.targetChanges.forEach(((l,d)=>{if(l.resumeToken.approximateByteSize()>0){const p=i.Ja.get(d);p&&i.Ja.set(d,p.withResumeToken(l.resumeToken,o))}})),a.targetMismatches.forEach(((l,d)=>{const p=i.Ja.get(l);if(!p)return;i.Ja.set(l,p.withResumeToken(Se.EMPTY_BYTE_STRING,p.snapshotVersion)),Zm(i,l);const g=new sn(p.target,l,d,p.sequenceNumber);Z1(i,g)}));const u=(function(d,p){const g=new Map;p.targetChanges.forEach(((v,k)=>{const F=d.Za.get(k);F!==void 0&&g.set(F,v)}));let I=new Re(Z);return p.targetMismatches.forEach(((v,k)=>{const F=d.Za.get(v);F!==void 0&&(I=I.insert(F,k))})),new mi(p.snapshotVersion,g,I,p.documentUpdates,p.augmentedDocumentUpdates,p.resolvedLimboDocuments)})(i,a);return i.remoteSyncer.applyRemoteEvent(u)})(r,t)}catch(n){M(dn,"Failed to raise snapshot:",n),await Ec(r,n)}}async function Ec(r,e,t){if(!Rr(e))throw e;r.tu.add(1),await yi(r),r.iu.set("Offline"),t||(t=()=>jm(r.localStore)),r.asyncQueue.enqueueRetryable((async()=>{M(dn,"Retrying IndexedDB access"),await t(),r.tu.delete(1),await ta(r)}))}function t0(r,e){return e().catch((t=>Ec(r,t,e)))}async function Ei(r){const e=G(r),t=Er(e);let n=e.Ha.length>0?e.Ha[e.Ha.length-1].batchId:or;for(;v5(e);)try{const s=await g5(e.localStore,n);if(s===null){e.Ha.length===0&&t.Nn();break}n=s.batchId,S5(e,s)}catch(s){await Ec(e,s)}n0(e)&&r0(e)}function v5(r){return Sr(r)&&r.Ha.length<10}function S5(r,e){r.Ha.push(e);const t=Er(r);t.Fn()&&t.Jn&&t.Yn(e.mutations)}function n0(r){return Sr(r)&&!Er(r).Cn()&&r.Ha.length>0}function r0(r){Er(r).start()}async function P5(r){Er(r).er()}async function C5(r){const e=Er(r);for(const t of r.Ha)e.Yn(t.mutations)}async function b5(r,e,t){const n=r.Ha.shift(),s=G1.from(n,e,t);await t0(r,(()=>r.remoteSyncer.applySuccessfulWrite(s))),await Ei(r)}async function N5(r,e){e&&Er(r).Jn&&await(async function(n,s){if((function(o){return P6(o)&&o!==N.ABORTED})(s.code)){const i=n.Ha.shift();Er(n).Mn(),await t0(n,(()=>n.remoteSyncer.rejectFailedWrite(i.batchId,s))),await Ei(n)}})(r,e),n0(r)&&r0(r)}async function y2(r,e){const t=G(r);t.asyncQueue.verifyOperationInProgress(),M(dn,"RemoteStore received new credentials");const n=Sr(t);t.tu.add(3),await yi(t),n&&t.iu.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.tu.delete(3),await ta(t)}async function Ml(r,e){const t=G(r);e?(t.tu.delete(2),await ta(t)):e||(t.tu.add(2),await yi(t),t.iu.set("Unknown"))}function Ii(r){return r._u||(r._u=(function(t,n,s){const i=G(t);return i.nr(),new j3(n,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)})(r.datastore,r.asyncQueue,{Qt:w5.bind(null,r),zt:T5.bind(null,r),Ht:A5.bind(null,r),zn:R5.bind(null,r)}),r.nu.push((async e=>{e?(r._u.Mn(),th(r)?eh(r):r.iu.set("Unknown")):(await r._u.stop(),e0(r))}))),r._u}function Er(r){return r.ou||(r.ou=(function(t,n,s){const i=G(t);return i.nr(),new z3(n,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)})(r.datastore,r.asyncQueue,{Qt:()=>Promise.resolve(),zt:P5.bind(null,r),Ht:N5.bind(null,r),Zn:C5.bind(null,r),Xn:b5.bind(null,r)}),r.nu.push((async e=>{e?(r.ou.Mn(),await Ei(r)):(await r.ou.stop(),r.Ha.length>0&&(M(dn,`Stopping write stream with ${r.Ha.length} pending writes`),r.Ha=[]))}))),r.ou}class nh{constructor(e,t,n,s,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=s,this.removalCallback=i,this.deferred=new nt,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((o=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,s,i){const o=Date.now()+n,a=new nh(e,t,o,s,i);return a.start(n),a}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new L(N.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function wi(r,e){if(Le("AsyncQueue",`${e}: ${r}`),Rr(r))return new L(N.UNAVAILABLE,`${e}: ${r}`);throw r}class cr{static emptySet(e){return new cr(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||B.comparator(t.key,n.key):(t,n)=>B.comparator(t.key,n.key),this.keyedMap=Ur(),this.sortedSet=new Re(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((t,n)=>(e(t),!1)))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof cr)||this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=n.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach((t=>{e.push(t.toString())})),e.length===0?"DocumentSet ()":`DocumentSet (
36  `+e.join(`  
37`)+`
38)`}copy(e,t){const n=new cr;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}class E2{constructor(){this.au=new Re(B.comparator)}track(e){const t=e.doc.key,n=this.au.get(t);n?e.type!==0&&n.type===3?this.au=this.au.insert(t,e):e.type===3&&n.type!==1?this.au=this.au.insert(t,{type:n.type,doc:e.doc}):e.type===2&&n.type===2?this.au=this.au.insert(t,{type:2,doc:e.doc}):e.type===2&&n.type===0?this.au=this.au.insert(t,{type:0,doc:e.doc}):e.type===1&&n.type===0?this.au=this.au.remove(t):e.type===1&&n.type===2?this.au=this.au.insert(t,{type:1,doc:n.doc}):e.type===0&&n.type===1?this.au=this.au.insert(t,{type:2,doc:e.doc}):H(63341,{ft:e,uu:n}):this.au=this.au.insert(t,e)}cu(){const e=[];return this.au.inorderTraversal(((t,n)=>{e.push(n)})),e}}class ss{constructor(e,t,n,s,i,o,a,u,l){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=s,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=u,this.hasCachedResults=l}static fromInitialDocuments(e,t,n,s,i){const o=[];return t.forEach((a=>{o.push({type:0,doc:a})})),new ss(e,t,cr.emptySet(t),o,n,s,!0,!1,i)}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)&&Wc(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++)if(t[s].type!==n[s].type||!t[s].doc.isEqual(n[s].doc))return!1;return!0}}class V5{constructor(){this.lu=void 0,this.Eu=[]}hu(){return this.Eu.some((e=>e.Tu()))}}class O5{constructor(){this.queries=I2(),this.onlineState="Unknown",this.Pu=new Set}terminate(){(function(t,n){const s=G(t),i=s.queries;s.queries=I2(),i.forEach(((o,a)=>{for(const u of a.Eu)u.onError(n)}))})(this,new L(N.ABORTED,"Firestore shutting down"))}}function I2(){return new Ln((r=>Pm(r)),Wc)}async function rh(r,e){const t=G(r);let n=3;const s=e.query;let i=t.queries.get(s);i?!i.hu()&&e.Tu()&&(n=2):(i=new V5,n=e.Tu()?0:1);try{switch(n){case 0:i.lu=await t.onListen(s,!0);break;case 1:i.lu=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(o){const a=wi(o,`Initialization of query '${Oe(e.query)?vn(e.query):fo(e.query)}' failed`);return void e.onError(a)}t.queries.set(s,i),i.Eu.push(e),e.Ru(t.onlineState),i.lu&&e.Iu(i.lu)&&ih(t)}async function sh(r,e){const t=G(r),n=e.query;let s=3;const i=t.queries.get(n);if(i){const o=i.Eu.indexOf(e);o>=0&&(i.Eu.splice(o,1),i.Eu.length===0?s=e.Tu()?0:1:!i.hu()&&e.Tu()&&(s=2))}switch(s){case 0:return t.queries.delete(n),t.onUnlisten(n,!0);case 1:return t.queries.delete(n),t.onUnlisten(n,!1);case 2:return t.onLastRemoteStoreUnlisten(n);default:return}}function D5(r,e){const t=G(r);let n=!1;for(const s of e){const i=s.query,o=t.queries.get(i);if(o){for(const a of o.Eu)a.Iu(s)&&(n=!0);o.lu=s}}n&&ih(t)}function k5(r,e,t){const n=G(r),s=n.queries.get(e);if(s)for(const i of s.Eu)i.onError(t);n.queries.delete(e)}function ih(r){r.Pu.forEach((e=>{e.next()}))}var Fl;(function(r){r.Default="default",r.Cache="cache"})(Fl||(Fl={}));class oh{constructor(e,t,n){this.query=e,this.Au=t,this.Vu=!1,this.du=null,this.onlineState="Unknown",this.options=n||{}}Iu(e){if(!this.options.includeMetadataChanges){const n=[];for(const s of e.docChanges)s.type!==3&&n.push(s);e=new ss(e.query,e.docs,e.oldDocs,n,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Vu?this.fu(e)&&(this.Au.next(e),t=!0):this.mu(e,this.onlineState)&&(this.pu(e),t=!0),this.du=e,t}onError(e){this.Au.error(e)}Ru(e){this.onlineState=e;let t=!1;return this.du&&!this.Vu&&this.mu(this.du,e)&&(this.pu(this.du),t=!0),t}mu(e,t){if(!e.fromCache||!this.Tu())return!0;const n=t!=="Offline";return(!this.options.waitForSyncWhenOnline||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}fu(e){if(e.docChanges.length>0)return!0;const t=this.du&&this.du.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}pu(e){e=ss.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Vu=!0,this.Au.next(e)}Tu(){return this.options.source!==Fl.Cache}}class s0{constructor(e,t){this.gu=e,this.byteLength=t}yu(){return"metadata"in this.gu}}class w2{constructor(e){this.serializer=e}Yo(e){return un(this.serializer,e)}Zo(e){return e.metadata.exists?Bc(this.serializer,e.document,!1):Ce.newNoDocument(this.Yo(e.metadata.name),this.Xo(e.metadata.readTime))}Xo(e){return Me(e)}}class ah{constructor(e,t){this.wu=e,this.serializer=t,this.bu=[],this.vu=[],this.collectionGroups=new Set,this.progress=i0(e)}get queries(){return this.bu}get documents(){return this.vu}o(e){this.progress.bytesLoaded+=e.byteLength;let t=this.progress.documentsLoaded;if(e.gu.namedQuery)this.bu.push(e.gu.namedQuery);else if(e.gu.documentMetadata){this.vu.push({metadata:e.gu.documentMetadata}),e.gu.documentMetadata.exists||++t;const n=re.fromString(e.gu.documentMetadata.name);this.collectionGroups.add(n.get(n.length-2))}else e.gu.document&&(this.vu[this.vu.length-1].document=e.gu.document,++t);return t!==this.progress.documentsLoaded?(this.progress.documentsLoaded=t,{...this.progress}):null}Du(e){const t=new Map,n=new w2(this.serializer);for(const s of e)if(s.metadata.queries){const i=n.Yo(s.metadata.name);for(const o of s.metadata.queries){const a=(t.get(o)||ne()).add(i);t.set(o,a)}}return t}async xu(e){const t=await _5(e,new w2(this.serializer),this.vu,this.wu.id),n=this.Du(this.documents);for(const s of this.bu)await y5(e,s,n.get(s.name));return this.progress.taskState="Success",{progress:this.progress,Cu:this.collectionGroups,Fu:t}}}function i0(r){return{taskState:"Running",documentsLoaded:0,bytesLoaded:0,totalDocuments:r.totalDocuments,totalBytes:r.totalBytes}}class o0{constructor(e){this.key=e}}class a0{constructor(e){this.key=e}}class c0{constructor(e,t){this.query=e,this.Ou=t,this.Mu=null,this.hasCachedResults=!1,this.current=!1,this.Nu=ne(),this.mutatedKeys=ne(),this.Lu=Oe(e)?Dl(e):f1(e),this.Bu=new cr(this.Lu)}get Uu(){return this.Ou}ku(e,t){const n=t?t.qu:new E2,s=t?t.Bu:this.Bu;let i=t?t.mutatedKeys:this.mutatedKeys,o=s,a=!1;const[u,l]=this.$u(this.query,s);e.inorderTraversal(((p,g)=>{const I=s.get(p),v=Lm(this.query,g)?g:null,k=!!I&&this.mutatedKeys.has(I.key),F=!!v&&(v.hasLocalMutations||this.mutatedKeys.has(v.key)&&v.hasCommittedMutations);let W=!1;I&&v?I.data.isEqual(v.data)?k!==F&&(n.track({type:3,doc:v}),W=!0):this.Ku(I,v)||(n.track({type:2,doc:v}),W=!0,(u&&this.Lu(v,u)>0||l&&this.Lu(v,l)<0)&&(a=!0)):!I&&v?(n.track({type:0,doc:v}),W=!0):I&&!v&&(n.track({type:1,doc:I}),W=!0,(u||l)&&(a=!0)),W&&(v?(o=o.add(v),i=F?i.add(p):i.delete(p)):(o=o.delete(p),i=i.delete(p)))}));const d=this.Wu(this.query);if(d)if(Oe(this.query)){const p=[];o.forEach((v=>p.push(v)));const g=xm(this.query,p);let I=new cr(Dl(this.query));for(const v of g)I=I.add(v);o.forEach((v=>{I.has(v.key)||(i=i.delete(v.key),n.track({type:1,doc:v}))})),o=I}else{const p=this.Qu(this.query);for(;o.size>d;){const g=p==="F"?o.last():o.first();o=o.delete(g.key),i=i.delete(g.key),n.track({type:1,doc:g})}}return{Bu:o,qu:n,Uo:a,mutatedKeys:i}}Wu(e){return Oe(e)?Ku(e)?.limit:e.limit||void 0}Qu(e){if(Oe(e)){const t=Ku(e);return t&&t.limit<0?"L":"F"}return e.limitType}$u(e,t){if(Oe(e)){const n=Ku(e)?.limit;return[t.size===n?t.last():null,null]}return[e.limitType==="F"&&t.size===this.Wu(this.query)?t.last():null,e.limitType==="L"&&t.size===this.Wu(this.query)?t.first():null]}Ku(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,s){const i=this.Bu;this.Bu=e.Bu,this.mutatedKeys=e.mutatedKeys;const o=e.qu.cu();o.sort(((d,p)=>(function(I,v){const k=F=>{switch(F){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return H(20277,{ft:F})}};return k(I)-k(v)})(d.type,p.type)||this.Lu(d.doc,p.doc))),this.Gu(n),s=s??!1;const a=t&&!s?this.zu():[],u=this.Nu.size===0&&this.current&&!s?1:0,l=u!==this.Mu;return this.Mu=u,o.length!==0||l?{snapshot:new ss(this.query,e.Bu,i,o,e.mutatedKeys,u===0,l,!1,!!n&&n.resumeToken.approximateByteSize()>0),ju:a}:{ju:a}}Ru(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Bu:this.Bu,qu:new E2,mutatedKeys:this.mutatedKeys,Uo:!1},!1)):{ju:[]}}Hu(e){return!this.Ou.has(e)&&!!this.Bu.has(e)&&!this.Bu.get(e).hasLocalMutations}Gu(e){e&&(e.addedDocuments.forEach((t=>this.Ou=this.Ou.add(t))),e.modifiedDocuments.forEach((t=>{})),e.removedDocuments.forEach((t=>this.Ou=this.Ou.delete(t))),this.current=e.current)}zu(){if(!this.current)return[];const e=this.Nu;this.Nu=ne(),this.Bu.forEach((n=>{this.Hu(n.key)&&(this.Nu=this.Nu.add(n.key))}));const t=[];return e.forEach((n=>{this.Nu.has(n)||t.push(new a0(n))})),this.Nu.forEach((n=>{e.has(n)||t.push(new o0(n))})),t}Ju(e){this.Ou=e.Jo,this.Nu=ne();const t=this.ku(e.documents);return this.applyChanges(t,!0)}Yu(){return ss.fromInitialDocuments(this.query,this.Bu,this.mutatedKeys,this.Mu===0,this.hasCachedResults)}}const Pr="SyncEngine";class x5{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class L5{constructor(e){this.key=e,this.Zu=!1}}class M5{constructor(e,t,n,s,i,o){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.Xu={},this.ec=new Ln((a=>Pm(a)),Wc),this.tc=new Map,this.nc=new Set,this.rc=new Re(B.comparator),this.sc=new Map,this._c=new H1,this.oc={},this.ac=new Map,this.uc=Vn.Cs(),this.onlineState="Unknown",this.cc=void 0}get isPrimaryClient(){return this.cc===!0}}async function F5(r,e,t=!0){const n=tu(r);let s;const i=n.ec.get(e);return i?(n.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.Yu()):s=await u0(n,e,t,!0),s}async function U5(r,e){const t=tu(r);await u0(t,e,!0,!1)}async function u0(r,e,t,n){const s=await Zs(r.localStore,Oe(e)?e:dt(e)),i=s.targetId,o=r.sharedClientState.addLocalQueryTarget(i,t);let a;return n&&(a=await ch(r,e,i,o==="current",s.resumeToken)),r.isPrimaryClient&&t&&eu(r.remoteStore,s),a}async function ch(r,e,t,n,s){r.lc=(p,g,I)=>(async function(k,F,W,J){let Y=F.view.ku(W);Y.Uo&&(Y=await gc(k.localStore,F.query,!1).then((({documents:T})=>F.view.ku(T,Y))));const me=J&&J.targetChanges.get(F.targetId),Ie=J&&J.targetMismatches.get(F.targetId)!=null,pe=F.view.applyChanges(Y,k.isPrimaryClient,me,Ie);return Ul(k,F.targetId,pe.ju),pe.snapshot})(r,p,g,I);const i=await gc(r.localStore,e,!0),o=new c0(e,i.Jo),a=o.ku(i.documents),u=Wo.createSynthesizedTargetChangeForCurrentChange(t,n&&r.onlineState!=="Offline",s),l=o.applyChanges(a,r.isPrimaryClient,u);Ul(r,t,l.ju);const d=new x5(e,t,o);return r.ec.set(e,d),r.tc.has(t)?r.tc.get(t).push(e):r.tc.set(t,[e]),l.snapshot}async function B5(r,e,t){const n=G(r),s=n.ec.get(e),i=n.tc.get(s.targetId);if(i.length>1)return n.tc.set(s.targetId,i.filter((o=>!Wc(o,e)))),void n.ec.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(s.targetId),n.sharedClientState.isActiveQueryTarget(s.targetId)||await ei(n.localStore,s.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(s.targetId),t&&ti(n.remoteStore,s.targetId),ni(n,s.targetId)})).catch(Ar)):(ni(n,s.targetId),await ei(n.localStore,s.targetId,!0))}async function q5(r,e){const t=G(r),n=t.ec.get(e),s=t.tc.get(n.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(n.targetId),ti(t.remoteStore,n.targetId))}async function G5(r,e,t){const n=dh(r);try{const s=await(function(o,a){const u=G(o),l=ge.now(),d=a.reduce(((I,v)=>I.add(v.key)),ne());let p,g;return u.persistence.runTransaction("Locally write mutations","readwrite",(I=>{let v=qe(),k=ne();return u.Qo.getEntries(I,d).next((F=>{v=F,v.forEach(((W,J)=>{J.isValidDocument()||(k=k.add(W))}))})).next((()=>u.localDocuments.getOverlayedDocuments(I,v))).next((F=>{p=F;const W=[];for(const J of a){const Y=i3(J,p.get(J.key).overlayedDocument);
38Y!=null&&W.push(new kn(J.key,Y,c6(Y.value.mapValue),be.exists(!0)))}return u.mutationQueue.addMutationBatch(I,l,W,a)})).next((F=>{g=F;const W=F.applyToLocalDocumentSet(p,k);return u.documentOverlayCache.saveOverlays(I,F.batchId,W)}))})).then((()=>({batchId:g.batchId,changes:N6(p)})))})(n.localStore,e);n.sharedClientState.addPendingMutation(s.batchId),(function(o,a,u){let l=o.oc[o.currentUser.toKey()];l||(l=new Re(Z)),l=l.insert(a,u),o.oc[o.currentUser.toKey()]=l})(n,s.batchId,t),await Mn(n,s.changes),await Ei(n.remoteStore)}catch(s){const i=wi(s,"Failed to persist write");t.reject(i)}}async function l0(r,e){const t=G(r);try{const n=await m5(t.localStore,e);e.targetChanges.forEach(((s,i)=>{const o=t.sc.get(i);o&&(U(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1,22616),s.addedDocuments.size>0?o.Zu=!0:s.modifiedDocuments.size>0?U(o.Zu,14607):s.removedDocuments.size>0&&(U(o.Zu,42227),o.Zu=!1))})),await Mn(t,n,e)}catch(n){await Ar(n)}}function T2(r,e,t){const n=G(r);if(n.isPrimaryClient&&t===0||!n.isPrimaryClient&&t===1){const s=[];n.ec.forEach(((i,o)=>{const a=o.view.Ru(e);a.snapshot&&s.push(a.snapshot)})),(function(o,a){const u=G(o);u.onlineState=a;let l=!1;u.queries.forEach(((d,p)=>{for(const g of p.Eu)g.Ru(a)&&(l=!0)})),l&&ih(u)})(n.eventManager,e),s.length&&n.Xu.zn(s),n.onlineState=e,n.isPrimaryClient&&n.sharedClientState.setOnlineState(e)}}async function $5(r,e,t){const n=G(r);n.sharedClientState.updateQueryState(e,"rejected",t);const s=n.sc.get(e),i=s&&s.key;if(i){let o=new Re(B.comparator);o=o.insert(i,Ce.newNoDocument(i,K.min()));const a=ne().add(i),u=new mi(K.min(),new Map,new Re(Z),o,qe(),a);await l0(n,u),n.rc=n.rc.remove(i),n.sc.delete(e),hh(n)}else await ei(n.localStore,e,!1).then((()=>ni(n,e,t))).catch(Ar)}async function j5(r,e){const t=G(r),n=e.batch.batchId;try{const s=await p5(t.localStore,e);lh(t,n,null),uh(t,n),t.sharedClientState.updateMutationState(n,"acknowledged"),await Mn(t,s)}catch(s){await Ar(s)}}async function z5(r,e,t){const n=G(r);try{const s=await(function(o,a){const u=G(o);return u.persistence.runTransaction("Reject batch","readwrite-primary",(l=>{let d;return u.mutationQueue.lookupMutationBatch(l,a).next((p=>(U(p!==null,37113),d=p.keys(),u.mutationQueue.removeMutationBatch(l,p)))).next((()=>u.mutationQueue.performConsistencyCheck(l))).next((()=>u.documentOverlayCache.removeOverlaysForBatchId(l,d,a))).next((()=>u.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(l,d))).next((()=>u.localDocuments.getDocuments(l,d)))}))})(n.localStore,e);lh(n,e,t),uh(n,e),n.sharedClientState.updateMutationState(e,"rejected",t),await Mn(n,s)}catch(s){await Ar(s)}}async function H5(r,e){const t=G(r);Sr(t.remoteStore)||M(Pr,"The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");try{const n=await(function(o){const a=G(o);return a.persistence.runTransaction("Get highest unacknowledged batch id","readonly",(u=>
vendor: 24,190 bytes, lines 38-40
38a.mutationQueue.getHighestUnacknowledgedBatchId(u)))})(t.localStore);if(n===or)return void e.resolve();const s=t.ac.get(n)||[];s.push(e),t.ac.set(n,s)}catch(n){const s=wi(n,"Initialization of waitForPendingWrites() operation failed");e.reject(s)}}function uh(r,e){(r.ac.get(e)||[]).forEach((t=>{t.resolve()})),r.ac.delete(e)}function lh(r,e,t){const n=G(r);let s=n.oc[n.currentUser.toKey()];if(s){const i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),n.oc[n.currentUser.toKey()]=s}}function ni(r,e,t=null){r.sharedClientState.removeLocalQueryTarget(e);for(const n of r.tc.get(e))r.ec.delete(n),t&&r.Xu.Ec(n,t);r.tc.delete(e),r.isPrimaryClient&&r._c.s_(e).forEach((n=>{r._c.containsKey(n)||h0(r,n)}))}function h0(r,e){r.nc.delete(e.path.canonicalString());const t=r.rc.get(e);t!==null&&(ti(r.remoteStore,t),r.rc=r.rc.remove(e),r.sc.delete(t),hh(r))}function Ul(r,e,t){for(const n of t)n instanceof o0?(r._c.addReference(n.key,e),W5(r,n)):n instanceof a0?(M(Pr,"Document no longer in limbo: "+n.key),r._c.removeReference(n.key,e),r._c.containsKey(n.key)||h0(r,n.key)):H(19791,{hc:n})}function W5(r,e){const t=e.key,n=t.path.canonicalString();r.rc.get(t)||r.nc.has(n)||(M(Pr,"New document in limbo: "+t),r.nc.add(n),hh(r))}function hh(r){for(;r.nc.size>0&&r.rc.size<r.maxConcurrentLimboResolutions;){const e=r.nc.values().next().value;r.nc.delete(e);const t=new B(re.fromString(e)),n=r.uc.next();r.sc.set(n,new L5(t)),r.rc=r.rc.insert(t,n),eu(r.remoteStore,new sn(dt(pi(t.path)),n,"TargetPurposeLimboResolution",wt.ce))}}async function Mn(r,e,t){const n=G(r),s=[],i=[],o=[];n.ec.isEmpty()||(n.ec.forEach(((a,u)=>{o.push(n.lc(u,e,t).then((l=>{if((l||t)&&n.isPrimaryClient){const d=l?!l.fromCache:t?.targetChanges.get(u.targetId)?.current;n.sharedClientState.updateQueryState(u.targetId,d?"current":"not-current")}if(l){s.push(l);const d=Y1.vo(u.targetId,l);i.push(d)}})))})),await Promise.all(o),n.Xu.zn(s),await(async function(u,l){const d=G(u);try{await d.persistence.runTransaction("notifyLocalViewChanges","readwrite",(p=>C.forEach(l,(g=>C.forEach(g.wo,(I=>d.persistence.referenceDelegate.addReference(p,g.targetId,I))).next((()=>C.forEach(g.bo,(I=>d.persistence.referenceDelegate.removeReference(p,g.targetId,I)))))))))}catch(p){if(!Rr(p))throw p;M(J1,"Failed to update sequence numbers: "+p)}for(const p of l){const g=p.targetId;if(!p.fromCache){const I=d.$o.get(g),v=I.snapshotVersion,k=I.withLastLimboFreeSnapshotVersion(v);d.$o=d.$o.insert(g,k)}}})(n.localStore,i))}async function K5(r,e){const t=G(r);if(!t.currentUser.isEqual(e)){M(Pr,"User change. New user:",e.toKey());const n=await $m(t.localStore,e);t.currentUser=e,(function(i,o){i.ac.forEach((a=>{a.forEach((u=>{u.reject(new L(N.CANCELLED,o))}))})),i.ac.clear()})(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,n.removedBatchIds,n.addedBatchIds),await Mn(t,n.zo)}}function Q5(r,e){const t=G(r),n=t.sc.get(e);if(n&&n.Zu)return ne().add(n.key);{let s=ne();const i=t.tc.get(e);if(!i)return s;for(const o of i??[]){const a=t.ec.get(o);s=s.unionWith(a.view.Uu)}return s}}async function Y5(r,e){const t=G(r),n=await gc(t.localStore,e.query,!0),s=e.view.Ju(n);return t.isPrimaryClient&&Ul(t,e.targetId,s.ju),s}async function J5(r,e){const t=G(r);return kl(t.localStore,e).then((n=>Mn(t,n)))}async function X5(r,e,t,n){const s=G(r),i=await(function(a,u){const l=G(a),d=G(l.mutationQueue);return l.persistence.runTransaction("Lookup mutation documents","readonly",(p=>d.ps(p,u).next((g=>g?l.localDocuments.getDocuments(p,g):C.resolve(null)))))})(s.localStore,e);i!==null?(t==="pending"?await Ei(s.remoteStore):t==="acknowledged"||t==="rejected"?(lh(s,e,n||null),uh(s,e),(function(a,u){G(G(a).mutationQueue).bs(u)})(s.localStore,e)):H(6720,"Unknown batchState",{Tc:t}),await Mn(s,i)):M(Pr,"Cannot apply mutation batch with id: "+e)}async function Z5(r,e){const t=G(r);if(tu(t),dh(t),e===!0&&t.cc!==!0){const n=t.sharedClientState.getAllActiveQueryTargets(),s=await A2(t,n.toArray());t.cc=!0,await Ml(t.remoteStore,!0);for(const i of s)eu(t.remoteStore,i)}else if(e===!1&&t.cc!==!1){const n=[];let s=Promise.resolve();t.tc.forEach(((i,o)=>{t.sharedClientState.isLocalQueryTarget(o)?n.push(o):s=s.then((()=>(ni(t,o),ei(t.localStore,o,!0)))),ti(t.remoteStore,o)})),await s,await A2(t,n),(function(o){const a=G(o);a.sc.forEach(((u,l)=>{ti(a.remoteStore,l)})),a._c.__(),a.sc=new Map,a.rc=new Re(B.comparator)})(t),t.cc=!1,await Ml(t.remoteStore,!1)}}async function A2(r,e,t){const n=G(r),s=[],i=[];for(const o of e){let a;const u=n.tc.get(o);if(u&&u.length!==0){a=await Zs(n.localStore,Oe(u[0])?u[0]:dt(u[0]));for(const l of u){const d=n.ec.get(l),p=await Y5(n,d);p.snapshot&&i.push(p.snapshot)}}else{const l=await Hm(n.localStore,o);a=await Zs(n.localStore,l),await ch(n,d0(l),o,!1,a.resumeToken)}s.push(a)}return n.Xu.zn(i),s}function d0(r){return En(r)?r:A6(r.path,r.collectionGroup,r.orderBy,r.filters,r.limit,"F",r.startAt,r.endAt)}function ey(r){return(function(t){return G(G(t).persistence).po()})(G(r).localStore)}async function ty(r,e,t,n){const s=G(r);if(s.cc)return void M(Pr,"Ignoring unexpected query state notification.");const i=s.tc.get(e);if(i&&i.length>0)switch(t){case"current":case"not-current":{let o;if(Oe(i[0]))switch(Rn(i[0])){case"collection_group":case"collection":o=await kl(s.localStore,Im(i[0]));break;case"documents":o=await(function(l,d){const p=G(l),g=ne(...lc(d).map((I=>B.fromPath(I))));return p.persistence.runTransaction("Get documents for pipeline","readonly",(I=>p.Qo.getEntries(I,g))).then((I=>I))})(s.localStore,i[0]);break;default:We(""),o=Ur()}else o=await kl(s.localStore,(function(l){return l.collectionGroup||(l.path.length%2==1?l.path.lastSegment():l.path.get(l.path.length-2))})(i[0]));const a=mi.createSynthesizedRemoteEventForCurrentChange(e,t==="current",Se.EMPTY_BYTE_STRING);await Mn(s,o,a);break}case"rejected":await ei(s.localStore,e,!0),ni(s,e,n);break;default:H(64155,t)}}async function ny(r,e,t){const n=tu(r);if(n.cc){for(const s of e){if(n.tc.has(s)&&n.sharedClientState.isActiveQueryTarget(s)){M(Pr,"Adding an already active target "+s);continue}const i=await Hm(n.localStore,s),o=await Zs(n.localStore,i);await ch(n,d0(i),o.targetId,!1,o.resumeToken),eu(n.remoteStore,o)}for(const s of t)n.tc.has(s)&&await ei(n.localStore,s,!1).then((()=>{ti(n.remoteStore,s),ni(n,s)})).catch(Ar)}}function tu(r){const e=G(r);return e.remoteStore.remoteSyncer.applyRemoteEvent=l0.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Q5.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=$5.bind(null,e),e.Xu.zn=D5.bind(null,e.eventManager),e.Xu.Ec=k5.bind(null,e.eventManager),e}function dh(r){const e=G(r);return e.remoteStore.remoteSyncer.applySuccessfulWrite=j5.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=z5.bind(null,e),e}function ry(r,e,t){const n=G(r);(async function(i,o,a){try{const u=await o.getMetadata();if(await(function(I,v){const k=G(I),F=Me(v.createTime);return k.persistence.runTransaction("hasNewerBundle","readonly",(W=>k.w_.getBundleMetadata(W,v.id))).then((W=>!!W&&W.createTime.compareTo(F)>=0))})(i.localStore,u))return await o.close(),a._completeWith((function(I){return{taskState:"Success",documentsLoaded:I.totalDocuments,bytesLoaded:I.totalBytes,totalDocuments:I.totalDocuments,totalBytes:I.totalBytes}})(u)),Promise.resolve(new Set);a._updateProgress(i0(u));const l=new ah(u,o.serializer);let d=await o.Pc();for(;d;){const g=await l.o(d);g&&a._updateProgress(g),d=await o.Pc()}const p=await l.xu(i.localStore);return await Mn(i,p.Fu,void 0),await(function(I,v){const k=G(I);return k.persistence.runTransaction("Save bundle","readwrite",(F=>k.w_.saveBundleMetadata(F,v)))})(i.localStore,u),a._completeWith(p.progress),Promise.resolve(p.Cu)}catch(u){return We(Pr,`Loading bundle failed with ${u}`),a._failWith(u),Promise.resolve(new Set)}})(n,e,t).then((s=>{n.sharedClientState.notifyBundleLoaded(s)}))}class ri{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=cs(e.databaseInfo.databaseId),this.sharedClientState=this.Rc(e),this.persistence=this.Ic(e),await this.persistence.start(),this.localStore=this.Ac(e),this.gcScheduler=this.Vc(e,this.localStore),this.indexBackfillerScheduler=this.dc(e,this.localStore)}Vc(e,t){return null}dc(e,t){return null}Ac(e){return Gm(this.persistence,new qm,e.initialUser,this.serializer)}Ic(e){return new W1(Zc.C_,this.serializer)}Rc(e){return new Jm}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}ri.provider={build:()=>new ri};class fh extends ri{constructor(e){super(),this.cacheSizeBytes=e}Vc(e,t){U(this.persistence.referenceDelegate instanceof mc,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new em(n,e.asyncQueue,t)}Ic(e){const t=this.cacheSizeBytes!==void 0?ut.withCacheSize(this.cacheSizeBytes):ut.DEFAULT;return new W1((n=>mc.C_(n,t)),this.serializer)}}class ph extends ri{constructor(e,t,n){super(),this.fc=e,this.cacheSizeBytes=t,this.forceOwnership=n,this.kind="persistent",this.synchronizeTabs=!1}async initialize(e){await super.initialize(e),await this.fc.initialize(this,e),await dh(this.fc.syncEngine),await Ei(this.fc.remoteStore),await this.persistence._o((()=>(this.gcScheduler&&!this.gcScheduler.started&&this.gcScheduler.start(),this.indexBackfillerScheduler&&!this.indexBackfillerScheduler.started&&this.indexBackfillerScheduler.start(),Promise.resolve())))}Ac(e){return Gm(this.persistence,new qm,e.initialUser,this.serializer)}Vc(e,t){const n=this.persistence.referenceDelegate.garbageCollector;return new em(n,e.asyncQueue,t)}dc(e,t){const n=new I_(t,this.persistence);return new E_(e.asyncQueue,n)}Ic(e){const t=Q1(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),n=this.cacheSizeBytes!==void 0?ut.withCacheSize(this.cacheSizeBytes):ut.DEFAULT;return new K1(this.synchronizeTabs,t,e.clientId,n,e.asyncQueue,Xm(),Ha(),this.serializer,this.sharedClientState,!!this.forceOwnership)}Rc(e){return new Jm}}class f0 extends ph{constructor(e,t){super(e,t,!1),this.fc=e,this.cacheSizeBytes=t,this.synchronizeTabs=!0}async initialize(e){await super.initialize(e);const t=this.fc.syncEngine;this.sharedClientState instanceof Zu&&(this.sharedClientState.syncEngine={Na:X5.bind(null,t),La:ty.bind(null,t),Ba:ny.bind(null,t),po:ey.bind(null,t),Ma:J5.bind(null,t)},await this.sharedClientState.start()),await this.persistence._o((async n=>{await Z5(this.fc.syncEngine,n),this.gcScheduler&&(n&&!this.gcScheduler.started?this.gcScheduler.start():n||this.gcScheduler.stop()),this.indexBackfillerScheduler&&(n&&!this.indexBackfillerScheduler.started?this.indexBackfillerScheduler.start():n||this.indexBackfillerScheduler.stop())}))}Rc(e){const t=Xm();if(!Zu.C(t))throw new L(N.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");const n=Q1(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);return new Zu(t,e.asyncQueue,n,e.clientId,e.initialUser)}}class Ir{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=n=>T2(this.syncEngine,n,1),this.remoteStore.remoteSyncer.handleCredentialChange=K5.bind(null,this.syncEngine),await Ml(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return(function(){return new O5})()}createDatastore(e){const t=cs(e.databaseInfo.databaseId),n=$3(e.databaseInfo);return K3(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return(function(n,s,i,o,a){return new I5(n,s,i,o,a)})(this.localStore,this.datastore,e.asyncQueue,(t=>T2(this.syncEngine,t,0)),(function(){return Gf.C()?new Gf:new U3})())}createSyncEngine(e,t){return(function(s,i,o,a,u,l,d){const p=new M5(s,i,o,a,u,l);return d&&(p.cc=!0),p})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){await(async function(t){const n=G(t);M(dn,"RemoteStore shutting down."),n.tu.add(5),await yi(n),n.ru.shutdown(),n.iu.set("Unknown")})(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}}Ir.provider={build:()=>new Ir};function R2(r,e=10240){let t=0;return{async read(){if(t<r.byteLength){const n={value:r.slice(t,t+e),done:!1};return t+=e,n}return{done:!0}},async cancel(){},releaseLock(){},closed:Promise.resolve()}}class nu{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.mc(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.mc(this.observer.error,e):Le("Uncaught Error in snapshot listener:",e.toString()))}gc(){this.muted=!0}mc(e,t){setTimeout((()=>{this.muted||e(t)}),0)}}class sy{constructor(e,t){this.yc=e,this.serializer=t,this.metadata=new nt,this.buffer=new Uint8Array,this.wc=(function(){return new TextDecoder("utf-8")})(),this.bc().then((n=>{n&&n.yu()?this.metadata.resolve(n.gu.metadata):this.metadata.reject(new Error(`The first element of the bundle is not a metadata, it is
39             ${JSON.stringify(n?.gu)}`))}),(n=>this.metadata.reject(n)))}close(){return this.yc.cancel()}async getMetadata(){return this.metadata.promise}async Pc(){return await this.getMetadata(),this.bc()}async bc(){const e=await this.vc();if(e===null)return null;const t=this.wc.decode(e),n=Number(t);isNaN(n)&&this.Sc(`length string (${t}) is not valid number`);const s=await this.Dc(n);return new s0(JSON.parse(s),e.length+n)}xc(){return this.buffer.findIndex((e=>e===123))}async vc(){for(;this.xc()<0&&!await this.Cc(););if(this.buffer.length===0)return null;const e=this.xc();e<0&&this.Sc("Reached the end of bundle when a length string is expected.");const t=this.buffer.slice(0,e);return this.buffer=this.buffer.slice(e),t}async Dc(e){for(;this.buffer.length<e;)await this.Cc()&&this.Sc("Reached the end of bundle when more is expected.");const t=this.wc.decode(this.buffer.slice(0,e));return this.buffer=this.buffer.slice(e),t}Sc(e){throw this.yc.cancel(),new Error(`Invalid bundle format: ${e}`)}async Cc(){const e=await this.yc.read();if(!e.done){const t=new Uint8Array(this.buffer.length+e.value.length);t.set(this.buffer),t.set(e.value,this.buffer.length),this.buffer=t}return e.done}}class iy{constructor(e,t){this.bundleData=e,this.serializer=t,this.cursor=0,this.elements=[];let n=this.Pc();if(!n||!n.yu())throw new Error(`The first element of the bundle is not a metadata object, it is
40         ${JSON.stringify(n?.gu)}`);this.metadata=n;do n=this.Pc(),n!==null&&this.elements.push(n);while(n!==null)}getMetadata(){return this.metadata}t(){return this.elements}Pc(){if(this.cursor===this.bundleData.length)return null;const e=this.vc(),t=this.Dc(e);return new s0(JSON.parse(t),e)}Dc(e){if(this.cursor+e>this.bundleData.length)throw new L(N.INTERNAL,"Reached the end of bundle when more is expected.");return this.bundleData.slice(this.cursor,this.cursor+=e)}vc(){const e=this.cursor;let t=this.cursor;for(;t<this.bundleData.length;){if(this.bundleData[t]==="{"){if(t===e)throw new Error("First character is a bracket and not a number");return this.cursor=t,Number(this.bundleData.slice(e,t))}t++}throw new Error("Reached the end of bundle when more is expected.")}}let oy=class{constructor(e){this.datastore=e,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastTransactionError=null,this.writtenDocs=new Set}async lookup(e){if(this.ensureCommitNotCalled(),this.mutations.length>0)throw this.lastTransactionError=new L(N.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;const t=await(async function(s,i){const o=G(s),a={documents:i.map((p=>Xs(o.serializer,p)))},u=await o.$t("BatchGetDocuments",o.serializer.databaseId,re.emptyPath(),a,i.length),l=new Map;u.forEach((p=>{const g=V3(o.serializer,p);l.set(g.key.toString(),g)}));const d=[];return i.forEach((p=>{const g=l.get(p.toString());U(!!g,55234,{key:p}),d.push(g)})),d})(this.datastore,e);return t.forEach((n=>this.recordVersion(n))),t}set(e,t){this.write(t.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,t){try{this.write(t.toMutation(e,this.preconditionForUpdate(e)))}catch(n){this.lastTransactionError=n}this.writtenDocs.add(e.toString())}delete(e){this.write(new fi(e,this.precondition(e))),this.writtenDocs.add(e.toString())}async commit(){if(this.ensureCommitNotCalled(),this.lastTransactionError)throw this.lastTransactionError;const e=this.readVersions;this.mutations.forEach((t=>{e.delete(t.key.toString())})),e.forEach(((t,n)=>{const s=B.fromPath(n);this.mutations.push(new c1(s,this.precondition(s)))})),await(async function(n,s){const i=G(n),o={writes:s.map((a=>No(i.serializer,a)))};await i.Bt("Commit",i.serializer.databaseId,re.emptyPath(),o)})(this.datastore,this.mutations),this.committed=!0}recordVersion(e){let t;if(e.isFoundDocument())t=e.version;else{if(!e.isNoDocument())throw H(50498,{Oc:e.constructor.name});t=K.min()}const n=this.readVersions.get(e.key.toString());if(n){if(!t.isEqual(n))throw new L(N.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),t)}precondition(e){const t=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&t?t.isEqual(K.min())?be.exists(!1):be.updateTime(t):be.none()}preconditionForUpdate(e){const t=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&t){if(t.isEqual(K.min()))throw new L(N.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return be.updateTime(t)}return be.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}};class ay{constructor(e,t,n,s,i){this.asyncQueue=e,this.datastore=t,this.options=n,this.updateFunction=s,this.deferred=i,this.Mc=n.maxAttempts,this.xn=new y1(this.asyncQueue,"transaction_retry")}Nc(){this.Mc-=1,this.Lc()}Lc(){this.xn.mn((async()=>{const e=new oy(this.datastore),t=this.Bc(e);t&&t.then((n=>{this.asyncQueue.enqueueAndForget((()=>e.commit().then((()=>{this.deferred.resolve(n)})).catch((s=>{this.Uc(s)}))))})).catch((n=>{this.Uc(n)}))}))}Bc(e){try{const t=this.updateFunction(e);return!$o(t)&&t.catch&&t.then?t:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.deferred.reject(t),null}}Uc(e){this.Mc>0&&this.kc(e)?(this.Mc-=1,this.asyncQueue.enqueueAndForget((()=>(this.Lc(),Promise.resolve())))):this.deferred.reject(e)}kc(e){if(e?.name==="FirebaseError"){const t=e.code;return t==="aborted"||t==="failed-precondition"||t==="already-exists"||!P6(t)}return!1}}const wr="FirestoreClient";class cy{constructor(e,t,n,s,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this._databaseInfo=s,this.user=et.UNAUTHENTICATED,this.clientId=Nc.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(n,(async o=>{M(wr,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o})),this.appCheckCredentials.start(n,(o=>(M(wr,"Received new app check token=",o),this.appCheckCredentialListener(o,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();const e=new nt;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(t){const n=wi(t,"Failed to shutdown persistence");e.reject(n)}})),e.promise}}async function el(r,e){r.asyncQueue.verifyOperationInProgress(),M(wr,"Initializing OfflineComponentProvider");const t=r.configuration;await e.initialize(t);let n=t.initialUser;r.setCredentialChangeListener((async s=>{n.isEqual(s)||(await $m(e.localStore,s),n=s)})),e.persistence.setDatabaseDeletedListener((()=>r.terminate())),r._offlineComponents=e}async function v2(r,e){r.asyncQueue.verifyOperationInProgress();const t=await mh(r);M(wr,"Initializing OnlineComponentProvider"),await e.initialize(t,r.configuration),r.setCredentialChangeListener((n=>y2(e.remoteStore,n))),r.setAppCheckTokenChangeListener(((n,s)=>y2(e.remoteStore,s))),r._onlineComponents=e}async function mh(r){if(!r._offlineComponents)if(r._uninitializedComponentsProvider){M(wr,"Using user provided OfflineComponentProvider");try{await el(r,r._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!(function(s){return s.name==="FirebaseError"?s.code===N.FAILED_PRECONDITION||s.code===N.UNIMPLEMENTED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11})(t))throw t;We("Error using user provided cache. Falling back to memory cache: "+t),await el(r,new ri)}}else M(wr,"Using default OfflineComponentProvider"),await el(r,new fh(void 0));return r._offlineComponents}async function ru(r){return r._onlineComponents||(r._uninitializedComponentsProvider?(M(wr,"Using user provided OnlineComponentProvider"),await v2(r,r._uninitializedComponentsProvider._online)):(M(wr,"Using default OnlineComponentProvider"),await v2(r,new Ir))),r._onlineComponents}function p0(r){return mh(r).then((e=>e.persistence))}function Ti(r){return mh(r).then((e=>e.localStore))}function m0(r){return ru(r).then((e=>e.remoteStore))}function gh(r){return ru(r).then((e=>e.syncEngine))}function g0(r){return ru(r).then((e=>e.datastore))}async function si(r){const e=await ru(r),t=e.eventManager;return t.onListen=F5.bind(null,e.syncEngine),t.onUnlisten=B5.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=U5.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=q5.bind(null,e.syncEngine),t}function uy(r){return r.asyncQueue.enqueue((async()=>{const e=await p0(r),t=await m0(r);return e.setNetworkEnabled(!0),(function(s){const i=G(s);return i.tu.delete(0),ta(i)})(t)}))}function ly(r){return r.asyncQueue.enqueue((async()=>{const e=await p0(r),t=await m0(r);return e.setNetworkEnabled(!1),(async function(s){const i=G(s);i.tu.add(0),await yi(i),i.iu.set("Offline")})(t)}))}function hy(r,e,t,n){const s=new nu(n),i=new oh(e,s,t);return r.asyncQueue.enqueueAndForget((async()=>rh(await si(r),i))),()=>{s.gc(),r.asyncQueue.enqueueAndForget((async()=>sh(await si(r),i)))}}function dy(r,e){const t=new nt;return r.asyncQueue.enqueueAndForget((async()=>(async function(s,i,o){try{const a=await(function(l,d){const p=G(l);return p.persistence.runTransaction("read document","readonly",(g=>p.localDocuments.getDocument(g,d)))})(s,i);a.isFoundDocument()?o.resolve(a):a.isNoDocument()?o.resolve(null):o.reject(new L(N.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)"))}catch(a){const u=wi(a,`Failed to get document '${i} from cache`);o.reject(u)}})(await Ti(r),e,t))),t.promise}function _0(r,e,t={}){const n=new nt;return r.asyncQueue.enqueueAndForget((async()=>(function(i,o,a,u,l){const d=new nu({next:g=>{d.gc(),o.enqueueAndForget((()=>sh(i,p)));const I=g.docs.has(a);!I&&g.fromCache?l.reject(new L(N.UNAVAILABLE,"Failed to get document because the client is offline.")):I&&g.fromCache&&u&&u.source==="server"?l.reject(new L(N.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):l.resolve(g)},error:g=>l.reject(g)}),p=new oh(pi(a.path),d,{includeMetadataChanges:!0,waitForSyncWhe
40nOnline:!0});return rh(i,p)})(await si(r),r.asyncQueue,e,t,n))),n.promise}function fy(r,e){const t=new nt;return r.asyncQueue.enqueueAndForget((async()=>(async function(s,i,o){try{const a=await gc(s,i,!0),u=new c0(i,a.Jo),l=u.ku(a.documents),d=u.applyChanges(l,!1);o.resolve(d.snapshot)}catch(a){const u=wi(a,`Failed to execute query '${i} against cache`);o.reject(u)}})(await Ti(r),e,t))),t.promise}function y0(r,e,t={}){const n=new nt;return r.asyncQueue.enqueueAndForget((async()=>(function(i,o,a,u,l){const d=new nu({next:g=>{d.gc(),o.enqueueAndForget((()=>sh(i,p))),g.fromCache&&u.source==="server"?l.reject(new L(N.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):l.resolve(g)},error:g=>l.reject(g)}),p=new oh(a instanceof mo?M8(a):a,d,{includeMetadataChanges:!0,waitForSyncWhenOnline:!0});return rh(i,p)})(await si(r),r.asyncQueue,e,t,n))),n.promise}function py(r,e,t){const n=new nt;return r.asyncQueue.enqueueAndForget((async()=>{try{const s=await g0(r);n.resolve((async function(o,a,u){const l=G(o),{request:d,wt:p,parent:g}=q6(l.serializer,R6(a),u);l.connection.Ot||delete d.parent;const I=(await l.$t("RunAggregationQuery",l.serializer.databaseId,g,d,1)).filter((k=>!!k.result));U(I.length===1,64727);const v=I[0].result?.aggregateFields;return Object.keys(v).reduce(((k,F)=>(k[p[F]]=v[F],k)),{})})(s,e,t))}catch(s){n.reject(s)}})),n.promise}function my(r,e){const t=new nt;return r.asyncQueue.enqueueAndForget((async()=>G5(await gh(r),e,t))),t.promise}function gy(r,e){const t=new nu(e);return r.asyncQueue.enqueueAndForget((async()=>(function(s,i){G(s).Pu.add(i),i.next()})(await si(r),t))),()=>{t.gc(),r.asyncQueue.enqueueAndForget((async()=>(function(s,i){G(s).Pu.delete(i)})(await si(r),t)))}}function _y(r,e,t){const n=new nt;return r.asyncQueue.enqueueAndForget((async()=>{const s=await g0(r);new ay(r.asyncQueue,s,t,e,n).Nc()})),n.promise}function yy(r,e,t,n){const s=(function(o,a){let u;return u=typeof o=="string"?O6().encode(o):o,(function(d,p){return new sy(d,p)})((function(d,p){if(d instanceof Uint8Array)return R2(d,p);if(d instanceof ArrayBuffer)return R2(new Uint8Array(d),p);if(d instanceof ReadableStream)return d.getReader();throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream")})(u),a)})(t,cs(e));r.asyncQueue.enqueueAndForget((async()=>{ry(await gh(r),s,n)}))}function Ey(r,e){return r.asyncQueue.enqueue((async()=>(function(n,s){const i=G(n);return i.persistence.runTransaction("Get named query","readonly",(o=>i.w_.getNamedQuery(o,s)))})(await Ti(r),e)))}function E0(r,e){return(function(n,s){return new iy(n,s)})(r,e)}function Iy(r,e){return r.asyncQueue.enqueue((async()=>(async function(n,s){const i=G(n),o=i.indexManager,a=[];return i.persistence.runTransaction("Configure indexes","readwrite",(u=>o.getFieldIndexes(u).next((l=>(function(p,g,I,v,k){p=[...p],g=[...g],p.sort(I),g.sort(I);const F=p.length,W=g.length;let J=0,Y=0;for(;J<W&&Y<F;){const me=I(p[Y],g[J]);me<0?k(p[Y++]):me>0?v(g[J++]):(J++,Y++)}for(;J<W;)v(g[J++]);for(;Y<F;)k(p[Y++])})(l,s,m_,(d=>{a.push(o.addFieldIndex(u,d))}),(d=>{a.push(o.deleteFieldIndex(u,d))})))).next((()=>C.waitFor(a)))))})(await Ti(r),e)))}function wy(r,e){return r.asyncQueue.enqueue((async()=>(function(n,s){G(n).qo.Do=s})(await Ti(r),e)))}function Ty(r){return r.asyncQueue.enqueue((async()=>(function(t){const n=G(t),s=n.indexManager;return n.persistence.runTransaction("Delete All Indexes","readwrite",(i=>s.deleteAllFieldIndexes(i)))})(await Ti(r))))}const S2="AsyncQueue";class P2{constructor(e=Promise.resolve()){this.qc=[],this.$c=!1,this.Kc=[],this.Wc=null,this.Qc=!1,this.Gc=!1,this.zc=[],this.xn=new y1(this,"async_queue_retry"),this.jc=()=>{const n=Ha();n&&M(S2,"Visibility state changed to "+n.visibilityState),this.xn.gn()},this.Hc=e;const t=Ha();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.jc)}get isShuttingDown(){return this.$c}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Jc(),this.Yc(e)}enterRestrictedMode(e){if(!this.$c){this.$c=!0,this.Gc=e||!1;const t=Ha();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.jc)}}enqueue(e){if(this.Jc(),this.$c)return new Promise((()=>{}));const t=new nt;
vendor: 4,352 bytes, lines 40-41
40return this.Yc((()=>this.$c&&this.Gc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.qc.push(e),this.Zc())))}async Zc(){if(this.qc.length!==0){try{await this.qc[0](),this.qc.shift(),this.xn.reset()}catch(e){if(!Rr(e))throw e;M(S2,"Operation failed with retryable error: "+e)}this.qc.length>0&&this.xn.mn((()=>this.Zc()))}}Yc(e){const t=this.Hc.then((()=>(this.Qc=!0,e().catch((n=>{throw this.Wc=n,this.Qc=!1,Le("INTERNAL UNHANDLED ERROR: ",C2(n)),n})).then((n=>(this.Qc=!1,n))))));return this.Hc=t,t}enqueueAfterDelay(e,t,n){this.Jc(),this.zc.indexOf(e)>-1&&(t=0);const s=nh.createAndSchedule(this,e,t,n,(i=>this.Xc(i)));return this.Kc.push(s),s}Jc(){this.Wc&&H(47125,{el:C2(this.Wc)})}verifyOperationInProgress(){}async tl(){let e;do e=this.Hc,await e;while(e!==this.Hc)}nl(e){for(const t of this.Kc)if(t.timerId===e)return!0;return!1}rl(e){return this.tl().then((()=>{this.Kc.sort(((t,n)=>t.targetTimeMs-n.targetTimeMs));for(const t of this.Kc)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.tl()}))}il(e){this.zc.push(e)}Xc(e){const t=this.Kc.indexOf(e);this.Kc.splice(t,1)}}function C2(r){let e=r.message||"";return r.stack&&(e=r.stack.includes(r.message)?r.stack:r.message+`
41`+r.stack),e}class I0{constructor(){this._progressObserver={},this._taskCompletionResolver=new nt,this._lastProgress={taskState:"Running",totalBytes:0,totalDocuments:0,bytesLoaded:0,documentsLoaded:0}}onProgress(e,t,n){this._progressObserver={next:e,error:t,complete:n}}catch(e){return this._taskCompletionResolver.promise.catch(e)}then(e,t){return this._taskCompletionResolver.promise.then(e,t)}_completeWith(e){this._updateProgress(e),this._progressObserver.complete&&this._progressObserver.complete(),this._taskCompletionResolver.resolve(e)}_failWith(e){this._lastProgress.taskState="Error",this._progressObserver.next&&this._progressObserver.next(this._lastProgress),this._progressObserver.error&&this._progressObserver.error(e),this._taskCompletionResolver.reject(e)}_updateProgress(e){this._lastProgress=e,this._progressObserver.next&&this._progressObserver.next(e)}}const Ay=-1;class we extends Ko{constructor(e,t,n,s){super(e,t,n,s),this.type="firestore",this._queue=new P2,this._persistenceKey=s?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new P2(e),this._firestoreClient=void 0,await e}}}function Ry(r,e,t){t||(t=Po);const n=ci(r,"firestore");if(n.isInitialized(t)){const s=n.getImmediate({identifier:t}),i=n.getOptions(t);if(Kt(i,e))return s;throw new L(N.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(e.cacheSizeBytes!==void 0&&e.localCache!==void 0)throw new L(N.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(e.cacheSizeBytes!==void 0&&e.cacheSizeBytes!==-1&&e.cacheSizeBytes<Z6)throw new L(N.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return e.host&&Tr(e.host)&&Cc(e.host),n.initialize({options:e,instanceIdentifier:t})}function vy(r,e){const t=typeof r=="object"?r:Kl(),n=typeof r=="string"?r:e||Po,s=ci(t,"firestore").getImmediate({identifier:n});if(!s._initialized){const i=dp("firestore");i&&rm(s,...i)}return s}function Ne(r){if(r._terminated)throw new L(N.FAILED_PRECONDITION,"The client has already been terminated.");return r._firestoreClient||w0(r),r._firestoreClient}function w0(r){const e=r._freezeSettings(),t=Y3(r._databaseId,r._app?.options.appId||"",r._persistenceKey,r._app?.options.apiKey,e);r._componentsProvider||e.localCache?._offlineComponentProvider&&e.localCache?._onlineComponentProvider&&(r._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),r._firestoreClient=new cy(r._authCredentials,r._appCheckCredentials,r._queue,t,r._componentsProvider&&(function(s){const i=s?._online.build();return{_offline:s?._offline.build(i),_online:i}})(r._componentsProvider))}function Sy(r,e){We("enableIndexedDbPersistence() will be deprecated 
41in the future, you can use `FirestoreSettings.cache` instead.");const t=r._freezeSettings();return T0(r,Ir.provider,{build:n=>new ph(n,t.cacheSizeBytes,e?.forceOwnership)}),Promise.resolve()}async function Py(r){We("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");const e=r._freezeSettings();T0(r,Ir.provider,{build:t=>new f0(t,e.cacheSizeBytes)})}function T0(r,e,t){if((r=oe(r,we))._firestoreClient||r._terminated)throw new L(N.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.");if(r._componentsProvider||r._getSettings().localCache)throw new L(N.FAILED_PRECONDITION,"SDK cache is already specified.");r._componentsProvider={_online:e,_offline:t},w0(r)}function Cy(r){if(r._initialized&&!r._terminated)throw new L(N.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");const e=new nt;return r._queue.enqueueAndForgetEvenWhileRestricted((async()=>{try{await(async function(n){if(!an.C())return Promise.resolve();const s=n+Bm;await an.delete(s)})(Q1(r._databaseId,r._persistenceKey)),e.resolve()}catch(t){e.reject(t)}})),e.promise}function by(r){return(function(t){const n=new nt;return t.asyncQueue.enqueueAndForget((async()=>H5(await gh(t),n))),n.promise})(Ne(r=oe(r,we)))}function Ny(r){return uy(Ne(r=oe(r,we)))}function Vy(r){return ly(Ne(r=oe(r,we)))}function Oy(r){return N4(r.app,"firestore",r._databaseId.database),r._delete()}function Bl(r,e){const t=Ne(r=oe(r,we)),n=new I0;return yy(t,r._databaseId,e,n),n}function A0(r,e){return Ey(Ne(r=oe(r,we)),e).then((t=>t?new Ke(r,null,t.query):null))}class _h{convertValue(e,t="none"){switch($e(e)){case 0:return null;case 1:return e.booleanValue;case 2:return ve(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(bn(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 H(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const n={};return vr(e,((s,i)=>{n[s]=this.convertValue(i,t)})),n}convertVectorValue(e){const t=e.fields?.[Yr].arrayValue?.values?.map((n=>ve(n.doubleValue)));return new _t(t)}convertGeoPoint(e){return new Ht(ve(e.latitude),ve(e.longitude))}convertArray(e,t){return(e.values||[]).map((n=>this.convertValue(n,t)))}convertServerTimestamp(e,t){switch(t){case"previous":const n=Ho(e);return n==null?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(zs(e));default:return null}}convertTimestamp(e){const t=Cn(e);return new ge(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=re.fromString(e);U(H6(n),9688,{name:e});const s=new dr(n.get(1),n.get(3)),i=new B(n.popFirst(5));return s.isEqual(t)||Le(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),i}}class Cr extends _h{constructor(e){super(),this.firestore=e}convertBytes(e){return new It(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new _e(this.firestore,null,t)}}function Dy(r){const e=Ne(oe(r.firestore,we)),t=e._onlineComponents?.datastore.serializer;return t===void 0?null:qc(t,dt(r._query)).yt}function ky(r,e){const t=r1(e,((i,o)=>new m6(o,i.aggregateType,i._internalFieldPath))),n=Ne(oe(r.firestore,we)),s=n._onlineComponents?.datastore.serializer;return s===void 0?null:q6(s,R6(r._query),t,!0).request}const b2="@firebase/firestore",N2="4.16.0";function Vs(r){return(function(t,n){if(typeof t!="object"||t===null)return!1;const s=t;for(const i of n)if(i in s&&typeof s[i]=="function")return!0;return!1})(r,["next","error","complete"])}class ii{constructor(e="count",t){this._internalFieldPath=t,this.type="AggregateField",this.aggregateType=e}}class R0{constructor(e,t,n){this._userDataWriter=t,this._data=n,this.type="AggregateQuerySnapsh
41ot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}_fieldsProto(){return new ze({mapValue:{fields:this._data}}).clone().value.mapValue.fields}}class Mo{constructor(e,t,n,s,i){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new _e(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new xy(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(e){if(this._document){const t=this._document.data.field(Qt("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class xy extends Mo{data(){return super.data()}}function v0(r){if(r.limitType==="L"&&r.explicitOrderBy.length===0)throw new L(N.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class yh{}class Ai extends yh{}function Ly(r,e,...t){let n=[];e instanceof yh&&n.push(e),n=n.concat(t),(function(i){const o=i.filter((u=>u instanceof ps)).length,a=i.filter((u=>u instanceof Ri)).length;if(o>1||o>0&&a>0)throw new L(N.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")})(n);for(const s of n)r=s._apply(r);return r}class Ri extends Ai{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new Ri(e,t,n)}_apply(e){const t=this._parse(e);return P0(e._query,t),new Ke(e.firestore,e.converter,Tl(e._query,t))}_parse(e){const t=ls(e.firestore);return(function(i,o,a,u,l,d,p){let g;if(l.isKeyField()){if(d==="array-contains"||d==="array-contains-any")throw new L(N.INVALID_ARGUMENT,`Invalid Query. You can't perform '${d}' queries on documentId().`);if(d==="in"||d==="not-in"){O2(p,d);const v=[];for(const k of p)v.push(V2(u,i,k));g={arrayValue:{values:v}}}else g=V2(u,i,p)}else d!=="in"&&d!=="not-in"&&d!=="array-contains-any"||O2(p,d),g=cm(a,o,p,d==="in"||d==="not-in");return ue.create(l,d,g)})(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function My(r,e,t){const n=e,s=Qt("where",r);return Ri._create(s,n,t)}class ps extends yh{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new ps(e,t)}_parse(e){const t=this._queryConstraints.map((n=>n._parse(e))).filter((n=>n.getFilters().length>0));return t.length===1?t[0]:Ee.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:((function(s,i){let o=s;const a=i.getFlattenedFilters();for(const u of a)P0(o,u),o=Tl(o,u)})(e._query,t),new Ke(e.firestore,e.converter,Tl(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}function Fy(...r){return r.forEach((e=>C0("or",e))),ps._create("or",r)}function Uy(...r){return r.forEach((e=>C0("and",e))),ps._create("and",r)}class su extends Ai{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new su(e,t)}_apply(e){const t=(function(s,i,o){if(s.startAt!==null)throw new L(N.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new L(N.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new bo(i,o)})(e._query,this._field,this._direction);return new Ke(e.firestore,e.converter,m3(e._query,t))}}function By(r,e="asc"){const t=e,n=Qt("orderBy",r);return su._create(n,t)}class na extends Ai{constructor(e,t,n){super(),this.type=e,this._limit=t,this._limitType=n}static _create(e,t,n){return new na(e,t,n)}_apply(e){return new Ke(e.firestore,e.converter,cc(e._query,this._limit,this._limitType))}}function qy(r){return Lp("limit",r),na._create("limit",r,"F")}function Gy(r){return Lp("limitToLast",r),na._create("limitToLast",r,"L")}class ra extends Ai{constructor(e,t,n){super(),this.type=e,this._docOrFields=t,this._inclusive=n}static _create(e,t,n){return new ra(e,t,n)}_apply(e){const t=S0(e,this.type,this._docOrFields,this._inclusive);return new Ke(e.firestore,e.converter,g3(e._query,t))}}function $y(...r){return ra._create("startAt",r,!0)}function jy(...r){return ra._create("startAfter",r,!1)}class sa extends Ai{constructor(e,t,n){super(),this.type=e,this._docOrFields=t,this._inclusive=n}static _create(e,t,n){return new sa(e,t,n)}_apply(e){const t=S0(e,this.type,this._docOrFields,this._inclusive);return new Ke(e.firestore,e.converter,_3(e._query,t))}}function zy(...r){return sa._create("endBefore",r,!1)}function Hy(...r){return sa._create("endAt",r,!0)}function S0(r,e,t,n){if(t[0]=ee(t[0]),t[0]instanceof Mo)return(function(i,o,a,u,l){if(!u)throw new L(N.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${a}().`);const d=[];for(const p of bs(i))if(p.field.isKeyField())d.push(Jr(o,u.key));else{const g=u.data.field(p.field);if(zo(g))throw new L(N.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+p.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(g===null){const I=p.field.canonicalString();throw new L(N.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${I}' (used as the orderBy) does not exist.`)}d.push(g)}return new mr(d,l)})(r._query,r.firestore._databaseId,e,t[0]._document,n);{const s=ls(r.firestore);return(function(o,a,u,l,d,p){const g=o.explicitOrderBy;if(d.length>g.length)throw new L(N.INVALID_ARGUMENT,`Too many arguments provided to ${l}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const I=[];for(let v=0;v<d.length;v++){const k=d[v];
vendor: 10,783 bytes, line 41
41if(g[v].field.isKeyField()){if(typeof k!="string")throw new L(N.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${l}(), but got a ${typeof k}`);if(!d1(o)&&k.indexOf("/")!==-1)throw new L(N.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${l}() must be a plain document ID, but '${k}' contains a slash.`);const F=o.path.child(re.fromString(k));if(!B.isDocumentKey(F))throw new L(N.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${l}() must result in a valid document path, but '${F}' is not because it contains an odd number of segments.`);const W=new B(F);I.push(Jr(a,W))}else{const F=cm(u,l,k);I.push(F)}}return new mr(I,p)})(r._query,r.firestore._databaseId,s,e,t,n)}}function V2(r,e,t){if(typeof(t=ee(t))=="string"){if(t==="")throw new L(N.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!d1(e)&&t.indexOf("/")!==-1)throw new L(N.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);const n=e.path.child(re.fromString(t));if(!B.isDocumentKey(n))throw new L(N.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${n}' is not because it has an odd number of segments (${n.length}).`);return Jr(r,new B(n))}if(t instanceof _e)return Jr(r,t._key);throw new L(N.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Vc(t)}.`)}function O2(r,e){if(!Array.isArray(r)||r.length===0)throw new L(N.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function P0(r,e){const t=(function(s,i){for(const o of s)for(const a of o.getFlattenedFilters())if(i.indexOf(a.op)>=0)return a.op;return null})(r.filters,(function(s){switch(s){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[]}})(e.op));if(t!==null)throw t===e.op?new L(N.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new L(N.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}function C0(r,e){if(!(e instanceof Ri||e instanceof ps))throw new L(N.INVALID_ARGUMENT,`Function ${r}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}function iu(r,e,t){let n;return n=r?t&&(t.merge||t.mergeFields)?r.toFirestore(e,t):r.toFirestore(e):e,n}class Eh extends _h{constructor(e){super(),this.firestore=e}convertBytes(e){return new It(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new _e(this.firestore,null,t)}}function Wy(r){return new ii("sum",Qt("sum",r))}function Ky(r){return new ii("avg",Qt("average",r))}function b0(){return new ii("count")}function Qy(r,e){return r instanceof ii&&e instanceof ii&&r.aggregateType===e.aggregateType&&r._internalFieldPath?.canonicalString()===e._internalFieldPath?.canonicalString()}function Yy(r,e){return E1(r.query,e.query)&&Kt(r.data(),e.data())}function Jy(r){return N0(r,{count:b0()})}function N0(r,e){const t=oe(r.firestore,we),n=Ne(t),s=r1(e,((i,o)=>new m6(o,i.aggregateType,i._internalFieldPath)));return py(n,r._query,s).then((i=>(function(a,u,l){const d=new Cr(a);return new R0(u,d,l)})(t,r,i)))}class Xy{constructor(e){this.kind="memory",this._onlineComponentProvider=Ir.provider,this._offlineComponentProvider=e?.garbageCollector?e.garbageCollector._offlineComponentProvider:{build:()=>new fh(void 0)}}toJSON(){return{kind:this.kind}}}class Zy{constructor(e){let t;this.kind="persistent",e?.tabManager?(e.tabManager._initialize(e),t=e.tabManager):(t=V0(void 0),t._initialize(e)),this._onlineComponentProvider=t._onlineComponentProvider,this._offlineComponentProvider=t._offlineComponentProvider}toJSON(){return{kind:this.kind}}}class eE{constructor(){this.kind="memoryEager",this._offlineComponentProvider=ri.provider}toJSON(){return{kind:this.kind}}}class tE{constructor(e){this.kind="memoryLru",this._offlineComponentProvider={build:()=>new fh(e)}}toJSON(){return{kind:this.kind}}}function nE(){return new eE}function rE(r){return new tE(r?.cacheSizeBytes)}function sE(r){return new Xy(r)}function iE(r){return new Zy(r)}class oE{constructor(e){this.forceOwnership=e,this.kind="persistentSingleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=Ir.provider,this._offlineComponentProvider={build:t=>new ph(t,e?.cacheSizeBytes,this.forceOwnership)}}}class aE{constructor(){this.kind="PersistentMultipleTab"}toJSON(){return{kind:this.kind}}_initialize(e){this._onlineComponentProvider=Ir.provider,this._offlineComponentProvider={build:t=>new f0(t,e?.cacheSizeBytes)}}}function V0(r){return new oE(r?.forceOwnership)}function cE(){return new aE}const O0="NOT SUPPORTED";class wn{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Rt extends Mo{constructor(e,t,n,s,i,o){super(e,t,n,s,o),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new yo(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){const n=this._document.data.field(Qt("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new L(N.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=Rt._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?t:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t)}}function uE(r,e,t){if(os(e,Rt._jsonSchema)){if(e.bundle===O0)throw new L(N.INVALID_ARGUMENT,"The provided JSON object was created in a client environment, which is not supported.");const n=cs(r._databaseId),s=E0(e.bundle,n),i=s.t(),o=new ah(s.getMetadata(),n);for(const d of i)o.o(d);const a=o.documents;if(a.length!==1)throw new L(N.INVALID_ARGUMENT,`Expected bundle data to contain 1 document, but it contains ${a.length} documents.`);const u=Bc(n,a[0].document),l=new B(re.fromString(e.bundleName));return new Rt(r,new Eh(r),l,u,new wn(!1,!1),t||null)}}Rt._jsonSchemaVersion="firestore/documentSnapshot/1.0",Rt._jsonSchema={type:Ge("string",Rt._jsonSchemaVersion),bundleSource:Ge("string","DocumentSnapshot"),bundleName:Ge("string"),bundle:Ge("string")};class yo extends Rt{data(e={}){return super.data(e)}}class vt{constructor(e,t,n,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new wn(s.hasPendingWrites,s.fromCache),this.query=n}get docs(){const e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new yo(this._firestore,this._userDataWriter,n.key,n,new wn(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new L(N.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(s,i){if(s._snapshot.oldDocs.isEmpty()){let o=0;return s._snapshot.docChanges.map((a=>{Oe(s._snapshot.query)?Dl(s._snapshot.query):f1(s.query._query);const u=new yo(s._firestore,s._userDataWriter,a.doc.key,a.doc,new wn(s._snapshot.mutatedKeys.has(a.doc.key),s._snapshot.fromCache),s.query.converter);return a.doc,{type:"added",doc:u,oldIndex:-1,newIndex:o++}}))}{let o=s._snapshot.oldDocs;return s._snapshot.docChanges.filter((a=>i||a.type!==3)).map((a=>{const u=new yo(s._firestore,s._userDataWriter,a.doc.key,a.doc,new wn(s._snapshot.mutatedKeys.has(a.doc.key),s._snapshot.fromCache),s.query.converter);let l=-1,d=-1;return a.type!==0&&(l=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),d=o.indexOf(a.doc.key)),{type:hE(a.type),doc:u,oldIndex:l,newIndex:d}}))}})(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new L(N.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=vt._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Nc.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],n=[],s=[];return this.docs.forEach((i=>{i._document!==null&&(t.push(i._document),n.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),s.push(i.ref.path))})),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function lE(r,e,t){if(os(e,vt._jsonSchema)){if(e.bundle===O0)throw new L(N.INVALID_ARGUMENT,"The provided JSON object was created in a client environment, which is not supported.");const n=cs(r._databaseId),s=E0(e.bundle,n),i=s.t(),o=new ah(s.getMetadata(),n);for(const g of i)o.o(g);if(o.queries.length!==1)throw new L(N.INVALID_ARGUMENT,`Snapshot data expected 1 query but found ${o.queries.length} queries.`);const a=Qc(o.queries[0].bundledQuery),u=o.documents;let l=new cr;u.map((g=>{const I=Bc(n,g.document);l=l.add(I)}));const d=ss.fromInitialDocuments(a,l,ne(),!1,!1),p=new Ke(r,t||null,a);return new vt(r,new Eh(r),p,d)}}function hE(r){switch(r){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return H(61501,{type:r})}}function dE(r,e){return r instanceof Rt&&e instanceof Rt?r._firestore===e._firestore&&r._key.isEqual(e._key)&&(r._document===null?e._document===null:r._document.isEqual(e._document))&&r._converter===e._converter:r instanceof vt&&e instanceof vt&&r._firestore===e._firestore&&E1(r.query,e.query)&&r.metadata.isEqual(e.metadata)&&r._snapshot.isEqual(e._snapshot)}
41vt._jsonSchemaVersion="firestore/querySnapshot/1.0",vt._jsonSchema={type:Ge("string",vt._jsonSchemaVersion),bundleSource:Ge("string","QuerySnapshot"),bundleName:Ge("string"),bundle:Ge("string")};const fE={maxAttempts:5};class D0{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=ls(e)}set(e,t,n){this._verifyNotCommitted();const s=tr(e,this._firestore),i=iu(s.converter,t,n),o=$c(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,n);return this._mutations.push(o.toMutation(s._key,be.none())),this}update(e,t,n,...s){this._verifyNotCommitted();const i=tr(e,this._firestore);let o;return o=typeof(t=ee(t))=="string"||t instanceof us?P1(this._dataReader,"WriteBatch.update",i._key,t,n,s):S1(this._dataReader,"WriteBatch.update",i._key,t),this._mutations.push(o.toMutation(i._key,be.exists(!0))),this}delete(e){this._verifyNotCommitted();const t=tr(e,this._firestore);return this._mutations=this._mutations.concat(new fi(t._key,be.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new L(N.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function tr(r,e){if((r=ee(r)).firestore!==e)throw new L(N.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return r}class pE{constructor(e,t){this._firestore=e,this._transaction=t,this._dataReader=ls(e)}get(e){const t=tr(e,this._firestore),n=new Eh(this._firestore);return this._transaction.lookup([t._key]).then((s=>{if(!s||s.length!==1)return H(24041);const i=s[0];if(i.isFoundDocument())return new Mo(this._firestore,n,i.key,i,t.converter);if(i.isNoDocument())return new Mo(this._firestore,n,t._key,null,t.converter);throw H(18433,{doc:i})}))}set(e,t,n){const s=tr(e,this._firestore),i=iu(s.converter,t,n),o=$c(this._dataReader,"Transaction.set",s._key,i,s.converter!==null,n);return this._transaction.set(s._key,o),this}update(e,t,n,...s){const i=tr(e,this._firestore);let o;return o=typeof(t=ee(t))=="string"||t instanceof us?P1(this._dataReader,"Transaction.update",i._key,t,n,s):S1(this._dataReader,"Transaction.update",i._key,t),this._transaction.update(i._key,o),this}delete(e){const t=tr(e,this._firestore);return this._transaction.delete(t._key),this}}class k0 extends pE{constructor(e,t){super(e,t),this._firestore=e}get(e){const t=tr(e,this._firestore),n=new Cr(this._firestore);return super.get(e).then((s=>new Rt(this._firestore,n,t._key,s._document,new wn(!1,!1),t.converter)))}}function mE(r,e,t){r=oe(r,we);const n={...fE,...t};(function(o){if(o.maxAttempts<1)throw new L(N.INVALID_ARGUMENT,"Max attempts must be at least 1")})(n);const s=Ne(r);return _y(s,(i=>e(new k0(r,i))),n)}function gE(r){r=oe(r,_e);const e=oe(r.firestore,we),t=Ne(e);return _0(t,r._key).then((n=>Ih(e,r,n)))}function _E(r){r=oe(r,_e);const e=oe(r.firestore,we),t=Ne(e),n=new Cr(e);return dy(t,r._key).then((s=>new Rt(e,n,r._key,s,new wn(s!==null&&s.hasLocalMutations,!0),r.converter)))}function yE(r){r=oe(r,_e);const e=oe(r.firestore,we),t=Ne(e);return _0(t,r._key,{source:"server"}).then((n=>Ih(e,r,n)))}function EE(r){r=oe(r,Ke);const e=oe(r.firestore,we),t=Ne(e),n=new Cr(e);return v0(r._query),y0(t,r._query).then((s=>new vt(e,n,r,s)))}function IE(r){r=oe(r,Ke);const e=oe(r.firestore,we),t=Ne(e),n=new Cr(e);return fy(t,r._query).then((s=>new vt(e,n,r,s)))}function wE(r){r=oe(r,Ke);const e=oe(r.firestore,we),t=Ne(e),n=new Cr(e);return y0(t,r._query,{source:"server"}).then((s=>new vt(e,n,r,s)))}function TE(r,e,t){r=oe(r,_e);const n=oe(r.firestore,we),s=iu(r.converter,e,t),i=ls(n);return vi(n,[$c(i,"setDoc",r._key,s,r.converter!==null,t).toMutation(r._key,be.none())])}function AE(r,e,t,...n){r=oe(r,_e);const s=oe(r.firestore,we),i=ls(s);let o;return o=typeof(e=ee(e))=="string"||e instanceof us?P1(i,"updateDoc",r._key,e,t,n):S1(i,"updateDoc",r._key,e),vi(s,[o.toMutation(r._key,be.exists(!0))])}function RE(r){return vi(oe(r.firestore,we),[new fi(r._key,be.none())])}function vE(r,e){const t=oe(r.firestore,we),n=sm(r),s=iu(r.converter,e),i=ls(r.firestore);return vi(t,[$c(i,"addDoc",n._key,s,r.converter!==null,{}).toMutation(n._key,be.exists(!1))]).then((()=>n))}function ql(r,...e){r=ee(r);let t={includeMetadataChanges:!1,source:"default"},n=0;
41typeof e[n]!="object"||Vs(e[n])||(t=e[n++]);const s={includeMetadataChanges:t.includeMetadataChanges,source:t.source};if(Vs(e[n])){const l=e[n];e[n]=l.next?.bind(l),e[n+1]=l.error?.bind(l),e[n+2]=l.complete?.bind(l)}let i,o,a;if(r instanceof _e)o=oe(r.firestore,we),a=pi(r._key.path),i={next:l=>{e[n]&&e[n](Ih(o,r,l))},error:e[n+1],complete:e[n+2]};else{const l=oe(r,Ke);o=oe(l.firestore,we),a=l._query;const d=new Cr(o);i={next:p=>{e[n]&&e[n](new vt(o,d,l,p))},error:e[n+1],complete:e[n+2]},v0(r._query)}const u=Ne(o);return hy(u,a,s,i)}function SE(r,e,...t){const n=ee(r),s=(function(u){const l={bundle:"",bundleName:"",bundleSource:""},d=["bundle","bundleName","bundleSource"];for(const p of d){if(!(p in u)){l.error=`snapshotJson missing required field: ${p}`;break}const g=u[p];if(typeof g!="string"){l.error=`snapshotJson field '${p}' must be a string.`;break}if(g.length===0){l.error=`snapshotJson field '${p}' cannot be an empty string.`;break}p==="bundle"?l.bundle=g:p==="bundleName"?l.bundleName=g:p==="bundleSource"&&(l.bundleSource=g)}return l})(e);if(s.error)throw new L(N.INVALID_ARGUMENT,s.error);let i,o=0;if(typeof t[o]!="object"||Vs(t[o])||(i=t[o++]),s.bundleSource==="QuerySnapshot"){let a=null;if(typeof t[o]=="object"&&Vs(t[o])){const u=t[o++];a={next:u.next,error:u.error,complete:u.complete}}else a={next:t[o++],error:t[o++],complete:t[o++]};return(function(l,d,p,g,I){let v,k=!1;return Bl(l,d.bundle).then((()=>A0(l,d.bundleName))).then((W=>{W&&!k&&(I&&W.withConverter(I),v=ql(W,p||{},g))})).catch((W=>(g.error&&g.error(W),()=>{}))),()=>{k||(k=!0,v&&v())}})(n,s,i,a,t[o])}if(s.bundleSource==="DocumentSnapshot"){let a=null;if(typeof t[o]=="object"&&Vs(t[o])){const u=t[o++];a={next:u.next,error:u.error,complete:u.complete}}else a={next:t[o++],error:t[o++],complete:t[o++]};return(function(l,d,p,g,I){let v,k=!1;return Bl(l,d.bundle).then((()=>
41{if(!k){const W=new _e(l,I||null,B.fromPath(d.bundleName));v=ql(W,p||{},g)}})).catch((W=>(g.error&&g.error(W),()=>{}))),()=>{k||(k=!0,v&&v())}})(n,s,i,a,t[o])}throw new L(N.INVALID_ARGUMENT,`unsupported bundle source: ${s.bundleSource}`)}function PE(r,e){r=oe(r,we);const t=Ne(r),n=Vs(e)?e:{next:e};return gy(t,n)}function vi(r,e){const t=Ne(r);return my(t,e)}function Ih(r,e,t){const n=t.docs.get(e._key),s=new Cr(r);return new Rt(r,s,e._key,n,new wn(t.hasPendingWrites,t.fromCache),e.converter)}function CE(r){return r=oe(r,we),Ne(r),new D0(r,(e=>vi(r,e)))}function bE(r,e){r=oe(r,we);const t=Ne(r);if(!t._uninitializedComponentsProvider||t._uninitializedComponentsProvider._offline.kind==="memory")return We("Cannot enable indexes when persistence is disabled"),Promise.resolve();const n=(function(i){const o=typeof i=="string"?(function(l){try{return JSON.parse(l)}catch(d){throw new L(N.INVALID_ARGUMENT,"Failed to parse JSON: "+d?.message)}})(i):i,a=[];if(Array.isArray(o.indexes))for(const u of o.indexes){const l=D2(u,"collectionGroup"),d=[];if(Array.isArray(u.fields))for(const p of u.fields){const g=D2(p,"fieldPath"),I=b1("setIndexConfiguration",g);p.arrayConfig==="CONTAINS"?d.push(new Hr(I,2)):p.order==="ASCENDING"?d.push(new Hr(I,0)):p.order==="DESCENDING"&&d.push(new Hr(I,1))}a.push(new Fs(Fs.UNKNOWN_ID,l,d,Us.empty()))}return a})(e);return Iy(t,n)}function D2(r,e){if(typeof r[e]!="string")throw new L(N.INVALID_ARGUMENT,"Missing string value for: "+e);return r[e]}class x0{constructor(e){this._firestore=e,this.type="PersistentCacheIndexManager"}}function NE(r){r=oe(r,we);const e=k2.get(r);if(e)return e;if(Ne(r)._uninitializedComponentsProvider?._offline.kind!=="persistent")return null;const n=new x0(r);return k2.set(r,n),n}function VE(r){L0(r,!0)}function OE(r){L0(r,!1)}function DE(r){const e=Ne(r._firestore);Ty(e).then((t=>M("deleting all persistent cache indexes succeeded"))).catch((t=>We("deleting all persistent cache indexes failed",t)))}function L0(r,e){const t=Ne(r._firestore);wy(t,e).then((n=>M(`setting persistent cache index auto creation isEnabled=${e} succeeded`))).catch((n=>We(`setting persistent cache index auto creation isEnabled=${e} failed`,n)))}const k2=new WeakMap;class kE{constructor(){throw new Error("instances of this class should not be created")}static onExistenceFilterMismatch(e){return wh.instance.onExistenceFilterMismatch(e)}}class wh{constructor(){this.i=new Map}static get instance(){return ka||(ka=new wh,R3(ka)),ka}u(e){this.i.forEach((t=>t(e)))}onExistenceFilterMismatch(e){const t=Symbol(),n=this.i;return n.set(t,e),()=>n.delete(t)}}let ka=null;(function(e,t=!0){n_(ui),Qr(new lr("firestore",((n,{instanceIdentifier:s,options:i})=>
41{const o=n.getProvider("app").getImmediate(),a=new we(new o_(n.getProvider("auth-internal")),new u_(o,n.getProvider("app-check-internal")),J_(o,s),o);return i={useFetchStreams:t,...i},a._setSettings(i),a}),"PUBLIC").setMultipleInstances(!0)),on(b2,N2,e),on(b2,N2,"esm2020")})();const lA=Object.freeze(Object.defineProperty({__proto__:null,AbstractUserDataWriter:_h,AggregateField:ii,AggregateQuerySnapshot:R0,Bytes:It,CACHE_SIZE_UNLIMITED:Ay,CollectionReference:Wt,DocumentReference:_e,DocumentSnapshot:Rt,FieldPath:us,FieldValue:gn,Firestore:we,FirestoreError:L,GeoPoint:Ht,LoadBundleTask:I0,PersistentCacheIndexManager:x0,Query:Ke,QueryCompositeFilterConstraint:ps,QueryConstraint:Ai,QueryDocumentSnapshot:yo,QueryEndAtConstraint:sa,QueryFieldFilterConstraint:Ri,QueryLimitConstraint:na,QueryOrderByConstraint:su,QuerySnapshot:vt,QueryStartAtConstraint:ra,SnapshotMetadata:wn,Timestamp:ge,Transaction:k0,VectorValue:_t,WriteBatch:D0,_AutoId:Nc,_ByteString:Se,_DatabaseId:dr,_DocumentKey:B,_EmptyAppCheckTokenProvider:l_,_EmptyAuthCredentialsProvider:Dp,_FieldPath:Ae,_TestingHooks:kE,_cast:oe,_debugAssert:s_,_internalAggregationQueryToProtoRunAggregationQueryRequest:ky,_internalQueryToProtoQueryTarget:Dy,_isBase64Available:K_,_logWarn:We,_validateIsNotUsedTogether:xp,addDoc:vE,aggregateFieldEqual:Qy,aggregateQuerySnapshotEqual:Yy,and:Uy,arrayRemove:l9,arrayUnion:u9,average:Ky,clearIndexedDbPersistence:Cy,collection:Z3,collectionGroup:e9,connectFirestoreEmulator:rm,count:b0,deleteAllPersistentCacheIndexes:DE,deleteDoc:RE,deleteField:a9,disableNetwork:Vy,disablePersistentCacheIndexAutoCreation:OE,doc:sm,documentId:Q6,documentSnapshotFromJSON:uE,enableIndexedDbPersistence:Sy,enableMultiTabIndexedDbPersistence:Py,enableNetwork:Ny,enablePersistentCacheIndexAutoCreation:VE,endAt:Hy,endBefore:zy,ensureFirestoreConfigured:Ne,executeWrite:vi,getAggregateFromServer:N0,getCountFromServer:Jy,getDoc:gE,getDocFromCache:_E,getDocFromServer:yE,getDocs:EE,getDocsFromCache:IE,getDocsFromServer:wE,getFirestore:vy,getPersistentCacheIndexManager:NE,increment:h9,initializeFirestore:Ry,limit:qy,limitToLast:Gy,loadBundle:Bl,maximum:f9,memoryEagerGarbageCollector:nE,memoryLocalCache:sE,memoryLruGarbageCollector:rE,minimum:d9,namedQuery:A0,onSnapshot:ql,onSnapshotResume:SE,onSnapshotsInSync:PE,or:Fy,orderBy:By,persistentLocalCache:iE,persistentMultipleTabManager:cE,persistentSingleTabManager:V0,query:Ly,queryEqual:E1,querySnapshotFromJSON:lE,refEqual:t9,runTransaction:mE,serverTimestamp:c9,setDoc:TE,setIndexConfiguration:bE,setLogLevel:r_,snapshotEqual:dE,startAfter:jy,startAt:$y,sum:Wy,terminate:Oy,updateDoc:AE,vector:fm,waitForPendingWrites:by,where:My,writeBatch:CE},Symbol.toStringTag,{value:"Module"}));function M0(){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."}}const xE=M0,F0=new qo("auth","Firebase",M0());const Ic=new Hl("@firebase/auth");function LE(r,...e){Ic.logLevel<=ce.WARN&&Ic.warn(`Auth (${ui}): ${r}`,...e)}function Wa(r,...e){Ic.logLevel<=ce.ERROR&&Ic.error(`Auth (${ui}): ${r}`,...e)}function Gt(r,...e){throw Ah(r,...e)}function St(r,...e){return Ah(r,...e)}function Th(r,e,t){const n={...xE(),[e]:t};return new qo("auth","Firebase",n).create(e,{appName:r.name})}function yt(r){return Th(r,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function ou(r,e,t){const n=t;if(!(e instanceof n))throw n.name!==e.constructor.name&&Gt(r,"argument-error"),Th(r,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Ah(r,...e){if(typeof r!="string"){const t=e[0],n=[...e.slice(1)];return n[0]&&(n[0].appName=r.name),r._errorFactory.create(t,...n)}return F0.create(r,...e)}function z(r,e,...t){if(!r)throw Ah(e,...t)}function Tn(r){const e="INTERNAL ASSERTION FAILED: "+r;throw Wa(e),new Error(e)}function On(r,e){r||Tn(e)}function Fo(){return typeof self<"u"&&self.location?.href||""}function Rh(){return x2()==="http:"||x2()==="https:"}function x2(){return typeof self<"u"&&self.location?.protocol||null}function ME(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Rh()||A7()||"connection"in navigator)?navigator.onLine:!0}function FE(){if(typeof navigator>"u")return null;const r=navigator;return r.languages&&r.languages[0]||r.language||null}class ia{constructor(e,t){this.shortDelay=e,this.longDelay=t,On(t>
41e,"Short delay should be less than long delay!"),this.isMobile=w7()||R7()}get(){return ME()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function vh(r,e){On(r.emulator,"Emulator should always be set here");const{url:t}=r.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}class U0{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Tn("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Tn("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Tn("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const UE={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"};const BE=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],qE=new ia(3e4,6e4);function Ye(r,e){return r.tenantId&&!e.tenantId?{...e,tenantId:r.tenantId}:e}async function Je(r,e,t,n,s={}){return B0(r,s,async()=>{let i={},o={};n&&(e==="GET"?o=n:i={body:JSON.stringify(n)});const a=ai({...o,key:r.config.apiKey}).slice(1),u=await r._getAdditionalHeaders();u["Content-Type"]="application/json",r.languageCode&&(u["X-Firebase-Locale"]=r.languageCode);const l={method:e,headers:u,...i};
41return T7()||(l.referrerPolicy="strict-origin-when-cross-origin"),r.emulatorConfig&&Tr(r.emulatorConfig.host)&&(l.credentials="include"),U0.fetch()(await q0(r,r.config.apiHost,t,a),l)})}async function B0(r,e,t){r._canInitEmulator=!1;const n={...UE,...e};try{const s=new $E(r),i=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw ro(r,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const a=i.ok?o.errorMessage:o.error.message,[u,l]=a.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw ro(r,"credential-already-in-use",o);if(u==="EMAIL_EXISTS")throw ro(r,"email-already-in-use",o);if(u==="USER_DISABLED")throw ro(r,"user-disabled",o);const d=n[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(l)throw Th(r,d,l);Gt(r,d)}}catch(s){if(s instanceof mn)throw s;Gt(r,"network-request-failed",{message:String(s)})}}async function Fn(r,e,t,n,s={}){const i=await Je(r,e,t,n,s);return"mfaPendingCredential"in i&&Gt(r,"multi-factor-auth-required",{_serverResponse:i}),i}async function q0(r,e,t,n){const s=`${e}${t}?${n}`,i=r,o=i.config.emulator?vh(r.config,s):`${r.config.apiScheme}://${s}`;return BE.includes(t)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(o).toString():o}function GE(r){switch(r){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class $E{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,n)=>{this.timer=setTimeout(()=>n(St(this.auth,"network-request-failed")),qE.get())})}}function ro(r,e,t){const n={appName:r.name};t.email&&(n.email=t.email),t.phoneNumber&&(n.phoneNumber=t.phoneNumber);const s=St(r,e,n);return s.customData._tokenResponse=t,s}function L2(r){return r!==void 0&&r.getResponse!==void 0}function M2(r){return r!==void 0&&r.enterprise!==void 0}class G0{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return GE(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function jE(r){return(await Je(r,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function $0(r,e){return Je(r,"GET","/v2/recaptchaConfig",Ye(r,e))}async function zE(r,e){return Je(r,"POST","/v1/accounts:delete",e)}async function HE(r,e){return Je(r,"POST","/v1/accounts:update",e)}async function wc(r,e){return Je(r,"POST","/v1/accounts:lookup",e)}function Eo(r){if(r)try{const e=new Date(Number(r));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function WE(r,e=!1){const t=ee(r),n=await t.getIdToken(e),s=au(n);z(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i?.sign_in_provider;return{claims:s,token:n,authTime:Eo(tl(s.auth_time)),issuedAtTime:Eo(tl(s.iat)),expirationTime:Eo(tl(s.exp)),signInProvider:o||null,signInSecondFactor:i?.sign_in_second_factor||null}}function tl(r){return Number(r)*1e3}function au(r){const[e,t,n]=r.split(".");if(e===void 0||t===void 0||n===void 0)return Wa("JWT malformed, contained fewer than 3 sections"),null;try{const s=up(t);return s?JSON.parse(s):(Wa("Failed to decode base64 JWT payload"),null)}catch(s){return Wa("Caught error parsing JWT payload as JSON",s?.toString()),null}}function F2(r){const e=au(r);return z(e,"internal-error"),z(typeof e.exp<"u","internal-error"),z(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function is(r,e,t=!1){if(t)return e;try{return await e}catch(n){throw n instanceof mn&&KE(n)&&r.auth.currentUser===r&&await r.auth.signOut(),n}}function KE({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}class QE{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,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;const n=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,n)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}class Gl{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Eo(this.lastLoginAt),this.creationTime=Eo(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function Uo(r){const e=r.auth,t=await r.getIdToken(),n=await is(r,wc(e,{idToken:t}));z(n?.users.length,e,"internal-error");const s=n.users[0];r._notifyReloadListener(s);const i=s.providerUserInfo?.length?z0(s.providerUserInfo):[],o=YE(r.providerData,i),a=r.isAnonymous,u=!(r.email&&s.passwordHash)&&!o?.length,l=a?u:!1,d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new Gl(s.createdAt,s.lastLoginAt),isAnonymous:l};Object.assign(r,d)}async function j0(r){const e=ee(r);await Uo(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function YE(r,e){return[...r.filter(n=>
41!e.some(s=>s.providerId===n.providerId)),...e]}function z0(r){return r.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}async function JE(r,e){const t=await B0(r,{},async()=>{const n=ai({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=r.config,o=await q0(r,s,"/v1/token",`key=${i}`),a=await r._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const u={method:"POST",headers:a,body:n};return r.emulatorConfig&&Tr(r.emulatorConfig.host)&&(u.credentials="include"),U0.fetch()(o,u)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function XE(r,e){return Je(r,"POST","/v2/accounts:revokeToken",Ye(r,e))}class Os{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){z(e.idToken,"internal-error"),z(typeof e.idToken<"u","internal-error"),z(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):F2(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){z(e.length!==0,"internal-error");const t=F2(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(z(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:s,expiresIn:i}=await JE(e,t);this.updateTokensAndExpiration(n,s,Number(i))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+n*1e3}static fromJSON(e,t){const{refreshToken:n,accessToken:s,expirationTime:i}=t,o=new Os;return n&&(z(typeof n=="string","internal-error",{appName:e}),o.refreshToken=n),s&&(z(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(z(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),o}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 Os,this.toJSON())}_performRefresh(){return Tn("not implemented")}}function Qn(r,e){z(typeof r=="string"||typeof r>"u","internal-error",{appName:e})}class zt{constructor({uid:e,auth:t,stsTokenManager:n,...s}){this.providerId="firebase",this.proactiveRefresh=new QE(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new Gl(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await is(this,this.stsTokenManager.getToken(this.auth,e));return z(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return WE(this,e)}reload(){return j0(this)}_assign(e){this!==e&&(z(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(t=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new zt({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){z(!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 n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await Uo(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Be(this.auth.app))return Promise.reject(yt(this.auth));const e=await this.getIdToken();return await is(this,zE(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
41nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...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){const n=t.displayName??void 0,s=t.email??void 0,i=t.phoneNumber??void 0,o=t.photoURL??void 0,a=t.tenantId??void 0,u=t._redirectEventId??void 0,l=t.createdAt??void 0,d=t.lastLoginAt??void 0,{uid:p,emailVerified:g,isAnonymous:I,providerData:v,stsTokenManager:k}=t;z(p&&k,e,"internal-error");const F=Os.fromJSON(this.name,k);z(typeof p=="string",e,"internal-error"),Qn(n,e.name),Qn(s,e.name),z(typeof g=="boolean",e,"internal-error"),z(typeof I=="boolean",e,"internal-error"),Qn(i,e.name),Qn(o,e.name),Qn(a,e.name),Qn(u,e.name),Qn(l,e.name),Qn(d,e.name);const W=new zt({uid:p,auth:e,email:s,emailVerified:g,displayName:n,isAnonymous:I,photoURL:o,phoneNumber:i,tenantId:a,stsTokenManager:F,createdAt:l,lastLoginAt:d});return v&&Array.isArray(v)&&(W.providerData=v.map(J=>({...J}))),u&&(W._redirectEventId=u),W}static async _fromIdTokenResponse(e,t,n=!1){const s=new Os;s.updateFromServerResponse(t);const i=new zt({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:n});return await Uo(i),i}static async _fromGetAccountInfoResponse(e,t,n){const s=t.users[0];z(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?z0(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!i?.length,a=new Os;a.updateFromIdToken(n);const u=new zt({uid:s.localId,auth:e,stsTokenManager:a,isAnonymous:o}),l={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new Gl(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!i?.length};return Object.assign(u,l),u}}const U2=new Map;function An(r){On(r instanceof Function,"Expected a class definition");let e=U2.get(r);return e?(On(e instanceof r,"Instance stored in cache mismatched with class"),e):(e=new r,U2.set(r,e),e)}class H0{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}H0.type="NONE";const $l=H0;function Ka(r,e,t){return`firebase:${r}:${e}:${t}`}class Ds{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:s,name:i}=this.auth;this.fullUserKey=Ka(this.userKey,s.apiKey,i),this.fullPersistenceKey=Ka("persistence",s.apiKey,i),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(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const t=await wc(this.auth,{idToken:e}).catch(()=>{});return t?zt._fromGetAccountInfoResponse(this.auth,t,e):null}return zt._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;const 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,n="authUser"){if(!t.length)return new Ds(An($l),e,n);const s=(await Promise.all(t.map(async l=>{if(await l._isAvailable())return l}))).filter(l=>l);let i=s[0]||An($l);const o=Ka(n,e.config.apiKey,e.name);let a=null;for(const l of t)try{const d=await l._get(o);if(d){let p;if(typeof d=="string"){const g=await wc(e,{idToken:d}).catch(()=>{});if(!g)break;p=await zt._fromGetAccountInfoResponse(e,g,d)}else p=zt._fromJSON(e,d);l!==i&&(a=p),i=l;break}}catch{}const u=s.filter(l=>l._shouldAllowMigration);return!i._shouldAllowMigration||!u.length?new Ds(i,e,n):(i=u[0],a&&await i._set(o,a.toJSON()),await Promise.all(t.map(async l=>{if(l!==i)try{await l._remove(o)}catch{}})),new Ds(i,e,n))}}function B2(r){const e=r.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Y0(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(W0(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(X0(e))return"Blackberry";if(Z0(e))return"Webos";if(K0(e))return"Safari";if((e.includes("chrome/")||Q0(e))&&!e.includes("edge/"))return"Chrome";if(J0(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=r.match(t);if(n?.length===2)return n[1]}return"Other"}function W0(r=He()){return/firefox\//i.test(r)}function K0(r=He()){const e=r.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Q0(r=He()){return/crios\//i.test(r)}function Y0(r=He()){return/iemobile/i.test(r)}function J0(r=He()){return/android/i.test(r)}function X0(r=He()){return/blackberry/i.test(r)}function Z0(r=He()){return/webos/i.test(r)}function Sh(r=He()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function ZE(r=He()){return Sh(r)&&!!window.navigator?.standalone}function eI(){return v7()&&document.documentMode===10}function eg(r=He()){return Sh(r)||J0(r)||Z0(r)||X0(r)||/windows phone/i.test(r)||Y0(r)}function tg(r,e=[]){let t;switch(r){case"Browser":t=B2(He());break;case"Worker":t=`${B2(He())}-${r}`;break;default:t=r}const n=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${ui}/${n}`}class tI{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=i=>new Promise((o,a)=>{try{const u=e(i);o(u)}catch(u){a(u)}});n.onAbort=t,this.queue.push(n);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(n){t.reverse();for(const s of t)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:n?.message})}}}async function nI(r,e={}){return Je(r,"GET","/v2/passwordPolicy",Ye(r,e))}const rI=6;class sI{constructor(e){const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??rI,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&
41(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),s&&(t.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let n;for(let s=0;s<e.length;s++)n=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}class iI{constructor(e,t,n,s){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new q2(this),this.idTokenSubscription=new q2(this),this.beforeStateQueue=new tI(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=F0,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=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=An(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await Ds.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const 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{const t=await wc(this,{idToken:e}),n=await zt._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(Be(this.app)){const i=this.app.settings.authIdToken;return i?new Promise(o=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(o,o))}):this.directlySetCurrentUser(null)}const t=await this.assertedPersistence.getCurrentUser();let n=t,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const i=this.redirectUser?._redirectEventId,o=n?._redirectEventId,a=await this.tryRedirectSignIn(e);(!i||i===o)&&a?.user&&(n=a.user,s=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(n)}catch(i){n=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(i))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return z(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Uo(e)}catch(t){if(t?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=FE()}async _delete(){this._deleted=!0}
41async updateCurrentUser(e){if(Be(this.app))return Promise.reject(yt(this));const t=e?ee(e):null;return t&&z(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&&z(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 Be(this.app)?Promise.reject(yt(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Be(this.app)?Promise.reject(yt(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(An(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const 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 this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await nI(this),t=new sI(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new qo("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),n={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(n.tenantId=this.tenantId),await XE(this,n)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return e===null?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&An(e)||this._popupRedirectResolver;z(t,this,"argument-error"),this.redirectPersistenceManager=await Ds.create(this,[An(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._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(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,s){if(this._deleted)return()=>{};const i=typeof t=="function"?t:t.next.bind(t);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(z(a,this,"internal-error"),a.then(()=>{o||i(this.currentUser)}),typeof t=="function"){const u=e.addObserver(t,n,s);return()=>{o=!0,u()}}else{const u=e.addObserver(t);return()=>{o=!0,u()}}}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 z(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=tg(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e["X-Firebase-Client"]=t);const n=await this._getAppCheckToken();return n&&(e["X-Firebase-AppCheck"]=n),e}async _getAppCheckToken(){if(Be(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&LE(`Error while retrieving App Check token: ${e.error}`),e?.token}}function rt(r){return ee(r)}class q2{constructor(e){this.auth=e,this.observer=null,this.addObserver=V7(t=>this.observer=t)}get next(){return z(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let oa={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function oI(r){oa=r}function Ph(r){return oa.loadJS(r)}function aI(){return oa.recaptchaV2Script}function cI(){return oa.recaptchaEnterpriseScript}function uI(){return oa.gapiScript}function ng(r){return`__${r}${Math.floor(Math.random()*1e6)}`}const lI=500,hI=6e4,xa=1e12;class dI{constructor(e){this.auth=e,this.counter=xa,this._widgets=new Map}render(e,t){const n=this.counter;return this._widgets.set(n,new mI(e,this.auth.name,t||{})),this.counter++,n}reset(e){const t=e||xa;this._widgets.get(t)?.delete(),this._widgets.delete(t)}getResponse(e){const t=e||xa;return this._widgets.get(t)?.getResponse()||""}async execute(e){const t=e||xa;return this._widgets.get(t)?.execute(),""}}class fI{constructor(){this.enterprise=new pI}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class pI{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class mI{constructor(e,t,n){this.params=n,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};const s=typeof e=="string"?document.getElementById(e):e;z(s,"argument-error",{appName:t}),this.container=s,this.isVisible=this.params.size!=="invisible",this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),!this.timerId&&(this.timerId=window.setTimeout(()=>{this.responseToken=gI(50);const{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch{}this.isVisible&&this.execute()},hI)},lI))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}function gI(r){const e=[],t="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let n=0;n<r;n++)e.push(t.charAt(Math.floor(Math.random()*t.length)));return e.join("")}const _I="recaptcha-enterprise",Io="NO_RECAPTCHA",G2="onFirebaseAuthREInstanceReady";class In{constructor(e){this.type=_I,this.auth=rt(e)}async verify(e="verify",t=!1){async function n(i){if(!t){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(o,a)=>
41{$0(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(u=>{if(u.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const l=new G0(u);return i.tenantId==null?i._agentRecaptchaConfig=l:i._tenantRecaptchaConfigs[i.tenantId]=l,o(l.siteKey)}}).catch(u=>{a(u)})})}function s(i,o,a){const u=window.grecaptcha;M2(u)?u.enterprise.ready(()=>{u.enterprise.execute(i,{action:e}).then(l=>{o(l)}).catch(()=>{o(Io)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new fI().execute("siteKey",{action:"verify"}):new Promise((i,o)=>{n(this.auth).then(async a=>{if(!t&&M2(window.grecaptcha)&&In.scriptInjectionDeferred)await In.scriptInjectionDeferred.promise,s(a,i,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let u=cI();u.length!==0&&(u+=a+`&onload=${G2}`),In.scriptInjectionDeferred=new mp,window[G2]=()=>{In.scriptInjectionDeferred?.resolve()},Ph(u).then(()=>In.scriptInjectionDeferred?.promise).then(()=>{s(a,i,o)}).catch(l=>{o(l)})}}).catch(a=>{o(a)})})}}In.scriptInjectionDeferred=null;async function Yi(r,e,t,n=!1,s=!1){const i=new In(r);let o;if(s)o=Io;else try{o=await i.verify(t)}catch{o=await i.verify(t,!0)}const a={...e};if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in a){const u=a.phoneEnrollmentInfo.phoneNumber,l=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:u,recaptchaToken:l,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const u=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:u,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return n?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function ur(r,e,t,n,s){if(s==="EMAIL_PASSWORD_PROVIDER")if(r._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await Yi(r,e,t,t==="getOobCode");return n(r,i)}else return n(r,e).catch(async i=>{if(i.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const o=await Yi(r,e,t,t==="getOobCode");return n(r,o)}else return Promise.reject(i)});else if(s==="PHONE_PROVIDER")if(r._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){const i=await Yi(r,e,t);return n(r,i).catch(async o=>{if(r._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(o.code==="auth/missing-recaptcha-token"||o.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${t} flow.`);const a=await Yi(r,e,t,!1,!0);return n(r,a)}return Promise.reject(o)})}else{const i=await Yi(r,e,t,!1,!0);return n(r,i)}else return Promise.reject(s+" provider is not supported.")}async function yI(r){const e=rt(r),t=await $0(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),n=new G0(t);e.tenantId==null?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,n.isAnyProviderEnabled()&&new In(e).verify()}function EI(r,e){const t=ci(r,"auth");if(t.isInitialized()){const s=t.getImmediate(),i=t.getOptions();if(Kt(i,e??{}))return s;Gt(s,"already-initialized")}return t.initialize({options:e})}function II(r,e){const t=e?.persistence||[],n=(Array.isArray(t)?t:[t]).map(An);e?.errorMap&&r._updateErrorMap(e.errorMap),r._initializeWithPersistence(n,e?.popupRedirectResolver)}function jl(r,e,t){const n=rt(r);z(/^https?:\/\//.test(e),n,"invalid-emulator-scheme");const s=!1,i=rg(e),{host:o,port:a}=wI(e),u=a===null?"":`:${a}`,l={url:`${i}//${o}${u}/`},d=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!n._canInitEmulator){z(n.config.emulator&&n.emulatorConfig,n,"emulator-config-failed"),z(Kt(l,n.config.emulator)&&Kt(d,n.emulatorConfig),n,"emulator-config-failed");return}n.config.emulator=l,n.emulatorConfig=d,n.settings.appVerificationDisabledForTesting=!0,Tr(o)?Cc(`${i}//${o}${u}`):TI()}function rg(r){const e=r.indexOf(":");return e<0?"":r.substr(0,e+1)}function wI(r){const e=rg(r),t=/(\/\/)?([^?#/]+)/.exec(r.substr(e.length));if(!t)return{host:"",port:null};const n=t[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(n);if(s){const i=s[1];return{host:i,port:$2(n.substr(i.length+1))}}else{const[i,o]=n.split(":");return{host:i,port:$2(o)}}}function $2(r){if(!r)return null;const e=Number(r);return isNaN(e)?null:e}function TI(){function r(){const 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)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}class cu{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Tn("not implemented")}_getIdTokenResponse(e){return Tn("not implemented")}_linkToIdToken(e,t){return Tn("not implemented")}_getReauthenticationResolver(e){return Tn("not implemented")}}async function AI(r,e){return Je(r,"POST","/v1/accounts:resetPassword",Ye(r,e))}async function RI(r,e){return Je(r,"POST","/v1/accounts:update",e)}async function vI(r,e){return Je(r,"POST","/v1/accounts:signUp",e)}async function SI(r,e){return Je(r,"POST","/v1/accounts:update",Ye(r,e))}async function PI(r,e){return Fn(r,"POST","/v1/accounts:signInWithPassword",Ye(r,e))}async function uu(r,e){return Je(r,"POST","/v1/accounts:sendOobCode",Ye(r,e))}async function CI(r,e){return uu(r,e)}async function bI(r,e){return uu(r,e)}async function NI(r,e){return uu(r,e)}async function VI(r,e){return uu(r,e)}async function OI(r,e){return Fn(r,"POST","/v1/accounts:signInWithEmailLink",Ye(r,e))}async function DI(r,e){return Fn(r,"POST","/v1/accounts:signInWithEmailLink",Ye(r,e))}class Bo extends cu{constructor(e,t,n,s=null){super("password",n),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new Bo(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new Bo(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;if(t?.email&&t?.password){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ur(e,t,"signInWithPassword",PI,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return OI(e,{email:this._email,oobCode:this._password});default:Gt(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":const n={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ur(e,n,"signUpPassword",vI,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return DI(e,{idToken:t,email:this._email,oobCode:this._password});default:Gt(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function ks(r,e){return Fn(r,"POST","/v1/accounts:signInWithIdp",Ye(r,e))}const kI="http://localhost";class fn extends cu{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new fn(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&&
41(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):Gt("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){const t=typeof e=="string"?JSON.parse(e):e,{providerId:n,signInMethod:s,...i}=t;if(!n||!s)return null;const o=new fn(n,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return ks(e,t)}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,ks(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,ks(e,t)}buildRequest(){const e={requestUri:kI,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const 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=ai(t)}return e}}async function j2(r,e){return Je(r,"POST","/v1/accounts:sendVerificationCode",Ye(r,e))}async function xI(r,e){return Fn(r,"POST","/v1/accounts:signInWithPhoneNumber",Ye(r,e))}async function LI(r,e){const t=await Fn(r,"POST","/v1/accounts:signInWithPhoneNumber",Ye(r,e));if(t.temporaryProof)throw ro(r,"account-exists-with-different-credential",t);return t}const MI={USER_NOT_FOUND:"user-not-found"};async function FI(r,e){const t={...e,operation:"REAUTH"};return Fn(r,"POST","/v1/accounts:signInWithPhoneNumber",Ye(r,t),MI)}class wo extends cu{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new wo({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new wo({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return xI(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return LI(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return FI(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:s}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:s}}toJSON(){const 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){typeof e=="string"&&(e=JSON.parse(e));const{verificationId:t,verificationCode:n,phoneNumber:s,temporaryProof:i}=e;return!n&&!t&&!s&&!i?null:new wo({verificationId:t,verificationCode:n,phoneNumber:s,temporaryProof:i})}}function UI(r){switch(r){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}}function BI(r){const e=Ji(Xi(r)).link,t=e?Ji(Xi(e)).deep_link_id:null,n=Ji(Xi(r)).deep_link_id;return(n?Ji(Xi(n)).link:null)||n||t||e||r}class lu{constructor(e){const t=Ji(Xi(e)),n=t.apiKey??null,s=t.oobCode??null,i=UI(t.mode??null);z(n&&s&&i,"argument-error"),this.apiKey=n,this.operation=i,this.code=s,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){const t=BI(e);try{return new lu(t)}catch{return null}}}class Dn{constructor(){this.providerId=Dn.PROVIDER_ID}static credential(e,t){return Bo._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=lu.parseLink(t);return z(n,"argument-error"),Bo._fromEmailAndCode(e,n.code,n.tenantId)}}Dn.PROVIDER_ID="password";Dn.EMAIL_PASSWORD_SIGN_IN_METHOD="password";Dn.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class Si{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 Pi extends Si{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class xe extends Pi{static credentialFromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;return z("providerId"in t&&"signInMethod"in t,"argument-error"),fn._fromParams(t)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return z(e.idToken||e.accessToken,"argument-error"),fn._fromParams({...e,providerId:this.providerId,sign
vendor: 6,105 bytes, line 41
41InMethod:this.providerId})}static credentialFromResult(e){return xe.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return xe.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n,oauthTokenSecret:s,pendingToken:i,nonce:o,providerId:a}=e;if(!n&&!s&&!t&&!i||!a)return null;try{return new xe(a)._credential({idToken:t,accessToken:n,nonce:o,pendingToken:i})}catch{return null}}}class Mt extends Pi{constructor(){super("facebook.com")}static credential(e){return fn._fromParams({providerId:Mt.PROVIDER_ID,signInMethod:Mt.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Mt.credentialFromTaggedObject(e)}static credentialFromError(e){return Mt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Mt.credential(e.oauthAccessToken)}catch{return null}}}Mt.FACEBOOK_SIGN_IN_METHOD="facebook.com";Mt.PROVIDER_ID="facebook.com";class Ft extends Pi{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return fn._fromParams({providerId:Ft.PROVIDER_ID,signInMethod:Ft.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return Ft.credentialFromTaggedObject(e)}static credentialFromError(e){return Ft.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return Ft.credential(t,n)}catch{return null}}}Ft.GOOGLE_SIGN_IN_METHOD="google.com";Ft.PROVIDER_ID="google.com";class Ut extends Pi{constructor(){super("github.com")}static credential(e){return fn._fromParams({providerId:Ut.PROVIDER_ID,signInMethod:Ut.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Ut.credentialFromTaggedObject(e)}static credentialFromError(e){return Ut.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Ut.credential(e.oauthAccessToken)}catch{return null}}}Ut.GITHUB_SIGN_IN_METHOD="github.com";Ut.PROVIDER_ID="github.com";class Bt extends Pi{constructor(){super("twitter.com")}static credential(e,t){return fn._fromParams({providerId:Bt.PROVIDER_ID,signInMethod:Bt.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return Bt.credentialFromTaggedObject(e)}static credentialFromError(e){return Bt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return Bt.credential(t,n)}catch{return null}}}Bt.TWITTER_SIGN_IN_METHOD="twitter.com";Bt.PROVIDER_ID="twitter.com";async function sg(r,e){return Fn(r,"POST","/v1/accounts:signUp",Ye(r,e))}class pn{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,s=!1){const i=await zt._fromIdTokenResponse(e,n,s),o=z2(n);return new pn({user:i,providerId:o,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const s=z2(n);return new pn({user:e,providerId:s,_tokenResponse:n,operationType:t})}}function z2(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}async function qI(r){if(Be(r.app))return Promise.reject(yt(r));const e=rt(r);if(await e._initializationPromise,e.currentUser?.isAnonymous)return new pn({user:e.currentUser,providerId:null,operationType:"signIn"});const t=await sg(e,{returnSecureToken:!0}),n=await pn._fromIdTokenResponse(e,"signIn",t,!0);return await e._updateCurrentUser(n.user),n}class Tc extends mn{constructor(e,t,n,s){super(t.code,t.message),this.operationType=n,this.user=s,Object.setPrototypeOf(this,Tc.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,s){return new Tc(e,t,n,s)}}function ig(r,e,t,n){return(e==="reauthenticate"?t._getReauthenticationResolver(r):t._getIdTokenResponse(r)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?Tc._fromErrorAndOperation(r,i,e,n):i})}function og(r){return new Set(r.map(({providerId:e})=>e).filter(e=>!!e))}async function GI(r,e){const t=ee(r);await hu(!0,t,e);const{providerUserInfo:n}=await HE(t.auth,{idToken:await t.getIdToken(),deleteProvider:[e]}),s=og(n||[]);return t.providerData=t.providerData.filter(i=>s.has(i.providerId)),s.has("phone")||(t.phoneNumber=null),await t.auth._persistUserIfCurrent(t),t}async function ag(r,e,t=!1){const n=await is(r,e._linkToIdToken(r.auth,await r.getIdToken()),t);return pn._forOperation(r,"link",n)}async function hu(r,e,t){await Uo(e);const n=og(e.providerData),s=r===!1?"provider-already-linked":"no-such-provider";z(n.has(t)===r,e.auth,s)}async function $I(r,e,t=!1){const{auth:n}=r;if(Be(n.app))return Promise.reject(yt(n));const s="reauthenticate";try{const i=await is(r,ig(n,s,e,r),t);z(i.idToken,n,"internal-error");const o=au(i.idToken);z(o,n,"internal-error");const{sub:a}=o;return z(r.uid===a,n,"user-mismatch"),pn._forOperation(r,s,i)}catch(i){throw i?.code==="auth/user-not-found"&&Gt(n,"user-mismatch"),i}}async function cg(r,e,t=!1){if(Be(r.app))return Promise.reject(yt(r));const n="signIn",s=await ig(r,n,e),i=await pn._fromIdTokenResponse(r,n,s);return t||await r._updateCurrentUser(i.user),i}async function Ch(r,e){return cg(rt(r),e)}async function ug(r,e){const t=ee(r);return await hu(!1,t,e.providerId),ag(t,e)}async function jI(r,e){return Fn(r,"POST","/v1/accounts:signInWithCustomToken",Ye(r,e))}async function zI(r,e){if(Be(r.app))return Promise.reject(yt(r));const t=rt(r),n=await jI(t,{token:e,returnSecureToken:!0}),s=await pn._fromIdTokenResponse(t,"signIn",n);return await t._updateCurrentUser(s.user),s}function du(r,e,t){z(t.url?.length>
410,r,"invalid-continue-uri"),z(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,r,"invalid-dynamic-link-domain"),z(typeof t.linkDomain>"u"||t.linkDomain.length>0,r,"invalid-hosting-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.linkDomain=t.linkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(z(t.iOS.bundleId.length>0,r,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(z(t.android.packageName.length>0,r,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}async function bh(r){const e=rt(r);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function HI(r,e,t){const n=rt(r),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};t&&du(n,s,t),await ur(n,s,"getOobCode",bI,"EMAIL_PASSWORD_PROVIDER")}async function WI(r,e,t){await AI(ee(r),{oobCode:e,newPassword:t}).catch(async n=>{throw n.code==="auth/password-does-not-meet-requirements"&&bh(r),n})}async function KI(r,e){await SI(ee(r),{oobCode:e})}async function QI(r,e,t){if(Be(r.app))return Promise.reject(yt(r));const n=rt(r),o=await ur(n,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",sg,"EMAIL_PASSWORD_PROVIDER").catch(u=>{throw u.code==="auth/password-does-not-meet-requirements"&&bh(r),u}),a=await pn._fromIdTokenResponse(n,"signIn",o);return await n._updateCurrentUser(a.user),a}function YI(r,e,t){return Be(r.app)?Promise.reject(yt(r)):Ch(ee(r),Dn.credential(e,t)).catch(async n=>{throw n.code==="auth/password-does-not-meet-requirements"&&bh(r),n})}async function JI(r,e,t){const n=rt(r),s={requestType:"EMAIL_SIGNIN",email:e,clientType:"CLIENT_TYPE_WEB"};function i(o,a){z(a.handleCodeInApp,n,"argument-error"),a&&du(n,o,a)}i(s,t),await ur(n,s,"getOobCode",NI,"EMAIL_PASSWORD_PROVIDER")}function XI(r,e){return lu.parseLink(e)?.operation==="EMAIL_SIGNIN"}async function ZI(r,e,t){if(Be(r.app))return Promise.reject(yt(r));const n=ee(r),s=Dn.credentialWithLink(e,t||Fo());return z(s._tenantId===(n.tenantId||null),n,"tenant-id-mismatch"),Ch(n,s)}async function ew(r,e){return Je(r,"POST","/v1/accounts:createAuthUri",Ye(r,e))}async function tw(r,e){const t=Rh()?Fo():"http://localhost",n={identifier:e,continueUri:t},{signinMethods:s}=await ew(ee(r),n);return s||[]}async function nw(r,e){const t=ee(r),s={requestType:"VERIFY_EMAIL",idToken:await r.getIdToken()};e&&du(t.auth,s,e);const{email:i}=await CI(t.auth,s);i!==r.email&&await r.reload()}async function rw(r,e,t){const n=ee(r),i={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await r.getIdToken(),newEmail:e};t&&du(n.auth,i,t);const{email:o}=await VI(n.auth,i);o!==r.email&&await r.reload()}async function sw(r,e){return Je(r,"POST","/v1/accounts:update",e)}async function iw(r,{displayName:e,photoURL:t}){if(e===void 0&&t===void 0)return;const n=ee(r),i={idToken:await n.getIdToken(),displayName:e,photoUrl:t,returnSecureToken:!0},o=await is(n,sw(n.auth,i));n.displayName=o.displayName||null,n.photoURL=o.photoUrl||null;const a=n.providerData.find(({providerId:u})=>u==="password");a&&(a.displayName=n.displayName,a.photoURL=n.photoURL),await n._updateTokensIfNecessary(o)}function ow(r,e){const t=ee(r);return Be(t.auth.app)?Promise.reject(yt(t.auth)):lg(t,e,null)}function aw(r,e){return lg(ee(r),null,e)}async function lg(r,e,t){const{auth:n}=r,i={idToken:await r.getIdToken(),returnSecureToken:!0};e&&(i.email=e),t&&(i.password=t);const o=await is(r,RI(n,i));await r._updateTokensIfNecessary(o,!0)}function cw(r){if(!r)return null;const{providerId:e}=r,t=r.rawUserInfo?JSON.parse(r.rawUserInfo):{},n=r.isNewUser||r.kind==="identitytoolkit#SignupNewUserResponse";if(!e&&r?.idToken){const s=au(r.idToken)?.firebase?.sign_in_provider;if(s){const i=s!=="anonymous"&&s!=="custom"?s:null;return new xs(n,i)}}if(!e)return null;switch(e){case"facebook.com":return new uw(n,t);case"github.com":return new lw(n,t);case"google.com":return new hw(n,t);case"twitter.com":return new dw(n,t,r.screenName||null);case"custom":case"anonymous":return new xs(n,null);default:return new xs(n,e,t)}}class xs{constructor(e,t,n={}){this.isNewUser=e,this.providerId=t,this.profile=n}}class hg extends xs{constructor(e,t,n,s){super(e,t,n),this.username=s}}class uw extends xs{constructor(e,t){super(e,"facebook.com",t)}}class lw extends hg{constructor(e,t){super(e,"github.com",t,typeof t?.login=="str
41ing"?t?.login:null)}}class hw extends xs{constructor(e,t){super(e,"google.com",t)}}class dw extends hg{constructor(e,t,n){super(e,"twitter.com",t,n)}}function fw(r){const{user:e,_tokenResponse:t}=r;return e.isAnonymous&&!t?{providerId:null,isNewUser:!1,profile:null}:cw(t)}function La(r,e){return ee(r).setPersistence(e)}function pw(r,e,t,n){return ee(r).onIdTokenChanged(e,t,n)}function mw(r,e,t){return ee(r).beforeAuthStateChanged(e,t)}function hA(r,e,t,n){return ee(r).onAuthStateChanged(e,t,n)}function dA(r){return ee(r).signOut()}function gw(r,e){return rt(r).revokeAccessToken(e)}async function _w(r){return ee(r).delete()}function H2(r,e){return Je(r,"POST","/v2/accounts/mfaEnrollment:start",Ye(r,e))}const Ac="__sak";class dg{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Ac,"1"),this.storage.removeItem(Ac),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const 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()}}const yw=1e3,Ew=10;class fg extends dg{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=eg(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),s=this.localCache[t];n!==s&&e(t,s,n)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,a,u)=>{this.notifyListeners(o,u)});return}const n=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const o=this.storage.getItem(n);!t&&this.localCache[n]===o||this.notifyListeners(n,o)},i=this.storage.getItem(n);eI()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,Ew):s()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const s of Array.from(n))s(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)})},yw)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(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),this.listeners[e].size===0&&delete this.listeners[e]),Ob
41ject.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}fg.type="LOCAL";const pg=fg;class mg extends dg{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}mg.type="SESSION";const Nh=mg;function Iw(r){return Promise.all(r.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}class fu{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(s=>s.isListeningto(e));if(t)return t;const n=new fu(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:s,data:i}=t.data,o=this.handlersMap[s];if(!o?.size)return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:s});const a=Array.from(o).map(async l=>l(t.origin,i)),u=await Iw(a);t.ports[0].postMessage({status:"done",eventId:n,eventType:s,response:u})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&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||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}fu.receivers=[];function pu(r="",e=10){let t="";for(let n=0;n<e;n++)t+=Math.floor(Math.random()*10);return r+t}class ww{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,n=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,o;return new Promise((a,u)=>{const l=pu("",20);s.port1.start();const d=setTimeout(()=>{u(new Error("unsupported_event"))},n);o={messageChannel:s,onMessage(p){const g=p;if(g.data.eventId===l)switch(g.data.status){case"ack":clearTimeout(d),i=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),a(g.data.response);break;default:clearTimeout(d),clearTimeout(i),u(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}function Ue(){return window}function Tw(r){Ue().location.href=r}function Vh(){return typeof Ue().WorkerGlobalScope<"u"&&typeof Ue().importScripts=="function"}async function Aw(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Rw(){return navigator?.serviceWorker?.controller||null}function vw(){return Vh()?self:null}const gg="firebaseLocalStorageDb",Sw=1,Rc="firebaseLocalStorage",_g="fbase_key";class aa{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 mu(r,e){return r.transaction([Rc],e?"readwrite":"readonly").objectStore(Rc)}function Pw(){const r=indexedDB.deleteDatabase(gg);return new aa(r).toPromise()}function yg(){const r=indexedDB.open(gg,Sw);return new Promise((e,t)=>{r.addEventListener("error",()=>{t(r.error)}),r.addEventListener("upgradeneeded",()=>{const n=r.result;try{n.createObjectStore(Rc,{keyPath:_g})}catch(s){t(s)}}),r.addEventListener("success",async()=>{const n=r.result;n.objectStoreNames.contains(Rc)?e(n):(n.close(),await Pw(),e(await yg()))})})}async function W2(r,e,t){const n=mu(r,!0).put({[_g]:e,value:t});return new aa(n).toPromise()}async function Cw(r,e){const t=mu(r,!1).get(e),n=await new aa(t).toProm
41ise();return n===void 0?null:n.value}function K2(r,e){const t=mu(r,!0).delete(e);return new aa(t).toPromise()}const bw=800,Nw=3;class Eg{constructor(){this.type="LOCAL",this.dbPromise=null,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.dbPromise?this.dbPromise:(this.dbPromise=yg(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let t=0;for(;;)try{const n=await this._openDb();return await e(n)}catch(n){if(t++>Nw)throw n;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return Vh()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=fu._getInstance(vw()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await Aw(),!this.activeServiceWorker)return;this.sender=new ww(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Rw()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await W2(e,Ac,"1"),await K2(e,Ac)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>W2(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(n=>Cw(n,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>K2(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=mu(s,!1).getAll();return new aa(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],n=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)n.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),t.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!n.has(s)&&(this.notifyListeners(s,null),t.push(s));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const s of Array.from(n))s(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),bw)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&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),this.listeners[e].size===0&&delete this.listeners[e]),Ob
41ject.keys(this.listeners).length===0&&this.stopPolling()}}Eg.type="LOCAL";const Ig=Eg;function Q2(r,e){return Je(r,"POST","/v2/accounts/mfaSignIn:start",Ye(r,e))}const nl=ng("rcb"),Vw=new ia(3e4,6e4);class Ow{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!Ue().grecaptcha?.render}load(e,t=""){return z(Dw(t),e,"argument-error"),this.shouldResolveImmediately(t)&&L2(Ue().grecaptcha)?Promise.resolve(Ue().grecaptcha):new Promise((n,s)=>{const i=Ue().setTimeout(()=>{s(St(e,"network-request-failed"))},Vw.get());Ue()[nl]=()=>{Ue().clearTimeout(i),delete Ue()[nl];const a=Ue().grecaptcha;if(!a||!L2(a)){s(St(e,"internal-error"));return}const u=a.render;a.render=(l,d)=>{const p=u(l,d);return this.counter++,p},this.hostLanguage=t,n(a)};const o=`${aI()}?${ai({onload:nl,render:"explicit",hl:t})}`;Ph(o).catch(()=>{clearTimeout(i),s(St(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!Ue().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}}function Dw(r){return r.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(r)}class kw{async load(e){return new dI(e)}clearedOneInstance(){}}const To="recaptcha",xw={theme:"light",type:"image"};class Y2{constructor(e,t,n={...xw}){this.parameters=n,this.type=To,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=rt(e),this.isInvisible=this.parameters.size==="invisible",z(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");const s=typeof t=="string"?document.getElementById(t):t;z(s,this.auth,"argument-error"),this.container=s,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new kw:new Ow,this.validateStartingState()}async verify(){this.assertNotDestroyed();const e=await this.render(),t=this.getAssertedRecaptcha(),n=t.getResponse(e);return n||new Promise(s=>{const i=o=>{o&&(this.tokenChangeListeners.delete(i),s(o))};this.tokenChangeListeners.add(i),this.isInvisible&&t.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise?this.renderPromise:(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),this.widgetId!==null&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){z(!this.parameters.sitekey,this.auth,"argument-error"),z(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),z(typeof document<"u",this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return t=>{if(this.tokenChangeListeners.forEach(n=>n(t)),typeof e=="function")e(t);else if(typeof e=="string"){const n=Ue()[e];typeof n=="function"&&n(t)}}}assertNotDestroyed(){z(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){const t=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}
41async init(){z(Rh()&&!Vh(),this.auth,"internal-error"),await Lw(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);const e=await jE(this.auth);z(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return z(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}function Lw(){let r=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}r=()=>e(),window.addEventListener("load",r)}).catch(e=>{throw r&&window.removeEventListener("load",r),e})}class wg{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){const t=wo._fromVerification(this.verificationId,e);return this.onConfirmation(t)}}async function Mw(r,e,t){if(Be(r.app))return Promise.reject(yt(r));const n=rt(r),s=await Tg(n,e,ee(t));return new wg(s,i=>Ch(n,i))}async function Fw(r,e,t){const n=ee(r);await hu(!1,n,"phone");const s=await Tg(n.auth,e,ee(t));return new wg(s,i=>ug(n,i))}async function Tg(r,e,t){if(!r._getRecaptchaConfig())try{await yI(r)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let n;if(typeof e=="string"?n={phoneNumber:e}:n=e,"session"in n){const s=n.session;if("phoneNumber"in n){z(s.type==="enroll",r,"internal-error");const i={idToken:s.credential,phoneEnrollmentInfo:{phoneNumber:n.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await ur(r,i,"mfaSmsEnrollment",async(l,d)=>{if(d.phoneEnrollmentInfo.captchaResponse===Io){z(t?.type===To,l,"argument-error");const p=await rl(l,d,t);return H2(l,p)}return H2(l,d)},"PHONE_PROVIDER").catch(l=>Promise.reject(l))).phoneSessionInfo.sessionInfo}else{z(s.type==="signin",r,"internal-error");const i=n.multiFactorHint?.uid||n.multiFactorUid;z(i,r,"missing-multi-factor-info");const o={mfaPendingCredential:s.credential,mfaEnrollmentId:i,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await ur(r,o,"mfaSmsSignIn",async(d,p)=>{if(p.phoneSignInInfo.captchaResponse===Io){z(t?.type===To,d,"argument-error");const g=await rl(d,p,t);return Q2(d,g)}return Q2(d,p)},"PHONE_PROVIDER").catch(d=>Promise.reject(d))).phoneResponseInfo.sessionInfo}}else{const s={phoneNumber:n.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await ur(r,s,"sendVerificationCode",async(u,l)=>{if(l.captchaResponse===Io){z(t?.type===To,u,"argument-error");const d=await rl(u,l,t);return j2(u,d)}return j2(u,l)},"PHONE_PROVIDER").catch(u=>Promise.reject(u))).sessionInfo}}finally{t?._reset()}}async function rl(r,e,t){z(t.type===To,r,"argument-error");const n=await t.verify();z(typeof n=="string",r,"argument-error");const s={...e};if("phoneEnrollmentInfo"in s){const i=s.phoneEnrollmentInfo.phoneNumber,o=s.phoneEnrollmentInfo.captchaResponse,a=s.phoneEnrollmentInfo.clientType,u=s.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(s,{phoneEnrollmentInfo:{phoneNumber:i,recaptchaToken:n,captchaResponse:o,clientType:a,recaptchaVersion:u}}),s}else if("phoneSignInInfo"in s){const i=s.phoneSignInInfo.captchaResponse,o=s.phoneSignInInfo.clientType,a=s.phoneSignInInfo.recaptchaVersion;return Object.assign(s,{phoneSignInInfo:{recaptchaToken:n,captchaResponse:i,clientType:o,recaptchaVersion:a}}),s}else return Object.assign(s,{recaptchaToken:n}),s}function ca(r,e){return e?An(e):(z(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}class Oh extends cu{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ks(e,this._buildIdpRequest())}_linkToIdToken(e,t){return ks(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return ks(e,this._buildIdpRequest())}_buildIdpRequest(e){const 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 Uw(r){return cg(r.auth,new Oh(r),r.bypassAuthState)}function Bw(r){const{auth:e,user:t}=r;return z(t,e,"internal-error"),$I(t,new Oh(r),r.bypassAuthState)}async function qw(r){const{auth:e,user:t}=r;return z(t,e,"internal-error"),ag(t,new Oh(r),r.bypassAuthState)}class Ag{constructor(e,t,n,s,i=!1){this.auth=e,this.resolver=n,this.user=s,this.bypassAuthState=i,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(n){this.reject(n)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:s,tenantId:i,error:o,type:a}=e;if(o){this.reject(o);return}const u={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(u))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Uw;case"linkViaPopup":case"linkViaRedirect":return qw;case"reauthViaPopup":case"reauthViaRedirect":return Bw;default:Gt(this.auth,"internal-error")}}resolve(e){On(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){On(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const Gw=new ia(2e3,1e4);async function $w(r,e,t){if(Be(r.app))return Promise.reject(St(r,"operation-not-supported-in-this-environment"));const n=rt(r);ou(r,e,Si);const s=ca(n,t);return new nr(n,"signInViaPopup",e,s).executeNotNull()}async function jw(r,e,t){const n=ee(r);ou(n.auth,e,Si);const s=ca(n.auth,t);return new nr(n.auth,"linkViaPopup",e,s,n).executeNotNull()}class nr extends Ag{constructor(e,t,n,s,i){super(e,t,s,i),this.provider=n,this.authWindow=null,this.pollId=null,nr.currentPopupAction&&nr.currentPopupAction.cancel(),nr.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return z(e,this.auth,"internal-error"),e}async onExecution(){On(this.filter.length===1,"Popup operations only handle one event");const e=pu();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(St(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(St(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,nr.currentPopupAction=null}pollUserCancellation(){const e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(St(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Gw.get())};e()}}nr.currentPopupAction=null;const zw="pendingRedirect",Qa=new Map;class Hw extends Ag{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=Qa.get(this.auth._key());if(!e){try{const n=await Ww(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(n)}catch(t){e=()=>Promise.reject(t)}Qa.set(this.auth._key(),e)}return this.bypassAuthState||Qa.set(this.auth._key(),()=>Promise.resolve(null)),e()}
41async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function Ww(r,e){const t=Sg(e),n=vg(r);if(!await n._isAvailable())return!1;const s=await n._get(t)==="true";return await n._remove(t),s}async function Rg(r,e){return vg(r)._set(Sg(e),"true")}function Kw(r,e){Qa.set(r._key(),e)}function vg(r){return An(r._redirectPersistence)}function Sg(r){return Ka(zw,r.config.apiKey,r.name)}function Qw(r,e,t){return Yw(r,e,t)}async function Yw(r,e,t){if(Be(r.app))return Promise.reject(yt(r));const n=rt(r);ou(r,e,Si),await n._initializationPromise;const s=ca(n,t);return await Rg(s,n),s._openRedirect(n,e,"signInViaRedirect")}function Jw(r,e,t){return Xw(r,e,t)}async function Xw(r,e,t){const n=ee(r);ou(n.auth,e,Si),await n.auth._initializationPromise;const s=ca(n.auth,t);await hu(!1,n,e.providerId),await Rg(s,n.auth);const i=await eT(n);return s._openRedirect(n.auth,e,"linkViaRedirect",i)}async function Zw(r,e){return await rt(r)._initializationPromise,Pg(r,e,!1)}async function Pg(r,e,t=!1){if(Be(r.app))return Promise.reject(yt(r));const n=rt(r),s=ca(n,e),o=await new Hw(n,s,t).execute();return o&&!t&&(delete o.user._redirectEventId,await n._persistUserIfCurrent(o.user),await n._setRedirectUser(null,e)),o}async function eT(r){const e=pu(`${r.uid}:::`);return r._redirectEventId=e,await r.auth._setRedirectUser(r),await r.auth._persistUserIfCurrent(r),e}const tT=600*1e3;class nT{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(n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!rT(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!Cg(e)){const n=e.error.code?.split("auth/")[1]||"internal-error";t.onError(St(this.auth,n))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const n=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=tT&&this.cachedEventUids.clear(),this.cachedEventUids.has(J2(e))}saveEventToCache(e){this.cachedEventUids.add(J2(e)),this.lastProcessedEventTime=Date.now()}}function J2(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(e=>e).join("-")}function Cg({type:r,error:e}){return r==="unknown"&&e?.code==="auth/no-auth-event"}function rT(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Cg(r);default:return!1}}async function sT(r,e={}){return Je(r,"GET","/v1/projects",e)}const iT=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,oT=/^https?/;async function aT(r){if(r.config.emulator)return;const{authorizedDomains:e}=await sT(r);for(const t of e)try{if(cT(t))return}catch{}Gt(r,"unauthorized-domain")}function cT(r){const e=Fo(),{protocol:t,hostname:n}=new URL(e);if(r.startsWith("chrome-extension://")){const o=new URL(r);return o.hostname===""&&n===""?t==="chrome-extension:"&&r.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===n}if(!oT.test(t))return!1;if(iT.test(r))return n===r;const s=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(n)}const uT=new ia(3e4,6e4);function X2(){const r=Ue().___jsl;if(r?.H){for(const e of Object.keys(r.H))if(r.H[e].r=r.H[e].r||[],r.H[e].L=r.H[e].L||[],r.H[e].r=[...r.H[e].L],r.CP)for(let t=0;t<r.CP.length;t++)r.CP[t]=null}}function lT(r){return new Promise((e,t)=>
41{function n(){X2(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{X2(),t(St(r,"network-request-failed"))},timeout:uT.get()})}if(Ue().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(Ue().gapi?.load)n();else{const s=ng("iframefcb");return Ue()[s]=()=>{gapi.load?n():t(St(r,"network-request-failed"))},Ph(`${uI()}?onload=${s}`).catch(i=>t(i))}}).catch(e=>{throw Ya=null,e})}let Ya=null;function hT(r){return Ya=Ya||lT(r),Ya}const dT=new ia(5e3,15e3),fT="__/auth/iframe",pT="emulator/auth/iframe",mT={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},gT=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function _T(r){const e=r.config;z(e.authDomain,r,"auth-domain-config-required");const t=e.emulator?vh(e,pT):`https://${r.config.authDomain}/${fT}`,n={apiKey:e.apiKey,appName:r.name,v:ui},s=gT.get(r.config.apiHost);s&&(n.eid=s);const i=r._getFrameworks();return i.length&&(n.fw=i.join(",")),`${t}?${ai(n).slice(1)}`}async function yT(r){const e=await hT(r),t=Ue().gapi;return z(t,r,"internal-error"),e.open({where:document.body,url:_T(r),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:mT,dontclear:!0},n=>new Promise(async(s,i)=>{await n.restyle({setHideOnLeave:!1});const o=St(r,"network-request-failed"),a=Ue().setTimeout(()=>{i(o)},dT.get());function u(){Ue().clearTimeout(a),s(n)}n.ping(u).then(u,()=>{i(o)})}))}const ET={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},IT=500,wT=600,TT="_blank",AT="http://localhost";class Z2{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function RT(r,e,t,n=IT,s=wT){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-n)/2,0).toString();let a="";const u={...ET,width:n.toString(),height:s.toString(),top:i,left:o},l=He().toLowerCase();t&&(a=Q0(l)?TT:t),W0(l)&&(e=e||AT,u.scrollbars="yes");const d=Object.entries(u).reduce((g,[I,v])=>`${g}${I}=${v},`,"");if(ZE(l)&&a!=="_self")return vT(e||"",a),new Z2(null);const p=window.open(e||"",a,d);z(p,r,"popup-blocked");try{p.focus()}catch{}return new Z2(p)}function vT(r,e){const t=document.createElement("a");t.href=r,t.target=e;const n=document.createEvent("MouseEvent");n.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(n)}const ST="__/auth/handler",PT="emulator/auth/handler",CT=encodeURIComponent("fac");async function ep(r,e,t,n,s,i){z(r.config.authDomain,r,"auth-domain-config-required"),z(r.config.apiKey,r,"invalid-api-key");const o={apiKey:r.config.apiKey,appName:r.name,authType:t,redirectUrl:n,v:ui,eventId:s};if(e instanceof Si){e.setDefaultLanguage(r.languageCode),o.providerId=e.providerId||"",N7(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[d,p]of Object.entries({}))o[d]=p}if(e instanceof Pi){const d=e.getScopes().filter(p=>p!=="");d.length>0&&(o.scopes=d.join(","))}r.tenantId&&(o.tid=r.tenantId);const a=o;for(const d of Object.keys(a))a[d]===void 0&&delete a[d];const u=await r._getAppCheckToken(),l=u?`#${CT}=${encodeURIComponent(u)}`:"";return`${bT(r)}?${ai(a).slice(1)}${l}`}function bT({config:r}){return r.emulator?vh(r,PT):`https://${r.authDomain}/${ST}`}const sl="webStorageSupport";class NT{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Nh,this._completeRedirectFn=Pg,this._overrideRedirectResult=Kw}async _openPopup(e,t,n,s){On(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");const i=await ep(e,t,n,Fo(),s);return RT(e,i,pu())}async _openRedirect(e,t,n,s){await this._originValidation(e);const i=await ep(e,t,n,Fo(),s);return Tw(i),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:s,promise:i}=this.eventManagers[t];return s?Promise.resolve(s):(On(i,"If manager is not set, promise should be"),i)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){const t=await yT(e),n=new nT(e);return t.register("authEvent",s=>
41(z(s?.authEvent,e,"invalid-auth-event"),{status:n.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(sl,{type:sl},s=>{const i=s?.[0]?.[sl];i!==void 0&&t(!!i),Gt(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=aT(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return eg()||K0()||Sh()}}const VT=NT;var tp="@firebase/auth",np="1.13.3";class OT{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.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;const t=this.auth.onIdTokenChanged(n=>{e(n?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){z(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}function DT(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function kT(r){Qr(new lr("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=n.options;z(o&&!o.includes(":"),"invalid-api-key",{appName:n.name});const u={apiKey:o,authDomain:a,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:tg(r)},l=new iI(n,s,i,u);return II(l,t),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Qr(new lr("auth-internal",e=>{const t=rt(e.getProvider("auth").getImmediate());return(n=>new OT(n))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),on(tp,np,DT(r)),on(tp,np,"esm2020")}const xT=300,LT=pp("authIdTokenMaxAge")||xT;let rp=null;const MT=r=>async e=>{const t=e&&await e.getIdTokenResult(),n=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>LT)return;const s=t?.token;rp!==s&&(rp=s,await fetch(r,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function ae(r=Kl()){const e=ci(r,"auth");if(e.isInitialized())return e.getImmediate();const t=EI(r,{popupRedirectResolver:VT,persistence:[Ig,pg,Nh]}),n=pp("authTokenSyncURL");if(n&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(n,location.origin);if(location.origin===i.origin){const o=MT(i.toString());mw(t,o,()=>o(t.currentUser)),pw(t,a=>o(a))}}const s=hp("auth");return s&&jl(t,`http://${s}`),t}function FT(){return document.getElementsByTagName("head")?.[0]??document}oI({loadJS(r){return new Promise((e,t)=>{const n=document.createElement("script");n.setAttribute("src",r),n.onload=e,n.onerror=s=>{const i=St("internal-error");i.customData=s,t(i)},n.type="text/javascript",n.charset="UTF-8",FT().appendChild(n)})},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="});kT("Browser");const UT="type.googleapis.com/google.protobuf.Int64Value",BT="type.googleapis.com/google.protobuf.UInt64Value";function bg(r,e){const t={};for(const n in r)r.hasOwnProperty(n)&&(t[n]=e(r[n]));return t}function vc(r){if(r==null)return null;if(r instanceof Number&&(r=r.valueOf()),typeof r=="number"&&isFinite(r)||r===!0||r===!1||Object.prototype.toString.call(r)==="[object String]")return r;if(r instanceof Date)return r.toISOString();if(Array.isArray(r))return r.map(e=>vc(e));if(typeof r=="function"||typeof r=="object")return bg(r,e=>vc(e));throw new Error("Data cannot be encoded in JSON: "+r)}function oi(r){if(r==null)return r;
41if(r["@type"])switch(r["@type"]){case UT:case BT:{const e=Number(r.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+r);return e}default:throw new Error("Data cannot be decoded from JSON: "+r)}return Array.isArray(r)?r.map(e=>oi(e)):typeof r=="function"||typeof r=="object"?bg(r,e=>oi(e)):r}const Dh="functions";const sp={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class At extends mn{constructor(e,t,n){super(`${Dh}/${e}`,t||""),this.details=n,Object.setPrototypeOf(this,At.prototype)}}function qT(r){if(r>=200&&r<300)return"ok";switch(r){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function Sc(r,e){let t=qT(r),n=t,s;try{const i=e&&e.error;if(i){const o=i.status;if(typeof o=="string"){if(!sp[o])return new At("internal","internal");t=sp[o],n=o}const a=i.message;typeof a=="string"&&(n=a),s=i.details,s!==void 0&&(s=oi(s))}}catch{}return t==="ok"?null:new At(t,n,s)}class GT{constructor(e,t,n,s){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,Be(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=t.getImmediate({optional:!0}),this.messaging=n.getImmediate({optional:!0}),this.auth||t.get().then(i=>this.auth=i,()=>{}),this.messaging||n.get().then(i=>this.messaging=i,()=>{}),this.appCheck||s?.get().then(i=>this.appCheck=i,()=>{})}async getAuthToken(){if(this.auth)try{return(await this.auth.getToken())?.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.serverAppAppCheckToken)return this.serverAppAppCheckToken;if(this.appCheck){const t=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return t.error?null:t.token}return null}async getContext(e){const t=await this.getAuthToken(),n=await this.getMessagingToken(),s=await this.getAppCheckToken(e);return{authToken:t,messagingToken:n,appCheckToken:s}}}const zl="us-central1",$T=/^data: (.*?)(?:\n|$)/;function jT(r){let e=null;return{promise:new Promise((t,n)=>{e=setTimeout(()=>{n(new At("deadline-exceeded","deadline-exceeded"))},r)}),cancel:()=>{e&&clearTimeout(e)}}}class zT{constructor(e,t,n,s,i=zl,o=(...a)=>fetch(...a)){this.app=e,this.fetchImpl=o,this.emulatorOrigin=null,this.contextProvider=new GT(e,t,n,s),this.cancelAllRequests=new Promise(a=>{this.deleteService=()=>Promise.resolve(a())});try{const a=new URL(i);this.customDomain=a.origin+(a.pathname==="/"?"":a.pathname),this.region=zl}catch{this.customDomain=null,this.region=i}}_delete(){return this.deleteService()}_url(e){const t=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${t}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${t}.cloudfunctions.net/${e}`}}function HT(r,e,t){const n=Tr(e);r.emulatorOrigin=`http${n?"s":""}://${e}:${t}`,n&&Cc(r.emulatorOrigin+"/backends")}function WT(r,e,t){const n=s=>QT(r,e,s,{});return n.stream=(s,i)=>JT(r,e,s,i),n}function Ng(r){return r.emulatorOrigin&&Tr(r.emulatorOrigin)?"include":void 0}async function KT(r,e,t,n,s){t["Content-Type"]="application/json";let i;try{i=await n(r,{method:"POST",body:JSON.stringify(e),headers:t,credentials:Ng(s)})}catch{return{status:0,json:null}}let o=null;try{o=await i.json()}catch{}return{status:i.status,json:o}}async function Vg(r,e){const t={},n=await r.contextProvider.getContext(e.limitedUseAppCheckTokens);return n.authToken&&(t.Authorization="Bearer "+n.authToken),n.messagingToken&&
41(t["Firebase-Instance-ID-Token"]=n.messagingToken),n.appCheckToken!==null&&(t["X-Firebase-AppCheck"]=n.appCheckToken),t}function QT(r,e,t,n){const s=r._url(e);return YT(r,s,t,n)}async function YT(r,e,t,n){t=vc(t);const s={data:t},i=await Vg(r,n),o=n.timeout||7e4,a=jT(o),u=await Promise.race([KT(e,s,i,r.fetchImpl,r),a.promise,r.cancelAllRequests]);if(a.cancel(),!u)throw new At("cancelled","Firebase Functions instance was deleted.");const l=Sc(u.status,u.json);if(l)throw l;if(!u.json)throw new At("internal","Response is not valid JSON object.");let d=u.json.data;if(typeof d>"u"&&(d=u.json.result),typeof d>"u")throw new At("internal","Response is missing data field.");return{data:oi(d)}}function JT(r,e,t,n){const s=r._url(e);return XT(r,s,t,n||{})}async function XT(r,e,t,n){t=vc(t);const s={data:t},i=await Vg(r,n);i["Content-Type"]="application/json",i.Accept="text/event-stream";let o;try{o=await r.fetchImpl(e,{method:"POST",body:JSON.stringify(s),headers:i,signal:n?.signal,credentials:Ng(r)})}catch(g){if(g instanceof Error&&g.name==="AbortError"){const v=new At("cancelled","Request was cancelled.");return{data:Promise.reject(v),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(v)}}}}}}const I=Sc(0,null);return{data:Promise.reject(I),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(I)}}}}}}let a,u;const l=new Promise((g,I)=>{a=g,u=I});n?.signal?.addEventListener("abort",()=>{const g=new At("cancelled","Request was cancelled.");u(g)});const d=o.body.getReader(),p=ZT(d,a,u,n?.signal);return{stream:{[Symbol.asyncIterator](){const g=p.getReader();return{async next(){const{value:I,done:v}=await g.read();return{value:I,done:v}},async return(){return await g.cancel(),{done:!0,value:void 0}}}}},data:l}}function ZT(r,e,t,n){const s=(o,a)=>{const u=o.match($T);if(!u)return;const l=u[1];try{const d=JSON.parse(l);if("result"in d){e(oi(d.result));return}if("message"in d){a.enqueue(oi(d.message));return}if("error"in d){const p=Sc(0,d);a.error(p),t(p);return}}catch(d){if(d instanceof At){a.error(d),t(d);return}}},i=new TextDecoder;return new ReadableStream({start(o){let a="";return u();async function u(){if(n?.aborted){const l=new At("cancelled","Request was cancelled");return o.error(l),t(l),Promise.resolve()}try{const{value:l,done:d}=await r.read();if(d){a.trim()&&s(a.trim(),o),o.close();return}if(n?.aborted){const g=new At("cancelled","Request was cancelled");o.error(g),t(g),await r.cancel();return}a+=i.decode(l,{stream:!0});const p=a.split(`
42`);a=p.pop()||"";for(const g of p)g.trim()&&s(g.trim(),o);return u()}catch(l){const d=l instanceof At?l:Sc(0,null);o.error(d),t(d)}}},cancel(){return r.cancel()}})}const ip="@firebase/functions",op="0.13.5";const eA="auth-internal",tA="app-check-internal",nA="messaging-internal";function rA(r){const e=(t,{instanceIdentifier:n})=>{const s=t.getProvider("app").getImmediate(),i=t.getProvider(eA),o=t.getProvider(nA),a=t.getProvider(tA);return new zT(s,i,o,a,n)};Qr(new lr(Dh,e,"PUBLIC").setMultipleInstances(!0)),on(ip,op,r),on(ip,op,"esm2020")}function fA(r=Kl(),e=zl){const n=ci(ee(r),Dh).getImmediate({identifier:e}),s=dp("functions");return s&&sA(n,...s),n}function sA(r,e,t){HT(ee(r),e,t)}function pA(r,e,t){return WT(ee(r),e)}rA();var zr;(function(r){r.IndexedDbLocal="INDEXED_DB_LOCAL",r.InMemory="IN_MEMORY",r.BrowserLocal="BROWSER_LOCAL",r.BrowserSession="BROWSER_SESSION"})(zr||(zr={}));var yn;(function(r){r.APPLE="apple.com",r.FACEBOOK="facebook.com",r.GAME_CENTER="gc.apple.com",r.GITHUB="github.com",r.GOOGLE="google.com",r.MICROSOFT="microsoft.com",r.PLAY_GAMES="playgames.google.com",r.TWITTER="twitter.com",r.YAHOO="yahoo.com",r.PASSWORD="password",r.PHONE="phone"})(yn||(yn={}));const iA=l7("FirebaseAuthentication",{web:()=>h7(()=>Promise.resolve().then(()=>oA),void 0).then(r=>new r.FirebaseAuthenticationWeb)}),mA=Object.freeze(Object.defineProperty({__proto__:null,FirebaseAuthentication:iA,get Persistence(){return zr},get ProviderId(){return yn}},Symbol.toStringTag,{value:"Module"}));class de extends d7{constructor(){super(),this.lastConfirmationResult=new Map;const e=ae();e.onAuthStateChanged(t=>this.handleAuthStateChange(t)),e.onIdTokenChanged(t=>{this.handleIdTokenChange(t)}
42)}async applyActionCode(e){const t=ae();return KI(t,e.oobCode)}async createUserWithEmailAndPassword(e){const t=ae(),n=await QI(t,e.email,e.password);return this.createSignInResult(n,null)}async confirmPasswordReset(e){const t=ae();return WI(t,e.oobCode,e.newPassword)}async confirmVerificationCode(e){const{verificationCode:t,verificationId:n}=e,s=this.lastConfirmationResult.get(n);if(!s)throw new Error(de.ERROR_CONFIRMATION_RESULT_MISSING);const i=await s.confirm(t);return this.createSignInResult(i,null)}async deleteUser(){const t=ae().currentUser;if(!t)throw new Error(de.ERROR_NO_USER_SIGNED_IN);return _w(t)}async fetchSignInMethodsForEmail(e){const t=ae();return{signInMethods:await tw(t,e.email)}}async getPendingAuthResult(){throw this.unimplemented("Not implemented on web.")}async getCurrentUser(){const e=ae();return{user:this.createUserResult(e.currentUser)}}async getIdToken(e){const t=ae();if(!t.currentUser)throw new Error(de.ERROR_NO_USER_SIGNED_IN);return{token:await t.currentUser.getIdToken(e?.forceRefresh)||""}}async getIdTokenResult(e){const t=ae();if(!t.currentUser)throw new Error(de.ERROR_NO_USER_SIGNED_IN);const n=await t.currentUser.getIdTokenResult(e?.forceRefresh);return Object.assign(Object.assign({},n),{authTime:Date.parse(n.authTime),expirationTime:Date.parse(n.expirationTime),issuedAtTime:Date.parse(n.issuedAtTime)})}async getRedirectResult(){const e=ae(),t=await Zw(e),n=t?xe.credentialFromResult(t):null;return this.createSignInResult(t,n)}async getTenantId(){return{tenantId:ae().tenantId}}async isSignInWithEmailLink(e){const t=ae();return{isSignInWithEmailLink:XI(t,e.emailLink)}}async linkWithApple(e){const t=new xe(yn.APPLE);this.applySignInOptions(e||{},t);const n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),s=xe.credentialFromResult(n);return this.createSignInResult(n,s)}async linkWithEmailAndPassword(e){const t=Dn.credential(e.email,e.password),n=await this.linkCurrentUserWithCredential(t);return this.createSignInResult(n,t)}async linkWithEmailLink(e){const t=Dn.credentialWithLink(e.email,e.emailLink),n=await this.linkCurrentUserWithCredential(t);return this.createSignInResult(n,t)}async linkWithFacebook(e){const t=new Mt;this.applySignInOptions(e||{},t);const n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),s=Mt.credentialFromResult(n);return this.createSignInResult(n,s)}async linkWithGameCenter(){throw this.unimplemented("Not implemented on web.")}async linkWithGithub(e){const t=new Ut;this.applySignInOptions(e||{},t);const n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),s=Ut.credentialFromResult(n);return this.createSignInResult(n,s)}async linkWithGoogle(e){const t=new Ft;this.applySignInOptions(e||{},t);const n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),s=Ft.credentialFromResult(n);return this.createSignInResult(n,s)}async linkWithMicrosoft(e){const t=new xe(yn.MICROSOFT);this.applySignInOptions(e||{},t);const n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),s=xe.credentialFromResult(n);return this.createSignInResult(n,s)}async linkWithOpenIdConnect(e){const t=new xe(e.providerId);this.applySignInOptions(e,t);const n=await this.linkCurrentUserWithPopupOrRedirect(t,e.mode),s=xe.credentialFromResult(n);return this.createSignInResult(n,s)}async linkWithPhoneNumber(e){const n=ae().currentUser;if(!n)throw new Error(de.ERROR_NO_USER_SIGNED_IN);if(!e.phoneNumber)throw new Error(de.ERROR_PHONE_NUMBER_MISSING);if(!e.recaptchaVerifier||!(e.recaptchaVerifier instanceof Y2))throw new Error(de.ERROR_RECAPTCHA_VERIFIER_MISSING);try{const s=await Fw(n,e.phoneNumber,e.recaptchaVerifier),{verificationId:i}=s;this.lastConfirmationResult.set(i,s);const o={verificationId:i};this.notifyListeners(de.PHONE_CODE_SENT_EVENT,o)}catch(s){const i={message:this.getErrorMessage(s)};this.notifyListeners(de.PHONE_VERIFICATION_FAILED_EVENT,i)}}async linkWithPlayGames(){throw this.unimplemented("Not implemented on web.")}async linkWithTwitter(e){const t=new Bt;this.applySignInOptions(e||{},t);const n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),s=Bt.credentialFromResult(n);return this.createSignInResult(n,s)}async linkWithYahoo(e){const t=new xe(yn.YAHOO);this.applySignInOptions(e||{},t);const n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),s=xe.credentialFromResult(n);return this.createSignInResult(n,s)}async reload(){const t=ae().currentUser;if(!t)throw new Error(de.ERROR_NO_USER_SIGNED_IN);return j0(t)}async revokeAccessToken(e){const t=ae();return gw(t,e.token)}async sendEmailVerification(e){const n=ae().currentUser;if(!n)throw new Error(de.ERROR_NO_USER_SIGNED_IN);return nw(n,e?.actionCodeSettings)}async sendPasswordResetEmail(e){const t=ae();return HI(t,e.email,e.actionCodeSettings)}async sendSignInLinkToEmail(e){const t=ae();return JI(t,e.email,e.actionCodeSettings)}async setLanguageCode(e){const t=ae();t.languageCode=e.languageCode}async setPersistence(e){const t=ae();switch(e.persistence){case zr.BrowserLocal:await La(t,pg);break;case zr.BrowserSession:await La(t,Nh);break;case zr.IndexedDbLocal:await La(t,Ig);break;case zr.InMemory:await La(t,$l);break}}async setTenantId(e){const t=ae();t.tenantId=e.tenantId}async signInAnonymously(){const e=ae(),t=await qI(e);return this.createSignInResult(t,null)}async signInWithApple(e){const t=new xe(yn.APPLE);this.applySignInOptions(e||{},t);const n=await this.signInWithPopupOrRedirect(t,e?.mode),s=xe.credentialFromResult(n);return this.createSignInResult(n,s)}async signInWithCustomToken(e){const t=ae(),n=await zI(t,e.token);return this.createSignInResult(n,null)}async signInWithEmailAndPassword(e){const t=ae(),n=await YI(t,e.email,e.password);return this.createSignInResult(n,null)}async signInWithEmailLink(e){const t=ae(),n=await ZI(t,e.email,e.emailLink);return this.createSignInResult(n,null)}async signInWithFacebook(e){const t=new Mt;this.applySignInOptions(e||{},t);const n=await this.signInWithPopupOrRedirect(t,e?.mode),s=Mt.credentialFromResult(n);return this.createSignInResult(n,s)}async signInWithGithub(e){const t=new Ut;this.applySignInOptions(e||{},t);const n=await this.signInWithPopupOrRedirect(t,e?.mode),s=Ut.credentialFromResult(n);return this.createSignInResult(n,s)}async signInWithGoogle(e){const t=new Ft;this.applySignInOptions(e||{},t);const n=await this.signInWithPopupOrRedirect(t,e?.mode),s=Ft.credentialFromResult(n);return this.createSignInResult(n,s)}async signInWithMicrosoft(e){const t=new xe(yn.MICROSOFT);this.applySignInOptions(e||{},t);const n=await this.signInWithPopupOrRedirect(t,e?.mode),s=xe.credentialFromResult(n);return this.createSignInResult(n,s)}async signInWithOpenIdConnect(e){const t=new xe(e.providerId);this.applySignInOptions(e,t);const n=await this.signInWithPopupOrRedirect(t,e.mode),s=xe.credentialFromResult(n);return this.createSignInResult(n,s)}async signInWithPhoneNumber(e){if(!e.phoneNumber)throw new Error(de.ERROR_PHONE_NUMBER_MISSING);
42if(!e.recaptchaVerifier||!(e.recaptchaVerifier instanceof Y2))throw new Error(de.ERROR_RECAPTCHA_VERIFIER_MISSING);const t=ae();try{const n=await Mw(t,e.phoneNumber,e.recaptchaVerifier),{verificationId:s}=n;this.lastConfirmationResult.set(s,n);const i={verificationId:s};this.notifyListeners(de.PHONE_CODE_SENT_EVENT,i)}catch(n){const s={message:this.getErrorMessage(n)};this.notifyListeners(de.PHONE_VERIFICATION_FAILED_EVENT,s)}}async signInWithPlayGames(){throw this.unimplemented("Not implemented on web.")}async signInWithGameCenter(){throw this.unimplemented("Not implemented on web.")}async signInWithTwitter(e){const t=new Bt;this.applySignInOptions(e||{},t);const n=await this.signInWithPopupOrRedirect(t,e?.mode),s=Bt.credentialFromResult(n);return this.createSignInResult(n,s)}async signInWithYahoo(e){const t=new xe(yn.YAHOO);this.applySignInOptions(e||{},t);const n=await this.signInWithPopupOrRedirect(t,e?.mode),s=xe.credentialFromResult(n);return this.createSignInResult(n,s)}async signOut(){await ae().signOut()}async unlink(e){const t=ae();if(!t.currentUser)throw new Error(de.ERROR_NO_USER_SIGNED_IN);const n=await GI(t.currentUser,e.providerId);return{user:this.createUserResult(n)}}async updateEmail(e){const n=ae().currentUser;if(!n)throw new Error(de.ERROR_NO_USER_SIGNED_IN);return ow(n,e.newEmail)}async updatePassword(e){const n=ae().currentUser;if(!n)throw new Error(de.ERROR_NO_USER_SIGNED_IN);return aw(n,e.newPassword)}async updateProfile(e){const n=ae().currentUser;if(!n)throw new Error(de.ERROR_NO_USER_SIGNED_IN);return iw(n,{displayName:e.displayName,photoURL:e.photoUrl})}async useAppLanguage(){ae().useDeviceLanguage()}async useEmulator(e){const t=ae(),n=e.port||9099,s=e.scheme||"http";e.host.includes("://")?jl(t,`${e.host}:${n}`):jl(t,`${s}://${e.host}:${n}`)}async verifyBeforeUpdateEmail(e){const n=ae().currentUser;if(!n)throw new Error(de.ERROR_NO_USER_SIGNED_IN);return rw(n,e?.newEmail,e?.actionCodeSettings)}handleAuthStateChange(e){const n={user:this.createUserResult(e)};this.notifyListeners(de.AUTH_STATE_CHANGE_EVENT,n,!0)}async handleIdTokenChange(e){if(!e)return;const n={token:await e.getIdToken(!1)};this.notifyListeners(de.ID_TOKEN_CHANGE_EVENT,n,!0)}applySignInOptions(e,t){if(e.customParameters){const n={};e.customParameters.map(s=>{n[s.key]=s.value}),t.setCustomParameters(n)}if(e.scopes)for(const n of e.scopes)t.addScope(n)}signInWithPopupOrRedirect(e,t){const n=ae();return t==="redirect"?Qw(n,e):$w(n,e)}linkCurrentUserWithPopupOrRedirect(e,t){const n=ae();if(!n.currentUser)throw new Error(de.ERROR_NO_USER_SIGNED_IN);return t==="redirect"?Jw(n.currentUser,e):jw(n.currentUser,e)}linkCurrentUserWithCredential(e){const t=ae();if(!t.currentUser)throw new Error(de.ERROR_NO_USER_SIGNED_IN);return ug(t.currentUser,e)}requestAppTrackingTransparencyPermission(){throw this.unimplemented("Not implemented on web.")}checkAppTrackingTransparencyPermission(){throw this.unimplemented("Not implemented on web.")}createSignInResult(e,t){const n=this.createUserResult(e?.user||null),s=this.createCredentialResult(t),i=this.createAdditionalUserInfoResult(e);return{user:n,credential:s,additionalUserInfo:i}}createCredentialResult(e){if(!e)return null;const t={providerId:e.providerId};return e instanceof fn&&(t.accessToken=e.accessToken,t.idToken=e.idToken,t.secret=e.secret),t}createUserResult(e){return e?{displayName:e.displayName,email:e.email,emailVerified:e.emailVerified,isAnonymous:e.isAnonymous,metadata:this.createUserMetadataResult(e.metadata),phoneNumber:e.phoneNumber,photoUrl:e.photoURL,providerData:this.createUserProviderDataResult(e.providerData),providerId:e.providerId,tenantId:e.tenantId,uid:e.uid}:null}createUserMetadataResult(e){const t={};return e.creationTime&&(t.creationTime=Date.parse(e.creationTime)),e.lastSignInTime&&(t.lastSignInTime=Date.parse(e.lastSignInTime)),t}createUserProviderDataResult(e){return e.map(t=>({displayName:t.displayName,email:t.email,phoneNumber:t.phoneNumber,photoUrl:t.photoURL,providerId:t.providerId,uid:t.uid}))}createAdditionalUserInfoResult(e){if(!e)return null;const t=fw(e);if(!t)return null;const{isNewUser:n,profile:s,providerId:i,username:o}=t,a={isNewUser:n};return i!==null&&(a.providerId=i),s!==null&&(a.profile=s),o!=null&&(a.username=o),a}getErrorMessage(e){return e instanceof Object&&"message"in e&&typeof e.message=="string"?e.message:JSON.stringify(e)}}de.AUTH_STATE_CHANGE_EVENT="authStateChange";de.ID_TOKEN_CHANGE_EVENT="idTokenChange";de.PHONE_CODE_SENT_EVENT="phoneCodeSent";de.PHONE_VERIFICATION_FAILED_EVENT="phoneVerificationFailed";de.ERROR_NO_USER_SIGNED_IN="No user is signed in.";de.ERROR_PHONE_NUMBER_MISSING="phoneNumber must be provided.";de.ERROR_RECAPTCHA_VERIFIER_MISSING="recaptchaVerifier must be provided and must be an instance of RecaptchaVerifier.";de.ERROR_CONFIRMATION_RESULT_MISSING="No confirmation result with this verification id was found.";
42const oA=Object.freeze(Object.defineProperty({__proto__:null,FirebaseAuthenticationWeb:de},Symbol.toStringTag,{value:"Module"}));export{Ft as G,xe as O,EI as a,ae as b,fA as c,Ig as d,sm as e,gE as f,vy as g,pA as h,D4 as i,YI as j,Ch as k,$w as l,_w as m,dA as n,hA as o,lA as p,mA as q,TE as s};

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.