@ssa-ui-kit/templates 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/814.index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkSSATemplates=self.webpackChunkSSATemplates||[]).push([[814],{258:function(e,t,n){n.d(t,{BH:function(){return d},L:function(){return o},LL:function(){return y},P0:function(){return l},Sg:function(){return p},ZR:function(){return g},aH:function(){return h},eu:function(){return m},hl:function(){return f},m9:function(){return E},vZ:function(){return v}});const s=function(e){const t=[];let 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++]=63&i|128):55296==(64512&i)&&s+1<e.length&&56320==(64512&e.charCodeAt(s+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++s)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let t=0;t<e.length;t+=3){const i=e[t],r=t+1<e.length,o=r?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,u=i>>2,l=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,r||(h=64)),s.push(n[u],n[l],n[h],n[d])}return s.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(s(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,s=0;for(;n<e.length;){const i=e[n++];if(i<128)t[s++]=String.fromCharCode(i);else if(i>191&&i<224){const r=e[n++];t[s++]=String.fromCharCode((31&i)<<6|63&r)}else if(i>239&&i<365){const r=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[s++]=String.fromCharCode(55296+(r>>10)),t[s++]=String.fromCharCode(56320+(1023&r))}else{const r=e[n++],o=e[n++];t[s++]=String.fromCharCode((15&i)<<12|(63&r)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let t=0;t<e.length;){const i=n[e.charAt(t++)],o=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==i||null==o||null==a||null==c)throw new r;const u=i<<2|o>>4;if(s.push(u),64!==a){const e=o<<4&240|a>>2;if(s.push(e),64!==c){const e=a<<6&192|c;s.push(e)}}}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class r extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const o=function(e){return function(e){const t=s(e);return i.encodeByteArray(t,!0)}(e).replace(/\./g,"")},a=function(e){try{return i.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};const c=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,u=()=>{try{return c()||(()=>{if("undefined"==typeof process||void 0==={ALLUSERSPROFILE:"C:\\ProgramData",ANDROID_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk",ANDROID_SDK_ROOT:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk",APPDATA:"C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming","asl.log":"Destination=file",CommonProgramFiles:"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files",CommonProgramW6432:"C:\\Program Files\\Common Files",COMPUTERNAME:"W23005",ComSpec:"C:\\windows\\system32\\cmd.exe",DriverData:"C:\\Windows\\System32\\Drivers\\DriverData",EFC_35152:"0",FPS_BROWSER_APP_PROFILE_STRING:"Internet Explorer",FPS_BROWSER_USER_PROFILE_STRING:"Default",HOME:"C:\\Users\\kostiantyn.petrenko",HOMEDRIVE:"C:",HOMEPATH:"\\Users\\kostiantyn.petrenko",IGCCSVC_DB:"AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAABzAPW+8cckC+AVlpiF6BiQQAAAACAAAAAAAQZgAAAAEAACAAAABtATYUVfnerbyC/jse8VmjR2PTkJ76psslt4jbzW0F5gAAAAAOgAAAAAIAACAAAACWVl7cQH8WgqfTCR9PIbDobz4HPZVFM/IO4Rh+F/zjvGAAAABy6Do7/5za8vHrXtoB8PQ7yjZfrcPTHvG0qGkDOdwaYqOFqVaLZ64EuN/pqQ5hFZ+rKwMV/rOPBCtMk6NDo43YWjXkjKNjtjg7xA+/oexS1Z67+c4GP60zU0x9//iGcvZAAAAAFaoYpREoxIHPW57M5ygt1OUtOVto62caJYHuz+D90cgurwVnU4TlPThXDn7czfCn80teoOHGBD4Uh2QomuugbQ==",INIT_CWD:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2",JAVA_HOME:"C:\\Program Files\\Java\\jdk-17",LOCALAPPDATA:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local",LOGONSERVER:"\\\\W23005",NODE:"C:\\Program Files\\nodejs\\node.exe",NODE_ENV:"production",NODE_PATH:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules\\webpack\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules\\webpack\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\node_modules",npm_command:"run-script",npm_config_frozen_lockfile:"",npm_config_node_gyp:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node_modules\\node-gyp\\bin\\node-gyp.js",npm_config_recursive:"true",npm_config_registry:"https://registry.npmjs.org/",npm_config_user_agent:"pnpm/8.10.4 npm/? node/v18.20.2 win32 x64",npm_execpath:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\pnpm.cjs",npm_lifecycle_event:"build",npm_lifecycle_script:"webpack --mode=production --node-env=production && tsc --build --force ./tsconfig.build.json && resolve-tspaths -p ./tsconfig.build.json",npm_node_execpath:"C:\\Program Files\\nodejs\\node.exe",npm_package_author:"SSA Group",npm_package_browserslist_0:">0.1%",npm_package_browserslist_1:"not dead",npm_package_browserslist_2:"not op_mini all",npm_package_dependencies_dompurify:"^3.1.7",npm_package_dependencies_dotenv:"^16.0.3",npm_package_dependencies_js_cookie:"^3.0.5",npm_package_dependencies_js_tokens:"^4.0.0",npm_package_dependencies_loose_envify:"^1.4.0",npm_package_dependencies_luxon:"^3.5.0",npm_package_dependencies_plotly_js:"^2.35.2",npm_package_dependencies_react_plotly_js:"^2.6.0",npm_package_dependencies_react_toastify:"^10.0.5",npm_package_dependencies_scheduler:"^0.23.0",npm_package_dependencies_usehooks_ts:"^3.1.0",npm_package_dependencies_uuid:"^9.0.0",npm_package_dependencies__emotion_core:"^11.0.0",npm_package_dependencies__emotion_css:"^11.11.2",npm_package_dependencies__emotion_react:"^11.11.1",npm_package_dependencies__emotion_styled:"^11.11.0",npm_package_dependencies__floating_ui_react:"0.25.4",npm_package_dependencies__nivo_colors:"0.84.0",npm_package_dependencies__ssa_ui_kit_core:"workspace:^",npm_package_dependencies__ssa_ui_kit_hooks:"workspace:^",npm_package_dependencies__ssa_ui_kit_utils:"workspace:^",npm_package_dependencies__ssa_ui_kit_widgets:"workspace:^",npm_package_description:"SSA UI Kit templates",npm_package_devDependencies_resolve_tspaths:"^0.8.16",npm_package_devDependencies_storybook_addon_pseudo_states:"^2.1.0",npm_package_devDependencies_terser_webpack_plugin:"^5.3.9",npm_package_devDependencies_webpack:"^5.85.0",npm_package_devDependencies__emotion_jest:"^11.11.0",npm_package_devDependencies__playwright_test:"^1.48.0",npm_package_devDependencies__testing_library_jest_dom:"^5.16.5",npm_package_devDependencies__types_dompurify:"^3.0.5",npm_package_devDependencies__types_js_cookie:"^3.0.6",npm_package_devDependencies__types_luxon:"^3.4.2",npm_package_devDependencies__types_react_plotly_js:"^2.6.3",npm_package_devDependencies__types_testing_library__jest_dom:"^5.14.6",npm_package_devDependencies__types_uuid:"^9.0.3",npm_package_keywords_0:"react",npm_package_keywords_1:"SSA UI Kit",npm_package_keywords_2:"ui",npm_package_license:"MIT",npm_package_main:"dist/index.js",npm_package_name:"@ssa-ui-kit/templates",npm_package_peerDependenciesMeta__types_react_optional:"true",npm_package_peerDependencies_react:"18.x",npm_package_peerDependencies_react_dom:"18.x",npm_package_peerDependencies_react_hook_form:"^7.46.1",npm_package_peerDependencies_react_router_dom:"6.x",npm_package_peerDependencies__emotion_core:"^11.0.0",npm_package_peerDependencies__emotion_css:"^11.11.0",npm_package_peerDependencies__emotion_react:"^11.11.1",npm_package_peerDependencies__emotion_styled:"^11.11.0",npm_package_peerDependencies__nivo_core:"^0.84.0",npm_package_peerDependencies__nivo_line:"^0.84.0",npm_package_peerDependencies__nivo_pie:"^0.84.0",npm_package_peerDependencies__nivo_scales:"^0.84.0",npm_package_private:"false",npm_package_repository_directory:"packages/templates",npm_package_repository_type:"git",npm_package_repository_url:"https://github.com/ssagroup/ui-kit.git",npm_package_scripts_build:"webpack --mode=production --node-env=production && tsc --build --force ./tsconfig.build.json && resolve-tspaths -p ./tsconfig.build.json",npm_package_scripts_sb_build:"storybook build",npm_package_scripts_sb_dev:"storybook dev -p 6008",npm_package_scripts_test:"jest -i --no-cache",npm_package_scripts_test_e2e:"pnpm exec playwright test --project=chromium",npm_package_scripts_test_e2e_debug:"pnpm exec playwright test --project=chromium --debug",npm_package_scripts_test_e2e_ui:"pnpm exec playwright test --project=chromium --ui",npm_package_scripts_ts_check:"tsc --noEmit -p ./tsconfig.json",npm_package_scripts_ts_check_build:"tsc -p ./tsconfig.build.json",npm_package_scripts_ts_show_config:"tsc --showConfig -p ./tsconfig.json",npm_package_scripts_ts_show_config_build:"tsc --showConfig -p ./tsconfig.build.json",npm_package_sideEffects:"false",npm_package_types:"dist/index.d.ts",npm_package_version:"1.0.10",NUMBER_OF_PROCESSORS:"20",NVM_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm",NVM_SYMLINK:"C:\\Program Files\\nodejs",OneDrive:"C:\\Users\\kostiantyn.petrenko\\OneDrive - SSA Group",OneDriveCommercial:"C:\\Users\\kostiantyn.petrenko\\OneDrive - SSA Group",OnlineServices:"Online Services",OS:"Windows_NT",Path:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\packages\\templates\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node-gyp-bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node-gyp-bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node-gyp-bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\Program Files\\Git\\cmd;C:\\Program Files\\HP\\HP One Agent;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk\\platform-tools;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk\\tools;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\jdk-11.0.2\\bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs",PATHEXT:".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JSE;.WSF;.WSH;.MSC",platformcode:"M8",PNPM_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm",PNPM_SCRIPT_SRC_DIR:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\packages\\templates",PROCESSOR_ARCHITECTURE:"AMD64",PROCESSOR_IDENTIFIER:"Intel64 Family 6 Model 154 Stepping 3, GenuineIntel",PROCESSOR_LEVEL:"6",PROCESSOR_REVISION:"9a03",ProgramData:"C:\\ProgramData",ProgramFiles:"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)",ProgramW6432:"C:\\Program Files",PROMPT:"$P$G",PSModulePath:"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\windows\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files\\Microsoft Monitoring Agent\\Agent\\PowerShell\\",PUBLIC:"C:\\Users\\Public",RegionCode:"NA",SESSIONNAME:"Console",SystemDrive:"C:",SystemRoot:"C:\\windows",TEMP:"C:\\Users\\KOSTIA~1.PET\\AppData\\Local\\Temp",TMP:"C:\\Users\\KOSTIA~1.PET\\AppData\\Local\\Temp",USERDNSDOMAIN:"SSA-Outsourcing.com",USERDOMAIN:"SSA",USERDOMAIN_ROAMINGPROFILE:"SSA",USERNAME:"kostiantyn.petrenko",USERPROFILE:"C:\\Users\\kostiantyn.petrenko",windir:"C:\\windows",ZES_ENABLE_SYSMAN:"1"})return;const e={ALLUSERSPROFILE:"C:\\ProgramData",ANDROID_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk",ANDROID_SDK_ROOT:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk",APPDATA:"C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming","asl.log":"Destination=file",CommonProgramFiles:"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files",CommonProgramW6432:"C:\\Program Files\\Common Files",COMPUTERNAME:"W23005",ComSpec:"C:\\windows\\system32\\cmd.exe",DriverData:"C:\\Windows\\System32\\Drivers\\DriverData",EFC_35152:"0",FPS_BROWSER_APP_PROFILE_STRING:"Internet Explorer",FPS_BROWSER_USER_PROFILE_STRING:"Default",HOME:"C:\\Users\\kostiantyn.petrenko",HOMEDRIVE:"C:",HOMEPATH:"\\Users\\kostiantyn.petrenko",IGCCSVC_DB:"AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAABzAPW+8cckC+AVlpiF6BiQQAAAACAAAAAAAQZgAAAAEAACAAAABtATYUVfnerbyC/jse8VmjR2PTkJ76psslt4jbzW0F5gAAAAAOgAAAAAIAACAAAACWVl7cQH8WgqfTCR9PIbDobz4HPZVFM/IO4Rh+F/zjvGAAAABy6Do7/5za8vHrXtoB8PQ7yjZfrcPTHvG0qGkDOdwaYqOFqVaLZ64EuN/pqQ5hFZ+rKwMV/rOPBCtMk6NDo43YWjXkjKNjtjg7xA+/oexS1Z67+c4GP60zU0x9//iGcvZAAAAAFaoYpREoxIHPW57M5ygt1OUtOVto62caJYHuz+D90cgurwVnU4TlPThXDn7czfCn80teoOHGBD4Uh2QomuugbQ==",INIT_CWD:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2",JAVA_HOME:"C:\\Program Files\\Java\\jdk-17",LOCALAPPDATA:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local",LOGONSERVER:"\\\\W23005",NODE:"C:\\Program Files\\nodejs\\node.exe",NODE_ENV:"production",NODE_PATH:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules\\webpack\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules\\webpack\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\node_modules",npm_command:"run-script",npm_config_frozen_lockfile:"",npm_config_node_gyp:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node_modules\\node-gyp\\bin\\node-gyp.js",npm_config_recursive:"true",npm_config_registry:"https://registry.npmjs.org/",npm_config_user_agent:"pnpm/8.10.4 npm/? node/v18.20.2 win32 x64",npm_execpath:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\pnpm.cjs",npm_lifecycle_event:"build",npm_lifecycle_script:"webpack --mode=production --node-env=production && tsc --build --force ./tsconfig.build.json && resolve-tspaths -p ./tsconfig.build.json",npm_node_execpath:"C:\\Program Files\\nodejs\\node.exe",npm_package_author:"SSA Group",npm_package_browserslist_0:">0.1%",npm_package_browserslist_1:"not dead",npm_package_browserslist_2:"not op_mini all",npm_package_dependencies_dompurify:"^3.1.7",npm_package_dependencies_dotenv:"^16.0.3",npm_package_dependencies_js_cookie:"^3.0.5",npm_package_dependencies_js_tokens:"^4.0.0",npm_package_dependencies_loose_envify:"^1.4.0",npm_package_dependencies_luxon:"^3.5.0",npm_package_dependencies_plotly_js:"^2.35.2",npm_package_dependencies_react_plotly_js:"^2.6.0",npm_package_dependencies_react_toastify:"^10.0.5",npm_package_dependencies_scheduler:"^0.23.0",npm_package_dependencies_usehooks_ts:"^3.1.0",npm_package_dependencies_uuid:"^9.0.0",npm_package_dependencies__emotion_core:"^11.0.0",npm_package_dependencies__emotion_css:"^11.11.2",npm_package_dependencies__emotion_react:"^11.11.1",npm_package_dependencies__emotion_styled:"^11.11.0",npm_package_dependencies__floating_ui_react:"0.25.4",npm_package_dependencies__nivo_colors:"0.84.0",npm_package_dependencies__ssa_ui_kit_core:"workspace:^",npm_package_dependencies__ssa_ui_kit_hooks:"workspace:^",npm_package_dependencies__ssa_ui_kit_utils:"workspace:^",npm_package_dependencies__ssa_ui_kit_widgets:"workspace:^",npm_package_description:"SSA UI Kit templates",npm_package_devDependencies_resolve_tspaths:"^0.8.16",npm_package_devDependencies_storybook_addon_pseudo_states:"^2.1.0",npm_package_devDependencies_terser_webpack_plugin:"^5.3.9",npm_package_devDependencies_webpack:"^5.85.0",npm_package_devDependencies__emotion_jest:"^11.11.0",npm_package_devDependencies__playwright_test:"^1.48.0",npm_package_devDependencies__testing_library_jest_dom:"^5.16.5",npm_package_devDependencies__types_dompurify:"^3.0.5",npm_package_devDependencies__types_js_cookie:"^3.0.6",npm_package_devDependencies__types_luxon:"^3.4.2",npm_package_devDependencies__types_react_plotly_js:"^2.6.3",npm_package_devDependencies__types_testing_library__jest_dom:"^5.14.6",npm_package_devDependencies__types_uuid:"^9.0.3",npm_package_keywords_0:"react",npm_package_keywords_1:"SSA UI Kit",npm_package_keywords_2:"ui",npm_package_license:"MIT",npm_package_main:"dist/index.js",npm_package_name:"@ssa-ui-kit/templates",npm_package_peerDependenciesMeta__types_react_optional:"true",npm_package_peerDependencies_react:"18.x",npm_package_peerDependencies_react_dom:"18.x",npm_package_peerDependencies_react_hook_form:"^7.46.1",npm_package_peerDependencies_react_router_dom:"6.x",npm_package_peerDependencies__emotion_core:"^11.0.0",npm_package_peerDependencies__emotion_css:"^11.11.0",npm_package_peerDependencies__emotion_react:"^11.11.1",npm_package_peerDependencies__emotion_styled:"^11.11.0",npm_package_peerDependencies__nivo_core:"^0.84.0",npm_package_peerDependencies__nivo_line:"^0.84.0",npm_package_peerDependencies__nivo_pie:"^0.84.0",npm_package_peerDependencies__nivo_scales:"^0.84.0",npm_package_private:"false",npm_package_repository_directory:"packages/templates",npm_package_repository_type:"git",npm_package_repository_url:"https://github.com/ssagroup/ui-kit.git",npm_package_scripts_build:"webpack --mode=production --node-env=production && tsc --build --force ./tsconfig.build.json && resolve-tspaths -p ./tsconfig.build.json",npm_package_scripts_sb_build:"storybook build",npm_package_scripts_sb_dev:"storybook dev -p 6008",npm_package_scripts_test:"jest -i --no-cache",npm_package_scripts_test_e2e:"pnpm exec playwright test --project=chromium",npm_package_scripts_test_e2e_debug:"pnpm exec playwright test --project=chromium --debug",npm_package_scripts_test_e2e_ui:"pnpm exec playwright test --project=chromium --ui",npm_package_scripts_ts_check:"tsc --noEmit -p ./tsconfig.json",npm_package_scripts_ts_check_build:"tsc -p ./tsconfig.build.json",npm_package_scripts_ts_show_config:"tsc --showConfig -p ./tsconfig.json",npm_package_scripts_ts_show_config_build:"tsc --showConfig -p ./tsconfig.build.json",npm_package_sideEffects:"false",npm_package_types:"dist/index.d.ts",npm_package_version:"1.0.10",NUMBER_OF_PROCESSORS:"20",NVM_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm",NVM_SYMLINK:"C:\\Program Files\\nodejs",OneDrive:"C:\\Users\\kostiantyn.petrenko\\OneDrive - SSA Group",OneDriveCommercial:"C:\\Users\\kostiantyn.petrenko\\OneDrive - SSA Group",OnlineServices:"Online Services",OS:"Windows_NT",Path:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\packages\\templates\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node-gyp-bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node-gyp-bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node-gyp-bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\Program Files\\Git\\cmd;C:\\Program Files\\HP\\HP One Agent;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk\\platform-tools;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk\\tools;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\jdk-11.0.2\\bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs",PATHEXT:".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JSE;.WSF;.WSH;.MSC",platformcode:"M8",PNPM_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm",PNPM_SCRIPT_SRC_DIR:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\packages\\templates",PROCESSOR_ARCHITECTURE:"AMD64",PROCESSOR_IDENTIFIER:"Intel64 Family 6 Model 154 Stepping 3, GenuineIntel",PROCESSOR_LEVEL:"6",PROCESSOR_REVISION:"9a03",ProgramData:"C:\\ProgramData",ProgramFiles:"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)",ProgramW6432:"C:\\Program Files",PROMPT:"$P$G",PSModulePath:"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\windows\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files\\Microsoft Monitoring Agent\\Agent\\PowerShell\\",PUBLIC:"C:\\Users\\Public",RegionCode:"NA",SESSIONNAME:"Console",SystemDrive:"C:",SystemRoot:"C:\\windows",TEMP:"C:\\Users\\KOSTIA~1.PET\\AppData\\Local\\Temp",TMP:"C:\\Users\\KOSTIA~1.PET\\AppData\\Local\\Temp",USERDNSDOMAIN:"SSA-Outsourcing.com",USERDOMAIN:"SSA",USERDOMAIN_ROAMINGPROFILE:"SSA",USERNAME:"kostiantyn.petrenko",USERPROFILE:"C:\\Users\\kostiantyn.petrenko",windir:"C:\\windows",ZES_ENABLE_SYSMAN:"1"}.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&a(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},l=e=>{const t=(e=>{var t,n;return null===(n=null===(t=u())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]})(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const s=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),s]:[t.substring(0,n),s]},h=()=>{var e;return null===(e=u())||void 0===e?void 0:e.config};class d{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),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}function p(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",s=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const r=Object.assign({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:{}}},e);return[o(JSON.stringify({alg:"none",type:"JWT"})),o(JSON.stringify(r)),""].join(".")}function f(){try{return"object"==typeof indexedDB}catch(e){return!1}}function m(){return new Promise(((e,t)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(s);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(s),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))}class g extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,g.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,y.prototype.create)}}class y{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],r=i?function(e,t){return e.replace(_,((e,n)=>{const s=t[n];return null!=s?String(s):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${r} (${s}).`;return new g(s,o,n)}}const _=/\{\$([^}]+)}/g;function v(e,t){if(e===t)return!0;const n=Object.keys(e),s=Object.keys(t);for(const i of n){if(!s.includes(i))return!1;const n=e[i],r=t[i];if(w(n)&&w(r)){if(!v(n,r))return!1}else if(n!==r)return!1}for(const e of s)if(!n.includes(e))return!1;return!0}function w(e){return null!==e&&"object"==typeof e}function E(e){return e&&e._delegate?e._delegate:e}},727:function(e,t,n){n.d(t,{Jn:function(){return F},qX:function(){return L},Xd:function(){return O},Mq:function(){return V},C6:function(){return j},ZF:function(){return U},KN:function(){return B}});var s=n(571),i=n(264),r=n(258);const o=(e,t)=>t.some((t=>e instanceof t));let a,c;const u=new WeakMap,l=new WeakMap,h=new WeakMap,d=new WeakMap,p=new WeakMap;let f={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return l.get(e);if("objectStoreNames"===t)return e.objectStoreNames||h.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return y(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function m(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(c||(c=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(_(this),t),y(u.get(this))}:function(...t){return y(e.apply(_(this),t))}:function(t,...n){const s=e.call(_(this),t,...n);return h.set(s,t.sort?t.sort():[t]),y(s)}}function g(e){return"function"==typeof e?m(e):(e instanceof IDBTransaction&&function(e){if(l.has(e))return;const t=new Promise(((t,n)=>{const s=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",r),e.removeEventListener("abort",r)},i=()=>{t(),s()},r=()=>{n(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",i),e.addEventListener("error",r),e.addEventListener("abort",r)}));l.set(e,t)}(e),o(e,a||(a=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,f):e)}function y(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const s=()=>{e.removeEventListener("success",i),e.removeEventListener("error",r)},i=()=>{t(y(e.result)),s()},r=()=>{n(e.error),s()};e.addEventListener("success",i),e.addEventListener("error",r)}));return t.then((t=>{t instanceof IDBCursor&&u.set(t,e)})).catch((()=>{})),p.set(t,e),t}(e);if(d.has(e))return d.get(e);const t=g(e);return t!==e&&(d.set(e,t),p.set(t,e)),t}const _=e=>p.get(e);const v=["get","getKey","getAll","getAllKeys","count"],w=["put","add","delete","clear"],E=new Map;function b(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(E.get(t))return E.get(t);const n=t.replace(/FromIndex$/,""),s=t!==n,i=w.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!i&&!v.includes(n))return;const r=async function(e,...t){const r=this.transaction(e,i?"readwrite":"readonly");let o=r.store;return s&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&r.done]))[0]};return E.set(t,r),r}f=(e=>({...e,get:(t,n,s)=>b(t,n)||e.get(t,n,s),has:(t,n)=>!!b(t,n)||e.has(t,n)}))(f);class k{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const C="@firebase/app",A="0.9.11",S=new i.Yd("@firebase/app"),T="[DEFAULT]",I={[C]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},D=new Map,N=new Map;function R(e,t){try{e.container.addComponent(t)}catch(n){S.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function O(e){const t=e.name;if(N.has(t))return S.debug(`There were multiple attempts to register component ${t}.`),!1;N.set(t,e);for(const t of D.values())R(t,e);return!0}function L(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}const P={"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","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."},M=new r.LL("app","Firebase",P);class x{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new s.wA("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 M.create("app-deleted",{appName:this._name})}}const F="9.22.1";function U(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const i=Object.assign({name:T,automaticDataCollectionEnabled:!1},t),o=i.name;if("string"!=typeof o||!o)throw M.create("bad-app-name",{appName:String(o)});if(n||(n=(0,r.aH)()),!n)throw M.create("no-options");const a=D.get(o);if(a){if((0,r.vZ)(n,a.options)&&(0,r.vZ)(i,a.config))return a;throw M.create("duplicate-app",{appName:o})}const c=new s.H0(o);for(const e of N.values())c.addComponent(e);const u=new x(n,i,c);return D.set(o,u),u}function V(e=T){const t=D.get(e);if(!t&&e===T&&(0,r.aH)())return U();if(!t)throw M.create("no-app",{appName:e});return t}function j(){return Array.from(D.values())}function B(e,t,n){var i;let r=null!==(i=I[e])&&void 0!==i?i:e;n&&(r+=`-${n}`);const o=r.match(/\s|\//),a=t.match(/\s|\//);if(o||a){const e=[`Unable to register library "${r}" with version "${t}":`];return o&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),o&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void S.warn(e.join(" "))}O(new s.wA(`${r}-version`,(()=>({library:r,version:t})),"VERSION"))}const q="firebase-heartbeat-database",$=1,z="firebase-heartbeat-store";let H=null;function G(){return H||(H=function(e,t,{blocked:n,upgrade:s,blocking:i,terminated:r}={}){const o=indexedDB.open(e,t),a=y(o);return s&&o.addEventListener("upgradeneeded",(e=>{s(y(o.result),e.oldVersion,e.newVersion,y(o.transaction),e)})),n&&o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),a.then((e=>{r&&e.addEventListener("close",(()=>r())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),a}(q,$,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(z)}}).catch((e=>{throw M.create("idb-open",{originalErrorMessage:e.message})}))),H}async function K(e,t){try{const n=(await G()).transaction(z,"readwrite"),s=n.objectStore(z);await s.put(t,W(e)),await n.done}catch(e){if(e instanceof r.ZR)S.warn(e.message);else{const t=M.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});S.warn(t.message)}}}function W(e){return`${e.name}!${e.options.appId}`}class Q{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new X(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=Y();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==t&&!this._heartbeatsCache.heartbeats.some((e=>e.date===t)))return this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const e=Y(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){const n=[];let s=e.slice();for(const i of e){const e=n.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),J(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),J(n)>t){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}(this._heartbeatsCache.heartbeats),s=(0,r.L)(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}}function Y(){return(new Date).toISOString().substring(0,10)}class X{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,r.hl)()&&(0,r.eu)().then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){return await async function(e){try{const t=await G();return await t.transaction(z).objectStore(z).get(W(e))}catch(e){if(e instanceof r.ZR)S.warn(e.message);else{const t=M.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});S.warn(t.message)}}}(this.app)||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return K(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return K(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function J(e){return(0,r.L)(JSON.stringify({version:2,heartbeats:e})).length}var Z;Z="",O(new s.wA("platform-logger",(e=>new k(e)),"PRIVATE")),O(new s.wA("heartbeat",(e=>new Q(e)),"PRIVATE")),B(C,A,Z),B(C,A,"esm2017"),B("fire-js","")},571:function(e,t,n){n.d(t,{H0:function(){return a},wA:function(){return i}});var s=n(258);class i{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 r="[DEFAULT]";class o{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 e=new s.BH;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),s=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(s)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(s)return null;throw e}}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(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:r})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=r){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((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(e=r){return this.instances.has(e)}getOptions(e=r){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[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(s)}return s}onInit(e,t){var n;const s=this.normalizeInstanceIdentifier(t),i=null!==(n=this.onInitCallbacks.get(s))&&void 0!==n?n:new Set;i.add(e),this.onInitCallbacks.set(s,i);const r=this.instances.get(s);return r&&e(r,s),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const s of n)try{s(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(s=e,s===r?void 0:s),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(e){}var s;return n||null}normalizeInstanceIdentifier(e=r){return this.component?this.component.multipleInstances?e:r:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class a{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 o(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}},264:function(e,t,n){n.d(t,{Yd:function(){return u},in:function(){return i}});const s=[];var i;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(i||(i={}));const r={debug:i.DEBUG,verbose:i.VERBOSE,info:i.INFO,warn:i.WARN,error:i.ERROR,silent:i.SILENT},o=i.INFO,a={[i.DEBUG]:"log",[i.VERBOSE]:"log",[i.INFO]:"info",[i.WARN]:"warn",[i.ERROR]:"error"},c=(e,t,...n)=>{if(t<e.logLevel)return;const s=(new Date).toISOString(),i=a[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${s}] ${e.name}:`,...n)};class u{constructor(e){this.name=e,this._logLevel=o,this._logHandler=c,this._userLogHandler=null,s.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in i))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?r[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,i.DEBUG,...e),this._logHandler(this,i.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,i.VERBOSE,...e),this._logHandler(this,i.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,i.INFO,...e),this._logHandler(this,i.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,i.WARN,...e),this._logHandler(this,i.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,i.ERROR,...e),this._logHandler(this,i.ERROR,...e)}}},968:function(e,t,n){n.d(t,{C6:function(){return s.C6},Mq:function(){return s.Mq},ZF:function(){return s.ZF}});var s=n(727);(0,s.KN)("firebase","9.22.1","app")},18:function(e,t,n){n.d(t,{hJ:function(){return el},JU:function(){return tl},QT:function(){return Hl},PL:function(){return Kl},ad:function(){return il},Xo:function(){return Pl},IO:function(){return Nl}});var s,i=n(727),r=n(571),o=n(264),a=n(258),c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},u={},l=l||{},h=c||self;function d(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function p(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}var f="closure_uid_"+(1e9*Math.random()>>>0),m=0;function g(e,t,n){return e.call.apply(e.bind,arguments)}function y(e,t,n){if(!e)throw Error();if(2<arguments.length){var s=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,s),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function _(e,t,n){return(_=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?g:y).apply(null,arguments)}function v(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function w(e,t){function n(){}n.prototype=t.prototype,e.$=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.ac=function(e,n,s){for(var i=Array(arguments.length-2),r=2;r<arguments.length;r++)i[r-2]=arguments[r];return t.prototype[n].apply(e,i)}}function E(){this.s=this.s,this.o=this.o}E.prototype.s=!1,E.prototype.sa=function(){var e;!this.s&&(this.s=!0,this.N(),0)&&(e=this,Object.prototype.hasOwnProperty.call(e,f)&&e[f]||(e[f]=++m))},E.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};const b=Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t,void 0)}:function(e,t){if("string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.indexOf(t,0);for(let n=0;n<e.length;n++)if(n in e&&e[n]===t)return n;return-1};function k(e){const t=e.length;if(0<t){const n=Array(t);for(let s=0;s<t;s++)n[s]=e[s];return n}return[]}function C(e,t){for(let t=1;t<arguments.length;t++){const n=arguments[t];if(d(n)){const t=e.length||0,s=n.length||0;e.length=t+s;for(let i=0;i<s;i++)e[t+i]=n[i]}else e.push(n)}}function A(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}A.prototype.h=function(){this.defaultPrevented=!0};var S=function(){if(!h.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{h.addEventListener("test",(()=>{}),t),h.removeEventListener("test",(()=>{}),t)}catch(e){}return e}();function T(e){return/^[\s\xa0]*$/.test(e)}function I(){var e=h.navigator;return e&&(e=e.userAgent)?e:""}function D(e){return-1!=I().indexOf(e)}function N(e){return N[" "](e),e}N[" "]=function(){};var R,O,L,P=D("Opera"),M=D("Trident")||D("MSIE"),x=D("Edge"),F=x||M,U=D("Gecko")&&!(-1!=I().toLowerCase().indexOf("webkit")&&!D("Edge"))&&!(D("Trident")||D("MSIE"))&&!D("Edge"),V=-1!=I().toLowerCase().indexOf("webkit")&&!D("Edge");function j(){var e=h.document;return e?e.documentMode:void 0}e:{var B="",q=(O=I(),U?/rv:([^\);]+)(\)|;)/.exec(O):x?/Edge\/([\d\.]+)/.exec(O):M?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(O):V?/WebKit\/(\S+)/.exec(O):P?/(?:Version)[ \/]?(\S+)/.exec(O):void 0);if(q&&(B=q?q[1]:""),M){var $=j();if(null!=$&&$>parseFloat(B)){R=String($);break e}}R=B}if(h.document&&M){var z=j();L=z||(parseInt(R,10)||void 0)}else L=void 0;var H=L;function G(e,t){if(A.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,s=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(U){e:{try{N(t.nodeName);var i=!0;break e}catch(e){}i=!1}i||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,s?(this.clientX=void 0!==s.clientX?s.clientX:s.pageX,this.clientY=void 0!==s.clientY?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:K[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&G.$.h.call(this)}}w(G,A);var K={2:"touch",3:"pen",4:"mouse"};G.prototype.h=function(){G.$.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var W="closure_listenable_"+(1e6*Math.random()|0),Q=0;function Y(e,t,n,s,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!s,this.la=i,this.key=++Q,this.fa=this.ia=!1}function X(e){e.fa=!0,e.listener=null,e.proxy=null,e.src=null,e.la=null}function J(e,t,n){for(const s in e)t.call(n,e[s],s,e)}function Z(e){const t={};for(const n in e)t[n]=e[n];return t}const ee="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function te(e,t){let n,s;for(let t=1;t<arguments.length;t++){for(n in s=arguments[t],s)e[n]=s[n];for(let t=0;t<ee.length;t++)n=ee[t],Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}}function ne(e){this.src=e,this.g={},this.h=0}function se(e,t){var n=t.type;if(n in e.g){var s,i=e.g[n],r=b(i,t);(s=0<=r)&&Array.prototype.splice.call(i,r,1),s&&(X(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function ie(e,t,n,s){for(var i=0;i<e.length;++i){var r=e[i];if(!r.fa&&r.listener==t&&r.capture==!!n&&r.la==s)return i}return-1}ne.prototype.add=function(e,t,n,s,i){var r=e.toString();(e=this.g[r])||(e=this.g[r]=[],this.h++);var o=ie(e,t,s,i);return-1<o?(t=e[o],n||(t.ia=!1)):((t=new Y(t,this.src,r,!!s,i)).ia=n,e.push(t)),t};var re="closure_lm_"+(1e6*Math.random()|0),oe={};function ae(e,t,n,s,i){if(s&&s.once)return ue(e,t,n,s,i);if(Array.isArray(t)){for(var r=0;r<t.length;r++)ae(e,t[r],n,s,i);return null}return n=ge(n),e&&e[W]?e.O(t,n,p(s)?!!s.capture:!!s,i):ce(e,t,n,!1,s,i)}function ce(e,t,n,s,i,r){if(!t)throw Error("Invalid event type");var o=p(i)?!!i.capture:!!i,a=fe(e);if(a||(e[re]=a=new ne(e)),(n=a.add(t,n,s,o,r)).proxy)return n;if(s=function(){function e(n){return t.call(e.src,e.listener,n)}const t=pe;return e}(),n.proxy=s,s.src=e,s.listener=n,e.addEventListener)S||(i=o),void 0===i&&(i=!1),e.addEventListener(t.toString(),s,i);else if(e.attachEvent)e.attachEvent(de(t.toString()),s);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(s)}return n}function ue(e,t,n,s,i){if(Array.isArray(t)){for(var r=0;r<t.length;r++)ue(e,t[r],n,s,i);return null}return n=ge(n),e&&e[W]?e.P(t,n,p(s)?!!s.capture:!!s,i):ce(e,t,n,!0,s,i)}function le(e,t,n,s,i){if(Array.isArray(t))for(var r=0;r<t.length;r++)le(e,t[r],n,s,i);else s=p(s)?!!s.capture:!!s,n=ge(n),e&&e[W]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=ie(r=e.g[t],n,s,i))&&(X(r[n]),Array.prototype.splice.call(r,n,1),0==r.length&&(delete e.g[t],e.h--)))):e&&(e=fe(e))&&(t=e.g[t.toString()],e=-1,t&&(e=ie(t,n,s,i)),(n=-1<e?t[e]:null)&&he(n))}function he(e){if("number"!=typeof e&&e&&!e.fa){var t=e.src;if(t&&t[W])se(t.i,e);else{var n=e.type,s=e.proxy;t.removeEventListener?t.removeEventListener(n,s,e.capture):t.detachEvent?t.detachEvent(de(n),s):t.addListener&&t.removeListener&&t.removeListener(s),(n=fe(t))?(se(n,e),0==n.h&&(n.src=null,t[re]=null)):X(e)}}}function de(e){return e in oe?oe[e]:oe[e]="on"+e}function pe(e,t){if(e.fa)e=!0;else{t=new G(t,this);var n=e.listener,s=e.la||e.src;e.ia&&he(e),e=n.call(s,t)}return e}function fe(e){return(e=e[re])instanceof ne?e:null}var me="__closure_events_fn_"+(1e9*Math.random()>>>0);function ge(e){return"function"==typeof e?e:(e[me]||(e[me]=function(t){return e.handleEvent(t)}),e[me])}function ye(){E.call(this),this.i=new ne(this),this.S=this,this.J=null}function _e(e,t){var n,s=e.J;if(s)for(n=[];s;s=s.J)n.push(s);if(e=e.S,s=t.type||t,"string"==typeof t)t=new A(t,e);else if(t instanceof A)t.target=t.target||e;else{var i=t;te(t=new A(s,e),i)}if(i=!0,n)for(var r=n.length-1;0<=r;r--){var o=t.g=n[r];i=ve(o,s,!0,t)&&i}if(i=ve(o=t.g=e,s,!0,t)&&i,i=ve(o,s,!1,t)&&i,n)for(r=0;r<n.length;r++)i=ve(o=t.g=n[r],s,!1,t)&&i}function ve(e,t,n,s){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var i=!0,r=0;r<t.length;++r){var o=t[r];if(o&&!o.fa&&o.capture==n){var a=o.listener,c=o.la||o.src;o.ia&&se(e.i,o),i=!1!==a.call(c,s)&&i}}return i&&!s.defaultPrevented}w(ye,E),ye.prototype[W]=!0,ye.prototype.removeEventListener=function(e,t,n,s){le(this,e,t,n,s)},ye.prototype.N=function(){if(ye.$.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],s=0;s<n.length;s++)X(n[s]);delete t.g[e],t.h--}}this.J=null},ye.prototype.O=function(e,t,n,s){return this.i.add(String(e),t,!1,n,s)},ye.prototype.P=function(e,t,n,s){return this.i.add(String(e),t,!0,n,s)};var we=h.JSON.stringify;function Ee(){var e=Ie;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var be=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}((()=>new ke),(e=>e.reset()));class ke{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}function Ce(e){var t=1;e=e.split(":");const n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function Ae(e){h.setTimeout((()=>{throw e}),0)}let Se,Te=!1,Ie=new class{constructor(){this.h=this.g=null}add(e,t){const n=be.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},De=()=>{const e=h.Promise.resolve(void 0);Se=()=>{e.then(Ne)}};var Ne=()=>{for(var e;e=Ee();){try{e.h.call(e.g)}catch(e){Ae(e)}var t=be;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}Te=!1};function Re(e,t){ye.call(this),this.h=e||1,this.g=t||h,this.j=_(this.qb,this),this.l=Date.now()}function Oe(e){e.ga=!1,e.T&&(e.g.clearTimeout(e.T),e.T=null)}function Le(e,t,n){if("function"==typeof e)n&&(e=_(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=_(e.handleEvent,e)}return 2147483647<Number(t)?-1:h.setTimeout(e,t||0)}function Pe(e){e.g=Le((()=>{e.g=null,e.i&&(e.i=!1,Pe(e))}),e.j);const t=e.h;e.h=null,e.m.apply(null,t)}w(Re,ye),(s=Re.prototype).ga=!1,s.T=null,s.qb=function(){if(this.ga){var e=Date.now()-this.l;0<e&&e<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-e):(this.T&&(this.g.clearTimeout(this.T),this.T=null),_e(this,"tick"),this.ga&&(Oe(this),this.start()))}},s.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())},s.N=function(){Re.$.N.call(this),Oe(this),delete this.g};class Me extends E{constructor(e,t){super(),this.m=e,this.j=t,this.h=null,this.i=!1,this.g=null}l(e){this.h=arguments,this.g?this.i=!0:Pe(this)}N(){super.N(),this.g&&(h.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function xe(e){E.call(this),this.h=e,this.g={}}w(xe,E);var Fe=[];function Ue(e,t,n,s){Array.isArray(n)||(n&&(Fe[0]=n.toString()),n=Fe);for(var i=0;i<n.length;i++){var r=ae(t,n[i],s||e.handleEvent,!1,e.h||e);if(!r)break;e.g[r.key]=r}}function Ve(e){J(e.g,(function(e,t){this.g.hasOwnProperty(t)&&he(e)}),e),e.g={}}function je(){this.g=!0}function Be(e,t,n,s){e.info((function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n)for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var s=n[e];if(!(2>s.length)){var i=s[1];if(Array.isArray(i)&&!(1>i.length)){var r=i[0];if("noop"!=r&&"stop"!=r&&"close"!=r)for(var o=1;o<i.length;o++)i[o]=""}}}return we(n)}catch(e){return t}}(e,n)+(s?" "+s:"")}))}xe.prototype.N=function(){xe.$.N.call(this),Ve(this)},xe.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},je.prototype.Ea=function(){this.g=!1},je.prototype.info=function(){};var qe={},$e=null;function ze(){return $e=$e||new ye}function He(e){A.call(this,qe.Ta,e)}function Ge(e){const t=ze();_e(t,new He(t))}function Ke(e,t){A.call(this,qe.STAT_EVENT,e),this.stat=t}function We(e){const t=ze();_e(t,new Ke(t,e))}function Qe(e,t){A.call(this,qe.Ua,e),this.size=t}function Ye(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return h.setTimeout((function(){e()}),t)}qe.Ta="serverreachability",w(He,A),qe.STAT_EVENT="statevent",w(Ke,A),qe.Ua="timingevent",w(Qe,A);var Xe={NO_ERROR:0,rb:1,Eb:2,Db:3,yb:4,Cb:5,Fb:6,Qa:7,TIMEOUT:8,Ib:9},Je={wb:"complete",Sb:"success",Ra:"error",Qa:"abort",Kb:"ready",Lb:"readystatechange",TIMEOUT:"timeout",Gb:"incrementaldata",Jb:"progress",zb:"downloadprogress",$b:"uploadprogress"};function Ze(){}function et(e){return e.h||(e.h=e.i())}function tt(){}Ze.prototype.h=null;var nt,st={OPEN:"a",vb:"b",Ra:"c",Hb:"d"};function it(){A.call(this,"d")}function rt(){A.call(this,"c")}function ot(){}function at(e,t,n,s){this.l=e,this.j=t,this.m=n,this.W=s||1,this.U=new xe(this),this.P=ut,e=F?125:void 0,this.V=new Re(e),this.I=null,this.i=!1,this.s=this.A=this.v=this.L=this.G=this.Y=this.B=null,this.F=[],this.g=null,this.C=0,this.o=this.u=null,this.ca=-1,this.J=!1,this.O=0,this.M=null,this.ba=this.K=this.aa=this.S=!1,this.h=new ct}function ct(){this.i=null,this.g="",this.h=!1}w(it,A),w(rt,A),w(ot,Ze),ot.prototype.g=function(){return new XMLHttpRequest},ot.prototype.i=function(){return{}},nt=new ot;var ut=45e3,lt={},ht={};function dt(e,t,n){e.L=1,e.v=Rt(St(t)),e.s=n,e.S=!0,pt(e,null)}function pt(e,t){e.G=Date.now(),yt(e),e.A=St(e.v);var n=e.A,s=e.W;Array.isArray(s)||(s=[String(s)]),zt(n.i,"t",s),e.C=0,n=e.l.J,e.h=new ct,e.g=zn(e.l,n?t:null,!e.s),0<e.O&&(e.M=new Me(_(e.Pa,e,e.g),e.O)),Ue(e.U,e.g,"readystatechange",e.nb),t=e.I?Z(e.I):{},e.s?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ha(e.A,e.u,e.s,t)):(e.u="GET",e.g.ha(e.A,e.u,null,t)),Ge(),function(e,t,n,s,i,r){e.info((function(){if(e.g)if(r)for(var o="",a=r.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var l=u[0];u=u[1];var h=l.split("_");o=2<=h.length&&"type"==h[1]?o+(l+"=")+u+"&":o+(l+"=redacted&")}}else o=null;else o=r;return"XMLHTTP REQ ("+s+") [attempt "+i+"]: "+t+"\n"+n+"\n"+o}))}(e.j,e.u,e.A,e.m,e.W,e.s)}function ft(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.l.Ha)}function mt(e,t,n){let s,i=!0;for(;!e.J&&e.C<n.length;){if(s=gt(e,n),s==ht){4==t&&(e.o=4,We(14),i=!1),Be(e.j,e.m,null,"[Incomplete Response]");break}if(s==lt){e.o=4,We(15),Be(e.j,e.m,n,"[Invalid Chunk]"),i=!1;break}Be(e.j,e.m,s,null),bt(e,s)}ft(e)&&s!=ht&&s!=lt&&(e.h.g="",e.C=0),4!=t||0!=n.length||e.h.h||(e.o=1,We(16),i=!1),e.i=e.i&&i,i?0<n.length&&!e.ba&&(e.ba=!0,(t=e.l).g==e&&t.ca&&!t.M&&(t.l.info("Great, no buffering proxy detected. Bytes received: "+n.length),xn(t),t.M=!0,We(11))):(Be(e.j,e.m,n,"[Invalid Chunked Response]"),Et(e),wt(e))}function gt(e,t){var n=e.C,s=t.indexOf("\n",n);return-1==s?ht:(n=Number(t.substring(n,s)),isNaN(n)?lt:(s+=1)+n>t.length?ht:(t=t.slice(s,s+n),e.C=s+n,t))}function yt(e){e.Y=Date.now()+e.P,_t(e,e.P)}function _t(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Ye(_(e.lb,e),t)}function vt(e){e.B&&(h.clearTimeout(e.B),e.B=null)}function wt(e){0==e.l.H||e.J||Vn(e.l,e)}function Et(e){vt(e);var t=e.M;t&&"function"==typeof t.sa&&t.sa(),e.M=null,Oe(e.V),Ve(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.sa())}function bt(e,t){try{var n=e.l;if(0!=n.H&&(n.g==e||Yt(n.i,e)))if(!e.K&&Yt(n.i,e)&&3==n.H){try{var s=n.Ja.g.parse(t)}catch(e){s=null}if(Array.isArray(s)&&3==s.length){var i=s;if(0==i[0]){e:if(!n.u){if(n.g){if(!(n.g.G+3e3<e.G))break e;Un(n),In(n)}Mn(n),We(18)}}else n.Fa=i[1],0<n.Fa-n.V&&37500>i[2]&&n.G&&0==n.A&&!n.v&&(n.v=Ye(_(n.ib,n),6e3));if(1>=Qt(n.i)&&n.oa){try{n.oa()}catch(e){}n.oa=void 0}}else Bn(n,11)}else if((e.K||n.g==e)&&Un(n),!T(t))for(i=n.Ja.g.parse(t),t=0;t<i.length;t++){let u=i[t];if(n.V=u[0],u=u[1],2==n.H)if("c"==u[0]){n.K=u[1],n.pa=u[2];const t=u[3];null!=t&&(n.ra=t,n.l.info("VER="+n.ra));const i=u[4];null!=i&&(n.Ga=i,n.l.info("SVER="+n.Ga));const l=u[5];null!=l&&"number"==typeof l&&0<l&&(s=1.5*l,n.L=s,n.l.info("backChannelRequestTimeoutMs_="+s)),s=n;const h=e.g;if(h){const e=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var r=s.i;r.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(r.j=r.l,r.g=new Set,r.h&&(Xt(r,r.h),r.h=null))}if(s.F){const e=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(s.Da=e,Nt(s.I,s.F,e))}}n.H=3,n.h&&n.h.Ba(),n.ca&&(n.S=Date.now()-e.G,n.l.info("Handshake RTT: "+n.S+"ms"));var o=e;if((s=n).wa=$n(s,s.J?s.pa:null,s.Y),o.K){Jt(s.i,o);var a=o,c=s.L;c&&a.setTimeout(c),a.B&&(vt(a),yt(a)),s.g=o}else Pn(s);0<n.j.length&&Nn(n)}else"stop"!=u[0]&&"close"!=u[0]||Bn(n,7);else 3==n.H&&("stop"==u[0]||"close"==u[0]?"stop"==u[0]?Bn(n,7):Tn(n):"noop"!=u[0]&&n.h&&n.h.Aa(u),n.A=0)}Ge()}catch(e){}}function kt(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(d(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.ta&&"function"==typeof e.ta)return e.ta();if(!e.Z||"function"!=typeof e.Z){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(d(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}t=[],n=0;for(const s in e)t[n++]=s;return t}}}(e),s=function(e){if(e.Z&&"function"==typeof e.Z)return e.Z();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");if(d(e)){for(var t=[],n=e.length,s=0;s<n;s++)t.push(e[s]);return t}for(s in t=[],n=0,e)t[n++]=e[s];return t}(e),i=s.length,r=0;r<i;r++)t.call(void 0,s[r],n&&n[r],e)}(s=at.prototype).setTimeout=function(e){this.P=e},s.nb=function(e){e=e.target;const t=this.M;t&&3==En(e)?t.l():this.Pa(e)},s.Pa=function(e){try{if(e==this.g)e:{const l=En(this.g);var t=this.g.Ia();this.g.da();if(!(3>l)&&(3!=l||F||this.g&&(this.h.h||this.g.ja()||bn(this.g)))){this.J||4!=l||7==t||Ge(),vt(this);var n=this.g.da();this.ca=n;t:if(ft(this)){var s=bn(this.g);e="";var i=s.length,r=4==En(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Et(this),wt(this);var o="";break t}this.h.i=new h.TextDecoder}for(t=0;t<i;t++)this.h.h=!0,e+=this.h.i.decode(s[t],{stream:r&&t==i-1});s.splice(0,i),this.h.g+=e,this.C=0,o=this.h.g}else o=this.g.ja();if(this.i=200==n,function(e,t,n,s,i,r,o){e.info((function(){return"XMLHTTP RESP ("+s+") [ attempt "+i+"]: "+t+"\n"+n+"\n"+r+" "+o}))}(this.j,this.u,this.A,this.m,this.W,l,n),this.i){if(this.aa&&!this.K){t:{if(this.g){var a,c=this.g;if((a=c.g?c.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!T(a)){var u=a;break t}}u=null}if(!(n=u)){this.i=!1,this.o=3,We(12),Et(this),wt(this);break e}Be(this.j,this.m,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,bt(this,n)}this.S?(mt(this,l,o),F&&this.i&&3==l&&(Ue(this.U,this.V,"tick",this.mb),this.V.start())):(Be(this.j,this.m,o,null),bt(this,o)),4==l&&Et(this),this.i&&!this.J&&(4==l?Vn(this.l,this):(this.i=!1,yt(this)))}else(function(e){const t={};e=(e.g&&2<=En(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let s=0;s<e.length;s++){if(T(e[s]))continue;var n=Ce(e[s]);const i=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const r=t[i]||[];t[i]=r,r.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,(function(e){return e.join(", ")}))})(this.g),400==n&&0<o.indexOf("Unknown SID")?(this.o=3,We(12)):(this.o=0,We(13)),Et(this),wt(this)}}}catch(e){}},s.mb=function(){if(this.g){var e=En(this.g),t=this.g.ja();this.C<t.length&&(vt(this),mt(this,e,t),this.i&&4!=e&&yt(this))}},s.cancel=function(){this.J=!0,Et(this)},s.lb=function(){this.B=null;const e=Date.now();0<=e-this.Y?(function(e,t){e.info((function(){return"TIMEOUT: "+t}))}(this.j,this.A),2!=this.L&&(Ge(),We(17)),Et(this),this.o=2,wt(this)):_t(this,this.Y-e)};var Ct=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function At(e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,e instanceof At){this.h=e.h,Tt(this,e.j),this.s=e.s,this.g=e.g,It(this,e.m),this.l=e.l;var t=e.i,n=new jt;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),Dt(this,n),this.o=e.o}else e&&(t=String(e).match(Ct))?(this.h=!1,Tt(this,t[1]||"",!0),this.s=Ot(t[2]||""),this.g=Ot(t[3]||"",!0),It(this,t[4]),this.l=Ot(t[5]||"",!0),Dt(this,t[6]||"",!0),this.o=Ot(t[7]||"")):(this.h=!1,this.i=new jt(null,this.h))}function St(e){return new At(e)}function Tt(e,t,n){e.j=n?Ot(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function It(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.m=t}else e.m=null}function Dt(e,t,n){t instanceof jt?(e.i=t,function(e,t){t&&!e.j&&(Bt(e),e.i=null,e.g.forEach((function(e,t){var n=t.toLowerCase();t!=n&&(qt(this,t),zt(this,n,e))}),e)),e.j=t}(e.i,e.h)):(n||(t=Lt(t,Ut)),e.i=new jt(t,e.h))}function Nt(e,t,n){e.i.set(t,n)}function Rt(e){return Nt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function Ot(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function Lt(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,Pt),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function Pt(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}At.prototype.toString=function(){var e=[],t=this.j;t&&e.push(Lt(t,Mt,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.s)&&e.push(Lt(t,Mt,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(Lt(n,"/"==n.charAt(0)?Ft:xt,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.o)&&e.push("#",Lt(n,Vt)),e.join("")};var Mt=/[#\/\?@]/g,xt=/[#\?:]/g,Ft=/[#\?]/g,Ut=/[#\?@]/g,Vt=/#/g;function jt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Bt(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var s=e[n].indexOf("="),i=null;if(0<=s){var r=e[n].substring(0,s);i=e[n].substring(s+1)}else r=e[n];t(r,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(e.i,(function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)})))}function qt(e,t){Bt(e),t=Ht(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function $t(e,t){return Bt(e),t=Ht(e,t),e.g.has(t)}function zt(e,t,n){qt(e,t),0<n.length&&(e.i=null,e.g.set(Ht(e,t),k(n)),e.h+=n.length)}function Ht(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}(s=jt.prototype).add=function(e,t){Bt(this),this.i=null,e=Ht(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},s.forEach=function(e,t){Bt(this),this.g.forEach((function(n,s){n.forEach((function(n){e.call(t,n,s,this)}),this)}),this)},s.ta=function(){Bt(this);const e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let s=0;s<t.length;s++){const i=e[s];for(let e=0;e<i.length;e++)n.push(t[s])}return n},s.Z=function(e){Bt(this);let t=[];if("string"==typeof e)$t(this,e)&&(t=t.concat(this.g.get(Ht(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},s.set=function(e,t){return Bt(this),this.i=null,$t(this,e=Ht(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},s.get=function(e,t){return e&&0<(e=this.Z(e)).length?String(e[0]):t},s.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var s=t[n];const r=encodeURIComponent(String(s)),o=this.Z(s);for(s=0;s<o.length;s++){var i=r;""!==o[s]&&(i+="="+encodeURIComponent(String(o[s]))),e.push(i)}}return this.i=e.join("&")};function Gt(e){this.l=e||Kt,h.PerformanceNavigationTiming?e=0<(e=h.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(h.g&&h.g.Ka&&h.g.Ka()&&h.g.Ka().ec),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var Kt=10;function Wt(e){return!!e.h||!!e.g&&e.g.size>=e.j}function Qt(e){return e.h?1:e.g?e.g.size:0}function Yt(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function Xt(e,t){e.g?e.g.add(t):e.h=t}function Jt(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function Zt(e){if(null!=e.h)return e.i.concat(e.h.F);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.F);return t}return k(e.i)}Gt.prototype.cancel=function(){if(this.i=Zt(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var en=class{stringify(e){return h.JSON.stringify(e,void 0)}parse(e){return h.JSON.parse(e,void 0)}};function tn(){this.g=new en}function nn(e,t,n){const s=n||"";try{kt(e,(function(e,n){let i=e;p(e)&&(i=we(e)),t.push(s+n+"="+encodeURIComponent(i))}))}catch(e){throw t.push(s+"type="+encodeURIComponent("_badmap")),e}}function sn(e,t,n,s,i){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,i(s)}catch(e){}}function rn(e){this.l=e.fc||null,this.j=e.ob||!1}function on(e,t){ye.call(this),this.F=e,this.u=t,this.m=void 0,this.readyState=an,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}w(rn,Ze),rn.prototype.g=function(){return new on(this.l,this.j)},rn.prototype.i=function(e){return function(){return e}}({}),w(on,ye);var an=0;function cn(e){e.j.read().then(e.Xa.bind(e)).catch(e.ka.bind(e))}function un(e){e.readyState=4,e.l=null,e.j=null,e.A=null,ln(e)}function ln(e){e.onreadystatechange&&e.onreadystatechange.call(e)}(s=on.prototype).open=function(e,t){if(this.readyState!=an)throw this.abort(),Error("Error reopening a connection");this.C=e,this.B=t,this.readyState=1,ln(this)},s.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.v,method:this.C,credentials:this.m,cache:void 0};e&&(t.body=e),(this.F||h).fetch(new Request(this.B,t)).then(this.$a.bind(this),this.ka.bind(this))},s.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((()=>{})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,un(this)),this.readyState=an},s.$a=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,ln(this)),this.g&&(this.readyState=3,ln(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(void 0!==h.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;cn(this)}else e.text().then(this.Za.bind(this),this.ka.bind(this))},s.Xa=function(e){if(this.g){if(this.u&&e.value)this.response.push(e.value);else if(!this.u){var t=e.value?e.value:new Uint8Array(0);(t=this.A.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?un(this):ln(this),3==this.readyState&&cn(this)}},s.Za=function(e){this.g&&(this.response=this.responseText=e,un(this))},s.Ya=function(e){this.g&&(this.response=e,un(this))},s.ka=function(){this.g&&un(this)},s.setRequestHeader=function(e,t){this.v.append(e,t)},s.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},s.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(on.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}});var hn=h.JSON.parse;function dn(e){ye.call(this),this.headers=new Map,this.u=e||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=pn,this.L=this.M=!1}w(dn,ye);var pn="",fn=/^https?$/i,mn=["POST","PUT"];function gn(e,t){e.h=!1,e.g&&(e.l=!0,e.g.abort(),e.l=!1),e.j=t,e.m=5,yn(e),vn(e)}function yn(e){e.F||(e.F=!0,_e(e,"complete"),_e(e,"error"))}function _n(e){if(e.h&&void 0!==l&&(!e.C[1]||4!=En(e)||2!=e.da()))if(e.v&&4==En(e))Le(e.La,0,e);else if(_e(e,"readystatechange"),4==En(e)){e.h=!1;try{const o=e.da();e:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var s;if(s=0===o){var i=String(e.I).match(Ct)[1]||null;!i&&h.self&&h.self.location&&(i=h.self.location.protocol.slice(0,-1)),s=!fn.test(i?i.toLowerCase():"")}n=s}if(n)_e(e,"complete"),_e(e,"success");else{e.m=6;try{var r=2<En(e)?e.g.statusText:""}catch(e){r=""}e.j=r+" ["+e.da()+"]",yn(e)}}finally{vn(e)}}}function vn(e,t){if(e.g){wn(e);const n=e.g,s=e.C[0]?()=>{}:null;e.g=null,e.C=null,t||_e(e,"ready");try{n.onreadystatechange=s}catch(e){}}}function wn(e){e.g&&e.L&&(e.g.ontimeout=null),e.A&&(h.clearTimeout(e.A),e.A=null)}function En(e){return e.g?e.g.readyState:0}function bn(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.K){case pn:case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function kn(e){let t="";return J(e,(function(e,n){t+=n,t+=":",t+=e,t+="\r\n"})),t}function Cn(e,t,n){e:{for(s in n){var s=!1;break e}s=!0}s||(n=kn(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):Nt(e,t,n))}function An(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function Sn(e){this.Ga=0,this.j=[],this.l=new je,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=An("failFast",!1,e),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=An("baseRetryDelayMs",5e3,e),this.hb=An("retryDelaySeedMs",1e4,e),this.eb=An("forwardChannelMaxRetries",2,e),this.xa=An("forwardChannelRequestTimeoutMs",2e4,e),this.va=e&&e.xmlHttpFactory||void 0,this.Ha=e&&e.dc||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.i=new Gt(e&&e.concurrentRequestLimit),this.Ja=new tn,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=e&&e.bc||!1,e&&e.Ea&&this.l.Ea(),e&&e.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&e&&e.detectBufferingProxy||!1,this.qa=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.qa=e.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}function Tn(e){if(Dn(e),3==e.H){var t=e.W++,n=St(e.I);if(Nt(n,"SID",e.K),Nt(n,"RID",t),Nt(n,"TYPE","terminate"),On(e,n),(t=new at(e,e.l,t)).L=2,t.v=Rt(St(n)),n=!1,h.navigator&&h.navigator.sendBeacon)try{n=h.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&h.Image&&((new Image).src=t.v,n=!0),n||(t.g=zn(t.l,null),t.g.ha(t.v)),t.G=Date.now(),yt(t)}qn(e)}function In(e){e.g&&(xn(e),e.g.cancel(),e.g=null)}function Dn(e){In(e),e.u&&(h.clearTimeout(e.u),e.u=null),Un(e),e.i.cancel(),e.m&&("number"==typeof e.m&&h.clearTimeout(e.m),e.m=null)}function Nn(e){if(!Wt(e.i)&&!e.m){e.m=!0;var t=e.Na;Se||De(),Te||(Se(),Te=!0),Ie.add(t,e),e.C=0}}function Rn(e,t){var n;n=t?t.m:e.W++;const s=St(e.I);Nt(s,"SID",e.K),Nt(s,"RID",n),Nt(s,"AID",e.V),On(e,s),e.o&&e.s&&Cn(s,e.o,e.s),n=new at(e,e.l,n,e.C+1),null===e.o&&(n.I=e.s),t&&(e.j=t.F.concat(e.j)),t=Ln(e,n,1e3),n.setTimeout(Math.round(.5*e.xa)+Math.round(.5*e.xa*Math.random())),Xt(e.i,n),dt(n,s,t)}function On(e,t){e.na&&J(e.na,(function(e,n){Nt(t,n,e)})),e.h&&kt({},(function(e,n){Nt(t,n,e)}))}function Ln(e,t,n){n=Math.min(e.j.length,n);var s=e.h?_(e.h.Va,e.h,e):null;e:{var i=e.j;let t=-1;for(;;){const e=["count="+n];-1==t?0<n?(t=i[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let r=!0;for(let o=0;o<n;o++){let n=i[o].g;const a=i[o].map;if(n-=t,0>n)t=Math.max(0,i[o].g-100),r=!1;else try{nn(a,e,"req"+n+"_")}catch(e){s&&s(a)}}if(r){s=e.join("&");break e}}}return e=e.j.splice(0,n),t.F=e,s}function Pn(e){if(!e.g&&!e.u){e.ba=1;var t=e.Ma;Se||De(),Te||(Se(),Te=!0),Ie.add(t,e),e.A=0}}function Mn(e){return!(e.g||e.u||3<=e.A)&&(e.ba++,e.u=Ye(_(e.Ma,e),jn(e,e.A)),e.A++,!0)}function xn(e){null!=e.B&&(h.clearTimeout(e.B),e.B=null)}function Fn(e){e.g=new at(e,e.l,"rpc",e.ba),null===e.o&&(e.g.I=e.s),e.g.O=0;var t=St(e.wa);Nt(t,"RID","rpc"),Nt(t,"SID",e.K),Nt(t,"AID",e.V),Nt(t,"CI",e.G?"0":"1"),!e.G&&e.qa&&Nt(t,"TO",e.qa),Nt(t,"TYPE","xmlhttp"),On(e,t),e.o&&e.s&&Cn(t,e.o,e.s),e.L&&e.g.setTimeout(e.L);var n=e.g;e=e.pa,n.L=1,n.v=Rt(St(t)),n.s=null,n.S=!0,pt(n,e)}function Un(e){null!=e.v&&(h.clearTimeout(e.v),e.v=null)}function Vn(e,t){var n=null;if(e.g==t){Un(e),xn(e),e.g=null;var s=2}else{if(!Yt(e.i,t))return;n=t.F,Jt(e.i,t),s=1}if(0!=e.H)if(t.i)if(1==s){n=t.s?t.s.length:0,t=Date.now()-t.G;var i=e.C;_e(s=ze(),new Qe(s,n)),Nn(e)}else Pn(e);else if(3==(i=t.o)||0==i&&0<t.ca||!(1==s&&function(e,t){return!(Qt(e.i)>=e.i.j-(e.m?1:0)||(e.m?(e.j=t.F.concat(e.j),0):1==e.H||2==e.H||e.C>=(e.cb?0:e.eb)||(e.m=Ye(_(e.Na,e,t),jn(e,e.C)),e.C++,0)))}(e,t)||2==s&&Mn(e)))switch(n&&0<n.length&&(t=e.i,t.i=t.i.concat(n)),i){case 1:Bn(e,5);break;case 4:Bn(e,10);break;case 3:Bn(e,6);break;default:Bn(e,2)}}function jn(e,t){let n=e.ab+Math.floor(Math.random()*e.hb);return e.isActive()||(n*=2),n*t}function Bn(e,t){if(e.l.info("Error code "+t),2==t){var n=null;e.h&&(n=null);var s=_(e.pb,e);n||(n=new At("//www.google.com/images/cleardot.gif"),h.location&&"http"==h.location.protocol||Tt(n,"https"),Rt(n)),function(e,t){const n=new je;if(h.Image){const s=new Image;s.onload=v(sn,n,s,"TestLoadImage: loaded",!0,t),s.onerror=v(sn,n,s,"TestLoadImage: error",!1,t),s.onabort=v(sn,n,s,"TestLoadImage: abort",!1,t),s.ontimeout=v(sn,n,s,"TestLoadImage: timeout",!1,t),h.setTimeout((function(){s.ontimeout&&s.ontimeout()}),1e4),s.src=e}else t(!1)}(n.toString(),s)}else We(2);e.H=0,e.h&&e.h.za(t),qn(e),Dn(e)}function qn(e){if(e.H=0,e.ma=[],e.h){const t=Zt(e.i);0==t.length&&0==e.j.length||(C(e.ma,t),C(e.ma,e.j),e.i.i.length=0,k(e.j),e.j.length=0),e.h.ya()}}function $n(e,t,n){var s=n instanceof At?St(n):new At(n);if(""!=s.g)t&&(s.g=t+"."+s.g),It(s,s.m);else{var i=h.location;s=i.protocol,t=t?t+"."+i.hostname:i.hostname,i=+i.port;var r=new At(null);s&&Tt(r,s),t&&(r.g=t),i&&It(r,i),n&&(r.l=n),s=r}return n=e.F,t=e.Da,n&&t&&Nt(s,n,t),Nt(s,"VER",e.ra),On(e,s),s}function zn(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=n&&e.Ha&&!e.va?new dn(new rn({ob:!0})):new dn(e.va)).Oa(e.J),t}function Hn(){}function Gn(){if(M&&!(10<=Number(H)))throw Error("Environmental error: no available transport.")}function Kn(e,t){ye.call(this),this.g=new Sn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.s=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.Ca&&(e?e["X-WebChannel-Client-Profile"]=t.Ca:e={"X-WebChannel-Client-Profile":t.Ca}),this.g.U=e,(e=t&&t.cc)&&!T(e)&&(this.g.o=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!T(t)&&(this.g.F=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new Yn(this)}function Wn(e){it.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(const n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function Qn(){rt.call(this),this.status=1}function Yn(e){this.g=e}function Xn(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}function Jn(e,t,n){n||(n=0);var s=Array(16);if("string"==typeof t)for(var i=0;16>i;++i)s[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;16>i;++i)s[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];var r=e.g[3],o=t+(r^n&(i^r))+s[0]+3614090360&4294967295;o=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=n+(o<<7&4294967295|o>>>25))+((o=r+(i^t&(n^i))+s[1]+3905402710&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^r&(t^n))+s[2]+606105819&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(r^t))+s[3]+3250441966&4294967295)<<22&4294967295|o>>>10))+((o=t+(r^n&(i^r))+s[4]+4118548399&4294967295)<<7&4294967295|o>>>25))+((o=r+(i^t&(n^i))+s[5]+1200080426&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^r&(t^n))+s[6]+2821735955&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(r^t))+s[7]+4249261313&4294967295)<<22&4294967295|o>>>10))+((o=t+(r^n&(i^r))+s[8]+1770035416&4294967295)<<7&4294967295|o>>>25))+((o=r+(i^t&(n^i))+s[9]+2336552879&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^r&(t^n))+s[10]+4294925233&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(r^t))+s[11]+2304563134&4294967295)<<22&4294967295|o>>>10))+((o=t+(r^n&(i^r))+s[12]+1804603682&4294967295)<<7&4294967295|o>>>25))+((o=r+(i^t&(n^i))+s[13]+4254626195&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^r&(t^n))+s[14]+2792965006&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(r^t))+s[15]+1236535329&4294967295)<<22&4294967295|o>>>10))+((o=t+(i^r&(n^i))+s[1]+4129170786&4294967295)<<5&4294967295|o>>>27))+((o=r+(n^i&(t^n))+s[6]+3225465664&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(r^t))+s[11]+643717713&4294967295)<<14&4294967295|o>>>18))+((o=n+(r^t&(i^r))+s[0]+3921069994&4294967295)<<20&4294967295|o>>>12))+((o=t+(i^r&(n^i))+s[5]+3593408605&4294967295)<<5&4294967295|o>>>27))+((o=r+(n^i&(t^n))+s[10]+38016083&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(r^t))+s[15]+3634488961&4294967295)<<14&4294967295|o>>>18))+((o=n+(r^t&(i^r))+s[4]+3889429448&4294967295)<<20&4294967295|o>>>12))+((o=t+(i^r&(n^i))+s[9]+568446438&4294967295)<<5&4294967295|o>>>27))+((o=r+(n^i&(t^n))+s[14]+3275163606&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(r^t))+s[3]+4107603335&4294967295)<<14&4294967295|o>>>18))+((o=n+(r^t&(i^r))+s[8]+1163531501&4294967295)<<20&4294967295|o>>>12))+((o=t+(i^r&(n^i))+s[13]+2850285829&4294967295)<<5&4294967295|o>>>27))+((o=r+(n^i&(t^n))+s[2]+4243563512&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(r^t))+s[7]+1735328473&4294967295)<<14&4294967295|o>>>18))+((o=n+(r^t&(i^r))+s[12]+2368359562&4294967295)<<20&4294967295|o>>>12))+((o=t+(n^i^r)+s[5]+4294588738&4294967295)<<4&4294967295|o>>>28))+((o=r+(t^n^i)+s[8]+2272392833&4294967295)<<11&4294967295|o>>>21))+((o=i+(r^t^n)+s[11]+1839030562&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^r^t)+s[14]+4259657740&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^i^r)+s[1]+2763975236&4294967295)<<4&4294967295|o>>>28))+((o=r+(t^n^i)+s[4]+1272893353&4294967295)<<11&4294967295|o>>>21))+((o=i+(r^t^n)+s[7]+4139469664&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^r^t)+s[10]+3200236656&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^i^r)+s[13]+681279174&4294967295)<<4&4294967295|o>>>28))+((o=r+(t^n^i)+s[0]+3936430074&4294967295)<<11&4294967295|o>>>21))+((o=i+(r^t^n)+s[3]+3572445317&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^r^t)+s[6]+76029189&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^i^r)+s[9]+3654602809&4294967295)<<4&4294967295|o>>>28))+((o=r+(t^n^i)+s[12]+3873151461&4294967295)<<11&4294967295|o>>>21))+((o=i+(r^t^n)+s[15]+530742520&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^r^t)+s[2]+3299628645&4294967295)<<23&4294967295|o>>>9))+((o=t+(i^(n|~r))+s[0]+4096336452&4294967295)<<6&4294967295|o>>>26))+((o=r+(n^(t|~i))+s[7]+1126891415&4294967295)<<10&4294967295|o>>>22))+((o=i+(t^(r|~n))+s[14]+2878612391&4294967295)<<15&4294967295|o>>>17))+((o=n+(r^(i|~t))+s[5]+4237533241&4294967295)<<21&4294967295|o>>>11))+((o=t+(i^(n|~r))+s[12]+1700485571&4294967295)<<6&4294967295|o>>>26))+((o=r+(n^(t|~i))+s[3]+2399980690&4294967295)<<10&4294967295|o>>>22))+((o=i+(t^(r|~n))+s[10]+4293915773&4294967295)<<15&4294967295|o>>>17))+((o=n+(r^(i|~t))+s[1]+2240044497&4294967295)<<21&4294967295|o>>>11))+((o=t+(i^(n|~r))+s[8]+1873313359&4294967295)<<6&4294967295|o>>>26))+((o=r+(n^(t|~i))+s[15]+4264355552&4294967295)<<10&4294967295|o>>>22))+((o=i+(t^(r|~n))+s[6]+2734768916&4294967295)<<15&4294967295|o>>>17))+((o=n+(r^(i|~t))+s[13]+1309151649&4294967295)<<21&4294967295|o>>>11))+((r=(t=n+((o=t+(i^(n|~r))+s[4]+4149444226&4294967295)<<6&4294967295|o>>>26))+((o=r+(n^(t|~i))+s[11]+3174756917&4294967295)<<10&4294967295|o>>>22))^((i=r+((o=i+(t^(r|~n))+s[2]+718787259&4294967295)<<15&4294967295|o>>>17))|~t))+s[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+r&4294967295}function Zn(e,t){this.h=t;for(var n=[],s=!0,i=e.length-1;0<=i;i--){var r=0|e[i];s&&r==t||(n[i]=r,s=!1)}this.g=n}(s=dn.prototype).Oa=function(e){this.M=e},s.ha=function(e,t,n,s){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+e);t=t?t.toUpperCase():"GET",this.I=e,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():nt.g(),this.C=this.u?et(this.u):et(nt),this.g.onreadystatechange=_(this.La,this);try{this.G=!0,this.g.open(t,String(e),!0),this.G=!1}catch(e){return void gn(this,e)}if(e=n||"",n=new Map(this.headers),s)if(Object.getPrototypeOf(s)===Object.prototype)for(var i in s)n.set(i,s[i]);else{if("function"!=typeof s.keys||"function"!=typeof s.get)throw Error("Unknown input type for opt_headers: "+String(s));for(const e of s.keys())n.set(e,s.get(e))}s=Array.from(n.keys()).find((e=>"content-type"==e.toLowerCase())),i=h.FormData&&e instanceof h.FormData,!(0<=b(mn,t))||s||i||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[e,t]of n)this.g.setRequestHeader(e,t);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{wn(this),0<this.B&&((this.L=function(e){return M&&"number"==typeof e.timeout&&void 0!==e.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=_(this.ua,this)):this.A=Le(this.ua,this.B,this)),this.v=!0,this.g.send(e),this.v=!1}catch(e){gn(this,e)}},s.ua=function(){void 0!==l&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,_e(this,"timeout"),this.abort(8))},s.abort=function(e){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=e||7,_e(this,"complete"),_e(this,"abort"),vn(this))},s.N=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),vn(this,!0)),dn.$.N.call(this)},s.La=function(){this.s||(this.G||this.v||this.l?_n(this):this.kb())},s.kb=function(){_n(this)},s.isActive=function(){return!!this.g},s.da=function(){try{return 2<En(this)?this.g.status:-1}catch(e){return-1}},s.ja=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},s.Wa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),hn(t)}},s.Ia=function(){return this.m},s.Sa=function(){return"string"==typeof this.j?this.j:String(this.j)},(s=Sn.prototype).ra=8,s.H=1,s.Na=function(e){if(this.m)if(this.m=null,1==this.H){if(!e){this.W=Math.floor(1e5*Math.random()),e=this.W++;const i=new at(this,this.l,e);let r=this.s;if(this.U&&(r?(r=Z(r),te(r,this.U)):r=this.U),null!==this.o||this.O||(i.I=r,r=null),this.P)e:{for(var t=0,n=0;n<this.j.length;n++){var s=this.j[n];if(void 0===(s="__data__"in s.map&&"string"==typeof(s=s.map.__data__)?s.length:void 0))break;if(4096<(t+=s)){t=n;break e}if(4096===t||n===this.j.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=Ln(this,i,t),Nt(n=St(this.I),"RID",e),Nt(n,"CVER",22),this.F&&Nt(n,"X-HTTP-Session-Id",this.F),On(this,n),r&&(this.O?t="headers="+encodeURIComponent(String(kn(r)))+"&"+t:this.o&&Cn(n,this.o,r)),Xt(this.i,i),this.bb&&Nt(n,"TYPE","init"),this.P?(Nt(n,"$req",t),Nt(n,"SID","null"),i.aa=!0,dt(i,n,null)):dt(i,n,t),this.H=2}}else 3==this.H&&(e?Rn(this,e):0==this.j.length||Wt(this.i)||Rn(this))},s.Ma=function(){if(this.u=null,Fn(this),this.ca&&!(this.M||null==this.g||0>=this.S)){var e=2*this.S;this.l.info("BP detection timer enabled: "+e),this.B=Ye(_(this.jb,this),e)}},s.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,We(10),In(this),Fn(this))},s.ib=function(){null!=this.v&&(this.v=null,In(this),Mn(this),We(19))},s.pb=function(e){e?(this.l.info("Successfully pinged google.com"),We(2)):(this.l.info("Failed to ping google.com"),We(1))},s.isActive=function(){return!!this.h&&this.h.isActive(this)},(s=Hn.prototype).Ba=function(){},s.Aa=function(){},s.za=function(){},s.ya=function(){},s.isActive=function(){return!0},s.Va=function(){},Gn.prototype.g=function(e,t){return new Kn(e,t)},w(Kn,ye),Kn.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var e=this.g,t=this.l,n=this.h||void 0;We(0),e.Y=t,e.na=n||{},e.G=e.aa,e.I=$n(e,null,e.Y),Nn(e)},Kn.prototype.close=function(){Tn(this.g)},Kn.prototype.u=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=we(e),e=n);t.j.push(new class{constructor(e,t){this.g=e,this.map=t}}(t.fb++,e)),3==t.H&&Nn(t)},Kn.prototype.N=function(){this.g.h=null,delete this.j,Tn(this.g),delete this.g,Kn.$.N.call(this)},w(Wn,it),w(Qn,rt),w(Yn,Hn),Yn.prototype.Ba=function(){_e(this.g,"a")},Yn.prototype.Aa=function(e){_e(this.g,new Wn(e))},Yn.prototype.za=function(e){_e(this.g,new Qn)},Yn.prototype.ya=function(){_e(this.g,"b")},w(Xn,(function(){this.blockSize=-1})),Xn.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0},Xn.prototype.j=function(e,t){void 0===t&&(t=e.length);for(var n=t-this.blockSize,s=this.m,i=this.h,r=0;r<t;){if(0==i)for(;r<=n;)Jn(this,e,r),r+=this.blockSize;if("string"==typeof e){for(;r<t;)if(s[i++]=e.charCodeAt(r++),i==this.blockSize){Jn(this,s),i=0;break}}else for(;r<t;)if(s[i++]=e[r++],i==this.blockSize){Jn(this,s),i=0;break}}this.h=i,this.i+=t},Xn.prototype.l=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.i;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.j(e),e=Array(16),t=n=0;4>t;++t)for(var s=0;32>s;s+=8)e[n++]=this.g[t]>>>s&255;return e};var es={};function ts(e){return-128<=e&&128>e?function(e,t){var n=es;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,(function(e){return new Zn([0|e],0>e?-1:0)})):new Zn([0|e],0>e?-1:0)}function ns(e){if(isNaN(e)||!isFinite(e))return is;if(0>e)return us(ns(-e));for(var t=[],n=1,s=0;e>=n;s++)t[s]=e/n|0,n*=ss;return new Zn(t,0)}var ss=4294967296,is=ts(0),rs=ts(1),os=ts(16777216);function as(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function cs(e){return-1==e.h}function us(e){for(var t=e.g.length,n=[],s=0;s<t;s++)n[s]=~e.g[s];return new Zn(n,~e.h).add(rs)}function ls(e,t){return e.add(us(t))}function hs(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function ds(e,t){this.g=e,this.h=t}function ps(e,t){if(as(t))throw Error("division by zero");if(as(e))return new ds(is,is);if(cs(e))return t=ps(us(e),t),new ds(us(t.g),us(t.h));if(cs(t))return t=ps(e,us(t)),new ds(us(t.g),t.h);if(30<e.g.length){if(cs(e)||cs(t))throw Error("slowDivide_ only works with positive integers.");for(var n=rs,s=t;0>=s.X(e);)n=fs(n),s=fs(s);var i=ms(n,1),r=ms(s,1);for(s=ms(s,2),n=ms(n,2);!as(s);){var o=r.add(s);0>=o.X(e)&&(i=i.add(n),r=o),s=ms(s,1),n=ms(n,1)}return t=ls(e,i.R(t)),new ds(i,t)}for(i=is;0<=e.X(t);){for(n=Math.max(1,Math.floor(e.ea()/t.ea())),s=48>=(s=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,s-48),o=(r=ns(n)).R(t);cs(o)||0<o.X(e);)o=(r=ns(n-=s)).R(t);as(r)&&(r=rs),i=i.add(r),e=ls(e,o)}return new ds(i,e)}function fs(e){for(var t=e.g.length+1,n=[],s=0;s<t;s++)n[s]=e.D(s)<<1|e.D(s-1)>>>31;return new Zn(n,e.h)}function ms(e,t){var n=t>>5;t%=32;for(var s=e.g.length-n,i=[],r=0;r<s;r++)i[r]=0<t?e.D(r+n)>>>t|e.D(r+n+1)<<32-t:e.D(r+n);return new Zn(i,e.h)}(s=Zn.prototype).ea=function(){if(cs(this))return-us(this).ea();for(var e=0,t=1,n=0;n<this.g.length;n++){var s=this.D(n);e+=(0<=s?s:ss+s)*t,t*=ss}return e},s.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(as(this))return"0";if(cs(this))return"-"+us(this).toString(e);for(var t=ns(Math.pow(e,6)),n=this,s="";;){var i=ps(n,t).g,r=((0<(n=ls(n,i.R(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(as(n=i))return r+s;for(;6>r.length;)r="0"+r;s=r+s}},s.D=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},s.X=function(e){return cs(e=ls(this,e))?-1:as(e)?0:1},s.abs=function(){return cs(this)?us(this):this},s.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0,i=0;i<=t;i++){var r=s+(65535&this.D(i))+(65535&e.D(i)),o=(r>>>16)+(this.D(i)>>>16)+(e.D(i)>>>16);s=o>>>16,r&=65535,o&=65535,n[i]=o<<16|r}return new Zn(n,-2147483648&n[n.length-1]?-1:0)},s.R=function(e){if(as(this)||as(e))return is;if(cs(this))return cs(e)?us(this).R(us(e)):us(us(this).R(e));if(cs(e))return us(this.R(us(e)));if(0>this.X(os)&&0>e.X(os))return ns(this.ea()*e.ea());for(var t=this.g.length+e.g.length,n=[],s=0;s<2*t;s++)n[s]=0;for(s=0;s<this.g.length;s++)for(var i=0;i<e.g.length;i++){var r=this.D(s)>>>16,o=65535&this.D(s),a=e.D(i)>>>16,c=65535&e.D(i);n[2*s+2*i]+=o*c,hs(n,2*s+2*i),n[2*s+2*i+1]+=r*c,hs(n,2*s+2*i+1),n[2*s+2*i+1]+=o*a,hs(n,2*s+2*i+1),n[2*s+2*i+2]+=r*a,hs(n,2*s+2*i+2)}for(s=0;s<t;s++)n[s]=n[2*s+1]<<16|n[2*s];for(s=t;s<2*t;s++)n[s]=0;return new Zn(n,0)},s.gb=function(e){return ps(this,e).h},s.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0;s<t;s++)n[s]=this.D(s)&e.D(s);return new Zn(n,this.h&e.h)},s.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0;s<t;s++)n[s]=this.D(s)|e.D(s);return new Zn(n,this.h|e.h)},s.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0;s<t;s++)n[s]=this.D(s)^e.D(s);return new Zn(n,this.h^e.h)},Gn.prototype.createWebChannel=Gn.prototype.g,Kn.prototype.send=Kn.prototype.u,Kn.prototype.open=Kn.prototype.m,Kn.prototype.close=Kn.prototype.close,Xe.NO_ERROR=0,Xe.TIMEOUT=8,Xe.HTTP_ERROR=6,Je.COMPLETE="complete",tt.EventType=st,st.OPEN="a",st.CLOSE="b",st.ERROR="c",st.MESSAGE="d",ye.prototype.listen=ye.prototype.O,dn.prototype.listenOnce=dn.prototype.P,dn.prototype.getLastError=dn.prototype.Sa,dn.prototype.getLastErrorCode=dn.prototype.Ia,dn.prototype.getStatus=dn.prototype.da,dn.prototype.getResponseJson=dn.prototype.Wa,dn.prototype.getResponseText=dn.prototype.ja,dn.prototype.send=dn.prototype.ha,dn.prototype.setWithCredentials=dn.prototype.Oa,Xn.prototype.digest=Xn.prototype.l,Xn.prototype.reset=Xn.prototype.reset,Xn.prototype.update=Xn.prototype.j,Zn.prototype.add=Zn.prototype.add,Zn.prototype.multiply=Zn.prototype.R,Zn.prototype.modulo=Zn.prototype.gb,Zn.prototype.compare=Zn.prototype.X,Zn.prototype.toNumber=Zn.prototype.ea,Zn.prototype.toString=Zn.prototype.toString,Zn.prototype.getBits=Zn.prototype.D,Zn.fromNumber=ns,Zn.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return us(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var s=ns(Math.pow(n,8)),i=is,r=0;r<t.length;r+=8){var o=Math.min(8,t.length-r),a=parseInt(t.substring(r,r+o),n);8>o?(o=ns(Math.pow(n,o)),i=i.R(o).add(ns(a))):i=(i=i.R(s)).add(ns(a))}return i};var gs=u.createWebChannelTransport=function(){return new Gn},ys=u.getStatEventTarget=function(){return ze()},_s=u.ErrorCode=Xe,vs=u.EventType=Je,ws=u.Event=qe,Es=u.Stat={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},bs=u.FetchXmlHttpFactory=rn,ks=u.WebChannel=tt,Cs=u.XhrIo=dn,As=u.Md5=Xn,Ss=u.Integer=Zn;const Ts="@firebase/firestore";class Is{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Is.UNAUTHENTICATED=new Is(null),Is.GOOGLE_CREDENTIALS=new Is("google-credentials-uid"),Is.FIRST_PARTY=new Is("first-party-uid"),Is.MOCK_USER=new Is("mock-user");let Ds="9.22.1";const Ns=new o.Yd("@firebase/firestore");function Rs(){return Ns.logLevel}function Os(e,...t){if(Ns.logLevel<=o.in.DEBUG){const n=t.map(Ms);Ns.debug(`Firestore (${Ds}): ${e}`,...n)}}function Ls(e,...t){if(Ns.logLevel<=o.in.ERROR){const n=t.map(Ms);Ns.error(`Firestore (${Ds}): ${e}`,...n)}}function Ps(e,...t){if(Ns.logLevel<=o.in.WARN){const n=t.map(Ms);Ns.warn(`Firestore (${Ds}): ${e}`,...n)}}function Ms(e){if("string"==typeof e)return e;try{return t=e,JSON.stringify(t)}catch(t){return e}var t}function xs(e="Unexpected state"){const t=`FIRESTORE (${Ds}) INTERNAL ASSERTION FAILED: `+e;throw Ls(t),new Error(t)}function Fs(e,t){e||xs()}function Us(e,t){return e}const Vs={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 js extends a.ZR{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class Bs{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class qs{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class $s{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(Is.UNAUTHENTICATED)))}shutdown(){}}class zs{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 Hs{constructor(e){this.t=e,this.currentUser=Is.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let n=this.i;const s=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let i=new Bs;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Bs,e.enqueueRetryable((()=>s(this.currentUser)))};const r=()=>{const t=i;e.enqueueRetryable((async()=>{await t.promise,await s(this.currentUser)}))},o=e=>{Os("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.auth.addAuthTokenListener(this.o),r()};this.t.onInit((e=>o(e))),setTimeout((()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?o(e):(Os("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Bs)}}),0),r()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i!==e?(Os("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(Fs("string"==typeof t.accessToken),new qs(t.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const e=this.auth&&this.auth.getUid();return Fs(null===e||"string"==typeof e),new Is(e)}}class Gs{constructor(e,t,n){this.h=e,this.l=t,this.m=n,this.type="FirstParty",this.user=Is.FIRST_PARTY,this.g=new Map}p(){return this.m?this.m():null}get headers(){this.g.set("X-Goog-AuthUser",this.h);const e=this.p();return e&&this.g.set("Authorization",e),this.l&&this.g.set("X-Goog-Iam-Authorization-Token",this.l),this.g}}class Ks{constructor(e,t,n){this.h=e,this.l=t,this.m=n}getToken(){return Promise.resolve(new Gs(this.h,this.l,this.m))}start(e,t){e.enqueueRetryable((()=>t(Is.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Ws{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 Qs{constructor(e){this.I=e,this.forceRefresh=!1,this.appCheck=null,this.T=null}start(e,t){const n=e=>{null!=e.error&&Os("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);const n=e.token!==this.T;return this.T=e.token,Os("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};const s=e=>{Os("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.appCheck.addTokenListener(this.o)};this.I.onInit((e=>s(e))),setTimeout((()=>{if(!this.appCheck){const e=this.I.getImmediate({optional:!0});e?s(e):Os("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(Fs("string"==typeof e.token),this.T=e.token,new Ws(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}function Ys(e){const t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}class Xs{static A(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(256/62);let n="";for(;n.length<20;){const s=Ys(40);for(let i=0;i<s.length;++i)n.length<20&&s[i]<t&&(n+=e.charAt(s[i]%62))}return n}}function Js(e,t){return e<t?-1:e>t?1:0}function Zs(e,t,n){return e.length===t.length&&e.every(((e,s)=>n(e,t[s])))}class ei{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new js(Vs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new js(Vs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new js(Vs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new js(Vs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return ei.fromMillis(Date.now())}static fromDate(e){return ei.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor(1e6*(e-1e3*t));return new ei(t,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?Js(this.nanoseconds,e.nanoseconds):Js(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}class ti{constructor(e){this.timestamp=e}static fromTimestamp(e){return new ti(e)}static min(){return new ti(new ei(0,0))}static max(){return new ti(new ei(253402300799,999999999))}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}}class ni{constructor(e,t,n){void 0===t?t=0:t>e.length&&xs(),void 0===n?n=e.length-t:n>e.length-t&&xs(),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===ni.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof ni?e.forEach((e=>{t.push(e)})):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,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 n=e.get(s),i=t.get(s);if(n<i)return-1;if(n>i)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}class si extends ni{construct(e,t,n){return new si(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...e){const t=[];for(const n of e){if(n.indexOf("//")>=0)throw new js(Vs.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter((e=>e.length>0)))}return new si(t)}static emptyPath(){return new si([])}}const ii=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class ri extends ni{construct(e,t,n){return new ri(e,t,n)}static isValidIdentifier(e){return ii.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),ri.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new ri(["__name__"])}static fromServerFormat(e){const t=[];let n="",s=0;const i=()=>{if(0===n.length)throw new js(Vs.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let r=!1;for(;s<e.length;){const t=e[s];if("\\"===t){if(s+1===e.length)throw new js(Vs.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[s+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new js(Vs.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,s+=2}else"`"===t?(r=!r,s++):"."!==t||r?(n+=t,s++):(i(),s++)}if(i(),r)throw new js(Vs.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new ri(t)}static emptyPath(){return new ri([])}}class oi{constructor(e){this.path=e}static fromPath(e){return new oi(si.fromString(e))}static fromName(e){return new oi(si.fromString(e).popFirst(5))}static empty(){return new oi(si.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===si.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return si.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new oi(new si(e.slice()))}}class ai{constructor(e,t,n,s){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=s}}ai.UNKNOWN_ID=-1;function ci(e,t){const n=e.toTimestamp().seconds,s=e.toTimestamp().nanoseconds+1,i=ti.fromTimestamp(1e9===s?new ei(n+1,0):new ei(n,s));return new li(i,oi.empty(),t)}function ui(e){return new li(e.readTime,e.key,-1)}class li{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new li(ti.min(),oi.empty(),-1)}static max(){return new li(ti.max(),oi.empty(),-1)}}function hi(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=oi.comparator(e.documentKey,t.documentKey),0!==n?n:Js(e.largestBatchId,t.largestBatchId))}const di="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class pi{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}async function fi(e){if(e.code!==Vs.FAILED_PRECONDITION||e.message!==di)throw e;Os("LocalStore","Unexpectedly lost primary lease")}class mi{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)}),(e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)}))}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&xs(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new mi(((n,s)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,s)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,s)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{const t=e();return t instanceof mi?t:mi.resolve(t)}catch(e){return mi.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction((()=>e(t))):mi.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction((()=>e(t))):mi.reject(t)}static resolve(e){return new mi(((t,n)=>{t(e)}))}static reject(e){return new mi(((t,n)=>{n(e)}))}static waitFor(e){return new mi(((t,n)=>{let s=0,i=0,r=!1;e.forEach((e=>{++s,e.next((()=>{++i,r&&i===s&&t()}),(e=>n(e)))})),r=!0,i===s&&t()}))}static or(e){let t=mi.resolve(!1);for(const n of e)t=t.next((e=>e?mi.resolve(e):n()));return t}static forEach(e,t){const n=[];return e.forEach(((e,s)=>{n.push(t.call(this,e,s))})),this.waitFor(n)}static mapArray(e,t){return new mi(((n,s)=>{const i=e.length,r=new Array(i);let o=0;for(let a=0;a<i;a++){const c=a;t(e[c]).next((e=>{r[c]=e,++o,o===i&&n(r)}),(e=>s(e)))}}))}static doWhile(e,t){return new mi(((n,s)=>{const i=()=>{!0===e()?t().next((()=>{i()}),s):n()};i()}))}}function gi(e){return"IndexedDbTransactionError"===e.name}class yi{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ot(e),this.ut=e=>t.writeSequenceNumber(e))}ot(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ut&&this.ut(e),e}}function _i(e){return null==e}function vi(e){return 0===e&&1/e==-1/0}function wi(e){return"number"==typeof e&&Number.isInteger(e)&&!vi(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}yi.ct=-1;const Ei=["mutationQueues","mutations","documentMutations","remoteDocuments","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries"],bi=["mutationQueues","mutations","documentMutations","remoteDocumentsV14","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries","documentOverlays"],ki=bi;function Ci(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Ai(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Si(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class Ti{constructor(e,t){this.comparator=e,this.root=t||Di.EMPTY}insert(e,t){return new Ti(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,Di.BLACK,null,null))}remove(e){return new Ti(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Di.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const n=this.comparator(e,t.key);if(0===n)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(0===s)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 Ii(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Ii(this.root,e,this.comparator,!1)}getReverseIterator(){return new Ii(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Ii(this.root,e,this.comparator,!0)}}class Ii{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(0===i){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(0===this.nodeStack.length)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class Di{constructor(e,t,n,s,i){this.key=e,this.value=t,this.color=null!=n?n:Di.RED,this.left=null!=s?s:Di.EMPTY,this.right=null!=i?i:Di.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,s,i){return new Di(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=s?s:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,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):0===i?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 Di.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()),0===t(e,s.key)){if(s.right.isEmpty())return Di.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,Di.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Di.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 xs();if(this.right.isRed())throw xs();const e=this.left.check();if(e!==this.right.check())throw xs();return e+(this.isRed()?0:1)}}Di.EMPTY=null,Di.RED=!0,Di.BLACK=!1,Di.EMPTY=new class{constructor(){this.size=0}get key(){throw xs()}get value(){throw xs()}get color(){throw xs()}get left(){throw xs()}get right(){throw xs()}copy(e,t,n,s,i){return this}insert(e,t,n){return new Di(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 Ni{constructor(e){this.comparator=e,this.data=new Ti(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,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=void 0!==t?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 Ri(this.data.getIterator())}getIteratorFrom(e){return new Ri(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach((e=>{t=t.add(e)})),t}isEqual(e){if(!(e instanceof Ni))return!1;if(this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const e=t.getNext().key,s=n.getNext().key;if(0!==this.comparator(e,s))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 Ni(this.comparator);return t.data=e,t}}class Ri{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class Oi{constructor(e){this.fields=e,e.sort(ri.comparator)}static empty(){return new Oi([])}unionWith(e){let t=new Ni(ri.comparator);for(const e of this.fields)t=t.add(e);for(const n of e)t=t.add(n);return new Oi(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Zs(this.fields,e.fields,((e,t)=>e.isEqual(t)))}}class Li extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class Pi{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new Li("Invalid base64 string: "+e):e}}(e);return new Pi(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new Pi(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return e=this.binaryString,btoa(e);var e}toUint8Array(){return function(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Js(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Pi.EMPTY_BYTE_STRING=new Pi("");const Mi=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function xi(e){if(Fs(!!e),"string"==typeof e){let t=0;const n=Mi.exec(e);if(Fs(!!n),n[1]){let e=n[1];e=(e+"000000000").substr(0,9),t=Number(e)}const s=new Date(e);return{seconds:Math.floor(s.getTime()/1e3),nanos:t}}return{seconds:Fi(e.seconds),nanos:Fi(e.nanos)}}function Fi(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function Ui(e){return"string"==typeof e?Pi.fromBase64String(e):Pi.fromUint8Array(e)}function Vi(e){var t,n;return"server_timestamp"===(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function ji(e){const t=e.mapValue.fields.__previous_value__;return Vi(t)?ji(t):t}function Bi(e){const t=xi(e.mapValue.fields.__local_write_time__.timestampValue);return new ei(t.seconds,t.nanos)}class qi{constructor(e,t,n,s,i,r,o,a,c){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=s,this.ssl=i,this.forceLongPolling=r,this.autoDetectLongPolling=o,this.longPollingOptions=a,this.useFetchStreams=c}}class $i{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new $i("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(e){return e instanceof $i&&e.projectId===this.projectId&&e.database===this.database}}const zi={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function Hi(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?Vi(e)?4:rr(e)?9007199254740991:10:xs()}function Gi(e,t){if(e===t)return!0;const n=Hi(e);if(n!==Hi(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Bi(e).isEqual(Bi(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;const n=xi(e.timestampValue),s=xi(t.timestampValue);return n.seconds===s.seconds&&n.nanos===s.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Ui(e.bytesValue).isEqual(Ui(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return Fi(e.geoPointValue.latitude)===Fi(t.geoPointValue.latitude)&&Fi(e.geoPointValue.longitude)===Fi(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return Fi(e.integerValue)===Fi(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){const n=Fi(e.doubleValue),s=Fi(t.doubleValue);return n===s?vi(n)===vi(s):isNaN(n)&&isNaN(s)}return!1}(e,t);case 9:return Zs(e.arrayValue.values||[],t.arrayValue.values||[],Gi);case 10:return function(e,t){const n=e.mapValue.fields||{},s=t.mapValue.fields||{};if(Ci(n)!==Ci(s))return!1;for(const e in n)if(n.hasOwnProperty(e)&&(void 0===s[e]||!Gi(n[e],s[e])))return!1;return!0}(e,t);default:return xs()}}function Ki(e,t){return void 0!==(e.values||[]).find((e=>Gi(e,t)))}function Wi(e,t){if(e===t)return 0;const n=Hi(e),s=Hi(t);if(n!==s)return Js(n,s);switch(n){case 0:case 9007199254740991:return 0;case 1:return Js(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=Fi(e.integerValue||e.doubleValue),s=Fi(t.integerValue||t.doubleValue);return n<s?-1:n>s?1:n===s?0:isNaN(n)?isNaN(s)?0:-1:1}(e,t);case 3:return Qi(e.timestampValue,t.timestampValue);case 4:return Qi(Bi(e),Bi(t));case 5:return Js(e.stringValue,t.stringValue);case 6:return function(e,t){const n=Ui(e),s=Ui(t);return n.compareTo(s)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),s=t.split("/");for(let e=0;e<n.length&&e<s.length;e++){const t=Js(n[e],s[e]);if(0!==t)return t}return Js(n.length,s.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=Js(Fi(e.latitude),Fi(t.latitude));return 0!==n?n:Js(Fi(e.longitude),Fi(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return function(e,t){const n=e.values||[],s=t.values||[];for(let e=0;e<n.length&&e<s.length;++e){const t=Wi(n[e],s[e]);if(t)return t}return Js(n.length,s.length)}(e.arrayValue,t.arrayValue);case 10:return function(e,t){if(e===zi.mapValue&&t===zi.mapValue)return 0;if(e===zi.mapValue)return 1;if(t===zi.mapValue)return-1;const n=e.fields||{},s=Object.keys(n),i=t.fields||{},r=Object.keys(i);s.sort(),r.sort();for(let e=0;e<s.length&&e<r.length;++e){const t=Js(s[e],r[e]);if(0!==t)return t;const o=Wi(n[s[e]],i[r[e]]);if(0!==o)return o}return Js(s.length,r.length)}(e.mapValue,t.mapValue);default:throw xs()}}function Qi(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return Js(e,t);const n=xi(e),s=xi(t),i=Js(n.seconds,s.seconds);return 0!==i?i:Js(n.nanos,s.nanos)}function Yi(e){return Xi(e)}function Xi(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){const t=xi(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?Ui(e.bytesValue).toBase64():"referenceValue"in e?(n=e.referenceValue,oi.fromName(n).toString()):"geoPointValue"in e?`geo(${(t=e.geoPointValue).latitude},${t.longitude})`:"arrayValue"in e?function(e){let t="[",n=!0;for(const s of e.values||[])n?n=!1:t+=",",t+=Xi(s);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",s=!0;for(const i of t)s?s=!1:n+=",",n+=`${i}:${Xi(e.fields[i])}`;return n+"}"}(e.mapValue):xs();var t,n}function Ji(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function Zi(e){return!!e&&"integerValue"in e}function er(e){return!!e&&"arrayValue"in e}function tr(e){return!!e&&"nullValue"in e}function nr(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function sr(e){return!!e&&"mapValue"in e}function ir(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){const t={mapValue:{fields:{}}};return Ai(e.mapValue.fields,((e,n)=>t.mapValue.fields[e]=ir(n))),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=ir(e.arrayValue.values[n]);return t}return Object.assign({},e)}function rr(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}class or{constructor(e){this.value=e}static empty(){return new or({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)],!sr(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=ir(t)}setAll(e){let t=ri.emptyPath(),n={},s=[];e.forEach(((e,i)=>{if(!t.isImmediateParentOf(i)){const e=this.getFieldsMap(t);this.applyChanges(e,n,s),n={},s=[],t=i.popLast()}e?n[i.lastSegment()]=ir(e):s.push(i.lastSegment())}));const i=this.getFieldsMap(t);this.applyChanges(i,n,s)}delete(e){const t=this.field(e.popLast());sr(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Gi(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)];sr(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,n){Ai(t,((t,n)=>e[t]=n));for(const t of n)delete e[t]}clone(){return new or(ir(this.value))}}class ar{constructor(e,t,n,s,i,r,o){this.key=e,this.documentType=t,this.version=n,this.readTime=s,this.createTime=i,this.data=r,this.documentState=o}static newInvalidDocument(e){return new ar(e,0,ti.min(),ti.min(),ti.min(),or.empty(),0)}static newFoundDocument(e,t,n,s){return new ar(e,1,t,ti.min(),n,s,0)}static newNoDocument(e,t){return new ar(e,2,t,ti.min(),ti.min(),or.empty(),0)}static newUnknownDocument(e,t){return new ar(e,3,t,ti.min(),ti.min(),or.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(ti.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=or.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=or.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ti.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof ar&&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 ar(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}class cr{constructor(e,t){this.position=e,this.inclusive=t}}function ur(e,t,n){let s=0;for(let i=0;i<e.position.length;i++){const r=t[i],o=e.position[i];if(s=r.field.isKeyField()?oi.comparator(oi.fromName(o.referenceValue),n.key):Wi(o,n.data.field(r.field)),"desc"===r.dir&&(s*=-1),0!==s)break}return s}function lr(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!Gi(e.position[n],t.position[n]))return!1;return!0}class hr{constructor(e,t="asc"){this.field=e,this.dir=t}}function dr(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}class pr{}class fr extends pr{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new br(e,t,n):"array-contains"===t?new Sr(e,n):"in"===t?new Tr(e,n):"not-in"===t?new Ir(e,n):"array-contains-any"===t?new Dr(e,n):new fr(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new kr(e,n):new Cr(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(Wi(t,this.value)):null!==t&&Hi(this.value)===Hi(t)&&this.matchesComparison(Wi(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return xs()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class mr extends pr{constructor(e,t){super(),this.filters=e,this.op=t,this.lt=null}static create(e,t){return new mr(e,t)}matches(e){return gr(this)?void 0===this.filters.find((t=>!t.matches(e))):void 0!==this.filters.find((t=>t.matches(e)))}getFlattenedFilters(){return null!==this.lt||(this.lt=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.lt}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const e=this.ft((e=>e.isInequality()));return null!==e?e.field:null}ft(e){for(const t of this.getFlattenedFilters())if(e(t))return t;return null}}function gr(e){return"and"===e.op}function yr(e){return _r(e)&&gr(e)}function _r(e){for(const t of e.filters)if(t instanceof mr)return!1;return!0}function vr(e){if(e instanceof fr)return e.field.canonicalString()+e.op.toString()+Yi(e.value);if(yr(e))return e.filters.map((e=>vr(e))).join(",");{const t=e.filters.map((e=>vr(e))).join(",");return`${e.op}(${t})`}}function wr(e,t){return e instanceof fr?function(e,t){return t instanceof fr&&e.op===t.op&&e.field.isEqual(t.field)&&Gi(e.value,t.value)}(e,t):e instanceof mr?function(e,t){return t instanceof mr&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce(((e,n,s)=>e&&wr(n,t.filters[s])),!0)}(e,t):void xs()}function Er(e){return e instanceof fr?function(e){return`${e.field.canonicalString()} ${e.op} ${Yi(e.value)}`}(e):e instanceof mr?function(e){return e.op.toString()+" {"+e.getFilters().map(Er).join(" ,")+"}"}(e):"Filter"}class br extends fr{constructor(e,t,n){super(e,t,n),this.key=oi.fromName(n.referenceValue)}matches(e){const t=oi.comparator(e.key,this.key);return this.matchesComparison(t)}}class kr extends fr{constructor(e,t){super(e,"in",t),this.keys=Ar("in",t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}}class Cr extends fr{constructor(e,t){super(e,"not-in",t),this.keys=Ar("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}}function Ar(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map((e=>oi.fromName(e.referenceValue)))}class Sr extends fr{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return er(t)&&Ki(t.arrayValue,this.value)}}class Tr extends fr{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&Ki(this.value.arrayValue,t)}}class Ir extends fr{constructor(e,t){super(e,"not-in",t)}matches(e){if(Ki(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&!Ki(this.value.arrayValue,t)}}class Dr extends fr{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!er(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>Ki(this.value.arrayValue,e)))}}class Nr{constructor(e,t=null,n=[],s=[],i=null,r=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=s,this.limit=i,this.startAt=r,this.endAt=o,this.dt=null}}function Rr(e,t=null,n=[],s=[],i=null,r=null,o=null){return new Nr(e,t,n,s,i,r,o)}function Or(e){const t=Us(e);if(null===t.dt){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map((e=>vr(e))).join(","),e+="|ob:",e+=t.orderBy.map((e=>function(e){return e.field.canonicalString()+e.dir}(e))).join(","),_i(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((e=>Yi(e))).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((e=>Yi(e))).join(",")),t.dt=e}return t.dt}function Lr(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!dr(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!wr(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!lr(e.startAt,t.startAt)&&lr(e.endAt,t.endAt)}function Pr(e){return oi.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}class Mr{constructor(e,t=null,n=[],s=[],i=null,r="F",o=null,a=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=s,this.limit=i,this.limitType=r,this.startAt=o,this.endAt=a,this.wt=null,this._t=null,this.startAt,this.endAt}}function xr(e,t,n,s,i,r,o,a){return new Mr(e,t,n,s,i,r,o,a)}function Fr(e){return new Mr(e)}function Ur(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function Vr(e){return e.explicitOrderBy.length>0?e.explicitOrderBy[0].field:null}function jr(e){for(const t of e.filters){const e=t.getFirstInequalityField();if(null!==e)return e}return null}function Br(e){return null!==e.collectionGroup}function qr(e){const t=Us(e);if(null===t.wt){t.wt=[];const e=jr(t),n=Vr(t);if(null!==e&&null===n)e.isKeyField()||t.wt.push(new hr(e)),t.wt.push(new hr(ri.keyField(),"asc"));else{let e=!1;for(const n of t.explicitOrderBy)t.wt.push(n),n.field.isKeyField()&&(e=!0);if(!e){const e=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc";t.wt.push(new hr(ri.keyField(),e))}}}return t.wt}function $r(e){const t=Us(e);if(!t._t)if("F"===t.limitType)t._t=Rr(t.path,t.collectionGroup,qr(t),t.filters,t.limit,t.startAt,t.endAt);else{const e=[];for(const n of qr(t)){const t="desc"===n.dir?"asc":"desc";e.push(new hr(n.field,t))}const n=t.endAt?new cr(t.endAt.position,t.endAt.inclusive):null,s=t.startAt?new cr(t.startAt.position,t.startAt.inclusive):null;t._t=Rr(t.path,t.collectionGroup,e,t.filters,t.limit,n,s)}return t._t}function zr(e,t){t.getFirstInequalityField(),jr(e);const n=e.filters.concat([t]);return new Mr(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function Hr(e,t,n){return new Mr(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function Gr(e,t){return Lr($r(e),$r(t))&&e.limitType===t.limitType}function Kr(e){return`${Or($r(e))}|lt:${e.limitType}`}function Wr(e){return`Query(target=${function(e){let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map((e=>Er(e))).join(", ")}]`),_i(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map((e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e))).join(", ")}]`),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((e=>Yi(e))).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((e=>Yi(e))).join(",")),`Target(${t})`}($r(e))}; limitType=${e.limitType})`}function Qr(e,t){return t.isFoundDocument()&&function(e,t){const n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):oi.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of qr(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(const n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){const s=ur(e,t,n);return e.inclusive?s<=0:s<0}(e.startAt,qr(e),t))&&!(e.endAt&&!function(e,t,n){const s=ur(e,t,n);return e.inclusive?s>=0:s>0}(e.endAt,qr(e),t))}(e,t)}function Yr(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function Xr(e){return(t,n)=>{let s=!1;for(const i of qr(e)){const e=Jr(i,t,n);if(0!==e)return e;s=s||i.field.isKeyField()}return 0}}function Jr(e,t,n){const s=e.field.isKeyField()?oi.comparator(t.key,n.key):function(e,t,n){const s=t.data.field(e),i=n.data.field(e);return null!==s&&null!==i?Wi(s,i):xs()}(e.field,t,n);switch(e.dir){case"asc":return s;case"desc":return-1*s;default:return xs()}}class Zr{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(void 0!==n)for(const[t,s]of n)if(this.equalsFn(t,e))return s}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),s=this.inner[n];if(void 0===s)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<s.length;n++)if(this.equalsFn(s[n][0],e))return void(s[n]=[e,t]);s.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let s=0;s<n.length;s++)if(this.equalsFn(n[s][0],e))return 1===n.length?delete this.inner[t]:n.splice(s,1),this.innerSize--,!0;return!1}forEach(e){Ai(this.inner,((t,n)=>{for(const[t,s]of n)e(t,s)}))}isEmpty(){return Si(this.inner)}size(){return this.innerSize}}const eo=new Ti(oi.comparator);function to(){return eo}const no=new Ti(oi.comparator);function so(...e){let t=no;for(const n of e)t=t.insert(n.key,n);return t}function io(e){let t=no;return e.forEach(((e,n)=>t=t.insert(e,n.overlayedDocument))),t}function ro(){return ao()}function oo(){return ao()}function ao(){return new Zr((e=>e.toString()),((e,t)=>e.isEqual(t)))}new Ti(oi.comparator);const co=new Ni(oi.comparator);function uo(...e){let t=co;for(const n of e)t=t.add(n);return t}const lo=new Ni(Js);function ho(){return lo}function po(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:vi(t)?"-0":t}}function fo(e){return{integerValue:""+e}}function mo(e,t){return wi(t)?fo(t):po(e,t)}class go{constructor(){this._=void 0}}function yo(e,t,n){return e instanceof wo?function(e,t){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&Vi(t)&&(t=ji(t)),t&&(n.fields.__previous_value__=t),{mapValue:n}}(n,t):e instanceof Eo?bo(e,t):e instanceof ko?Co(e,t):function(e,t){const n=vo(e,t),s=So(n)+So(e.gt);return Zi(n)&&Zi(e.gt)?fo(s):po(e.serializer,s)}(e,t)}function _o(e,t,n){return e instanceof Eo?bo(e,t):e instanceof ko?Co(e,t):n}function vo(e,t){return e instanceof Ao?Zi(n=t)||function(e){return!!e&&"doubleValue"in e}(n)?t:{integerValue:0}:null;var n}class wo extends go{}class Eo extends go{constructor(e){super(),this.elements=e}}function bo(e,t){const n=To(t);for(const t of e.elements)n.some((e=>Gi(e,t)))||n.push(t);return{arrayValue:{values:n}}}class ko extends go{constructor(e){super(),this.elements=e}}function Co(e,t){let n=To(t);for(const t of e.elements)n=n.filter((e=>!Gi(e,t)));return{arrayValue:{values:n}}}class Ao extends go{constructor(e,t){super(),this.serializer=e,this.gt=t}}function So(e){return Fi(e.integerValue||e.doubleValue)}function To(e){return er(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Io{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Io}static exists(e){return new Io(void 0,e)}static updateTime(e){return new Io(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Do(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class No{}function Ro(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new jo(e.key,Io.none()):new Mo(e.key,e.data,Io.none());{const n=e.data,s=or.empty();let i=new Ni(ri.comparator);for(let e of t.fields)if(!i.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?s.delete(e):s.set(e,t),i=i.add(e)}return new xo(e.key,s,new Oi(i.toArray()),Io.none())}}function Oo(e,t,n){e instanceof Mo?function(e,t,n){const s=e.value.clone(),i=Uo(e.fieldTransforms,t,n.transformResults);s.setAll(i),t.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(e,t,n):e instanceof xo?function(e,t,n){if(!Do(e.precondition,t))return void t.convertToUnknownDocument(n.version);const s=Uo(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(Fo(e)),i.setAll(s),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function Lo(e,t,n,s){return e instanceof Mo?function(e,t,n,s){if(!Do(e.precondition,t))return n;const i=e.value.clone(),r=Vo(e.fieldTransforms,s,t);return i.setAll(r),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,s):e instanceof xo?function(e,t,n,s){if(!Do(e.precondition,t))return n;const i=Vo(e.fieldTransforms,s,t),r=t.data;return r.setAll(Fo(e)),r.setAll(i),t.convertToFoundDocument(t.version,r).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,s):function(e,t,n){return Do(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function Po(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Zs(e,t,((e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Eo&&t instanceof Eo||e instanceof ko&&t instanceof ko?Zs(e.elements,t.elements,Gi):e instanceof Ao&&t instanceof Ao?Gi(e.gt,t.gt):e instanceof wo&&t instanceof wo}(e.transform,t.transform)}(e,t)))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class Mo extends No{constructor(e,t,n,s=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class xo extends No{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 Fo(e){const t=new Map;return e.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const s=e.data.field(n);t.set(n,s)}})),t}function Uo(e,t,n){const s=new Map;Fs(e.length===n.length);for(let i=0;i<n.length;i++){const r=e[i],o=r.transform,a=t.data.field(r.field);s.set(r.field,_o(o,a,n[i]))}return s}function Vo(e,t,n){const s=new Map;for(const i of e){const e=i.transform,r=n.data.field(i.field);s.set(i.field,yo(e,r,t))}return s}class jo extends No{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Bo{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 t=0;t<this.mutations.length;t++){const s=this.mutations[t];s.key.isEqual(e.key)&&Oo(s,e,n[t])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=Lo(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=Lo(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=oo();return this.mutations.forEach((s=>{const i=e.get(s.key),r=i.overlayedDocument;let o=this.applyToLocalView(r,i.mutatedFields);o=t.has(s.key)?null:o;const a=Ro(r,o);null!==a&&n.set(s.key,a),r.isValidDocument()||r.convertToNoDocument(ti.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),uo())}isEqual(e){return this.batchId===e.batchId&&Zs(this.mutations,e.mutations,((e,t)=>Po(e,t)))&&Zs(this.baseMutations,e.baseMutations,((e,t)=>Po(e,t)))}}class qo{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}class $o{constructor(e,t){this.count=e,this.unchangedNames=t}}var zo,Ho;function Go(e){if(void 0===e)return Ls("GRPC error has no .code"),Vs.UNKNOWN;switch(e){case zo.OK:return Vs.OK;case zo.CANCELLED:return Vs.CANCELLED;case zo.UNKNOWN:return Vs.UNKNOWN;case zo.DEADLINE_EXCEEDED:return Vs.DEADLINE_EXCEEDED;case zo.RESOURCE_EXHAUSTED:return Vs.RESOURCE_EXHAUSTED;case zo.INTERNAL:return Vs.INTERNAL;case zo.UNAVAILABLE:return Vs.UNAVAILABLE;case zo.UNAUTHENTICATED:return Vs.UNAUTHENTICATED;case zo.INVALID_ARGUMENT:return Vs.INVALID_ARGUMENT;case zo.NOT_FOUND:return Vs.NOT_FOUND;case zo.ALREADY_EXISTS:return Vs.ALREADY_EXISTS;case zo.PERMISSION_DENIED:return Vs.PERMISSION_DENIED;case zo.FAILED_PRECONDITION:return Vs.FAILED_PRECONDITION;case zo.ABORTED:return Vs.ABORTED;case zo.OUT_OF_RANGE:return Vs.OUT_OF_RANGE;case zo.UNIMPLEMENTED:return Vs.UNIMPLEMENTED;case zo.DATA_LOSS:return Vs.DATA_LOSS;default:return xs()}}(Ho=zo||(zo={}))[Ho.OK=0]="OK",Ho[Ho.CANCELLED=1]="CANCELLED",Ho[Ho.UNKNOWN=2]="UNKNOWN",Ho[Ho.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Ho[Ho.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Ho[Ho.NOT_FOUND=5]="NOT_FOUND",Ho[Ho.ALREADY_EXISTS=6]="ALREADY_EXISTS",Ho[Ho.PERMISSION_DENIED=7]="PERMISSION_DENIED",Ho[Ho.UNAUTHENTICATED=16]="UNAUTHENTICATED",Ho[Ho.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Ho[Ho.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Ho[Ho.ABORTED=10]="ABORTED",Ho[Ho.OUT_OF_RANGE=11]="OUT_OF_RANGE",Ho[Ho.UNIMPLEMENTED=12]="UNIMPLEMENTED",Ho[Ho.INTERNAL=13]="INTERNAL",Ho[Ho.UNAVAILABLE=14]="UNAVAILABLE",Ho[Ho.DATA_LOSS=15]="DATA_LOSS";class Ko{constructor(){this.onExistenceFilterMismatchCallbacks=new Map}static get instance(){return Wo}static getOrCreateInstance(){return null===Wo&&(Wo=new Ko),Wo}onExistenceFilterMismatch(e){const t=Symbol();return this.onExistenceFilterMismatchCallbacks.set(t,e),()=>this.onExistenceFilterMismatchCallbacks.delete(t)}notifyOnExistenceFilterMismatch(e){this.onExistenceFilterMismatchCallbacks.forEach((t=>t(e)))}}let Wo=null;function Qo(){return new TextEncoder}const Yo=new Ss([4294967295,4294967295],0);function Xo(e){const t=Qo().encode(e),n=new As;return n.update(t),new Uint8Array(n.digest())}function Jo(e){const t=new DataView(e.buffer),n=t.getUint32(0,!0),s=t.getUint32(4,!0),i=t.getUint32(8,!0),r=t.getUint32(12,!0);return[new Ss([n,s],0),new Ss([i,r],0)]}class Zo{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new ea(`Invalid padding: ${t}`);if(n<0)throw new ea(`Invalid hash count: ${n}`);if(e.length>0&&0===this.hashCount)throw new ea(`Invalid hash count: ${n}`);if(0===e.length&&0!==t)throw new ea(`Invalid padding when bitmap length is 0: ${t}`);this.It=8*e.length-t,this.Tt=Ss.fromNumber(this.It)}Et(e,t,n){let s=e.add(t.multiply(Ss.fromNumber(n)));return 1===s.compare(Yo)&&(s=new Ss([s.getBits(0),s.getBits(1)],0)),s.modulo(this.Tt).toNumber()}At(e){return 0!=(this.bitmap[Math.floor(e/8)]&1<<e%8)}vt(e){if(0===this.It)return!1;const t=Xo(e),[n,s]=Jo(t);for(let e=0;e<this.hashCount;e++){const t=this.Et(n,s,e);if(!this.At(t))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)),r=new Zo(i,s,t);return n.forEach((e=>r.insert(e))),r}insert(e){if(0===this.It)return;const t=Xo(e),[n,s]=Jo(t);for(let e=0;e<this.hashCount;e++){const t=this.Et(n,s,e);this.Rt(t)}}Rt(e){const t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}}class ea extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}class ta{constructor(e,t,n,s,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=s,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,t,n){const s=new Map;return s.set(e,na.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new ta(ti.min(),s,new Ti(Js),to(),uo())}}class na{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 na(n,t,uo(),uo(),uo())}}class sa{constructor(e,t,n,s){this.Pt=e,this.removedTargetIds=t,this.key=n,this.bt=s}}class ia{constructor(e,t){this.targetId=e,this.Vt=t}}class ra{constructor(e,t,n=Pi.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=s}}class oa{constructor(){this.St=0,this.Dt=ua(),this.Ct=Pi.EMPTY_BYTE_STRING,this.xt=!1,this.Nt=!0}get current(){return this.xt}get resumeToken(){return this.Ct}get kt(){return 0!==this.St}get Mt(){return this.Nt}$t(e){e.approximateByteSize()>0&&(this.Nt=!0,this.Ct=e)}Ot(){let e=uo(),t=uo(),n=uo();return this.Dt.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:xs()}})),new na(this.Ct,this.xt,e,t,n)}Ft(){this.Nt=!1,this.Dt=ua()}Bt(e,t){this.Nt=!0,this.Dt=this.Dt.insert(e,t)}Lt(e){this.Nt=!0,this.Dt=this.Dt.remove(e)}qt(){this.St+=1}Ut(){this.St-=1}Kt(){this.Nt=!0,this.xt=!0}}class aa{constructor(e){this.Gt=e,this.Qt=new Map,this.jt=to(),this.zt=ca(),this.Wt=new Ti(Js)}Ht(e){for(const t of e.Pt)e.bt&&e.bt.isFoundDocument()?this.Jt(t,e.bt):this.Yt(t,e.key,e.bt);for(const t of e.removedTargetIds)this.Yt(t,e.key,e.bt)}Xt(e){this.forEachTarget(e,(t=>{const n=this.Zt(t);switch(e.state){case 0:this.te(t)&&n.$t(e.resumeToken);break;case 1:n.Ut(),n.kt||n.Ft(),n.$t(e.resumeToken);break;case 2:n.Ut(),n.kt||this.removeTarget(t);break;case 3:this.te(t)&&(n.Kt(),n.$t(e.resumeToken));break;case 4:this.te(t)&&(this.ee(t),n.$t(e.resumeToken));break;default:xs()}}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Qt.forEach(((e,n)=>{this.te(n)&&t(n)}))}ne(e){var t;const n=e.targetId,s=e.Vt.count,i=this.se(n);if(i){const r=i.target;if(Pr(r))if(0===s){const e=new oi(r.path);this.Yt(n,e,ar.newNoDocument(e,ti.min()))}else Fs(1===s);else{const i=this.ie(n);if(i!==s){const s=this.re(e,i);if(0!==s){this.ee(n);const e=2===s?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Wt=this.Wt.insert(n,e)}null===(t=Ko.instance)||void 0===t||t.notifyOnExistenceFilterMismatch(function(e,t,n){var s,i,r,o,a,c;const u={localCacheCount:t,existenceFilterCount:n.count},l=n.unchangedNames;return l&&(u.bloomFilter={applied:0===e,hashCount:null!==(s=null==l?void 0:l.hashCount)&&void 0!==s?s:0,bitmapLength:null!==(o=null===(r=null===(i=null==l?void 0:l.bits)||void 0===i?void 0:i.bitmap)||void 0===r?void 0:r.length)&&void 0!==o?o:0,padding:null!==(c=null===(a=null==l?void 0:l.bits)||void 0===a?void 0:a.padding)&&void 0!==c?c:0}),u}(s,i,e.Vt))}}}}re(e,t){const{unchangedNames:n,count:s}=e.Vt;if(!n||!n.bits)return 1;const{bits:{bitmap:i="",padding:r=0},hashCount:o=0}=n;let a,c;try{a=Ui(i).toUint8Array()}catch(e){if(e instanceof Li)return Ps("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),1;throw e}try{c=new Zo(a,r,o)}catch(e){return Ps(e instanceof ea?"BloomFilter error: ":"Applying bloom filter failed: ",e),1}return 0===c.It?1:s!==t-this.oe(e.targetId,c)?2:0}oe(e,t){const n=this.Gt.getRemoteKeysForTarget(e);let s=0;return n.forEach((n=>{const i=this.Gt.ue(),r=`projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;t.vt(r)||(this.Yt(e,n,null),s++)})),s}ce(e){const t=new Map;this.Qt.forEach(((n,s)=>{const i=this.se(s);if(i){if(n.current&&Pr(i.target)){const t=new oi(i.target.path);null!==this.jt.get(t)||this.ae(s,t)||this.Yt(s,t,ar.newNoDocument(t,e))}n.Mt&&(t.set(s,n.Ot()),n.Ft())}}));let n=uo();this.zt.forEach(((e,t)=>{let s=!0;t.forEachWhile((e=>{const t=this.se(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(s=!1,!1)})),s&&(n=n.add(e))})),this.jt.forEach(((t,n)=>n.setReadTime(e)));const s=new ta(e,t,this.Wt,this.jt,n);return this.jt=to(),this.zt=ca(),this.Wt=new Ti(Js),s}Jt(e,t){if(!this.te(e))return;const n=this.ae(e,t.key)?2:0;this.Zt(e).Bt(t.key,n),this.jt=this.jt.insert(t.key,t),this.zt=this.zt.insert(t.key,this.he(t.key).add(e))}Yt(e,t,n){if(!this.te(e))return;const s=this.Zt(e);this.ae(e,t)?s.Bt(t,1):s.Lt(t),this.zt=this.zt.insert(t,this.he(t).delete(e)),n&&(this.jt=this.jt.insert(t,n))}removeTarget(e){this.Qt.delete(e)}ie(e){const t=this.Zt(e).Ot();return this.Gt.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}qt(e){this.Zt(e).qt()}Zt(e){let t=this.Qt.get(e);return t||(t=new oa,this.Qt.set(e,t)),t}he(e){let t=this.zt.get(e);return t||(t=new Ni(Js),this.zt=this.zt.insert(e,t)),t}te(e){const t=null!==this.se(e);return t||Os("WatchChangeAggregator","Detected inactive target",e),t}se(e){const t=this.Qt.get(e);return t&&t.kt?null:this.Gt.le(e)}ee(e){this.Qt.set(e,new oa),this.Gt.getRemoteKeysForTarget(e).forEach((t=>{this.Yt(e,t,null)}))}ae(e,t){return this.Gt.getRemoteKeysForTarget(e).has(t)}}function ca(){return new Ti(oi.comparator)}function ua(){return new Ti(oi.comparator)}const la={asc:"ASCENDING",desc:"DESCENDING"},ha={"<":"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"},da={and:"AND",or:"OR"};class pa{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function fa(e,t){return e.useProto3Json||_i(t)?t:{value:t}}function ma(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function ga(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function ya(e){return Fs(!!e),ti.fromTimestamp(function(e){const t=xi(e);return new ei(t.seconds,t.nanos)}(e))}function _a(e,t){return function(e){return new si(["projects",e.projectId,"databases",e.database])}(e).child("documents").child(t).canonicalString()}function va(e){const t=si.fromString(e);return Fs(Ma(t)),t}function wa(e,t){const n=va(t);if(n.get(1)!==e.databaseId.projectId)throw new js(Vs.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new js(Vs.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new oi(Ca(n))}function Ea(e,t){return _a(e.databaseId,t)}function ba(e){const t=va(e);return 4===t.length?si.emptyPath():Ca(t)}function ka(e){return new si(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Ca(e){return Fs(e.length>4&&"documents"===e.get(4)),e.popFirst(5)}function Aa(e,t){return{documents:[Ea(e,t.path)]}}function Sa(e,t){const n={structuredQuery:{}},s=t.path;null!==t.collectionGroup?(n.parent=Ea(e,s),n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(n.parent=Ea(e,s.popLast()),n.structuredQuery.from=[{collectionId:s.lastSegment()}]);const i=function(e){if(0!==e.length)return Pa(mr.create(e,"and"))}(t.filters);i&&(n.structuredQuery.where=i);const r=function(e){if(0!==e.length)return e.map((e=>function(e){return{field:Oa(e.field),direction:Da(e.dir)}}(e)))}(t.orderBy);r&&(n.structuredQuery.orderBy=r);const o=fa(e,t.limit);var a;return null!==o&&(n.structuredQuery.limit=o),t.startAt&&(n.structuredQuery.startAt={before:(a=t.startAt).inclusive,values:a.position}),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),n}function Ta(e){let t=ba(e.parent);const n=e.structuredQuery,s=n.from?n.from.length:0;let i=null;if(s>0){Fs(1===s);const e=n.from[0];e.allDescendants?i=e.collectionId:t=t.child(e.collectionId)}let r=[];n.where&&(r=function(e){const t=Ia(e);return t instanceof mr&&yr(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((e=>function(e){return new hr(La(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,_i(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){const t=!!e.before,n=e.values||[];return new cr(n,t)}(n.startAt));let u=null;return n.endAt&&(u=function(e){const t=!e.before,n=e.values||[];return new cr(n,t)}(n.endAt)),xr(t,i,o,r,a,"F",c,u)}function Ia(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=La(e.unaryFilter.field);return fr.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=La(e.unaryFilter.field);return fr.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=La(e.unaryFilter.field);return fr.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=La(e.unaryFilter.field);return fr.create(i,"!=",{nullValue:"NULL_VALUE"});default:return xs()}}(e):void 0!==e.fieldFilter?function(e){return fr.create(La(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return xs()}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return mr.create(e.compositeFilter.filters.map((e=>Ia(e))),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return xs()}}(e.compositeFilter.op))}(e):xs()}function Da(e){return la[e]}function Na(e){return ha[e]}function Ra(e){return da[e]}function Oa(e){return{fieldPath:e.canonicalString()}}function La(e){return ri.fromServerFormat(e.fieldPath)}function Pa(e){return e instanceof fr?function(e){if("=="===e.op){if(nr(e.value))return{unaryFilter:{field:Oa(e.field),op:"IS_NAN"}};if(tr(e.value))return{unaryFilter:{field:Oa(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(nr(e.value))return{unaryFilter:{field:Oa(e.field),op:"IS_NOT_NAN"}};if(tr(e.value))return{unaryFilter:{field:Oa(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Oa(e.field),op:Na(e.op),value:e.value}}}(e):e instanceof mr?function(e){const t=e.getFilters().map((e=>Pa(e)));return 1===t.length?t[0]:{compositeFilter:{op:Ra(e.op),filters:t}}}(e):xs()}function Ma(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}class xa{constructor(e,t,n,s,i=ti.min(),r=ti.min(),o=Pi.EMPTY_BYTE_STRING,a=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=r,this.resumeToken=o,this.expectedCount=a}withSequenceNumber(e){return new xa(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new xa(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new xa(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new xa(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class Fa{constructor(e){this.fe=e}}function Ua(e){const t=Ta({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?Hr(t,t.limit,"L"):t}class Va{constructor(){}_e(e,t){this.me(e,t),t.ge()}me(e,t){if("nullValue"in e)this.ye(t,5);else if("booleanValue"in e)this.ye(t,10),t.pe(e.booleanValue?1:0);else if("integerValue"in e)this.ye(t,15),t.pe(Fi(e.integerValue));else if("doubleValue"in e){const n=Fi(e.doubleValue);isNaN(n)?this.ye(t,13):(this.ye(t,15),vi(n)?t.pe(0):t.pe(n))}else if("timestampValue"in e){const n=e.timestampValue;this.ye(t,20),"string"==typeof n?t.Ie(n):(t.Ie(`${n.seconds||""}`),t.pe(n.nanos||0))}else if("stringValue"in e)this.Te(e.stringValue,t),this.Ee(t);else if("bytesValue"in e)this.ye(t,30),t.Ae(Ui(e.bytesValue)),this.Ee(t);else if("referenceValue"in e)this.ve(e.referenceValue,t);else if("geoPointValue"in e){const n=e.geoPointValue;this.ye(t,45),t.pe(n.latitude||0),t.pe(n.longitude||0)}else"mapValue"in e?rr(e)?this.ye(t,Number.MAX_SAFE_INTEGER):(this.Re(e.mapValue,t),this.Ee(t)):"arrayValue"in e?(this.Pe(e.arrayValue,t),this.Ee(t)):xs()}Te(e,t){this.ye(t,25),this.be(e,t)}be(e,t){t.Ie(e)}Re(e,t){const n=e.fields||{};this.ye(t,55);for(const e of Object.keys(n))this.Te(e,t),this.me(n[e],t)}Pe(e,t){const n=e.values||[];this.ye(t,50);for(const e of n)this.me(e,t)}ve(e,t){this.ye(t,37),oi.fromName(e).path.forEach((e=>{this.ye(t,60),this.be(e,t)}))}ye(e,t){e.pe(t)}Ee(e){e.pe(2)}}Va.Ve=new Va;class ja{constructor(){this.rn=new Ba}addToCollectionParentIndex(e,t){return this.rn.add(t),mi.resolve()}getCollectionParents(e,t){return mi.resolve(this.rn.getEntries(t))}addFieldIndex(e,t){return mi.resolve()}deleteFieldIndex(e,t){return mi.resolve()}getDocumentsMatchingTarget(e,t){return mi.resolve(null)}getIndexType(e,t){return mi.resolve(0)}getFieldIndexes(e,t){return mi.resolve([])}getNextCollectionGroupToUpdate(e){return mi.resolve(null)}getMinOffset(e,t){return mi.resolve(li.min())}getMinOffsetFromCollectionGroup(e,t){return mi.resolve(li.min())}updateCollectionGroup(e,t,n){return mi.resolve()}updateIndexEntries(e,t){return mi.resolve()}}class Ba{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),s=this.index[t]||new Ni(si.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 Ni(si.comparator)).toArray()}}new Uint8Array(0);class qa{constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}static withCacheSize(e){return new qa(e,qa.DEFAULT_COLLECTION_PERCENTILE,qa.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}qa.DEFAULT_COLLECTION_PERCENTILE=10,qa.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,qa.DEFAULT=new qa(41943040,qa.DEFAULT_COLLECTION_PERCENTILE,qa.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),qa.DISABLED=new qa(-1,0,0);class $a{constructor(e){this.Nn=e}next(){return this.Nn+=2,this.Nn}static kn(){return new $a(0)}static Mn(){return new $a(-1)}}class za{constructor(){this.changes=new Zr((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,ar.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?mi.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)}assertNotApplied(){}}class Ha{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class Ga{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((e=>(null!==n&&Lo(n.mutation,e,Oi.empty(),ei.now()),e)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.getLocalViewOfDocuments(e,t,uo()).next((()=>t))))}getLocalViewOfDocuments(e,t,n=uo()){const s=ro();return this.populateOverlays(e,s,t).next((()=>this.computeViews(e,t,s,n).next((e=>{let t=so();return e.forEach(((e,n)=>{t=t.insert(e,n.overlayedDocument)})),t}))))}getOverlayedDocuments(e,t){const n=ro();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,uo())))}populateOverlays(e,t,n){const s=[];return n.forEach((e=>{t.has(e)||s.push(e)})),this.documentOverlayCache.getOverlays(e,s).next((e=>{e.forEach(((e,n)=>{t.set(e,n)}))}))}computeViews(e,t,n,s){let i=to();const r=ao(),o=ao();return t.forEach(((e,t)=>{const o=n.get(t.key);s.has(t.key)&&(void 0===o||o.mutation instanceof xo)?i=i.insert(t.key,t):void 0!==o?(r.set(t.key,o.mutation.getFieldMask()),Lo(o.mutation,t,o.mutation.getFieldMask(),ei.now())):r.set(t.key,Oi.empty())})),this.recalculateAndSaveOverlays(e,i).next((e=>(e.forEach(((e,t)=>r.set(e,t))),t.forEach(((e,t)=>{var n;return o.set(e,new Ha(t,null!==(n=r.get(e))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(e,t){const n=ao();let s=new Ti(((e,t)=>e-t)),i=uo();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((e=>{for(const i of e)i.keys().forEach((e=>{const r=t.get(e);if(null===r)return;let o=n.get(e)||Oi.empty();o=i.applyToLocalView(r,o),n.set(e,o);const a=(s.get(i.batchId)||uo()).add(e);s=s.insert(i.batchId,a)}))})).next((()=>{const r=[],o=s.getReverseIterator();for(;o.hasNext();){const s=o.getNext(),a=s.key,c=s.value,u=oo();c.forEach((e=>{if(!i.has(e)){const s=Ro(t.get(e),n.get(e));null!==s&&u.set(e,s),i=i.add(e)}})),r.push(this.documentOverlayCache.saveOverlays(e,a,u))}return mi.waitFor(r)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.recalculateAndSaveOverlays(e,t)))}getDocumentsMatchingQuery(e,t,n){return function(e){return oi.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Br(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n):this.getDocumentsMatchingCollectionQuery(e,t,n)}getNextDocuments(e,t,n,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,s).next((i=>{const r=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,s-i.size):mi.resolve(ro());let o=-1,a=i;return r.next((t=>mi.forEach(t,((t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(t)?mi.resolve():this.remoteDocumentCache.getEntry(e,t).next((e=>{a=a.insert(t,e)}))))).next((()=>this.populateOverlays(e,t,i))).next((()=>this.computeViews(e,a,t,uo()))).next((e=>({batchId:o,changes:io(e)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new oi(t)).next((e=>{let t=so();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}getDocumentsMatchingCollectionGroupQuery(e,t,n){const s=t.collectionGroup;let i=so();return this.indexManager.getCollectionParents(e,s).next((r=>mi.forEach(r,(r=>{const o=function(e,t){return new Mr(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,r.child(s));return this.getDocumentsMatchingCollectionQuery(e,o,n).next((e=>{e.forEach(((e,t)=>{i=i.insert(e,t)}))}))})).next((()=>i))))}getDocumentsMatchingCollectionQuery(e,t,n){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((i=>(s=i,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,s)))).next((e=>{s.forEach(((t,n)=>{const s=n.getKey();null===e.get(s)&&(e=e.insert(s,ar.newInvalidDocument(s)))}));let n=so();return e.forEach(((e,i)=>{const r=s.get(e);void 0!==r&&Lo(r.mutation,i,Oi.empty(),ei.now()),Qr(t,i)&&(n=n.insert(e,i))})),n}))}}class Ka{constructor(e){this.serializer=e,this.cs=new Map,this.hs=new Map}getBundleMetadata(e,t){return mi.resolve(this.cs.get(t))}saveBundleMetadata(e,t){var n;return this.cs.set(t.id,{id:(n=t).id,version:n.version,createTime:ya(n.createTime)}),mi.resolve()}getNamedQuery(e,t){return mi.resolve(this.hs.get(t))}saveNamedQuery(e,t){return this.hs.set(t.name,function(e){return{name:e.name,query:Ua(e.bundledQuery),readTime:ya(e.readTime)}}(t)),mi.resolve()}}class Wa{constructor(){this.overlays=new Ti(oi.comparator),this.ls=new Map}getOverlay(e,t){return mi.resolve(this.overlays.get(t))}getOverlays(e,t){const n=ro();return mi.forEach(t,(t=>this.getOverlay(e,t).next((e=>{null!==e&&n.set(t,e)})))).next((()=>n))}saveOverlays(e,t,n){return n.forEach(((n,s)=>{this.we(e,t,s)})),mi.resolve()}removeOverlaysForBatchId(e,t,n){const s=this.ls.get(n);return void 0!==s&&(s.forEach((e=>this.overlays=this.overlays.remove(e))),this.ls.delete(n)),mi.resolve()}getOverlaysForCollection(e,t,n){const s=ro(),i=t.length+1,r=new oi(t.child("")),o=this.overlays.getIteratorFrom(r);for(;o.hasNext();){const e=o.getNext().value,r=e.getKey();if(!t.isPrefixOf(r.path))break;r.path.length===i&&e.largestBatchId>n&&s.set(e.getKey(),e)}return mi.resolve(s)}getOverlaysForCollectionGroup(e,t,n,s){let i=new Ti(((e,t)=>e-t));const r=this.overlays.getIterator();for(;r.hasNext();){const e=r.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=i.get(e.largestBatchId);null===t&&(t=ro(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const o=ro(),a=i.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((e,t)=>o.set(e,t))),!(o.size()>=s)););return mi.resolve(o)}we(e,t,n){const s=this.overlays.get(n.key);if(null!==s){const e=this.ls.get(s.largestBatchId).delete(n.key);this.ls.set(s.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new qo(t,n));let i=this.ls.get(t);void 0===i&&(i=uo(),this.ls.set(t,i)),this.ls.set(t,i.add(n.key))}}class Qa{constructor(){this.fs=new Ni(Ya.ds),this.ws=new Ni(Ya._s)}isEmpty(){return this.fs.isEmpty()}addReference(e,t){const n=new Ya(e,t);this.fs=this.fs.add(n),this.ws=this.ws.add(n)}gs(e,t){e.forEach((e=>this.addReference(e,t)))}removeReference(e,t){this.ys(new Ya(e,t))}ps(e,t){e.forEach((e=>this.removeReference(e,t)))}Is(e){const t=new oi(new si([])),n=new Ya(t,e),s=new Ya(t,e+1),i=[];return this.ws.forEachInRange([n,s],(e=>{this.ys(e),i.push(e.key)})),i}Ts(){this.fs.forEach((e=>this.ys(e)))}ys(e){this.fs=this.fs.delete(e),this.ws=this.ws.delete(e)}Es(e){const t=new oi(new si([])),n=new Ya(t,e),s=new Ya(t,e+1);let i=uo();return this.ws.forEachInRange([n,s],(e=>{i=i.add(e.key)})),i}containsKey(e){const t=new Ya(e,0),n=this.fs.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class Ya{constructor(e,t){this.key=e,this.As=t}static ds(e,t){return oi.comparator(e.key,t.key)||Js(e.As,t.As)}static _s(e,t){return Js(e.As,t.As)||oi.comparator(e.key,t.key)}}class Xa{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.vs=1,this.Rs=new Ni(Ya.ds)}checkEmpty(e){return mi.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,s){const i=this.vs;this.vs++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const r=new Bo(i,t,n,s);this.mutationQueue.push(r);for(const t of s)this.Rs=this.Rs.add(new Ya(t.key,i)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return mi.resolve(r)}lookupMutationBatch(e,t){return mi.resolve(this.Ps(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,s=this.bs(n),i=s<0?0:s;return mi.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return mi.resolve(0===this.mutationQueue.length?-1:this.vs-1)}getAllMutationBatches(e){return mi.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new Ya(t,0),s=new Ya(t,Number.POSITIVE_INFINITY),i=[];return this.Rs.forEachInRange([n,s],(e=>{const t=this.Ps(e.As);i.push(t)})),mi.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new Ni(Js);return t.forEach((e=>{const t=new Ya(e,0),s=new Ya(e,Number.POSITIVE_INFINITY);this.Rs.forEachInRange([t,s],(e=>{n=n.add(e.As)}))})),mi.resolve(this.Vs(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,s=n.length+1;let i=n;oi.isDocumentKey(i)||(i=i.child(""));const r=new Ya(new oi(i),0);let o=new Ni(Js);return this.Rs.forEachWhile((e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===s&&(o=o.add(e.As)),!0)}),r),mi.resolve(this.Vs(o))}Vs(e){const t=[];return e.forEach((e=>{const n=this.Ps(e);null!==n&&t.push(n)})),t}removeMutationBatch(e,t){Fs(0===this.Ss(t.batchId,"removed")),this.mutationQueue.shift();let n=this.Rs;return mi.forEach(t.mutations,(s=>{const i=new Ya(s.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)})).next((()=>{this.Rs=n}))}Cn(e){}containsKey(e,t){const n=new Ya(t,0),s=this.Rs.firstAfterOrEqual(n);return mi.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,mi.resolve()}Ss(e,t){return this.bs(e)}bs(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Ps(e){const t=this.bs(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class Ja{constructor(e){this.Ds=e,this.docs=new Ti(oi.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,r=this.Ds(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:r}),this.size+=r-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 mi.resolve(n?n.document.mutableCopy():ar.newInvalidDocument(t))}getEntries(e,t){let n=to();return t.forEach((e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():ar.newInvalidDocument(e))})),mi.resolve(n)}getDocumentsMatchingQuery(e,t,n,s){let i=to();const r=t.path,o=new oi(r.child("")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){const{key:e,value:{document:o}}=a.getNext();if(!r.isPrefixOf(e.path))break;e.path.length>r.length+1||hi(ui(o),n)<=0||(s.has(o.key)||Qr(t,o))&&(i=i.insert(o.key,o.mutableCopy()))}return mi.resolve(i)}getAllFromCollectionGroup(e,t,n,s){xs()}Cs(e,t){return mi.forEach(this.docs,(e=>t(e)))}newChangeBuffer(e){return new Za(this)}getSize(e){return mi.resolve(this.size)}}class Za extends za{constructor(e){super(),this.os=e}applyChanges(e){const t=[];return this.changes.forEach(((n,s)=>{s.isValidDocument()?t.push(this.os.addEntry(e,s)):this.os.removeEntry(n)})),mi.waitFor(t)}getFromCache(e,t){return this.os.getEntry(e,t)}getAllFromCache(e,t){return this.os.getEntries(e,t)}}class ec{constructor(e){this.persistence=e,this.xs=new Zr((e=>Or(e)),Lr),this.lastRemoteSnapshotVersion=ti.min(),this.highestTargetId=0,this.Ns=0,this.ks=new Qa,this.targetCount=0,this.Ms=$a.kn()}forEachTarget(e,t){return this.xs.forEach(((e,n)=>t(n))),mi.resolve()}getLastRemoteSnapshotVersion(e){return mi.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return mi.resolve(this.Ns)}allocateTargetId(e){return this.highestTargetId=this.Ms.next(),mi.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Ns&&(this.Ns=t),mi.resolve()}Fn(e){this.xs.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.Ms=new $a(t),this.highestTargetId=t),e.sequenceNumber>this.Ns&&(this.Ns=e.sequenceNumber)}addTargetData(e,t){return this.Fn(t),this.targetCount+=1,mi.resolve()}updateTargetData(e,t){return this.Fn(t),mi.resolve()}removeTargetData(e,t){return this.xs.delete(t.target),this.ks.Is(t.targetId),this.targetCount-=1,mi.resolve()}removeTargets(e,t,n){let s=0;const i=[];return this.xs.forEach(((r,o)=>{o.sequenceNumber<=t&&null===n.get(o.targetId)&&(this.xs.delete(r),i.push(this.removeMatchingKeysForTargetId(e,o.targetId)),s++)})),mi.waitFor(i).next((()=>s))}getTargetCount(e){return mi.resolve(this.targetCount)}getTargetData(e,t){const n=this.xs.get(t)||null;return mi.resolve(n)}addMatchingKeys(e,t,n){return this.ks.gs(t,n),mi.resolve()}removeMatchingKeys(e,t,n){this.ks.ps(t,n);const s=this.persistence.referenceDelegate,i=[];return s&&t.forEach((t=>{i.push(s.markPotentiallyOrphaned(e,t))})),mi.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.ks.Is(t),mi.resolve()}getMatchingKeysForTargetId(e,t){const n=this.ks.Es(t);return mi.resolve(n)}containsKey(e,t){return mi.resolve(this.ks.containsKey(t))}}class tc{constructor(e,t){this.$s={},this.overlays={},this.Os=new yi(0),this.Fs=!1,this.Fs=!0,this.referenceDelegate=e(this),this.Bs=new ec(this),this.indexManager=new ja,this.remoteDocumentCache=function(e){return new Ja(e)}((e=>this.referenceDelegate.Ls(e))),this.serializer=new Fa(t),this.qs=new Ka(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.Fs=!1,Promise.resolve()}get started(){return this.Fs}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Wa,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.$s[e.toKey()];return n||(n=new Xa(t,this.referenceDelegate),this.$s[e.toKey()]=n),n}getTargetCache(){return this.Bs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.qs}runTransaction(e,t,n){Os("MemoryPersistence","Starting transaction:",e);const s=new nc(this.Os.next());return this.referenceDelegate.Us(),n(s).next((e=>this.referenceDelegate.Ks(s).next((()=>e)))).toPromise().then((e=>(s.raiseOnCommittedEvent(),e)))}Gs(e,t){return mi.or(Object.values(this.$s).map((n=>()=>n.containsKey(e,t))))}}class nc extends pi{constructor(e){super(),this.currentSequenceNumber=e}}class sc{constructor(e){this.persistence=e,this.Qs=new Qa,this.js=null}static zs(e){return new sc(e)}get Ws(){if(this.js)return this.js;throw xs()}addReference(e,t,n){return this.Qs.addReference(n,t),this.Ws.delete(n.toString()),mi.resolve()}removeReference(e,t,n){return this.Qs.removeReference(n,t),this.Ws.add(n.toString()),mi.resolve()}markPotentiallyOrphaned(e,t){return this.Ws.add(t.toString()),mi.resolve()}removeTarget(e,t){this.Qs.Is(t.targetId).forEach((e=>this.Ws.add(e.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((e=>{e.forEach((e=>this.Ws.add(e.toString())))})).next((()=>n.removeTargetData(e,t)))}Us(){this.js=new Set}Ks(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return mi.forEach(this.Ws,(n=>{const s=oi.fromPath(n);return this.Hs(e,s).next((e=>{e||t.removeEntry(s,ti.min())}))})).next((()=>(this.js=null,t.apply(e))))}updateLimboDocument(e,t){return this.Hs(e,t).next((e=>{e?this.Ws.delete(t.toString()):this.Ws.add(t.toString())}))}Ls(e){return 0}Hs(e,t){return mi.or([()=>mi.resolve(this.Qs.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Gs(e,t)])}}class ic{constructor(e,t,n,s){this.targetId=e,this.fromCache=t,this.Fi=n,this.Bi=s}static Li(e,t){let n=uo(),s=uo();for(const e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:s=s.add(e.doc.key)}return new ic(e,t.fromCache,n,s)}}class rc{constructor(){this.qi=!1}initialize(e,t){this.Ui=e,this.indexManager=t,this.qi=!0}getDocumentsMatchingQuery(e,t,n,s){return this.Ki(e,t).next((i=>i||this.Gi(e,t,s,n))).next((n=>n||this.Qi(e,t)))}Ki(e,t){if(Ur(t))return mi.resolve(null);let n=$r(t);return this.indexManager.getIndexType(e,n).next((s=>0===s?null:(null!==t.limit&&1===s&&(t=Hr(t,null,"F"),n=$r(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next((s=>{const i=uo(...s);return this.Ui.getDocuments(e,i).next((s=>this.indexManager.getMinOffset(e,n).next((n=>{const r=this.ji(t,s);return this.zi(t,r,i,n.readTime)?this.Ki(e,Hr(t,null,"F")):this.Wi(e,r,t,n)}))))})))))}Gi(e,t,n,s){return Ur(t)||s.isEqual(ti.min())?this.Qi(e,t):this.Ui.getDocuments(e,n).next((i=>{const r=this.ji(t,i);return this.zi(t,r,n,s)?this.Qi(e,t):(Rs()<=o.in.DEBUG&&Os("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),Wr(t)),this.Wi(e,r,t,ci(s,-1)))}))}ji(e,t){let n=new Ni(Xr(e));return t.forEach(((t,s)=>{Qr(e,s)&&(n=n.add(s))})),n}zi(e,t,n,s){if(null===e.limit)return!1;if(n.size!==t.size)return!0;const i="F"===e.limitType?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}Qi(e,t){return Rs()<=o.in.DEBUG&&Os("QueryEngine","Using full collection scan to execute query:",Wr(t)),this.Ui.getDocumentsMatchingQuery(e,t,li.min())}Wi(e,t,n,s){return this.Ui.getDocumentsMatchingQuery(e,n,s).next((e=>(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}}class oc{constructor(e,t,n,s){this.persistence=e,this.Hi=t,this.serializer=s,this.Ji=new Ti(Js),this.Yi=new Zr((e=>Or(e)),Lr),this.Xi=new Map,this.Zi=e.getRemoteDocumentCache(),this.Bs=e.getTargetCache(),this.qs=e.getBundleCache(),this.tr(n)}tr(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Ga(this.Zi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Zi.setIndexManager(this.indexManager),this.Hi.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(t=>e.collect(t,this.Ji)))}}function ac(e,t,n,s){return new oc(e,t,n,s)}async function cc(e,t){const n=Us(e);return await n.persistence.runTransaction("Handle user change","readonly",(e=>{let s;return n.mutationQueue.getAllMutationBatches(e).next((i=>(s=i,n.tr(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{const i=[],r=[];let o=uo();for(const e of s){i.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}for(const e of t){r.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next((e=>({er:e,removedBatchIds:i,addedBatchIds:r})))}))}))}function uc(e){const t=Us(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",(e=>t.Bs.getLastRemoteSnapshotVersion(e)))}function lc(e,t,n){let s=uo(),i=uo();return n.forEach((e=>s=s.add(e))),t.getEntries(e,s).next((e=>{let s=to();return n.forEach(((n,r)=>{const o=e.get(n);r.isFoundDocument()!==o.isFoundDocument()&&(i=i.add(n)),r.isNoDocument()&&r.version.isEqual(ti.min())?(t.removeEntry(n,r.readTime),s=s.insert(n,r)):!o.isValidDocument()||r.version.compareTo(o.version)>0||0===r.version.compareTo(o.version)&&o.hasPendingWrites?(t.addEntry(r),s=s.insert(n,r)):Os("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",r.version)})),{nr:s,sr:i}}))}function hc(e,t){const n=Us(e);return n.persistence.runTransaction("Allocate target","readwrite",(e=>{let s;return n.Bs.getTargetData(e,t).next((i=>i?(s=i,mi.resolve(s)):n.Bs.allocateTargetId(e).next((i=>(s=new xa(t,i,"TargetPurposeListen",e.currentSequenceNumber),n.Bs.addTargetData(e,s).next((()=>s)))))))})).then((e=>{const s=n.Ji.get(e.targetId);return(null===s||e.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.Ji=n.Ji.insert(e.targetId,e),n.Yi.set(t,e.targetId)),e}))}async function dc(e,t,n){const s=Us(e),i=s.Ji.get(t),r=n?"readwrite":"readwrite-primary";try{n||await s.persistence.runTransaction("Release target",r,(e=>s.persistence.referenceDelegate.removeTarget(e,i)))}catch(e){if(!gi(e))throw e;Os("LocalStore",`Failed to update sequence numbers for target ${t}: ${e}`)}s.Ji=s.Ji.remove(t),s.Yi.delete(i.target)}function pc(e,t,n){const s=Us(e);let i=ti.min(),r=uo();return s.persistence.runTransaction("Execute query","readonly",(e=>function(e,t,n){const s=Us(e),i=s.Yi.get(n);return void 0!==i?mi.resolve(s.Ji.get(i)):s.Bs.getTargetData(t,n)}(s,e,$r(t)).next((t=>{if(t)return i=t.lastLimboFreeSnapshotVersion,s.Bs.getMatchingKeysForTargetId(e,t.targetId).next((e=>{r=e}))})).next((()=>s.Hi.getDocumentsMatchingQuery(e,t,n?i:ti.min(),n?r:uo()))).next((e=>(fc(s,Yr(t),e),{documents:e,ir:r})))))}function fc(e,t,n){let s=e.Xi.get(t)||ti.min();n.forEach(((e,t)=>{t.readTime.compareTo(s)>0&&(s=t.readTime)})),e.Xi.set(t,s)}class mc{constructor(){this.activeTargetIds=ho()}lr(e){this.activeTargetIds=this.activeTargetIds.add(e)}dr(e){this.activeTargetIds=this.activeTargetIds.delete(e)}hr(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class gc{constructor(){this.Hr=new mc,this.Jr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e){return this.Hr.lr(e),this.Jr[e]||"not-current"}updateQueryState(e,t,n){this.Jr[e]=t}removeLocalQueryTarget(e){this.Hr.dr(e)}isLocalQueryTarget(e){return this.Hr.activeTargetIds.has(e)}clearQueryState(e){delete this.Jr[e]}getAllActiveQueryTargets(){return this.Hr.activeTargetIds}isActiveQueryTarget(e){return this.Hr.activeTargetIds.has(e)}start(){return this.Hr=new mc,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class yc{Yr(e){}shutdown(){}}class _c{constructor(){this.Xr=()=>this.Zr(),this.eo=()=>this.no(),this.so=[],this.io()}Yr(e){this.so.push(e)}shutdown(){window.removeEventListener("online",this.Xr),window.removeEventListener("offline",this.eo)}io(){window.addEventListener("online",this.Xr),window.addEventListener("offline",this.eo)}Zr(){Os("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.so)e(0)}no(){Os("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.so)e(1)}static D(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let vc=null;function wc(){return null===vc?vc=268435456+Math.round(2147483648*Math.random()):vc++,"0x"+vc.toString(16)}const Ec={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class bc{constructor(e){this.ro=e.ro,this.oo=e.oo}uo(e){this.co=e}ao(e){this.ho=e}onMessage(e){this.lo=e}close(){this.oo()}send(e){this.ro(e)}fo(){this.co()}wo(e){this.ho(e)}_o(e){this.lo(e)}}const kc="WebChannelConnection";class Cc extends class{constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http";this.mo=t+"://"+e.host,this.yo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get po(){return!1}Io(e,t,n,s,i){const r=wc(),o=this.To(e,t);Os("RestConnection",`Sending RPC '${e}' ${r}:`,o,n);const a={};return this.Eo(a,s,i),this.Ao(e,o,a,n).then((t=>(Os("RestConnection",`Received RPC '${e}' ${r}: `,t),t)),(t=>{throw Ps("RestConnection",`RPC '${e}' ${r} failed with error: `,t,"url: ",o,"request:",n),t}))}vo(e,t,n,s,i,r){return this.Io(e,t,n,s,i)}Eo(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+Ds,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach(((t,n)=>e[n]=t)),n&&n.headers.forEach(((t,n)=>e[n]=t))}To(e,t){const n=Ec[e];return`${this.mo}/v1/${t}:${n}`}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Ao(e,t,n,s){const i=wc();return new Promise(((r,o)=>{const a=new Cs;a.setWithCredentials(!0),a.listenOnce(vs.COMPLETE,(()=>{try{switch(a.getLastErrorCode()){case _s.NO_ERROR:const t=a.getResponseJson();Os(kc,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(t)),r(t);break;case _s.TIMEOUT:Os(kc,`RPC '${e}' ${i} timed out`),o(new js(Vs.DEADLINE_EXCEEDED,"Request time out"));break;case _s.HTTP_ERROR:const n=a.getStatus();if(Os(kc,`RPC '${e}' ${i} failed with status:`,n,"response text:",a.getResponseText()),n>0){let e=a.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=null==e?void 0:e.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(Vs).indexOf(t)>=0?t:Vs.UNKNOWN}(t.status);o(new js(e,t.message))}else o(new js(Vs.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new js(Vs.UNAVAILABLE,"Connection failed."));break;default:xs()}}finally{Os(kc,`RPC '${e}' ${i} completed.`)}}));const c=JSON.stringify(s);Os(kc,`RPC '${e}' ${i} sending request:`,s),a.send(t,"POST",c,n,15)}))}Ro(e,t,n){const s=wc(),i=[this.mo,"/","google.firestore.v1.Firestore","/",e,"/channel"],r=gs(),o=ys(),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},c=this.longPollingOptions.timeoutSeconds;void 0!==c&&(a.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(a.xmlHttpFactory=new bs({})),this.Eo(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const u=i.join("");Os(kc,`Creating RPC '${e}' stream ${s}: ${u}`,a);const l=r.createWebChannel(u,a);let h=!1,d=!1;const p=new bc({ro:t=>{d?Os(kc,`Not sending because RPC '${e}' stream ${s} is closed:`,t):(h||(Os(kc,`Opening RPC '${e}' stream ${s} transport.`),l.open(),h=!0),Os(kc,`RPC '${e}' stream ${s} sending:`,t),l.send(t))},oo:()=>l.close()}),f=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(e){setTimeout((()=>{throw e}),0)}}))};return f(l,ks.EventType.OPEN,(()=>{d||Os(kc,`RPC '${e}' stream ${s} transport opened.`)})),f(l,ks.EventType.CLOSE,(()=>{d||(d=!0,Os(kc,`RPC '${e}' stream ${s} transport closed`),p.wo())})),f(l,ks.EventType.ERROR,(t=>{d||(d=!0,Ps(kc,`RPC '${e}' stream ${s} transport errored:`,t),p.wo(new js(Vs.UNAVAILABLE,"The operation could not be completed")))})),f(l,ks.EventType.MESSAGE,(t=>{var n;if(!d){const i=t.data[0];Fs(!!i);const r=i,o=r.error||(null===(n=r[0])||void 0===n?void 0:n.error);if(o){Os(kc,`RPC '${e}' stream ${s} received error:`,o);const t=o.status;let n=function(e){const t=zo[e];if(void 0!==t)return Go(t)}(t),i=o.message;void 0===n&&(n=Vs.INTERNAL,i="Unknown error status: "+t+" with message "+o.message),d=!0,p.wo(new js(n,i)),l.close()}else Os(kc,`RPC '${e}' stream ${s} received:`,i),p._o(i)}})),f(o,ws.STAT_EVENT,(t=>{t.stat===Es.PROXY?Os(kc,`RPC '${e}' stream ${s} detected buffering proxy`):t.stat===Es.NOPROXY&&Os(kc,`RPC '${e}' stream ${s} detected no buffering proxy`)})),setTimeout((()=>{p.fo()}),0),p}}function Ac(){return"undefined"!=typeof document?document:null}function Sc(e){return new pa(e,!0)}class Tc{constructor(e,t,n=1e3,s=1.5,i=6e4){this.ii=e,this.timerId=t,this.Po=n,this.bo=s,this.Vo=i,this.So=0,this.Do=null,this.Co=Date.now(),this.reset()}reset(){this.So=0}xo(){this.So=this.Vo}No(e){this.cancel();const t=Math.floor(this.So+this.ko()),n=Math.max(0,Date.now()-this.Co),s=Math.max(0,t-n);s>0&&Os("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.So} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Do=this.ii.enqueueAfterDelay(this.timerId,s,(()=>(this.Co=Date.now(),e()))),this.So*=this.bo,this.So<this.Po&&(this.So=this.Po),this.So>this.Vo&&(this.So=this.Vo)}Mo(){null!==this.Do&&(this.Do.skipDelay(),this.Do=null)}cancel(){null!==this.Do&&(this.Do.cancel(),this.Do=null)}ko(){return(Math.random()-.5)*this.So}}class Ic{constructor(e,t,n,s,i,r,o,a){this.ii=e,this.$o=n,this.Oo=s,this.connection=i,this.authCredentialsProvider=r,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.Fo=0,this.Bo=null,this.Lo=null,this.stream=null,this.qo=new Tc(e,t)}Uo(){return 1===this.state||5===this.state||this.Ko()}Ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Go()}async stop(){this.Uo()&&await this.close(0)}Qo(){this.state=0,this.qo.reset()}jo(){this.Ko()&&null===this.Bo&&(this.Bo=this.ii.enqueueAfterDelay(this.$o,6e4,(()=>this.zo())))}Wo(e){this.Ho(),this.stream.send(e)}async zo(){if(this.Ko())return this.close(0)}Ho(){this.Bo&&(this.Bo.cancel(),this.Bo=null)}Jo(){this.Lo&&(this.Lo.cancel(),this.Lo=null)}async close(e,t){this.Ho(),this.Jo(),this.qo.cancel(),this.Fo++,4!==e?this.qo.reset():t&&t.code===Vs.RESOURCE_EXHAUSTED?(Ls(t.toString()),Ls("Using maximum backoff delay to prevent overloading the backend."),this.qo.xo()):t&&t.code===Vs.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Yo(),this.stream.close(),this.stream=null),this.state=e,await this.listener.ao(t)}Yo(){}auth(){this.state=1;const e=this.Xo(this.Fo),t=this.Fo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([e,n])=>{this.Fo===t&&this.Zo(e,n)}),(t=>{e((()=>{const e=new js(Vs.UNKNOWN,"Fetching auth token failed: "+t.message);return this.tu(e)}))}))}Zo(e,t){const n=this.Xo(this.Fo);this.stream=this.eu(e,t),this.stream.uo((()=>{n((()=>(this.state=2,this.Lo=this.ii.enqueueAfterDelay(this.Oo,1e4,(()=>(this.Ko()&&(this.state=3),Promise.resolve()))),this.listener.uo())))})),this.stream.ao((e=>{n((()=>this.tu(e)))})),this.stream.onMessage((e=>{n((()=>this.onMessage(e)))}))}Go(){this.state=5,this.qo.No((async()=>{this.state=0,this.start()}))}tu(e){return Os("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}Xo(e){return t=>{this.ii.enqueueAndForget((()=>this.Fo===e?t():(Os("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Dc extends Ic{constructor(e,t,n,s,i,r){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,s,r),this.serializer=i}eu(e,t){return this.connection.Ro("Listen",e,t)}onMessage(e){this.qo.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const s=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:xs()}(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],r=function(e,t){return e.useProto3Json?(Fs(void 0===t||"string"==typeof t),Pi.fromBase64String(t||"")):(Fs(void 0===t||t instanceof Uint8Array),Pi.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,a=o&&function(e){const t=void 0===e.code?Vs.UNKNOWN:Go(e.code);return new js(t,e.message||"")}(o);n=new ra(s,i,r,a||null)}else if("documentChange"in t){t.documentChange;const s=t.documentChange;s.document,s.document.name,s.document.updateTime;const i=wa(e,s.document.name),r=ya(s.document.updateTime),o=s.document.createTime?ya(s.document.createTime):ti.min(),a=new or({mapValue:{fields:s.document.fields}}),c=ar.newFoundDocument(i,r,o,a),u=s.targetIds||[],l=s.removedTargetIds||[];n=new sa(u,l,c.key,c)}else if("documentDelete"in t){t.documentDelete;const s=t.documentDelete;s.document;const i=wa(e,s.document),r=s.readTime?ya(s.readTime):ti.min(),o=ar.newNoDocument(i,r),a=s.removedTargetIds||[];n=new sa([],a,o.key,o)}else if("documentRemove"in t){t.documentRemove;const s=t.documentRemove;s.document;const i=wa(e,s.document),r=s.removedTargetIds||[];n=new sa([],r,i,null)}else{if(!("filter"in t))return xs();{t.filter;const e=t.filter;e.targetId;const{count:s=0,unchangedNames:i}=e,r=new $o(s,i),o=e.targetId;n=new ia(o,r)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return ti.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?ti.min():t.readTime?ya(t.readTime):ti.min()}(e);return this.listener.nu(t,n)}su(e){const t={};t.database=ka(this.serializer),t.addTarget=function(e,t){let n;const s=t.target;if(n=Pr(s)?{documents:Aa(e,s)}:{query:Sa(e,s)},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=ga(e,t.resumeToken);const s=fa(e,t.expectedCount);null!==s&&(n.expectedCount=s)}else if(t.snapshotVersion.compareTo(ti.min())>0){n.readTime=ma(e,t.snapshotVersion.toTimestamp());const s=fa(e,t.expectedCount);null!==s&&(n.expectedCount=s)}return n}(this.serializer,e);const n=function(e,t){const n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return xs()}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.Wo(t)}iu(e){const t={};t.database=ka(this.serializer),t.removeTarget=e,this.Wo(t)}}class Nc extends class{}{constructor(e,t,n,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=s,this.lu=!1}fu(){if(this.lu)throw new js(Vs.FAILED_PRECONDITION,"The client has already been terminated.")}Io(e,t,n){return this.fu(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,i])=>this.connection.Io(e,t,n,s,i))).catch((e=>{throw"FirebaseError"===e.name?(e.code===Vs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new js(Vs.UNKNOWN,e.toString())}))}vo(e,t,n,s){return this.fu(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,r])=>this.connection.vo(e,t,n,i,r,s))).catch((e=>{throw"FirebaseError"===e.name?(e.code===Vs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new js(Vs.UNKNOWN,e.toString())}))}terminate(){this.lu=!0}}class Rc{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.wu=0,this._u=null,this.mu=!0}gu(){0===this.wu&&(this.yu("Unknown"),this._u=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this._u=null,this.pu("Backend didn't respond within 10 seconds."),this.yu("Offline"),Promise.resolve()))))}Iu(e){"Online"===this.state?this.yu("Unknown"):(this.wu++,this.wu>=1&&(this.Tu(),this.pu(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.yu("Offline")))}set(e){this.Tu(),this.wu=0,"Online"===e&&(this.mu=!1),this.yu(e)}yu(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}pu(e){const t=`Could not reach Cloud Firestore backend. ${e}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.mu?(Ls(t),this.mu=!1):Os("OnlineStateTracker",t)}Tu(){null!==this._u&&(this._u.cancel(),this._u=null)}}class Oc{constructor(e,t,n,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Eu=[],this.Au=new Map,this.vu=new Set,this.Ru=[],this.Pu=i,this.Pu.Yr((e=>{n.enqueueAndForget((async()=>{Bc(this)&&(Os("RemoteStore","Restarting streams for network reachability change."),await async function(e){const t=Us(e);t.vu.add(4),await Pc(t),t.bu.set("Unknown"),t.vu.delete(4),await Lc(t)}(this))}))})),this.bu=new Rc(n,s)}}async function Lc(e){if(Bc(e))for(const t of e.Ru)await t(!0)}async function Pc(e){for(const t of e.Ru)await t(!1)}function Mc(e,t){const n=Us(e);n.Au.has(t.targetId)||(n.Au.set(t.targetId,t),jc(n)?Vc(n):Qc(n).Ko()&&Fc(n,t))}function xc(e,t){const n=Us(e),s=Qc(n);n.Au.delete(t),s.Ko()&&Uc(n,t),0===n.Au.size&&(s.Ko()?s.jo():Bc(n)&&n.bu.set("Unknown"))}function Fc(e,t){if(e.Vu.qt(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(ti.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}Qc(e).su(t)}function Uc(e,t){e.Vu.qt(t),Qc(e).iu(t)}function Vc(e){e.Vu=new aa({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),le:t=>e.Au.get(t)||null,ue:()=>e.datastore.serializer.databaseId}),Qc(e).start(),e.bu.gu()}function jc(e){return Bc(e)&&!Qc(e).Uo()&&e.Au.size>0}function Bc(e){return 0===Us(e).vu.size}function qc(e){e.Vu=void 0}async function $c(e){e.Au.forEach(((t,n)=>{Fc(e,t)}))}async function zc(e,t){qc(e),jc(e)?(e.bu.Iu(t),Vc(e)):e.bu.set("Unknown")}async function Hc(e,t,n){if(e.bu.set("Online"),t instanceof ra&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const s of t.targetIds)e.Au.has(s)&&(await e.remoteSyncer.rejectListen(s,n),e.Au.delete(s),e.Vu.removeTarget(s))}(e,t)}catch(n){Os("RemoteStore","Failed to remove targets %s: %s ",t.targetIds.join(","),n),await Gc(e,n)}else if(t instanceof sa?e.Vu.Ht(t):t instanceof ia?e.Vu.ne(t):e.Vu.Xt(t),!n.isEqual(ti.min()))try{const t=await uc(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.Vu.ce(t);return n.targetChanges.forEach(((n,s)=>{if(n.resumeToken.approximateByteSize()>0){const i=e.Au.get(s);i&&e.Au.set(s,i.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach(((t,n)=>{const s=e.Au.get(t);if(!s)return;e.Au.set(t,s.withResumeToken(Pi.EMPTY_BYTE_STRING,s.snapshotVersion)),Uc(e,t);const i=new xa(s.target,t,n,s.sequenceNumber);Fc(e,i)})),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){Os("RemoteStore","Failed to raise snapshot:",t),await Gc(e,t)}}async function Gc(e,t,n){if(!gi(t))throw t;e.vu.add(1),await Pc(e),e.bu.set("Offline"),n||(n=()=>uc(e.localStore)),e.asyncQueue.enqueueRetryable((async()=>{Os("RemoteStore","Retrying IndexedDB access"),await n(),e.vu.delete(1),await Lc(e)}))}async function Kc(e,t){const n=Us(e);n.asyncQueue.verifyOperationInProgress(),Os("RemoteStore","RemoteStore received new credentials");const s=Bc(n);n.vu.add(3),await Pc(n),s&&n.bu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.vu.delete(3),await Lc(n)}async function Wc(e,t){const n=Us(e);t?(n.vu.delete(2),await Lc(n)):t||(n.vu.add(2),await Pc(n),n.bu.set("Unknown"))}function Qc(e){return e.Su||(e.Su=function(e,t,n){const s=Us(e);return s.fu(),new Dc(t,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,n)}(e.datastore,e.asyncQueue,{uo:$c.bind(null,e),ao:zc.bind(null,e),nu:Hc.bind(null,e)}),e.Ru.push((async t=>{t?(e.Su.Qo(),jc(e)?Vc(e):e.bu.set("Unknown")):(await e.Su.stop(),qc(e))}))),e.Su}class Yc{constructor(e,t,n,s,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=s,this.removalCallback=i,this.deferred=new Bs,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}static createAndSchedule(e,t,n,s,i){const r=Date.now()+n,o=new Yc(e,t,r,s,i);return o.start(n),o}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new js(Vs.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Xc(e,t){if(Ls("AsyncQueue",`${t}: ${e}`),gi(e))return new js(Vs.UNAVAILABLE,`${t}: ${e}`);throw e}class Jc{constructor(e){this.comparator=e?(t,n)=>e(t,n)||oi.comparator(t.key,n.key):(e,t)=>oi.comparator(e.key,t.key),this.keyedMap=so(),this.sortedSet=new Ti(this.comparator)}static emptySet(e){return new Jc(e.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){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 Jc))return!1;if(this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const e=t.getNext().key,s=n.getNext().key;if(!e.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach((t=>{e.push(t.toString())})),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){const n=new Jc;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}class Zc{constructor(){this.Cu=new Ti(oi.comparator)}track(e){const t=e.doc.key,n=this.Cu.get(t);n?0!==e.type&&3===n.type?this.Cu=this.Cu.insert(t,e):3===e.type&&1!==n.type?this.Cu=this.Cu.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.Cu=this.Cu.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.Cu=this.Cu.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.Cu=this.Cu.remove(t):1===e.type&&2===n.type?this.Cu=this.Cu.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.Cu=this.Cu.insert(t,{type:2,doc:e.doc}):xs():this.Cu=this.Cu.insert(t,e)}xu(){const e=[];return this.Cu.inorderTraversal(((t,n)=>{e.push(n)})),e}}class eu{constructor(e,t,n,s,i,r,o,a,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=s,this.mutatedKeys=i,this.fromCache=r,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(e,t,n,s,i){const r=[];return t.forEach((e=>{r.push({type:0,doc:e})})),new eu(e,t,Jc.emptySet(t),r,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)&&Gr(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 e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}}class tu{constructor(){this.Nu=void 0,this.listeners=[]}}class nu{constructor(){this.queries=new Zr((e=>Kr(e)),Gr),this.onlineState="Unknown",this.ku=new Set}}async function su(e,t){const n=Us(e),s=t.query;let i=!1,r=n.queries.get(s);if(r||(i=!0,r=new tu),i)try{r.Nu=await n.onListen(s)}catch(e){const n=Xc(e,`Initialization of query '${Wr(t.query)}' failed`);return void t.onError(n)}n.queries.set(s,r),r.listeners.push(t),t.Mu(n.onlineState),r.Nu&&t.$u(r.Nu)&&au(n)}async function iu(e,t){const n=Us(e),s=t.query;let i=!1;const r=n.queries.get(s);if(r){const e=r.listeners.indexOf(t);e>=0&&(r.listeners.splice(e,1),i=0===r.listeners.length)}if(i)return n.queries.delete(s),n.onUnlisten(s)}function ru(e,t){const n=Us(e);let s=!1;for(const e of t){const t=e.query,i=n.queries.get(t);if(i){for(const t of i.listeners)t.$u(e)&&(s=!0);i.Nu=e}}s&&au(n)}function ou(e,t,n){const s=Us(e),i=s.queries.get(t);if(i)for(const e of i.listeners)e.onError(n);s.queries.delete(t)}function au(e){e.ku.forEach((e=>{e.next()}))}class cu{constructor(e,t,n){this.query=e,this.Ou=t,this.Fu=!1,this.Bu=null,this.onlineState="Unknown",this.options=n||{}}$u(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new eu(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Fu?this.Lu(e)&&(this.Ou.next(e),t=!0):this.qu(e,this.onlineState)&&(this.Uu(e),t=!0),this.Bu=e,t}onError(e){this.Ou.error(e)}Mu(e){this.onlineState=e;let t=!1;return this.Bu&&!this.Fu&&this.qu(this.Bu,e)&&(this.Uu(this.Bu),t=!0),t}qu(e,t){if(!e.fromCache)return!0;const n="Offline"!==t;return(!this.options.Ku||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}Lu(e){if(e.docChanges.length>0)return!0;const t=this.Bu&&this.Bu.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}Uu(e){e=eu.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Fu=!0,this.Ou.next(e)}}class uu{constructor(e){this.key=e}}class lu{constructor(e){this.key=e}}class hu{constructor(e,t){this.query=e,this.Yu=t,this.Xu=null,this.hasCachedResults=!1,this.current=!1,this.Zu=uo(),this.mutatedKeys=uo(),this.tc=Xr(e),this.ec=new Jc(this.tc)}get nc(){return this.Yu}sc(e,t){const n=t?t.ic:new Zc,s=t?t.ec:this.ec;let i=t?t.mutatedKeys:this.mutatedKeys,r=s,o=!1;const a="F"===this.query.limitType&&s.size===this.query.limit?s.last():null,c="L"===this.query.limitType&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal(((e,t)=>{const u=s.get(e),l=Qr(this.query,t)?t:null,h=!!u&&this.mutatedKeys.has(u.key),d=!!l&&(l.hasLocalMutations||this.mutatedKeys.has(l.key)&&l.hasCommittedMutations);let p=!1;u&&l?u.data.isEqual(l.data)?h!==d&&(n.track({type:3,doc:l}),p=!0):this.rc(u,l)||(n.track({type:2,doc:l}),p=!0,(a&&this.tc(l,a)>0||c&&this.tc(l,c)<0)&&(o=!0)):!u&&l?(n.track({type:0,doc:l}),p=!0):u&&!l&&(n.track({type:1,doc:u}),p=!0,(a||c)&&(o=!0)),p&&(l?(r=r.add(l),i=d?i.add(e):i.delete(e)):(r=r.delete(e),i=i.delete(e)))})),null!==this.query.limit)for(;r.size>this.query.limit;){const e="F"===this.query.limitType?r.last():r.first();r=r.delete(e.key),i=i.delete(e.key),n.track({type:1,doc:e})}return{ec:r,ic:n,zi:o,mutatedKeys:i}}rc(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n){const s=this.ec;this.ec=e.ec,this.mutatedKeys=e.mutatedKeys;const i=e.ic.xu();i.sort(((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return xs()}};return n(e)-n(t)}(e.type,t.type)||this.tc(e.doc,t.doc))),this.oc(n);const r=t?this.uc():[],o=0===this.Zu.size&&this.current?1:0,a=o!==this.Xu;return this.Xu=o,0!==i.length||a?{snapshot:new eu(this.query,e.ec,s,i,e.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),cc:r}:{cc:r}}Mu(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({ec:this.ec,ic:new Zc,mutatedKeys:this.mutatedKeys,zi:!1},!1)):{cc:[]}}ac(e){return!this.Yu.has(e)&&!!this.ec.has(e)&&!this.ec.get(e).hasLocalMutations}oc(e){e&&(e.addedDocuments.forEach((e=>this.Yu=this.Yu.add(e))),e.modifiedDocuments.forEach((e=>{})),e.removedDocuments.forEach((e=>this.Yu=this.Yu.delete(e))),this.current=e.current)}uc(){if(!this.current)return[];const e=this.Zu;this.Zu=uo(),this.ec.forEach((e=>{this.ac(e.key)&&(this.Zu=this.Zu.add(e.key))}));const t=[];return e.forEach((e=>{this.Zu.has(e)||t.push(new lu(e))})),this.Zu.forEach((n=>{e.has(n)||t.push(new uu(n))})),t}hc(e){this.Yu=e.ir,this.Zu=uo();const t=this.sc(e.documents);return this.applyChanges(t,!0)}lc(){return eu.fromInitialDocuments(this.query,this.ec,this.mutatedKeys,0===this.Xu,this.hasCachedResults)}}class du{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class pu{constructor(e){this.key=e,this.fc=!1}}class fu{constructor(e,t,n,s,i,r){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=r,this.dc={},this.wc=new Zr((e=>Kr(e)),Gr),this._c=new Map,this.mc=new Set,this.gc=new Ti(oi.comparator),this.yc=new Map,this.Ic=new Qa,this.Tc={},this.Ec=new Map,this.Ac=$a.Mn(),this.onlineState="Unknown",this.vc=void 0}get isPrimaryClient(){return!0===this.vc}}async function mu(e,t){const n=Du(e);let s,i;const r=n.wc.get(t);if(r)s=r.targetId,n.sharedClientState.addLocalQueryTarget(s),i=r.view.lc();else{const e=await hc(n.localStore,$r(t)),r=n.sharedClientState.addLocalQueryTarget(e.targetId);s=e.targetId,i=await gu(n,t,s,"current"===r,e.resumeToken),n.isPrimaryClient&&Mc(n.remoteStore,e)}return i}async function gu(e,t,n,s,i){e.Rc=(t,n,s)=>async function(e,t,n,s){let i=t.view.sc(n);i.zi&&(i=await pc(e.localStore,t.query,!1).then((({documents:e})=>t.view.sc(e,i))));const r=s&&s.targetChanges.get(t.targetId),o=t.view.applyChanges(i,e.isPrimaryClient,r);return ku(e,t.targetId,o.cc),o.snapshot}(e,t,n,s);const r=await pc(e.localStore,t,!0),o=new hu(t,r.ir),a=o.sc(r.documents),c=na.createSynthesizedTargetChangeForCurrentChange(n,s&&"Offline"!==e.onlineState,i),u=o.applyChanges(a,e.isPrimaryClient,c);ku(e,n,u.cc);const l=new du(t,n,o);return e.wc.set(t,l),e._c.has(n)?e._c.get(n).push(t):e._c.set(n,[t]),u.snapshot}async function yu(e,t){const n=Us(e),s=n.wc.get(t),i=n._c.get(s.targetId);if(i.length>1)return n._c.set(s.targetId,i.filter((e=>!Gr(e,t)))),void n.wc.delete(t);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(s.targetId),n.sharedClientState.isActiveQueryTarget(s.targetId)||await dc(n.localStore,s.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(s.targetId),xc(n.remoteStore,s.targetId),Eu(n,s.targetId)})).catch(fi)):(Eu(n,s.targetId),await dc(n.localStore,s.targetId,!0))}async function _u(e,t){const n=Us(e);try{const e=await function(e,t){const n=Us(e),s=t.snapshotVersion;let i=n.Ji;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(e=>{const r=n.Zi.newChangeBuffer({trackRemovals:!0});i=n.Ji;const o=[];t.targetChanges.forEach(((r,a)=>{const c=i.get(a);if(!c)return;o.push(n.Bs.removeMatchingKeys(e,r.removedDocuments,a).next((()=>n.Bs.addMatchingKeys(e,r.addedDocuments,a))));let u=c.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?u=u.withResumeToken(Pi.EMPTY_BYTE_STRING,ti.min()).withLastLimboFreeSnapshotVersion(ti.min()):r.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(r.resumeToken,s)),i=i.insert(a,u),function(e,t,n){return 0===e.resumeToken.approximateByteSize()||t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(c,u,r)&&o.push(n.Bs.updateTargetData(e,u))}));let a=to(),c=uo();if(t.documentUpdates.forEach((s=>{t.resolvedLimboDocuments.has(s)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,s))})),o.push(lc(e,r,t.documentUpdates).next((e=>{a=e.nr,c=e.sr}))),!s.isEqual(ti.min())){const t=n.Bs.getLastRemoteSnapshotVersion(e).next((t=>n.Bs.setTargetsMetadata(e,e.currentSequenceNumber,s)));o.push(t)}return mi.waitFor(o).next((()=>r.apply(e))).next((()=>n.localDocuments.getLocalViewOfDocuments(e,a,c))).next((()=>a))})).then((e=>(n.Ji=i,e)))}(n.localStore,t);t.targetChanges.forEach(((e,t)=>{const s=n.yc.get(t);s&&(Fs(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1),e.addedDocuments.size>0?s.fc=!0:e.modifiedDocuments.size>0?Fs(s.fc):e.removedDocuments.size>0&&(Fs(s.fc),s.fc=!1))})),await Su(n,e,t)}catch(e){await fi(e)}}function vu(e,t,n){const s=Us(e);if(s.isPrimaryClient&&0===n||!s.isPrimaryClient&&1===n){const e=[];s.wc.forEach(((n,s)=>{const i=s.view.Mu(t);i.snapshot&&e.push(i.snapshot)})),function(e,t){const n=Us(e);n.onlineState=t;let s=!1;n.queries.forEach(((e,n)=>{for(const e of n.listeners)e.Mu(t)&&(s=!0)})),s&&au(n)}(s.eventManager,t),e.length&&s.dc.nu(e),s.onlineState=t,s.isPrimaryClient&&s.sharedClientState.setOnlineState(t)}}async function wu(e,t,n){const s=Us(e);s.sharedClientState.updateQueryState(t,"rejected",n);const i=s.yc.get(t),r=i&&i.key;if(r){let e=new Ti(oi.comparator);e=e.insert(r,ar.newNoDocument(r,ti.min()));const n=uo().add(r),i=new ta(ti.min(),new Map,new Ti(Js),e,n);await _u(s,i),s.gc=s.gc.remove(r),s.yc.delete(t),Au(s)}else await dc(s.localStore,t,!1).then((()=>Eu(s,t,n))).catch(fi)}function Eu(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(const s of e._c.get(t))e.wc.delete(s),n&&e.dc.Pc(s,n);e._c.delete(t),e.isPrimaryClient&&e.Ic.Is(t).forEach((t=>{e.Ic.containsKey(t)||bu(e,t)}))}function bu(e,t){e.mc.delete(t.path.canonicalString());const n=e.gc.get(t);null!==n&&(xc(e.remoteStore,n),e.gc=e.gc.remove(t),e.yc.delete(n),Au(e))}function ku(e,t,n){for(const s of n)s instanceof uu?(e.Ic.addReference(s.key,t),Cu(e,s)):s instanceof lu?(Os("SyncEngine","Document no longer in limbo: "+s.key),e.Ic.removeReference(s.key,t),e.Ic.containsKey(s.key)||bu(e,s.key)):xs()}function Cu(e,t){const n=t.key,s=n.path.canonicalString();e.gc.get(n)||e.mc.has(s)||(Os("SyncEngine","New document in limbo: "+n),e.mc.add(s),Au(e))}function Au(e){for(;e.mc.size>0&&e.gc.size<e.maxConcurrentLimboResolutions;){const t=e.mc.values().next().value;e.mc.delete(t);const n=new oi(si.fromString(t)),s=e.Ac.next();e.yc.set(s,new pu(n)),e.gc=e.gc.insert(n,s),Mc(e.remoteStore,new xa($r(Fr(n.path)),s,"TargetPurposeLimboResolution",yi.ct))}}async function Su(e,t,n){const s=Us(e),i=[],r=[],o=[];s.wc.isEmpty()||(s.wc.forEach(((e,a)=>{o.push(s.Rc(a,t,n).then((e=>{if((e||n)&&s.isPrimaryClient&&s.sharedClientState.updateQueryState(a.targetId,(null==e?void 0:e.fromCache)?"not-current":"current"),e){i.push(e);const t=ic.Li(a.targetId,e);r.push(t)}})))})),await Promise.all(o),s.dc.nu(i),await async function(e,t){const n=Us(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(e=>mi.forEach(t,(t=>mi.forEach(t.Fi,(s=>n.persistence.referenceDelegate.addReference(e,t.targetId,s))).next((()=>mi.forEach(t.Bi,(s=>n.persistence.referenceDelegate.removeReference(e,t.targetId,s)))))))))}catch(e){if(!gi(e))throw e;Os("LocalStore","Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.Ji.get(t),s=e.snapshotVersion,i=e.withLastLimboFreeSnapshotVersion(s);n.Ji=n.Ji.insert(t,i)}}}(s.localStore,r))}async function Tu(e,t){const n=Us(e);if(!n.currentUser.isEqual(t)){Os("SyncEngine","User change. New user:",t.toKey());const e=await cc(n.localStore,t);n.currentUser=t,function(e,t){e.Ec.forEach((e=>{e.forEach((e=>{e.reject(new js(Vs.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),e.Ec.clear()}(n),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Su(n,e.er)}}function Iu(e,t){const n=Us(e),s=n.yc.get(t);if(s&&s.fc)return uo().add(s.key);{let e=uo();const s=n._c.get(t);if(!s)return e;for(const t of s){const s=n.wc.get(t);e=e.unionWith(s.view.nc)}return e}}function Du(e){const t=Us(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=_u.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Iu.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=wu.bind(null,t),t.dc.nu=ru.bind(null,t.eventManager),t.dc.Pc=ou.bind(null,t.eventManager),t}class Nu{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=Sc(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){return ac(this.persistence,new rc,e.initialUser,this.serializer)}createPersistence(e){return new tc(sc.zs,this.serializer)}createSharedClientState(e){return new gc}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Ru{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>vu(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Tu.bind(null,this.syncEngine),await Wc(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new nu}createDatastore(e){const t=Sc(e.databaseInfo.databaseId),n=(s=e.databaseInfo,new Cc(s));var s;return function(e,t,n,s){return new Nc(e,t,n,s)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return t=this.localStore,n=this.datastore,s=e.asyncQueue,i=e=>vu(this.syncEngine,e,0),r=_c.D()?new _c:new yc,new Oc(t,n,s,i,r);var t,n,s,i,r}createSyncEngine(e,t){return function(e,t,n,s,i,r,o){const a=new fu(e,t,n,s,i,r);return o&&(a.vc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}terminate(){return async function(e){const t=Us(e);Os("RemoteStore","RemoteStore shutting down."),t.vu.add(5),await Pc(t),t.Pu.shutdown(),t.bu.set("Unknown")}(this.remoteStore)}}class Ou{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Sc(this.observer.next,e)}error(e){this.observer.error?this.Sc(this.observer.error,e):Ls("Uncaught Error in snapshot listener:",e.toString())}Dc(){this.muted=!0}Sc(e,t){this.muted||setTimeout((()=>{this.muted||e(t)}),0)}}class Lu{constructor(e,t,n,s){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=s,this.user=Is.UNAUTHENTICATED,this.clientId=Xs.A(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async e=>{Os("FirestoreClient","Received user=",e.uid),await this.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(Os("FirestoreClient","Received new app check token=",e),this.appCheckCredentialListener(e,this.user))))}async getConfiguration(){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}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new js(Vs.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Bs;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=Xc(t,"Failed to shutdown persistence");e.reject(n)}})),e.promise}}async function Pu(e,t){e.asyncQueue.verifyOperationInProgress(),Os("FirestoreClient","Initializing OfflineComponentProvider");const n=await e.getConfiguration();await t.initialize(n);let s=n.initialUser;e.setCredentialChangeListener((async e=>{s.isEqual(e)||(await cc(t.localStore,e),s=e)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e._offlineComponents=t}async function Mu(e,t){e.asyncQueue.verifyOperationInProgress();const n=await Fu(e);Os("FirestoreClient","Initializing OnlineComponentProvider");const s=await e.getConfiguration();await t.initialize(n,s),e.setCredentialChangeListener((e=>Kc(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>Kc(t.remoteStore,n))),e._onlineComponents=t}function xu(e){return"FirebaseError"===e.name?e.code===Vs.FAILED_PRECONDITION||e.code===Vs.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}async function Fu(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){Os("FirestoreClient","Using user provided OfflineComponentProvider");try{await Pu(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!xu(n))throw n;Ps("Error using user provided cache. Falling back to memory cache: "+n),await Pu(e,new Nu)}}else Os("FirestoreClient","Using default OfflineComponentProvider"),await Pu(e,new Nu);return e._offlineComponents}async function Uu(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(Os("FirestoreClient","Using user provided OnlineComponentProvider"),await Mu(e,e._uninitializedComponentsProvider._online)):(Os("FirestoreClient","Using default OnlineComponentProvider"),await Mu(e,new Ru))),e._onlineComponents}async function Vu(e){const t=await Uu(e),n=t.eventManager;return n.onListen=mu.bind(null,t.syncEngine),n.onUnlisten=yu.bind(null,t.syncEngine),n}function ju(e,t,n={}){const s=new Bs;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,s,i){const r=new Ou({next:r=>{t.enqueueAndForget((()=>iu(e,o)));const a=r.docs.has(n);!a&&r.fromCache?i.reject(new js(Vs.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&r.fromCache&&s&&"server"===s.source?i.reject(new js(Vs.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.)')):i.resolve(r)},error:e=>i.reject(e)}),o=new cu(Fr(n.path),r,{includeMetadataChanges:!0,Ku:!0});return su(e,o)}(await Vu(e),e.asyncQueue,t,n,s))),s.promise}function Bu(e,t,n={}){const s=new Bs;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,s,i){const r=new Ou({next:n=>{t.enqueueAndForget((()=>iu(e,o))),n.fromCache&&"server"===s.source?i.reject(new js(Vs.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.)')):i.resolve(n)},error:e=>i.reject(e)}),o=new cu(n,r,{includeMetadataChanges:!0,Ku:!0});return su(e,o)}(await Vu(e),e.asyncQueue,t,n,s))),s.promise}function qu(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}const $u=new Map;function zu(e,t,n){if(!n)throw new js(Vs.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function Hu(e){if(!oi.isDocumentKey(e))throw new js(Vs.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function Gu(e){if(oi.isDocumentKey(e))throw new js(Vs.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function Ku(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:"an object"}}return"function"==typeof e?"a function":xs()}function Wu(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new js(Vs.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Ku(e);throw new js(Vs.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}class Qu{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new js(Vs.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=null===(t=e.ssl)||void 0===t||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.cache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new js(Vs.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,s){if(!0===t&&!0===s)throw new js(Vs.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=qu(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new js(Vs.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new js(Vs.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new js(Vs.INVALID_ARGUMENT,`invalid long polling timeout: ${e.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&&(t=this.experimentalLongPollingOptions,n=e.experimentalLongPollingOptions,t.timeoutSeconds===n.timeoutSeconds)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams;var t,n}}class Yu{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 Qu({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new js(Vs.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 void 0!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new js(Vs.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 Qu(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new $s;switch(e.type){case"firstParty":return new Ks(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new js(Vs.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=$u.get(e);t&&(Os("ComponentProvider","Removing Datastore"),$u.delete(e),t.terminate())}(this),Promise.resolve()}}class Xu{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 Zu(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Xu(this.firestore,e,this._key)}}class Ju{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new Ju(this.firestore,e,this._query)}}class Zu extends Ju{constructor(e,t,n){super(e,t,Fr(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 Xu(this.firestore,null,new oi(e))}withConverter(e){return new Zu(this.firestore,e,this._path)}}function el(e,t,...n){if(e=(0,a.m9)(e),zu("collection","path",t),e instanceof Yu){const s=si.fromString(t,...n);return Gu(s),new Zu(e,null,s)}{if(!(e instanceof Xu||e instanceof Zu))throw new js(Vs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=e._path.child(si.fromString(t,...n));return Gu(s),new Zu(e.firestore,null,s)}}function tl(e,t,...n){if(e=(0,a.m9)(e),1===arguments.length&&(t=Xs.A()),zu("doc","path",t),e instanceof Yu){const s=si.fromString(t,...n);return Hu(s),new Xu(e,null,new oi(s))}{if(!(e instanceof Xu||e instanceof Zu))throw new js(Vs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=e._path.child(si.fromString(t,...n));return Hu(s),new Xu(e.firestore,e instanceof Zu?e.converter:null,new oi(s))}}class nl{constructor(){this.Gc=Promise.resolve(),this.Qc=[],this.jc=!1,this.zc=[],this.Wc=null,this.Hc=!1,this.Jc=!1,this.Yc=[],this.qo=new Tc(this,"async_queue_retry"),this.Xc=()=>{const e=Ac();e&&Os("AsyncQueue","Visibility state changed to "+e.visibilityState),this.qo.Mo()};const e=Ac();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.Xc)}get isShuttingDown(){return this.jc}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Zc(),this.ta(e)}enterRestrictedMode(e){if(!this.jc){this.jc=!0,this.Jc=e||!1;const t=Ac();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.Xc)}}enqueue(e){if(this.Zc(),this.jc)return new Promise((()=>{}));const t=new Bs;return this.ta((()=>this.jc&&this.Jc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Qc.push(e),this.ea())))}async ea(){if(0!==this.Qc.length){try{await this.Qc[0](),this.Qc.shift(),this.qo.reset()}catch(e){if(!gi(e))throw e;Os("AsyncQueue","Operation failed with retryable error: "+e)}this.Qc.length>0&&this.qo.No((()=>this.ea()))}}ta(e){const t=this.Gc.then((()=>(this.Hc=!0,e().catch((e=>{this.Wc=e,this.Hc=!1;const t=function(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}(e);throw Ls("INTERNAL UNHANDLED ERROR: ",t),e})).then((e=>(this.Hc=!1,e))))));return this.Gc=t,t}enqueueAfterDelay(e,t,n){this.Zc(),this.Yc.indexOf(e)>-1&&(t=0);const s=Yc.createAndSchedule(this,e,t,n,(e=>this.na(e)));return this.zc.push(s),s}Zc(){this.Wc&&xs()}verifyOperationInProgress(){}async sa(){let e;do{e=this.Gc,await e}while(e!==this.Gc)}ia(e){for(const t of this.zc)if(t.timerId===e)return!0;return!1}ra(e){return this.sa().then((()=>{this.zc.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(const t of this.zc)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.sa()}))}oa(e){this.Yc.push(e)}na(e){const t=this.zc.indexOf(e);this.zc.splice(t,1)}}class sl extends Yu{constructor(e,t,n,s){super(e,t,n,s),this.type="firestore",this._queue=new nl,this._persistenceKey=(null==s?void 0:s.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||ol(this),this._firestoreClient.terminate()}}function il(e,t){const n="object"==typeof e?e:(0,i.Mq)(),s="string"==typeof e?e:t||"(default)",r=(0,i.qX)(n,"firestore").getImmediate({identifier:s});if(!r._initialized){const e=(0,a.P0)("firestore");e&&function(e,t,n,s={}){var i;const r=(e=Wu(e,Yu))._getSettings();if("firestore.googleapis.com"!==r.host&&r.host!==t&&Ps("Host has been set in both settings() and useEmulator(), emulator host will be used"),e._setSettings(Object.assign(Object.assign({},r),{host:`${t}:${n}`,ssl:!1})),s.mockUserToken){let t,n;if("string"==typeof s.mockUserToken)t=s.mockUserToken,n=Is.MOCK_USER;else{t=(0,a.Sg)(s.mockUserToken,null===(i=e._app)||void 0===i?void 0:i.options.projectId);const r=s.mockUserToken.sub||s.mockUserToken.user_id;if(!r)throw new js(Vs.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Is(r)}e._authCredentials=new zs(new qs(t,n))}}(r,...e)}return r}function rl(e){return e._firestoreClient||ol(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function ol(e){var t,n,s;const i=e._freezeSettings(),r=function(e,t,n,s){return new qi(e,t,n,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,qu(s.experimentalLongPollingOptions),s.useFetchStreams)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,i);e._firestoreClient=new Lu(e._authCredentials,e._appCheckCredentials,e._queue,r),(null===(n=i.cache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(s=i.cache)||void 0===s?void 0:s._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.cache.kind,_offline:i.cache._offlineComponentProvider,_online:i.cache._onlineComponentProvider})}class al{constructor(e){this._byteString=e}static fromBase64String(e){try{return new al(Pi.fromBase64String(e))}catch(e){throw new js(Vs.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new al(Pi.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}class cl{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new js(Vs.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new ri(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}class ul{constructor(e){this._methodName=e}}class ll{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new js(Vs.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new js(Vs.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return Js(this._lat,e._lat)||Js(this._long,e._long)}}const hl=/^__.*__$/;function dl(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw xs()}}class pl{constructor(e,t,n,s,i,r){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=s,void 0===i&&this.ua(),this.fieldTransforms=i||[],this.fieldMask=r||[]}get path(){return this.settings.path}get ca(){return this.settings.ca}aa(e){return new pl(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ha(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),s=this.aa({path:n,la:!1});return s.fa(e),s}da(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),s=this.aa({path:n,la:!1});return s.ua(),s}wa(e){return this.aa({path:void 0,la:!0})}_a(e){return kl(e,this.settings.methodName,this.settings.ma||!1,this.path,this.settings.ga)}contains(e){return void 0!==this.fieldMask.find((t=>e.isPrefixOf(t)))||void 0!==this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))}ua(){if(this.path)for(let e=0;e<this.path.length;e++)this.fa(this.path.get(e))}fa(e){if(0===e.length)throw this._a("Document fields must not be empty");if(dl(this.ca)&&hl.test(e))throw this._a('Document fields cannot begin and end with "__"')}}class fl{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||Sc(e)}ya(e,t,n,s=!1){return new pl({ca:e,methodName:t,ga:n,path:ri.emptyPath(),la:!1,ma:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function ml(e){const t=e._freezeSettings(),n=Sc(e._databaseId);return new fl(e._databaseId,!!t.ignoreUndefinedProperties,n)}function gl(e,t,n,s=!1){return yl(n,e.ya(s?4:3,t))}function yl(e,t){if(vl(e=(0,a.m9)(e)))return wl("Unsupported field value:",t,e),_l(e,t);if(e instanceof ul)return function(e,t){if(!dl(t.ca))throw t._a(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t._a(`${e._methodName}() is not currently supported inside arrays`);const n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.la&&4!==t.ca)throw t._a("Nested arrays are not supported");return function(e,t){const n=[];let s=0;for(const i of e){let e=yl(i,t.wa(s));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),s++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=(0,a.m9)(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return mo(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=ei.fromDate(e);return{timestampValue:ma(t.serializer,n)}}if(e instanceof ei){const n=new ei(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:ma(t.serializer,n)}}if(e instanceof ll)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof al)return{bytesValue:ga(t.serializer,e._byteString)};if(e instanceof Xu){const n=t.databaseId,s=e.firestore._databaseId;if(!s.isEqual(n))throw t._a(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:_a(e.firestore._databaseId||t.databaseId,e._key.path)}}throw t._a(`Unsupported field value: ${Ku(e)}`)}(e,t)}function _l(e,t){const n={};return Si(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):Ai(e,((e,s)=>{const i=yl(s,t.ha(e));null!=i&&(n[e]=i)})),{mapValue:{fields:n}}}function vl(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof ei||e instanceof ll||e instanceof al||e instanceof Xu||e instanceof ul)}function wl(e,t,n){if(!vl(n)||!function(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}(n)){const s=Ku(n);throw"an object"===s?t._a(e+" a custom object"):t._a(e+" "+s)}}const El=new RegExp("[~\\*/\\[\\]]");function bl(e,t,n){if(t.search(El)>=0)throw kl(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new cl(...t.split("."))._internalPath}catch(s){throw kl(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function kl(e,t,n,s,i){const r=s&&!s.isEmpty(),o=void 0!==i;let a=`Function ${t}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(r||o)&&(c+=" (found",r&&(c+=` in field ${s}`),o&&(c+=` in document ${i}`),c+=")"),new js(Vs.INVALID_ARGUMENT,a+e+c)}class Cl{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 Xu(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new Al(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const t=this._document.data.field(Sl("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class Al extends Cl{data(){return super.data()}}function Sl(e,t){return"string"==typeof t?bl(e,t):t instanceof cl?t._internalPath:t._delegate._internalPath}function Tl(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new js(Vs.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Il{}class Dl extends Il{}function Nl(e,t,...n){let s=[];t instanceof Il&&s.push(t),s=s.concat(n),function(e){const t=e.filter((e=>e instanceof Ol)).length,n=e.filter((e=>e instanceof Rl)).length;if(t>1||t>0&&n>0)throw new js(Vs.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(...)))`.")}(s);for(const t of s)e=t._apply(e);return e}class Rl extends Dl{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new Rl(e,t,n)}_apply(e){const t=this._parse(e);return Fl(e._query,t),new Ju(e.firestore,e.converter,zr(e._query,t))}_parse(e){const t=ml(e.firestore),n=function(e,t,n,s,i,r,o){let a;if(i.isKeyField()){if("array-contains"===r||"array-contains-any"===r)throw new js(Vs.INVALID_ARGUMENT,`Invalid Query. You can't perform '${r}' queries on documentId().`);if("in"===r||"not-in"===r){xl(o,r);const t=[];for(const n of o)t.push(Ml(s,e,n));a={arrayValue:{values:t}}}else a=Ml(s,e,o)}else"in"!==r&&"not-in"!==r&&"array-contains-any"!==r||xl(o,r),a=gl(n,"where",o,"in"===r||"not-in"===r);return fr.create(i,r,a)}(e._query,0,t,e.firestore._databaseId,this._field,this._op,this._value);return n}}class Ol extends Il{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Ol(e,t)}_parse(e){const t=this._queryConstraints.map((t=>t._parse(e))).filter((e=>e.getFilters().length>0));return 1===t.length?t[0]:mr.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const s=t.getFlattenedFilters();for(const e of s)Fl(n,e),n=zr(n,e)}(e._query,t),new Ju(e.firestore,e.converter,zr(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}class Ll extends Dl{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new Ll(e,t)}_apply(e){const t=function(e,t,n){if(null!==e.startAt)throw new js(Vs.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==e.endAt)throw new js(Vs.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");const s=new hr(t,n);return function(e,t){if(null===Vr(e)){const n=jr(e);null!==n&&Ul(e,n,t.field)}}(e,s),s}(e._query,this._field,this._direction);return new Ju(e.firestore,e.converter,function(e,t){const n=e.explicitOrderBy.concat([t]);return new Mr(e.path,e.collectionGroup,n,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(e._query,t))}}function Pl(e,t="asc"){const n=t,s=Sl("orderBy",e);return Ll._create(s,n)}function Ml(e,t,n){if("string"==typeof(n=(0,a.m9)(n))){if(""===n)throw new js(Vs.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Br(t)&&-1!==n.indexOf("/"))throw new js(Vs.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const s=t.path.child(si.fromString(n));if(!oi.isDocumentKey(s))throw new js(Vs.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);return Ji(e,new oi(s))}if(n instanceof Xu)return Ji(e,n._key);throw new js(Vs.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ku(n)}.`)}function xl(e,t){if(!Array.isArray(e)||0===e.length)throw new js(Vs.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function Fl(e,t){if(t.isInequality()){const n=jr(e),s=t.field;if(null!==n&&!n.isEqual(s))throw new js(Vs.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${s.toString()}'`);const i=Vr(e);null!==i&&Ul(e,s,i)}const n=function(e,t){for(const n of e)for(const e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new js(Vs.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new js(Vs.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}function Ul(e,t,n){if(!n.isEqual(t))throw new js(Vs.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${t.toString()}' and so you must also use '${t.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}class Vl{convertValue(e,t="none"){switch(Hi(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Fi(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(Ui(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 10:return this.convertObject(e.mapValue,t);default:throw xs()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const n={};return Ai(e,((e,s)=>{n[e]=this.convertValue(s,t)})),n}convertGeoPoint(e){return new ll(Fi(e.latitude),Fi(e.longitude))}convertArray(e,t){return(e.values||[]).map((e=>this.convertValue(e,t)))}convertServerTimestamp(e,t){switch(t){case"previous":const n=ji(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Bi(e));default:return null}}convertTimestamp(e){const t=xi(e);return new ei(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=si.fromString(e);Fs(Ma(n));const s=new $i(n.get(1),n.get(3)),i=new oi(n.popFirst(5));return s.isEqual(t)||Ls(`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 jl{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Bl extends Cl{constructor(e,t,n,s,i,r){super(e,t,n,s,r),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new ql(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(Sl("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}}class ql extends Bl{data(e={}){return super.data(e)}}class $l{constructor(e,t,n,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new jl(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 0===this.size}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new ql(this._firestore,this._userDataWriter,n.key,n,new jl(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 js(Vs.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map((n=>{const s=new ql(e._firestore,e._userDataWriter,n.doc.key,n.doc,new jl(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:s,oldIndex:-1,newIndex:t++}}))}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((e=>t||3!==e.type)).map((t=>{const s=new ql(e._firestore,e._userDataWriter,t.doc.key,t.doc,new jl(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let i=-1,r=-1;return 0!==t.type&&(i=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),r=n.indexOf(t.doc.key)),{type:zl(t.type),doc:s,oldIndex:i,newIndex:r}}))}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function zl(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return xs()}}function Hl(e){e=Wu(e,Xu);const t=Wu(e.firestore,sl);return ju(rl(t),e._key).then((n=>Wl(t,e,n)))}class Gl extends Vl{constructor(e){super(),this.firestore=e}convertBytes(e){return new al(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Xu(this.firestore,null,t)}}function Kl(e){e=Wu(e,Ju);const t=Wu(e.firestore,sl),n=rl(t),s=new Gl(t);return Tl(e._query),Bu(n,e._query).then((n=>new $l(t,s,e,n)))}function Wl(e,t,n){const s=n.docs.get(t._key),i=new Gl(e);return new Bl(e,i,t._key,s,new jl(n.hasPendingWrites,n.fromCache),t.converter)}!function(e,t=!0){!function(e){Ds=e}(i.Jn),(0,i.Xd)(new r.wA("firestore",((e,{instanceIdentifier:n,options:s})=>{const i=e.getProvider("app").getImmediate(),r=new sl(new Hs(e.getProvider("auth-internal")),new Qs(e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new js(Vs.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new $i(e.options.projectId,t)}(i,n),i);return s=Object.assign({useFetchStreams:t},s),r._setSettings(s),r}),"PUBLIC").setMultipleInstances(!0)),(0,i.KN)(Ts,"3.12.1",e),(0,i.KN)(Ts,"3.12.1","esm2017")}()}}]);
1
+ "use strict";(self.webpackChunkSSATemplates=self.webpackChunkSSATemplates||[]).push([[814],{258:function(e,t,n){n.d(t,{BH:function(){return d},L:function(){return o},LL:function(){return y},P0:function(){return l},Sg:function(){return p},ZR:function(){return g},aH:function(){return h},eu:function(){return m},hl:function(){return f},m9:function(){return E},vZ:function(){return v}});const s=function(e){const t=[];let 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++]=63&i|128):55296==(64512&i)&&s+1<e.length&&56320==(64512&e.charCodeAt(s+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++s)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let t=0;t<e.length;t+=3){const i=e[t],r=t+1<e.length,o=r?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,u=i>>2,l=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,r||(h=64)),s.push(n[u],n[l],n[h],n[d])}return s.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(s(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,s=0;for(;n<e.length;){const i=e[n++];if(i<128)t[s++]=String.fromCharCode(i);else if(i>191&&i<224){const r=e[n++];t[s++]=String.fromCharCode((31&i)<<6|63&r)}else if(i>239&&i<365){const r=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[s++]=String.fromCharCode(55296+(r>>10)),t[s++]=String.fromCharCode(56320+(1023&r))}else{const r=e[n++],o=e[n++];t[s++]=String.fromCharCode((15&i)<<12|(63&r)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let t=0;t<e.length;){const i=n[e.charAt(t++)],o=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==i||null==o||null==a||null==c)throw new r;const u=i<<2|o>>4;if(s.push(u),64!==a){const e=o<<4&240|a>>2;if(s.push(e),64!==c){const e=a<<6&192|c;s.push(e)}}}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class r extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const o=function(e){return function(e){const t=s(e);return i.encodeByteArray(t,!0)}(e).replace(/\./g,"")},a=function(e){try{return i.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};const c=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,u=()=>{try{return c()||(()=>{if("undefined"==typeof process||void 0==={ALLUSERSPROFILE:"C:\\ProgramData",ANDROID_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk",ANDROID_SDK_ROOT:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk",APPDATA:"C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming","asl.log":"Destination=file",CommonProgramFiles:"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files",CommonProgramW6432:"C:\\Program Files\\Common Files",COMPUTERNAME:"W23005",ComSpec:"C:\\windows\\system32\\cmd.exe",DriverData:"C:\\Windows\\System32\\Drivers\\DriverData",EFC_35152:"0",FPS_BROWSER_APP_PROFILE_STRING:"Internet Explorer",FPS_BROWSER_USER_PROFILE_STRING:"Default",HOME:"C:\\Users\\kostiantyn.petrenko",HOMEDRIVE:"C:",HOMEPATH:"\\Users\\kostiantyn.petrenko",IGCCSVC_DB:"AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAABzAPW+8cckC+AVlpiF6BiQQAAAACAAAAAAAQZgAAAAEAACAAAABtATYUVfnerbyC/jse8VmjR2PTkJ76psslt4jbzW0F5gAAAAAOgAAAAAIAACAAAACWVl7cQH8WgqfTCR9PIbDobz4HPZVFM/IO4Rh+F/zjvGAAAABy6Do7/5za8vHrXtoB8PQ7yjZfrcPTHvG0qGkDOdwaYqOFqVaLZ64EuN/pqQ5hFZ+rKwMV/rOPBCtMk6NDo43YWjXkjKNjtjg7xA+/oexS1Z67+c4GP60zU0x9//iGcvZAAAAAFaoYpREoxIHPW57M5ygt1OUtOVto62caJYHuz+D90cgurwVnU4TlPThXDn7czfCn80teoOHGBD4Uh2QomuugbQ==",INIT_CWD:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2",JAVA_HOME:"C:\\Program Files\\Java\\jdk-17",LOCALAPPDATA:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local",LOGONSERVER:"\\\\W23005",NODE:"C:\\Program Files\\nodejs\\node.exe",NODE_ENV:"production",NODE_PATH:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules\\webpack\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules\\webpack\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\node_modules",npm_command:"run-script",npm_config_frozen_lockfile:"",npm_config_node_gyp:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node_modules\\node-gyp\\bin\\node-gyp.js",npm_config_recursive:"true",npm_config_registry:"https://registry.npmjs.org/",npm_config_user_agent:"pnpm/8.10.4 npm/? node/v18.20.2 win32 x64",npm_execpath:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\pnpm.cjs",npm_lifecycle_event:"build",npm_lifecycle_script:"webpack --mode=production --node-env=production && tsc --build --force ./tsconfig.build.json && resolve-tspaths -p ./tsconfig.build.json",npm_node_execpath:"C:\\Program Files\\nodejs\\node.exe",npm_package_author:"SSA Group",npm_package_browserslist_0:">0.1%",npm_package_browserslist_1:"not dead",npm_package_browserslist_2:"not op_mini all",npm_package_dependencies_dompurify:"^3.1.7",npm_package_dependencies_dotenv:"^16.0.3",npm_package_dependencies_js_cookie:"^3.0.5",npm_package_dependencies_js_tokens:"^4.0.0",npm_package_dependencies_loose_envify:"^1.4.0",npm_package_dependencies_luxon:"^3.5.0",npm_package_dependencies_plotly_js:"^2.35.2",npm_package_dependencies_react_plotly_js:"^2.6.0",npm_package_dependencies_react_toastify:"^10.0.5",npm_package_dependencies_scheduler:"^0.23.0",npm_package_dependencies_usehooks_ts:"^3.1.0",npm_package_dependencies_uuid:"^9.0.0",npm_package_dependencies__emotion_core:"^11.0.0",npm_package_dependencies__emotion_css:"^11.11.2",npm_package_dependencies__emotion_react:"^11.11.1",npm_package_dependencies__emotion_styled:"^11.11.0",npm_package_dependencies__floating_ui_react:"0.25.4",npm_package_dependencies__nivo_colors:"0.84.0",npm_package_dependencies__ssa_ui_kit_core:"workspace:^",npm_package_dependencies__ssa_ui_kit_hooks:"workspace:^",npm_package_dependencies__ssa_ui_kit_utils:"workspace:^",npm_package_dependencies__ssa_ui_kit_widgets:"workspace:^",npm_package_description:"SSA UI Kit templates",npm_package_devDependencies_resolve_tspaths:"^0.8.16",npm_package_devDependencies_storybook_addon_pseudo_states:"^2.1.0",npm_package_devDependencies_terser_webpack_plugin:"^5.3.9",npm_package_devDependencies_webpack:"^5.85.0",npm_package_devDependencies__emotion_jest:"^11.11.0",npm_package_devDependencies__playwright_test:"^1.48.0",npm_package_devDependencies__testing_library_jest_dom:"^5.16.5",npm_package_devDependencies__types_dompurify:"^3.0.5",npm_package_devDependencies__types_js_cookie:"^3.0.6",npm_package_devDependencies__types_luxon:"^3.4.2",npm_package_devDependencies__types_react_plotly_js:"^2.6.3",npm_package_devDependencies__types_testing_library__jest_dom:"^5.14.6",npm_package_devDependencies__types_uuid:"^9.0.3",npm_package_keywords_0:"react",npm_package_keywords_1:"SSA UI Kit",npm_package_keywords_2:"ui",npm_package_license:"MIT",npm_package_main:"dist/index.js",npm_package_name:"@ssa-ui-kit/templates",npm_package_peerDependenciesMeta__types_react_optional:"true",npm_package_peerDependencies_react:"18.x",npm_package_peerDependencies_react_dom:"18.x",npm_package_peerDependencies_react_hook_form:"^7.46.1",npm_package_peerDependencies_react_router_dom:"6.x",npm_package_peerDependencies__emotion_core:"^11.0.0",npm_package_peerDependencies__emotion_css:"^11.11.0",npm_package_peerDependencies__emotion_react:"^11.11.1",npm_package_peerDependencies__emotion_styled:"^11.11.0",npm_package_peerDependencies__nivo_core:"^0.84.0",npm_package_peerDependencies__nivo_line:"^0.84.0",npm_package_peerDependencies__nivo_pie:"^0.84.0",npm_package_peerDependencies__nivo_scales:"^0.84.0",npm_package_private:"false",npm_package_repository_directory:"packages/templates",npm_package_repository_type:"git",npm_package_repository_url:"https://github.com/ssagroup/ui-kit.git",npm_package_scripts_build:"webpack --mode=production --node-env=production && tsc --build --force ./tsconfig.build.json && resolve-tspaths -p ./tsconfig.build.json",npm_package_scripts_sb_build:"storybook build",npm_package_scripts_sb_dev:"storybook dev -p 6008",npm_package_scripts_test:"jest -i --no-cache",npm_package_scripts_test_e2e:"pnpm exec playwright test --project=chromium",npm_package_scripts_test_e2e_debug:"pnpm exec playwright test --project=chromium --debug",npm_package_scripts_test_e2e_ui:"pnpm exec playwright test --project=chromium --ui",npm_package_scripts_ts_check:"tsc --noEmit -p ./tsconfig.json",npm_package_scripts_ts_check_build:"tsc -p ./tsconfig.build.json",npm_package_scripts_ts_show_config:"tsc --showConfig -p ./tsconfig.json",npm_package_scripts_ts_show_config_build:"tsc --showConfig -p ./tsconfig.build.json",npm_package_sideEffects:"false",npm_package_types:"dist/index.d.ts",npm_package_version:"1.0.11",NUMBER_OF_PROCESSORS:"20",NVM_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm",NVM_SYMLINK:"C:\\Program Files\\nodejs",OneDrive:"C:\\Users\\kostiantyn.petrenko\\OneDrive - SSA Group",OneDriveCommercial:"C:\\Users\\kostiantyn.petrenko\\OneDrive - SSA Group",OnlineServices:"Online Services",OS:"Windows_NT",Path:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\packages\\templates\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node-gyp-bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node-gyp-bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\Program Files\\Git\\cmd;C:\\Program Files\\HP\\HP One Agent;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk\\platform-tools;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk\\tools;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\jdk-11.0.2\\bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs",PATHEXT:".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JSE;.WSF;.WSH;.MSC",platformcode:"M8",PNPM_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm",PNPM_SCRIPT_SRC_DIR:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\packages\\templates",PROCESSOR_ARCHITECTURE:"AMD64",PROCESSOR_IDENTIFIER:"Intel64 Family 6 Model 154 Stepping 3, GenuineIntel",PROCESSOR_LEVEL:"6",PROCESSOR_REVISION:"9a03",ProgramData:"C:\\ProgramData",ProgramFiles:"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)",ProgramW6432:"C:\\Program Files",PROMPT:"$P$G",PSModulePath:"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\windows\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files\\Microsoft Monitoring Agent\\Agent\\PowerShell\\",PUBLIC:"C:\\Users\\Public",RegionCode:"NA",SESSIONNAME:"Console",SystemDrive:"C:",SystemRoot:"C:\\windows",TEMP:"C:\\Users\\KOSTIA~1.PET\\AppData\\Local\\Temp",TMP:"C:\\Users\\KOSTIA~1.PET\\AppData\\Local\\Temp",USERDNSDOMAIN:"SSA-Outsourcing.com",USERDOMAIN:"SSA",USERDOMAIN_ROAMINGPROFILE:"SSA",USERNAME:"kostiantyn.petrenko",USERPROFILE:"C:\\Users\\kostiantyn.petrenko",windir:"C:\\windows",ZES_ENABLE_SYSMAN:"1"})return;const e={ALLUSERSPROFILE:"C:\\ProgramData",ANDROID_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk",ANDROID_SDK_ROOT:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk",APPDATA:"C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming","asl.log":"Destination=file",CommonProgramFiles:"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files",CommonProgramW6432:"C:\\Program Files\\Common Files",COMPUTERNAME:"W23005",ComSpec:"C:\\windows\\system32\\cmd.exe",DriverData:"C:\\Windows\\System32\\Drivers\\DriverData",EFC_35152:"0",FPS_BROWSER_APP_PROFILE_STRING:"Internet Explorer",FPS_BROWSER_USER_PROFILE_STRING:"Default",HOME:"C:\\Users\\kostiantyn.petrenko",HOMEDRIVE:"C:",HOMEPATH:"\\Users\\kostiantyn.petrenko",IGCCSVC_DB:"AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAABzAPW+8cckC+AVlpiF6BiQQAAAACAAAAAAAQZgAAAAEAACAAAABtATYUVfnerbyC/jse8VmjR2PTkJ76psslt4jbzW0F5gAAAAAOgAAAAAIAACAAAACWVl7cQH8WgqfTCR9PIbDobz4HPZVFM/IO4Rh+F/zjvGAAAABy6Do7/5za8vHrXtoB8PQ7yjZfrcPTHvG0qGkDOdwaYqOFqVaLZ64EuN/pqQ5hFZ+rKwMV/rOPBCtMk6NDo43YWjXkjKNjtjg7xA+/oexS1Z67+c4GP60zU0x9//iGcvZAAAAAFaoYpREoxIHPW57M5ygt1OUtOVto62caJYHuz+D90cgurwVnU4TlPThXDn7czfCn80teoOHGBD4Uh2QomuugbQ==",INIT_CWD:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2",JAVA_HOME:"C:\\Program Files\\Java\\jdk-17",LOCALAPPDATA:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local",LOGONSERVER:"\\\\W23005",NODE:"C:\\Program Files\\nodejs\\node.exe",NODE_ENV:"production",NODE_PATH:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules\\webpack\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules\\webpack\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\webpack@5.85.0_@swc+core@1.3.79_esbuild@0.18.20_webpack-cli@5.1.1\\node_modules;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\node_modules",npm_command:"run-script",npm_config_frozen_lockfile:"",npm_config_node_gyp:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node_modules\\node-gyp\\bin\\node-gyp.js",npm_config_recursive:"true",npm_config_registry:"https://registry.npmjs.org/",npm_config_user_agent:"pnpm/8.10.4 npm/? node/v18.20.2 win32 x64",npm_execpath:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\bin\\pnpm.cjs",npm_lifecycle_event:"build",npm_lifecycle_script:"webpack --mode=production --node-env=production && tsc --build --force ./tsconfig.build.json && resolve-tspaths -p ./tsconfig.build.json",npm_node_execpath:"C:\\Program Files\\nodejs\\node.exe",npm_package_author:"SSA Group",npm_package_browserslist_0:">0.1%",npm_package_browserslist_1:"not dead",npm_package_browserslist_2:"not op_mini all",npm_package_dependencies_dompurify:"^3.1.7",npm_package_dependencies_dotenv:"^16.0.3",npm_package_dependencies_js_cookie:"^3.0.5",npm_package_dependencies_js_tokens:"^4.0.0",npm_package_dependencies_loose_envify:"^1.4.0",npm_package_dependencies_luxon:"^3.5.0",npm_package_dependencies_plotly_js:"^2.35.2",npm_package_dependencies_react_plotly_js:"^2.6.0",npm_package_dependencies_react_toastify:"^10.0.5",npm_package_dependencies_scheduler:"^0.23.0",npm_package_dependencies_usehooks_ts:"^3.1.0",npm_package_dependencies_uuid:"^9.0.0",npm_package_dependencies__emotion_core:"^11.0.0",npm_package_dependencies__emotion_css:"^11.11.2",npm_package_dependencies__emotion_react:"^11.11.1",npm_package_dependencies__emotion_styled:"^11.11.0",npm_package_dependencies__floating_ui_react:"0.25.4",npm_package_dependencies__nivo_colors:"0.84.0",npm_package_dependencies__ssa_ui_kit_core:"workspace:^",npm_package_dependencies__ssa_ui_kit_hooks:"workspace:^",npm_package_dependencies__ssa_ui_kit_utils:"workspace:^",npm_package_dependencies__ssa_ui_kit_widgets:"workspace:^",npm_package_description:"SSA UI Kit templates",npm_package_devDependencies_resolve_tspaths:"^0.8.16",npm_package_devDependencies_storybook_addon_pseudo_states:"^2.1.0",npm_package_devDependencies_terser_webpack_plugin:"^5.3.9",npm_package_devDependencies_webpack:"^5.85.0",npm_package_devDependencies__emotion_jest:"^11.11.0",npm_package_devDependencies__playwright_test:"^1.48.0",npm_package_devDependencies__testing_library_jest_dom:"^5.16.5",npm_package_devDependencies__types_dompurify:"^3.0.5",npm_package_devDependencies__types_js_cookie:"^3.0.6",npm_package_devDependencies__types_luxon:"^3.4.2",npm_package_devDependencies__types_react_plotly_js:"^2.6.3",npm_package_devDependencies__types_testing_library__jest_dom:"^5.14.6",npm_package_devDependencies__types_uuid:"^9.0.3",npm_package_keywords_0:"react",npm_package_keywords_1:"SSA UI Kit",npm_package_keywords_2:"ui",npm_package_license:"MIT",npm_package_main:"dist/index.js",npm_package_name:"@ssa-ui-kit/templates",npm_package_peerDependenciesMeta__types_react_optional:"true",npm_package_peerDependencies_react:"18.x",npm_package_peerDependencies_react_dom:"18.x",npm_package_peerDependencies_react_hook_form:"^7.46.1",npm_package_peerDependencies_react_router_dom:"6.x",npm_package_peerDependencies__emotion_core:"^11.0.0",npm_package_peerDependencies__emotion_css:"^11.11.0",npm_package_peerDependencies__emotion_react:"^11.11.1",npm_package_peerDependencies__emotion_styled:"^11.11.0",npm_package_peerDependencies__nivo_core:"^0.84.0",npm_package_peerDependencies__nivo_line:"^0.84.0",npm_package_peerDependencies__nivo_pie:"^0.84.0",npm_package_peerDependencies__nivo_scales:"^0.84.0",npm_package_private:"false",npm_package_repository_directory:"packages/templates",npm_package_repository_type:"git",npm_package_repository_url:"https://github.com/ssagroup/ui-kit.git",npm_package_scripts_build:"webpack --mode=production --node-env=production && tsc --build --force ./tsconfig.build.json && resolve-tspaths -p ./tsconfig.build.json",npm_package_scripts_sb_build:"storybook build",npm_package_scripts_sb_dev:"storybook dev -p 6008",npm_package_scripts_test:"jest -i --no-cache",npm_package_scripts_test_e2e:"pnpm exec playwright test --project=chromium",npm_package_scripts_test_e2e_debug:"pnpm exec playwright test --project=chromium --debug",npm_package_scripts_test_e2e_ui:"pnpm exec playwright test --project=chromium --ui",npm_package_scripts_ts_check:"tsc --noEmit -p ./tsconfig.json",npm_package_scripts_ts_check_build:"tsc -p ./tsconfig.build.json",npm_package_scripts_ts_show_config:"tsc --showConfig -p ./tsconfig.json",npm_package_scripts_ts_show_config_build:"tsc --showConfig -p ./tsconfig.build.json",npm_package_sideEffects:"false",npm_package_types:"dist/index.d.ts",npm_package_version:"1.0.11",NUMBER_OF_PROCESSORS:"20",NVM_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm",NVM_SYMLINK:"C:\\Program Files\\nodejs",OneDrive:"C:\\Users\\kostiantyn.petrenko\\OneDrive - SSA Group",OneDriveCommercial:"C:\\Users\\kostiantyn.petrenko\\OneDrive - SSA Group",OnlineServices:"Online Services",OS:"Windows_NT",Path:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\packages\\templates\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node-gyp-bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm\\global\\5\\.pnpm\\pnpm@8.10.4\\node_modules\\pnpm\\dist\\node-gyp-bin;C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\node_modules\\.bin;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs;C:\\Program Files\\Git\\cmd;C:\\Program Files\\HP\\HP One Agent;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk\\platform-tools;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Android\\Sdk\\tools;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\jdk-11.0.2\\bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\kostiantyn.petrenko\\AppData\\Roaming\\nvm;C:\\Program Files\\nodejs",PATHEXT:".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JSE;.WSF;.WSH;.MSC",platformcode:"M8",PNPM_HOME:"C:\\Users\\kostiantyn.petrenko\\AppData\\Local\\pnpm",PNPM_SCRIPT_SRC_DIR:"C:\\Users\\kostiantyn.petrenko\\projects\\ui-kit-2\\packages\\templates",PROCESSOR_ARCHITECTURE:"AMD64",PROCESSOR_IDENTIFIER:"Intel64 Family 6 Model 154 Stepping 3, GenuineIntel",PROCESSOR_LEVEL:"6",PROCESSOR_REVISION:"9a03",ProgramData:"C:\\ProgramData",ProgramFiles:"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)",ProgramW6432:"C:\\Program Files",PROMPT:"$P$G",PSModulePath:"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\windows\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files\\Microsoft Monitoring Agent\\Agent\\PowerShell\\",PUBLIC:"C:\\Users\\Public",RegionCode:"NA",SESSIONNAME:"Console",SystemDrive:"C:",SystemRoot:"C:\\windows",TEMP:"C:\\Users\\KOSTIA~1.PET\\AppData\\Local\\Temp",TMP:"C:\\Users\\KOSTIA~1.PET\\AppData\\Local\\Temp",USERDNSDOMAIN:"SSA-Outsourcing.com",USERDOMAIN:"SSA",USERDOMAIN_ROAMINGPROFILE:"SSA",USERNAME:"kostiantyn.petrenko",USERPROFILE:"C:\\Users\\kostiantyn.petrenko",windir:"C:\\windows",ZES_ENABLE_SYSMAN:"1"}.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&a(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},l=e=>{const t=(e=>{var t,n;return null===(n=null===(t=u())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]})(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const s=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),s]:[t.substring(0,n),s]},h=()=>{var e;return null===(e=u())||void 0===e?void 0:e.config};class d{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),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}function p(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",s=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const r=Object.assign({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:{}}},e);return[o(JSON.stringify({alg:"none",type:"JWT"})),o(JSON.stringify(r)),""].join(".")}function f(){try{return"object"==typeof indexedDB}catch(e){return!1}}function m(){return new Promise(((e,t)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(s);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(s),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))}class g extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,g.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,y.prototype.create)}}class y{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],r=i?function(e,t){return e.replace(_,((e,n)=>{const s=t[n];return null!=s?String(s):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${r} (${s}).`;return new g(s,o,n)}}const _=/\{\$([^}]+)}/g;function v(e,t){if(e===t)return!0;const n=Object.keys(e),s=Object.keys(t);for(const i of n){if(!s.includes(i))return!1;const n=e[i],r=t[i];if(w(n)&&w(r)){if(!v(n,r))return!1}else if(n!==r)return!1}for(const e of s)if(!n.includes(e))return!1;return!0}function w(e){return null!==e&&"object"==typeof e}function E(e){return e&&e._delegate?e._delegate:e}},727:function(e,t,n){n.d(t,{Jn:function(){return F},qX:function(){return P},Xd:function(){return O},Mq:function(){return V},C6:function(){return j},ZF:function(){return U},KN:function(){return B}});var s=n(571),i=n(264),r=n(258);const o=(e,t)=>t.some((t=>e instanceof t));let a,c;const u=new WeakMap,l=new WeakMap,h=new WeakMap,d=new WeakMap,p=new WeakMap;let f={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return l.get(e);if("objectStoreNames"===t)return e.objectStoreNames||h.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return y(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function m(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(c||(c=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(_(this),t),y(u.get(this))}:function(...t){return y(e.apply(_(this),t))}:function(t,...n){const s=e.call(_(this),t,...n);return h.set(s,t.sort?t.sort():[t]),y(s)}}function g(e){return"function"==typeof e?m(e):(e instanceof IDBTransaction&&function(e){if(l.has(e))return;const t=new Promise(((t,n)=>{const s=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",r),e.removeEventListener("abort",r)},i=()=>{t(),s()},r=()=>{n(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",i),e.addEventListener("error",r),e.addEventListener("abort",r)}));l.set(e,t)}(e),o(e,a||(a=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,f):e)}function y(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const s=()=>{e.removeEventListener("success",i),e.removeEventListener("error",r)},i=()=>{t(y(e.result)),s()},r=()=>{n(e.error),s()};e.addEventListener("success",i),e.addEventListener("error",r)}));return t.then((t=>{t instanceof IDBCursor&&u.set(t,e)})).catch((()=>{})),p.set(t,e),t}(e);if(d.has(e))return d.get(e);const t=g(e);return t!==e&&(d.set(e,t),p.set(t,e)),t}const _=e=>p.get(e);const v=["get","getKey","getAll","getAllKeys","count"],w=["put","add","delete","clear"],E=new Map;function b(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(E.get(t))return E.get(t);const n=t.replace(/FromIndex$/,""),s=t!==n,i=w.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!i&&!v.includes(n))return;const r=async function(e,...t){const r=this.transaction(e,i?"readwrite":"readonly");let o=r.store;return s&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&r.done]))[0]};return E.set(t,r),r}f=(e=>({...e,get:(t,n,s)=>b(t,n)||e.get(t,n,s),has:(t,n)=>!!b(t,n)||e.has(t,n)}))(f);class k{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const C="@firebase/app",A="0.9.11",S=new i.Yd("@firebase/app"),T="[DEFAULT]",I={[C]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},D=new Map,N=new Map;function R(e,t){try{e.container.addComponent(t)}catch(n){S.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function O(e){const t=e.name;if(N.has(t))return S.debug(`There were multiple attempts to register component ${t}.`),!1;N.set(t,e);for(const t of D.values())R(t,e);return!0}function P(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}const L={"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","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."},M=new r.LL("app","Firebase",L);class x{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new s.wA("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 M.create("app-deleted",{appName:this._name})}}const F="9.22.1";function U(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const i=Object.assign({name:T,automaticDataCollectionEnabled:!1},t),o=i.name;if("string"!=typeof o||!o)throw M.create("bad-app-name",{appName:String(o)});if(n||(n=(0,r.aH)()),!n)throw M.create("no-options");const a=D.get(o);if(a){if((0,r.vZ)(n,a.options)&&(0,r.vZ)(i,a.config))return a;throw M.create("duplicate-app",{appName:o})}const c=new s.H0(o);for(const e of N.values())c.addComponent(e);const u=new x(n,i,c);return D.set(o,u),u}function V(e=T){const t=D.get(e);if(!t&&e===T&&(0,r.aH)())return U();if(!t)throw M.create("no-app",{appName:e});return t}function j(){return Array.from(D.values())}function B(e,t,n){var i;let r=null!==(i=I[e])&&void 0!==i?i:e;n&&(r+=`-${n}`);const o=r.match(/\s|\//),a=t.match(/\s|\//);if(o||a){const e=[`Unable to register library "${r}" with version "${t}":`];return o&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),o&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void S.warn(e.join(" "))}O(new s.wA(`${r}-version`,(()=>({library:r,version:t})),"VERSION"))}const q="firebase-heartbeat-database",$=1,z="firebase-heartbeat-store";let H=null;function G(){return H||(H=function(e,t,{blocked:n,upgrade:s,blocking:i,terminated:r}={}){const o=indexedDB.open(e,t),a=y(o);return s&&o.addEventListener("upgradeneeded",(e=>{s(y(o.result),e.oldVersion,e.newVersion,y(o.transaction),e)})),n&&o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),a.then((e=>{r&&e.addEventListener("close",(()=>r())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),a}(q,$,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(z)}}).catch((e=>{throw M.create("idb-open",{originalErrorMessage:e.message})}))),H}async function K(e,t){try{const n=(await G()).transaction(z,"readwrite"),s=n.objectStore(z);await s.put(t,W(e)),await n.done}catch(e){if(e instanceof r.ZR)S.warn(e.message);else{const t=M.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});S.warn(t.message)}}}function W(e){return`${e.name}!${e.options.appId}`}class Q{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new X(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=Y();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==t&&!this._heartbeatsCache.heartbeats.some((e=>e.date===t)))return this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const e=Y(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){const n=[];let s=e.slice();for(const i of e){const e=n.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),J(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),J(n)>t){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}(this._heartbeatsCache.heartbeats),s=(0,r.L)(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}}function Y(){return(new Date).toISOString().substring(0,10)}class X{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,r.hl)()&&(0,r.eu)().then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){return await async function(e){try{const t=await G();return await t.transaction(z).objectStore(z).get(W(e))}catch(e){if(e instanceof r.ZR)S.warn(e.message);else{const t=M.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});S.warn(t.message)}}}(this.app)||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return K(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return K(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function J(e){return(0,r.L)(JSON.stringify({version:2,heartbeats:e})).length}var Z;Z="",O(new s.wA("platform-logger",(e=>new k(e)),"PRIVATE")),O(new s.wA("heartbeat",(e=>new Q(e)),"PRIVATE")),B(C,A,Z),B(C,A,"esm2017"),B("fire-js","")},571:function(e,t,n){n.d(t,{H0:function(){return a},wA:function(){return i}});var s=n(258);class i{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 r="[DEFAULT]";class o{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 e=new s.BH;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),s=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(s)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(s)return null;throw e}}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(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:r})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=r){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((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(e=r){return this.instances.has(e)}getOptions(e=r){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[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(s)}return s}onInit(e,t){var n;const s=this.normalizeInstanceIdentifier(t),i=null!==(n=this.onInitCallbacks.get(s))&&void 0!==n?n:new Set;i.add(e),this.onInitCallbacks.set(s,i);const r=this.instances.get(s);return r&&e(r,s),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const s of n)try{s(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(s=e,s===r?void 0:s),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(e){}var s;return n||null}normalizeInstanceIdentifier(e=r){return this.component?this.component.multipleInstances?e:r:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class a{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 o(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}},264:function(e,t,n){n.d(t,{Yd:function(){return u},in:function(){return i}});const s=[];var i;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(i||(i={}));const r={debug:i.DEBUG,verbose:i.VERBOSE,info:i.INFO,warn:i.WARN,error:i.ERROR,silent:i.SILENT},o=i.INFO,a={[i.DEBUG]:"log",[i.VERBOSE]:"log",[i.INFO]:"info",[i.WARN]:"warn",[i.ERROR]:"error"},c=(e,t,...n)=>{if(t<e.logLevel)return;const s=(new Date).toISOString(),i=a[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${s}] ${e.name}:`,...n)};class u{constructor(e){this.name=e,this._logLevel=o,this._logHandler=c,this._userLogHandler=null,s.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in i))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?r[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,i.DEBUG,...e),this._logHandler(this,i.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,i.VERBOSE,...e),this._logHandler(this,i.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,i.INFO,...e),this._logHandler(this,i.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,i.WARN,...e),this._logHandler(this,i.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,i.ERROR,...e),this._logHandler(this,i.ERROR,...e)}}},968:function(e,t,n){n.d(t,{C6:function(){return s.C6},Mq:function(){return s.Mq},ZF:function(){return s.ZF}});var s=n(727);(0,s.KN)("firebase","9.22.1","app")},18:function(e,t,n){n.d(t,{hJ:function(){return el},JU:function(){return tl},QT:function(){return Hl},PL:function(){return Kl},ad:function(){return il},Xo:function(){return Ll},IO:function(){return Nl}});var s,i=n(727),r=n(571),o=n(264),a=n(258),c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},u={},l=l||{},h=c||self;function d(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function p(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}var f="closure_uid_"+(1e9*Math.random()>>>0),m=0;function g(e,t,n){return e.call.apply(e.bind,arguments)}function y(e,t,n){if(!e)throw Error();if(2<arguments.length){var s=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,s),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function _(e,t,n){return(_=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?g:y).apply(null,arguments)}function v(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function w(e,t){function n(){}n.prototype=t.prototype,e.$=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.ac=function(e,n,s){for(var i=Array(arguments.length-2),r=2;r<arguments.length;r++)i[r-2]=arguments[r];return t.prototype[n].apply(e,i)}}function E(){this.s=this.s,this.o=this.o}E.prototype.s=!1,E.prototype.sa=function(){var e;!this.s&&(this.s=!0,this.N(),0)&&(e=this,Object.prototype.hasOwnProperty.call(e,f)&&e[f]||(e[f]=++m))},E.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};const b=Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t,void 0)}:function(e,t){if("string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.indexOf(t,0);for(let n=0;n<e.length;n++)if(n in e&&e[n]===t)return n;return-1};function k(e){const t=e.length;if(0<t){const n=Array(t);for(let s=0;s<t;s++)n[s]=e[s];return n}return[]}function C(e,t){for(let t=1;t<arguments.length;t++){const n=arguments[t];if(d(n)){const t=e.length||0,s=n.length||0;e.length=t+s;for(let i=0;i<s;i++)e[t+i]=n[i]}else e.push(n)}}function A(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}A.prototype.h=function(){this.defaultPrevented=!0};var S=function(){if(!h.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{h.addEventListener("test",(()=>{}),t),h.removeEventListener("test",(()=>{}),t)}catch(e){}return e}();function T(e){return/^[\s\xa0]*$/.test(e)}function I(){var e=h.navigator;return e&&(e=e.userAgent)?e:""}function D(e){return-1!=I().indexOf(e)}function N(e){return N[" "](e),e}N[" "]=function(){};var R,O,P,L=D("Opera"),M=D("Trident")||D("MSIE"),x=D("Edge"),F=x||M,U=D("Gecko")&&!(-1!=I().toLowerCase().indexOf("webkit")&&!D("Edge"))&&!(D("Trident")||D("MSIE"))&&!D("Edge"),V=-1!=I().toLowerCase().indexOf("webkit")&&!D("Edge");function j(){var e=h.document;return e?e.documentMode:void 0}e:{var B="",q=(O=I(),U?/rv:([^\);]+)(\)|;)/.exec(O):x?/Edge\/([\d\.]+)/.exec(O):M?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(O):V?/WebKit\/(\S+)/.exec(O):L?/(?:Version)[ \/]?(\S+)/.exec(O):void 0);if(q&&(B=q?q[1]:""),M){var $=j();if(null!=$&&$>parseFloat(B)){R=String($);break e}}R=B}if(h.document&&M){var z=j();P=z||(parseInt(R,10)||void 0)}else P=void 0;var H=P;function G(e,t){if(A.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,s=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(U){e:{try{N(t.nodeName);var i=!0;break e}catch(e){}i=!1}i||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,s?(this.clientX=void 0!==s.clientX?s.clientX:s.pageX,this.clientY=void 0!==s.clientY?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:K[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&G.$.h.call(this)}}w(G,A);var K={2:"touch",3:"pen",4:"mouse"};G.prototype.h=function(){G.$.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var W="closure_listenable_"+(1e6*Math.random()|0),Q=0;function Y(e,t,n,s,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!s,this.la=i,this.key=++Q,this.fa=this.ia=!1}function X(e){e.fa=!0,e.listener=null,e.proxy=null,e.src=null,e.la=null}function J(e,t,n){for(const s in e)t.call(n,e[s],s,e)}function Z(e){const t={};for(const n in e)t[n]=e[n];return t}const ee="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function te(e,t){let n,s;for(let t=1;t<arguments.length;t++){for(n in s=arguments[t],s)e[n]=s[n];for(let t=0;t<ee.length;t++)n=ee[t],Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}}function ne(e){this.src=e,this.g={},this.h=0}function se(e,t){var n=t.type;if(n in e.g){var s,i=e.g[n],r=b(i,t);(s=0<=r)&&Array.prototype.splice.call(i,r,1),s&&(X(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function ie(e,t,n,s){for(var i=0;i<e.length;++i){var r=e[i];if(!r.fa&&r.listener==t&&r.capture==!!n&&r.la==s)return i}return-1}ne.prototype.add=function(e,t,n,s,i){var r=e.toString();(e=this.g[r])||(e=this.g[r]=[],this.h++);var o=ie(e,t,s,i);return-1<o?(t=e[o],n||(t.ia=!1)):((t=new Y(t,this.src,r,!!s,i)).ia=n,e.push(t)),t};var re="closure_lm_"+(1e6*Math.random()|0),oe={};function ae(e,t,n,s,i){if(s&&s.once)return ue(e,t,n,s,i);if(Array.isArray(t)){for(var r=0;r<t.length;r++)ae(e,t[r],n,s,i);return null}return n=ge(n),e&&e[W]?e.O(t,n,p(s)?!!s.capture:!!s,i):ce(e,t,n,!1,s,i)}function ce(e,t,n,s,i,r){if(!t)throw Error("Invalid event type");var o=p(i)?!!i.capture:!!i,a=fe(e);if(a||(e[re]=a=new ne(e)),(n=a.add(t,n,s,o,r)).proxy)return n;if(s=function(){function e(n){return t.call(e.src,e.listener,n)}const t=pe;return e}(),n.proxy=s,s.src=e,s.listener=n,e.addEventListener)S||(i=o),void 0===i&&(i=!1),e.addEventListener(t.toString(),s,i);else if(e.attachEvent)e.attachEvent(de(t.toString()),s);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(s)}return n}function ue(e,t,n,s,i){if(Array.isArray(t)){for(var r=0;r<t.length;r++)ue(e,t[r],n,s,i);return null}return n=ge(n),e&&e[W]?e.P(t,n,p(s)?!!s.capture:!!s,i):ce(e,t,n,!0,s,i)}function le(e,t,n,s,i){if(Array.isArray(t))for(var r=0;r<t.length;r++)le(e,t[r],n,s,i);else s=p(s)?!!s.capture:!!s,n=ge(n),e&&e[W]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=ie(r=e.g[t],n,s,i))&&(X(r[n]),Array.prototype.splice.call(r,n,1),0==r.length&&(delete e.g[t],e.h--)))):e&&(e=fe(e))&&(t=e.g[t.toString()],e=-1,t&&(e=ie(t,n,s,i)),(n=-1<e?t[e]:null)&&he(n))}function he(e){if("number"!=typeof e&&e&&!e.fa){var t=e.src;if(t&&t[W])se(t.i,e);else{var n=e.type,s=e.proxy;t.removeEventListener?t.removeEventListener(n,s,e.capture):t.detachEvent?t.detachEvent(de(n),s):t.addListener&&t.removeListener&&t.removeListener(s),(n=fe(t))?(se(n,e),0==n.h&&(n.src=null,t[re]=null)):X(e)}}}function de(e){return e in oe?oe[e]:oe[e]="on"+e}function pe(e,t){if(e.fa)e=!0;else{t=new G(t,this);var n=e.listener,s=e.la||e.src;e.ia&&he(e),e=n.call(s,t)}return e}function fe(e){return(e=e[re])instanceof ne?e:null}var me="__closure_events_fn_"+(1e9*Math.random()>>>0);function ge(e){return"function"==typeof e?e:(e[me]||(e[me]=function(t){return e.handleEvent(t)}),e[me])}function ye(){E.call(this),this.i=new ne(this),this.S=this,this.J=null}function _e(e,t){var n,s=e.J;if(s)for(n=[];s;s=s.J)n.push(s);if(e=e.S,s=t.type||t,"string"==typeof t)t=new A(t,e);else if(t instanceof A)t.target=t.target||e;else{var i=t;te(t=new A(s,e),i)}if(i=!0,n)for(var r=n.length-1;0<=r;r--){var o=t.g=n[r];i=ve(o,s,!0,t)&&i}if(i=ve(o=t.g=e,s,!0,t)&&i,i=ve(o,s,!1,t)&&i,n)for(r=0;r<n.length;r++)i=ve(o=t.g=n[r],s,!1,t)&&i}function ve(e,t,n,s){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var i=!0,r=0;r<t.length;++r){var o=t[r];if(o&&!o.fa&&o.capture==n){var a=o.listener,c=o.la||o.src;o.ia&&se(e.i,o),i=!1!==a.call(c,s)&&i}}return i&&!s.defaultPrevented}w(ye,E),ye.prototype[W]=!0,ye.prototype.removeEventListener=function(e,t,n,s){le(this,e,t,n,s)},ye.prototype.N=function(){if(ye.$.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],s=0;s<n.length;s++)X(n[s]);delete t.g[e],t.h--}}this.J=null},ye.prototype.O=function(e,t,n,s){return this.i.add(String(e),t,!1,n,s)},ye.prototype.P=function(e,t,n,s){return this.i.add(String(e),t,!0,n,s)};var we=h.JSON.stringify;function Ee(){var e=Ie;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var be=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}((()=>new ke),(e=>e.reset()));class ke{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}function Ce(e){var t=1;e=e.split(":");const n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function Ae(e){h.setTimeout((()=>{throw e}),0)}let Se,Te=!1,Ie=new class{constructor(){this.h=this.g=null}add(e,t){const n=be.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},De=()=>{const e=h.Promise.resolve(void 0);Se=()=>{e.then(Ne)}};var Ne=()=>{for(var e;e=Ee();){try{e.h.call(e.g)}catch(e){Ae(e)}var t=be;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}Te=!1};function Re(e,t){ye.call(this),this.h=e||1,this.g=t||h,this.j=_(this.qb,this),this.l=Date.now()}function Oe(e){e.ga=!1,e.T&&(e.g.clearTimeout(e.T),e.T=null)}function Pe(e,t,n){if("function"==typeof e)n&&(e=_(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=_(e.handleEvent,e)}return 2147483647<Number(t)?-1:h.setTimeout(e,t||0)}function Le(e){e.g=Pe((()=>{e.g=null,e.i&&(e.i=!1,Le(e))}),e.j);const t=e.h;e.h=null,e.m.apply(null,t)}w(Re,ye),(s=Re.prototype).ga=!1,s.T=null,s.qb=function(){if(this.ga){var e=Date.now()-this.l;0<e&&e<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-e):(this.T&&(this.g.clearTimeout(this.T),this.T=null),_e(this,"tick"),this.ga&&(Oe(this),this.start()))}},s.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())},s.N=function(){Re.$.N.call(this),Oe(this),delete this.g};class Me extends E{constructor(e,t){super(),this.m=e,this.j=t,this.h=null,this.i=!1,this.g=null}l(e){this.h=arguments,this.g?this.i=!0:Le(this)}N(){super.N(),this.g&&(h.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function xe(e){E.call(this),this.h=e,this.g={}}w(xe,E);var Fe=[];function Ue(e,t,n,s){Array.isArray(n)||(n&&(Fe[0]=n.toString()),n=Fe);for(var i=0;i<n.length;i++){var r=ae(t,n[i],s||e.handleEvent,!1,e.h||e);if(!r)break;e.g[r.key]=r}}function Ve(e){J(e.g,(function(e,t){this.g.hasOwnProperty(t)&&he(e)}),e),e.g={}}function je(){this.g=!0}function Be(e,t,n,s){e.info((function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n)for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var s=n[e];if(!(2>s.length)){var i=s[1];if(Array.isArray(i)&&!(1>i.length)){var r=i[0];if("noop"!=r&&"stop"!=r&&"close"!=r)for(var o=1;o<i.length;o++)i[o]=""}}}return we(n)}catch(e){return t}}(e,n)+(s?" "+s:"")}))}xe.prototype.N=function(){xe.$.N.call(this),Ve(this)},xe.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},je.prototype.Ea=function(){this.g=!1},je.prototype.info=function(){};var qe={},$e=null;function ze(){return $e=$e||new ye}function He(e){A.call(this,qe.Ta,e)}function Ge(e){const t=ze();_e(t,new He(t))}function Ke(e,t){A.call(this,qe.STAT_EVENT,e),this.stat=t}function We(e){const t=ze();_e(t,new Ke(t,e))}function Qe(e,t){A.call(this,qe.Ua,e),this.size=t}function Ye(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return h.setTimeout((function(){e()}),t)}qe.Ta="serverreachability",w(He,A),qe.STAT_EVENT="statevent",w(Ke,A),qe.Ua="timingevent",w(Qe,A);var Xe={NO_ERROR:0,rb:1,Eb:2,Db:3,yb:4,Cb:5,Fb:6,Qa:7,TIMEOUT:8,Ib:9},Je={wb:"complete",Sb:"success",Ra:"error",Qa:"abort",Kb:"ready",Lb:"readystatechange",TIMEOUT:"timeout",Gb:"incrementaldata",Jb:"progress",zb:"downloadprogress",$b:"uploadprogress"};function Ze(){}function et(e){return e.h||(e.h=e.i())}function tt(){}Ze.prototype.h=null;var nt,st={OPEN:"a",vb:"b",Ra:"c",Hb:"d"};function it(){A.call(this,"d")}function rt(){A.call(this,"c")}function ot(){}function at(e,t,n,s){this.l=e,this.j=t,this.m=n,this.W=s||1,this.U=new xe(this),this.P=ut,e=F?125:void 0,this.V=new Re(e),this.I=null,this.i=!1,this.s=this.A=this.v=this.L=this.G=this.Y=this.B=null,this.F=[],this.g=null,this.C=0,this.o=this.u=null,this.ca=-1,this.J=!1,this.O=0,this.M=null,this.ba=this.K=this.aa=this.S=!1,this.h=new ct}function ct(){this.i=null,this.g="",this.h=!1}w(it,A),w(rt,A),w(ot,Ze),ot.prototype.g=function(){return new XMLHttpRequest},ot.prototype.i=function(){return{}},nt=new ot;var ut=45e3,lt={},ht={};function dt(e,t,n){e.L=1,e.v=Rt(St(t)),e.s=n,e.S=!0,pt(e,null)}function pt(e,t){e.G=Date.now(),yt(e),e.A=St(e.v);var n=e.A,s=e.W;Array.isArray(s)||(s=[String(s)]),zt(n.i,"t",s),e.C=0,n=e.l.J,e.h=new ct,e.g=zn(e.l,n?t:null,!e.s),0<e.O&&(e.M=new Me(_(e.Pa,e,e.g),e.O)),Ue(e.U,e.g,"readystatechange",e.nb),t=e.I?Z(e.I):{},e.s?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ha(e.A,e.u,e.s,t)):(e.u="GET",e.g.ha(e.A,e.u,null,t)),Ge(),function(e,t,n,s,i,r){e.info((function(){if(e.g)if(r)for(var o="",a=r.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var l=u[0];u=u[1];var h=l.split("_");o=2<=h.length&&"type"==h[1]?o+(l+"=")+u+"&":o+(l+"=redacted&")}}else o=null;else o=r;return"XMLHTTP REQ ("+s+") [attempt "+i+"]: "+t+"\n"+n+"\n"+o}))}(e.j,e.u,e.A,e.m,e.W,e.s)}function ft(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.l.Ha)}function mt(e,t,n){let s,i=!0;for(;!e.J&&e.C<n.length;){if(s=gt(e,n),s==ht){4==t&&(e.o=4,We(14),i=!1),Be(e.j,e.m,null,"[Incomplete Response]");break}if(s==lt){e.o=4,We(15),Be(e.j,e.m,n,"[Invalid Chunk]"),i=!1;break}Be(e.j,e.m,s,null),bt(e,s)}ft(e)&&s!=ht&&s!=lt&&(e.h.g="",e.C=0),4!=t||0!=n.length||e.h.h||(e.o=1,We(16),i=!1),e.i=e.i&&i,i?0<n.length&&!e.ba&&(e.ba=!0,(t=e.l).g==e&&t.ca&&!t.M&&(t.l.info("Great, no buffering proxy detected. Bytes received: "+n.length),xn(t),t.M=!0,We(11))):(Be(e.j,e.m,n,"[Invalid Chunked Response]"),Et(e),wt(e))}function gt(e,t){var n=e.C,s=t.indexOf("\n",n);return-1==s?ht:(n=Number(t.substring(n,s)),isNaN(n)?lt:(s+=1)+n>t.length?ht:(t=t.slice(s,s+n),e.C=s+n,t))}function yt(e){e.Y=Date.now()+e.P,_t(e,e.P)}function _t(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Ye(_(e.lb,e),t)}function vt(e){e.B&&(h.clearTimeout(e.B),e.B=null)}function wt(e){0==e.l.H||e.J||Vn(e.l,e)}function Et(e){vt(e);var t=e.M;t&&"function"==typeof t.sa&&t.sa(),e.M=null,Oe(e.V),Ve(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.sa())}function bt(e,t){try{var n=e.l;if(0!=n.H&&(n.g==e||Yt(n.i,e)))if(!e.K&&Yt(n.i,e)&&3==n.H){try{var s=n.Ja.g.parse(t)}catch(e){s=null}if(Array.isArray(s)&&3==s.length){var i=s;if(0==i[0]){e:if(!n.u){if(n.g){if(!(n.g.G+3e3<e.G))break e;Un(n),In(n)}Mn(n),We(18)}}else n.Fa=i[1],0<n.Fa-n.V&&37500>i[2]&&n.G&&0==n.A&&!n.v&&(n.v=Ye(_(n.ib,n),6e3));if(1>=Qt(n.i)&&n.oa){try{n.oa()}catch(e){}n.oa=void 0}}else Bn(n,11)}else if((e.K||n.g==e)&&Un(n),!T(t))for(i=n.Ja.g.parse(t),t=0;t<i.length;t++){let u=i[t];if(n.V=u[0],u=u[1],2==n.H)if("c"==u[0]){n.K=u[1],n.pa=u[2];const t=u[3];null!=t&&(n.ra=t,n.l.info("VER="+n.ra));const i=u[4];null!=i&&(n.Ga=i,n.l.info("SVER="+n.Ga));const l=u[5];null!=l&&"number"==typeof l&&0<l&&(s=1.5*l,n.L=s,n.l.info("backChannelRequestTimeoutMs_="+s)),s=n;const h=e.g;if(h){const e=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var r=s.i;r.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(r.j=r.l,r.g=new Set,r.h&&(Xt(r,r.h),r.h=null))}if(s.F){const e=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(s.Da=e,Nt(s.I,s.F,e))}}n.H=3,n.h&&n.h.Ba(),n.ca&&(n.S=Date.now()-e.G,n.l.info("Handshake RTT: "+n.S+"ms"));var o=e;if((s=n).wa=$n(s,s.J?s.pa:null,s.Y),o.K){Jt(s.i,o);var a=o,c=s.L;c&&a.setTimeout(c),a.B&&(vt(a),yt(a)),s.g=o}else Ln(s);0<n.j.length&&Nn(n)}else"stop"!=u[0]&&"close"!=u[0]||Bn(n,7);else 3==n.H&&("stop"==u[0]||"close"==u[0]?"stop"==u[0]?Bn(n,7):Tn(n):"noop"!=u[0]&&n.h&&n.h.Aa(u),n.A=0)}Ge()}catch(e){}}function kt(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(d(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.ta&&"function"==typeof e.ta)return e.ta();if(!e.Z||"function"!=typeof e.Z){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(d(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}t=[],n=0;for(const s in e)t[n++]=s;return t}}}(e),s=function(e){if(e.Z&&"function"==typeof e.Z)return e.Z();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");if(d(e)){for(var t=[],n=e.length,s=0;s<n;s++)t.push(e[s]);return t}for(s in t=[],n=0,e)t[n++]=e[s];return t}(e),i=s.length,r=0;r<i;r++)t.call(void 0,s[r],n&&n[r],e)}(s=at.prototype).setTimeout=function(e){this.P=e},s.nb=function(e){e=e.target;const t=this.M;t&&3==En(e)?t.l():this.Pa(e)},s.Pa=function(e){try{if(e==this.g)e:{const l=En(this.g);var t=this.g.Ia();this.g.da();if(!(3>l)&&(3!=l||F||this.g&&(this.h.h||this.g.ja()||bn(this.g)))){this.J||4!=l||7==t||Ge(),vt(this);var n=this.g.da();this.ca=n;t:if(ft(this)){var s=bn(this.g);e="";var i=s.length,r=4==En(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Et(this),wt(this);var o="";break t}this.h.i=new h.TextDecoder}for(t=0;t<i;t++)this.h.h=!0,e+=this.h.i.decode(s[t],{stream:r&&t==i-1});s.splice(0,i),this.h.g+=e,this.C=0,o=this.h.g}else o=this.g.ja();if(this.i=200==n,function(e,t,n,s,i,r,o){e.info((function(){return"XMLHTTP RESP ("+s+") [ attempt "+i+"]: "+t+"\n"+n+"\n"+r+" "+o}))}(this.j,this.u,this.A,this.m,this.W,l,n),this.i){if(this.aa&&!this.K){t:{if(this.g){var a,c=this.g;if((a=c.g?c.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!T(a)){var u=a;break t}}u=null}if(!(n=u)){this.i=!1,this.o=3,We(12),Et(this),wt(this);break e}Be(this.j,this.m,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,bt(this,n)}this.S?(mt(this,l,o),F&&this.i&&3==l&&(Ue(this.U,this.V,"tick",this.mb),this.V.start())):(Be(this.j,this.m,o,null),bt(this,o)),4==l&&Et(this),this.i&&!this.J&&(4==l?Vn(this.l,this):(this.i=!1,yt(this)))}else(function(e){const t={};e=(e.g&&2<=En(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let s=0;s<e.length;s++){if(T(e[s]))continue;var n=Ce(e[s]);const i=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const r=t[i]||[];t[i]=r,r.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,(function(e){return e.join(", ")}))})(this.g),400==n&&0<o.indexOf("Unknown SID")?(this.o=3,We(12)):(this.o=0,We(13)),Et(this),wt(this)}}}catch(e){}},s.mb=function(){if(this.g){var e=En(this.g),t=this.g.ja();this.C<t.length&&(vt(this),mt(this,e,t),this.i&&4!=e&&yt(this))}},s.cancel=function(){this.J=!0,Et(this)},s.lb=function(){this.B=null;const e=Date.now();0<=e-this.Y?(function(e,t){e.info((function(){return"TIMEOUT: "+t}))}(this.j,this.A),2!=this.L&&(Ge(),We(17)),Et(this),this.o=2,wt(this)):_t(this,this.Y-e)};var Ct=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function At(e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,e instanceof At){this.h=e.h,Tt(this,e.j),this.s=e.s,this.g=e.g,It(this,e.m),this.l=e.l;var t=e.i,n=new jt;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),Dt(this,n),this.o=e.o}else e&&(t=String(e).match(Ct))?(this.h=!1,Tt(this,t[1]||"",!0),this.s=Ot(t[2]||""),this.g=Ot(t[3]||"",!0),It(this,t[4]),this.l=Ot(t[5]||"",!0),Dt(this,t[6]||"",!0),this.o=Ot(t[7]||"")):(this.h=!1,this.i=new jt(null,this.h))}function St(e){return new At(e)}function Tt(e,t,n){e.j=n?Ot(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function It(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.m=t}else e.m=null}function Dt(e,t,n){t instanceof jt?(e.i=t,function(e,t){t&&!e.j&&(Bt(e),e.i=null,e.g.forEach((function(e,t){var n=t.toLowerCase();t!=n&&(qt(this,t),zt(this,n,e))}),e)),e.j=t}(e.i,e.h)):(n||(t=Pt(t,Ut)),e.i=new jt(t,e.h))}function Nt(e,t,n){e.i.set(t,n)}function Rt(e){return Nt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function Ot(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function Pt(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,Lt),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function Lt(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}At.prototype.toString=function(){var e=[],t=this.j;t&&e.push(Pt(t,Mt,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.s)&&e.push(Pt(t,Mt,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(Pt(n,"/"==n.charAt(0)?Ft:xt,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.o)&&e.push("#",Pt(n,Vt)),e.join("")};var Mt=/[#\/\?@]/g,xt=/[#\?:]/g,Ft=/[#\?]/g,Ut=/[#\?@]/g,Vt=/#/g;function jt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Bt(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var s=e[n].indexOf("="),i=null;if(0<=s){var r=e[n].substring(0,s);i=e[n].substring(s+1)}else r=e[n];t(r,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(e.i,(function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)})))}function qt(e,t){Bt(e),t=Ht(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function $t(e,t){return Bt(e),t=Ht(e,t),e.g.has(t)}function zt(e,t,n){qt(e,t),0<n.length&&(e.i=null,e.g.set(Ht(e,t),k(n)),e.h+=n.length)}function Ht(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}(s=jt.prototype).add=function(e,t){Bt(this),this.i=null,e=Ht(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},s.forEach=function(e,t){Bt(this),this.g.forEach((function(n,s){n.forEach((function(n){e.call(t,n,s,this)}),this)}),this)},s.ta=function(){Bt(this);const e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let s=0;s<t.length;s++){const i=e[s];for(let e=0;e<i.length;e++)n.push(t[s])}return n},s.Z=function(e){Bt(this);let t=[];if("string"==typeof e)$t(this,e)&&(t=t.concat(this.g.get(Ht(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},s.set=function(e,t){return Bt(this),this.i=null,$t(this,e=Ht(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},s.get=function(e,t){return e&&0<(e=this.Z(e)).length?String(e[0]):t},s.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var s=t[n];const r=encodeURIComponent(String(s)),o=this.Z(s);for(s=0;s<o.length;s++){var i=r;""!==o[s]&&(i+="="+encodeURIComponent(String(o[s]))),e.push(i)}}return this.i=e.join("&")};function Gt(e){this.l=e||Kt,h.PerformanceNavigationTiming?e=0<(e=h.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(h.g&&h.g.Ka&&h.g.Ka()&&h.g.Ka().ec),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var Kt=10;function Wt(e){return!!e.h||!!e.g&&e.g.size>=e.j}function Qt(e){return e.h?1:e.g?e.g.size:0}function Yt(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function Xt(e,t){e.g?e.g.add(t):e.h=t}function Jt(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function Zt(e){if(null!=e.h)return e.i.concat(e.h.F);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.F);return t}return k(e.i)}Gt.prototype.cancel=function(){if(this.i=Zt(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var en=class{stringify(e){return h.JSON.stringify(e,void 0)}parse(e){return h.JSON.parse(e,void 0)}};function tn(){this.g=new en}function nn(e,t,n){const s=n||"";try{kt(e,(function(e,n){let i=e;p(e)&&(i=we(e)),t.push(s+n+"="+encodeURIComponent(i))}))}catch(e){throw t.push(s+"type="+encodeURIComponent("_badmap")),e}}function sn(e,t,n,s,i){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,i(s)}catch(e){}}function rn(e){this.l=e.fc||null,this.j=e.ob||!1}function on(e,t){ye.call(this),this.F=e,this.u=t,this.m=void 0,this.readyState=an,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}w(rn,Ze),rn.prototype.g=function(){return new on(this.l,this.j)},rn.prototype.i=function(e){return function(){return e}}({}),w(on,ye);var an=0;function cn(e){e.j.read().then(e.Xa.bind(e)).catch(e.ka.bind(e))}function un(e){e.readyState=4,e.l=null,e.j=null,e.A=null,ln(e)}function ln(e){e.onreadystatechange&&e.onreadystatechange.call(e)}(s=on.prototype).open=function(e,t){if(this.readyState!=an)throw this.abort(),Error("Error reopening a connection");this.C=e,this.B=t,this.readyState=1,ln(this)},s.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.v,method:this.C,credentials:this.m,cache:void 0};e&&(t.body=e),(this.F||h).fetch(new Request(this.B,t)).then(this.$a.bind(this),this.ka.bind(this))},s.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((()=>{})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,un(this)),this.readyState=an},s.$a=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,ln(this)),this.g&&(this.readyState=3,ln(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(void 0!==h.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;cn(this)}else e.text().then(this.Za.bind(this),this.ka.bind(this))},s.Xa=function(e){if(this.g){if(this.u&&e.value)this.response.push(e.value);else if(!this.u){var t=e.value?e.value:new Uint8Array(0);(t=this.A.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?un(this):ln(this),3==this.readyState&&cn(this)}},s.Za=function(e){this.g&&(this.response=this.responseText=e,un(this))},s.Ya=function(e){this.g&&(this.response=e,un(this))},s.ka=function(){this.g&&un(this)},s.setRequestHeader=function(e,t){this.v.append(e,t)},s.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},s.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(on.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}});var hn=h.JSON.parse;function dn(e){ye.call(this),this.headers=new Map,this.u=e||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=pn,this.L=this.M=!1}w(dn,ye);var pn="",fn=/^https?$/i,mn=["POST","PUT"];function gn(e,t){e.h=!1,e.g&&(e.l=!0,e.g.abort(),e.l=!1),e.j=t,e.m=5,yn(e),vn(e)}function yn(e){e.F||(e.F=!0,_e(e,"complete"),_e(e,"error"))}function _n(e){if(e.h&&void 0!==l&&(!e.C[1]||4!=En(e)||2!=e.da()))if(e.v&&4==En(e))Pe(e.La,0,e);else if(_e(e,"readystatechange"),4==En(e)){e.h=!1;try{const o=e.da();e:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var s;if(s=0===o){var i=String(e.I).match(Ct)[1]||null;!i&&h.self&&h.self.location&&(i=h.self.location.protocol.slice(0,-1)),s=!fn.test(i?i.toLowerCase():"")}n=s}if(n)_e(e,"complete"),_e(e,"success");else{e.m=6;try{var r=2<En(e)?e.g.statusText:""}catch(e){r=""}e.j=r+" ["+e.da()+"]",yn(e)}}finally{vn(e)}}}function vn(e,t){if(e.g){wn(e);const n=e.g,s=e.C[0]?()=>{}:null;e.g=null,e.C=null,t||_e(e,"ready");try{n.onreadystatechange=s}catch(e){}}}function wn(e){e.g&&e.L&&(e.g.ontimeout=null),e.A&&(h.clearTimeout(e.A),e.A=null)}function En(e){return e.g?e.g.readyState:0}function bn(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.K){case pn:case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function kn(e){let t="";return J(e,(function(e,n){t+=n,t+=":",t+=e,t+="\r\n"})),t}function Cn(e,t,n){e:{for(s in n){var s=!1;break e}s=!0}s||(n=kn(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):Nt(e,t,n))}function An(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function Sn(e){this.Ga=0,this.j=[],this.l=new je,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=An("failFast",!1,e),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=An("baseRetryDelayMs",5e3,e),this.hb=An("retryDelaySeedMs",1e4,e),this.eb=An("forwardChannelMaxRetries",2,e),this.xa=An("forwardChannelRequestTimeoutMs",2e4,e),this.va=e&&e.xmlHttpFactory||void 0,this.Ha=e&&e.dc||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.i=new Gt(e&&e.concurrentRequestLimit),this.Ja=new tn,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=e&&e.bc||!1,e&&e.Ea&&this.l.Ea(),e&&e.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&e&&e.detectBufferingProxy||!1,this.qa=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.qa=e.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}function Tn(e){if(Dn(e),3==e.H){var t=e.W++,n=St(e.I);if(Nt(n,"SID",e.K),Nt(n,"RID",t),Nt(n,"TYPE","terminate"),On(e,n),(t=new at(e,e.l,t)).L=2,t.v=Rt(St(n)),n=!1,h.navigator&&h.navigator.sendBeacon)try{n=h.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&h.Image&&((new Image).src=t.v,n=!0),n||(t.g=zn(t.l,null),t.g.ha(t.v)),t.G=Date.now(),yt(t)}qn(e)}function In(e){e.g&&(xn(e),e.g.cancel(),e.g=null)}function Dn(e){In(e),e.u&&(h.clearTimeout(e.u),e.u=null),Un(e),e.i.cancel(),e.m&&("number"==typeof e.m&&h.clearTimeout(e.m),e.m=null)}function Nn(e){if(!Wt(e.i)&&!e.m){e.m=!0;var t=e.Na;Se||De(),Te||(Se(),Te=!0),Ie.add(t,e),e.C=0}}function Rn(e,t){var n;n=t?t.m:e.W++;const s=St(e.I);Nt(s,"SID",e.K),Nt(s,"RID",n),Nt(s,"AID",e.V),On(e,s),e.o&&e.s&&Cn(s,e.o,e.s),n=new at(e,e.l,n,e.C+1),null===e.o&&(n.I=e.s),t&&(e.j=t.F.concat(e.j)),t=Pn(e,n,1e3),n.setTimeout(Math.round(.5*e.xa)+Math.round(.5*e.xa*Math.random())),Xt(e.i,n),dt(n,s,t)}function On(e,t){e.na&&J(e.na,(function(e,n){Nt(t,n,e)})),e.h&&kt({},(function(e,n){Nt(t,n,e)}))}function Pn(e,t,n){n=Math.min(e.j.length,n);var s=e.h?_(e.h.Va,e.h,e):null;e:{var i=e.j;let t=-1;for(;;){const e=["count="+n];-1==t?0<n?(t=i[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let r=!0;for(let o=0;o<n;o++){let n=i[o].g;const a=i[o].map;if(n-=t,0>n)t=Math.max(0,i[o].g-100),r=!1;else try{nn(a,e,"req"+n+"_")}catch(e){s&&s(a)}}if(r){s=e.join("&");break e}}}return e=e.j.splice(0,n),t.F=e,s}function Ln(e){if(!e.g&&!e.u){e.ba=1;var t=e.Ma;Se||De(),Te||(Se(),Te=!0),Ie.add(t,e),e.A=0}}function Mn(e){return!(e.g||e.u||3<=e.A)&&(e.ba++,e.u=Ye(_(e.Ma,e),jn(e,e.A)),e.A++,!0)}function xn(e){null!=e.B&&(h.clearTimeout(e.B),e.B=null)}function Fn(e){e.g=new at(e,e.l,"rpc",e.ba),null===e.o&&(e.g.I=e.s),e.g.O=0;var t=St(e.wa);Nt(t,"RID","rpc"),Nt(t,"SID",e.K),Nt(t,"AID",e.V),Nt(t,"CI",e.G?"0":"1"),!e.G&&e.qa&&Nt(t,"TO",e.qa),Nt(t,"TYPE","xmlhttp"),On(e,t),e.o&&e.s&&Cn(t,e.o,e.s),e.L&&e.g.setTimeout(e.L);var n=e.g;e=e.pa,n.L=1,n.v=Rt(St(t)),n.s=null,n.S=!0,pt(n,e)}function Un(e){null!=e.v&&(h.clearTimeout(e.v),e.v=null)}function Vn(e,t){var n=null;if(e.g==t){Un(e),xn(e),e.g=null;var s=2}else{if(!Yt(e.i,t))return;n=t.F,Jt(e.i,t),s=1}if(0!=e.H)if(t.i)if(1==s){n=t.s?t.s.length:0,t=Date.now()-t.G;var i=e.C;_e(s=ze(),new Qe(s,n)),Nn(e)}else Ln(e);else if(3==(i=t.o)||0==i&&0<t.ca||!(1==s&&function(e,t){return!(Qt(e.i)>=e.i.j-(e.m?1:0)||(e.m?(e.j=t.F.concat(e.j),0):1==e.H||2==e.H||e.C>=(e.cb?0:e.eb)||(e.m=Ye(_(e.Na,e,t),jn(e,e.C)),e.C++,0)))}(e,t)||2==s&&Mn(e)))switch(n&&0<n.length&&(t=e.i,t.i=t.i.concat(n)),i){case 1:Bn(e,5);break;case 4:Bn(e,10);break;case 3:Bn(e,6);break;default:Bn(e,2)}}function jn(e,t){let n=e.ab+Math.floor(Math.random()*e.hb);return e.isActive()||(n*=2),n*t}function Bn(e,t){if(e.l.info("Error code "+t),2==t){var n=null;e.h&&(n=null);var s=_(e.pb,e);n||(n=new At("//www.google.com/images/cleardot.gif"),h.location&&"http"==h.location.protocol||Tt(n,"https"),Rt(n)),function(e,t){const n=new je;if(h.Image){const s=new Image;s.onload=v(sn,n,s,"TestLoadImage: loaded",!0,t),s.onerror=v(sn,n,s,"TestLoadImage: error",!1,t),s.onabort=v(sn,n,s,"TestLoadImage: abort",!1,t),s.ontimeout=v(sn,n,s,"TestLoadImage: timeout",!1,t),h.setTimeout((function(){s.ontimeout&&s.ontimeout()}),1e4),s.src=e}else t(!1)}(n.toString(),s)}else We(2);e.H=0,e.h&&e.h.za(t),qn(e),Dn(e)}function qn(e){if(e.H=0,e.ma=[],e.h){const t=Zt(e.i);0==t.length&&0==e.j.length||(C(e.ma,t),C(e.ma,e.j),e.i.i.length=0,k(e.j),e.j.length=0),e.h.ya()}}function $n(e,t,n){var s=n instanceof At?St(n):new At(n);if(""!=s.g)t&&(s.g=t+"."+s.g),It(s,s.m);else{var i=h.location;s=i.protocol,t=t?t+"."+i.hostname:i.hostname,i=+i.port;var r=new At(null);s&&Tt(r,s),t&&(r.g=t),i&&It(r,i),n&&(r.l=n),s=r}return n=e.F,t=e.Da,n&&t&&Nt(s,n,t),Nt(s,"VER",e.ra),On(e,s),s}function zn(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=n&&e.Ha&&!e.va?new dn(new rn({ob:!0})):new dn(e.va)).Oa(e.J),t}function Hn(){}function Gn(){if(M&&!(10<=Number(H)))throw Error("Environmental error: no available transport.")}function Kn(e,t){ye.call(this),this.g=new Sn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.s=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.Ca&&(e?e["X-WebChannel-Client-Profile"]=t.Ca:e={"X-WebChannel-Client-Profile":t.Ca}),this.g.U=e,(e=t&&t.cc)&&!T(e)&&(this.g.o=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!T(t)&&(this.g.F=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new Yn(this)}function Wn(e){it.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(const n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function Qn(){rt.call(this),this.status=1}function Yn(e){this.g=e}function Xn(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}function Jn(e,t,n){n||(n=0);var s=Array(16);if("string"==typeof t)for(var i=0;16>i;++i)s[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;16>i;++i)s[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];var r=e.g[3],o=t+(r^n&(i^r))+s[0]+3614090360&4294967295;o=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=(n=(i=(r=(t=n+(o<<7&4294967295|o>>>25))+((o=r+(i^t&(n^i))+s[1]+3905402710&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^r&(t^n))+s[2]+606105819&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(r^t))+s[3]+3250441966&4294967295)<<22&4294967295|o>>>10))+((o=t+(r^n&(i^r))+s[4]+4118548399&4294967295)<<7&4294967295|o>>>25))+((o=r+(i^t&(n^i))+s[5]+1200080426&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^r&(t^n))+s[6]+2821735955&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(r^t))+s[7]+4249261313&4294967295)<<22&4294967295|o>>>10))+((o=t+(r^n&(i^r))+s[8]+1770035416&4294967295)<<7&4294967295|o>>>25))+((o=r+(i^t&(n^i))+s[9]+2336552879&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^r&(t^n))+s[10]+4294925233&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(r^t))+s[11]+2304563134&4294967295)<<22&4294967295|o>>>10))+((o=t+(r^n&(i^r))+s[12]+1804603682&4294967295)<<7&4294967295|o>>>25))+((o=r+(i^t&(n^i))+s[13]+4254626195&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^r&(t^n))+s[14]+2792965006&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(r^t))+s[15]+1236535329&4294967295)<<22&4294967295|o>>>10))+((o=t+(i^r&(n^i))+s[1]+4129170786&4294967295)<<5&4294967295|o>>>27))+((o=r+(n^i&(t^n))+s[6]+3225465664&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(r^t))+s[11]+643717713&4294967295)<<14&4294967295|o>>>18))+((o=n+(r^t&(i^r))+s[0]+3921069994&4294967295)<<20&4294967295|o>>>12))+((o=t+(i^r&(n^i))+s[5]+3593408605&4294967295)<<5&4294967295|o>>>27))+((o=r+(n^i&(t^n))+s[10]+38016083&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(r^t))+s[15]+3634488961&4294967295)<<14&4294967295|o>>>18))+((o=n+(r^t&(i^r))+s[4]+3889429448&4294967295)<<20&4294967295|o>>>12))+((o=t+(i^r&(n^i))+s[9]+568446438&4294967295)<<5&4294967295|o>>>27))+((o=r+(n^i&(t^n))+s[14]+3275163606&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(r^t))+s[3]+4107603335&4294967295)<<14&4294967295|o>>>18))+((o=n+(r^t&(i^r))+s[8]+1163531501&4294967295)<<20&4294967295|o>>>12))+((o=t+(i^r&(n^i))+s[13]+2850285829&4294967295)<<5&4294967295|o>>>27))+((o=r+(n^i&(t^n))+s[2]+4243563512&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(r^t))+s[7]+1735328473&4294967295)<<14&4294967295|o>>>18))+((o=n+(r^t&(i^r))+s[12]+2368359562&4294967295)<<20&4294967295|o>>>12))+((o=t+(n^i^r)+s[5]+4294588738&4294967295)<<4&4294967295|o>>>28))+((o=r+(t^n^i)+s[8]+2272392833&4294967295)<<11&4294967295|o>>>21))+((o=i+(r^t^n)+s[11]+1839030562&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^r^t)+s[14]+4259657740&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^i^r)+s[1]+2763975236&4294967295)<<4&4294967295|o>>>28))+((o=r+(t^n^i)+s[4]+1272893353&4294967295)<<11&4294967295|o>>>21))+((o=i+(r^t^n)+s[7]+4139469664&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^r^t)+s[10]+3200236656&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^i^r)+s[13]+681279174&4294967295)<<4&4294967295|o>>>28))+((o=r+(t^n^i)+s[0]+3936430074&4294967295)<<11&4294967295|o>>>21))+((o=i+(r^t^n)+s[3]+3572445317&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^r^t)+s[6]+76029189&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^i^r)+s[9]+3654602809&4294967295)<<4&4294967295|o>>>28))+((o=r+(t^n^i)+s[12]+3873151461&4294967295)<<11&4294967295|o>>>21))+((o=i+(r^t^n)+s[15]+530742520&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^r^t)+s[2]+3299628645&4294967295)<<23&4294967295|o>>>9))+((o=t+(i^(n|~r))+s[0]+4096336452&4294967295)<<6&4294967295|o>>>26))+((o=r+(n^(t|~i))+s[7]+1126891415&4294967295)<<10&4294967295|o>>>22))+((o=i+(t^(r|~n))+s[14]+2878612391&4294967295)<<15&4294967295|o>>>17))+((o=n+(r^(i|~t))+s[5]+4237533241&4294967295)<<21&4294967295|o>>>11))+((o=t+(i^(n|~r))+s[12]+1700485571&4294967295)<<6&4294967295|o>>>26))+((o=r+(n^(t|~i))+s[3]+2399980690&4294967295)<<10&4294967295|o>>>22))+((o=i+(t^(r|~n))+s[10]+4293915773&4294967295)<<15&4294967295|o>>>17))+((o=n+(r^(i|~t))+s[1]+2240044497&4294967295)<<21&4294967295|o>>>11))+((o=t+(i^(n|~r))+s[8]+1873313359&4294967295)<<6&4294967295|o>>>26))+((o=r+(n^(t|~i))+s[15]+4264355552&4294967295)<<10&4294967295|o>>>22))+((o=i+(t^(r|~n))+s[6]+2734768916&4294967295)<<15&4294967295|o>>>17))+((o=n+(r^(i|~t))+s[13]+1309151649&4294967295)<<21&4294967295|o>>>11))+((r=(t=n+((o=t+(i^(n|~r))+s[4]+4149444226&4294967295)<<6&4294967295|o>>>26))+((o=r+(n^(t|~i))+s[11]+3174756917&4294967295)<<10&4294967295|o>>>22))^((i=r+((o=i+(t^(r|~n))+s[2]+718787259&4294967295)<<15&4294967295|o>>>17))|~t))+s[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+r&4294967295}function Zn(e,t){this.h=t;for(var n=[],s=!0,i=e.length-1;0<=i;i--){var r=0|e[i];s&&r==t||(n[i]=r,s=!1)}this.g=n}(s=dn.prototype).Oa=function(e){this.M=e},s.ha=function(e,t,n,s){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+e);t=t?t.toUpperCase():"GET",this.I=e,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():nt.g(),this.C=this.u?et(this.u):et(nt),this.g.onreadystatechange=_(this.La,this);try{this.G=!0,this.g.open(t,String(e),!0),this.G=!1}catch(e){return void gn(this,e)}if(e=n||"",n=new Map(this.headers),s)if(Object.getPrototypeOf(s)===Object.prototype)for(var i in s)n.set(i,s[i]);else{if("function"!=typeof s.keys||"function"!=typeof s.get)throw Error("Unknown input type for opt_headers: "+String(s));for(const e of s.keys())n.set(e,s.get(e))}s=Array.from(n.keys()).find((e=>"content-type"==e.toLowerCase())),i=h.FormData&&e instanceof h.FormData,!(0<=b(mn,t))||s||i||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[e,t]of n)this.g.setRequestHeader(e,t);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{wn(this),0<this.B&&((this.L=function(e){return M&&"number"==typeof e.timeout&&void 0!==e.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=_(this.ua,this)):this.A=Pe(this.ua,this.B,this)),this.v=!0,this.g.send(e),this.v=!1}catch(e){gn(this,e)}},s.ua=function(){void 0!==l&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,_e(this,"timeout"),this.abort(8))},s.abort=function(e){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=e||7,_e(this,"complete"),_e(this,"abort"),vn(this))},s.N=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),vn(this,!0)),dn.$.N.call(this)},s.La=function(){this.s||(this.G||this.v||this.l?_n(this):this.kb())},s.kb=function(){_n(this)},s.isActive=function(){return!!this.g},s.da=function(){try{return 2<En(this)?this.g.status:-1}catch(e){return-1}},s.ja=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},s.Wa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),hn(t)}},s.Ia=function(){return this.m},s.Sa=function(){return"string"==typeof this.j?this.j:String(this.j)},(s=Sn.prototype).ra=8,s.H=1,s.Na=function(e){if(this.m)if(this.m=null,1==this.H){if(!e){this.W=Math.floor(1e5*Math.random()),e=this.W++;const i=new at(this,this.l,e);let r=this.s;if(this.U&&(r?(r=Z(r),te(r,this.U)):r=this.U),null!==this.o||this.O||(i.I=r,r=null),this.P)e:{for(var t=0,n=0;n<this.j.length;n++){var s=this.j[n];if(void 0===(s="__data__"in s.map&&"string"==typeof(s=s.map.__data__)?s.length:void 0))break;if(4096<(t+=s)){t=n;break e}if(4096===t||n===this.j.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=Pn(this,i,t),Nt(n=St(this.I),"RID",e),Nt(n,"CVER",22),this.F&&Nt(n,"X-HTTP-Session-Id",this.F),On(this,n),r&&(this.O?t="headers="+encodeURIComponent(String(kn(r)))+"&"+t:this.o&&Cn(n,this.o,r)),Xt(this.i,i),this.bb&&Nt(n,"TYPE","init"),this.P?(Nt(n,"$req",t),Nt(n,"SID","null"),i.aa=!0,dt(i,n,null)):dt(i,n,t),this.H=2}}else 3==this.H&&(e?Rn(this,e):0==this.j.length||Wt(this.i)||Rn(this))},s.Ma=function(){if(this.u=null,Fn(this),this.ca&&!(this.M||null==this.g||0>=this.S)){var e=2*this.S;this.l.info("BP detection timer enabled: "+e),this.B=Ye(_(this.jb,this),e)}},s.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,We(10),In(this),Fn(this))},s.ib=function(){null!=this.v&&(this.v=null,In(this),Mn(this),We(19))},s.pb=function(e){e?(this.l.info("Successfully pinged google.com"),We(2)):(this.l.info("Failed to ping google.com"),We(1))},s.isActive=function(){return!!this.h&&this.h.isActive(this)},(s=Hn.prototype).Ba=function(){},s.Aa=function(){},s.za=function(){},s.ya=function(){},s.isActive=function(){return!0},s.Va=function(){},Gn.prototype.g=function(e,t){return new Kn(e,t)},w(Kn,ye),Kn.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var e=this.g,t=this.l,n=this.h||void 0;We(0),e.Y=t,e.na=n||{},e.G=e.aa,e.I=$n(e,null,e.Y),Nn(e)},Kn.prototype.close=function(){Tn(this.g)},Kn.prototype.u=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=we(e),e=n);t.j.push(new class{constructor(e,t){this.g=e,this.map=t}}(t.fb++,e)),3==t.H&&Nn(t)},Kn.prototype.N=function(){this.g.h=null,delete this.j,Tn(this.g),delete this.g,Kn.$.N.call(this)},w(Wn,it),w(Qn,rt),w(Yn,Hn),Yn.prototype.Ba=function(){_e(this.g,"a")},Yn.prototype.Aa=function(e){_e(this.g,new Wn(e))},Yn.prototype.za=function(e){_e(this.g,new Qn)},Yn.prototype.ya=function(){_e(this.g,"b")},w(Xn,(function(){this.blockSize=-1})),Xn.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0},Xn.prototype.j=function(e,t){void 0===t&&(t=e.length);for(var n=t-this.blockSize,s=this.m,i=this.h,r=0;r<t;){if(0==i)for(;r<=n;)Jn(this,e,r),r+=this.blockSize;if("string"==typeof e){for(;r<t;)if(s[i++]=e.charCodeAt(r++),i==this.blockSize){Jn(this,s),i=0;break}}else for(;r<t;)if(s[i++]=e[r++],i==this.blockSize){Jn(this,s),i=0;break}}this.h=i,this.i+=t},Xn.prototype.l=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.i;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.j(e),e=Array(16),t=n=0;4>t;++t)for(var s=0;32>s;s+=8)e[n++]=this.g[t]>>>s&255;return e};var es={};function ts(e){return-128<=e&&128>e?function(e,t){var n=es;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,(function(e){return new Zn([0|e],0>e?-1:0)})):new Zn([0|e],0>e?-1:0)}function ns(e){if(isNaN(e)||!isFinite(e))return is;if(0>e)return us(ns(-e));for(var t=[],n=1,s=0;e>=n;s++)t[s]=e/n|0,n*=ss;return new Zn(t,0)}var ss=4294967296,is=ts(0),rs=ts(1),os=ts(16777216);function as(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function cs(e){return-1==e.h}function us(e){for(var t=e.g.length,n=[],s=0;s<t;s++)n[s]=~e.g[s];return new Zn(n,~e.h).add(rs)}function ls(e,t){return e.add(us(t))}function hs(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function ds(e,t){this.g=e,this.h=t}function ps(e,t){if(as(t))throw Error("division by zero");if(as(e))return new ds(is,is);if(cs(e))return t=ps(us(e),t),new ds(us(t.g),us(t.h));if(cs(t))return t=ps(e,us(t)),new ds(us(t.g),t.h);if(30<e.g.length){if(cs(e)||cs(t))throw Error("slowDivide_ only works with positive integers.");for(var n=rs,s=t;0>=s.X(e);)n=fs(n),s=fs(s);var i=ms(n,1),r=ms(s,1);for(s=ms(s,2),n=ms(n,2);!as(s);){var o=r.add(s);0>=o.X(e)&&(i=i.add(n),r=o),s=ms(s,1),n=ms(n,1)}return t=ls(e,i.R(t)),new ds(i,t)}for(i=is;0<=e.X(t);){for(n=Math.max(1,Math.floor(e.ea()/t.ea())),s=48>=(s=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,s-48),o=(r=ns(n)).R(t);cs(o)||0<o.X(e);)o=(r=ns(n-=s)).R(t);as(r)&&(r=rs),i=i.add(r),e=ls(e,o)}return new ds(i,e)}function fs(e){for(var t=e.g.length+1,n=[],s=0;s<t;s++)n[s]=e.D(s)<<1|e.D(s-1)>>>31;return new Zn(n,e.h)}function ms(e,t){var n=t>>5;t%=32;for(var s=e.g.length-n,i=[],r=0;r<s;r++)i[r]=0<t?e.D(r+n)>>>t|e.D(r+n+1)<<32-t:e.D(r+n);return new Zn(i,e.h)}(s=Zn.prototype).ea=function(){if(cs(this))return-us(this).ea();for(var e=0,t=1,n=0;n<this.g.length;n++){var s=this.D(n);e+=(0<=s?s:ss+s)*t,t*=ss}return e},s.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(as(this))return"0";if(cs(this))return"-"+us(this).toString(e);for(var t=ns(Math.pow(e,6)),n=this,s="";;){var i=ps(n,t).g,r=((0<(n=ls(n,i.R(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(as(n=i))return r+s;for(;6>r.length;)r="0"+r;s=r+s}},s.D=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},s.X=function(e){return cs(e=ls(this,e))?-1:as(e)?0:1},s.abs=function(){return cs(this)?us(this):this},s.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0,i=0;i<=t;i++){var r=s+(65535&this.D(i))+(65535&e.D(i)),o=(r>>>16)+(this.D(i)>>>16)+(e.D(i)>>>16);s=o>>>16,r&=65535,o&=65535,n[i]=o<<16|r}return new Zn(n,-2147483648&n[n.length-1]?-1:0)},s.R=function(e){if(as(this)||as(e))return is;if(cs(this))return cs(e)?us(this).R(us(e)):us(us(this).R(e));if(cs(e))return us(this.R(us(e)));if(0>this.X(os)&&0>e.X(os))return ns(this.ea()*e.ea());for(var t=this.g.length+e.g.length,n=[],s=0;s<2*t;s++)n[s]=0;for(s=0;s<this.g.length;s++)for(var i=0;i<e.g.length;i++){var r=this.D(s)>>>16,o=65535&this.D(s),a=e.D(i)>>>16,c=65535&e.D(i);n[2*s+2*i]+=o*c,hs(n,2*s+2*i),n[2*s+2*i+1]+=r*c,hs(n,2*s+2*i+1),n[2*s+2*i+1]+=o*a,hs(n,2*s+2*i+1),n[2*s+2*i+2]+=r*a,hs(n,2*s+2*i+2)}for(s=0;s<t;s++)n[s]=n[2*s+1]<<16|n[2*s];for(s=t;s<2*t;s++)n[s]=0;return new Zn(n,0)},s.gb=function(e){return ps(this,e).h},s.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0;s<t;s++)n[s]=this.D(s)&e.D(s);return new Zn(n,this.h&e.h)},s.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0;s<t;s++)n[s]=this.D(s)|e.D(s);return new Zn(n,this.h|e.h)},s.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0;s<t;s++)n[s]=this.D(s)^e.D(s);return new Zn(n,this.h^e.h)},Gn.prototype.createWebChannel=Gn.prototype.g,Kn.prototype.send=Kn.prototype.u,Kn.prototype.open=Kn.prototype.m,Kn.prototype.close=Kn.prototype.close,Xe.NO_ERROR=0,Xe.TIMEOUT=8,Xe.HTTP_ERROR=6,Je.COMPLETE="complete",tt.EventType=st,st.OPEN="a",st.CLOSE="b",st.ERROR="c",st.MESSAGE="d",ye.prototype.listen=ye.prototype.O,dn.prototype.listenOnce=dn.prototype.P,dn.prototype.getLastError=dn.prototype.Sa,dn.prototype.getLastErrorCode=dn.prototype.Ia,dn.prototype.getStatus=dn.prototype.da,dn.prototype.getResponseJson=dn.prototype.Wa,dn.prototype.getResponseText=dn.prototype.ja,dn.prototype.send=dn.prototype.ha,dn.prototype.setWithCredentials=dn.prototype.Oa,Xn.prototype.digest=Xn.prototype.l,Xn.prototype.reset=Xn.prototype.reset,Xn.prototype.update=Xn.prototype.j,Zn.prototype.add=Zn.prototype.add,Zn.prototype.multiply=Zn.prototype.R,Zn.prototype.modulo=Zn.prototype.gb,Zn.prototype.compare=Zn.prototype.X,Zn.prototype.toNumber=Zn.prototype.ea,Zn.prototype.toString=Zn.prototype.toString,Zn.prototype.getBits=Zn.prototype.D,Zn.fromNumber=ns,Zn.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return us(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var s=ns(Math.pow(n,8)),i=is,r=0;r<t.length;r+=8){var o=Math.min(8,t.length-r),a=parseInt(t.substring(r,r+o),n);8>o?(o=ns(Math.pow(n,o)),i=i.R(o).add(ns(a))):i=(i=i.R(s)).add(ns(a))}return i};var gs=u.createWebChannelTransport=function(){return new Gn},ys=u.getStatEventTarget=function(){return ze()},_s=u.ErrorCode=Xe,vs=u.EventType=Je,ws=u.Event=qe,Es=u.Stat={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},bs=u.FetchXmlHttpFactory=rn,ks=u.WebChannel=tt,Cs=u.XhrIo=dn,As=u.Md5=Xn,Ss=u.Integer=Zn;const Ts="@firebase/firestore";class Is{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Is.UNAUTHENTICATED=new Is(null),Is.GOOGLE_CREDENTIALS=new Is("google-credentials-uid"),Is.FIRST_PARTY=new Is("first-party-uid"),Is.MOCK_USER=new Is("mock-user");let Ds="9.22.1";const Ns=new o.Yd("@firebase/firestore");function Rs(){return Ns.logLevel}function Os(e,...t){if(Ns.logLevel<=o.in.DEBUG){const n=t.map(Ms);Ns.debug(`Firestore (${Ds}): ${e}`,...n)}}function Ps(e,...t){if(Ns.logLevel<=o.in.ERROR){const n=t.map(Ms);Ns.error(`Firestore (${Ds}): ${e}`,...n)}}function Ls(e,...t){if(Ns.logLevel<=o.in.WARN){const n=t.map(Ms);Ns.warn(`Firestore (${Ds}): ${e}`,...n)}}function Ms(e){if("string"==typeof e)return e;try{return t=e,JSON.stringify(t)}catch(t){return e}var t}function xs(e="Unexpected state"){const t=`FIRESTORE (${Ds}) INTERNAL ASSERTION FAILED: `+e;throw Ps(t),new Error(t)}function Fs(e,t){e||xs()}function Us(e,t){return e}const Vs={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 js extends a.ZR{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class Bs{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class qs{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class $s{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(Is.UNAUTHENTICATED)))}shutdown(){}}class zs{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 Hs{constructor(e){this.t=e,this.currentUser=Is.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let n=this.i;const s=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let i=new Bs;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Bs,e.enqueueRetryable((()=>s(this.currentUser)))};const r=()=>{const t=i;e.enqueueRetryable((async()=>{await t.promise,await s(this.currentUser)}))},o=e=>{Os("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.auth.addAuthTokenListener(this.o),r()};this.t.onInit((e=>o(e))),setTimeout((()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?o(e):(Os("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Bs)}}),0),r()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i!==e?(Os("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(Fs("string"==typeof t.accessToken),new qs(t.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const e=this.auth&&this.auth.getUid();return Fs(null===e||"string"==typeof e),new Is(e)}}class Gs{constructor(e,t,n){this.h=e,this.l=t,this.m=n,this.type="FirstParty",this.user=Is.FIRST_PARTY,this.g=new Map}p(){return this.m?this.m():null}get headers(){this.g.set("X-Goog-AuthUser",this.h);const e=this.p();return e&&this.g.set("Authorization",e),this.l&&this.g.set("X-Goog-Iam-Authorization-Token",this.l),this.g}}class Ks{constructor(e,t,n){this.h=e,this.l=t,this.m=n}getToken(){return Promise.resolve(new Gs(this.h,this.l,this.m))}start(e,t){e.enqueueRetryable((()=>t(Is.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Ws{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 Qs{constructor(e){this.I=e,this.forceRefresh=!1,this.appCheck=null,this.T=null}start(e,t){const n=e=>{null!=e.error&&Os("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);const n=e.token!==this.T;return this.T=e.token,Os("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};const s=e=>{Os("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.appCheck.addTokenListener(this.o)};this.I.onInit((e=>s(e))),setTimeout((()=>{if(!this.appCheck){const e=this.I.getImmediate({optional:!0});e?s(e):Os("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(Fs("string"==typeof e.token),this.T=e.token,new Ws(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}function Ys(e){const t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}class Xs{static A(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(256/62);let n="";for(;n.length<20;){const s=Ys(40);for(let i=0;i<s.length;++i)n.length<20&&s[i]<t&&(n+=e.charAt(s[i]%62))}return n}}function Js(e,t){return e<t?-1:e>t?1:0}function Zs(e,t,n){return e.length===t.length&&e.every(((e,s)=>n(e,t[s])))}class ei{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new js(Vs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new js(Vs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new js(Vs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new js(Vs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return ei.fromMillis(Date.now())}static fromDate(e){return ei.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor(1e6*(e-1e3*t));return new ei(t,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?Js(this.nanoseconds,e.nanoseconds):Js(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}class ti{constructor(e){this.timestamp=e}static fromTimestamp(e){return new ti(e)}static min(){return new ti(new ei(0,0))}static max(){return new ti(new ei(253402300799,999999999))}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}}class ni{constructor(e,t,n){void 0===t?t=0:t>e.length&&xs(),void 0===n?n=e.length-t:n>e.length-t&&xs(),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===ni.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof ni?e.forEach((e=>{t.push(e)})):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,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 n=e.get(s),i=t.get(s);if(n<i)return-1;if(n>i)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}class si extends ni{construct(e,t,n){return new si(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...e){const t=[];for(const n of e){if(n.indexOf("//")>=0)throw new js(Vs.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter((e=>e.length>0)))}return new si(t)}static emptyPath(){return new si([])}}const ii=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class ri extends ni{construct(e,t,n){return new ri(e,t,n)}static isValidIdentifier(e){return ii.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),ri.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new ri(["__name__"])}static fromServerFormat(e){const t=[];let n="",s=0;const i=()=>{if(0===n.length)throw new js(Vs.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let r=!1;for(;s<e.length;){const t=e[s];if("\\"===t){if(s+1===e.length)throw new js(Vs.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[s+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new js(Vs.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,s+=2}else"`"===t?(r=!r,s++):"."!==t||r?(n+=t,s++):(i(),s++)}if(i(),r)throw new js(Vs.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new ri(t)}static emptyPath(){return new ri([])}}class oi{constructor(e){this.path=e}static fromPath(e){return new oi(si.fromString(e))}static fromName(e){return new oi(si.fromString(e).popFirst(5))}static empty(){return new oi(si.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===si.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return si.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new oi(new si(e.slice()))}}class ai{constructor(e,t,n,s){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=s}}ai.UNKNOWN_ID=-1;function ci(e,t){const n=e.toTimestamp().seconds,s=e.toTimestamp().nanoseconds+1,i=ti.fromTimestamp(1e9===s?new ei(n+1,0):new ei(n,s));return new li(i,oi.empty(),t)}function ui(e){return new li(e.readTime,e.key,-1)}class li{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new li(ti.min(),oi.empty(),-1)}static max(){return new li(ti.max(),oi.empty(),-1)}}function hi(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=oi.comparator(e.documentKey,t.documentKey),0!==n?n:Js(e.largestBatchId,t.largestBatchId))}const di="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class pi{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}async function fi(e){if(e.code!==Vs.FAILED_PRECONDITION||e.message!==di)throw e;Os("LocalStore","Unexpectedly lost primary lease")}class mi{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)}),(e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)}))}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&xs(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new mi(((n,s)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,s)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,s)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{const t=e();return t instanceof mi?t:mi.resolve(t)}catch(e){return mi.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction((()=>e(t))):mi.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction((()=>e(t))):mi.reject(t)}static resolve(e){return new mi(((t,n)=>{t(e)}))}static reject(e){return new mi(((t,n)=>{n(e)}))}static waitFor(e){return new mi(((t,n)=>{let s=0,i=0,r=!1;e.forEach((e=>{++s,e.next((()=>{++i,r&&i===s&&t()}),(e=>n(e)))})),r=!0,i===s&&t()}))}static or(e){let t=mi.resolve(!1);for(const n of e)t=t.next((e=>e?mi.resolve(e):n()));return t}static forEach(e,t){const n=[];return e.forEach(((e,s)=>{n.push(t.call(this,e,s))})),this.waitFor(n)}static mapArray(e,t){return new mi(((n,s)=>{const i=e.length,r=new Array(i);let o=0;for(let a=0;a<i;a++){const c=a;t(e[c]).next((e=>{r[c]=e,++o,o===i&&n(r)}),(e=>s(e)))}}))}static doWhile(e,t){return new mi(((n,s)=>{const i=()=>{!0===e()?t().next((()=>{i()}),s):n()};i()}))}}function gi(e){return"IndexedDbTransactionError"===e.name}class yi{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ot(e),this.ut=e=>t.writeSequenceNumber(e))}ot(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ut&&this.ut(e),e}}function _i(e){return null==e}function vi(e){return 0===e&&1/e==-1/0}function wi(e){return"number"==typeof e&&Number.isInteger(e)&&!vi(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}yi.ct=-1;const Ei=["mutationQueues","mutations","documentMutations","remoteDocuments","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries"],bi=["mutationQueues","mutations","documentMutations","remoteDocumentsV14","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries","documentOverlays"],ki=bi;function Ci(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Ai(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Si(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class Ti{constructor(e,t){this.comparator=e,this.root=t||Di.EMPTY}insert(e,t){return new Ti(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,Di.BLACK,null,null))}remove(e){return new Ti(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Di.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const n=this.comparator(e,t.key);if(0===n)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(0===s)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 Ii(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Ii(this.root,e,this.comparator,!1)}getReverseIterator(){return new Ii(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Ii(this.root,e,this.comparator,!0)}}class Ii{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(0===i){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(0===this.nodeStack.length)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class Di{constructor(e,t,n,s,i){this.key=e,this.value=t,this.color=null!=n?n:Di.RED,this.left=null!=s?s:Di.EMPTY,this.right=null!=i?i:Di.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,s,i){return new Di(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=s?s:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,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):0===i?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 Di.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()),0===t(e,s.key)){if(s.right.isEmpty())return Di.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,Di.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Di.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 xs();if(this.right.isRed())throw xs();const e=this.left.check();if(e!==this.right.check())throw xs();return e+(this.isRed()?0:1)}}Di.EMPTY=null,Di.RED=!0,Di.BLACK=!1,Di.EMPTY=new class{constructor(){this.size=0}get key(){throw xs()}get value(){throw xs()}get color(){throw xs()}get left(){throw xs()}get right(){throw xs()}copy(e,t,n,s,i){return this}insert(e,t,n){return new Di(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 Ni{constructor(e){this.comparator=e,this.data=new Ti(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,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=void 0!==t?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 Ri(this.data.getIterator())}getIteratorFrom(e){return new Ri(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach((e=>{t=t.add(e)})),t}isEqual(e){if(!(e instanceof Ni))return!1;if(this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const e=t.getNext().key,s=n.getNext().key;if(0!==this.comparator(e,s))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 Ni(this.comparator);return t.data=e,t}}class Ri{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class Oi{constructor(e){this.fields=e,e.sort(ri.comparator)}static empty(){return new Oi([])}unionWith(e){let t=new Ni(ri.comparator);for(const e of this.fields)t=t.add(e);for(const n of e)t=t.add(n);return new Oi(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Zs(this.fields,e.fields,((e,t)=>e.isEqual(t)))}}class Pi extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class Li{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new Pi("Invalid base64 string: "+e):e}}(e);return new Li(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new Li(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return e=this.binaryString,btoa(e);var e}toUint8Array(){return function(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Js(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Li.EMPTY_BYTE_STRING=new Li("");const Mi=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function xi(e){if(Fs(!!e),"string"==typeof e){let t=0;const n=Mi.exec(e);if(Fs(!!n),n[1]){let e=n[1];e=(e+"000000000").substr(0,9),t=Number(e)}const s=new Date(e);return{seconds:Math.floor(s.getTime()/1e3),nanos:t}}return{seconds:Fi(e.seconds),nanos:Fi(e.nanos)}}function Fi(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function Ui(e){return"string"==typeof e?Li.fromBase64String(e):Li.fromUint8Array(e)}function Vi(e){var t,n;return"server_timestamp"===(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function ji(e){const t=e.mapValue.fields.__previous_value__;return Vi(t)?ji(t):t}function Bi(e){const t=xi(e.mapValue.fields.__local_write_time__.timestampValue);return new ei(t.seconds,t.nanos)}class qi{constructor(e,t,n,s,i,r,o,a,c){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=s,this.ssl=i,this.forceLongPolling=r,this.autoDetectLongPolling=o,this.longPollingOptions=a,this.useFetchStreams=c}}class $i{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new $i("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(e){return e instanceof $i&&e.projectId===this.projectId&&e.database===this.database}}const zi={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function Hi(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?Vi(e)?4:rr(e)?9007199254740991:10:xs()}function Gi(e,t){if(e===t)return!0;const n=Hi(e);if(n!==Hi(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Bi(e).isEqual(Bi(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;const n=xi(e.timestampValue),s=xi(t.timestampValue);return n.seconds===s.seconds&&n.nanos===s.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Ui(e.bytesValue).isEqual(Ui(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return Fi(e.geoPointValue.latitude)===Fi(t.geoPointValue.latitude)&&Fi(e.geoPointValue.longitude)===Fi(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return Fi(e.integerValue)===Fi(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){const n=Fi(e.doubleValue),s=Fi(t.doubleValue);return n===s?vi(n)===vi(s):isNaN(n)&&isNaN(s)}return!1}(e,t);case 9:return Zs(e.arrayValue.values||[],t.arrayValue.values||[],Gi);case 10:return function(e,t){const n=e.mapValue.fields||{},s=t.mapValue.fields||{};if(Ci(n)!==Ci(s))return!1;for(const e in n)if(n.hasOwnProperty(e)&&(void 0===s[e]||!Gi(n[e],s[e])))return!1;return!0}(e,t);default:return xs()}}function Ki(e,t){return void 0!==(e.values||[]).find((e=>Gi(e,t)))}function Wi(e,t){if(e===t)return 0;const n=Hi(e),s=Hi(t);if(n!==s)return Js(n,s);switch(n){case 0:case 9007199254740991:return 0;case 1:return Js(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=Fi(e.integerValue||e.doubleValue),s=Fi(t.integerValue||t.doubleValue);return n<s?-1:n>s?1:n===s?0:isNaN(n)?isNaN(s)?0:-1:1}(e,t);case 3:return Qi(e.timestampValue,t.timestampValue);case 4:return Qi(Bi(e),Bi(t));case 5:return Js(e.stringValue,t.stringValue);case 6:return function(e,t){const n=Ui(e),s=Ui(t);return n.compareTo(s)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),s=t.split("/");for(let e=0;e<n.length&&e<s.length;e++){const t=Js(n[e],s[e]);if(0!==t)return t}return Js(n.length,s.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=Js(Fi(e.latitude),Fi(t.latitude));return 0!==n?n:Js(Fi(e.longitude),Fi(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return function(e,t){const n=e.values||[],s=t.values||[];for(let e=0;e<n.length&&e<s.length;++e){const t=Wi(n[e],s[e]);if(t)return t}return Js(n.length,s.length)}(e.arrayValue,t.arrayValue);case 10:return function(e,t){if(e===zi.mapValue&&t===zi.mapValue)return 0;if(e===zi.mapValue)return 1;if(t===zi.mapValue)return-1;const n=e.fields||{},s=Object.keys(n),i=t.fields||{},r=Object.keys(i);s.sort(),r.sort();for(let e=0;e<s.length&&e<r.length;++e){const t=Js(s[e],r[e]);if(0!==t)return t;const o=Wi(n[s[e]],i[r[e]]);if(0!==o)return o}return Js(s.length,r.length)}(e.mapValue,t.mapValue);default:throw xs()}}function Qi(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return Js(e,t);const n=xi(e),s=xi(t),i=Js(n.seconds,s.seconds);return 0!==i?i:Js(n.nanos,s.nanos)}function Yi(e){return Xi(e)}function Xi(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){const t=xi(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?Ui(e.bytesValue).toBase64():"referenceValue"in e?(n=e.referenceValue,oi.fromName(n).toString()):"geoPointValue"in e?`geo(${(t=e.geoPointValue).latitude},${t.longitude})`:"arrayValue"in e?function(e){let t="[",n=!0;for(const s of e.values||[])n?n=!1:t+=",",t+=Xi(s);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",s=!0;for(const i of t)s?s=!1:n+=",",n+=`${i}:${Xi(e.fields[i])}`;return n+"}"}(e.mapValue):xs();var t,n}function Ji(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function Zi(e){return!!e&&"integerValue"in e}function er(e){return!!e&&"arrayValue"in e}function tr(e){return!!e&&"nullValue"in e}function nr(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function sr(e){return!!e&&"mapValue"in e}function ir(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){const t={mapValue:{fields:{}}};return Ai(e.mapValue.fields,((e,n)=>t.mapValue.fields[e]=ir(n))),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=ir(e.arrayValue.values[n]);return t}return Object.assign({},e)}function rr(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}class or{constructor(e){this.value=e}static empty(){return new or({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)],!sr(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=ir(t)}setAll(e){let t=ri.emptyPath(),n={},s=[];e.forEach(((e,i)=>{if(!t.isImmediateParentOf(i)){const e=this.getFieldsMap(t);this.applyChanges(e,n,s),n={},s=[],t=i.popLast()}e?n[i.lastSegment()]=ir(e):s.push(i.lastSegment())}));const i=this.getFieldsMap(t);this.applyChanges(i,n,s)}delete(e){const t=this.field(e.popLast());sr(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Gi(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)];sr(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,n){Ai(t,((t,n)=>e[t]=n));for(const t of n)delete e[t]}clone(){return new or(ir(this.value))}}class ar{constructor(e,t,n,s,i,r,o){this.key=e,this.documentType=t,this.version=n,this.readTime=s,this.createTime=i,this.data=r,this.documentState=o}static newInvalidDocument(e){return new ar(e,0,ti.min(),ti.min(),ti.min(),or.empty(),0)}static newFoundDocument(e,t,n,s){return new ar(e,1,t,ti.min(),n,s,0)}static newNoDocument(e,t){return new ar(e,2,t,ti.min(),ti.min(),or.empty(),0)}static newUnknownDocument(e,t){return new ar(e,3,t,ti.min(),ti.min(),or.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(ti.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=or.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=or.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ti.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof ar&&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 ar(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}class cr{constructor(e,t){this.position=e,this.inclusive=t}}function ur(e,t,n){let s=0;for(let i=0;i<e.position.length;i++){const r=t[i],o=e.position[i];if(s=r.field.isKeyField()?oi.comparator(oi.fromName(o.referenceValue),n.key):Wi(o,n.data.field(r.field)),"desc"===r.dir&&(s*=-1),0!==s)break}return s}function lr(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!Gi(e.position[n],t.position[n]))return!1;return!0}class hr{constructor(e,t="asc"){this.field=e,this.dir=t}}function dr(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}class pr{}class fr extends pr{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new br(e,t,n):"array-contains"===t?new Sr(e,n):"in"===t?new Tr(e,n):"not-in"===t?new Ir(e,n):"array-contains-any"===t?new Dr(e,n):new fr(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new kr(e,n):new Cr(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(Wi(t,this.value)):null!==t&&Hi(this.value)===Hi(t)&&this.matchesComparison(Wi(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return xs()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class mr extends pr{constructor(e,t){super(),this.filters=e,this.op=t,this.lt=null}static create(e,t){return new mr(e,t)}matches(e){return gr(this)?void 0===this.filters.find((t=>!t.matches(e))):void 0!==this.filters.find((t=>t.matches(e)))}getFlattenedFilters(){return null!==this.lt||(this.lt=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.lt}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const e=this.ft((e=>e.isInequality()));return null!==e?e.field:null}ft(e){for(const t of this.getFlattenedFilters())if(e(t))return t;return null}}function gr(e){return"and"===e.op}function yr(e){return _r(e)&&gr(e)}function _r(e){for(const t of e.filters)if(t instanceof mr)return!1;return!0}function vr(e){if(e instanceof fr)return e.field.canonicalString()+e.op.toString()+Yi(e.value);if(yr(e))return e.filters.map((e=>vr(e))).join(",");{const t=e.filters.map((e=>vr(e))).join(",");return`${e.op}(${t})`}}function wr(e,t){return e instanceof fr?function(e,t){return t instanceof fr&&e.op===t.op&&e.field.isEqual(t.field)&&Gi(e.value,t.value)}(e,t):e instanceof mr?function(e,t){return t instanceof mr&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce(((e,n,s)=>e&&wr(n,t.filters[s])),!0)}(e,t):void xs()}function Er(e){return e instanceof fr?function(e){return`${e.field.canonicalString()} ${e.op} ${Yi(e.value)}`}(e):e instanceof mr?function(e){return e.op.toString()+" {"+e.getFilters().map(Er).join(" ,")+"}"}(e):"Filter"}class br extends fr{constructor(e,t,n){super(e,t,n),this.key=oi.fromName(n.referenceValue)}matches(e){const t=oi.comparator(e.key,this.key);return this.matchesComparison(t)}}class kr extends fr{constructor(e,t){super(e,"in",t),this.keys=Ar("in",t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}}class Cr extends fr{constructor(e,t){super(e,"not-in",t),this.keys=Ar("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}}function Ar(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map((e=>oi.fromName(e.referenceValue)))}class Sr extends fr{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return er(t)&&Ki(t.arrayValue,this.value)}}class Tr extends fr{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&Ki(this.value.arrayValue,t)}}class Ir extends fr{constructor(e,t){super(e,"not-in",t)}matches(e){if(Ki(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&!Ki(this.value.arrayValue,t)}}class Dr extends fr{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!er(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>Ki(this.value.arrayValue,e)))}}class Nr{constructor(e,t=null,n=[],s=[],i=null,r=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=s,this.limit=i,this.startAt=r,this.endAt=o,this.dt=null}}function Rr(e,t=null,n=[],s=[],i=null,r=null,o=null){return new Nr(e,t,n,s,i,r,o)}function Or(e){const t=Us(e);if(null===t.dt){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map((e=>vr(e))).join(","),e+="|ob:",e+=t.orderBy.map((e=>function(e){return e.field.canonicalString()+e.dir}(e))).join(","),_i(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((e=>Yi(e))).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((e=>Yi(e))).join(",")),t.dt=e}return t.dt}function Pr(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!dr(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!wr(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!lr(e.startAt,t.startAt)&&lr(e.endAt,t.endAt)}function Lr(e){return oi.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}class Mr{constructor(e,t=null,n=[],s=[],i=null,r="F",o=null,a=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=s,this.limit=i,this.limitType=r,this.startAt=o,this.endAt=a,this.wt=null,this._t=null,this.startAt,this.endAt}}function xr(e,t,n,s,i,r,o,a){return new Mr(e,t,n,s,i,r,o,a)}function Fr(e){return new Mr(e)}function Ur(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function Vr(e){return e.explicitOrderBy.length>0?e.explicitOrderBy[0].field:null}function jr(e){for(const t of e.filters){const e=t.getFirstInequalityField();if(null!==e)return e}return null}function Br(e){return null!==e.collectionGroup}function qr(e){const t=Us(e);if(null===t.wt){t.wt=[];const e=jr(t),n=Vr(t);if(null!==e&&null===n)e.isKeyField()||t.wt.push(new hr(e)),t.wt.push(new hr(ri.keyField(),"asc"));else{let e=!1;for(const n of t.explicitOrderBy)t.wt.push(n),n.field.isKeyField()&&(e=!0);if(!e){const e=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc";t.wt.push(new hr(ri.keyField(),e))}}}return t.wt}function $r(e){const t=Us(e);if(!t._t)if("F"===t.limitType)t._t=Rr(t.path,t.collectionGroup,qr(t),t.filters,t.limit,t.startAt,t.endAt);else{const e=[];for(const n of qr(t)){const t="desc"===n.dir?"asc":"desc";e.push(new hr(n.field,t))}const n=t.endAt?new cr(t.endAt.position,t.endAt.inclusive):null,s=t.startAt?new cr(t.startAt.position,t.startAt.inclusive):null;t._t=Rr(t.path,t.collectionGroup,e,t.filters,t.limit,n,s)}return t._t}function zr(e,t){t.getFirstInequalityField(),jr(e);const n=e.filters.concat([t]);return new Mr(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function Hr(e,t,n){return new Mr(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function Gr(e,t){return Pr($r(e),$r(t))&&e.limitType===t.limitType}function Kr(e){return`${Or($r(e))}|lt:${e.limitType}`}function Wr(e){return`Query(target=${function(e){let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map((e=>Er(e))).join(", ")}]`),_i(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map((e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e))).join(", ")}]`),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((e=>Yi(e))).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((e=>Yi(e))).join(",")),`Target(${t})`}($r(e))}; limitType=${e.limitType})`}function Qr(e,t){return t.isFoundDocument()&&function(e,t){const n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):oi.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of qr(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(const n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){const s=ur(e,t,n);return e.inclusive?s<=0:s<0}(e.startAt,qr(e),t))&&!(e.endAt&&!function(e,t,n){const s=ur(e,t,n);return e.inclusive?s>=0:s>0}(e.endAt,qr(e),t))}(e,t)}function Yr(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function Xr(e){return(t,n)=>{let s=!1;for(const i of qr(e)){const e=Jr(i,t,n);if(0!==e)return e;s=s||i.field.isKeyField()}return 0}}function Jr(e,t,n){const s=e.field.isKeyField()?oi.comparator(t.key,n.key):function(e,t,n){const s=t.data.field(e),i=n.data.field(e);return null!==s&&null!==i?Wi(s,i):xs()}(e.field,t,n);switch(e.dir){case"asc":return s;case"desc":return-1*s;default:return xs()}}class Zr{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(void 0!==n)for(const[t,s]of n)if(this.equalsFn(t,e))return s}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),s=this.inner[n];if(void 0===s)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<s.length;n++)if(this.equalsFn(s[n][0],e))return void(s[n]=[e,t]);s.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let s=0;s<n.length;s++)if(this.equalsFn(n[s][0],e))return 1===n.length?delete this.inner[t]:n.splice(s,1),this.innerSize--,!0;return!1}forEach(e){Ai(this.inner,((t,n)=>{for(const[t,s]of n)e(t,s)}))}isEmpty(){return Si(this.inner)}size(){return this.innerSize}}const eo=new Ti(oi.comparator);function to(){return eo}const no=new Ti(oi.comparator);function so(...e){let t=no;for(const n of e)t=t.insert(n.key,n);return t}function io(e){let t=no;return e.forEach(((e,n)=>t=t.insert(e,n.overlayedDocument))),t}function ro(){return ao()}function oo(){return ao()}function ao(){return new Zr((e=>e.toString()),((e,t)=>e.isEqual(t)))}new Ti(oi.comparator);const co=new Ni(oi.comparator);function uo(...e){let t=co;for(const n of e)t=t.add(n);return t}const lo=new Ni(Js);function ho(){return lo}function po(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:vi(t)?"-0":t}}function fo(e){return{integerValue:""+e}}function mo(e,t){return wi(t)?fo(t):po(e,t)}class go{constructor(){this._=void 0}}function yo(e,t,n){return e instanceof wo?function(e,t){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&Vi(t)&&(t=ji(t)),t&&(n.fields.__previous_value__=t),{mapValue:n}}(n,t):e instanceof Eo?bo(e,t):e instanceof ko?Co(e,t):function(e,t){const n=vo(e,t),s=So(n)+So(e.gt);return Zi(n)&&Zi(e.gt)?fo(s):po(e.serializer,s)}(e,t)}function _o(e,t,n){return e instanceof Eo?bo(e,t):e instanceof ko?Co(e,t):n}function vo(e,t){return e instanceof Ao?Zi(n=t)||function(e){return!!e&&"doubleValue"in e}(n)?t:{integerValue:0}:null;var n}class wo extends go{}class Eo extends go{constructor(e){super(),this.elements=e}}function bo(e,t){const n=To(t);for(const t of e.elements)n.some((e=>Gi(e,t)))||n.push(t);return{arrayValue:{values:n}}}class ko extends go{constructor(e){super(),this.elements=e}}function Co(e,t){let n=To(t);for(const t of e.elements)n=n.filter((e=>!Gi(e,t)));return{arrayValue:{values:n}}}class Ao extends go{constructor(e,t){super(),this.serializer=e,this.gt=t}}function So(e){return Fi(e.integerValue||e.doubleValue)}function To(e){return er(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Io{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Io}static exists(e){return new Io(void 0,e)}static updateTime(e){return new Io(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Do(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class No{}function Ro(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new jo(e.key,Io.none()):new Mo(e.key,e.data,Io.none());{const n=e.data,s=or.empty();let i=new Ni(ri.comparator);for(let e of t.fields)if(!i.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?s.delete(e):s.set(e,t),i=i.add(e)}return new xo(e.key,s,new Oi(i.toArray()),Io.none())}}function Oo(e,t,n){e instanceof Mo?function(e,t,n){const s=e.value.clone(),i=Uo(e.fieldTransforms,t,n.transformResults);s.setAll(i),t.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(e,t,n):e instanceof xo?function(e,t,n){if(!Do(e.precondition,t))return void t.convertToUnknownDocument(n.version);const s=Uo(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(Fo(e)),i.setAll(s),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function Po(e,t,n,s){return e instanceof Mo?function(e,t,n,s){if(!Do(e.precondition,t))return n;const i=e.value.clone(),r=Vo(e.fieldTransforms,s,t);return i.setAll(r),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,s):e instanceof xo?function(e,t,n,s){if(!Do(e.precondition,t))return n;const i=Vo(e.fieldTransforms,s,t),r=t.data;return r.setAll(Fo(e)),r.setAll(i),t.convertToFoundDocument(t.version,r).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,s):function(e,t,n){return Do(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function Lo(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Zs(e,t,((e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Eo&&t instanceof Eo||e instanceof ko&&t instanceof ko?Zs(e.elements,t.elements,Gi):e instanceof Ao&&t instanceof Ao?Gi(e.gt,t.gt):e instanceof wo&&t instanceof wo}(e.transform,t.transform)}(e,t)))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class Mo extends No{constructor(e,t,n,s=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class xo extends No{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 Fo(e){const t=new Map;return e.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const s=e.data.field(n);t.set(n,s)}})),t}function Uo(e,t,n){const s=new Map;Fs(e.length===n.length);for(let i=0;i<n.length;i++){const r=e[i],o=r.transform,a=t.data.field(r.field);s.set(r.field,_o(o,a,n[i]))}return s}function Vo(e,t,n){const s=new Map;for(const i of e){const e=i.transform,r=n.data.field(i.field);s.set(i.field,yo(e,r,t))}return s}class jo extends No{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Bo{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 t=0;t<this.mutations.length;t++){const s=this.mutations[t];s.key.isEqual(e.key)&&Oo(s,e,n[t])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=Po(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=Po(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=oo();return this.mutations.forEach((s=>{const i=e.get(s.key),r=i.overlayedDocument;let o=this.applyToLocalView(r,i.mutatedFields);o=t.has(s.key)?null:o;const a=Ro(r,o);null!==a&&n.set(s.key,a),r.isValidDocument()||r.convertToNoDocument(ti.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),uo())}isEqual(e){return this.batchId===e.batchId&&Zs(this.mutations,e.mutations,((e,t)=>Lo(e,t)))&&Zs(this.baseMutations,e.baseMutations,((e,t)=>Lo(e,t)))}}class qo{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}class $o{constructor(e,t){this.count=e,this.unchangedNames=t}}var zo,Ho;function Go(e){if(void 0===e)return Ps("GRPC error has no .code"),Vs.UNKNOWN;switch(e){case zo.OK:return Vs.OK;case zo.CANCELLED:return Vs.CANCELLED;case zo.UNKNOWN:return Vs.UNKNOWN;case zo.DEADLINE_EXCEEDED:return Vs.DEADLINE_EXCEEDED;case zo.RESOURCE_EXHAUSTED:return Vs.RESOURCE_EXHAUSTED;case zo.INTERNAL:return Vs.INTERNAL;case zo.UNAVAILABLE:return Vs.UNAVAILABLE;case zo.UNAUTHENTICATED:return Vs.UNAUTHENTICATED;case zo.INVALID_ARGUMENT:return Vs.INVALID_ARGUMENT;case zo.NOT_FOUND:return Vs.NOT_FOUND;case zo.ALREADY_EXISTS:return Vs.ALREADY_EXISTS;case zo.PERMISSION_DENIED:return Vs.PERMISSION_DENIED;case zo.FAILED_PRECONDITION:return Vs.FAILED_PRECONDITION;case zo.ABORTED:return Vs.ABORTED;case zo.OUT_OF_RANGE:return Vs.OUT_OF_RANGE;case zo.UNIMPLEMENTED:return Vs.UNIMPLEMENTED;case zo.DATA_LOSS:return Vs.DATA_LOSS;default:return xs()}}(Ho=zo||(zo={}))[Ho.OK=0]="OK",Ho[Ho.CANCELLED=1]="CANCELLED",Ho[Ho.UNKNOWN=2]="UNKNOWN",Ho[Ho.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Ho[Ho.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Ho[Ho.NOT_FOUND=5]="NOT_FOUND",Ho[Ho.ALREADY_EXISTS=6]="ALREADY_EXISTS",Ho[Ho.PERMISSION_DENIED=7]="PERMISSION_DENIED",Ho[Ho.UNAUTHENTICATED=16]="UNAUTHENTICATED",Ho[Ho.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Ho[Ho.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Ho[Ho.ABORTED=10]="ABORTED",Ho[Ho.OUT_OF_RANGE=11]="OUT_OF_RANGE",Ho[Ho.UNIMPLEMENTED=12]="UNIMPLEMENTED",Ho[Ho.INTERNAL=13]="INTERNAL",Ho[Ho.UNAVAILABLE=14]="UNAVAILABLE",Ho[Ho.DATA_LOSS=15]="DATA_LOSS";class Ko{constructor(){this.onExistenceFilterMismatchCallbacks=new Map}static get instance(){return Wo}static getOrCreateInstance(){return null===Wo&&(Wo=new Ko),Wo}onExistenceFilterMismatch(e){const t=Symbol();return this.onExistenceFilterMismatchCallbacks.set(t,e),()=>this.onExistenceFilterMismatchCallbacks.delete(t)}notifyOnExistenceFilterMismatch(e){this.onExistenceFilterMismatchCallbacks.forEach((t=>t(e)))}}let Wo=null;function Qo(){return new TextEncoder}const Yo=new Ss([4294967295,4294967295],0);function Xo(e){const t=Qo().encode(e),n=new As;return n.update(t),new Uint8Array(n.digest())}function Jo(e){const t=new DataView(e.buffer),n=t.getUint32(0,!0),s=t.getUint32(4,!0),i=t.getUint32(8,!0),r=t.getUint32(12,!0);return[new Ss([n,s],0),new Ss([i,r],0)]}class Zo{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new ea(`Invalid padding: ${t}`);if(n<0)throw new ea(`Invalid hash count: ${n}`);if(e.length>0&&0===this.hashCount)throw new ea(`Invalid hash count: ${n}`);if(0===e.length&&0!==t)throw new ea(`Invalid padding when bitmap length is 0: ${t}`);this.It=8*e.length-t,this.Tt=Ss.fromNumber(this.It)}Et(e,t,n){let s=e.add(t.multiply(Ss.fromNumber(n)));return 1===s.compare(Yo)&&(s=new Ss([s.getBits(0),s.getBits(1)],0)),s.modulo(this.Tt).toNumber()}At(e){return 0!=(this.bitmap[Math.floor(e/8)]&1<<e%8)}vt(e){if(0===this.It)return!1;const t=Xo(e),[n,s]=Jo(t);for(let e=0;e<this.hashCount;e++){const t=this.Et(n,s,e);if(!this.At(t))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)),r=new Zo(i,s,t);return n.forEach((e=>r.insert(e))),r}insert(e){if(0===this.It)return;const t=Xo(e),[n,s]=Jo(t);for(let e=0;e<this.hashCount;e++){const t=this.Et(n,s,e);this.Rt(t)}}Rt(e){const t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}}class ea extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}class ta{constructor(e,t,n,s,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=s,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,t,n){const s=new Map;return s.set(e,na.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new ta(ti.min(),s,new Ti(Js),to(),uo())}}class na{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 na(n,t,uo(),uo(),uo())}}class sa{constructor(e,t,n,s){this.Pt=e,this.removedTargetIds=t,this.key=n,this.bt=s}}class ia{constructor(e,t){this.targetId=e,this.Vt=t}}class ra{constructor(e,t,n=Li.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=s}}class oa{constructor(){this.St=0,this.Dt=ua(),this.Ct=Li.EMPTY_BYTE_STRING,this.xt=!1,this.Nt=!0}get current(){return this.xt}get resumeToken(){return this.Ct}get kt(){return 0!==this.St}get Mt(){return this.Nt}$t(e){e.approximateByteSize()>0&&(this.Nt=!0,this.Ct=e)}Ot(){let e=uo(),t=uo(),n=uo();return this.Dt.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:xs()}})),new na(this.Ct,this.xt,e,t,n)}Ft(){this.Nt=!1,this.Dt=ua()}Bt(e,t){this.Nt=!0,this.Dt=this.Dt.insert(e,t)}Lt(e){this.Nt=!0,this.Dt=this.Dt.remove(e)}qt(){this.St+=1}Ut(){this.St-=1}Kt(){this.Nt=!0,this.xt=!0}}class aa{constructor(e){this.Gt=e,this.Qt=new Map,this.jt=to(),this.zt=ca(),this.Wt=new Ti(Js)}Ht(e){for(const t of e.Pt)e.bt&&e.bt.isFoundDocument()?this.Jt(t,e.bt):this.Yt(t,e.key,e.bt);for(const t of e.removedTargetIds)this.Yt(t,e.key,e.bt)}Xt(e){this.forEachTarget(e,(t=>{const n=this.Zt(t);switch(e.state){case 0:this.te(t)&&n.$t(e.resumeToken);break;case 1:n.Ut(),n.kt||n.Ft(),n.$t(e.resumeToken);break;case 2:n.Ut(),n.kt||this.removeTarget(t);break;case 3:this.te(t)&&(n.Kt(),n.$t(e.resumeToken));break;case 4:this.te(t)&&(this.ee(t),n.$t(e.resumeToken));break;default:xs()}}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Qt.forEach(((e,n)=>{this.te(n)&&t(n)}))}ne(e){var t;const n=e.targetId,s=e.Vt.count,i=this.se(n);if(i){const r=i.target;if(Lr(r))if(0===s){const e=new oi(r.path);this.Yt(n,e,ar.newNoDocument(e,ti.min()))}else Fs(1===s);else{const i=this.ie(n);if(i!==s){const s=this.re(e,i);if(0!==s){this.ee(n);const e=2===s?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Wt=this.Wt.insert(n,e)}null===(t=Ko.instance)||void 0===t||t.notifyOnExistenceFilterMismatch(function(e,t,n){var s,i,r,o,a,c;const u={localCacheCount:t,existenceFilterCount:n.count},l=n.unchangedNames;return l&&(u.bloomFilter={applied:0===e,hashCount:null!==(s=null==l?void 0:l.hashCount)&&void 0!==s?s:0,bitmapLength:null!==(o=null===(r=null===(i=null==l?void 0:l.bits)||void 0===i?void 0:i.bitmap)||void 0===r?void 0:r.length)&&void 0!==o?o:0,padding:null!==(c=null===(a=null==l?void 0:l.bits)||void 0===a?void 0:a.padding)&&void 0!==c?c:0}),u}(s,i,e.Vt))}}}}re(e,t){const{unchangedNames:n,count:s}=e.Vt;if(!n||!n.bits)return 1;const{bits:{bitmap:i="",padding:r=0},hashCount:o=0}=n;let a,c;try{a=Ui(i).toUint8Array()}catch(e){if(e instanceof Pi)return Ls("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),1;throw e}try{c=new Zo(a,r,o)}catch(e){return Ls(e instanceof ea?"BloomFilter error: ":"Applying bloom filter failed: ",e),1}return 0===c.It?1:s!==t-this.oe(e.targetId,c)?2:0}oe(e,t){const n=this.Gt.getRemoteKeysForTarget(e);let s=0;return n.forEach((n=>{const i=this.Gt.ue(),r=`projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;t.vt(r)||(this.Yt(e,n,null),s++)})),s}ce(e){const t=new Map;this.Qt.forEach(((n,s)=>{const i=this.se(s);if(i){if(n.current&&Lr(i.target)){const t=new oi(i.target.path);null!==this.jt.get(t)||this.ae(s,t)||this.Yt(s,t,ar.newNoDocument(t,e))}n.Mt&&(t.set(s,n.Ot()),n.Ft())}}));let n=uo();this.zt.forEach(((e,t)=>{let s=!0;t.forEachWhile((e=>{const t=this.se(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(s=!1,!1)})),s&&(n=n.add(e))})),this.jt.forEach(((t,n)=>n.setReadTime(e)));const s=new ta(e,t,this.Wt,this.jt,n);return this.jt=to(),this.zt=ca(),this.Wt=new Ti(Js),s}Jt(e,t){if(!this.te(e))return;const n=this.ae(e,t.key)?2:0;this.Zt(e).Bt(t.key,n),this.jt=this.jt.insert(t.key,t),this.zt=this.zt.insert(t.key,this.he(t.key).add(e))}Yt(e,t,n){if(!this.te(e))return;const s=this.Zt(e);this.ae(e,t)?s.Bt(t,1):s.Lt(t),this.zt=this.zt.insert(t,this.he(t).delete(e)),n&&(this.jt=this.jt.insert(t,n))}removeTarget(e){this.Qt.delete(e)}ie(e){const t=this.Zt(e).Ot();return this.Gt.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}qt(e){this.Zt(e).qt()}Zt(e){let t=this.Qt.get(e);return t||(t=new oa,this.Qt.set(e,t)),t}he(e){let t=this.zt.get(e);return t||(t=new Ni(Js),this.zt=this.zt.insert(e,t)),t}te(e){const t=null!==this.se(e);return t||Os("WatchChangeAggregator","Detected inactive target",e),t}se(e){const t=this.Qt.get(e);return t&&t.kt?null:this.Gt.le(e)}ee(e){this.Qt.set(e,new oa),this.Gt.getRemoteKeysForTarget(e).forEach((t=>{this.Yt(e,t,null)}))}ae(e,t){return this.Gt.getRemoteKeysForTarget(e).has(t)}}function ca(){return new Ti(oi.comparator)}function ua(){return new Ti(oi.comparator)}const la={asc:"ASCENDING",desc:"DESCENDING"},ha={"<":"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"},da={and:"AND",or:"OR"};class pa{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function fa(e,t){return e.useProto3Json||_i(t)?t:{value:t}}function ma(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function ga(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function ya(e){return Fs(!!e),ti.fromTimestamp(function(e){const t=xi(e);return new ei(t.seconds,t.nanos)}(e))}function _a(e,t){return function(e){return new si(["projects",e.projectId,"databases",e.database])}(e).child("documents").child(t).canonicalString()}function va(e){const t=si.fromString(e);return Fs(Ma(t)),t}function wa(e,t){const n=va(t);if(n.get(1)!==e.databaseId.projectId)throw new js(Vs.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new js(Vs.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new oi(Ca(n))}function Ea(e,t){return _a(e.databaseId,t)}function ba(e){const t=va(e);return 4===t.length?si.emptyPath():Ca(t)}function ka(e){return new si(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Ca(e){return Fs(e.length>4&&"documents"===e.get(4)),e.popFirst(5)}function Aa(e,t){return{documents:[Ea(e,t.path)]}}function Sa(e,t){const n={structuredQuery:{}},s=t.path;null!==t.collectionGroup?(n.parent=Ea(e,s),n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(n.parent=Ea(e,s.popLast()),n.structuredQuery.from=[{collectionId:s.lastSegment()}]);const i=function(e){if(0!==e.length)return La(mr.create(e,"and"))}(t.filters);i&&(n.structuredQuery.where=i);const r=function(e){if(0!==e.length)return e.map((e=>function(e){return{field:Oa(e.field),direction:Da(e.dir)}}(e)))}(t.orderBy);r&&(n.structuredQuery.orderBy=r);const o=fa(e,t.limit);var a;return null!==o&&(n.structuredQuery.limit=o),t.startAt&&(n.structuredQuery.startAt={before:(a=t.startAt).inclusive,values:a.position}),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),n}function Ta(e){let t=ba(e.parent);const n=e.structuredQuery,s=n.from?n.from.length:0;let i=null;if(s>0){Fs(1===s);const e=n.from[0];e.allDescendants?i=e.collectionId:t=t.child(e.collectionId)}let r=[];n.where&&(r=function(e){const t=Ia(e);return t instanceof mr&&yr(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((e=>function(e){return new hr(Pa(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,_i(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){const t=!!e.before,n=e.values||[];return new cr(n,t)}(n.startAt));let u=null;return n.endAt&&(u=function(e){const t=!e.before,n=e.values||[];return new cr(n,t)}(n.endAt)),xr(t,i,o,r,a,"F",c,u)}function Ia(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=Pa(e.unaryFilter.field);return fr.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=Pa(e.unaryFilter.field);return fr.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=Pa(e.unaryFilter.field);return fr.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=Pa(e.unaryFilter.field);return fr.create(i,"!=",{nullValue:"NULL_VALUE"});default:return xs()}}(e):void 0!==e.fieldFilter?function(e){return fr.create(Pa(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return xs()}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return mr.create(e.compositeFilter.filters.map((e=>Ia(e))),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return xs()}}(e.compositeFilter.op))}(e):xs()}function Da(e){return la[e]}function Na(e){return ha[e]}function Ra(e){return da[e]}function Oa(e){return{fieldPath:e.canonicalString()}}function Pa(e){return ri.fromServerFormat(e.fieldPath)}function La(e){return e instanceof fr?function(e){if("=="===e.op){if(nr(e.value))return{unaryFilter:{field:Oa(e.field),op:"IS_NAN"}};if(tr(e.value))return{unaryFilter:{field:Oa(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(nr(e.value))return{unaryFilter:{field:Oa(e.field),op:"IS_NOT_NAN"}};if(tr(e.value))return{unaryFilter:{field:Oa(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Oa(e.field),op:Na(e.op),value:e.value}}}(e):e instanceof mr?function(e){const t=e.getFilters().map((e=>La(e)));return 1===t.length?t[0]:{compositeFilter:{op:Ra(e.op),filters:t}}}(e):xs()}function Ma(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}class xa{constructor(e,t,n,s,i=ti.min(),r=ti.min(),o=Li.EMPTY_BYTE_STRING,a=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=r,this.resumeToken=o,this.expectedCount=a}withSequenceNumber(e){return new xa(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new xa(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new xa(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new xa(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class Fa{constructor(e){this.fe=e}}function Ua(e){const t=Ta({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?Hr(t,t.limit,"L"):t}class Va{constructor(){}_e(e,t){this.me(e,t),t.ge()}me(e,t){if("nullValue"in e)this.ye(t,5);else if("booleanValue"in e)this.ye(t,10),t.pe(e.booleanValue?1:0);else if("integerValue"in e)this.ye(t,15),t.pe(Fi(e.integerValue));else if("doubleValue"in e){const n=Fi(e.doubleValue);isNaN(n)?this.ye(t,13):(this.ye(t,15),vi(n)?t.pe(0):t.pe(n))}else if("timestampValue"in e){const n=e.timestampValue;this.ye(t,20),"string"==typeof n?t.Ie(n):(t.Ie(`${n.seconds||""}`),t.pe(n.nanos||0))}else if("stringValue"in e)this.Te(e.stringValue,t),this.Ee(t);else if("bytesValue"in e)this.ye(t,30),t.Ae(Ui(e.bytesValue)),this.Ee(t);else if("referenceValue"in e)this.ve(e.referenceValue,t);else if("geoPointValue"in e){const n=e.geoPointValue;this.ye(t,45),t.pe(n.latitude||0),t.pe(n.longitude||0)}else"mapValue"in e?rr(e)?this.ye(t,Number.MAX_SAFE_INTEGER):(this.Re(e.mapValue,t),this.Ee(t)):"arrayValue"in e?(this.Pe(e.arrayValue,t),this.Ee(t)):xs()}Te(e,t){this.ye(t,25),this.be(e,t)}be(e,t){t.Ie(e)}Re(e,t){const n=e.fields||{};this.ye(t,55);for(const e of Object.keys(n))this.Te(e,t),this.me(n[e],t)}Pe(e,t){const n=e.values||[];this.ye(t,50);for(const e of n)this.me(e,t)}ve(e,t){this.ye(t,37),oi.fromName(e).path.forEach((e=>{this.ye(t,60),this.be(e,t)}))}ye(e,t){e.pe(t)}Ee(e){e.pe(2)}}Va.Ve=new Va;class ja{constructor(){this.rn=new Ba}addToCollectionParentIndex(e,t){return this.rn.add(t),mi.resolve()}getCollectionParents(e,t){return mi.resolve(this.rn.getEntries(t))}addFieldIndex(e,t){return mi.resolve()}deleteFieldIndex(e,t){return mi.resolve()}getDocumentsMatchingTarget(e,t){return mi.resolve(null)}getIndexType(e,t){return mi.resolve(0)}getFieldIndexes(e,t){return mi.resolve([])}getNextCollectionGroupToUpdate(e){return mi.resolve(null)}getMinOffset(e,t){return mi.resolve(li.min())}getMinOffsetFromCollectionGroup(e,t){return mi.resolve(li.min())}updateCollectionGroup(e,t,n){return mi.resolve()}updateIndexEntries(e,t){return mi.resolve()}}class Ba{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),s=this.index[t]||new Ni(si.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 Ni(si.comparator)).toArray()}}new Uint8Array(0);class qa{constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}static withCacheSize(e){return new qa(e,qa.DEFAULT_COLLECTION_PERCENTILE,qa.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}qa.DEFAULT_COLLECTION_PERCENTILE=10,qa.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,qa.DEFAULT=new qa(41943040,qa.DEFAULT_COLLECTION_PERCENTILE,qa.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),qa.DISABLED=new qa(-1,0,0);class $a{constructor(e){this.Nn=e}next(){return this.Nn+=2,this.Nn}static kn(){return new $a(0)}static Mn(){return new $a(-1)}}class za{constructor(){this.changes=new Zr((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,ar.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?mi.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)}assertNotApplied(){}}class Ha{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class Ga{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((e=>(null!==n&&Po(n.mutation,e,Oi.empty(),ei.now()),e)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.getLocalViewOfDocuments(e,t,uo()).next((()=>t))))}getLocalViewOfDocuments(e,t,n=uo()){const s=ro();return this.populateOverlays(e,s,t).next((()=>this.computeViews(e,t,s,n).next((e=>{let t=so();return e.forEach(((e,n)=>{t=t.insert(e,n.overlayedDocument)})),t}))))}getOverlayedDocuments(e,t){const n=ro();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,uo())))}populateOverlays(e,t,n){const s=[];return n.forEach((e=>{t.has(e)||s.push(e)})),this.documentOverlayCache.getOverlays(e,s).next((e=>{e.forEach(((e,n)=>{t.set(e,n)}))}))}computeViews(e,t,n,s){let i=to();const r=ao(),o=ao();return t.forEach(((e,t)=>{const o=n.get(t.key);s.has(t.key)&&(void 0===o||o.mutation instanceof xo)?i=i.insert(t.key,t):void 0!==o?(r.set(t.key,o.mutation.getFieldMask()),Po(o.mutation,t,o.mutation.getFieldMask(),ei.now())):r.set(t.key,Oi.empty())})),this.recalculateAndSaveOverlays(e,i).next((e=>(e.forEach(((e,t)=>r.set(e,t))),t.forEach(((e,t)=>{var n;return o.set(e,new Ha(t,null!==(n=r.get(e))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(e,t){const n=ao();let s=new Ti(((e,t)=>e-t)),i=uo();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((e=>{for(const i of e)i.keys().forEach((e=>{const r=t.get(e);if(null===r)return;let o=n.get(e)||Oi.empty();o=i.applyToLocalView(r,o),n.set(e,o);const a=(s.get(i.batchId)||uo()).add(e);s=s.insert(i.batchId,a)}))})).next((()=>{const r=[],o=s.getReverseIterator();for(;o.hasNext();){const s=o.getNext(),a=s.key,c=s.value,u=oo();c.forEach((e=>{if(!i.has(e)){const s=Ro(t.get(e),n.get(e));null!==s&&u.set(e,s),i=i.add(e)}})),r.push(this.documentOverlayCache.saveOverlays(e,a,u))}return mi.waitFor(r)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.recalculateAndSaveOverlays(e,t)))}getDocumentsMatchingQuery(e,t,n){return function(e){return oi.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Br(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n):this.getDocumentsMatchingCollectionQuery(e,t,n)}getNextDocuments(e,t,n,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,s).next((i=>{const r=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,s-i.size):mi.resolve(ro());let o=-1,a=i;return r.next((t=>mi.forEach(t,((t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(t)?mi.resolve():this.remoteDocumentCache.getEntry(e,t).next((e=>{a=a.insert(t,e)}))))).next((()=>this.populateOverlays(e,t,i))).next((()=>this.computeViews(e,a,t,uo()))).next((e=>({batchId:o,changes:io(e)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new oi(t)).next((e=>{let t=so();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}getDocumentsMatchingCollectionGroupQuery(e,t,n){const s=t.collectionGroup;let i=so();return this.indexManager.getCollectionParents(e,s).next((r=>mi.forEach(r,(r=>{const o=function(e,t){return new Mr(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,r.child(s));return this.getDocumentsMatchingCollectionQuery(e,o,n).next((e=>{e.forEach(((e,t)=>{i=i.insert(e,t)}))}))})).next((()=>i))))}getDocumentsMatchingCollectionQuery(e,t,n){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((i=>(s=i,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,s)))).next((e=>{s.forEach(((t,n)=>{const s=n.getKey();null===e.get(s)&&(e=e.insert(s,ar.newInvalidDocument(s)))}));let n=so();return e.forEach(((e,i)=>{const r=s.get(e);void 0!==r&&Po(r.mutation,i,Oi.empty(),ei.now()),Qr(t,i)&&(n=n.insert(e,i))})),n}))}}class Ka{constructor(e){this.serializer=e,this.cs=new Map,this.hs=new Map}getBundleMetadata(e,t){return mi.resolve(this.cs.get(t))}saveBundleMetadata(e,t){var n;return this.cs.set(t.id,{id:(n=t).id,version:n.version,createTime:ya(n.createTime)}),mi.resolve()}getNamedQuery(e,t){return mi.resolve(this.hs.get(t))}saveNamedQuery(e,t){return this.hs.set(t.name,function(e){return{name:e.name,query:Ua(e.bundledQuery),readTime:ya(e.readTime)}}(t)),mi.resolve()}}class Wa{constructor(){this.overlays=new Ti(oi.comparator),this.ls=new Map}getOverlay(e,t){return mi.resolve(this.overlays.get(t))}getOverlays(e,t){const n=ro();return mi.forEach(t,(t=>this.getOverlay(e,t).next((e=>{null!==e&&n.set(t,e)})))).next((()=>n))}saveOverlays(e,t,n){return n.forEach(((n,s)=>{this.we(e,t,s)})),mi.resolve()}removeOverlaysForBatchId(e,t,n){const s=this.ls.get(n);return void 0!==s&&(s.forEach((e=>this.overlays=this.overlays.remove(e))),this.ls.delete(n)),mi.resolve()}getOverlaysForCollection(e,t,n){const s=ro(),i=t.length+1,r=new oi(t.child("")),o=this.overlays.getIteratorFrom(r);for(;o.hasNext();){const e=o.getNext().value,r=e.getKey();if(!t.isPrefixOf(r.path))break;r.path.length===i&&e.largestBatchId>n&&s.set(e.getKey(),e)}return mi.resolve(s)}getOverlaysForCollectionGroup(e,t,n,s){let i=new Ti(((e,t)=>e-t));const r=this.overlays.getIterator();for(;r.hasNext();){const e=r.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=i.get(e.largestBatchId);null===t&&(t=ro(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const o=ro(),a=i.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((e,t)=>o.set(e,t))),!(o.size()>=s)););return mi.resolve(o)}we(e,t,n){const s=this.overlays.get(n.key);if(null!==s){const e=this.ls.get(s.largestBatchId).delete(n.key);this.ls.set(s.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new qo(t,n));let i=this.ls.get(t);void 0===i&&(i=uo(),this.ls.set(t,i)),this.ls.set(t,i.add(n.key))}}class Qa{constructor(){this.fs=new Ni(Ya.ds),this.ws=new Ni(Ya._s)}isEmpty(){return this.fs.isEmpty()}addReference(e,t){const n=new Ya(e,t);this.fs=this.fs.add(n),this.ws=this.ws.add(n)}gs(e,t){e.forEach((e=>this.addReference(e,t)))}removeReference(e,t){this.ys(new Ya(e,t))}ps(e,t){e.forEach((e=>this.removeReference(e,t)))}Is(e){const t=new oi(new si([])),n=new Ya(t,e),s=new Ya(t,e+1),i=[];return this.ws.forEachInRange([n,s],(e=>{this.ys(e),i.push(e.key)})),i}Ts(){this.fs.forEach((e=>this.ys(e)))}ys(e){this.fs=this.fs.delete(e),this.ws=this.ws.delete(e)}Es(e){const t=new oi(new si([])),n=new Ya(t,e),s=new Ya(t,e+1);let i=uo();return this.ws.forEachInRange([n,s],(e=>{i=i.add(e.key)})),i}containsKey(e){const t=new Ya(e,0),n=this.fs.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class Ya{constructor(e,t){this.key=e,this.As=t}static ds(e,t){return oi.comparator(e.key,t.key)||Js(e.As,t.As)}static _s(e,t){return Js(e.As,t.As)||oi.comparator(e.key,t.key)}}class Xa{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.vs=1,this.Rs=new Ni(Ya.ds)}checkEmpty(e){return mi.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,s){const i=this.vs;this.vs++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const r=new Bo(i,t,n,s);this.mutationQueue.push(r);for(const t of s)this.Rs=this.Rs.add(new Ya(t.key,i)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return mi.resolve(r)}lookupMutationBatch(e,t){return mi.resolve(this.Ps(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,s=this.bs(n),i=s<0?0:s;return mi.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return mi.resolve(0===this.mutationQueue.length?-1:this.vs-1)}getAllMutationBatches(e){return mi.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new Ya(t,0),s=new Ya(t,Number.POSITIVE_INFINITY),i=[];return this.Rs.forEachInRange([n,s],(e=>{const t=this.Ps(e.As);i.push(t)})),mi.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new Ni(Js);return t.forEach((e=>{const t=new Ya(e,0),s=new Ya(e,Number.POSITIVE_INFINITY);this.Rs.forEachInRange([t,s],(e=>{n=n.add(e.As)}))})),mi.resolve(this.Vs(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,s=n.length+1;let i=n;oi.isDocumentKey(i)||(i=i.child(""));const r=new Ya(new oi(i),0);let o=new Ni(Js);return this.Rs.forEachWhile((e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===s&&(o=o.add(e.As)),!0)}),r),mi.resolve(this.Vs(o))}Vs(e){const t=[];return e.forEach((e=>{const n=this.Ps(e);null!==n&&t.push(n)})),t}removeMutationBatch(e,t){Fs(0===this.Ss(t.batchId,"removed")),this.mutationQueue.shift();let n=this.Rs;return mi.forEach(t.mutations,(s=>{const i=new Ya(s.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)})).next((()=>{this.Rs=n}))}Cn(e){}containsKey(e,t){const n=new Ya(t,0),s=this.Rs.firstAfterOrEqual(n);return mi.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,mi.resolve()}Ss(e,t){return this.bs(e)}bs(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Ps(e){const t=this.bs(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class Ja{constructor(e){this.Ds=e,this.docs=new Ti(oi.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,r=this.Ds(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:r}),this.size+=r-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 mi.resolve(n?n.document.mutableCopy():ar.newInvalidDocument(t))}getEntries(e,t){let n=to();return t.forEach((e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():ar.newInvalidDocument(e))})),mi.resolve(n)}getDocumentsMatchingQuery(e,t,n,s){let i=to();const r=t.path,o=new oi(r.child("")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){const{key:e,value:{document:o}}=a.getNext();if(!r.isPrefixOf(e.path))break;e.path.length>r.length+1||hi(ui(o),n)<=0||(s.has(o.key)||Qr(t,o))&&(i=i.insert(o.key,o.mutableCopy()))}return mi.resolve(i)}getAllFromCollectionGroup(e,t,n,s){xs()}Cs(e,t){return mi.forEach(this.docs,(e=>t(e)))}newChangeBuffer(e){return new Za(this)}getSize(e){return mi.resolve(this.size)}}class Za extends za{constructor(e){super(),this.os=e}applyChanges(e){const t=[];return this.changes.forEach(((n,s)=>{s.isValidDocument()?t.push(this.os.addEntry(e,s)):this.os.removeEntry(n)})),mi.waitFor(t)}getFromCache(e,t){return this.os.getEntry(e,t)}getAllFromCache(e,t){return this.os.getEntries(e,t)}}class ec{constructor(e){this.persistence=e,this.xs=new Zr((e=>Or(e)),Pr),this.lastRemoteSnapshotVersion=ti.min(),this.highestTargetId=0,this.Ns=0,this.ks=new Qa,this.targetCount=0,this.Ms=$a.kn()}forEachTarget(e,t){return this.xs.forEach(((e,n)=>t(n))),mi.resolve()}getLastRemoteSnapshotVersion(e){return mi.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return mi.resolve(this.Ns)}allocateTargetId(e){return this.highestTargetId=this.Ms.next(),mi.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Ns&&(this.Ns=t),mi.resolve()}Fn(e){this.xs.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.Ms=new $a(t),this.highestTargetId=t),e.sequenceNumber>this.Ns&&(this.Ns=e.sequenceNumber)}addTargetData(e,t){return this.Fn(t),this.targetCount+=1,mi.resolve()}updateTargetData(e,t){return this.Fn(t),mi.resolve()}removeTargetData(e,t){return this.xs.delete(t.target),this.ks.Is(t.targetId),this.targetCount-=1,mi.resolve()}removeTargets(e,t,n){let s=0;const i=[];return this.xs.forEach(((r,o)=>{o.sequenceNumber<=t&&null===n.get(o.targetId)&&(this.xs.delete(r),i.push(this.removeMatchingKeysForTargetId(e,o.targetId)),s++)})),mi.waitFor(i).next((()=>s))}getTargetCount(e){return mi.resolve(this.targetCount)}getTargetData(e,t){const n=this.xs.get(t)||null;return mi.resolve(n)}addMatchingKeys(e,t,n){return this.ks.gs(t,n),mi.resolve()}removeMatchingKeys(e,t,n){this.ks.ps(t,n);const s=this.persistence.referenceDelegate,i=[];return s&&t.forEach((t=>{i.push(s.markPotentiallyOrphaned(e,t))})),mi.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.ks.Is(t),mi.resolve()}getMatchingKeysForTargetId(e,t){const n=this.ks.Es(t);return mi.resolve(n)}containsKey(e,t){return mi.resolve(this.ks.containsKey(t))}}class tc{constructor(e,t){this.$s={},this.overlays={},this.Os=new yi(0),this.Fs=!1,this.Fs=!0,this.referenceDelegate=e(this),this.Bs=new ec(this),this.indexManager=new ja,this.remoteDocumentCache=function(e){return new Ja(e)}((e=>this.referenceDelegate.Ls(e))),this.serializer=new Fa(t),this.qs=new Ka(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.Fs=!1,Promise.resolve()}get started(){return this.Fs}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Wa,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.$s[e.toKey()];return n||(n=new Xa(t,this.referenceDelegate),this.$s[e.toKey()]=n),n}getTargetCache(){return this.Bs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.qs}runTransaction(e,t,n){Os("MemoryPersistence","Starting transaction:",e);const s=new nc(this.Os.next());return this.referenceDelegate.Us(),n(s).next((e=>this.referenceDelegate.Ks(s).next((()=>e)))).toPromise().then((e=>(s.raiseOnCommittedEvent(),e)))}Gs(e,t){return mi.or(Object.values(this.$s).map((n=>()=>n.containsKey(e,t))))}}class nc extends pi{constructor(e){super(),this.currentSequenceNumber=e}}class sc{constructor(e){this.persistence=e,this.Qs=new Qa,this.js=null}static zs(e){return new sc(e)}get Ws(){if(this.js)return this.js;throw xs()}addReference(e,t,n){return this.Qs.addReference(n,t),this.Ws.delete(n.toString()),mi.resolve()}removeReference(e,t,n){return this.Qs.removeReference(n,t),this.Ws.add(n.toString()),mi.resolve()}markPotentiallyOrphaned(e,t){return this.Ws.add(t.toString()),mi.resolve()}removeTarget(e,t){this.Qs.Is(t.targetId).forEach((e=>this.Ws.add(e.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((e=>{e.forEach((e=>this.Ws.add(e.toString())))})).next((()=>n.removeTargetData(e,t)))}Us(){this.js=new Set}Ks(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return mi.forEach(this.Ws,(n=>{const s=oi.fromPath(n);return this.Hs(e,s).next((e=>{e||t.removeEntry(s,ti.min())}))})).next((()=>(this.js=null,t.apply(e))))}updateLimboDocument(e,t){return this.Hs(e,t).next((e=>{e?this.Ws.delete(t.toString()):this.Ws.add(t.toString())}))}Ls(e){return 0}Hs(e,t){return mi.or([()=>mi.resolve(this.Qs.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Gs(e,t)])}}class ic{constructor(e,t,n,s){this.targetId=e,this.fromCache=t,this.Fi=n,this.Bi=s}static Li(e,t){let n=uo(),s=uo();for(const e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:s=s.add(e.doc.key)}return new ic(e,t.fromCache,n,s)}}class rc{constructor(){this.qi=!1}initialize(e,t){this.Ui=e,this.indexManager=t,this.qi=!0}getDocumentsMatchingQuery(e,t,n,s){return this.Ki(e,t).next((i=>i||this.Gi(e,t,s,n))).next((n=>n||this.Qi(e,t)))}Ki(e,t){if(Ur(t))return mi.resolve(null);let n=$r(t);return this.indexManager.getIndexType(e,n).next((s=>0===s?null:(null!==t.limit&&1===s&&(t=Hr(t,null,"F"),n=$r(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next((s=>{const i=uo(...s);return this.Ui.getDocuments(e,i).next((s=>this.indexManager.getMinOffset(e,n).next((n=>{const r=this.ji(t,s);return this.zi(t,r,i,n.readTime)?this.Ki(e,Hr(t,null,"F")):this.Wi(e,r,t,n)}))))})))))}Gi(e,t,n,s){return Ur(t)||s.isEqual(ti.min())?this.Qi(e,t):this.Ui.getDocuments(e,n).next((i=>{const r=this.ji(t,i);return this.zi(t,r,n,s)?this.Qi(e,t):(Rs()<=o.in.DEBUG&&Os("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),Wr(t)),this.Wi(e,r,t,ci(s,-1)))}))}ji(e,t){let n=new Ni(Xr(e));return t.forEach(((t,s)=>{Qr(e,s)&&(n=n.add(s))})),n}zi(e,t,n,s){if(null===e.limit)return!1;if(n.size!==t.size)return!0;const i="F"===e.limitType?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}Qi(e,t){return Rs()<=o.in.DEBUG&&Os("QueryEngine","Using full collection scan to execute query:",Wr(t)),this.Ui.getDocumentsMatchingQuery(e,t,li.min())}Wi(e,t,n,s){return this.Ui.getDocumentsMatchingQuery(e,n,s).next((e=>(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}}class oc{constructor(e,t,n,s){this.persistence=e,this.Hi=t,this.serializer=s,this.Ji=new Ti(Js),this.Yi=new Zr((e=>Or(e)),Pr),this.Xi=new Map,this.Zi=e.getRemoteDocumentCache(),this.Bs=e.getTargetCache(),this.qs=e.getBundleCache(),this.tr(n)}tr(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Ga(this.Zi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Zi.setIndexManager(this.indexManager),this.Hi.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(t=>e.collect(t,this.Ji)))}}function ac(e,t,n,s){return new oc(e,t,n,s)}async function cc(e,t){const n=Us(e);return await n.persistence.runTransaction("Handle user change","readonly",(e=>{let s;return n.mutationQueue.getAllMutationBatches(e).next((i=>(s=i,n.tr(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{const i=[],r=[];let o=uo();for(const e of s){i.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}for(const e of t){r.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next((e=>({er:e,removedBatchIds:i,addedBatchIds:r})))}))}))}function uc(e){const t=Us(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",(e=>t.Bs.getLastRemoteSnapshotVersion(e)))}function lc(e,t,n){let s=uo(),i=uo();return n.forEach((e=>s=s.add(e))),t.getEntries(e,s).next((e=>{let s=to();return n.forEach(((n,r)=>{const o=e.get(n);r.isFoundDocument()!==o.isFoundDocument()&&(i=i.add(n)),r.isNoDocument()&&r.version.isEqual(ti.min())?(t.removeEntry(n,r.readTime),s=s.insert(n,r)):!o.isValidDocument()||r.version.compareTo(o.version)>0||0===r.version.compareTo(o.version)&&o.hasPendingWrites?(t.addEntry(r),s=s.insert(n,r)):Os("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",r.version)})),{nr:s,sr:i}}))}function hc(e,t){const n=Us(e);return n.persistence.runTransaction("Allocate target","readwrite",(e=>{let s;return n.Bs.getTargetData(e,t).next((i=>i?(s=i,mi.resolve(s)):n.Bs.allocateTargetId(e).next((i=>(s=new xa(t,i,"TargetPurposeListen",e.currentSequenceNumber),n.Bs.addTargetData(e,s).next((()=>s)))))))})).then((e=>{const s=n.Ji.get(e.targetId);return(null===s||e.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.Ji=n.Ji.insert(e.targetId,e),n.Yi.set(t,e.targetId)),e}))}async function dc(e,t,n){const s=Us(e),i=s.Ji.get(t),r=n?"readwrite":"readwrite-primary";try{n||await s.persistence.runTransaction("Release target",r,(e=>s.persistence.referenceDelegate.removeTarget(e,i)))}catch(e){if(!gi(e))throw e;Os("LocalStore",`Failed to update sequence numbers for target ${t}: ${e}`)}s.Ji=s.Ji.remove(t),s.Yi.delete(i.target)}function pc(e,t,n){const s=Us(e);let i=ti.min(),r=uo();return s.persistence.runTransaction("Execute query","readonly",(e=>function(e,t,n){const s=Us(e),i=s.Yi.get(n);return void 0!==i?mi.resolve(s.Ji.get(i)):s.Bs.getTargetData(t,n)}(s,e,$r(t)).next((t=>{if(t)return i=t.lastLimboFreeSnapshotVersion,s.Bs.getMatchingKeysForTargetId(e,t.targetId).next((e=>{r=e}))})).next((()=>s.Hi.getDocumentsMatchingQuery(e,t,n?i:ti.min(),n?r:uo()))).next((e=>(fc(s,Yr(t),e),{documents:e,ir:r})))))}function fc(e,t,n){let s=e.Xi.get(t)||ti.min();n.forEach(((e,t)=>{t.readTime.compareTo(s)>0&&(s=t.readTime)})),e.Xi.set(t,s)}class mc{constructor(){this.activeTargetIds=ho()}lr(e){this.activeTargetIds=this.activeTargetIds.add(e)}dr(e){this.activeTargetIds=this.activeTargetIds.delete(e)}hr(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class gc{constructor(){this.Hr=new mc,this.Jr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e){return this.Hr.lr(e),this.Jr[e]||"not-current"}updateQueryState(e,t,n){this.Jr[e]=t}removeLocalQueryTarget(e){this.Hr.dr(e)}isLocalQueryTarget(e){return this.Hr.activeTargetIds.has(e)}clearQueryState(e){delete this.Jr[e]}getAllActiveQueryTargets(){return this.Hr.activeTargetIds}isActiveQueryTarget(e){return this.Hr.activeTargetIds.has(e)}start(){return this.Hr=new mc,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class yc{Yr(e){}shutdown(){}}class _c{constructor(){this.Xr=()=>this.Zr(),this.eo=()=>this.no(),this.so=[],this.io()}Yr(e){this.so.push(e)}shutdown(){window.removeEventListener("online",this.Xr),window.removeEventListener("offline",this.eo)}io(){window.addEventListener("online",this.Xr),window.addEventListener("offline",this.eo)}Zr(){Os("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.so)e(0)}no(){Os("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.so)e(1)}static D(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let vc=null;function wc(){return null===vc?vc=268435456+Math.round(2147483648*Math.random()):vc++,"0x"+vc.toString(16)}const Ec={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class bc{constructor(e){this.ro=e.ro,this.oo=e.oo}uo(e){this.co=e}ao(e){this.ho=e}onMessage(e){this.lo=e}close(){this.oo()}send(e){this.ro(e)}fo(){this.co()}wo(e){this.ho(e)}_o(e){this.lo(e)}}const kc="WebChannelConnection";class Cc extends class{constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http";this.mo=t+"://"+e.host,this.yo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get po(){return!1}Io(e,t,n,s,i){const r=wc(),o=this.To(e,t);Os("RestConnection",`Sending RPC '${e}' ${r}:`,o,n);const a={};return this.Eo(a,s,i),this.Ao(e,o,a,n).then((t=>(Os("RestConnection",`Received RPC '${e}' ${r}: `,t),t)),(t=>{throw Ls("RestConnection",`RPC '${e}' ${r} failed with error: `,t,"url: ",o,"request:",n),t}))}vo(e,t,n,s,i,r){return this.Io(e,t,n,s,i)}Eo(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+Ds,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach(((t,n)=>e[n]=t)),n&&n.headers.forEach(((t,n)=>e[n]=t))}To(e,t){const n=Ec[e];return`${this.mo}/v1/${t}:${n}`}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Ao(e,t,n,s){const i=wc();return new Promise(((r,o)=>{const a=new Cs;a.setWithCredentials(!0),a.listenOnce(vs.COMPLETE,(()=>{try{switch(a.getLastErrorCode()){case _s.NO_ERROR:const t=a.getResponseJson();Os(kc,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(t)),r(t);break;case _s.TIMEOUT:Os(kc,`RPC '${e}' ${i} timed out`),o(new js(Vs.DEADLINE_EXCEEDED,"Request time out"));break;case _s.HTTP_ERROR:const n=a.getStatus();if(Os(kc,`RPC '${e}' ${i} failed with status:`,n,"response text:",a.getResponseText()),n>0){let e=a.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=null==e?void 0:e.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(Vs).indexOf(t)>=0?t:Vs.UNKNOWN}(t.status);o(new js(e,t.message))}else o(new js(Vs.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new js(Vs.UNAVAILABLE,"Connection failed."));break;default:xs()}}finally{Os(kc,`RPC '${e}' ${i} completed.`)}}));const c=JSON.stringify(s);Os(kc,`RPC '${e}' ${i} sending request:`,s),a.send(t,"POST",c,n,15)}))}Ro(e,t,n){const s=wc(),i=[this.mo,"/","google.firestore.v1.Firestore","/",e,"/channel"],r=gs(),o=ys(),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},c=this.longPollingOptions.timeoutSeconds;void 0!==c&&(a.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(a.xmlHttpFactory=new bs({})),this.Eo(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const u=i.join("");Os(kc,`Creating RPC '${e}' stream ${s}: ${u}`,a);const l=r.createWebChannel(u,a);let h=!1,d=!1;const p=new bc({ro:t=>{d?Os(kc,`Not sending because RPC '${e}' stream ${s} is closed:`,t):(h||(Os(kc,`Opening RPC '${e}' stream ${s} transport.`),l.open(),h=!0),Os(kc,`RPC '${e}' stream ${s} sending:`,t),l.send(t))},oo:()=>l.close()}),f=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(e){setTimeout((()=>{throw e}),0)}}))};return f(l,ks.EventType.OPEN,(()=>{d||Os(kc,`RPC '${e}' stream ${s} transport opened.`)})),f(l,ks.EventType.CLOSE,(()=>{d||(d=!0,Os(kc,`RPC '${e}' stream ${s} transport closed`),p.wo())})),f(l,ks.EventType.ERROR,(t=>{d||(d=!0,Ls(kc,`RPC '${e}' stream ${s} transport errored:`,t),p.wo(new js(Vs.UNAVAILABLE,"The operation could not be completed")))})),f(l,ks.EventType.MESSAGE,(t=>{var n;if(!d){const i=t.data[0];Fs(!!i);const r=i,o=r.error||(null===(n=r[0])||void 0===n?void 0:n.error);if(o){Os(kc,`RPC '${e}' stream ${s} received error:`,o);const t=o.status;let n=function(e){const t=zo[e];if(void 0!==t)return Go(t)}(t),i=o.message;void 0===n&&(n=Vs.INTERNAL,i="Unknown error status: "+t+" with message "+o.message),d=!0,p.wo(new js(n,i)),l.close()}else Os(kc,`RPC '${e}' stream ${s} received:`,i),p._o(i)}})),f(o,ws.STAT_EVENT,(t=>{t.stat===Es.PROXY?Os(kc,`RPC '${e}' stream ${s} detected buffering proxy`):t.stat===Es.NOPROXY&&Os(kc,`RPC '${e}' stream ${s} detected no buffering proxy`)})),setTimeout((()=>{p.fo()}),0),p}}function Ac(){return"undefined"!=typeof document?document:null}function Sc(e){return new pa(e,!0)}class Tc{constructor(e,t,n=1e3,s=1.5,i=6e4){this.ii=e,this.timerId=t,this.Po=n,this.bo=s,this.Vo=i,this.So=0,this.Do=null,this.Co=Date.now(),this.reset()}reset(){this.So=0}xo(){this.So=this.Vo}No(e){this.cancel();const t=Math.floor(this.So+this.ko()),n=Math.max(0,Date.now()-this.Co),s=Math.max(0,t-n);s>0&&Os("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.So} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Do=this.ii.enqueueAfterDelay(this.timerId,s,(()=>(this.Co=Date.now(),e()))),this.So*=this.bo,this.So<this.Po&&(this.So=this.Po),this.So>this.Vo&&(this.So=this.Vo)}Mo(){null!==this.Do&&(this.Do.skipDelay(),this.Do=null)}cancel(){null!==this.Do&&(this.Do.cancel(),this.Do=null)}ko(){return(Math.random()-.5)*this.So}}class Ic{constructor(e,t,n,s,i,r,o,a){this.ii=e,this.$o=n,this.Oo=s,this.connection=i,this.authCredentialsProvider=r,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.Fo=0,this.Bo=null,this.Lo=null,this.stream=null,this.qo=new Tc(e,t)}Uo(){return 1===this.state||5===this.state||this.Ko()}Ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Go()}async stop(){this.Uo()&&await this.close(0)}Qo(){this.state=0,this.qo.reset()}jo(){this.Ko()&&null===this.Bo&&(this.Bo=this.ii.enqueueAfterDelay(this.$o,6e4,(()=>this.zo())))}Wo(e){this.Ho(),this.stream.send(e)}async zo(){if(this.Ko())return this.close(0)}Ho(){this.Bo&&(this.Bo.cancel(),this.Bo=null)}Jo(){this.Lo&&(this.Lo.cancel(),this.Lo=null)}async close(e,t){this.Ho(),this.Jo(),this.qo.cancel(),this.Fo++,4!==e?this.qo.reset():t&&t.code===Vs.RESOURCE_EXHAUSTED?(Ps(t.toString()),Ps("Using maximum backoff delay to prevent overloading the backend."),this.qo.xo()):t&&t.code===Vs.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Yo(),this.stream.close(),this.stream=null),this.state=e,await this.listener.ao(t)}Yo(){}auth(){this.state=1;const e=this.Xo(this.Fo),t=this.Fo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([e,n])=>{this.Fo===t&&this.Zo(e,n)}),(t=>{e((()=>{const e=new js(Vs.UNKNOWN,"Fetching auth token failed: "+t.message);return this.tu(e)}))}))}Zo(e,t){const n=this.Xo(this.Fo);this.stream=this.eu(e,t),this.stream.uo((()=>{n((()=>(this.state=2,this.Lo=this.ii.enqueueAfterDelay(this.Oo,1e4,(()=>(this.Ko()&&(this.state=3),Promise.resolve()))),this.listener.uo())))})),this.stream.ao((e=>{n((()=>this.tu(e)))})),this.stream.onMessage((e=>{n((()=>this.onMessage(e)))}))}Go(){this.state=5,this.qo.No((async()=>{this.state=0,this.start()}))}tu(e){return Os("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}Xo(e){return t=>{this.ii.enqueueAndForget((()=>this.Fo===e?t():(Os("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Dc extends Ic{constructor(e,t,n,s,i,r){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,s,r),this.serializer=i}eu(e,t){return this.connection.Ro("Listen",e,t)}onMessage(e){this.qo.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const s=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:xs()}(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],r=function(e,t){return e.useProto3Json?(Fs(void 0===t||"string"==typeof t),Li.fromBase64String(t||"")):(Fs(void 0===t||t instanceof Uint8Array),Li.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,a=o&&function(e){const t=void 0===e.code?Vs.UNKNOWN:Go(e.code);return new js(t,e.message||"")}(o);n=new ra(s,i,r,a||null)}else if("documentChange"in t){t.documentChange;const s=t.documentChange;s.document,s.document.name,s.document.updateTime;const i=wa(e,s.document.name),r=ya(s.document.updateTime),o=s.document.createTime?ya(s.document.createTime):ti.min(),a=new or({mapValue:{fields:s.document.fields}}),c=ar.newFoundDocument(i,r,o,a),u=s.targetIds||[],l=s.removedTargetIds||[];n=new sa(u,l,c.key,c)}else if("documentDelete"in t){t.documentDelete;const s=t.documentDelete;s.document;const i=wa(e,s.document),r=s.readTime?ya(s.readTime):ti.min(),o=ar.newNoDocument(i,r),a=s.removedTargetIds||[];n=new sa([],a,o.key,o)}else if("documentRemove"in t){t.documentRemove;const s=t.documentRemove;s.document;const i=wa(e,s.document),r=s.removedTargetIds||[];n=new sa([],r,i,null)}else{if(!("filter"in t))return xs();{t.filter;const e=t.filter;e.targetId;const{count:s=0,unchangedNames:i}=e,r=new $o(s,i),o=e.targetId;n=new ia(o,r)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return ti.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?ti.min():t.readTime?ya(t.readTime):ti.min()}(e);return this.listener.nu(t,n)}su(e){const t={};t.database=ka(this.serializer),t.addTarget=function(e,t){let n;const s=t.target;if(n=Lr(s)?{documents:Aa(e,s)}:{query:Sa(e,s)},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=ga(e,t.resumeToken);const s=fa(e,t.expectedCount);null!==s&&(n.expectedCount=s)}else if(t.snapshotVersion.compareTo(ti.min())>0){n.readTime=ma(e,t.snapshotVersion.toTimestamp());const s=fa(e,t.expectedCount);null!==s&&(n.expectedCount=s)}return n}(this.serializer,e);const n=function(e,t){const n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return xs()}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.Wo(t)}iu(e){const t={};t.database=ka(this.serializer),t.removeTarget=e,this.Wo(t)}}class Nc extends class{}{constructor(e,t,n,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=s,this.lu=!1}fu(){if(this.lu)throw new js(Vs.FAILED_PRECONDITION,"The client has already been terminated.")}Io(e,t,n){return this.fu(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,i])=>this.connection.Io(e,t,n,s,i))).catch((e=>{throw"FirebaseError"===e.name?(e.code===Vs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new js(Vs.UNKNOWN,e.toString())}))}vo(e,t,n,s){return this.fu(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,r])=>this.connection.vo(e,t,n,i,r,s))).catch((e=>{throw"FirebaseError"===e.name?(e.code===Vs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new js(Vs.UNKNOWN,e.toString())}))}terminate(){this.lu=!0}}class Rc{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.wu=0,this._u=null,this.mu=!0}gu(){0===this.wu&&(this.yu("Unknown"),this._u=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this._u=null,this.pu("Backend didn't respond within 10 seconds."),this.yu("Offline"),Promise.resolve()))))}Iu(e){"Online"===this.state?this.yu("Unknown"):(this.wu++,this.wu>=1&&(this.Tu(),this.pu(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.yu("Offline")))}set(e){this.Tu(),this.wu=0,"Online"===e&&(this.mu=!1),this.yu(e)}yu(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}pu(e){const t=`Could not reach Cloud Firestore backend. ${e}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.mu?(Ps(t),this.mu=!1):Os("OnlineStateTracker",t)}Tu(){null!==this._u&&(this._u.cancel(),this._u=null)}}class Oc{constructor(e,t,n,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Eu=[],this.Au=new Map,this.vu=new Set,this.Ru=[],this.Pu=i,this.Pu.Yr((e=>{n.enqueueAndForget((async()=>{Bc(this)&&(Os("RemoteStore","Restarting streams for network reachability change."),await async function(e){const t=Us(e);t.vu.add(4),await Lc(t),t.bu.set("Unknown"),t.vu.delete(4),await Pc(t)}(this))}))})),this.bu=new Rc(n,s)}}async function Pc(e){if(Bc(e))for(const t of e.Ru)await t(!0)}async function Lc(e){for(const t of e.Ru)await t(!1)}function Mc(e,t){const n=Us(e);n.Au.has(t.targetId)||(n.Au.set(t.targetId,t),jc(n)?Vc(n):Qc(n).Ko()&&Fc(n,t))}function xc(e,t){const n=Us(e),s=Qc(n);n.Au.delete(t),s.Ko()&&Uc(n,t),0===n.Au.size&&(s.Ko()?s.jo():Bc(n)&&n.bu.set("Unknown"))}function Fc(e,t){if(e.Vu.qt(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(ti.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}Qc(e).su(t)}function Uc(e,t){e.Vu.qt(t),Qc(e).iu(t)}function Vc(e){e.Vu=new aa({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),le:t=>e.Au.get(t)||null,ue:()=>e.datastore.serializer.databaseId}),Qc(e).start(),e.bu.gu()}function jc(e){return Bc(e)&&!Qc(e).Uo()&&e.Au.size>0}function Bc(e){return 0===Us(e).vu.size}function qc(e){e.Vu=void 0}async function $c(e){e.Au.forEach(((t,n)=>{Fc(e,t)}))}async function zc(e,t){qc(e),jc(e)?(e.bu.Iu(t),Vc(e)):e.bu.set("Unknown")}async function Hc(e,t,n){if(e.bu.set("Online"),t instanceof ra&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const s of t.targetIds)e.Au.has(s)&&(await e.remoteSyncer.rejectListen(s,n),e.Au.delete(s),e.Vu.removeTarget(s))}(e,t)}catch(n){Os("RemoteStore","Failed to remove targets %s: %s ",t.targetIds.join(","),n),await Gc(e,n)}else if(t instanceof sa?e.Vu.Ht(t):t instanceof ia?e.Vu.ne(t):e.Vu.Xt(t),!n.isEqual(ti.min()))try{const t=await uc(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.Vu.ce(t);return n.targetChanges.forEach(((n,s)=>{if(n.resumeToken.approximateByteSize()>0){const i=e.Au.get(s);i&&e.Au.set(s,i.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach(((t,n)=>{const s=e.Au.get(t);if(!s)return;e.Au.set(t,s.withResumeToken(Li.EMPTY_BYTE_STRING,s.snapshotVersion)),Uc(e,t);const i=new xa(s.target,t,n,s.sequenceNumber);Fc(e,i)})),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){Os("RemoteStore","Failed to raise snapshot:",t),await Gc(e,t)}}async function Gc(e,t,n){if(!gi(t))throw t;e.vu.add(1),await Lc(e),e.bu.set("Offline"),n||(n=()=>uc(e.localStore)),e.asyncQueue.enqueueRetryable((async()=>{Os("RemoteStore","Retrying IndexedDB access"),await n(),e.vu.delete(1),await Pc(e)}))}async function Kc(e,t){const n=Us(e);n.asyncQueue.verifyOperationInProgress(),Os("RemoteStore","RemoteStore received new credentials");const s=Bc(n);n.vu.add(3),await Lc(n),s&&n.bu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.vu.delete(3),await Pc(n)}async function Wc(e,t){const n=Us(e);t?(n.vu.delete(2),await Pc(n)):t||(n.vu.add(2),await Lc(n),n.bu.set("Unknown"))}function Qc(e){return e.Su||(e.Su=function(e,t,n){const s=Us(e);return s.fu(),new Dc(t,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,n)}(e.datastore,e.asyncQueue,{uo:$c.bind(null,e),ao:zc.bind(null,e),nu:Hc.bind(null,e)}),e.Ru.push((async t=>{t?(e.Su.Qo(),jc(e)?Vc(e):e.bu.set("Unknown")):(await e.Su.stop(),qc(e))}))),e.Su}class Yc{constructor(e,t,n,s,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=s,this.removalCallback=i,this.deferred=new Bs,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}static createAndSchedule(e,t,n,s,i){const r=Date.now()+n,o=new Yc(e,t,r,s,i);return o.start(n),o}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new js(Vs.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Xc(e,t){if(Ps("AsyncQueue",`${t}: ${e}`),gi(e))return new js(Vs.UNAVAILABLE,`${t}: ${e}`);throw e}class Jc{constructor(e){this.comparator=e?(t,n)=>e(t,n)||oi.comparator(t.key,n.key):(e,t)=>oi.comparator(e.key,t.key),this.keyedMap=so(),this.sortedSet=new Ti(this.comparator)}static emptySet(e){return new Jc(e.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){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 Jc))return!1;if(this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const e=t.getNext().key,s=n.getNext().key;if(!e.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach((t=>{e.push(t.toString())})),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){const n=new Jc;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}class Zc{constructor(){this.Cu=new Ti(oi.comparator)}track(e){const t=e.doc.key,n=this.Cu.get(t);n?0!==e.type&&3===n.type?this.Cu=this.Cu.insert(t,e):3===e.type&&1!==n.type?this.Cu=this.Cu.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.Cu=this.Cu.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.Cu=this.Cu.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.Cu=this.Cu.remove(t):1===e.type&&2===n.type?this.Cu=this.Cu.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.Cu=this.Cu.insert(t,{type:2,doc:e.doc}):xs():this.Cu=this.Cu.insert(t,e)}xu(){const e=[];return this.Cu.inorderTraversal(((t,n)=>{e.push(n)})),e}}class eu{constructor(e,t,n,s,i,r,o,a,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=s,this.mutatedKeys=i,this.fromCache=r,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(e,t,n,s,i){const r=[];return t.forEach((e=>{r.push({type:0,doc:e})})),new eu(e,t,Jc.emptySet(t),r,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)&&Gr(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 e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}}class tu{constructor(){this.Nu=void 0,this.listeners=[]}}class nu{constructor(){this.queries=new Zr((e=>Kr(e)),Gr),this.onlineState="Unknown",this.ku=new Set}}async function su(e,t){const n=Us(e),s=t.query;let i=!1,r=n.queries.get(s);if(r||(i=!0,r=new tu),i)try{r.Nu=await n.onListen(s)}catch(e){const n=Xc(e,`Initialization of query '${Wr(t.query)}' failed`);return void t.onError(n)}n.queries.set(s,r),r.listeners.push(t),t.Mu(n.onlineState),r.Nu&&t.$u(r.Nu)&&au(n)}async function iu(e,t){const n=Us(e),s=t.query;let i=!1;const r=n.queries.get(s);if(r){const e=r.listeners.indexOf(t);e>=0&&(r.listeners.splice(e,1),i=0===r.listeners.length)}if(i)return n.queries.delete(s),n.onUnlisten(s)}function ru(e,t){const n=Us(e);let s=!1;for(const e of t){const t=e.query,i=n.queries.get(t);if(i){for(const t of i.listeners)t.$u(e)&&(s=!0);i.Nu=e}}s&&au(n)}function ou(e,t,n){const s=Us(e),i=s.queries.get(t);if(i)for(const e of i.listeners)e.onError(n);s.queries.delete(t)}function au(e){e.ku.forEach((e=>{e.next()}))}class cu{constructor(e,t,n){this.query=e,this.Ou=t,this.Fu=!1,this.Bu=null,this.onlineState="Unknown",this.options=n||{}}$u(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new eu(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Fu?this.Lu(e)&&(this.Ou.next(e),t=!0):this.qu(e,this.onlineState)&&(this.Uu(e),t=!0),this.Bu=e,t}onError(e){this.Ou.error(e)}Mu(e){this.onlineState=e;let t=!1;return this.Bu&&!this.Fu&&this.qu(this.Bu,e)&&(this.Uu(this.Bu),t=!0),t}qu(e,t){if(!e.fromCache)return!0;const n="Offline"!==t;return(!this.options.Ku||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}Lu(e){if(e.docChanges.length>0)return!0;const t=this.Bu&&this.Bu.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}Uu(e){e=eu.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Fu=!0,this.Ou.next(e)}}class uu{constructor(e){this.key=e}}class lu{constructor(e){this.key=e}}class hu{constructor(e,t){this.query=e,this.Yu=t,this.Xu=null,this.hasCachedResults=!1,this.current=!1,this.Zu=uo(),this.mutatedKeys=uo(),this.tc=Xr(e),this.ec=new Jc(this.tc)}get nc(){return this.Yu}sc(e,t){const n=t?t.ic:new Zc,s=t?t.ec:this.ec;let i=t?t.mutatedKeys:this.mutatedKeys,r=s,o=!1;const a="F"===this.query.limitType&&s.size===this.query.limit?s.last():null,c="L"===this.query.limitType&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal(((e,t)=>{const u=s.get(e),l=Qr(this.query,t)?t:null,h=!!u&&this.mutatedKeys.has(u.key),d=!!l&&(l.hasLocalMutations||this.mutatedKeys.has(l.key)&&l.hasCommittedMutations);let p=!1;u&&l?u.data.isEqual(l.data)?h!==d&&(n.track({type:3,doc:l}),p=!0):this.rc(u,l)||(n.track({type:2,doc:l}),p=!0,(a&&this.tc(l,a)>0||c&&this.tc(l,c)<0)&&(o=!0)):!u&&l?(n.track({type:0,doc:l}),p=!0):u&&!l&&(n.track({type:1,doc:u}),p=!0,(a||c)&&(o=!0)),p&&(l?(r=r.add(l),i=d?i.add(e):i.delete(e)):(r=r.delete(e),i=i.delete(e)))})),null!==this.query.limit)for(;r.size>this.query.limit;){const e="F"===this.query.limitType?r.last():r.first();r=r.delete(e.key),i=i.delete(e.key),n.track({type:1,doc:e})}return{ec:r,ic:n,zi:o,mutatedKeys:i}}rc(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n){const s=this.ec;this.ec=e.ec,this.mutatedKeys=e.mutatedKeys;const i=e.ic.xu();i.sort(((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return xs()}};return n(e)-n(t)}(e.type,t.type)||this.tc(e.doc,t.doc))),this.oc(n);const r=t?this.uc():[],o=0===this.Zu.size&&this.current?1:0,a=o!==this.Xu;return this.Xu=o,0!==i.length||a?{snapshot:new eu(this.query,e.ec,s,i,e.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),cc:r}:{cc:r}}Mu(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({ec:this.ec,ic:new Zc,mutatedKeys:this.mutatedKeys,zi:!1},!1)):{cc:[]}}ac(e){return!this.Yu.has(e)&&!!this.ec.has(e)&&!this.ec.get(e).hasLocalMutations}oc(e){e&&(e.addedDocuments.forEach((e=>this.Yu=this.Yu.add(e))),e.modifiedDocuments.forEach((e=>{})),e.removedDocuments.forEach((e=>this.Yu=this.Yu.delete(e))),this.current=e.current)}uc(){if(!this.current)return[];const e=this.Zu;this.Zu=uo(),this.ec.forEach((e=>{this.ac(e.key)&&(this.Zu=this.Zu.add(e.key))}));const t=[];return e.forEach((e=>{this.Zu.has(e)||t.push(new lu(e))})),this.Zu.forEach((n=>{e.has(n)||t.push(new uu(n))})),t}hc(e){this.Yu=e.ir,this.Zu=uo();const t=this.sc(e.documents);return this.applyChanges(t,!0)}lc(){return eu.fromInitialDocuments(this.query,this.ec,this.mutatedKeys,0===this.Xu,this.hasCachedResults)}}class du{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class pu{constructor(e){this.key=e,this.fc=!1}}class fu{constructor(e,t,n,s,i,r){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=r,this.dc={},this.wc=new Zr((e=>Kr(e)),Gr),this._c=new Map,this.mc=new Set,this.gc=new Ti(oi.comparator),this.yc=new Map,this.Ic=new Qa,this.Tc={},this.Ec=new Map,this.Ac=$a.Mn(),this.onlineState="Unknown",this.vc=void 0}get isPrimaryClient(){return!0===this.vc}}async function mu(e,t){const n=Du(e);let s,i;const r=n.wc.get(t);if(r)s=r.targetId,n.sharedClientState.addLocalQueryTarget(s),i=r.view.lc();else{const e=await hc(n.localStore,$r(t)),r=n.sharedClientState.addLocalQueryTarget(e.targetId);s=e.targetId,i=await gu(n,t,s,"current"===r,e.resumeToken),n.isPrimaryClient&&Mc(n.remoteStore,e)}return i}async function gu(e,t,n,s,i){e.Rc=(t,n,s)=>async function(e,t,n,s){let i=t.view.sc(n);i.zi&&(i=await pc(e.localStore,t.query,!1).then((({documents:e})=>t.view.sc(e,i))));const r=s&&s.targetChanges.get(t.targetId),o=t.view.applyChanges(i,e.isPrimaryClient,r);return ku(e,t.targetId,o.cc),o.snapshot}(e,t,n,s);const r=await pc(e.localStore,t,!0),o=new hu(t,r.ir),a=o.sc(r.documents),c=na.createSynthesizedTargetChangeForCurrentChange(n,s&&"Offline"!==e.onlineState,i),u=o.applyChanges(a,e.isPrimaryClient,c);ku(e,n,u.cc);const l=new du(t,n,o);return e.wc.set(t,l),e._c.has(n)?e._c.get(n).push(t):e._c.set(n,[t]),u.snapshot}async function yu(e,t){const n=Us(e),s=n.wc.get(t),i=n._c.get(s.targetId);if(i.length>1)return n._c.set(s.targetId,i.filter((e=>!Gr(e,t)))),void n.wc.delete(t);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(s.targetId),n.sharedClientState.isActiveQueryTarget(s.targetId)||await dc(n.localStore,s.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(s.targetId),xc(n.remoteStore,s.targetId),Eu(n,s.targetId)})).catch(fi)):(Eu(n,s.targetId),await dc(n.localStore,s.targetId,!0))}async function _u(e,t){const n=Us(e);try{const e=await function(e,t){const n=Us(e),s=t.snapshotVersion;let i=n.Ji;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(e=>{const r=n.Zi.newChangeBuffer({trackRemovals:!0});i=n.Ji;const o=[];t.targetChanges.forEach(((r,a)=>{const c=i.get(a);if(!c)return;o.push(n.Bs.removeMatchingKeys(e,r.removedDocuments,a).next((()=>n.Bs.addMatchingKeys(e,r.addedDocuments,a))));let u=c.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?u=u.withResumeToken(Li.EMPTY_BYTE_STRING,ti.min()).withLastLimboFreeSnapshotVersion(ti.min()):r.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(r.resumeToken,s)),i=i.insert(a,u),function(e,t,n){return 0===e.resumeToken.approximateByteSize()||t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(c,u,r)&&o.push(n.Bs.updateTargetData(e,u))}));let a=to(),c=uo();if(t.documentUpdates.forEach((s=>{t.resolvedLimboDocuments.has(s)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,s))})),o.push(lc(e,r,t.documentUpdates).next((e=>{a=e.nr,c=e.sr}))),!s.isEqual(ti.min())){const t=n.Bs.getLastRemoteSnapshotVersion(e).next((t=>n.Bs.setTargetsMetadata(e,e.currentSequenceNumber,s)));o.push(t)}return mi.waitFor(o).next((()=>r.apply(e))).next((()=>n.localDocuments.getLocalViewOfDocuments(e,a,c))).next((()=>a))})).then((e=>(n.Ji=i,e)))}(n.localStore,t);t.targetChanges.forEach(((e,t)=>{const s=n.yc.get(t);s&&(Fs(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1),e.addedDocuments.size>0?s.fc=!0:e.modifiedDocuments.size>0?Fs(s.fc):e.removedDocuments.size>0&&(Fs(s.fc),s.fc=!1))})),await Su(n,e,t)}catch(e){await fi(e)}}function vu(e,t,n){const s=Us(e);if(s.isPrimaryClient&&0===n||!s.isPrimaryClient&&1===n){const e=[];s.wc.forEach(((n,s)=>{const i=s.view.Mu(t);i.snapshot&&e.push(i.snapshot)})),function(e,t){const n=Us(e);n.onlineState=t;let s=!1;n.queries.forEach(((e,n)=>{for(const e of n.listeners)e.Mu(t)&&(s=!0)})),s&&au(n)}(s.eventManager,t),e.length&&s.dc.nu(e),s.onlineState=t,s.isPrimaryClient&&s.sharedClientState.setOnlineState(t)}}async function wu(e,t,n){const s=Us(e);s.sharedClientState.updateQueryState(t,"rejected",n);const i=s.yc.get(t),r=i&&i.key;if(r){let e=new Ti(oi.comparator);e=e.insert(r,ar.newNoDocument(r,ti.min()));const n=uo().add(r),i=new ta(ti.min(),new Map,new Ti(Js),e,n);await _u(s,i),s.gc=s.gc.remove(r),s.yc.delete(t),Au(s)}else await dc(s.localStore,t,!1).then((()=>Eu(s,t,n))).catch(fi)}function Eu(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(const s of e._c.get(t))e.wc.delete(s),n&&e.dc.Pc(s,n);e._c.delete(t),e.isPrimaryClient&&e.Ic.Is(t).forEach((t=>{e.Ic.containsKey(t)||bu(e,t)}))}function bu(e,t){e.mc.delete(t.path.canonicalString());const n=e.gc.get(t);null!==n&&(xc(e.remoteStore,n),e.gc=e.gc.remove(t),e.yc.delete(n),Au(e))}function ku(e,t,n){for(const s of n)s instanceof uu?(e.Ic.addReference(s.key,t),Cu(e,s)):s instanceof lu?(Os("SyncEngine","Document no longer in limbo: "+s.key),e.Ic.removeReference(s.key,t),e.Ic.containsKey(s.key)||bu(e,s.key)):xs()}function Cu(e,t){const n=t.key,s=n.path.canonicalString();e.gc.get(n)||e.mc.has(s)||(Os("SyncEngine","New document in limbo: "+n),e.mc.add(s),Au(e))}function Au(e){for(;e.mc.size>0&&e.gc.size<e.maxConcurrentLimboResolutions;){const t=e.mc.values().next().value;e.mc.delete(t);const n=new oi(si.fromString(t)),s=e.Ac.next();e.yc.set(s,new pu(n)),e.gc=e.gc.insert(n,s),Mc(e.remoteStore,new xa($r(Fr(n.path)),s,"TargetPurposeLimboResolution",yi.ct))}}async function Su(e,t,n){const s=Us(e),i=[],r=[],o=[];s.wc.isEmpty()||(s.wc.forEach(((e,a)=>{o.push(s.Rc(a,t,n).then((e=>{if((e||n)&&s.isPrimaryClient&&s.sharedClientState.updateQueryState(a.targetId,(null==e?void 0:e.fromCache)?"not-current":"current"),e){i.push(e);const t=ic.Li(a.targetId,e);r.push(t)}})))})),await Promise.all(o),s.dc.nu(i),await async function(e,t){const n=Us(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(e=>mi.forEach(t,(t=>mi.forEach(t.Fi,(s=>n.persistence.referenceDelegate.addReference(e,t.targetId,s))).next((()=>mi.forEach(t.Bi,(s=>n.persistence.referenceDelegate.removeReference(e,t.targetId,s)))))))))}catch(e){if(!gi(e))throw e;Os("LocalStore","Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.Ji.get(t),s=e.snapshotVersion,i=e.withLastLimboFreeSnapshotVersion(s);n.Ji=n.Ji.insert(t,i)}}}(s.localStore,r))}async function Tu(e,t){const n=Us(e);if(!n.currentUser.isEqual(t)){Os("SyncEngine","User change. New user:",t.toKey());const e=await cc(n.localStore,t);n.currentUser=t,function(e,t){e.Ec.forEach((e=>{e.forEach((e=>{e.reject(new js(Vs.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),e.Ec.clear()}(n),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Su(n,e.er)}}function Iu(e,t){const n=Us(e),s=n.yc.get(t);if(s&&s.fc)return uo().add(s.key);{let e=uo();const s=n._c.get(t);if(!s)return e;for(const t of s){const s=n.wc.get(t);e=e.unionWith(s.view.nc)}return e}}function Du(e){const t=Us(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=_u.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Iu.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=wu.bind(null,t),t.dc.nu=ru.bind(null,t.eventManager),t.dc.Pc=ou.bind(null,t.eventManager),t}class Nu{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=Sc(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){return ac(this.persistence,new rc,e.initialUser,this.serializer)}createPersistence(e){return new tc(sc.zs,this.serializer)}createSharedClientState(e){return new gc}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Ru{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>vu(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Tu.bind(null,this.syncEngine),await Wc(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new nu}createDatastore(e){const t=Sc(e.databaseInfo.databaseId),n=(s=e.databaseInfo,new Cc(s));var s;return function(e,t,n,s){return new Nc(e,t,n,s)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return t=this.localStore,n=this.datastore,s=e.asyncQueue,i=e=>vu(this.syncEngine,e,0),r=_c.D()?new _c:new yc,new Oc(t,n,s,i,r);var t,n,s,i,r}createSyncEngine(e,t){return function(e,t,n,s,i,r,o){const a=new fu(e,t,n,s,i,r);return o&&(a.vc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}terminate(){return async function(e){const t=Us(e);Os("RemoteStore","RemoteStore shutting down."),t.vu.add(5),await Lc(t),t.Pu.shutdown(),t.bu.set("Unknown")}(this.remoteStore)}}class Ou{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Sc(this.observer.next,e)}error(e){this.observer.error?this.Sc(this.observer.error,e):Ps("Uncaught Error in snapshot listener:",e.toString())}Dc(){this.muted=!0}Sc(e,t){this.muted||setTimeout((()=>{this.muted||e(t)}),0)}}class Pu{constructor(e,t,n,s){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=s,this.user=Is.UNAUTHENTICATED,this.clientId=Xs.A(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async e=>{Os("FirestoreClient","Received user=",e.uid),await this.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(Os("FirestoreClient","Received new app check token=",e),this.appCheckCredentialListener(e,this.user))))}async getConfiguration(){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}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new js(Vs.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Bs;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=Xc(t,"Failed to shutdown persistence");e.reject(n)}})),e.promise}}async function Lu(e,t){e.asyncQueue.verifyOperationInProgress(),Os("FirestoreClient","Initializing OfflineComponentProvider");const n=await e.getConfiguration();await t.initialize(n);let s=n.initialUser;e.setCredentialChangeListener((async e=>{s.isEqual(e)||(await cc(t.localStore,e),s=e)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e._offlineComponents=t}async function Mu(e,t){e.asyncQueue.verifyOperationInProgress();const n=await Fu(e);Os("FirestoreClient","Initializing OnlineComponentProvider");const s=await e.getConfiguration();await t.initialize(n,s),e.setCredentialChangeListener((e=>Kc(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>Kc(t.remoteStore,n))),e._onlineComponents=t}function xu(e){return"FirebaseError"===e.name?e.code===Vs.FAILED_PRECONDITION||e.code===Vs.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}async function Fu(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){Os("FirestoreClient","Using user provided OfflineComponentProvider");try{await Lu(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!xu(n))throw n;Ls("Error using user provided cache. Falling back to memory cache: "+n),await Lu(e,new Nu)}}else Os("FirestoreClient","Using default OfflineComponentProvider"),await Lu(e,new Nu);return e._offlineComponents}async function Uu(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(Os("FirestoreClient","Using user provided OnlineComponentProvider"),await Mu(e,e._uninitializedComponentsProvider._online)):(Os("FirestoreClient","Using default OnlineComponentProvider"),await Mu(e,new Ru))),e._onlineComponents}async function Vu(e){const t=await Uu(e),n=t.eventManager;return n.onListen=mu.bind(null,t.syncEngine),n.onUnlisten=yu.bind(null,t.syncEngine),n}function ju(e,t,n={}){const s=new Bs;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,s,i){const r=new Ou({next:r=>{t.enqueueAndForget((()=>iu(e,o)));const a=r.docs.has(n);!a&&r.fromCache?i.reject(new js(Vs.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&r.fromCache&&s&&"server"===s.source?i.reject(new js(Vs.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.)')):i.resolve(r)},error:e=>i.reject(e)}),o=new cu(Fr(n.path),r,{includeMetadataChanges:!0,Ku:!0});return su(e,o)}(await Vu(e),e.asyncQueue,t,n,s))),s.promise}function Bu(e,t,n={}){const s=new Bs;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,s,i){const r=new Ou({next:n=>{t.enqueueAndForget((()=>iu(e,o))),n.fromCache&&"server"===s.source?i.reject(new js(Vs.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.)')):i.resolve(n)},error:e=>i.reject(e)}),o=new cu(n,r,{includeMetadataChanges:!0,Ku:!0});return su(e,o)}(await Vu(e),e.asyncQueue,t,n,s))),s.promise}function qu(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}const $u=new Map;function zu(e,t,n){if(!n)throw new js(Vs.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function Hu(e){if(!oi.isDocumentKey(e))throw new js(Vs.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function Gu(e){if(oi.isDocumentKey(e))throw new js(Vs.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function Ku(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:"an object"}}return"function"==typeof e?"a function":xs()}function Wu(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new js(Vs.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Ku(e);throw new js(Vs.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}class Qu{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new js(Vs.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=null===(t=e.ssl)||void 0===t||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.cache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new js(Vs.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,s){if(!0===t&&!0===s)throw new js(Vs.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=qu(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new js(Vs.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new js(Vs.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new js(Vs.INVALID_ARGUMENT,`invalid long polling timeout: ${e.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&&(t=this.experimentalLongPollingOptions,n=e.experimentalLongPollingOptions,t.timeoutSeconds===n.timeoutSeconds)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams;var t,n}}class Yu{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 Qu({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new js(Vs.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 void 0!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new js(Vs.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 Qu(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new $s;switch(e.type){case"firstParty":return new Ks(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new js(Vs.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=$u.get(e);t&&(Os("ComponentProvider","Removing Datastore"),$u.delete(e),t.terminate())}(this),Promise.resolve()}}class Xu{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 Zu(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Xu(this.firestore,e,this._key)}}class Ju{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new Ju(this.firestore,e,this._query)}}class Zu extends Ju{constructor(e,t,n){super(e,t,Fr(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 Xu(this.firestore,null,new oi(e))}withConverter(e){return new Zu(this.firestore,e,this._path)}}function el(e,t,...n){if(e=(0,a.m9)(e),zu("collection","path",t),e instanceof Yu){const s=si.fromString(t,...n);return Gu(s),new Zu(e,null,s)}{if(!(e instanceof Xu||e instanceof Zu))throw new js(Vs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=e._path.child(si.fromString(t,...n));return Gu(s),new Zu(e.firestore,null,s)}}function tl(e,t,...n){if(e=(0,a.m9)(e),1===arguments.length&&(t=Xs.A()),zu("doc","path",t),e instanceof Yu){const s=si.fromString(t,...n);return Hu(s),new Xu(e,null,new oi(s))}{if(!(e instanceof Xu||e instanceof Zu))throw new js(Vs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=e._path.child(si.fromString(t,...n));return Hu(s),new Xu(e.firestore,e instanceof Zu?e.converter:null,new oi(s))}}class nl{constructor(){this.Gc=Promise.resolve(),this.Qc=[],this.jc=!1,this.zc=[],this.Wc=null,this.Hc=!1,this.Jc=!1,this.Yc=[],this.qo=new Tc(this,"async_queue_retry"),this.Xc=()=>{const e=Ac();e&&Os("AsyncQueue","Visibility state changed to "+e.visibilityState),this.qo.Mo()};const e=Ac();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.Xc)}get isShuttingDown(){return this.jc}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Zc(),this.ta(e)}enterRestrictedMode(e){if(!this.jc){this.jc=!0,this.Jc=e||!1;const t=Ac();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.Xc)}}enqueue(e){if(this.Zc(),this.jc)return new Promise((()=>{}));const t=new Bs;return this.ta((()=>this.jc&&this.Jc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Qc.push(e),this.ea())))}async ea(){if(0!==this.Qc.length){try{await this.Qc[0](),this.Qc.shift(),this.qo.reset()}catch(e){if(!gi(e))throw e;Os("AsyncQueue","Operation failed with retryable error: "+e)}this.Qc.length>0&&this.qo.No((()=>this.ea()))}}ta(e){const t=this.Gc.then((()=>(this.Hc=!0,e().catch((e=>{this.Wc=e,this.Hc=!1;const t=function(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}(e);throw Ps("INTERNAL UNHANDLED ERROR: ",t),e})).then((e=>(this.Hc=!1,e))))));return this.Gc=t,t}enqueueAfterDelay(e,t,n){this.Zc(),this.Yc.indexOf(e)>-1&&(t=0);const s=Yc.createAndSchedule(this,e,t,n,(e=>this.na(e)));return this.zc.push(s),s}Zc(){this.Wc&&xs()}verifyOperationInProgress(){}async sa(){let e;do{e=this.Gc,await e}while(e!==this.Gc)}ia(e){for(const t of this.zc)if(t.timerId===e)return!0;return!1}ra(e){return this.sa().then((()=>{this.zc.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(const t of this.zc)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.sa()}))}oa(e){this.Yc.push(e)}na(e){const t=this.zc.indexOf(e);this.zc.splice(t,1)}}class sl extends Yu{constructor(e,t,n,s){super(e,t,n,s),this.type="firestore",this._queue=new nl,this._persistenceKey=(null==s?void 0:s.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||ol(this),this._firestoreClient.terminate()}}function il(e,t){const n="object"==typeof e?e:(0,i.Mq)(),s="string"==typeof e?e:t||"(default)",r=(0,i.qX)(n,"firestore").getImmediate({identifier:s});if(!r._initialized){const e=(0,a.P0)("firestore");e&&function(e,t,n,s={}){var i;const r=(e=Wu(e,Yu))._getSettings();if("firestore.googleapis.com"!==r.host&&r.host!==t&&Ls("Host has been set in both settings() and useEmulator(), emulator host will be used"),e._setSettings(Object.assign(Object.assign({},r),{host:`${t}:${n}`,ssl:!1})),s.mockUserToken){let t,n;if("string"==typeof s.mockUserToken)t=s.mockUserToken,n=Is.MOCK_USER;else{t=(0,a.Sg)(s.mockUserToken,null===(i=e._app)||void 0===i?void 0:i.options.projectId);const r=s.mockUserToken.sub||s.mockUserToken.user_id;if(!r)throw new js(Vs.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Is(r)}e._authCredentials=new zs(new qs(t,n))}}(r,...e)}return r}function rl(e){return e._firestoreClient||ol(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function ol(e){var t,n,s;const i=e._freezeSettings(),r=function(e,t,n,s){return new qi(e,t,n,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,qu(s.experimentalLongPollingOptions),s.useFetchStreams)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,i);e._firestoreClient=new Pu(e._authCredentials,e._appCheckCredentials,e._queue,r),(null===(n=i.cache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(s=i.cache)||void 0===s?void 0:s._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.cache.kind,_offline:i.cache._offlineComponentProvider,_online:i.cache._onlineComponentProvider})}class al{constructor(e){this._byteString=e}static fromBase64String(e){try{return new al(Li.fromBase64String(e))}catch(e){throw new js(Vs.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new al(Li.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}class cl{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new js(Vs.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new ri(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}class ul{constructor(e){this._methodName=e}}class ll{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new js(Vs.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new js(Vs.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return Js(this._lat,e._lat)||Js(this._long,e._long)}}const hl=/^__.*__$/;function dl(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw xs()}}class pl{constructor(e,t,n,s,i,r){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=s,void 0===i&&this.ua(),this.fieldTransforms=i||[],this.fieldMask=r||[]}get path(){return this.settings.path}get ca(){return this.settings.ca}aa(e){return new pl(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ha(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),s=this.aa({path:n,la:!1});return s.fa(e),s}da(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),s=this.aa({path:n,la:!1});return s.ua(),s}wa(e){return this.aa({path:void 0,la:!0})}_a(e){return kl(e,this.settings.methodName,this.settings.ma||!1,this.path,this.settings.ga)}contains(e){return void 0!==this.fieldMask.find((t=>e.isPrefixOf(t)))||void 0!==this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))}ua(){if(this.path)for(let e=0;e<this.path.length;e++)this.fa(this.path.get(e))}fa(e){if(0===e.length)throw this._a("Document fields must not be empty");if(dl(this.ca)&&hl.test(e))throw this._a('Document fields cannot begin and end with "__"')}}class fl{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||Sc(e)}ya(e,t,n,s=!1){return new pl({ca:e,methodName:t,ga:n,path:ri.emptyPath(),la:!1,ma:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function ml(e){const t=e._freezeSettings(),n=Sc(e._databaseId);return new fl(e._databaseId,!!t.ignoreUndefinedProperties,n)}function gl(e,t,n,s=!1){return yl(n,e.ya(s?4:3,t))}function yl(e,t){if(vl(e=(0,a.m9)(e)))return wl("Unsupported field value:",t,e),_l(e,t);if(e instanceof ul)return function(e,t){if(!dl(t.ca))throw t._a(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t._a(`${e._methodName}() is not currently supported inside arrays`);const n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.la&&4!==t.ca)throw t._a("Nested arrays are not supported");return function(e,t){const n=[];let s=0;for(const i of e){let e=yl(i,t.wa(s));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),s++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=(0,a.m9)(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return mo(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=ei.fromDate(e);return{timestampValue:ma(t.serializer,n)}}if(e instanceof ei){const n=new ei(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:ma(t.serializer,n)}}if(e instanceof ll)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof al)return{bytesValue:ga(t.serializer,e._byteString)};if(e instanceof Xu){const n=t.databaseId,s=e.firestore._databaseId;if(!s.isEqual(n))throw t._a(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:_a(e.firestore._databaseId||t.databaseId,e._key.path)}}throw t._a(`Unsupported field value: ${Ku(e)}`)}(e,t)}function _l(e,t){const n={};return Si(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):Ai(e,((e,s)=>{const i=yl(s,t.ha(e));null!=i&&(n[e]=i)})),{mapValue:{fields:n}}}function vl(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof ei||e instanceof ll||e instanceof al||e instanceof Xu||e instanceof ul)}function wl(e,t,n){if(!vl(n)||!function(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}(n)){const s=Ku(n);throw"an object"===s?t._a(e+" a custom object"):t._a(e+" "+s)}}const El=new RegExp("[~\\*/\\[\\]]");function bl(e,t,n){if(t.search(El)>=0)throw kl(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new cl(...t.split("."))._internalPath}catch(s){throw kl(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function kl(e,t,n,s,i){const r=s&&!s.isEmpty(),o=void 0!==i;let a=`Function ${t}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(r||o)&&(c+=" (found",r&&(c+=` in field ${s}`),o&&(c+=` in document ${i}`),c+=")"),new js(Vs.INVALID_ARGUMENT,a+e+c)}class Cl{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 Xu(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new Al(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const t=this._document.data.field(Sl("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class Al extends Cl{data(){return super.data()}}function Sl(e,t){return"string"==typeof t?bl(e,t):t instanceof cl?t._internalPath:t._delegate._internalPath}function Tl(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new js(Vs.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Il{}class Dl extends Il{}function Nl(e,t,...n){let s=[];t instanceof Il&&s.push(t),s=s.concat(n),function(e){const t=e.filter((e=>e instanceof Ol)).length,n=e.filter((e=>e instanceof Rl)).length;if(t>1||t>0&&n>0)throw new js(Vs.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(...)))`.")}(s);for(const t of s)e=t._apply(e);return e}class Rl extends Dl{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new Rl(e,t,n)}_apply(e){const t=this._parse(e);return Fl(e._query,t),new Ju(e.firestore,e.converter,zr(e._query,t))}_parse(e){const t=ml(e.firestore),n=function(e,t,n,s,i,r,o){let a;if(i.isKeyField()){if("array-contains"===r||"array-contains-any"===r)throw new js(Vs.INVALID_ARGUMENT,`Invalid Query. You can't perform '${r}' queries on documentId().`);if("in"===r||"not-in"===r){xl(o,r);const t=[];for(const n of o)t.push(Ml(s,e,n));a={arrayValue:{values:t}}}else a=Ml(s,e,o)}else"in"!==r&&"not-in"!==r&&"array-contains-any"!==r||xl(o,r),a=gl(n,"where",o,"in"===r||"not-in"===r);return fr.create(i,r,a)}(e._query,0,t,e.firestore._databaseId,this._field,this._op,this._value);return n}}class Ol extends Il{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Ol(e,t)}_parse(e){const t=this._queryConstraints.map((t=>t._parse(e))).filter((e=>e.getFilters().length>0));return 1===t.length?t[0]:mr.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const s=t.getFlattenedFilters();for(const e of s)Fl(n,e),n=zr(n,e)}(e._query,t),new Ju(e.firestore,e.converter,zr(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}class Pl extends Dl{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new Pl(e,t)}_apply(e){const t=function(e,t,n){if(null!==e.startAt)throw new js(Vs.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==e.endAt)throw new js(Vs.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");const s=new hr(t,n);return function(e,t){if(null===Vr(e)){const n=jr(e);null!==n&&Ul(e,n,t.field)}}(e,s),s}(e._query,this._field,this._direction);return new Ju(e.firestore,e.converter,function(e,t){const n=e.explicitOrderBy.concat([t]);return new Mr(e.path,e.collectionGroup,n,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(e._query,t))}}function Ll(e,t="asc"){const n=t,s=Sl("orderBy",e);return Pl._create(s,n)}function Ml(e,t,n){if("string"==typeof(n=(0,a.m9)(n))){if(""===n)throw new js(Vs.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Br(t)&&-1!==n.indexOf("/"))throw new js(Vs.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const s=t.path.child(si.fromString(n));if(!oi.isDocumentKey(s))throw new js(Vs.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);return Ji(e,new oi(s))}if(n instanceof Xu)return Ji(e,n._key);throw new js(Vs.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ku(n)}.`)}function xl(e,t){if(!Array.isArray(e)||0===e.length)throw new js(Vs.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function Fl(e,t){if(t.isInequality()){const n=jr(e),s=t.field;if(null!==n&&!n.isEqual(s))throw new js(Vs.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${s.toString()}'`);const i=Vr(e);null!==i&&Ul(e,s,i)}const n=function(e,t){for(const n of e)for(const e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new js(Vs.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new js(Vs.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}function Ul(e,t,n){if(!n.isEqual(t))throw new js(Vs.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${t.toString()}' and so you must also use '${t.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}class Vl{convertValue(e,t="none"){switch(Hi(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Fi(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(Ui(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 10:return this.convertObject(e.mapValue,t);default:throw xs()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const n={};return Ai(e,((e,s)=>{n[e]=this.convertValue(s,t)})),n}convertGeoPoint(e){return new ll(Fi(e.latitude),Fi(e.longitude))}convertArray(e,t){return(e.values||[]).map((e=>this.convertValue(e,t)))}convertServerTimestamp(e,t){switch(t){case"previous":const n=ji(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Bi(e));default:return null}}convertTimestamp(e){const t=xi(e);return new ei(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=si.fromString(e);Fs(Ma(n));const s=new $i(n.get(1),n.get(3)),i=new oi(n.popFirst(5));return s.isEqual(t)||Ps(`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 jl{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Bl extends Cl{constructor(e,t,n,s,i,r){super(e,t,n,s,r),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new ql(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(Sl("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}}class ql extends Bl{data(e={}){return super.data(e)}}class $l{constructor(e,t,n,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new jl(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 0===this.size}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new ql(this._firestore,this._userDataWriter,n.key,n,new jl(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 js(Vs.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map((n=>{const s=new ql(e._firestore,e._userDataWriter,n.doc.key,n.doc,new jl(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:s,oldIndex:-1,newIndex:t++}}))}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((e=>t||3!==e.type)).map((t=>{const s=new ql(e._firestore,e._userDataWriter,t.doc.key,t.doc,new jl(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let i=-1,r=-1;return 0!==t.type&&(i=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),r=n.indexOf(t.doc.key)),{type:zl(t.type),doc:s,oldIndex:i,newIndex:r}}))}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function zl(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return xs()}}function Hl(e){e=Wu(e,Xu);const t=Wu(e.firestore,sl);return ju(rl(t),e._key).then((n=>Wl(t,e,n)))}class Gl extends Vl{constructor(e){super(),this.firestore=e}convertBytes(e){return new al(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Xu(this.firestore,null,t)}}function Kl(e){e=Wu(e,Ju);const t=Wu(e.firestore,sl),n=rl(t),s=new Gl(t);return Tl(e._query),Bu(n,e._query).then((n=>new $l(t,s,e,n)))}function Wl(e,t,n){const s=n.docs.get(t._key),i=new Gl(e);return new Bl(e,i,t._key,s,new jl(n.hasPendingWrites,n.fromCache),t.converter)}!function(e,t=!0){!function(e){Ds=e}(i.Jn),(0,i.Xd)(new r.wA("firestore",((e,{instanceIdentifier:n,options:s})=>{const i=e.getProvider("app").getImmediate(),r=new sl(new Hs(e.getProvider("auth-internal")),new Qs(e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new js(Vs.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new $i(e.options.projectId,t)}(i,n),i);return s=Object.assign({useFetchStreams:t},s),r._setSettings(s),r}),"PUBLIC").setMultipleInstances(!0)),(0,i.KN)(Ts,"3.12.1",e),(0,i.KN)(Ts,"3.12.1","esm2017")}()}}]);
2
2
  //# sourceMappingURL=814.index.js.map