diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..5d570f2 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,53 @@ +name: build and deploy react app for gsoc doc + +on: + push: + branches: [ "gsoc" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + working-directory: ./gsoc-doc + run: npm install + + - name: Create env file + working-directory: ./gsoc-doc + run: | + touch .env + echo REACT_APP_GEO_LOC_KEY="${{ secrets.REACT_APP_GEO_LOC_KEY }}" >> .env + echo REACT_APP_SHEET_SCRIPT_URL="${{ secrets.REACT_APP_SHEET_SCRIPT_URL }}" >> .env + + - name: Build + working-directory: ./gsoc-doc + run: npm run build + + - name: Deploy + working-directory: ./gsoc-doc + run: | + git config --global user.name $user_name + git config --global user.email $user_email + git remote set-url origin https://${github_token}@github.com/${repository} + npm run deploy + env: + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' + github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }} + repository: ${{ github.repository }} + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a88fb2d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +gsoc-doc/.env diff --git a/README.md b/README.md index e96ec03..0310b98 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# Contains webpages of the repo +# GSoC 2022 INCF The Virtual Brain, TVB Data Importer Blog diff --git a/blog.md b/blog.md new file mode 100644 index 0000000..f255687 --- /dev/null +++ b/blog.md @@ -0,0 +1,69 @@ +Date: 8th Sep 2022 + +Contributor: @Akash Upadhyay + +Mentors: @Paula Popa & @Lia Domide + + +Project Description +The Virtual Brain (TVB) is a brain stimulation platform. It offers tools for computing, simulating and analyzing functional and structural data of human brains. TVB provides a graphical user interface (GUI) for using its tools for studying human brains. The platform supports importing data into TVB like projects, data structures etc. Since TVB provides various tools for studying human brains the platform is also accessible through REST APIs. Goal of this project is to create a new package which will consume TVB REST services and perform operations on it. The new python client will have features like uploading data into a TVB, data encryption and validation, build BIDS datasets, monitor directories etc. Users will be able to use this python client to interact with a remote TVB server without using an active GUI. + +Milestone 1 - Update BIDS Importer +In this phase we started working on updating the BIDS Importer. BIDS importer is used to import bids datasets into TVB projects. Goal was to modify the bids importer so that it will also support bids datasets with only single datatype (ts, net, coords, spatial). We're able to achieve this and we also tested the updated bids importer with BIDS datasets containing only time series or connectivity datatypes. + +To use this custom bids importer, you can refer to the sample code which is also added here: View File/Commit + +Milestone 2 - Creating BIDS data builder +In the second phase the goal was to build a module which can create datasets from a BIDS directory. The need was to design a builder which will create datasets with only required files and no other files. This will also reduce the size of the datasets. + +Few challenges we faced + +How do we find all the dependencies from json files? There are cases when a json file contains a path to another json file and so on. +So we came up with an approach similar to BFS traversal, since the connection(of dependencies paths) among json files was forming a graph-like structure. View get_connected_dependencies_paths +Finding a way to write files into a zip file with all the directories/sub-directories being preserved. +To resolve this we used ZipFile which is already in use in TVB importers. View create_archive +Final Outcome: A class named BIDSDataBuilder which takes BIDS root directory and datatype of which dataset is to be built. BIDSDataBuilder can also build a dataset from a set of initial json files. And the result is a zip file containing the built dataset. + +View BIDSDataBuilder + +Milestone 3 - Creating BIDS Directory monitor +After building BIDSDataBuilder our next goal was to write a separate module for observing or monitoring a BIDS directory for new files and whenever new files are added then consume BIDSDataBuilder to build a dataset for those files and import them into the TVB project. + +So we splitted this this module into two parts + +Watcher - Responsible for monitoring the directories and triggering uploader on new files +Uploader - Responsible for building the dataset for new files and importing the dataset into TVB project +Challenges: + +Which library to be used for monitoring directory +We used watchdog npm library for monitoring directories and we configured it to detect json files changes only. +Running background processes +We needed the watcher to run in the background and not block other processes and similarly we needed the uploader to also run in the background. To resolve this we created two parallel threads namely watcher_thread and uploader_thread. +Final Outcome: BIDSDirWatcher class which takes BIDS directory as argument and monitors that directory for new files. It also takes additional arguments such as tvb project id in which data will be imported. + +Milestone 4 - Testing +Now that we have BIDSDirWatcher and BIDSDataBuilder as a next step we need to test the module properly. During this phase we also added unit tests for bids data builder and dir watcher. + +TestBIDSDataBuilder +TestBIDSDirWatcher +Challenges + +While testing BIDSDirWatcher we found a bug in the BIDSImporter and because of this the import was not successful. The BIDSImporter was not able to extract the subject folders from the file paths present in a bids zip file. To resolve this we splitted the path in different manner and checked again if it's a subject directory. +Final Outcome: By this part we have our BIDSDirWatcher and BIDSDataBuilder ready and tested. Also added a sample file launch_bids_monitor.py for demonstrating how to consume the module. This file can also be used to run BIDSDirWatcher on a directory by passing it as command line arguments. + +Milestone 5 - Packaging the code +This is the last stage of the project which includes packaging the whole code with all dependencies so that it can be installed easily. + +So added following things + +setup_bids_monitor.py +MANIFEST +README Readme +PRs and code repositories +Pull Request: (GSoC 2022, 8.2) TVB BIDS data builder and dir monitor module #589 +TVB main repo: the-virtual-brain/tvb-root +Forked repo: Spectre-ak/tvb-root, tvb-bids-monitoring-gsoc +Code documentation: README.md +Project page: Separate tool to upload data into TVB +GSoC INCF page: INCF +GSoC home page: summerofcode.withgoogle.com diff --git a/build/asset-manifest.json b/build/asset-manifest.json deleted file mode 100644 index 4cb0eef..0000000 --- a/build/asset-manifest.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "files": { - "main.css": "/static/css/main.0cc182db.chunk.css", - "main.js": "/static/js/main.77a312d2.chunk.js", - "main.js.map": "/static/js/main.77a312d2.chunk.js.map", - "runtime-main.js": "/static/js/runtime-main.2fd6158b.js", - "runtime-main.js.map": "/static/js/runtime-main.2fd6158b.js.map", - "static/js/2.0b487018.chunk.js": "/static/js/2.0b487018.chunk.js", - "static/js/2.0b487018.chunk.js.map": "/static/js/2.0b487018.chunk.js.map", - "index.html": "/index.html", - "static/css/main.0cc182db.chunk.css.map": "/static/css/main.0cc182db.chunk.css.map", - "static/js/2.0b487018.chunk.js.LICENSE.txt": "/static/js/2.0b487018.chunk.js.LICENSE.txt", - "static/media/logo.6ce24c58.svg": "/static/media/logo.6ce24c58.svg" - }, - "entrypoints": [ - "static/js/runtime-main.2fd6158b.js", - "static/js/2.0b487018.chunk.js", - "static/css/main.0cc182db.chunk.css", - "static/js/main.77a312d2.chunk.js" - ] -} \ No newline at end of file diff --git a/build/assets/images/17520.jpg b/build/assets/images/17520.jpg deleted file mode 100644 index a1c6348..0000000 Binary files a/build/assets/images/17520.jpg and /dev/null differ diff --git a/build/assets/images/christian-nielsen-1JHzqk5oTy8-unsplash.jpg b/build/assets/images/christian-nielsen-1JHzqk5oTy8-unsplash.jpg deleted file mode 100644 index 261a004..0000000 Binary files a/build/assets/images/christian-nielsen-1JHzqk5oTy8-unsplash.jpg and /dev/null differ diff --git a/build/assets/images/eberhard-grossgasteiger-cs0sK0gzqCU-unsplash.jpg b/build/assets/images/eberhard-grossgasteiger-cs0sK0gzqCU-unsplash.jpg deleted file mode 100644 index f2c1219..0000000 Binary files a/build/assets/images/eberhard-grossgasteiger-cs0sK0gzqCU-unsplash.jpg and /dev/null differ diff --git a/build/assets/images/exoplanet_atmosphere_clouds_stars_moon_mist_mountains_rocks_101205_1920x1080.jpg b/build/assets/images/exoplanet_atmosphere_clouds_stars_moon_mist_mountains_rocks_101205_1920x1080.jpg deleted file mode 100644 index 6d15602..0000000 Binary files a/build/assets/images/exoplanet_atmosphere_clouds_stars_moon_mist_mountains_rocks_101205_1920x1080.jpg and /dev/null differ diff --git a/build/assets/images/jeremy-thomas-E0AHdsENmDg-unsplash.jpg b/build/assets/images/jeremy-thomas-E0AHdsENmDg-unsplash.jpg deleted file mode 100644 index a5b1e3b..0000000 Binary files a/build/assets/images/jeremy-thomas-E0AHdsENmDg-unsplash.jpg and /dev/null differ diff --git a/build/assets/images/klemen-vrankar-lcT_p8kLCsc-unsplash.jpg b/build/assets/images/klemen-vrankar-lcT_p8kLCsc-unsplash.jpg deleted file mode 100644 index ac52696..0000000 Binary files a/build/assets/images/klemen-vrankar-lcT_p8kLCsc-unsplash.jpg and /dev/null differ diff --git a/build/assets/images/shot-by-cerqueira-0o_GEzyargo-unsplash.jpg b/build/assets/images/shot-by-cerqueira-0o_GEzyargo-unsplash.jpg deleted file mode 100644 index 58fab59..0000000 Binary files a/build/assets/images/shot-by-cerqueira-0o_GEzyargo-unsplash.jpg and /dev/null differ diff --git a/build/firebaseHandle.js b/build/firebaseHandle.js deleted file mode 100644 index e508836..0000000 --- a/build/firebaseHandle.js +++ /dev/null @@ -1,22 +0,0 @@ -var sendingDatabase; -var recevingDatabase; -var firebaseConfig = { - apiKey: "AIzaSyBCiec200q3DXiXtE54t4PuNFThQnbXCl0", - authDomain: "ne-7664f.firebaseapp.com", - databaseURL: "https://ne-7664f.firebaseio.com", - projectId: "ne-7664f", - storageBucket: "ne-7664f.appspot.com", - messagingSenderId: "578526438847", - appId: "1:578526438847:android:a431b66f2b2e98a9f32d0a", - // measurementId: "G-MEASUREMENT_ID", - }; -firebase.initializeApp(firebaseConfig); -alert("asdasd") -function clicked() { - var username=document.getElementById("inputForText").value; - if(username.length==0)alert("InvalidName"); - else{ - sendingDatabase=firebase.database().ref('newChat'); - firebase.database().ref('newChat').child(username).set("present"); - } -} \ No newline at end of file diff --git a/build/index.html b/build/index.html deleted file mode 100644 index a510324..0000000 --- a/build/index.html +++ /dev/null @@ -1 +0,0 @@ -

asdasd

ChatHere
diff --git a/build/static/css/main.0cc182db.chunk.css b/build/static/css/main.0cc182db.chunk.css deleted file mode 100644 index f868877..0000000 --- a/build/static/css/main.0cc182db.chunk.css +++ /dev/null @@ -1,2 +0,0 @@ -body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;z-index:500px}code{font-family:source-code-pro,Menlo,Monaco,Consolas,"Courier New",monospace}#FixedChatAreaMainDiv{position:relative;top:90px;max-width:100px;max-height:100px;text-align:center;display:inline-block}#loginContainer{text-align:center;color:#fff}#buttonForSubmit,#inputForText{border:2px solid #9595ea;border-radius:10px;color:#fff;background-color:rgba(11,11,12,0)}#buttonForSubmit{width:60px}#FixedChatAreaMainDivId{border:2px solid #28f201;border-radius:10px;color:#fff;width:100%;max-width:700px;height:600px;max-height:600px;overflow-x:hidden;overflow-y:auto}#FixedChatAreaMainDivIdInputMessage{text-align:center}#inputForTextDuringChat{width:80%;max-width:550px}#buttonDuringChatId,#inputForTextDuringChat{color:#fff;margin-top:5px;border:2px solid orange;border-radius:10px;background-color:rgba(11,11,12,0)}#buttonDuringChatId{margin-left:5px}::-webkit-scrollbar{width:5px;border-radius:10px}::-webkit-scrollbar-track{background:rgba(11,11,12,0);border-radius:10px}::-webkit-scrollbar-thumb{background:#6c757d;border-radius:10px}::-webkit-scrollbar-thumb:hover{background:#555}.App{text-align:center}.App-logo{height:40vmin;pointer-events:none}@media (prefers-reduced-motion:no-preference){.App-logo{-webkit-animation:App-logo-spin 20s linear infinite;animation:App-logo-spin 20s linear infinite}}.App-header{background-color:#282c34;min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:calc(10px + 2vmin);color:#fff}.App-link{color:#61dafb}@-webkit-keyframes App-logo-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes App-logo-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}} -/*# sourceMappingURL=main.0cc182db.chunk.css.map */ \ No newline at end of file diff --git a/build/static/css/main.0cc182db.chunk.css.map b/build/static/css/main.0cc182db.chunk.css.map deleted file mode 100644 index 74a67fd..0000000 --- a/build/static/css/main.0cc182db.chunk.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://src/index.css","webpack://src/App.css"],"names":[],"mappings":"AAAA,KACE,QAAS,CACT,mJAEY,CACZ,kCAAmC,CACnC,iCAAkC,CAClC,aACF,CAEA,KACE,yEAEF,CACA,sBAEC,iBAAkB,CACf,QAAS,CAGZ,eAAgB,CAChB,gBAAiB,CACjB,iBAAkB,CAEhB,oBAMH,CACA,gBACC,iBAAkB,CAClB,UACD,CAOA,+BALC,wBAAyB,CACzB,kBAAmB,CACnB,UAAY,CACZ,iCAQD,CANA,iBAIC,UAED,CACA,wBACC,wBAAyB,CACzB,kBAAmB,CACnB,UAAY,CACZ,UAAW,CACX,eAAgB,CAChB,YAAa,CACb,gBAAiB,CACjB,iBAAkB,CACf,eACJ,CACA,oCACC,iBAED,CACA,wBAMC,SAAU,CACV,eACD,CACA,4CARC,UAAY,CACZ,cAAe,CACf,uBAAwB,CACxB,kBAAmB,CACnB,iCAUD,CANA,oBAKC,eACD,CAIA,oBACE,SAAU,CACV,kBACF,CAGA,0BACE,2BAAqB,CACpB,kBACH,CAGA,0BACE,kBAAmB,CAClB,kBACH,CAGA,gCACE,eACF,CCtGA,KACE,iBACF,CAEA,UACE,aAAc,CACd,mBACF,CAEA,8CACE,UACE,mDAA4C,CAA5C,2CACF,CACF,CAEA,YACE,wBAAyB,CACzB,gBAAiB,CACjB,YAAa,CACb,qBAAsB,CACtB,kBAAmB,CACnB,sBAAuB,CACvB,4BAA6B,CAC7B,UACF,CAEA,UACE,aACF,CAEA,iCACE,GACE,sBACF,CACA,GACE,uBACF,CACF,CAPA,yBACE,GACE,sBACF,CACA,GACE,uBACF,CACF","file":"main.0cc182db.chunk.css","sourcesContent":["body {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n z-index: 500px;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\n monospace;\n}\n#FixedChatAreaMainDiv{\n\n\tposition: relative;\n top: 90px;\n \n\n\tmax-width: 100px;\n\tmax-height: 100px; \n\ttext-align: center;\n\t\n display: inline-block;\n\n\n /* width:250px; or whatever width you want. \n max-width:250px; or whatever width you want. \n display: inline-block;*/\n}\n#loginContainer{\n\ttext-align: center;\n\tcolor: white;\n}\n#inputForText{\n\tborder: 2px solid #9595ea;\n\tborder-radius: 10px;\n\tcolor: white;\n\tbackground-color: #0b0b0c00;\n}\n#buttonForSubmit{\n\tborder: 2px solid #9595ea;\n\tborder-radius: 10px;\n\tcolor: white;\n\twidth: 60px;\n\tbackground-color: #0b0b0c00;\n}\n#FixedChatAreaMainDivId{\n\tborder: 2px solid #28f201;\n\tborder-radius: 10px;\n\tcolor: white;\n\twidth: 100%;\n\tmax-width: 700px;\n\theight: 600px;\n\tmax-height: 600px;\n\toverflow-x: hidden; \n overflow-y: auto\n}\n#FixedChatAreaMainDivIdInputMessage{\n\ttext-align: center;\n\t\n}\n#inputForTextDuringChat{\n\tcolor: white;\n\tmargin-top: 5px;\n\tborder: 2px solid orange;\n\tborder-radius: 10px;\n\tbackground-color: #0b0b0c00;\n\twidth: 80%;\n\tmax-width: 550px;\n}\n#buttonDuringChatId{\n\tcolor: white;\n\tmargin-top: 5px;\n\tborder: 2px solid orange;background-color: #0b0b0c00;\n\tborder-radius: 10px;\n\tmargin-left: 5px;\n}\n\n\n/* width */\n::-webkit-scrollbar {\n width: 5px;\n border-radius: 10px;\n}\n\n/* Track */\n::-webkit-scrollbar-track {\n background: #0b0b0c00;; \n border-radius: 10px;\n}\n \n/* Handle */\n::-webkit-scrollbar-thumb {\n background: #6c757d; \n border-radius: 10px;\n}\n\n/* Handle on hover */\n::-webkit-scrollbar-thumb:hover {\n background: #555; \n}\n\n",".App {\n text-align: center;\n}\n\n.App-logo {\n height: 40vmin;\n pointer-events: none;\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .App-logo {\n animation: App-logo-spin infinite 20s linear;\n }\n}\n\n.App-header {\n background-color: #282c34;\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n font-size: calc(10px + 2vmin);\n color: white;\n}\n\n.App-link {\n color: #61dafb;\n}\n\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n"]} \ No newline at end of file diff --git a/build/static/js/2.0b487018.chunk.js b/build/static/js/2.0b487018.chunk.js deleted file mode 100644 index a747280..0000000 --- a/build/static/js/2.0b487018.chunk.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see 2.0b487018.chunk.js.LICENSE.txt */ -(this["webpackJsonpbirthday-remainder"]=this["webpackJsonpbirthday-remainder"]||[]).push([[2],[function(t,e,n){"use strict";n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return a})),n.d(e,"d",(function(){return s})),n.d(e,"h",(function(){return u})),n.d(e,"e",(function(){return c})),n.d(e,"f",(function(){return l})),n.d(e,"g",(function(){return h}));var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o=function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(t,e){var n="function"===typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function l(){for(var t=[],e=0;e>6|192,e[n++]=63&i|128):55296===(64512&i)&&r+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},l={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:function(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i>2,h=(3&o)<<4|s>>4,f=(15&s)<<2|c>>6,p=63&c;u||(p=64,a||(f=64)),r.push(n[l],n[h],n[f],n[p])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(c(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){for(var e=[],n=0,r=0;n191&&i<224){var o=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){var a=((7&i)<<18|(63&(o=t[n++]))<<12|(63&(s=t[n++]))<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(a>>10)),e[r++]=String.fromCharCode(56320+(1023&a))}else{o=t[n++];var s=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&s)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i>4;if(r.push(c),64!==s){var l=a<<4&240|s>>2;if(r.push(l),64!==u){var h=s<<6&192|u;r.push(h)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},h=function(t){var e=c(t);return l.encodeByteArray(e,!0)},f=function(t){try{return l.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function p(t){return d(void 0,t)}function d(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n in e)e.hasOwnProperty(n)&&"__proto__"!==n&&(t[n]=d(t[n],e[n]));return t}var v=function(){function t(){var t=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))}return t.prototype.wrapCallback=function(t){var e=this;return function(n,r){n?e.reject(n):e.resolve(r),"function"===typeof t&&(e.promise.catch((function(){})),1===t.length?t(n):t(n,r))}},t}();function y(){return"undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:""}function g(){return"undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(y())}function m(){try{return"[object process]"===Object.prototype.toString.call(t.process)}catch(e){return!1}}function b(){return"object"===typeof self&&self.self===self}function _(){var t="object"===typeof chrome?chrome.runtime:"object"===typeof browser?browser.runtime:void 0;return"object"===typeof t&&void 0!==t.id}function w(){return"object"===typeof navigator&&"ReactNative"===navigator.product}function E(){return y().indexOf("Electron/")>=0}function T(){var t=y();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function I(){return y().indexOf("MSAppHost/")>=0}function S(){return!0===i||!0===o}function O(){return"indexedDB"in self&&null!=indexedDB}function C(){return new Promise((function(t,e){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=window.indexedDB.open(r);i.onsuccess=function(){i.result.close(),n||window.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=function(){n=!1},i.onerror=function(){var t;e((null===(t=i.error)||void 0===t?void 0:t.message)||"")}}catch(o){e(o)}}))}function k(){return!(!navigator||!navigator.cookieEnabled)}var N=function(t){function e(n,r,i){var o=t.call(this,r)||this;return o.code=n,o.customData=i,o.name="FirebaseError",Object.setPrototypeOf(o,e.prototype),Error.captureStackTrace&&Error.captureStackTrace(o,A.prototype.create),o}return Object(r.c)(e,t),e}(Error),A=function(){function t(t,e,n){this.service=t,this.serviceName=e,this.errors=n}return t.prototype.create=function(t){for(var e=[],n=1;n"}))}var R=/\{\$([^}]+)}/g;function x(t){return JSON.parse(t)}function j(t){return JSON.stringify(t)}var D=function(t){var e={},n={},r={},i="";try{var o=t.split(".");e=x(f(o[0])||""),n=x(f(o[1])||""),i=o[2],r=n.d||{},delete n.d}catch(a){}return{header:e,claims:n,data:r,signature:i}},L=function(t){var e=D(t).claims;return!!e&&"object"===typeof e&&e.hasOwnProperty("iat")},M=function(t){var e=D(t).claims;return"object"===typeof e&&!0===e.admin};function F(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function U(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function V(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function q(t,e,n){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=e.call(n,t[i],i,t));return r}function B(t){for(var e=[],n=function(t,n){Array.isArray(n)?n.forEach((function(n){e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))})):e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))},r=0,i=Object.entries(t);r>>31)}var o,a,s=this.chain_[0],u=this.chain_[1],c=this.chain_[2],l=this.chain_[3],h=this.chain_[4];for(r=0;r<80;r++){r<40?r<20?(o=l^u&(c^l),a=1518500249):(o=u^c^l,a=1859775393):r<60?(o=u&c|l&(u|c),a=2400959708):(o=u^c^l,a=3395469782);i=(s<<5|s>>>27)+o+h+a+n[r]&4294967295;h=l,l=c,c=4294967295&(u<<30|u>>>2),u=s,s=i}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+u&4294967295,this.chain_[2]=this.chain_[2]+c&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295},t.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r=56;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var i=24;i>=0;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t},t}();function H(t,e){var n=new K(t,e);return n.subscribe.bind(n)}var K=function(){function t(t,e){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((function(){t(n)})).catch((function(t){n.error(t)}))}return t.prototype.next=function(t){this.forEachObserver((function(e){e.next(t)}))},t.prototype.error=function(t){this.forEachObserver((function(e){e.error(t)})),this.close(t)},t.prototype.complete=function(){this.forEachObserver((function(t){t.complete()})),this.close()},t.prototype.subscribe=function(t,e,n){var r,i=this;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(t,e){if("object"!==typeof t||null===t)return!1;for(var n=0,r=e;nn&&(i=0===n?"none":"no more than "+n),i)throw new Error(t+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".")};function Q(t,e,n){var r="";switch(e){case 1:r=n?"first":"First";break;case 2:r=n?"second":"Second";break;case 3:r=n?"third":"Third";break;case 4:r=n?"fourth":"Fourth";break;default:throw new Error("errorPrefix called with argumentNumber > 4. Need to update it?")}var i=t+" failed: ";return i+=r+" argument "}function Y(t,e,n,r){if((!r||n)&&"function"!==typeof n)throw new Error(Q(t,e,r)+"must be a valid function.")}function J(t,e,n,r){if((!r||n)&&("object"!==typeof n||null===n))throw new Error(Q(t,e,r)+"must be a valid context object.")}var X=function(t){for(var e=[],n=0,r=0;r=55296&&i<=56319){var o=i-55296;r++,s(r>6|192,e[n++]=63&i|128):i<65536?(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},$=function(t){for(var e=0,n=0;n=55296&&r<=56319?(e+=4,n++):e+=3}return e};function Z(t,e,n){void 0===e&&(e=1e3),void 0===n&&(n=2);var r=e*Math.pow(n,t),i=Math.round(.5*r*(Math.random()-.5)*2);return Math.min(144e5,r+i)}}).call(this,n(13))},function(t,e,n){"use strict";var r,i,o=n(0),a=n(1),s=n(5),u=n(4),c=((r={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",r["bad-app-name"]="Illegal App name: '{$appName}",r["duplicate-app"]="Firebase App named '{$appName}' already exists",r["app-deleted"]="Firebase App named '{$appName}' already deleted",r["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",r["invalid-log-argument"]="First argument to `onLog` must be null or a function.",r),l=new a.b("app","Firebase",c),h="@firebase/app",f="[DEFAULT]",p=((i={})[h]="fire-core",i["@firebase/analytics"]="fire-analytics",i["@firebase/auth"]="fire-auth",i["@firebase/database"]="fire-rtdb",i["@firebase/functions"]="fire-fn",i["@firebase/installations"]="fire-iid",i["@firebase/messaging"]="fire-fcm",i["@firebase/performance"]="fire-perf",i["@firebase/remote-config"]="fire-rc",i["@firebase/storage"]="fire-gcs",i["@firebase/firestore"]="fire-fst",i["fire-js"]="fire-js",i["firebase-wrapper"]="fire-js-all",i),d=new u.b("@firebase/app"),v=function(){function t(t,e,n){var r,i,u=this;this.firebase_=n,this.isDeleted_=!1,this.name_=e.name,this.automaticDataCollectionEnabled_=e.automaticDataCollectionEnabled||!1,this.options_=Object(a.m)(t),this.container=new s.b(e.name),this._addComponent(new s.a("app",(function(){return u}),"PUBLIC"));try{for(var c=Object(o.h)(this.firebase_.INTERNAL.components.values()),l=c.next();!l.done;l=c.next()){var h=l.value;this._addComponent(h)}}catch(f){r={error:f}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}return Object.defineProperty(t.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(t){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),t.prototype.delete=function(){var t=this;return new Promise((function(e){t.checkDestroyed_(),e()})).then((function(){return t.firebase_.INTERNAL.removeApp(t.name_),Promise.all(t.container.getProviders().map((function(t){return t.delete()})))})).then((function(){t.isDeleted_=!0}))},t.prototype._getService=function(t,e){return void 0===e&&(e=f),this.checkDestroyed_(),this.container.getProvider(t).getImmediate({identifier:e})},t.prototype._removeServiceInstance=function(t,e){void 0===e&&(e=f),this.container.getProvider(t).clearInstance(e)},t.prototype._addComponent=function(t){try{this.container.addComponent(t)}catch(e){d.debug("Component "+t.name+" failed to register with FirebaseApp "+this.name,e)}},t.prototype._addOrOverwriteComponent=function(t){this.container.addOrOverwriteComponent(t)},t.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw l.create("app-deleted",{appName:this.name_})},t}();v.prototype.name&&v.prototype.options||v.prototype.delete||console.log("dc");var y=function t(){var e=function(t){var e={},n=new Map,r={__esModule:!0,initializeApp:function(n,i){void 0===i&&(i={}),"object"===typeof i&&null!==i||(i={name:i});var o=i;void 0===o.name&&(o.name=f);var s=o.name;if("string"!==typeof s||!s)throw l.create("bad-app-name",{appName:String(s)});if(Object(a.k)(e,s))throw l.create("duplicate-app",{appName:s});var u=new t(n,o,r);return e[s]=u,u},app:i,registerVersion:function(t,e,n){var r,i=null!==(r=p[t])&&void 0!==r?r:t;n&&(i+="-"+n);var o=i.match(/\s|\//),a=e.match(/\s|\//);if(o||a){var u=['Unable to register library "'+i+'" with version "'+e+'":'];return o&&u.push('library name "'+i+'" contains illegal characters (whitespace or "/")'),o&&a&&u.push("and"),a&&u.push('version name "'+e+'" contains illegal characters (whitespace or "/")'),void d.warn(u.join(" "))}c(new s.a(i+"-version",(function(){return{library:i,version:e}}),"VERSION"))},setLogLevel:u.c,onLog:function(t,e){if(null!==t&&"function"!==typeof t)throw l.create("invalid-log-argument",{appName:name});Object(u.d)(t,e)},apps:null,SDK_VERSION:"8.0.1",INTERNAL:{registerComponent:c,removeApp:function(t){delete e[t]},components:n,useAsService:function(t,e){return"serverAuth"===e?null:e}}};function i(t){if(t=t||f,!Object(a.k)(e,t))throw l.create("no-app",{appName:t});return e[t]}function c(s){var u,c,h=s.name;if(n.has(h))return d.debug("There were multiple attempts to register component "+h+"."),"PUBLIC"===s.type?r[h]:null;if(n.set(h,s),"PUBLIC"===s.type){var f=function(t){if(void 0===t&&(t=i()),"function"!==typeof t[h])throw l.create("invalid-app-argument",{appName:h});return t[h]()};void 0!==s.serviceProps&&Object(a.n)(f,s.serviceProps),r[h]=f,t.prototype[h]=function(){for(var t=[],e=0;e=0&&d.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n ")}var b=y.initializeApp;y.initializeApp=function(){for(var t=[],e=0;e=(null!==r&&void 0!==r?r:e.logLevel)&&t({level:o[n].toLowerCase(),message:s,args:i,type:e.name})}},r=0,i=a;re?1:0}function b(t,e,n){return t.length===e.length&&t.every((function(t,r){return n(t,e[r])}))}function _(t){return t+"\0"}var w=function(){function t(t){this.i=t}return t.fromBase64String=function(e){return new t(atob(e))},t.fromUint8Array=function(e){return new t(function(t){for(var e="",n=0;n=1e9)throw new T(E.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new T(E.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new T(E.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}return t.now=function(){return t.fromMillis(Date.now())},t.fromDate=function(e){return t.fromMillis(e.getTime())},t.fromMillis=function(e){var n=Math.floor(e/1e3);return new t(n,1e6*(e-1e3*n))},t.prototype.toDate=function(){return new Date(this.toMillis())},t.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},t.prototype.K=function(t){return this.seconds===t.seconds?m(this.nanoseconds,t.nanoseconds):m(this.seconds,t.seconds)},t.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},t.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},t.prototype.toJSON=function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}},t.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},t}(),U=function(){function t(t){this.timestamp=t}return t.W=function(e){return new t(e)},t.min=function(){return new t(new F(0,0))},t.prototype.u=function(t){return this.timestamp.K(t.timestamp)},t.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},t.prototype.j=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},t.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},t.prototype.G=function(){return this.timestamp},t}(),V=function(){function t(t,e,n){void 0===e?e=0:e>t.length&&p(),void 0===n?n=t.length-e:n>t.length-e&&p(),this.segments=t,this.offset=e,this.H=n}return Object.defineProperty(t.prototype,"length",{get:function(){return this.H},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(e){return 0===t.J(this,e)},t.prototype.child=function(e){var n=this.segments.slice(this.offset,this.limit());return e instanceof t?e.forEach((function(t){n.push(t)})):n.push(e),this.Y(n)},t.prototype.limit=function(){return this.offset+this.length},t.prototype.X=function(t){return t=void 0===t?1:t,this.Y(this.segments,this.offset+t,this.length-t)},t.prototype.Z=function(){return this.Y(this.segments,this.offset,this.length-1)},t.prototype.tt=function(){return this.segments[this.offset]},t.prototype.et=function(){return this.get(this.length-1)},t.prototype.get=function(t){return this.segments[this.offset+t]},t.prototype.nt=function(){return 0===this.length},t.prototype.st=function(t){if(t.lengtho)return 1}return t.lengthe.length?1:0},t}(),q=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.Y=function(t,n,r){return new e(t,n,r)},e.prototype.ot=function(){return this.rt().join("/")},e.prototype.toString=function(){return this.ot()},e.ct=function(){for(var t=[],n=0;n=0)throw new T(E.INVALID_ARGUMENT,"Invalid segment ("+a+"). Paths must not contain // in them.");r.push.apply(r,a.split("/").filter((function(t){return t.length>0})))}return new e(r)},e.at=function(){return new e([])},e}(V),B=/^[_a-zA-Z][_a-zA-Z0-9]*$/,z=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.Y=function(t,n,r){return new e(t,n,r)},e.ut=function(t){return B.test(t)},e.prototype.ot=function(){return this.rt().map((function(t){return t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),e.ut(t)||(t="`"+t+"`"),t})).join(".")},e.prototype.toString=function(){return this.ot()},e.prototype.ht=function(){return 1===this.length&&"__name__"===this.get(0)},e.lt=function(){return new e(["__name__"])},e._t=function(t){for(var n=[],r="",i=0,o=function(){if(0===r.length)throw new T(E.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");n.push(r),r=""},a=!1;i=2&&this.path.get(this.path.length-2)===t},t.prototype.isEqual=function(t){return null!==t&&0===q.J(this.path,t.path)},t.prototype.toString=function(){return this.path.toString()},t.J=function(t,e){return q.J(t.path,e.path)},t.Et=function(t){return t.length%2==0},t.Tt=function(e){return new t(new q(e.slice()))},t}();function K(t){var e=0;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function W(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function G(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var Q=function(){function t(t){this.fields=t,t.sort(z.J)}return t.prototype.It=function(t){for(var e=0,n=this.fields;e=Number.MIN_SAFE_INTEGER}function ot(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?Z(t)?4:10:p()}function at(t,e){var n=ot(t);if(n!==ot(e))return!1;switch(n){case 0:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return et(t).isEqual(et(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;var n=J(t.timestampValue),r=J(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return $(t.bytesValue).isEqual($(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return X(t.geoPointValue.latitude)===X(e.geoPointValue.latitude)&&X(t.geoPointValue.longitude)===X(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return X(t.integerValue)===X(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){var n=X(t.doubleValue),r=X(e.doubleValue);return n===r?rt(n)===rt(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return b(t.arrayValue.values||[],e.arrayValue.values||[],at);case 10:return function(t,e){var n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(K(n)!==K(r))return!1;for(var i in n)if(n.hasOwnProperty(i)&&(void 0===r[i]||!at(n[i],r[i])))return!1;return!0}(t,e);default:return p()}}function st(t,e){return void 0!==(t.values||[]).find((function(t){return at(t,e)}))}function ut(t,e){var n=ot(t),r=ot(e);if(n!==r)return m(n,r);switch(n){case 0:return 0;case 1:return m(t.booleanValue,e.booleanValue);case 2:return function(t,e){var n=X(t.integerValue||t.doubleValue),r=X(e.integerValue||e.doubleValue);return nr?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return ct(t.timestampValue,e.timestampValue);case 4:return ct(et(t),et(e));case 5:return m(t.stringValue,e.stringValue);case 6:return function(t,e){var n=$(t),r=$(e);return n.u(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){for(var n=t.split("/"),r=e.split("/"),i=0;i":return t>0;case">=":return t>=0;default:return p()}},e.prototype.xt=function(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0},e}((function(){})),Pt=function(t){function e(e,n,r){var i=this;return(i=t.call(this,e,n,r)||this).key=H.dt(r.referenceValue),i}return Object(a.c)(e,t),e.prototype.matches=function(t){var e=H.J(t.key,this.key);return this.Ct(e)},e}(At),Rt=function(t){function e(e,n){var r=this;return(r=t.call(this,e,"in",n)||this).keys=jt("in",n),r}return Object(a.c)(e,t),e.prototype.matches=function(t){return this.keys.some((function(e){return e.isEqual(t.key)}))},e}(At),xt=function(t){function e(e,n){var r=this;return(r=t.call(this,e,"not-in",n)||this).keys=jt("not-in",n),r}return Object(a.c)(e,t),e.prototype.matches=function(t){return!this.keys.some((function(e){return e.isEqual(t.key)}))},e}(At);function jt(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((function(t){return H.dt(t.referenceValue)}))}var Dt=function(t){function e(e,n){return t.call(this,e,"array-contains",n)||this}return Object(a.c)(e,t),e.prototype.matches=function(t){var e=t.field(this.field);return dt(e)&&st(e.arrayValue,this.value)},e}(At),Lt=function(t){function e(e,n){return t.call(this,e,"in",n)||this}return Object(a.c)(e,t),e.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&st(this.value.arrayValue,e)},e}(At),Mt=function(t){function e(e,n){return t.call(this,e,"not-in",n)||this}return Object(a.c)(e,t),e.prototype.matches=function(t){if(st(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;var e=t.field(this.field);return null!==e&&!st(this.value.arrayValue,e)},e}(At),Ft=function(t){function e(e,n){return t.call(this,e,"array-contains-any",n)||this}return Object(a.c)(e,t),e.prototype.matches=function(t){var e=this,n=t.field(this.field);return!(!dt(n)||!n.arrayValue.values)&&n.arrayValue.values.some((function(t){return st(e.value.arrayValue,t)}))},e}(At),Ut=function(t,e){this.position=t,this.before=e};function Vt(t){return(t.before?"b":"a")+":"+t.position.map((function(t){return lt(t)})).join(",")}var qt=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function Bt(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}function zt(t,e,n){for(var r=0,i=0;i0?t.Nt[0].field:null}function Xt(t){for(var e=0,n=t.filters;e0?e.Nt[e.Nt.length-1].dir:"asc";e.Ft.push(new qt(z.lt(),u))}}}return e.Ft}function te(t){var e=v(t);if(!e.Ot)if("F"===e.limitType)e.Ot=Ot(e.path,e.collectionGroup,Zt(e),e.filters,e.limit,e.startAt,e.endAt);else{for(var n=[],r=0,i=Zt(e);r0&&(e+=", orderBy: ["+t.orderBy.map((function(t){return function(t){return t.field.ot()+" ("+t.dir+")"}(t)})).join(", ")+"]"),t.startAt&&(e+=", startAt: "+Vt(t.startAt)),t.endAt&&(e+=", endAt: "+Vt(t.endAt)),"Target("+e+")"}(te(t))+"; limitType="+t.limitType+")"}function oe(t,e){return function(t,e){var n=e.key.path;return null!==t.collectionGroup?e.key.wt(t.collectionGroup)&&t.path.st(n):H.Et(t.path)?t.path.isEqual(n):t.path.it(n)}(t,e)&&function(t,e){for(var n=0,r=t.Nt;n0&&(e=e.right)}return null},t.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.nt();){var r=this.J(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1},t.prototype.nt=function(){return this.root.nt()},Object.defineProperty(t.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),t.prototype.Yt=function(){return this.root.Yt()},t.prototype.Xt=function(){return this.root.Xt()},t.prototype.Zt=function(t){return this.root.Zt(t)},t.prototype.forEach=function(t){this.Zt((function(e,n){return t(e,n),!1}))},t.prototype.toString=function(){var t=[];return this.Zt((function(e,n){return t.push(e+":"+n),!1})),"{"+t.join(", ")+"}"},t.prototype.te=function(t){return this.root.te(t)},t.prototype.ee=function(){return new Qe(this.root,null,this.J,!1)},t.prototype.ne=function(t){return new Qe(this.root,t,this.J,!1)},t.prototype.se=function(){return new Qe(this.root,null,this.J,!0)},t.prototype.ie=function(t){return new Qe(this.root,t,this.J,!0)},t}(),Qe=function(){function t(t,e,n,r){this.re=r,this.oe=[];for(var i=1;!t.nt();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.re?t.left:t.right;else{if(0===i){this.oe.push(t);break}this.oe.push(t),t=this.re?t.right:t.left}}return t.prototype.ce=function(){var t=this.oe.pop(),e={key:t.key,value:t.value};if(this.re)for(t=t.left;!t.nt();)this.oe.push(t),t=t.right;else for(t=t.right;!t.nt();)this.oe.push(t),t=t.left;return e},t.prototype.ae=function(){return this.oe.length>0},t.prototype.ue=function(){if(0===this.oe.length)return null;var t=this.oe[this.oe.length-1];return{key:t.key,value:t.value}},t}(),Ye=function(){function t(e,n,r,i,o){this.key=e,this.value=n,this.color=null!=r?r:t.RED,this.left=null!=i?i:t.EMPTY,this.right=null!=o?o:t.EMPTY,this.size=this.left.size+1+this.right.size}return t.prototype.copy=function(e,n,r,i,o){return new t(null!=e?e:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},t.prototype.nt=function(){return!1},t.prototype.Zt=function(t){return this.left.Zt(t)||t(this.key,this.value)||this.right.Zt(t)},t.prototype.te=function(t){return this.right.te(t)||t(this.key,this.value)||this.left.te(t)},t.prototype.min=function(){return this.left.nt()?this:this.left.min()},t.prototype.Yt=function(){return this.min().key},t.prototype.Xt=function(){return this.right.nt()?this.key:this.right.Xt()},t.prototype.Ht=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.Ht(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.Ht(t,e,n))).he()},t.prototype.le=function(){if(this.left.nt())return t.EMPTY;var e=this;return e.left._e()||e.left.left._e()||(e=e.fe()),(e=e.copy(null,null,null,e.left.le(),null)).he()},t.prototype.remove=function(e,n){var r,i=this;if(n(e,i.key)<0)i.left.nt()||i.left._e()||i.left.left._e()||(i=i.fe()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left._e()&&(i=i.de()),i.right.nt()||i.right._e()||i.right.left._e()||(i=i.we()),0===n(e,i.key)){if(i.right.nt())return t.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.le())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.he()},t.prototype._e=function(){return this.color},t.prototype.he=function(){var t=this;return t.right._e()&&!t.left._e()&&(t=t.Ee()),t.left._e()&&t.left.left._e()&&(t=t.de()),t.left._e()&&t.right._e()&&(t=t.Te()),t},t.prototype.fe=function(){var t=this.Te();return t.right.left._e()&&(t=(t=(t=t.copy(null,null,null,null,t.right.de())).Ee()).Te()),t},t.prototype.we=function(){var t=this.Te();return t.left.left._e()&&(t=(t=t.de()).Te()),t},t.prototype.Ee=function(){var e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},t.prototype.de=function(){var e=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},t.prototype.Te=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},t.prototype.Ie=function(){var t=this.me();return Math.pow(2,t)<=this.size+1},t.prototype.me=function(){if(this._e()&&this.left._e())throw p();if(this.right._e())throw p();var t=this.left.me();if(t!==this.right.me())throw p();return t+(this._e()?0:1)},t}();Ye.EMPTY=null,Ye.RED=!0,Ye.Jt=!1,Ye.EMPTY=new(function(){function t(){this.size=0}return Object.defineProperty(t.prototype,"key",{get:function(){throw p()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){throw p()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){throw p()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){throw p()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){throw p()},enumerable:!1,configurable:!0}),t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.Ht=function(t,e,n){return new Ye(t,e)},t.prototype.remove=function(t,e){return this},t.prototype.nt=function(){return!0},t.prototype.Zt=function(t){return!1},t.prototype.te=function(t){return!1},t.prototype.Yt=function(){return null},t.prototype.Xt=function(){return null},t.prototype._e=function(){return!1},t.prototype.Ie=function(){return!0},t.prototype.me=function(){return 0},t}());var Je=function(){function t(t){this.J=t,this.data=new Ge(this.J)}return t.prototype.has=function(t){return null!==this.data.get(t)},t.prototype.first=function(){return this.data.Yt()},t.prototype.last=function(){return this.data.Xt()},Object.defineProperty(t.prototype,"size",{get:function(){return this.data.size},enumerable:!1,configurable:!0}),t.prototype.indexOf=function(t){return this.data.indexOf(t)},t.prototype.forEach=function(t){this.data.Zt((function(e,n){return t(e),!1}))},t.prototype.Ae=function(t,e){for(var n=this.data.ne(t[0]);n.ae();){var r=n.ce();if(this.J(r.key,t[1])>=0)return;e(r.key)}},t.prototype.Re=function(t,e){var n;for(n=void 0!==e?this.data.ne(e):this.data.ee();n.ae();)if(!t(n.ce().key))return},t.prototype.Pe=function(t){var e=this.data.ne(t);return e.ae()?e.ce().key:null},t.prototype.ee=function(){return new Xe(this.data.ee())},t.prototype.ne=function(t){return new Xe(this.data.ne(t))},t.prototype.add=function(t){return this.copy(this.data.remove(t).Ht(t,!0))},t.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},t.prototype.nt=function(){return this.data.nt()},t.prototype.ye=function(t){var e=this;return e.size0&&(this.Xe=!0,this.Je=t)},t.prototype.nn=function(){var t=sn(),e=sn(),n=sn();return this.He.forEach((function(r,i){switch(i){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:p()}})),new dn(this.Je,this.Ye,t,e,n)},t.prototype.sn=function(){this.Xe=!1,this.He=wn()},t.prototype.rn=function(t,e){this.Xe=!0,this.He=this.He.Ht(t,e)},t.prototype.on=function(t){this.Xe=!0,this.He=this.He.remove(t)},t.prototype.cn=function(){this.ze+=1},t.prototype.an=function(){this.ze-=1},t.prototype.un=function(){this.Xe=!0,this.Ye=!0},t}(),bn=function(){function t(t){this.hn=t,this.ln=new Map,this._n=Ze(),this.fn=_n(),this.dn=new Je(m)}return t.prototype.wn=function(t){for(var e=0,n=t.We;e0?t.targetIds.forEach(e):this.ln.forEach((function(t,r){n.Rn(r)&&e(r)}))},t.prototype.yn=function(t){var e=t.targetId,n=t.Ge.count,r=this.gn(e);if(r){var i=r.target;if(Nt(i))if(0===n){var o=new H(i.path);this.Tn(e,o,new Tt(o,U.min()))}else d(1===n);else this.Vn(e)!==n&&(this.Pn(e),this.dn=this.dn.add(e))}},t.prototype.pn=function(t){var e=this,n=new Map;this.ln.forEach((function(r,i){var o=e.gn(i);if(o){if(r.qe&&Nt(o.target)){var a=new H(o.target.path);null!==e._n.get(a)||e.bn(i,a)||e.Tn(i,a,new Tt(a,t))}r.tn&&(n.set(i,r.nn()),r.sn())}}));var r=sn();this.fn.forEach((function(t,n){var i=!0;n.Re((function(t){var n=e.gn(t);return!n||2===n.kt||(i=!1,!1)})),i&&(r=r.add(t))}));var i=new pn(t,n,this.dn,this._n,r);return this._n=Ze(),this.fn=_n(),this.dn=new Je(m),i},t.prototype.En=function(t,e){if(this.Rn(t)){var n=this.bn(t,e.key)?2:0;this.An(t).rn(e.key,n),this._n=this._n.Ht(e.key,e),this.fn=this.fn.Ht(e.key,this.vn(e.key).add(t))}},t.prototype.Tn=function(t,e,n){if(this.Rn(t)){var r=this.An(t);this.bn(t,e)?r.rn(e,1):r.on(e),this.fn=this.fn.Ht(e,this.vn(e).delete(t)),n&&(this._n=this._n.Ht(e,n))}},t.prototype.removeTarget=function(t){this.ln.delete(t)},t.prototype.Vn=function(t){var e=this.An(t).nn();return this.hn.Sn(t).size+e.Ue.size-e.Ke.size},t.prototype.cn=function(t){this.An(t).cn()},t.prototype.An=function(t){var e=this.ln.get(t);return e||(e=new mn,this.ln.set(t,e)),e},t.prototype.vn=function(t){var e=this.fn.get(t);return e||(e=new Je(m),this.fn=this.fn.Ht(t,e)),e},t.prototype.Rn=function(t){var e=null!==this.gn(t);return e||c("WatchChangeAggregator","Detected inactive target",t),e},t.prototype.gn=function(t){var e=this.ln.get(t);return e&&e.Ze?null:this.hn.Dn(t)},t.prototype.Pn=function(t){var e=this;this.ln.set(t,new mn),this.hn.Sn(t).forEach((function(n){e.Tn(t,n,null)}))},t.prototype.bn=function(t,e){return this.hn.Sn(t).has(e)},t}();function _n(){return new Ge(H.J)}function wn(){return new Ge(H.J)}var En={asc:"ASCENDING",desc:"DESCENDING"},Tn={"<":"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"},In=function(t,e){this.T=t,this.qt=e};function Sn(t,e){return t.qt?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function On(t,e){return t.qt?e.toBase64():e.toUint8Array()}function Cn(t,e){return Sn(t,e.G())}function kn(t){return d(!!t),U.W(function(t){var e=J(t);return new F(e.seconds,e.nanos)}(t))}function Nn(t,e){return function(t){return new q(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).ot()}function An(t){var e=q.ct(t);return d(tr(e)),e}function Pn(t,e){return Nn(t.T,e.path)}function Rn(t,e){var n=An(e);if(n.get(1)!==t.T.projectId)throw new T(E.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.T.projectId);if(n.get(3)!==t.T.database)throw new T(E.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.T.database);return new H(Ln(n))}function xn(t,e){return Nn(t.T,e)}function jn(t){var e=An(t);return 4===e.length?q.at():Ln(e)}function Dn(t){return new q(["projects",t.T.projectId,"databases",t.T.database]).ot()}function Ln(t){return d(t.length>4&&"documents"===t.get(4)),t.X(5)}function Mn(t,e,n){return{name:Pn(t,e),fields:n.proto.mapValue.fields}}function Fn(t,e,n){var r=Rn(t,e.name),i=kn(e.updateTime),o=new mt({mapValue:{fields:e.fields}});return new Et(r,i,o,{hasCommittedMutations:!!n})}function Un(t,e){var n;if(e instanceof je)n={update:Mn(t,e.key,e.value)};else if(e instanceof Be)n={delete:Pn(t,e.key)};else if(e instanceof De)n={update:Mn(t,e.key,e.data),updateMask:Zn(e.zt)};else{if(!(e instanceof ze))return p();n={verify:Pn(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((function(t){return function(t,e){var n=e.transform;if(n instanceof ye)return{fieldPath:e.field.ot(),setToServerValue:"REQUEST_TIME"};if(n instanceof ge)return{fieldPath:e.field.ot(),appendMissingElements:{values:n.elements}};if(n instanceof be)return{fieldPath:e.field.ot(),removeAllFromArray:{values:n.elements}};if(n instanceof we)return{fieldPath:e.field.ot(),increment:n.Qt};throw p()}(0,t)}))),e.Gt.jt||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Cn(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:p()}(t,e.Gt)),n}function Vn(t,e){var n=e.currentDocument?function(t){return void 0!==t.updateTime?Oe.updateTime(kn(t.updateTime)):void 0!==t.exists?Oe.exists(t.exists):Oe.Wt()}(e.currentDocument):Oe.Wt(),r=e.updateTransforms?e.updateTransforms.map((function(e){return function(t,e){var n=null;if("setToServerValue"in e)d("REQUEST_TIME"===e.setToServerValue),n=new ye;else if("appendMissingElements"in e){var r=e.appendMissingElements.values||[];n=new ge(r)}else if("removeAllFromArray"in e){var i=e.removeAllFromArray.values||[];n=new be(i)}else"increment"in e?n=new we(t,e.increment):p();var o=z._t(e.fieldPath);return new Ie(o,n)}(t,e)})):[];if(e.update){e.update.name;var i=Rn(t,e.update.name),o=new mt({mapValue:{fields:e.update.fields}});if(e.updateMask){var a=function(t){var e=t.fieldPaths||[];return new Q(e.map((function(t){return z._t(t)})))}(e.updateMask);return new De(i,o,a,n,r)}return new je(i,o,n,r)}if(e.delete){var s=Rn(t,e.delete);return new Be(s,n)}if(e.verify){var u=Rn(t,e.verify);return new ze(u,n)}return p()}function qn(t,e){return{documents:[xn(t,e.path)]}}function Bn(t,e){var n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=xn(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=xn(t,r.Z()),n.structuredQuery.from=[{collectionId:r.et()}]);var i=function(t){if(0!==t.length){var e=t.map((function(t){return function(t){if("=="===t.op){if(yt(t.value))return{unaryFilter:{field:Yn(t.field),op:"IS_NAN"}};if(vt(t.value))return{unaryFilter:{field:Yn(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(yt(t.value))return{unaryFilter:{field:Yn(t.field),op:"IS_NOT_NAN"}};if(vt(t.value))return{unaryFilter:{field:Yn(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Yn(t.field),op:Qn(t.op),value:t.value}}}(t)}));return 1===e.length?e[0]:{compositeFilter:{op:"AND",filters:e}}}}(e.filters);i&&(n.structuredQuery.where=i);var o=function(t){if(0!==t.length)return t.map((function(t){return function(t){return{field:Yn(t.field),direction:Gn(t.dir)}}(t)}))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);var a=function(t,e){return t.qt||nt(e)?e:{value:e}}(t,e.limit);return null!==a&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=Kn(e.startAt)),e.endAt&&(n.structuredQuery.endAt=Kn(e.endAt)),n}function zn(t){var e=jn(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){d(1===r);var o=n.from[0];o.allDescendants?i=o.collectionId:e=e.child(o.collectionId)}var a=[];n.where&&(a=Hn(n.where));var s=[];n.orderBy&&(s=n.orderBy.map((function(t){return function(t){return new qt(Jn(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t)})));var u=null;n.limit&&(u=function(t){var e;return nt(e="object"==typeof t?t.value:t)?null:e}(n.limit));var c=null;n.startAt&&(c=Wn(n.startAt));var l=null;return n.endAt&&(l=Wn(n.endAt)),Wt(e,i,s,a,u,"F",c,l)}function Hn(t){return t?void 0!==t.unaryFilter?[$n(t)]:void 0!==t.fieldFilter?[Xn(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map((function(t){return Hn(t)})).reduce((function(t,e){return t.concat(e)})):p():[]}function Kn(t){return{before:t.before,values:t.position}}function Wn(t){var e=!!t.before,n=t.values||[];return new Ut(n,e)}function Gn(t){return En[t]}function Qn(t){return Tn[t]}function Yn(t){return{fieldPath:t.ot()}}function Jn(t){return z._t(t.fieldPath)}function Xn(t){return At.create(Jn(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return p()}}(t.fieldFilter.op),t.fieldFilter.value)}function $n(t){switch(t.unaryFilter.op){case"IS_NAN":var e=Jn(t.unaryFilter.field);return At.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=Jn(t.unaryFilter.field);return At.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var r=Jn(t.unaryFilter.field);return At.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var i=Jn(t.unaryFilter.field);return At.create(i,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return p()}}function Zn(t){var e=[];return t.fields.forEach((function(t){return e.push(t.ot())})),{fieldPaths:e}}function tr(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}var er=function(){var t=this;this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))},nr=function(){function t(t){var e=this;this.Cn=null,this.xn=null,this.result=void 0,this.error=void 0,this.Nn=!1,this.Fn=!1,t((function(t){e.Nn=!0,e.result=t,e.Cn&&e.Cn(t)}),(function(t){e.Nn=!0,e.error=t,e.xn&&e.xn(t)}))}return t.prototype.catch=function(t){return this.next(void 0,t)},t.prototype.next=function(e,n){var r=this;return this.Fn&&p(),this.Fn=!0,this.Nn?this.error?this.On(n,this.error):this.kn(e,this.result):new t((function(t,i){r.Cn=function(n){r.kn(e,n).next(t,i)},r.xn=function(e){r.On(n,e).next(t,i)}}))},t.prototype.Mn=function(){var t=this;return new Promise((function(e,n){t.next(e,n)}))},t.prototype.Ln=function(e){try{var n=e();return n instanceof t?n:t.resolve(n)}catch(e){return t.reject(e)}},t.prototype.kn=function(e,n){return e?this.Ln((function(){return e(n)})):t.resolve(n)},t.prototype.On=function(e,n){return e?this.Ln((function(){return e(n)})):t.reject(n)},t.resolve=function(e){return new t((function(t,n){t(e)}))},t.reject=function(e){return new t((function(t,n){n(e)}))},t.$n=function(e){return new t((function(t,n){var r=0,i=0,o=!1;e.forEach((function(e){++r,e.next((function(){++i,o&&i===r&&t()}),(function(t){return n(t)}))})),o=!0,i===r&&t()}))},t.Bn=function(e){for(var n=t.resolve(!1),r=function(e){n=n.next((function(n){return n?t.resolve(n):e()}))},i=0,o=e;i0||t.indexOf("Trident/")>0||t.indexOf("Edge/")>0||r||a)},e.jn=function(){var e;return"undefined"!=typeof t&&"YES"===(null===(e=Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}))||void 0===e?void 0:e.zn)},e.Hn=function(t,e){return t.store(e)},e.Kn=function(t){var e=t.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=e?e[1].split("_").slice(0,2).join("."):"-1";return Number(n)},e.Gn=function(t){var e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)},e.prototype.Jn=function(t){return Object(a.b)(this,void 0,void 0,(function(){var e,n=this;return Object(a.d)(this,(function(r){switch(r.label){case 0:return this.db?[3,2]:(c("SimpleDb","Opening database:",this.name),e=this,[4,new Promise((function(e,r){var i=indexedDB.open(n.name,n.version);i.onsuccess=function(t){var n=t.target.result;e(n)},i.onblocked=function(){r(new ar(t,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=function(e){var n=e.target.error;"VersionError"===n.name?r(new T(E.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):r(new ar(t,n))},i.onupgradeneeded=function(t){c("SimpleDb",'Database "'+n.name+'" requires upgrade from version:',t.oldVersion);var e=t.target.result;n.Qn.Yn(e,i.transaction,t.oldVersion,n.version).next((function(){c("SimpleDb","Database upgrade to version "+n.version+" complete")}))}}))]);case 1:e.db=r.sent(),r.label=2;case 2:return[2,(this.Xn&&(this.db.onversionchange=function(t){return n.Xn(t)}),this.db)]}}))}))},e.prototype.Zn=function(t){this.Xn=t,this.db&&(this.db.onversionchange=function(e){return t(e)})},e.prototype.runTransaction=function(t,e,n,r){return Object(a.b)(this,void 0,void 0,(function(){var i,o,s,u,l;return Object(a.d)(this,(function(h){switch(h.label){case 0:i="readonly"===e,o=0,s=function(){var e,s,l,h,f;return Object(a.d)(this,(function(a){switch(a.label){case 0:++o,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,u.Jn(t)];case 2:return u.db=a.sent(),e=rr.open(u.db,t,i?"readonly":"readwrite",n),s=r(e).catch((function(t){return e.abort(t),nr.reject(t)})).Mn(),l={},s.catch((function(){})),[4,e.Un];case 3:return[2,(l.value=(a.sent(),s),l)];case 4:return h=a.sent(),f="FirebaseError"!==h.name&&o<3,c("SimpleDb","Transaction failed with error:",h.message,"Retrying:",f),u.close(),f?[3,5]:[2,{value:Promise.reject(h)}];case 5:return[2]}}))},u=this,h.label=1;case 1:return[5,s()];case 2:if("object"==typeof(l=h.sent()))return[2,l.value];h.label=3;case 3:return[3,1];case 4:return[2]}}))}))},e.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},e}(),or=function(){function t(t){this.ts=t,this.es=!1,this.ns=null}return Object.defineProperty(t.prototype,"Nn",{get:function(){return this.es},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ss",{get:function(){return this.ns},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cursor",{set:function(t){this.ts=t},enumerable:!1,configurable:!0}),t.prototype.done=function(){this.es=!0},t.prototype.rs=function(t){this.ns=t},t.prototype.delete=function(){return cr(this.ts.delete())},t}(),ar=function(t){function e(e,n){var r=this;return(r=t.call(this,E.UNAVAILABLE,"IndexedDB transaction '"+e+"' failed: "+n)||this).name="IndexedDbTransactionError",r}return Object(a.c)(e,t),e}(T);function sr(t){return"IndexedDbTransactionError"===t.name}var ur=function(){function t(t){this.store=t}return t.prototype.put=function(t,e){var n;return void 0!==e?(c("SimpleDb","PUT",this.store.name,t,e),n=this.store.put(e,t)):(c("SimpleDb","PUT",this.store.name,"",t),n=this.store.put(t)),cr(n)},t.prototype.add=function(t){return c("SimpleDb","ADD",this.store.name,t,t),cr(this.store.add(t))},t.prototype.get=function(t){var e=this;return cr(this.store.get(t)).next((function(n){return void 0===n&&(n=null),c("SimpleDb","GET",e.store.name,t,n),n}))},t.prototype.delete=function(t){return c("SimpleDb","DELETE",this.store.name,t),cr(this.store.delete(t))},t.prototype.count=function(){return c("SimpleDb","COUNT",this.store.name),cr(this.store.count())},t.prototype.os=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.cs(n,(function(t,e){r.push(e)})).next((function(){return r}))},t.prototype.us=function(t,e){c("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.hs=!1;var r=this.cursor(n);return this.cs(r,(function(t,e,n){return n.delete()}))},t.prototype.ls=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.cs(r,e)},t.prototype._s=function(t){var e=this.cursor({});return new nr((function(n,r){e.onerror=function(t){var e=hr(t.target.error);r(e)},e.onsuccess=function(e){var r=e.target.result;r?t(r.primaryKey,r.value).next((function(t){t?r.continue():n()})):n()}}))},t.prototype.cs=function(t,e){var n=[];return new nr((function(r,i){t.onerror=function(t){i(t.target.error)},t.onsuccess=function(t){var i=t.target.result;if(i){var o=new or(i),a=e(i.primaryKey,i.value,o);if(a instanceof nr){var s=a.catch((function(t){return o.done(),nr.reject(t)}));n.push(s)}o.Nn?r():null===o.ss?i.continue():i.continue(o.ss)}else r()}})).next((function(){return nr.$n(n)}))},t.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},t.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.hs?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},t}();function cr(t){return new nr((function(e,n){t.onsuccess=function(t){var n=t.target.result;e(n)},t.onerror=function(t){var e=hr(t.target.error);n(e)}}))}var lr=!1;function hr(t){var e=ir.Kn(Object(i.p)());if(e>=12.2&&e<13){var n="An internal error was encountered in the Indexed Database server";if(t.message.indexOf(n)>=0){var r=new T("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+n+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return lr||(lr=!0,setTimeout((function(){throw r}),0)),r}}return t}var fr=function(){function t(t,e,n,r,i){this.fs=t,this.ds=e,this.ws=n,this.op=r,this.Es=i,this.Ts=new er,this.then=this.Ts.promise.then.bind(this.Ts.promise),this.Ts.promise.catch((function(t){}))}return t.Is=function(e,n,r,i,o){var a=new t(e,n,Date.now()+r,i,o);return a.start(r),a},t.prototype.start=function(t){var e=this;this.As=setTimeout((function(){return e.Rs()}),t)},t.prototype.Ps=function(){return this.Rs()},t.prototype.cancel=function(t){null!==this.As&&(this.clearTimeout(),this.Ts.reject(new T(E.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},t.prototype.Rs=function(){var t=this;this.fs.ys((function(){return null!==t.As?(t.clearTimeout(),t.op().then((function(e){return t.Ts.resolve(e)}))):Promise.resolve()}))},t.prototype.clearTimeout=function(){null!==this.As&&(this.Es(this),clearTimeout(this.As),this.As=null)},t}();function pr(t,e){if(l("AsyncQueue",e+": "+t),sr(t))return new T(E.UNAVAILABLE,e+": "+t);throw t}var dr=function(t,e){this.progress=t,this.gs=e},vr="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",yr=function(){function t(){this.Vs=[]}return t.prototype.ps=function(t){this.Vs.push(t)},t.prototype.bs=function(){this.Vs.forEach((function(t){return t()}))},t}();function gr(t){for(var e="",n=0;n0&&(e=br(e)),e=mr(t.get(n),e);return br(e)}function mr(t,e){for(var n=e,r=t.length,i=0;i=2),2===e)return d("\x01"===t.charAt(0)&&"\x01"===t.charAt(1)),q.at();for(var n=e-2,r=[],i="",o=0;on)&&p(),t.charAt(a+1)){case"\x01":var s=t.substring(o,a),u=void 0;0===i.length?u=s:(u=i+=s,i=""),r.push(u);break;case"\x10":i+=t.substring(o,a),i+="\0";break;case"\x11":i+=t.substring(o,a+1);break;default:p()}o=a+2}return new q(r)}var wr=function(t,e){this.seconds=t,this.nanoseconds=e},Er=function(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n};Er.store="owner",Er.key="owner";var Tr=function(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n};Tr.store="mutationQueues",Tr.keyPath="userId";var Ir=function(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i};Ir.store="mutations",Ir.keyPath="batchId",Ir.userMutationsIndex="userMutationsIndex",Ir.userMutationsKeyPath=["userId","batchId"];var Sr=function(){function t(){}return t.prefixForUser=function(t){return[t]},t.prefixForPath=function(t,e){return[t,gr(e)]},t.key=function(t,e,n){return[t,gr(e),n]},t}();Sr.store="documentMutations",Sr.PLACEHOLDER=new Sr;var Or=function(t,e){this.path=t,this.readTime=e},Cr=function(t,e){this.path=t,this.version=e},kr=function(t,e,n,r,i,o){this.unknownDocument=t,this.noDocument=e,this.document=n,this.hasCommittedMutations=r,this.readTime=i,this.parentPath=o};kr.store="remoteDocuments",kr.readTimeIndex="readTimeIndex",kr.readTimeIndexPath="readTime",kr.collectionReadTimeIndex="collectionReadTimeIndex",kr.collectionReadTimeIndexPath=["parentPath","readTime"];var Nr=function(t){this.byteSize=t};Nr.store="remoteDocumentGlobal",Nr.key="remoteDocumentGlobalKey";var Ar=function(t,e,n,r,i,o,a){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.lastLimboFreeSnapshotVersion=o,this.query=a};Ar.store="targets",Ar.keyPath="targetId",Ar.queryTargetsIndexName="queryTargetsIndex",Ar.queryTargetsKeyPath=["canonicalId","targetId"];var Pr=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};Pr.store="targetDocuments",Pr.keyPath=["targetId","path"],Pr.documentTargetsIndex="documentTargetsIndex",Pr.documentTargetsKeyPath=["path","targetId"];var Rr=function(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r};Rr.key="targetGlobalKey",Rr.store="targetGlobal";var xr=function(t,e){this.collectionId=t,this.parent=e};xr.store="collectionParents",xr.keyPath=["collectionId","parent"];var jr=function(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r};jr.store="clientMetadata",jr.keyPath="clientId";var Dr=function(t,e,n){this.bundleId=t,this.createTime=e,this.version=n};Dr.store="bundles",Dr.keyPath="bundleId";var Lr=function(t,e,n){this.name=t,this.readTime=e,this.bundledQuery=n};Lr.store="namedQueries",Lr.keyPath="name";var Mr=Object(a.g)(Object(a.g)(Object(a.g)(Object(a.g)([Tr.store,Ir.store,Sr.store,kr.store,Ar.store,Er.store,Rr.store,Pr.store],[jr.store]),[Nr.store]),[xr.store]),[Dr.store,Lr.store]),Fr=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).vs=e,r.Ss=n,r}return Object(a.c)(e,t),e}(yr);function Ur(t,e){var n=v(t);return ir.Hn(n.vs,e)}var Vr=function(){function t(t,e,n,r){this.batchId=t,this.Ds=e,this.baseMutations=n,this.mutations=r}return t.prototype.Cs=function(t,e,n){for(var r=n.xs,i=0;i=0;--r){var i=e.mutations[r];void 0!==(null==i?void 0:i.transform)&&(e.mutations[r-1].updateTransforms=i.transform.fieldTransforms,e.mutations.splice(r,1),--r)}var o=e.mutations.map((function(e){return Vn(t.Ms,e)})),a=F.fromMillis(e.localWriteTimeMs);return new Vr(e.batchId,a,n,o)}function Jr(t){var e,n,r=Qr(t.readTime),i=void 0!==t.lastLimboFreeSnapshotVersion?Qr(t.lastLimboFreeSnapshotVersion):U.min();return void 0!==t.query.documents?(d(1===(n=t.query).documents.length),e=te(Gt(jn(n.documents[0])))):e=function(t){return te(zn(t))}(t.query),new ue(e,t.targetId,0,t.lastListenSequenceNumber,r,i,w.fromBase64String(t.resumeToken))}function Xr(t,e){var n,r=Gr(e.Mt),i=Gr(e.lastLimboFreeSnapshotVersion);n=Nt(e.target)?qn(t.Ms,e.target):Bn(t.Ms,e.target);var o=e.resumeToken.toBase64();return new Ar(e.targetId,Ct(e.target),r,o,e.sequenceNumber,i,n)}function $r(t){var e=zn({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?ee(e,e.limit,"L"):e}var Zr=function(){function t(){}return t.prototype.Ls=function(t,e){return ti(t).get(e).next((function(t){if(t)return{id:(e=t).bundleId,createTime:Qr(e.createTime),version:e.version};var e}))},t.prototype.$s=function(t,e){return ti(t).put({bundleId:(n=e).id,createTime:Gr(kn(n.createTime)),version:n.version});var n},t.prototype.Bs=function(t,e){return ei(t).get(e).next((function(t){if(t)return{name:(e=t).name,query:$r(e.bundledQuery),readTime:Qr(e.readTime)};var e}))},t.prototype.qs=function(t,e){return ei(t).put(function(t){return{name:t.name,readTime:Gr(kn(t.readTime)),bundledQuery:t.bundledQuery}}(e))},t}();function ti(t){return Ur(t,Dr.store)}function ei(t){return Ur(t,Lr.store)}var ni=function(){function t(){this.Us=new ri}return t.prototype.Qs=function(t,e){return this.Us.add(e),nr.resolve()},t.prototype.Ks=function(t,e){return nr.resolve(this.Us.getEntries(e))},t}(),ri=function(){function t(){this.index={}}return t.prototype.add=function(t){var e=t.et(),n=t.Z(),r=this.index[e]||new Je(q.J),i=!r.has(n);return this.index[e]=r.add(n),i},t.prototype.has=function(t){var e=t.et(),n=t.Z(),r=this.index[e];return r&&r.has(n)},t.prototype.getEntries=function(t){return(this.index[t]||new Je(q.J)).rt()},t}(),ii=function(){function t(){this.Ws=new ri}return t.prototype.Qs=function(t,e){var n=this;if(!this.Ws.has(e)){var r=e.et(),i=e.Z();t.ps((function(){n.Ws.add(e)}));var o={collectionId:r,parent:gr(i)};return oi(t).put(o)}return nr.resolve()},t.prototype.Ks=function(t,e){var n=[],r=IDBKeyRange.bound([e,""],[_(e),""],!1,!0);return oi(t).os(r).next((function(t){for(var r=0,i=t;r=r),o=Yr(n.Kt,e)),i.done()})).next((function(){return o}))},t.prototype.bi=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),n=-1;return vi(t).ls({index:Ir.userMutationsIndex,range:e,reverse:!0},(function(t,e,r){n=e.batchId,r.done()})).next((function(){return n}))},t.prototype.vi=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return vi(t).os(Ir.userMutationsIndex,n).next((function(t){return t.map((function(t){return Yr(e.Kt,t)}))}))},t.prototype.Si=function(t,e){var n=this,r=Sr.prefixForPath(this.userId,e.path),i=IDBKeyRange.lowerBound(r),o=[];return yi(t).ls({range:i},(function(r,i,a){var s=r[0],u=r[1],c=r[2],l=_r(u);if(s===n.userId&&e.path.isEqual(l))return vi(t).get(c).next((function(t){if(!t)throw p();d(t.userId===n.userId),o.push(Yr(n.Kt,t))}));a.done()})).next((function(){return o}))},t.prototype.Di=function(t,e){var n=this,r=new Je(m),i=[];return e.forEach((function(e){var o=Sr.prefixForPath(n.userId,e.path),a=IDBKeyRange.lowerBound(o),s=yi(t).ls({range:a},(function(t,i,o){var a=t[0],s=t[1],u=t[2],c=_r(s);a===n.userId&&e.path.isEqual(c)?r=r.add(u):o.done()}));i.push(s)})),nr.$n(i).next((function(){return n.Ci(t,r)}))},t.prototype.xi=function(t,e){var n=this,r=e.path,i=r.length+1,o=Sr.prefixForPath(this.userId,r),a=IDBKeyRange.lowerBound(o),s=new Je(m);return yi(t).ls({range:a},(function(t,e,o){var a=t[0],u=t[1],c=t[2],l=_r(u);a===n.userId&&r.st(l)?l.length===i&&(s=s.add(c)):o.done()})).next((function(){return n.Ci(t,s)}))},t.prototype.Ci=function(t,e){var n=this,r=[],i=[];return e.forEach((function(e){i.push(vi(t).get(e).next((function(t){if(null===t)throw p();d(t.userId===n.userId),r.push(Yr(n.Kt,t))})))})),nr.$n(i).next((function(){return r}))},t.prototype.Ni=function(t,e){var n=this;return hi(t.vs,this.userId,e).next((function(r){return t.ps((function(){n.Fi(e.batchId)})),nr.forEach(r,(function(e){return n.mi.Oi(t,e)}))}))},t.prototype.Fi=function(t){delete this.Ai[t]},t.prototype.ki=function(t){var e=this;return this.Pi(t).next((function(n){if(!n)return nr.resolve();var r=IDBKeyRange.lowerBound(Sr.prefixForUser(e.userId)),i=[];return yi(t).ls({range:r},(function(t,n,r){if(t[0]===e.userId){var o=_r(t[1]);i.push(o)}else r.done()})).next((function(){d(0===i.length)}))}))},t.prototype.Mi=function(t,e){return di(t,this.userId,e)},t.prototype.Li=function(t){var e=this;return gi(t).get(this.userId).next((function(t){return t||new Tr(e.userId,-1,"")}))},t}();function di(t,e,n){var r=Sr.prefixForPath(e,n.path),i=r[1],o=IDBKeyRange.lowerBound(r),a=!1;return yi(t).ls({range:o,hs:!0},(function(t,n,r){var o=t[0],s=t[1];t[2],o===e&&s===i&&(a=!0),r.done()})).next((function(){return a}))}function vi(t){return Ur(t,Ir.store)}function yi(t){return Ur(t,Sr.store)}function gi(t){return Ur(t,Tr.store)}var mi=function(){function t(t){this.$i=t}return t.prototype.next=function(){return this.$i+=2,this.$i},t.Bi=function(){return new t(0)},t.qi=function(){return new t(-1)},t}(),bi=function(){function t(t,e){this.mi=t,this.Kt=e}return t.prototype.Ui=function(t){var e=this;return this.Qi(t).next((function(n){var r=new mi(n.highestTargetId);return n.highestTargetId=r.next(),e.Ki(t,n).next((function(){return n.highestTargetId}))}))},t.prototype.Wi=function(t){return this.Qi(t).next((function(t){return U.W(new F(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))}))},t.prototype.ji=function(t){return this.Qi(t).next((function(t){return t.highestListenSequenceNumber}))},t.prototype.Gi=function(t,e,n){var r=this;return this.Qi(t).next((function(i){return i.highestListenSequenceNumber=e,n&&(i.lastRemoteSnapshotVersion=n.G()),e>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=e),r.Ki(t,i)}))},t.prototype.zi=function(t,e){var n=this;return this.Hi(t,e).next((function(){return n.Qi(t).next((function(r){return r.targetCount+=1,n.Ji(e,r),n.Ki(t,r)}))}))},t.prototype.Yi=function(t,e){return this.Hi(t,e)},t.prototype.Xi=function(t,e){var n=this;return this.Zi(t,e.targetId).next((function(){return _i(t).delete(e.targetId)})).next((function(){return n.Qi(t)})).next((function(e){return d(e.targetCount>0),e.targetCount-=1,n.Ki(t,e)}))},t.prototype.tr=function(t,e,n){var r=this,i=0,o=[];return _i(t).ls((function(a,s){var u=Jr(s);u.sequenceNumber<=e&&null===n.get(u.targetId)&&(i++,o.push(r.Xi(t,u)))})).next((function(){return nr.$n(o)})).next((function(){return i}))},t.prototype.mn=function(t,e){return _i(t).ls((function(t,n){var r=Jr(n);e(r)}))},t.prototype.Qi=function(t){return wi(t).get(Rr.key).next((function(t){return d(null!==t),t}))},t.prototype.Ki=function(t,e){return wi(t).put(Rr.key,e)},t.prototype.Hi=function(t,e){return _i(t).put(Xr(this.Kt,e))},t.prototype.Ji=function(t,e){var n=!1;return t.targetId>e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},t.prototype.er=function(t){return this.Qi(t).next((function(t){return t.targetCount}))},t.prototype.nr=function(t,e){var n=Ct(e),r=IDBKeyRange.bound([n,Number.NEGATIVE_INFINITY],[n,Number.POSITIVE_INFINITY]),i=null;return _i(t).ls({range:r,index:Ar.queryTargetsIndexName},(function(t,n,r){var o=Jr(n);kt(e,o.target)&&(i=o,r.done())})).next((function(){return i}))},t.prototype.sr=function(t,e,n){var r=this,i=[],o=Ei(t);return e.forEach((function(e){var a=gr(e.path);i.push(o.put(new Pr(n,a))),i.push(r.mi.ir(t,n,e))})),nr.$n(i)},t.prototype.rr=function(t,e,n){var r=this,i=Ei(t);return nr.forEach(e,(function(e){var o=gr(e.path);return nr.$n([i.delete([n,o]),r.mi.cr(t,n,e)])}))},t.prototype.Zi=function(t,e){var n=Ei(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},t.prototype.ar=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=Ei(t),i=sn();return r.ls({range:n,hs:!0},(function(t,e,n){var r=_r(t[1]),o=new H(r);i=i.add(o)})).next((function(){return i}))},t.prototype.Mi=function(t,e){var n=gr(e.path),r=IDBKeyRange.bound([n],[_(n)],!1,!0),i=0;return Ei(t).ls({index:Pr.documentTargetsIndex,hs:!0,range:r},(function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())})).next((function(){return i>0}))},t.prototype.Dn=function(t,e){return _i(t).get(e).next((function(t){return t?Jr(t):null}))},t}();function _i(t){return Ur(t,Ar.store)}function wi(t){return Ur(t,Rr.store)}function Ei(t){return Ur(t,Pr.store)}function Ti(t,e){var n=t[0],r=t[1],i=e[0],o=e[1],a=m(n,i);return 0===a?m(r,o):a}var Ii=function(){function t(t){this.ur=t,this.buffer=new Je(Ti),this.hr=0}return t.prototype.lr=function(){return++this.hr},t.prototype._r=function(t){var e=[t,this.lr()];if(this.buffer.sizef.params.Xs?(c("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+f.params.Xs+" from "+e),i=f.params.Xs):i=e,a=Date.now(),f.gr(t,i)})).next((function(r){return n=r,s=Date.now(),f.tr(t,n,e)})).next((function(e){return o=e,l=Date.now(),f.pr(t,n)})).next((function(t){return h=Date.now(),u()<=r.a.DEBUG&&c("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(a-p)+"ms\n\tDetermined least recently used "+i+" in "+(s-a)+"ms\n\tRemoved "+o+" targets in "+(l-s)+"ms\n\tRemoved "+t+" documents in "+(h-l)+"ms\nTotal Duration: "+(h-p)+"ms"),nr.resolve({js:!0,Gs:i,zs:o,Hs:t})}))},t}(),Ci=function(){function t(t,e){this.db=t,this.dr=function(t,e){return new Oi(t,e)}(this,e)}return t.prototype.yr=function(t){var e=this.Dr(t);return this.db.Cr().er(t).next((function(t){return e.next((function(e){return t+e}))}))},t.prototype.Dr=function(t){var e=0;return this.Vr(t,(function(t){e++})).next((function(){return e}))},t.prototype.mn=function(t,e){return this.db.Cr().mn(t,e)},t.prototype.Vr=function(t,e){return this.Nr(t,(function(t,n){return e(n)}))},t.prototype.ir=function(t,e,n){return ki(t,n)},t.prototype.cr=function(t,e,n){return ki(t,n)},t.prototype.tr=function(t,e,n){return this.db.Cr().tr(t,e,n)},t.prototype.Oi=function(t,e){return ki(t,e)},t.prototype.Fr=function(t,e){return function(t,e){var n=!1;return gi(t)._s((function(r){return di(t,r,e).next((function(t){return t&&(n=!0),nr.resolve(!t)}))})).next((function(){return n}))}(t,e)},t.prototype.pr=function(t,e){var n=this,r=this.db.kr().Or(),i=[],o=0;return this.Nr(t,(function(a,s){if(s<=e){var u=n.Fr(t,a).next((function(e){if(!e)return o++,r.di(t,a).next((function(){return r.fi(a),Ei(t).delete([0,gr(a.path)])}))}));i.push(u)}})).next((function(){return nr.$n(i)})).next((function(){return r.apply(t)})).next((function(){return o}))},t.prototype.removeTarget=function(t,e){var n=e.Lt(t.Ss);return this.db.Cr().Yi(t,n)},t.prototype.Mr=function(t,e){return ki(t,e)},t.prototype.Nr=function(t,e){var n,r=Ei(t),i=M.U;return r.ls({index:Pr.documentTargetsIndex},(function(t,r){var o=t[0],a=(t[1],r.path),s=r.sequenceNumber;0===o?(i!==M.U&&e(new H(_r(n)),i),i=s,n=a):i=M.U})).next((function(){i!==M.U&&e(new H(_r(n)),i)}))},t.prototype.vr=function(t){return this.db.kr().Lr(t)},t}();function ki(t,e){return Ei(t).put(function(t,e){return new Pr(0,gr(t.path),e)}(e,t.Ss))}var Ni=function(){function t(t,e){this.Kt=t,this.Ii=e}return t.prototype.hi=function(t,e,n){return Ri(t).put(xi(e),n)},t.prototype.fi=function(t,e){var n=Ri(t),r=xi(e);return n.delete(r)},t.prototype.updateMetadata=function(t,e){var n=this;return this.getMetadata(t).next((function(r){return r.byteSize+=e,n.$r(t,r)}))},t.prototype.di=function(t,e){var n=this;return Ri(t).get(xi(e)).next((function(t){return n.Br(t)}))},t.prototype.qr=function(t,e){var n=this;return Ri(t).get(xi(e)).next((function(t){var e=n.Br(t);return e?{_i:e,size:fi(t)}:null}))},t.prototype.getEntries=function(t,e){var n=this,r=tn();return this.Ur(t,e,(function(t,e){var i=n.Br(e);r=r.Ht(t,i)})).next((function(){return r}))},t.prototype.Qr=function(t,e){var n=this,r=tn(),i=new Ge(H.J);return this.Ur(t,e,(function(t,e){var o=n.Br(e);o?(r=r.Ht(t,o),i=i.Ht(t,fi(e))):(r=r.Ht(t,null),i=i.Ht(t,0))})).next((function(){return{Kr:r,Wr:i}}))},t.prototype.Ur=function(t,e,n){if(e.nt())return nr.resolve();var r=IDBKeyRange.bound(e.first().path.rt(),e.last().path.rt()),i=e.ee(),o=i.ce();return Ri(t).ls({range:r},(function(t,e,r){for(var a=H.Tt(t);o&&H.J(o,a)<0;)n(o,null),o=i.ce();o&&o.isEqual(a)&&(n(o,e),o=i.ae()?i.ce():null),o?r.rs(o.path.rt()):r.done()})).next((function(){for(;o;)n(o,null),o=i.ae()?i.ce():null}))},t.prototype.jr=function(t,e,n){var r=this,i=nn(),o=e.path.length+1,a={};if(n.isEqual(U.min())){var s=e.path.rt();a.range=IDBKeyRange.lowerBound(s)}else{var u=e.path.rt(),c=Kr(n);a.range=IDBKeyRange.lowerBound([u,c],!0),a.index=kr.collectionReadTimeIndex}return Ri(t).ls(a,(function(t,n,a){if(t.length===o){var s=zr(r.Kt,n);e.path.st(s.key.path)?s instanceof Et&&oe(e,s)&&(i=i.Ht(s.key,s)):a.done()}})).next((function(){return i}))},t.prototype.Or=function(t){return new Ai(this,!!t&&t.Gr)},t.prototype.Lr=function(t){return this.getMetadata(t).next((function(t){return t.byteSize}))},t.prototype.getMetadata=function(t){return Pi(t).get(Nr.key).next((function(t){return d(!!t),t}))},t.prototype.$r=function(t,e){return Pi(t).put(Nr.key,e)},t.prototype.Br=function(t){if(t){var e=zr(this.Kt,t);return e instanceof Tt&&e.version.isEqual(U.min())?null:e}return null},t}(),Ai=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).zr=e,r.Gr=n,r.Hr=new ci((function(t){return t.toString()}),(function(t,e){return t.isEqual(e)})),r}return Object(a.c)(e,t),e.prototype.Ti=function(t){var e=this,n=[],r=0,i=new Je((function(t,e){return m(t.ot(),e.ot())}));return this.ci.forEach((function(o,a){var s=e.Hr.get(o);if(a._i){var u=Hr(e.zr.Kt,a._i,e.ui(o));i=i.add(o.path.Z());var c=fi(u);r+=c-s,n.push(e.zr.hi(t,o,u))}else if(r-=s,e.Gr){var l=Hr(e.zr.Kt,new Tt(o,U.min()),e.ui(o));n.push(e.zr.hi(t,o,l))}else n.push(e.zr.fi(t,o))})),i.forEach((function(r){n.push(e.zr.Ii.Qs(t,r))})),n.push(this.zr.updateMetadata(t,r)),nr.$n(n)},e.prototype.wi=function(t,e){var n=this;return this.zr.qr(t,e).next((function(t){return null===t?(n.Hr.set(e,0),null):(n.Hr.set(e,t.size),t._i)}))},e.prototype.Ei=function(t,e){var n=this;return this.zr.Qr(t,e).next((function(t){var e=t.Kr;return t.Wr.forEach((function(t,e){n.Hr.set(t,e)})),e}))},e}(li);function Pi(t){return Ur(t,Nr.store)}function Ri(t){return Ur(t,kr.store)}function xi(t){return t.path.rt()}var ji=function(){function t(t){this.Kt=t}return t.prototype.Yn=function(t,e,n,r){var i=this;d(n=0&&r<=11);var o=new rr("createOrUpgrade",e);n<1&&r>=1&&(function(t){t.createObjectStore(Er.store)}(t),function(t){t.createObjectStore(Tr.store,{keyPath:Tr.keyPath}),t.createObjectStore(Ir.store,{keyPath:Ir.keyPath,autoIncrement:!0}).createIndex(Ir.userMutationsIndex,Ir.userMutationsKeyPath,{unique:!0}),t.createObjectStore(Sr.store)}(t),Di(t),function(t){t.createObjectStore(kr.store)}(t));var a=nr.resolve();return n<3&&r>=3&&(0!==n&&(function(t){t.deleteObjectStore(Pr.store),t.deleteObjectStore(Ar.store),t.deleteObjectStore(Rr.store)}(t),Di(t)),a=a.next((function(){return function(t){var e=t.store(Rr.store),n=new Rr(0,0,U.min().G(),0);return e.put(Rr.key,n)}(o)}))),n<4&&r>=4&&(0!==n&&(a=a.next((function(){return function(t,e){return e.store(Ir.store).os().next((function(n){t.deleteObjectStore(Ir.store),t.createObjectStore(Ir.store,{keyPath:Ir.keyPath,autoIncrement:!0}).createIndex(Ir.userMutationsIndex,Ir.userMutationsKeyPath,{unique:!0});var r=e.store(Ir.store),i=n.map((function(t){return r.put(t)}));return nr.$n(i)}))}(t,o)}))),a=a.next((function(){!function(t){t.createObjectStore(jr.store,{keyPath:jr.keyPath})}(t)}))),n<5&&r>=5&&(a=a.next((function(){return i.Jr(o)}))),n<6&&r>=6&&(a=a.next((function(){return function(t){t.createObjectStore(Nr.store)}(t),i.Yr(o)}))),n<7&&r>=7&&(a=a.next((function(){return i.Xr(o)}))),n<8&&r>=8&&(a=a.next((function(){return i.Zr(t,o)}))),n<9&&r>=9&&(a=a.next((function(){!function(t){t.objectStoreNames.contains("remoteDocumentChanges")&&t.deleteObjectStore("remoteDocumentChanges")}(t),function(t){var e=t.objectStore(kr.store);e.createIndex(kr.readTimeIndex,kr.readTimeIndexPath,{unique:!1}),e.createIndex(kr.collectionReadTimeIndex,kr.collectionReadTimeIndexPath,{unique:!1})}(e)}))),n<10&&r>=10&&(a=a.next((function(){return i.eo(o)}))),n<11&&r>=11&&(a=a.next((function(){!function(t){t.createObjectStore(Dr.store,{keyPath:Dr.keyPath})}(t),function(t){t.createObjectStore(Lr.store,{keyPath:Lr.keyPath})}(t)}))),a},t.prototype.Yr=function(t){var e=0;return t.store(kr.store).ls((function(t,n){e+=fi(n)})).next((function(){var n=new Nr(e);return t.store(Nr.store).put(Nr.key,n)}))},t.prototype.Jr=function(t){var e=this,n=t.store(Tr.store),r=t.store(Ir.store);return n.os().next((function(n){return nr.forEach(n,(function(n){var i=IDBKeyRange.bound([n.userId,-1],[n.userId,n.lastAcknowledgedBatchId]);return r.os(Ir.userMutationsIndex,i).next((function(r){return nr.forEach(r,(function(r){d(r.userId===n.userId);var i=Yr(e.Kt,r);return hi(t,n.userId,i).next((function(){}))}))}))}))}))},t.prototype.Xr=function(t){var e=t.store(Pr.store),n=t.store(kr.store);return t.store(Rr.store).get(Rr.key).next((function(t){var r=[];return n.ls((function(n,i){var o=new q(n),a=function(t){return[0,gr(t)]}(o);r.push(e.get(a).next((function(n){return n?nr.resolve():function(n){return e.put(new Pr(0,gr(n),t.highestListenSequenceNumber))}(o)})))})).next((function(){return nr.$n(r)}))}))},t.prototype.Zr=function(t,e){t.createObjectStore(xr.store,{keyPath:xr.keyPath});var n=e.store(xr.store),r=new ri,i=function(t){if(r.add(t)){var e=t.et(),i=t.Z();return n.put({collectionId:e,parent:gr(i)})}};return e.store(kr.store).ls({hs:!0},(function(t,e){var n=new q(t);return i(n.Z())})).next((function(){return e.store(Sr.store).ls({hs:!0},(function(t,e){t[0];var n=t[1],r=(t[2],_r(n));return i(r.Z())}))}))},t.prototype.eo=function(t){var e=this,n=t.store(Ar.store);return n.ls((function(t,r){var i=Jr(r),o=Xr(e.Kt,i);return n.put(o)}))},t}();function Di(t){t.createObjectStore(Pr.store,{keyPath:Pr.keyPath}).createIndex(Pr.documentTargetsIndex,Pr.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(Ar.store,{keyPath:Ar.keyPath}).createIndex(Ar.queryTargetsIndexName,Ar.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(Rr.store)}var Li="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",Mi=function(){function t(e,n,r,i,o,a,s,u,c,h){if(this.allowTabSynchronization=e,this.persistenceKey=n,this.clientId=r,this.no=o,this.window=a,this.document=s,this.so=c,this.io=h,this.ro=null,this.oo=!1,this.isPrimary=!1,this.networkEnabled=!0,this.co=null,this.inForeground=!1,this.ao=null,this.uo=null,this.ho=Number.NEGATIVE_INFINITY,this.lo=function(t){return Promise.resolve()},!t.Wn())throw new T(E.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.mi=new Ci(this,i),this._o=n+"main",this.Kt=new Br(u),this.fo=new ir(this._o,11,new ji(this.Kt)),this.wo=new bi(this.mi,this.Kt),this.Ii=new ii,this.Eo=function(t,e){return new Ni(t,e)}(this.Kt,this.Ii),this.To=new Zr,this.window&&this.window.localStorage?this.Io=this.window.localStorage:(this.Io=null,!1===h&&l("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}return t.prototype.start=function(){var t=this;return this.mo().then((function(){if(!t.isPrimary&&!t.allowTabSynchronization)throw new T(E.FAILED_PRECONDITION,Li);return t.Ao(),t.Ro(),t.Po(),t.runTransaction("getHighestListenSequenceNumber","readonly",(function(e){return t.wo.ji(e)}))})).then((function(e){t.ro=new M(e,t.so)})).then((function(){t.oo=!0})).catch((function(e){return t.fo&&t.fo.close(),Promise.reject(e)}))},t.prototype.yo=function(t){var e=this;return this.lo=function(n){return Object(a.b)(e,void 0,void 0,(function(){return Object(a.d)(this,(function(e){return this.Ir?[2,t(n)]:[2]}))}))},t(this.isPrimary)},t.prototype.Vo=function(t){var e=this;this.fo.Zn((function(n){return Object(a.b)(e,void 0,void 0,(function(){return Object(a.d)(this,(function(e){switch(e.label){case 0:return null===n.newVersion?[4,t()]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))}))},t.prototype.po=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.no.ys((function(){return Object(a.b)(e,void 0,void 0,(function(){return Object(a.d)(this,(function(t){switch(t.label){case 0:return this.Ir?[4,this.mo()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))})))},t.prototype.mo=function(){var t=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",(function(e){return Ui(e).put(new jr(t.clientId,Date.now(),t.networkEnabled,t.inForeground)).next((function(){if(t.isPrimary)return t.bo(e).next((function(e){e||(t.isPrimary=!1,t.no.vo((function(){return t.lo(!1)})))}))})).next((function(){return t.So(e)})).next((function(n){return t.isPrimary&&!n?t.Do(e).next((function(){return!1})):!!n&&t.Co(e).next((function(){return!0}))}))})).catch((function(e){if(sr(e))return c("IndexedDbPersistence","Failed to extend owner lease: ",e),t.isPrimary;if(!t.allowTabSynchronization)throw e;return c("IndexedDbPersistence","Releasing owner lease after error during lease refresh",e),!1})).then((function(e){t.isPrimary!==e&&t.no.vo((function(){return t.lo(e)})),t.isPrimary=e}))},t.prototype.bo=function(t){var e=this;return Fi(t).get(Er.key).next((function(t){return nr.resolve(e.xo(t))}))},t.prototype.No=function(t){return Ui(t).delete(this.clientId)},t.prototype.Fo=function(){return Object(a.b)(this,void 0,void 0,(function(){var t,e,n,r,i=this;return Object(a.d)(this,(function(o){switch(o.label){case 0:return!this.isPrimary||this.Oo(this.ho,18e5)?[3,2]:(this.ho=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",(function(t){var e=Ur(t,jr.store);return e.os().next((function(t){var n=i.ko(t,18e5),r=t.filter((function(t){return-1===n.indexOf(t)}));return nr.forEach(r,(function(t){return e.delete(t.clientId)})).next((function(){return r}))}))})).catch((function(){return[]}))]);case 1:if(t=o.sent(),this.Io)for(e=0,n=t;en&&(l("Detected an update time that is in the future: "+t+" > "+n),1))},t.prototype.Ao=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.ao=function(){t.no.ys((function(){return t.inForeground="visible"===t.document.visibilityState,t.mo()}))},this.document.addEventListener("visibilitychange",this.ao),this.inForeground="visible"===this.document.visibilityState)},t.prototype.qo=function(){this.ao&&(this.document.removeEventListener("visibilitychange",this.ao),this.ao=null)},t.prototype.Ro=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.co=function(){e.Bo(),e.no.ys((function(){return e.$o()}))},this.window.addEventListener("unload",this.co))},t.prototype.Uo=function(){this.co&&(this.window.removeEventListener("unload",this.co),this.co=null)},t.prototype.Lo=function(t){var e;try{var n=null!==(null===(e=this.Io)||void 0===e?void 0:e.getItem(this.Mo(t)));return c("IndexedDbPersistence","Client '"+t+"' "+(n?"is":"is not")+" zombied in LocalStorage"),n}catch(t){return l("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},t.prototype.Bo=function(){if(this.Io)try{this.Io.setItem(this.Mo(this.clientId),String(Date.now()))}catch(t){l("Failed to set zombie client id.",t)}},t.prototype.Qo=function(){if(this.Io)try{this.Io.removeItem(this.Mo(this.clientId))}catch(t){}},t.prototype.Mo=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},t}();function Fi(t){return Ur(t,Er.store)}function Ui(t){return Ur(t,jr.store)}function Vi(t,e){var n=t.projectId;return t.m||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}var qi=function(){function t(t,e,n){this.Eo=t,this.Ho=e,this.Ii=n}return t.prototype.Jo=function(t,e){var n=this;return this.Ho.Si(t,e).next((function(r){return n.Yo(t,e,r)}))},t.prototype.Yo=function(t,e,n){return this.Eo.di(t,e).next((function(t){for(var r=0,i=n;r0)},t.prototype.hc=function(t,e){return u()<=r.a.DEBUG&&c("QueryEngine","Using full collection scan to execute query:",ie(e)),this.uc.jr(t,e,U.min())},t}(),Hi=function(){function t(t,e,n,r){this.persistence=t,this.fc=e,this.Kt=r,this.dc=new Ge(m),this.wc=new ci((function(t){return Ct(t)}),kt),this.Ec=U.min(),this.Ho=t.Wo(n),this.Tc=t.kr(),this.wo=t.Cr(),this.Ic=new qi(this.Tc,this.Ho,this.persistence.jo()),this.To=t.Go(),this.fc.ac(this.Ic)}return t.prototype.Ar=function(t){var e=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",(function(n){return t.br(n,e.dc)}))},t}();function Ki(t,e,n,r){return new Hi(t,e,n,r)}function Wi(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n,r,i,o;return Object(a.d)(this,(function(a){switch(a.label){case 0:return n=v(t),r=n.Ho,i=n.Ic,[4,n.persistence.runTransaction("Handle user change","readonly",(function(t){var o;return n.Ho.vi(t).next((function(a){return o=a,r=n.persistence.Wo(e),i=new qi(n.Tc,r,n.persistence.jo()),r.vi(t)})).next((function(e){for(var n=[],r=[],a=sn(),s=0,u=o;s0){var c=s.$t(u,r).Lt(t.Ss);i=i.Ht(o,c),function(t,e,n){return d(e.resumeToken.o()>0),0===t.resumeToken.o()||e.Mt.j()-t.Mt.j()>=3e8||n.Ue.size+n.Qe.size+n.Ke.size>0}(s,c,e)&&a.push(n.wo.Yi(t,c))}}}));var s=Ze();if(e.Me.forEach((function(r,i){e.Le.has(r)&&a.push(n.persistence.mi.Mr(t,r))})),a.push(Ji(t,o,e.Me,r,void 0).next((function(t){s=t}))),!r.isEqual(U.min())){var u=n.wo.Wi(t).next((function(e){return n.wo.Gi(t,t.Ss,r)}));a.push(u)}return nr.$n(a).next((function(){return o.apply(t)})).next((function(){return n.Ic.tc(t,s)}))})).then((function(t){return n.dc=i,t}))}function Ji(t,e,n,r,i){var o=sn();return n.forEach((function(t){return o=o.add(t)})),e.getEntries(t,o).next((function(t){var o=Ze();return n.forEach((function(n,a){var s=t.get(n),u=(null==i?void 0:i.get(n))||r;a instanceof Tt&&a.version.isEqual(U.min())?(e.fi(n,u),o=o.Ht(n,a)):null==s||a.version.u(s.version)>0||0===a.version.u(s.version)&&s.hasPendingWrites?(e.hi(a,u),o=o.Ht(n,a)):c("LocalStore","Ignoring outdated watch update for ",n,". Current version:",s.version," Watch version:",a.version)})),o}))}function Xi(t,e){var n=v(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(function(t){return void 0===e&&(e=-1),n.Ho.pi(t,e)}))}function $i(t,e){var n=v(t);return n.persistence.runTransaction("Allocate target","readwrite",(function(t){var r;return n.wo.nr(t,e).next((function(i){return i?(r=i,nr.resolve(r)):n.wo.Ui(t).next((function(i){return r=new ue(e,i,0,t.Ss),n.wo.zi(t,r).next((function(){return r}))}))}))})).then((function(t){var r=n.dc.get(t.targetId);return(null===r||t.Mt.u(r.Mt)>0)&&(n.dc=n.dc.Ht(t.targetId,t),n.wc.set(e,t.targetId)),t}))}function Zi(t,e,n){return Object(a.b)(this,void 0,void 0,(function(){var r,i,o,s;return Object(a.d)(this,(function(a){switch(a.label){case 0:r=v(t),i=r.dc.get(e),o=n?"readwrite":"readwrite-primary",a.label=1;case 1:return a.trys.push([1,4,,5]),n?[3,3]:[4,r.persistence.runTransaction("Release target",o,(function(t){return r.persistence.mi.removeTarget(t,i)}))];case 2:a.sent(),a.label=3;case 3:return[3,5];case 4:if(!sr(s=a.sent()))throw s;return c("LocalStore","Failed to update sequence numbers for target "+e+": "+s),[3,5];case 5:return r.dc=r.dc.remove(e),r.wc.delete(i.target),[2]}}))}))}function to(t,e,n){var r=v(t),i=U.min(),o=sn();return r.persistence.runTransaction("Execute query","readonly",(function(t){return function(t,e,n){var r=v(t),i=r.wc.get(n);return void 0!==i?nr.resolve(r.dc.get(i)):r.wo.nr(e,n)}(r,t,te(e)).next((function(e){if(e)return i=e.lastLimboFreeSnapshotVersion,r.wo.ar(t,e.targetId).next((function(t){o=t}))})).next((function(){return r.fc.jr(t,e,n?i:U.min(),n?o:sn())})).next((function(t){return{documents:t,Pc:o}}))}))}function eo(t,e){var n=v(t),r=v(n.wo),i=n.dc.get(e);return i?Promise.resolve(i.target):n.persistence.runTransaction("Get target data","readonly",(function(t){return r.Dn(t,e).next((function(t){return t?t.target:null}))}))}function no(t){var e=v(t);return e.persistence.runTransaction("Get new document changes","readonly",(function(t){return function(t,e,n){var r=v(t),i=Ze(),o=Kr(n),a=Ri(e),s=IDBKeyRange.lowerBound(o,!0);return a.ls({index:kr.readTimeIndex,range:s},(function(t,e){var n=zr(r.Kt,e);i=i.Ht(n.key,n),o=e.readTime})).next((function(){return{gs:i,readTime:Wr(o)}}))}(e.Tc,t,e.Ec)})).then((function(t){var n=t.gs,r=t.readTime;return e.Ec=r,n}))}function ro(t){return Object(a.b)(this,void 0,void 0,(function(){var e;return Object(a.d)(this,(function(n){return[2,(e=v(t)).persistence.runTransaction("Synchronize last document change read time","readonly",(function(t){return function(t){var e=Ri(t),n=U.min();return e.ls({index:kr.readTimeIndex,reverse:!0},(function(t,e,r){e.readTime&&(n=Wr(e.readTime)),r.done()})).next((function(){return n}))}(t)})).then((function(t){e.Ec=t}))]}))}))}function io(t,e,n,r){return Object(a.b)(this,void 0,void 0,(function(){var i,o,s,u,c,l,h,f,p,d;return Object(a.d)(this,(function(a){switch(a.label){case 0:for(i=v(t),o=sn(),s=Ze(),u=on(),c=0,l=n;c=0)return i.To.qs(t,e);var a=r.$t(w.h,o);return i.dc=i.dc.Ht(a.targetId,a),i.wo.Yi(t,a).next((function(){return i.wo.Zi(t,r.targetId)})).next((function(){return i.wo.sr(t,n,r.targetId)})).next((function(){return i.To.qs(t,e)}))}))]}}))}))}var ao=function(){function t(t){this.Kt=t,this.bc=new Map,this.vc=new Map}return t.prototype.Ls=function(t,e){return nr.resolve(this.bc.get(e))},t.prototype.$s=function(t,e){var n;return this.bc.set(e.id,{id:(n=e).id,version:n.version,createTime:kn(n.createTime)}),nr.resolve()},t.prototype.Bs=function(t,e){return nr.resolve(this.vc.get(e))},t.prototype.qs=function(t,e){return this.vc.set(e.name,function(t){return{name:t.name,query:$r(t.bundledQuery),readTime:kn(t.readTime)}}(e)),nr.resolve()},t}(),so=function(){function t(){this.Sc=new Je(uo.Dc),this.Cc=new Je(uo.xc)}return t.prototype.nt=function(){return this.Sc.nt()},t.prototype.ir=function(t,e){var n=new uo(t,e);this.Sc=this.Sc.add(n),this.Cc=this.Cc.add(n)},t.prototype.Nc=function(t,e){var n=this;t.forEach((function(t){return n.ir(t,e)}))},t.prototype.cr=function(t,e){this.Fc(new uo(t,e))},t.prototype.Oc=function(t,e){var n=this;t.forEach((function(t){return n.cr(t,e)}))},t.prototype.kc=function(t){var e=this,n=new H(new q([])),r=new uo(n,t),i=new uo(n,t+1),o=[];return this.Cc.Ae([r,i],(function(t){e.Fc(t),o.push(t.key)})),o},t.prototype.Mc=function(){var t=this;this.Sc.forEach((function(e){return t.Fc(e)}))},t.prototype.Fc=function(t){this.Sc=this.Sc.delete(t),this.Cc=this.Cc.delete(t)},t.prototype.Lc=function(t){var e=new H(new q([])),n=new uo(e,t),r=new uo(e,t+1),i=sn();return this.Cc.Ae([n,r],(function(t){i=i.add(t.key)})),i},t.prototype.Mi=function(t){var e=new uo(t,0),n=this.Sc.Pe(e);return null!==n&&t.isEqual(n.key)},t}(),uo=function(){function t(t,e){this.key=t,this.$c=e}return t.Dc=function(t,e){return H.J(t.key,e.key)||m(t.$c,e.$c)},t.xc=function(t,e){return m(t.$c,e.$c)||H.J(t.key,e.key)},t}(),co=function(){function t(t,e){this.Ii=t,this.mi=e,this.Ho=[],this.Bc=1,this.qc=new Je(uo.Dc)}return t.prototype.Pi=function(t){return nr.resolve(0===this.Ho.length)},t.prototype.yi=function(t,e,n,r){var i=this.Bc;this.Bc++,this.Ho.length>0&&this.Ho[this.Ho.length-1];var o=new Vr(i,e,n,r);this.Ho.push(o);for(var a=0,s=r;ai?this.Ho[i]:null)},t.prototype.bi=function(){return nr.resolve(0===this.Ho.length?-1:this.Bc-1)},t.prototype.vi=function(t){return nr.resolve(this.Ho.slice())},t.prototype.Si=function(t,e){var n=this,r=new uo(e,0),i=new uo(e,Number.POSITIVE_INFINITY),o=[];return this.qc.Ae([r,i],(function(t){var e=n.Uc(t.$c);o.push(e)})),nr.resolve(o)},t.prototype.Di=function(t,e){var n=this,r=new Je(m);return e.forEach((function(t){var e=new uo(t,0),i=new uo(t,Number.POSITIVE_INFINITY);n.qc.Ae([e,i],(function(t){r=r.add(t.$c)}))})),nr.resolve(this.Kc(r))},t.prototype.xi=function(t,e){var n=e.path,r=n.length+1,i=n;H.Et(i)||(i=i.child(""));var o=new uo(new H(i),0),a=new Je(m);return this.qc.Re((function(t){var e=t.key.path;return!!n.st(e)&&(e.length===r&&(a=a.add(t.$c)),!0)}),o),nr.resolve(this.Kc(a))},t.prototype.Kc=function(t){var e=this,n=[];return t.forEach((function(t){var r=e.Uc(t);null!==r&&n.push(r)})),n},t.prototype.Ni=function(t,e){var n=this;d(0===this.Wc(e.batchId,"removed")),this.Ho.shift();var r=this.qc;return nr.forEach(e.mutations,(function(i){var o=new uo(i.key,e.batchId);return r=r.delete(o),n.mi.Oi(t,i.key)})).next((function(){n.qc=r}))},t.prototype.Fi=function(t){},t.prototype.Mi=function(t,e){var n=new uo(e,0),r=this.qc.Pe(n);return nr.resolve(e.isEqual(r&&r.key))},t.prototype.ki=function(t){return this.Ho.length,nr.resolve()},t.prototype.Wc=function(t,e){return this.Qc(t)},t.prototype.Qc=function(t){return 0===this.Ho.length?0:t-this.Ho[0].batchId},t.prototype.Uc=function(t){var e=this.Qc(t);return e<0||e>=this.Ho.length?null:this.Ho[e]},t}(),lo=function(){function t(t,e){this.Ii=t,this.jc=e,this.docs=new Ge(H.J),this.size=0}return t.prototype.hi=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,a=this.jc(e);return this.docs=this.docs.Ht(r,{_i:e,size:a,readTime:n}),this.size+=a-o,this.Ii.Qs(t,r.path.Z())},t.prototype.fi=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},t.prototype.di=function(t,e){var n=this.docs.get(e);return nr.resolve(n?n._i:null)},t.prototype.getEntries=function(t,e){var n=this,r=tn();return e.forEach((function(t){var e=n.docs.get(t);r=r.Ht(t,e?e._i:null)})),nr.resolve(r)},t.prototype.jr=function(t,e,n){for(var r=nn(),i=new H(e.path.child("")),o=this.docs.ne(i);o.ae();){var a=o.ce(),s=a.key,u=a.value,c=u._i,l=u.readTime;if(!e.path.st(s.path))break;l.u(n)<=0||c instanceof Et&&oe(e,c)&&(r=r.Ht(c.key,c))}return nr.resolve(r)},t.prototype.Gc=function(t,e){return nr.forEach(this.docs,(function(t){return e(t)}))},t.prototype.Or=function(t){return new ho(this)},t.prototype.Lr=function(t){return nr.resolve(this.size)},t}(),ho=function(t){function e(e){var n=this;return(n=t.call(this)||this).zr=e,n}return Object(a.c)(e,t),e.prototype.Ti=function(t){var e=this,n=[];return this.ci.forEach((function(r,i){i&&i._i?n.push(e.zr.hi(t,i._i,e.ui(r))):e.zr.fi(r)})),nr.$n(n)},e.prototype.wi=function(t,e){return this.zr.di(t,e)},e.prototype.Ei=function(t,e){return this.zr.getEntries(t,e)},e}(li),fo=function(){function t(t){this.persistence=t,this.zc=new ci((function(t){return Ct(t)}),kt),this.lastRemoteSnapshotVersion=U.min(),this.highestTargetId=0,this.Hc=0,this.Jc=new so,this.targetCount=0,this.Yc=mi.Bi()}return t.prototype.mn=function(t,e){return this.zc.forEach((function(t,n){return e(n)})),nr.resolve()},t.prototype.Wi=function(t){return nr.resolve(this.lastRemoteSnapshotVersion)},t.prototype.ji=function(t){return nr.resolve(this.Hc)},t.prototype.Ui=function(t){return this.highestTargetId=this.Yc.next(),nr.resolve(this.highestTargetId)},t.prototype.Gi=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.Hc&&(this.Hc=e),nr.resolve()},t.prototype.Hi=function(t){this.zc.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.Yc=new mi(e),this.highestTargetId=e),t.sequenceNumber>this.Hc&&(this.Hc=t.sequenceNumber)},t.prototype.zi=function(t,e){return this.Hi(e),this.targetCount+=1,nr.resolve()},t.prototype.Yi=function(t,e){return this.Hi(e),nr.resolve()},t.prototype.Xi=function(t,e){return this.zc.delete(e.target),this.Jc.kc(e.targetId),this.targetCount-=1,nr.resolve()},t.prototype.tr=function(t,e,n){var r=this,i=0,o=[];return this.zc.forEach((function(a,s){s.sequenceNumber<=e&&null===n.get(s.targetId)&&(r.zc.delete(a),o.push(r.Zi(t,s.targetId)),i++)})),nr.$n(o).next((function(){return i}))},t.prototype.er=function(t){return nr.resolve(this.targetCount)},t.prototype.nr=function(t,e){var n=this.zc.get(e)||null;return nr.resolve(n)},t.prototype.sr=function(t,e,n){return this.Jc.Nc(e,n),nr.resolve()},t.prototype.rr=function(t,e,n){this.Jc.Oc(e,n);var r=this.persistence.mi,i=[];return r&&e.forEach((function(e){i.push(r.Oi(t,e))})),nr.$n(i)},t.prototype.Zi=function(t,e){return this.Jc.kc(e),nr.resolve()},t.prototype.ar=function(t,e){var n=this.Jc.Lc(e);return nr.resolve(n)},t.prototype.Mi=function(t,e){return nr.resolve(this.Jc.Mi(e))},t}(),po=function(){function t(t,e){var n=this;this.Xc={},this.ro=new M(0),this.oo=!1,this.oo=!0,this.mi=t(this),this.wo=new fo(this),this.Ii=new ni,this.Eo=function(t,e){return new lo(t,(function(t){return n.mi.Zc(t)}))}(this.Ii),this.Kt=new Br(e),this.To=new ao(this.Kt)}return t.prototype.start=function(){return Promise.resolve()},t.prototype.$o=function(){return this.oo=!1,Promise.resolve()},Object.defineProperty(t.prototype,"Ir",{get:function(){return this.oo},enumerable:!1,configurable:!0}),t.prototype.Vo=function(){},t.prototype.po=function(){},t.prototype.jo=function(){return this.Ii},t.prototype.Wo=function(t){var e=this.Xc[t.R()];return e||(e=new co(this.Ii,this.mi),this.Xc[t.R()]=e),e},t.prototype.Cr=function(){return this.wo},t.prototype.kr=function(){return this.Eo},t.prototype.Go=function(){return this.To},t.prototype.runTransaction=function(t,e,n){var r=this;c("MemoryPersistence","Starting transaction:",t);var i=new vo(this.ro.next());return this.mi.ta(),n(i).next((function(t){return r.mi.ea(i).next((function(){return t}))})).Mn().then((function(t){return i.bs(),t}))},t.prototype.na=function(t,e){return nr.Bn(Object.values(this.Xc).map((function(n){return function(){return n.Mi(t,e)}})))},t}(),vo=function(t){function e(e){var n=this;return(n=t.call(this)||this).Ss=e,n}return Object(a.c)(e,t),e}(yr),yo=function(){function t(t){this.persistence=t,this.sa=new so,this.ia=null}return t.ra=function(e){return new t(e)},Object.defineProperty(t.prototype,"oa",{get:function(){if(this.ia)return this.ia;throw p()},enumerable:!1,configurable:!0}),t.prototype.ir=function(t,e,n){return this.sa.ir(n,e),this.oa.delete(n.toString()),nr.resolve()},t.prototype.cr=function(t,e,n){return this.sa.cr(n,e),this.oa.add(n.toString()),nr.resolve()},t.prototype.Oi=function(t,e){return this.oa.add(e.toString()),nr.resolve()},t.prototype.removeTarget=function(t,e){var n=this;this.sa.kc(e.targetId).forEach((function(t){return n.oa.add(t.toString())}));var r=this.persistence.Cr();return r.ar(t,e.targetId).next((function(t){t.forEach((function(t){return n.oa.add(t.toString())}))})).next((function(){return r.Xi(t,e)}))},t.prototype.ta=function(){this.ia=new Set},t.prototype.ea=function(t){var e=this,n=this.persistence.kr().Or();return nr.forEach(this.oa,(function(r){var i=H.ft(r);return e.ca(t,i).next((function(t){t||n.fi(i)}))})).next((function(){return e.ia=null,n.apply(t)}))},t.prototype.Mr=function(t,e){var n=this;return this.ca(t,e).next((function(t){t?n.oa.delete(e.toString()):n.oa.add(e.toString())}))},t.prototype.Zc=function(t){return 0},t.prototype.ca=function(t,e){var n=this;return nr.Bn([function(){return nr.resolve(n.sa.Mi(e))},function(){return n.persistence.Cr().Mi(t,e)},function(){return n.persistence.na(t,e)}])},t}();function go(t,e){return"firestore_clients_"+t+"_"+e}function mo(t,e,n){var r="firestore_mutations_"+t+"_"+n;return e.A()&&(r+="_"+e.uid),r}function bo(t,e){return"firestore_targets_"+t+"_"+e}var _o=function(){function t(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}return t.aa=function(e,n,r){var i=JSON.parse(r),o="object"==typeof i&&-1!==["pending","acknowledged","rejected"].indexOf(i.state)&&(void 0===i.error||"object"==typeof i.error),a=void 0;return o&&i.error&&(o="string"==typeof i.error.message&&"string"==typeof i.error.code)&&(a=new T(i.error.code,i.error.message)),o?new t(e,n,i.state,a):(l("SharedClientState","Failed to parse mutation state for ID '"+n+"': "+r),null)},t.prototype.ua=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},t}(),wo=function(){function t(t,e,n){this.targetId=t,this.state=e,this.error=n}return t.aa=function(e,n){var r=JSON.parse(n),i="object"==typeof r&&-1!==["not-current","current","rejected"].indexOf(r.state)&&(void 0===r.error||"object"==typeof r.error),o=void 0;return i&&r.error&&(i="string"==typeof r.error.message&&"string"==typeof r.error.code)&&(o=new T(r.error.code,r.error.message)),i?new t(e,r.state,o):(l("SharedClientState","Failed to parse target state for ID '"+e+"': "+n),null)},t.prototype.ua=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},t}(),Eo=function(){function t(t,e){this.clientId=t,this.activeTargetIds=e}return t.aa=function(e,n){for(var r=JSON.parse(n),i="object"==typeof r&&r.activeTargetIds instanceof Array,o=cn(),a=0;i&&a0){var r=s.getResponseJson().error;if(r&&r.status&&r.message){var u=function(t){var e=t.toLowerCase().replace(/_/g,"-");return Object.values(E).indexOf(e)>=0?e:E.UNKNOWN}(r.status);a(new T(u,r.message))}else a(new T(E.UNKNOWN,"Server responded with status "+s.getStatus()))}else a(new T(E.UNAVAILABLE,"Connection failed."));break;default:p()}}finally{c("Connection",'RPC "'+t+'" completed.')}}));var u=JSON.stringify(r);s.send(e,"POST",u,n,15)}))},e.prototype.xu=function(t,e){var n=[this.Vu,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=Object(o.g)(),a=Object(o.h)(),s={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.T.projectId+"/databases/"+this.T.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.I};this.Su(s.initMessageHeaders,e),Object(i.x)()||Object(i.A)()||Object(i.t)()||Object(i.v)()||Object(i.B)()||Object(i.s)()||(s.httpHeadersOverwriteParam="$httpHeaders");var u=n.join("");c("Connection","Creating WebChannel: "+u,s);var l=r.createWebChannel(u,s),f=!1,p=!1,v=new Ao({du:function(t){p?c("Connection","Not sending because WebChannel is closed:",t):(f||(c("Connection","Opening WebChannel transport."),l.open(),f=!0),c("Connection","WebChannel sending:",t),l.send(t))},wu:function(){return l.close()}}),y=function(t,e,n){t.listen(e,(function(t){try{n(t)}catch(t){setTimeout((function(){throw t}),0)}}))};return y(l,o.e.EventType.OPEN,(function(){p||c("Connection","WebChannel transport opened.")})),y(l,o.e.EventType.CLOSE,(function(){p||(p=!0,c("Connection","WebChannel transport closed"),v.Pu())})),y(l,o.e.EventType.ERROR,(function(t){p||(p=!0,h("Connection","WebChannel transport errored:",t),v.Pu(new T(E.UNAVAILABLE,"The operation could not be completed")))})),y(l,o.e.EventType.MESSAGE,(function(t){var e;if(!p){var n=t.data[0];d(!!n);var r=n,i=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(i){c("Connection","WebChannel received error:",i);var o=i.status,a=function(t){var e=Ve[t];if(void 0!==e)return We(e)}(o),s=i.message;void 0===a&&(a=E.INTERNAL,s="Unknown error status: "+o+" with message "+i.message),p=!0,v.Pu(new T(a,s)),l.close()}else c("Connection","WebChannel received:",n),v.yu(n)}})),y(a,o.b.STAT_EVENT,(function(t){t.stat===o.d.PROXY?c("Connection","Detected buffering proxy"):t.stat===o.d.NOPROXY&&c("Connection","Detected no buffering proxy")})),setTimeout((function(){v.Ru()}),0),v},e}(function(){function t(t){this.gu=t,this.T=t.T;var e=t.ssl?"https":"http";this.Vu=e+"://"+t.host,this.pu="projects/"+this.T.projectId+"/databases/"+this.T.database+"/documents"}return t.prototype.bu=function(t,e,n,r){var i=this.vu(t,e);c("RestConnection","Sending: ",i,n);var o={};return this.Su(o,r),this.Du(t,i,o,n).then((function(t){return c("RestConnection","Received: ",t),t}),(function(e){throw h("RestConnection",t+" failed with error: ",e,"url: ",i,"request:",n),e}))},t.prototype.Cu=function(t,e,n,r){return this.bu(t,e,n,r)},t.prototype.Su=function(t,e){if(t["X-Goog-Api-Client"]="gl-js/ fire/8.2.1",t["Content-Type"]="text/plain",e)for(var n in e.V)e.V.hasOwnProperty(n)&&(t[n]=e.V[n])},t.prototype.vu=function(t,e){var n=No[t];return this.Vu+"/v1/"+e+":"+n},t}());function Ro(){return"undefined"!=typeof window?window:null}function xo(){return"undefined"!=typeof document?document:null}function jo(t){return new In(t,!0)}var Do=function(){function t(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.no=t,this.ds=e,this.Nu=n,this.Fu=r,this.Ou=i,this.ku=0,this.Mu=null,this.Lu=Date.now(),this.reset()}return t.prototype.reset=function(){this.ku=0},t.prototype.$u=function(){this.ku=this.Ou},t.prototype.Bu=function(t){var e=this;this.cancel();var n=Math.floor(this.ku+this.qu()),r=Math.max(0,Date.now()-this.Lu),i=Math.max(0,n-r);i>0&&c("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.ku+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.Mu=this.no.mr(this.ds,i,(function(){return e.Lu=Date.now(),t()})),this.ku*=this.Fu,this.kuthis.Ou&&(this.ku=this.Ou)},t.prototype.Uu=function(){null!==this.Mu&&(this.Mu.Ps(),this.Mu=null)},t.prototype.cancel=function(){null!==this.Mu&&(this.Mu.cancel(),this.Mu=null)},t.prototype.qu=function(){return(Math.random()-.5)*this.ku},t}(),Lo=function(){function t(t,e,n,r,i,o){this.no=t,this.Qu=n,this.Ku=r,this.Wu=i,this.listener=o,this.state=0,this.ju=0,this.Gu=null,this.stream=null,this.zu=new Do(t,e)}return t.prototype.Hu=function(){return 1===this.state||2===this.state||4===this.state},t.prototype.Ju=function(){return 2===this.state},t.prototype.start=function(){3!==this.state?this.auth():this.Yu()},t.prototype.stop=function(){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(t){switch(t.label){case 0:return this.Hu()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},t.prototype.Xu=function(){this.state=0,this.zu.reset()},t.prototype.Zu=function(){var t=this;this.Ju()&&null===this.Gu&&(this.Gu=this.no.mr(this.Qu,6e4,(function(){return t.th()})))},t.prototype.eh=function(t){this.nh(),this.stream.send(t)},t.prototype.th=function(){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(t){return this.Ju()?[2,this.close(0)]:[2]}))}))},t.prototype.nh=function(){this.Gu&&(this.Gu.cancel(),this.Gu=null)},t.prototype.close=function(t,e){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(n){switch(n.label){case 0:return this.nh(),this.zu.cancel(),this.ju++,3!==t?this.zu.reset():e&&e.code===E.RESOURCE_EXHAUSTED?(l(e.toString()),l("Using maximum backoff delay to prevent overloading the backend."),this.zu.$u()):e&&e.code===E.UNAUTHENTICATED&&this.Wu.v(),null!==this.stream&&(this.sh(),this.stream.close(),this.stream=null),this.state=t,[4,this.listener.Iu(e)];case 1:return n.sent(),[2]}}))}))},t.prototype.sh=function(){},t.prototype.auth=function(){var t=this;this.state=1;var e=this.ih(this.ju),n=this.ju;this.Wu.getToken().then((function(e){t.ju===n&&t.rh(e)}),(function(n){e((function(){var e=new T(E.UNKNOWN,"Fetching auth token failed: "+n.message);return t.oh(e)}))}))},t.prototype.rh=function(t){var e=this,n=this.ih(this.ju);this.stream=this.ah(t),this.stream.Eu((function(){n((function(){return e.state=2,e.listener.Eu()}))})),this.stream.Iu((function(t){n((function(){return e.oh(t)}))})),this.stream.onMessage((function(t){n((function(){return e.onMessage(t)}))}))},t.prototype.Yu=function(){var t=this;this.state=4,this.zu.Bu((function(){return Object(a.b)(t,void 0,void 0,(function(){return Object(a.d)(this,(function(t){return this.state=0,this.start(),[2]}))}))}))},t.prototype.oh=function(t){return c("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},t.prototype.ih=function(t){var e=this;return function(n){e.no.ys((function(){return e.ju===t?n():(c("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())}))}},t}(),Mo=function(t){function e(e,n,r,i,o){var a=this;return(a=t.call(this,e,"listen_stream_connection_backoff","listen_stream_idle",n,r,o)||this).Kt=i,a}return Object(a.c)(e,t),e.prototype.ah=function(t){return this.Ku.xu("Listen",t)},e.prototype.onMessage=function(t){this.zu.reset();var e=function(t,e){var n;if("targetChange"in e){e.targetChange;var r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:p()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],o=function(t,e){return t.qt?(d(void 0===e||"string"==typeof e),w.fromBase64String(e||"")):(d(void 0===e||e instanceof Uint8Array),w.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),a=(s=e.targetChange.cause)&&function(t){var e=void 0===t.code?E.UNKNOWN:We(t.code);return new T(e,t.message||"")}(s);n=new gn(r,i,o,a||null)}else if("documentChange"in e){e.documentChange,(r=e.documentChange).document,r.document.name,r.document.updateTime,i=Rn(t,r.document.name),o=kn(r.document.updateTime);var s=new mt({mapValue:{fields:r.document.fields}}),u=(a=new Et(i,o,s,{}),r.targetIds||[]),c=r.removedTargetIds||[];n=new vn(u,c,a.key,a)}else if("documentDelete"in e)e.documentDelete,(r=e.documentDelete).document,i=Rn(t,r.document),o=r.readTime?kn(r.readTime):U.min(),s=new Tt(i,o),a=r.removedTargetIds||[],n=new vn([],a,s.key,s);else if("documentRemove"in e)e.documentRemove,(r=e.documentRemove).document,i=Rn(t,r.document),o=r.removedTargetIds||[],n=new vn([],o,i,null);else{if(!("filter"in e))return p();e.filter;var l=e.filter;l.targetId,r=l.count||0,i=new He(r),o=l.targetId,n=new yn(o,i)}return n}(this.Kt,t),n=function(t){if(!("targetChange"in t))return U.min();var e=t.targetChange;return e.targetIds&&e.targetIds.length?U.min():e.readTime?kn(e.readTime):U.min()}(t);return this.listener.uh(e,n)},e.prototype.hh=function(t){var e={};e.database=Dn(this.Kt),e.addTarget=function(t,e){var n,r=e.target;return(n=Nt(r)?{documents:qn(t,r)}:{query:Bn(t,r)}).targetId=e.targetId,e.resumeToken.o()>0?n.resumeToken=On(t,e.resumeToken):e.Mt.u(U.min())>0&&(n.readTime=Sn(t,e.Mt.G())),n}(this.Kt,t);var n=function(t,e){var n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return p()}}(0,e.kt);return null==n?null:{"goog-listen-tags":n}}(this.Kt,t);n&&(e.labels=n),this.eh(e)},e.prototype.lh=function(t){var e={};e.database=Dn(this.Kt),e.removeTarget=t,this.eh(e)},e}(Lo),Fo=function(t){function e(e,n,r,i,o){var a=this;return(a=t.call(this,e,"write_stream_connection_backoff","write_stream_idle",n,r,o)||this).Kt=i,a._h=!1,a}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"fh",{get:function(){return this._h},enumerable:!1,configurable:!0}),e.prototype.start=function(){this._h=!1,this.lastStreamToken=void 0,t.prototype.start.call(this)},e.prototype.sh=function(){this._h&&this.dh([])},e.prototype.ah=function(t){return this.Ku.xu("Write",t)},e.prototype.onMessage=function(t){if(d(!!t.streamToken),this.lastStreamToken=t.streamToken,this._h){this.zu.reset();var e=function(t,e){return t&&t.length>0?(d(void 0!==e),t.map((function(t){return function(t,e){var n=t.updateTime?kn(t.updateTime):kn(e);n.isEqual(U.min())&&(n=kn(e));var r=null;return t.transformResults&&t.transformResults.length>0&&(r=t.transformResults),new Se(n,r)}(t,e)}))):[]}(t.writeResults,t.commitTime),n=kn(t.commitTime);return this.listener.wh(n,e)}return d(!t.writeResults||0===t.writeResults.length),this._h=!0,this.listener.Eh()},e.prototype.Th=function(){var t={};t.database=Dn(this.Kt),this.eh(t)},e.prototype.dh=function(t){var e=this,n={streamToken:this.lastStreamToken,writes:t.map((function(t){return Un(e.Kt,t)}))};this.eh(n)},e}(Lo),Uo=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).credentials=e,i.Ku=n,i.Kt=r,i.Ih=!1,i}return Object(a.c)(e,t),e.prototype.mh=function(){if(this.Ih)throw new T(E.FAILED_PRECONDITION,"The client has already been terminated.")},e.prototype.bu=function(t,e,n){var r=this;return this.mh(),this.credentials.getToken().then((function(i){return r.Ku.bu(t,e,n,i)})).catch((function(t){throw t.code===E.UNAUTHENTICATED&&r.credentials.v(),t}))},e.prototype.Cu=function(t,e,n){var r=this;return this.mh(),this.credentials.getToken().then((function(i){return r.Ku.Cu(t,e,n,i)})).catch((function(t){throw t.code===E.UNAUTHENTICATED&&r.credentials.v(),t}))},e.prototype.terminate=function(){this.Ih=!1},e}((function(){})),Vo=function(){function t(t,e){this.fs=t,this.da=e,this.state="Unknown",this.Ah=0,this.Rh=null,this.Ph=!0}return t.prototype.yh=function(){var t=this;0===this.Ah&&(this.gh("Unknown"),this.Rh=this.fs.mr("online_state_timeout",1e4,(function(){return t.Rh=null,t.Vh("Backend didn't respond within 10 seconds."),t.gh("Offline"),Promise.resolve()})))},t.prototype.ph=function(t){"Online"===this.state?this.gh("Unknown"):(this.Ah++,this.Ah>=1&&(this.bh(),this.Vh("Connection failed 1 times. Most recent error: "+t.toString()),this.gh("Offline")))},t.prototype.set=function(t){this.bh(),this.Ah=0,"Online"===t&&(this.Ph=!1),this.gh(t)},t.prototype.gh=function(t){t!==this.state&&(this.state=t,this.da(t))},t.prototype.Vh=function(t){var e="Could not reach Cloud Firestore backend. "+t+"\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.Ph?(l(e),this.Ph=!1):c("OnlineStateTracker",e)},t.prototype.bh=function(){null!==this.Rh&&(this.Rh.cancel(),this.Rh=null)},t}(),qo=function(t,e,n,r,i){var o=this;this.Sh=t,this.Dh=e,this.fs=n,this.Ch={},this.xh=[],this.Nh=new Map,this.Fh=new Set,this.Oh=[],this.kh=i,this.kh.cu((function(t){n.ys((function(){return Object(a.b)(o,void 0,void 0,(function(){return Object(a.d)(this,(function(t){switch(t.label){case 0:return Jo(this)?(c("RemoteStore","Restarting streams for network reachability change."),[4,function(t){return Object(a.b)(this,void 0,void 0,(function(){var e;return Object(a.d)(this,(function(n){switch(n.label){case 0:return(e=v(t)).Fh.add(4),[4,zo(e)];case 1:return n.sent(),e.Mh.set("Unknown"),e.Fh.delete(4),[4,Bo(e)];case 2:return n.sent(),[2]}}))}))}(this)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))}))})),this.Mh=new Vo(n,r)};function Bo(t){return Object(a.b)(this,void 0,void 0,(function(){var e,n;return Object(a.d)(this,(function(r){switch(r.label){case 0:if(!Jo(t))return[3,4];e=0,n=t.Oh,r.label=1;case 1:return e0}function Jo(t){return 0===v(t).Fh.size}function Xo(t){t.Lh=void 0}function $o(t){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(e){return t.Nh.forEach((function(e,n){Wo(t,e)})),[2]}))}))}function Zo(t,e){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(n){return Xo(t),Yo(t)?(t.Mh.ph(e),Qo(t)):t.Mh.set("Unknown"),[2]}))}))}function ta(t,e,n){return Object(a.b)(this,void 0,void 0,(function(){var r,i,o;return Object(a.d)(this,(function(s){switch(s.label){case 0:if(t.Mh.set("Online"),!(e instanceof gn&&2===e.state&&e.cause))return[3,6];s.label=1;case 1:return s.trys.push([1,3,,5]),[4,function(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n,r,i,o;return Object(a.d)(this,(function(a){switch(a.label){case 0:n=e.cause,r=0,i=e.targetIds,a.label=1;case 1:return r=0?[4,function(t,e){var n=t.Lh.pn(e);return n.Oe.forEach((function(n,r){if(n.resumeToken.o()>0){var i=t.Nh.get(r);i&&t.Nh.set(r,i.$t(n.resumeToken,e))}})),n.ke.forEach((function(e){var n=t.Nh.get(e);if(n){t.Nh.set(e,n.$t(w.h,n.Mt)),Go(t,e);var r=new ue(n.target,e,1,n.sequenceNumber);Wo(t,r)}})),t.Ch.Bh(n)}(t,n)]:[3,10];case 9:s.sent(),s.label=10;case 10:return[3,13];case 11:return c("RemoteStore","Failed to raise snapshot:",o=s.sent()),[4,ea(t,o)];case 12:return s.sent(),[3,13];case 13:return[2]}}))}))}function ea(t,e,n){return Object(a.b)(this,void 0,void 0,(function(){var r=this;return Object(a.d)(this,(function(i){switch(i.label){case 0:if(!sr(e))throw e;return t.Fh.add(1),[4,zo(t)];case 1:return i.sent(),t.Mh.set("Offline"),n||(n=function(){return Qi(t.Sh)}),t.fs.vo((function(){return Object(a.b)(r,void 0,void 0,(function(){return Object(a.d)(this,(function(e){switch(e.label){case 0:return c("RemoteStore","Retrying IndexedDB access"),[4,n()];case 1:return e.sent(),t.Fh.delete(1),[4,Bo(t)];case 2:return e.sent(),[2]}}))}))})),[2]}}))}))}function na(t,e){return e().catch((function(n){return ea(t,n,e)}))}function ra(t){return Object(a.b)(this,void 0,void 0,(function(){var e,n,r,i,o;return Object(a.d)(this,(function(a){switch(a.label){case 0:e=v(t),n=fa(e),r=e.xh.length>0?e.xh[e.xh.length-1].batchId:-1,a.label=1;case 1:if(!function(t){return Jo(t)&&t.xh.length<10}(e))return[3,7];a.label=2;case 2:return a.trys.push([2,4,,6]),[4,Xi(e.Sh,r)];case 3:return null===(i=a.sent())?(0===e.xh.length&&n.Zu(),[3,7]):(r=i.batchId,function(t,e){t.xh.push(e);var n=fa(t);n.Ju()&&n.fh&&n.dh(e.mutations)}(e,i),[3,6]);case 4:return o=a.sent(),[4,ea(e,o)];case 5:return a.sent(),[3,6];case 6:return[3,1];case 7:return ia(e)&&oa(e),[2]}}))}))}function ia(t){return Jo(t)&&!fa(t).Hu()&&t.xh.length>0}function oa(t){fa(t).start()}function aa(t){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(e){return fa(t).Th(),[2]}))}))}function sa(t){return Object(a.b)(this,void 0,void 0,(function(){var e,n,r,i;return Object(a.d)(this,(function(o){for(e=fa(t),n=0,r=t.xh;n0&&(c("RemoteStore","Stopping write stream with "+t.xh.length+" pending writes"),t.xh=[]),e.label=4;case 4:return[2]}}))}))}))),t.Kh}var pa=function(){this.Wh=void 0,this.listeners=[]},da=function(){this.queries=new ci((function(t){return re(t)}),ne),this.onlineState="Unknown",this.jh=new Set};function va(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n,r,i,o,s,u,c;return Object(a.d)(this,(function(a){switch(a.label){case 0:if(n=v(t),r=e.query,i=!1,(o=n.queries.get(r))||(i=!0,o=new pa),!i)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),s=o,[4,n.Gh(r)];case 2:return s.Wh=a.sent(),[3,4];case 3:return u=a.sent(),c=pr(u,"Initialization of query '"+ie(e.query)+"' failed"),[2,void e.onError(c)];case 4:return n.queries.set(r,o),o.listeners.push(e),e.zh(n.onlineState),o.Wh&&e.Hh(o.Wh)&&ba(n),[2]}}))}))}function ya(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n,r,i,o,s;return Object(a.d)(this,(function(a){return n=v(t),r=e.query,i=!1,(o=n.queries.get(r))&&(s=o.listeners.indexOf(e))>=0&&(o.listeners.splice(s,1),i=0===o.listeners.length),i?[2,(n.queries.delete(r),n.Jh(r))]:[2]}))}))}function ga(t,e){for(var n=v(t),r=!1,i=0,o=e;i0)return!0;var e=this.Zh&&this.Zh.hasPendingWrites!==t.hasPendingWrites;return!(!t.xe&&!e)&&!0===this.options.includeMetadataChanges},t.prototype.nl=function(t){t=fn.Fe(t.query,t.docs,t.Ce,t.fromCache),this.Xh=!0,this.Yh.next(t)},t}(),wa=function(){function t(t,e){this.payload=t,this.byteLength=e}return t.prototype.il=function(){return"metadata"in this.payload},t}(),Ea=function(){function t(t){this.Kt=t}return t.prototype.yc=function(t){return Rn(this.Kt,t)},t.prototype.gc=function(t){return t.metadata.exists?Fn(this.Kt,t.document,!1):new Tt(this.yc(t.metadata.name),this.Vc(t.metadata.readTime))},t.prototype.Vc=function(t){return kn(t)},t}(),Ta=function(){function t(t,e,n){this.rl=t,this.Sh=e,this.Kt=n,this.queries=[],this.documents=[],this.progress=Ia(t)}return t.prototype.ol=function(t){this.progress.bytesLoaded+=t.byteLength;var e=this.progress.documentsLoaded;return t.payload.namedQuery?this.queries.push(t.payload.namedQuery):t.payload.documentMetadata?(this.documents.push({metadata:t.payload.documentMetadata}),t.payload.documentMetadata.exists||++e):t.payload.document&&(this.documents[this.documents.length-1].document=t.payload.document,++e),e!==this.progress.documentsLoaded?(this.progress.documentsLoaded=e,Object.assign({},this.progress)):null},t.prototype.cl=function(t){for(var e=new Map,n=new Ea(this.Kt),r=0,i=t;r0||c&&n.ll(h,c)<0)&&(s=!0)):!l&&h?(r.track({type:0,doc:h}),d=!0):l&&!h&&(r.track({type:1,doc:l}),d=!0,(u||c)&&(s=!0)),d&&(h?(a=a.add(h),o=p?o.add(t):o.delete(t)):(a=a.delete(t),o=o.delete(t)))})),Qt(this.query)||Yt(this.query))for(;a.size>this.query.limit;){var l=Qt(this.query)?a.last():a.first();a=a.delete(l.key),o=o.delete(l.key),r.track({type:1,doc:l})}return{_l:a,wl:r,_c:s,Ce:o}},t.prototype.El=function(t,e){return t.bt&&e.hasCommittedMutations&&!e.bt},t.prototype.Ti=function(t,e,n){var r=this,i=this._l;this._l=t._l,this.Ce=t.Ce;var o=t.wl.Se();o.sort((function(t,e){return function(t,e){var n=function(t){switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return p()}};return n(t)-n(e)}(t.type,e.type)||r.ll(t.doc,e.doc)})),this.Tl(n);var a=e?this.Il():[],s=0===this.hl.size&&this.qe?1:0,u=s!==this.ul;return this.ul=s,0!==o.length||u?{snapshot:new fn(this.query,t._l,i,o,t.Ce,0===s,u,!1),ml:a}:{ml:a}},t.prototype.zh=function(t){return this.qe&&"Offline"===t?(this.qe=!1,this.Ti({_l:this._l,wl:new hn,Ce:this.Ce,_c:!1},!1)):{ml:[]}},t.prototype.Al=function(t){return!this.al.has(t)&&!!this._l.has(t)&&!this._l.get(t).bt},t.prototype.Tl=function(t){var e=this;t&&(t.Ue.forEach((function(t){return e.al=e.al.add(t)})),t.Qe.forEach((function(t){})),t.Ke.forEach((function(t){return e.al=e.al.delete(t)})),this.qe=t.qe)},t.prototype.Il=function(){var t=this;if(!this.qe)return[];var e=this.hl;this.hl=sn(),this._l.forEach((function(e){t.Al(e.key)&&(t.hl=t.hl.add(e.key))}));var n=[];return e.forEach((function(e){t.hl.has(e)||n.push(new Oa(e))})),this.hl.forEach((function(t){e.has(t)||n.push(new Sa(t))})),n},t.prototype.Rl=function(t){this.al=t.Pc,this.hl=sn();var e=this.dl(t.documents);return this.Ti(e,!0)},t.prototype.Pl=function(){return fn.Fe(this.query,this._l,this.Ce,0===this.ul)},t}(),ka=function(t,e,n){this.query=t,this.targetId=e,this.view=n},Na=function(t){this.key=t,this.yl=!1},Aa=function(){function t(t,e,n,r,i,o){this.Sh=t,this.gl=e,this.Vl=n,this.pl=r,this.currentUser=i,this.bl=o,this.vl={},this.Sl=new ci((function(t){return re(t)}),ne),this.Dl=new Map,this.Cl=[],this.xl=new Ge(H.J),this.Nl=new Map,this.Fl=new so,this.Ol={},this.kl=new Map,this.Ml=mi.qi(),this.onlineState="Unknown",this.Ll=void 0}return Object.defineProperty(t.prototype,"$l",{get:function(){return!0===this.Ll},enumerable:!1,configurable:!0}),t}();function Pa(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n,r,i,o,s,u;return Object(a.d)(this,(function(a){switch(a.label){case 0:return n=as(t),(o=n.Sl.get(e))?(r=o.targetId,n.pl.ka(r),i=o.view.Pl(),[3,4]):[3,1];case 1:return[4,$i(n.Sh,te(e))];case 2:return s=a.sent(),u=n.pl.ka(s.targetId),r=s.targetId,[4,Ra(n,e,r,"current"===u)];case 3:i=a.sent(),n.$l&&Ho(n.gl,s),a.label=4;case 4:return[2,i]}}))}))}function Ra(t,e,n,r){return Object(a.b)(this,void 0,void 0,(function(){var i,o,s,u,c,l;return Object(a.d)(this,(function(h){switch(h.label){case 0:return t.Bl=function(e,n,r){return function(t,e,n,r){return Object(a.b)(this,void 0,void 0,(function(){var i,o,s;return Object(a.d)(this,(function(a){switch(a.label){case 0:return(i=e.view.dl(n))._c?[4,to(t.Sh,e.query,!1).then((function(t){var n=t.documents;return e.view.dl(n,i)}))]:[3,2];case 1:i=a.sent(),a.label=2;case 2:return o=r&&r.Oe.get(e.targetId),s=e.view.Ti(i,t.$l,o),[2,(Ka(t,e.targetId,s.ml),s.snapshot)]}}))}))}(t,e,n,r)},[4,to(t.Sh,e,!0)];case 1:return i=h.sent(),o=new Ca(e,i.Pc),s=o.dl(i.documents),u=dn.Be(n,r&&"Offline"!==t.onlineState),c=o.Ti(s,t.$l,u),Ka(t,n,c.ml),l=new ka(e,n,o),[2,(t.Sl.set(e,l),t.Dl.has(n)?t.Dl.get(n).push(e):t.Dl.set(n,[e]),c.snapshot)]}}))}))}function xa(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n,r,i;return Object(a.d)(this,(function(o){switch(o.label){case 0:return n=v(t),r=n.Sl.get(e),(i=n.Dl.get(r.targetId)).length>1?[2,(n.Dl.set(r.targetId,i.filter((function(t){return!ne(t,e)}))),void n.Sl.delete(e))]:n.$l?(n.pl.La(r.targetId),n.pl.Ca(r.targetId)?[3,2]:[4,Zi(n.Sh,r.targetId,!1).then((function(){n.pl.Ba(r.targetId),Ko(n.gl,r.targetId),za(n,r.targetId)})).catch(ui)]):[3,3];case 1:o.sent(),o.label=2;case 2:return[3,5];case 3:return za(n,r.targetId),[4,Zi(n.Sh,r.targetId,!0)];case 4:o.sent(),o.label=5;case 5:return[2]}}))}))}function ja(t,e,n){return Object(a.b)(this,void 0,void 0,(function(){var r,i,o,s;return Object(a.d)(this,(function(a){switch(a.label){case 0:r=ss(t),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,function(t,e){var n,r=v(t),i=F.now(),o=e.reduce((function(t,e){return t.add(e.key)}),sn());return r.persistence.runTransaction("Locally write mutations","readwrite",(function(t){return r.Ic.Zo(t,o).next((function(o){n=o;for(var a=[],s=0,u=e;s0?r.yl=!0:t.Qe.size>0?d(r.yl):t.Ke.size>0&&(d(r.yl),r.yl=!1))})),[4,Qa(n,r,e)];case 3:return i.sent(),[3,6];case 4:return[4,ui(i.sent())];case 5:return i.sent(),[3,6];case 6:return[2]}}))}))}function La(t,e,n){var r=v(t);if(r.$l&&0===n||!r.$l&&1===n){var i=[];r.Sl.forEach((function(t,n){var r=n.view.zh(e);r.snapshot&&i.push(r.snapshot)})),function(t,e){var n=v(t);n.onlineState=e;var r=!1;n.queries.forEach((function(t,n){for(var i=0,o=n.listeners;i0&&t.xl.size=0}))}(t.Sh,r)];case 2:return a.sent()?[4,e.close()]:[3,4];case 3:return[2,(a.sent(),void n.Ul(function(t){return{taskState:"Success",documentsLoaded:t.totalDocuments,bytesLoaded:t.totalBytes,totalDocuments:t.totalDocuments,totalBytes:t.totalBytes}}(r)))];case 4:return n.Ql(Ia(r)),i=new Ta(r,t.Sh,e.Kt),[4,e.Kl()];case 5:o=a.sent(),a.label=6;case 6:return o?[4,i.ol(o)]:[3,10];case 7:return(s=a.sent())&&n.Ql(s),[4,e.Kl()];case 8:o=a.sent(),a.label=9;case 9:return[3,6];case 10:return[4,i.complete()];case 11:return u=a.sent(),[4,Qa(t,u.gs,void 0)];case 12:return a.sent(),[4,function(t,e){var n=v(t);return n.persistence.runTransaction("Save bundle","readwrite",(function(t){return n.To.$s(t,e)}))}(t.Sh,r)];case 13:return a.sent(),n.Ul(u.progress),[3,15];case 14:return h("SyncEngine","Loading bundle failed with "+(c=a.sent())),n.Wl(c),[3,15];case 15:return[2]}}))}))})(r,e,n).then((function(){r.pl.ja()}))}var cs=function(){function t(){this.synchronizeTabs=!1}return t.prototype.initialize=function(t){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(e){switch(e.label){case 0:return this.Kt=jo(t.gu.T),this.pl=this.jl(t),this.persistence=this.Gl(t),[4,this.persistence.start()];case 1:return e.sent(),this.zl=this.Hl(t),this.Sh=this.Jl(t),[2]}}))}))},t.prototype.Hl=function(t){return null},t.prototype.Jl=function(t){return Ki(this.persistence,new zi,t.Yl,this.Kt)},t.prototype.Gl=function(t){return new po(yo.ra,this.Kt)},t.prototype.jl=function(t){return new Oo},t.prototype.terminate=function(){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(t){switch(t.label){case 0:return this.zl&&this.zl.stop(),[4,this.pl.$o()];case 1:return t.sent(),[4,this.persistence.$o()];case 2:return t.sent(),[2]}}))}))},t}(),ls=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).Xl=e,i.cacheSizeBytes=n,i.forceOwnership=r,i.synchronizeTabs=!1,i}return Object(a.c)(e,t),e.prototype.initialize=function(e){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(n){switch(n.label){case 0:return[4,t.prototype.initialize.call(this,e)];case 1:return n.sent(),[4,ro(this.Sh)];case 2:return n.sent(),[4,this.Xl.initialize(this,e)];case 3:return n.sent(),[4,ss(this.Xl.fa)];case 4:return n.sent(),[4,ra(this.Xl.gl)];case 5:return n.sent(),[2]}}))}))},e.prototype.Jl=function(t){return Ki(this.persistence,new zi,t.Yl,this.Kt)},e.prototype.Hl=function(t){var e=this.persistence.mi.dr;return new Si(e,t.fs)},e.prototype.Gl=function(t){var e=Vi(t.gu.T,t.gu.persistenceKey),n=void 0!==this.cacheSizeBytes?si.Zs(this.cacheSizeBytes):si.ni;return new Mi(this.synchronizeTabs,e,t.clientId,n,t.fs,Ro(),xo(),this.Kt,this.pl,!!this.forceOwnership)},e.prototype.jl=function(t){return new Oo},e}(cs),hs=function(t){function e(e,n){var r=this;return(r=t.call(this,e,n,!1)||this).Xl=e,r.cacheSizeBytes=n,r.synchronizeTabs=!0,r}return Object(a.c)(e,t),e.prototype.initialize=function(e){return Object(a.b)(this,void 0,void 0,(function(){var n,r=this;return Object(a.d)(this,(function(i){switch(i.label){case 0:return[4,t.prototype.initialize.call(this,e)];case 1:return i.sent(),n=this.Xl.fa,this.pl instanceof So?(this.pl.fa={nu:Za.bind(null,n),su:is.bind(null,n),iu:os.bind(null,n),Ko:rs.bind(null,n),eu:$a.bind(null,n)},[4,this.pl.start()]):[3,3];case 2:i.sent(),i.label=3;case 3:return[4,this.persistence.yo((function(t){return Object(a.b)(r,void 0,void 0,(function(){return Object(a.d)(this,(function(e){switch(e.label){case 0:return[4,ts(this.Xl.fa,t)];case 1:return e.sent(),this.zl&&(t&&!this.zl.Ir?this.zl.start(this.Sh):t||this.zl.stop()),[2]}}))}))}))];case 4:return i.sent(),[2]}}))}))},e.prototype.jl=function(t){var e=Ro();if(!So.Wn(e))throw new T(E.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var n=Vi(t.gu.T,t.gu.persistenceKey);return new So(e,t.fs,n,t.clientId,t.Yl)},e}(ls),fs=function(){function t(){}return t.prototype.initialize=function(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n=this;return Object(a.d)(this,(function(r){switch(r.label){case 0:return this.Sh?[3,2]:(this.Sh=t.Sh,this.pl=t.pl,this.Dh=this.Zl(e),this.gl=this.t_(e),this.Vl=this.e_(e),this.fa=this.n_(e,!t.synchronizeTabs),this.pl.da=function(t){return La(n.fa,t,1)},this.gl.Ch.s_=Ya.bind(null,this.fa),[4,la(this.gl,this.fa.$l)]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.e_=function(t){return new da},t.prototype.Zl=function(t){var e,n=jo(t.gu.T),r=(e=t.gu,new Po(e));return function(t,e,n){return new Uo(t,e,n)}(t.credentials,r,n)},t.prototype.t_=function(t){var e,n,r,i,o,a=this;return e=this.Sh,n=this.Dh,r=t.fs,i=function(t){return La(a.fa,t,0)},o=ko.Wn()?new ko:new Co,new qo(e,n,r,i,o)},t.prototype.n_=function(t,e){return function(t,e,n,r,i,o,a){var s=new Aa(t,e,n,r,i,o);return a&&(s.Ll=!0),s}(this.Sh,this.gl,this.Vl,this.pl,t.Yl,t.bl,e)},t.prototype.terminate=function(){return function(t){return Object(a.b)(this,void 0,void 0,(function(){var e;return Object(a.d)(this,(function(n){switch(n.label){case 0:return e=v(t),c("RemoteStore","RemoteStore shutting down."),e.Fh.add(5),[4,zo(e)];case 1:return n.sent(),e.kh.$o(),e.Mh.set("Unknown"),[2]}}))}))}(this.gl)},t}();function ps(t,e){void 0===e&&(e=10240);var n=0;return{read:function(){return Object(a.b)(this,void 0,void 0,(function(){var r;return Object(a.d)(this,(function(i){return n20&&(t=t.substring(0,20)+"..."),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";var e=function(t){if(t.constructor){var e=/function\s+([^\s(]+)\s*\(/.exec(t.constructor.toString());if(e&&e.length>1)return e[1]}return null}(t);return e?"a custom "+e+" object":"an object"}return"function"==typeof t?"a function":p()}function Is(t,e){if("_delegate"in t&&(t=t._),!(t instanceof e)){if(e.name===t.constructor.name)throw new T(E.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");var n=Ts(t);throw new T(E.INVALID_ARGUMENT,"Expected type '"+e.name+"', but it was: "+n)}return t}function Ss(t,e){if(e<=0)throw new T(E.INVALID_ARGUMENT,"Function "+t+"() requires a positive number, but it was: "+e+".")}var Os=function(){function t(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new T(E.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new T(E.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,_s("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}return t.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},t}(),Cs=new Map,ks=function(){function t(t,e){this.w_="(lite)",this.E_=new Os({}),this.T_=!1,t instanceof A?(this.I_=t,this.m_=new x):(this.A_=t,this.I_=function(t){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new T(E.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new A(t.options.projectId)}(t),this.m_=new j(e))}return Object.defineProperty(t.prototype,"app",{get:function(){if(!this.A_)throw new T(E.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.A_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"R_",{get:function(){return this.T_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"P_",{get:function(){return void 0!==this.y_},enumerable:!1,configurable:!0}),t.prototype.g_=function(t){if(this.T_)throw new T(E.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.E_=new Os(t),void 0!==t.credentials&&(this.m_=function(t){if(!t)return new x;switch(t.type){case"gapi":var e=t.client;return d(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new L(e,t.sessionIndex||"0");case"provider":return t.client;default:throw new T(E.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(t.credentials))},t.prototype.V_=function(){return this.E_},t.prototype.p_=function(){return this.T_=!0,this.E_},t.prototype._delete=function(){return this.y_||(this.y_=this.b_()),this.y_},t.prototype.b_=function(){return this,(t=Cs.get(this))&&(c("ComponentProvider","Removing Datastore"),Cs.delete(this),t.terminate()),Promise.resolve();var t},t}(),Ns=function(){function t(t,e,n){this.v_=e,this.S_=n,this.type="document",this.firestore=t}return Object.defineProperty(t.prototype,"D_",{get:function(){return this.S_.path},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this.S_.path.et()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return this.S_.path.ot()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return new Ps(this.firestore,this.v_,this.S_.path.Z())},enumerable:!1,configurable:!0}),t.prototype.withConverter=function(e){return new t(this.firestore,e,this.S_)},t}(),As=function(){function t(t,e,n){this.v_=e,this.C_=n,this.type="query",this.firestore=t}return t.prototype.withConverter=function(e){return new t(this.firestore,e,this.C_)},t}(),Ps=function(t){function e(e,n,r){var i=this;return(i=t.call(this,e,n,Gt(r))||this).firestore=e,i.D_=r,i.type="collection",i}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this.C_.path.et()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this.C_.path.ot()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){var t=this.D_.Z();return t.nt()?null:new Ns(this.firestore,null,new H(t))},enumerable:!1,configurable:!0}),e.prototype.withConverter=function(t){return new e(this.firestore,t,this.D_)},e}(As);function Rs(t,e){for(var n,r=[],i=2;i90)throw new T(E.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new T(E.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this.x_=t,this.N_=e}return Object.defineProperty(t.prototype,"latitude",{get:function(){return this.x_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"longitude",{get:function(){return this.N_},enumerable:!1,configurable:!0}),t.prototype.isEqual=function(t){return this.x_===t.x_&&this.N_===t.N_},t.prototype.toJSON=function(){return{latitude:this.x_,longitude:this.N_}},t.prototype.K=function(t){return m(this.x_,t.x_)||m(this.N_,t.N_)},t}(),Ms=/^__.*__$/,Fs=function(){function t(t,e,n){this.data=t,this.zt=e,this.fieldTransforms=n}return t.prototype.F_=function(t,e){return null!==this.zt?new De(t,this.data,this.zt,e,this.fieldTransforms):new je(t,this.data,e,this.fieldTransforms)},t}(),Us=function(){function t(t,e,n){this.data=t,this.zt=e,this.fieldTransforms=n}return t.prototype.F_=function(t,e){return new De(t,this.data,this.zt,e,this.fieldTransforms)},t}();function Vs(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw p()}}var qs=function(){function t(t,e,n,r,i,o){this.settings=t,this.T=e,this.Kt=n,this.ignoreUndefinedProperties=r,void 0===i&&this.O_(),this.fieldTransforms=i||[],this.zt=o||[]}return Object.defineProperty(t.prototype,"path",{get:function(){return this.settings.path},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"k_",{get:function(){return this.settings.k_},enumerable:!1,configurable:!0}),t.prototype.M_=function(e){return new t(Object.assign(Object.assign({},this.settings),e),this.T,this.Kt,this.ignoreUndefinedProperties,this.fieldTransforms,this.zt)},t.prototype.L_=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.M_({path:n,B_:!1});return r.q_(t),r},t.prototype.U_=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.M_({path:n,B_:!1});return r.O_(),r},t.prototype.Q_=function(t){return this.M_({path:void 0,B_:!0})},t.prototype.K_=function(t){return su(t,this.settings.methodName,this.settings.W_||!1,this.path,this.settings.j_)},t.prototype.contains=function(t){return void 0!==this.zt.find((function(e){return t.st(e)}))||void 0!==this.fieldTransforms.find((function(e){return t.st(e.field)}))},t.prototype.O_=function(){if(this.path)for(var t=0;t=0;--f)if(!uu(l,s[f])){var p=s[f],d=u[f];d instanceof S&&(d=d._);var v=a.U_(p);if(d instanceof Ks)l.push(p);else{var y=tu(d,v);null!=y&&(l.push(p),h.set(p,y))}}var g=new Q(l);return new Us(h.yt(),g,a.fieldTransforms)}function Zs(t,e,n,r){return void 0===r&&(r=!1),tu(n,t.G_(r?4:3,e))}function tu(t,e){if(t instanceof S&&(t=t._),nu(t))return ru("Unsupported field value:",e,t),eu(t,e);if(t instanceof gs)return function(t,e){if(!Vs(e.k_))throw e.K_(t._methodName+"() can only be used with update() and set()");if(!e.path)throw e.K_(t._methodName+"() is not currently supported inside arrays");var n=t.z_(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(e.path&&e.zt.push(e.path),t instanceof Array){if(e.settings.B_&&4!==e.k_)throw e.K_("Nested arrays are not supported");return function(t,e){for(var n=[],r=0,i=0,o=t;i0&&e.zt.push(e.path):W(t,(function(t,r){var i=tu(r,e.L_(t));null!=i&&(n[t]=i)})),{mapValue:{fields:n}}}function nu(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof F||t instanceof Ls||t instanceof I||t instanceof Ns||t instanceof gs)}function ru(t,e,n){if(!nu(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){var r=Ts(n);throw"an object"===r?e.K_(t+" a custom object"):e.K_(t+" "+r)}}function iu(t,e,n){if(e instanceof S&&(e=e._),e instanceof ys)return e.d_;if("string"==typeof e)return au(t,e);throw su("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}var ou=new RegExp("[~\\*/\\[\\]]");function au(t,e,n){if(e.search(ou)>=0)throw su("Invalid field path ("+e+"). Paths must not contain '~', '*', '/', '[', or ']'",t,!1,void 0,n);try{return(new(ys.bind.apply(ys,Object(a.g)([void 0],e.split("."))))).d_}catch(r){throw su("Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'",t,!1,void 0,n)}}function su(t,e,n,r,i){var o=r&&!r.nt(),a=void 0!==i,s="Function "+e+"() called with invalid data";n&&(s+=" (via `toFirestore()`)");var u="";return(o||a)&&(u+=" (found",o&&(u+=" in field "+r),a&&(u+=" in document "+i),u+=")"),new T(E.INVALID_ARGUMENT,(s+=". ")+t+u)}function uu(t,e){return t.some((function(t){return t.isEqual(e)}))}var cu=function(){function t(t){this.Dh=t,this.Y_=new Map,this.mutations=[],this.X_=!1,this.Z_=null,this.tf=new Set}return t.prototype.ef=function(t){return Object(a.b)(this,void 0,void 0,(function(){var e,n=this;return Object(a.d)(this,(function(r){switch(r.label){case 0:if(this.nf(),this.mutations.length>0)throw new T(E.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n,r,i,o,s,u;return Object(a.d)(this,(function(a){switch(a.label){case 0:return n=v(t),r=Dn(n.Kt)+"/documents",i={documents:e.map((function(t){return Pn(n.Kt,t)}))},[4,n.Cu("BatchGetDocuments",r,i)];case 1:return o=a.sent(),s=new Map,o.forEach((function(t){var e=function(t,e){return"found"in e?function(t,e){d(!!e.found),e.found.name,e.found.updateTime;var n=Rn(t,e.found.name),r=kn(e.found.updateTime),i=new mt({mapValue:{fields:e.found.fields}});return new Et(n,r,i,{})}(t,e):"missing"in e?function(t,e){d(!!e.missing),d(!!e.readTime);var n=Rn(t,e.missing),r=kn(e.readTime);return new Tt(n,r)}(t,e):p()}(n.Kt,t);s.set(e.key.toString(),e)})),u=[],[2,(e.forEach((function(t){var e=s.get(t.toString());d(!!e),u.push(e)})),u)]}}))}))}(this.Dh,t)];case 1:return[2,((e=r.sent()).forEach((function(t){t instanceof Tt||t instanceof Et?n.sf(t):p()})),e)]}}))}))},t.prototype.set=function(t,e){this.write(e.F_(t,this.Gt(t))),this.tf.add(t.toString())},t.prototype.update=function(t,e){try{this.write(e.F_(t,this.rf(t)))}catch(t){this.Z_=t}this.tf.add(t.toString())},t.prototype.delete=function(t){this.write(new Be(t,this.Gt(t))),this.tf.add(t.toString())},t.prototype.commit=function(){return Object(a.b)(this,void 0,void 0,(function(){var t,e=this;return Object(a.d)(this,(function(n){switch(n.label){case 0:if(this.nf(),this.Z_)throw this.Z_;return t=this.Y_,this.mutations.forEach((function(e){t.delete(e.key.toString())})),t.forEach((function(t,n){var r=H.ft(n);e.mutations.push(new ze(r,e.Gt(r)))})),[4,function(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n,r,i;return Object(a.d)(this,(function(o){switch(o.label){case 0:return n=v(t),r=Dn(n.Kt)+"/documents",i={writes:e.map((function(t){return Un(n.Kt,t)}))},[4,n.bu("Commit",r,i)];case 1:return o.sent(),[2]}}))}))}(this.Dh,this.mutations)];case 1:return n.sent(),this.X_=!0,[2]}}))}))},t.prototype.sf=function(t){var e;if(t instanceof Et)e=t.version;else{if(!(t instanceof Tt))throw p();e=U.min()}var n=this.Y_.get(t.key.toString());if(n){if(!e.isEqual(n))throw new T(E.ABORTED,"Document version changed between two reads.")}else this.Y_.set(t.key.toString(),e)},t.prototype.Gt=function(t){var e=this.Y_.get(t.toString());return!this.tf.has(t.toString())&&e?Oe.updateTime(e):Oe.Wt()},t.prototype.rf=function(t){var e=this.Y_.get(t.toString());if(!this.tf.has(t.toString())&&e){if(e.isEqual(U.min()))throw new T(E.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Oe.updateTime(e)}return Oe.exists(!0)},t.prototype.write=function(t){this.nf(),this.mutations.push(t)},t.prototype.nf=function(){},t}(),lu=function(){function t(t,e,n,r){this.fs=t,this.Dh=e,this.updateFunction=n,this.Ts=r,this.cf=5,this.zu=new Do(this.fs,"transaction_retry")}return t.prototype.run=function(){this.af()},t.prototype.af=function(){var t=this;this.zu.Bu((function(){return Object(a.b)(t,void 0,void 0,(function(){var t,e,n=this;return Object(a.d)(this,(function(r){return t=new cu(this.Dh),(e=this.uf(t))&&e.then((function(e){n.fs.ys((function(){return t.commit().then((function(){n.Ts.resolve(e)})).catch((function(t){n.hf(t)}))}))})).catch((function(t){n.hf(t)})),[2]}))}))}))},t.prototype.uf=function(t){try{var e=this.updateFunction(t);return!nt(e)&&e.catch&&e.then?e:(this.Ts.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.Ts.reject(t),null}},t.prototype.hf=function(t){var e=this;this.cf>0&&this.lf(t)?(this.cf-=1,this.fs.ys((function(){return e.af(),Promise.resolve()}))):this.Ts.reject(t)},t.prototype.lf=function(t){if("FirebaseError"===t.name){var e=t.code;return"aborted"===e||"failed-precondition"===e||!Ke(e)}return!1},t}(),hu=function(){function t(t,e,n){var r=this;this.credentials=t,this.fs=e,this.gu=n,this.user=P.UNAUTHENTICATED,this.clientId=g.t(),this._f=function(){},this.N=new er,this.credentials.S((function(t){c("FirestoreClient","Received user=",t.uid),r.user=t,r._f(t),r.N.resolve()}))}return t.prototype.getConfiguration=function(){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(t){switch(t.label){case 0:return[4,this.N.promise];case 1:return[2,(t.sent(),{fs:this.fs,gu:this.gu,clientId:this.clientId,credentials:this.credentials,Yl:this.user,bl:100})]}}))}))},t.prototype.ff=function(t){var e=this;this._f=t,this.N.promise.then((function(){return e._f(e.user)}))},t.prototype.df=function(){if(this.fs.wf)throw new T(E.FAILED_PRECONDITION,"The client has already been terminated.")},t.prototype.terminate=function(){var t=this;this.fs.Ef();var e=new er;return this.fs.Tf((function(){return Object(a.b)(t,void 0,void 0,(function(){var t,n;return Object(a.d)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),this.If?[4,this.If.terminate()]:[3,2];case 1:r.sent(),r.label=2;case 2:return this.mf?[4,this.mf.terminate()]:[3,4];case 3:r.sent(),r.label=4;case 4:return this.credentials.D(),e.resolve(),[3,6];case 5:return t=r.sent(),n=pr(t,"Failed to shutdown persistence"),e.reject(n),[3,6];case 6:return[2]}}))}))})),e.promise},t}();function fu(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n,r,i=this;return Object(a.d)(this,(function(o){switch(o.label){case 0:return t.fs.Af(),c("FirestoreClient","Initializing OfflineComponentProvider"),[4,t.getConfiguration()];case 1:return n=o.sent(),[4,e.initialize(n)];case 2:return o.sent(),r=n.Yl,t.ff((function(n){r.isEqual(n)||(r=n,t.fs.vo((function(){return Object(a.b)(i,void 0,void 0,(function(){return Object(a.d)(this,(function(t){switch(t.label){case 0:return[4,Wi(e.Sh,n)];case 1:return t.sent(),[2]}}))}))})))})),e.persistence.Vo((function(){return t.terminate()})),t.mf=e,[2]}}))}))}function pu(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n,r;return Object(a.d)(this,(function(i){switch(i.label){case 0:return t.fs.Af(),[4,du(t)];case 1:return n=i.sent(),c("FirestoreClient","Initializing OnlineComponentProvider"),[4,t.getConfiguration()];case 2:return r=i.sent(),[4,e.initialize(n,r)];case 3:return i.sent(),t.ff((function(n){return t.fs.vo((function(){return function(t,e){return Object(a.b)(this,void 0,void 0,(function(){var n,r;return Object(a.d)(this,(function(i){switch(i.label){case 0:return(n=v(t)).fs.Af(),c("RemoteStore","RemoteStore received new credentials"),r=Jo(n),n.Fh.add(3),[4,zo(n)];case 1:return i.sent(),r&&n.Mh.set("Unknown"),[4,n.Ch.s_(e)];case 2:return i.sent(),n.Fh.delete(3),[4,Bo(n)];case 3:return i.sent(),[2]}}))}))}(e.gl,n)}))})),t.If=e,[2]}}))}))}function du(t){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(e){switch(e.label){case 0:return t.mf?[3,2]:(c("FirestoreClient","Using default OfflineComponentProvider"),[4,fu(t,new cs)]);case 1:e.sent(),e.label=2;case 2:return[2,t.mf]}}))}))}function vu(t){return Object(a.b)(this,void 0,void 0,(function(){return Object(a.d)(this,(function(e){switch(e.label){case 0:return t.If?[3,2]:(c("FirestoreClient","Using default OnlineComponentProvider"),[4,pu(t,new fs)]);case 1:e.sent(),e.label=2;case 2:return[2,t.If]}}))}))}function yu(t){return du(t).then((function(t){return t.persistence}))}function gu(t){return du(t).then((function(t){return t.Sh}))}function mu(t){return vu(t).then((function(t){return t.gl}))}function bu(t){return vu(t).then((function(t){return t.fa}))}function _u(t){return Object(a.b)(this,void 0,void 0,(function(){var e,n;return Object(a.d)(this,(function(r){switch(r.label){case 0:return[4,vu(t)];case 1:return e=r.sent(),[2,((n=e.Vl).Gh=Pa.bind(null,e.fa),n.Jh=xa.bind(null,e.fa),n)]}}))}))}function wu(t,e,n){var r=this;void 0===n&&(n={});var i=new er;return t.fs.ys((function(){return Object(a.b)(r,void 0,void 0,(function(){var r;return Object(a.d)(this,(function(o){switch(o.label){case 0:return r=function(t,e,n,r,i){var o=new ds({next:function(o){e.ys((function(){return ya(t,a)}));var s=o.docs.has(n);!s&&o.fromCache?i.reject(new T(E.UNAVAILABLE,"Failed to get document because the client is offline.")):s&&o.fromCache&&r&&"server"===r.source?i.reject(new T(E.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(o)},error:function(t){return i.reject(t)}}),a=new _a(Gt(n.path),o,{includeMetadataChanges:!0,sl:!0});return va(t,a)},[4,_u(t)];case 1:return[2,r.apply(void 0,[o.sent(),t.fs,e,n,i])]}}))}))})),i.promise}function Eu(t,e,n){var r=this;void 0===n&&(n={});var i=new er;return t.fs.ys((function(){return Object(a.b)(r,void 0,void 0,(function(){var r;return Object(a.d)(this,(function(o){switch(o.label){case 0:return r=function(t,e,n,r,i){var o=new ds({next:function(n){e.ys((function(){return ya(t,a)})),n.fromCache&&"server"===r.source?i.reject(new T(E.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:function(t){return i.reject(t)}}),a=new _a(n,o,{includeMetadataChanges:!0,sl:!0});return va(t,a)},[4,_u(t)];case 1:return[2,r.apply(void 0,[o.sent(),t.fs,e,n,i])]}}))}))})),i.promise}var Tu=function(){function t(){var t=this;this.Rf=Promise.resolve(),this.Pf=[],this.yf=!1,this.gf=[],this.Vf=null,this.pf=!1,this.bf=[],this.zu=new Do(this,"async_queue_retry"),this.vf=function(){var e=xo();e&&c("AsyncQueue","Visibility state changed to "+e.visibilityState),t.zu.Uu()};var e=xo();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.vf)}return Object.defineProperty(t.prototype,"wf",{get:function(){return this.yf},enumerable:!1,configurable:!0}),t.prototype.ys=function(t){this.enqueue(t)},t.prototype.Tf=function(t){this.Sf(),this.Df(t)},t.prototype.Ef=function(){if(!this.yf){this.yf=!0;var t=xo();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.vf)}},t.prototype.enqueue=function(t){return this.Sf(),this.yf?new Promise((function(t){})):this.Df(t)},t.prototype.vo=function(t){var e=this;this.ys((function(){return e.Pf.push(t),e.Cf()}))},t.prototype.Cf=function(){return Object(a.b)(this,void 0,void 0,(function(){var t,e=this;return Object(a.d)(this,(function(n){switch(n.label){case 0:if(0===this.Pf.length)return[3,5];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.Pf[0]()];case 2:return n.sent(),this.Pf.shift(),this.zu.reset(),[3,4];case 3:if(!sr(t=n.sent()))throw t;return c("AsyncQueue","Operation failed with retryable error: "+t),[3,4];case 4:this.Pf.length>0&&this.zu.Bu((function(){return e.Cf()})),n.label=5;case 5:return[2]}}))}))},t.prototype.Df=function(t){var e=this,n=this.Rf.then((function(){return e.pf=!0,t().catch((function(t){throw e.Vf=t,e.pf=!1,l("INTERNAL UNHANDLED ERROR: ",function(t){var e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}(t)),t})).then((function(t){return e.pf=!1,t}))}));return this.Rf=n,n},t.prototype.mr=function(t,e,n){var r=this;this.Sf(),this.bf.indexOf(t)>-1&&(e=0);var i=fr.Is(this,t,e,n,(function(t){return r.xf(t)}));return this.gf.push(i),i},t.prototype.Sf=function(){this.Vf&&p()},t.prototype.Af=function(){},t.prototype.Nf=function(){return Object(a.b)(this,void 0,void 0,(function(){var t;return Object(a.d)(this,(function(e){switch(e.label){case 0:return[4,t=this.Rf];case 1:e.sent(),e.label=2;case 2:if(t!==this.Rf)return[3,0];e.label=3;case 3:return[2]}}))}))},t.prototype.Ff=function(t){for(var e=0,n=this.gf;e, or >=) must be on the same field. But you have inequality filters on '"+n.toString()+"' and '"+e.field.toString()+"'");var r=Jt(t);null!==r&&Ku(t,e.field,r)}var i=function(t,e){for(var n=0,r=t.filters;n=0)return i.op}return null}(t,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==i)throw i===e.op?new T(E.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new T(E.INVALID_ARGUMENT,"Invalid query. You cannot use '"+e.op.toString()+"' filters with '"+i.toString()+"' filters.")}(t,f),f}(t.C_,0,e,t.firestore.I_,this.Xf,this.Zf,this.td);return new As(t.firestore,t.v_,function(t,e){var n=t.filters.concat([e]);return new Kt(t.path,t.collectionGroup,t.Nt.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}(t.C_,n))},e}(Du),Fu=function(t){function e(e,n){var r=this;return(r=t.call(this)||this).Xf=e,r.ed=n,r.type="orderBy",r}return Object(a.c)(e,t),e.prototype.Yf=function(t){var e=function(t,e,n){if(null!==t.startAt)throw new T(E.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new T(E.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");var r=new qt(e,n);return function(t,e){if(null===Jt(t)){var n=Xt(t);null!==n&&Ku(t,n,e.field)}}(t,r),r}(t.C_,this.Xf,this.ed);return new As(t.firestore,t.v_,function(t,e){var n=t.Nt.concat([e]);return new Kt(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(t.C_,e))},e}(Du),Uu=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).type=e,i.nd=n,i.sd=r,i}return Object(a.c)(e,t),e.prototype.Yf=function(t){return new As(t.firestore,t.v_,ee(t.C_,this.nd,this.sd))},e}(Du),Vu=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).type=e,i.rd=n,i.od=r,i}return Object(a.c)(e,t),e.prototype.Yf=function(t){var e=Bu(t,this.type,this.rd,this.od);return new As(t.firestore,t.v_,function(t,e){return new Kt(t.path,t.collectionGroup,t.Nt.slice(),t.filters.slice(),t.limit,t.limitType,e,t.endAt)}(t.C_,e))},e}(Du),qu=function(t){function e(e,n,r){var i=this;return(i=t.call(this)||this).type=e,i.rd=n,i.od=r,i}return Object(a.c)(e,t),e.prototype.Yf=function(t){var e=Bu(t,this.type,this.rd,this.od);return new As(t.firestore,t.v_,function(t,e){return new Kt(t.path,t.collectionGroup,t.Nt.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,e)}(t.C_,e))},e}(Du);function Bu(t,e,n,r){if(n[0]instanceof S&&(n[0]=n[0]._),n[0]instanceof Pu)return function(t,e,n,r,i){if(!r)throw new T(E.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+n+"().");for(var o=[],a=0,s=Zt(t);aa.length)throw new T(E.INVALID_ARGUMENT,"Too many arguments provided to "+r+"(). The number of arguments must be less than or equal to the number of orderBy() clauses");for(var s=[],u=0;u10)throw new T(E.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.")}function Ku(t,e,n){if(!n.isEqual(e))throw new T(E.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first argument to orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}function Wu(t){return function(t,e){if("object"!=typeof t||null===t)return!1;for(var n=t,r=0,i=["next","error","complete"];r0?this._d(this.fd):Promise.resolve()},t.prototype.Ed=function(){if(this.dd)throw new T(E.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},t}();function sc(t,e){if(t instanceof S&&(t=t._),t.firestore!==e)throw new T(E.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}var uc=function(t){function e(e,n){var r=this;return(r=t.call(this,e,n)||this).zf=e,r}return Object(a.c)(e,t),e.prototype.get=function(e){var n=this,r=sc(e,this.zf),i=new ec(this.zf);return t.prototype.get.call(this,e).then((function(t){return new Ju(n.zf,i,r.S_,t.Jf,new Yu(!1,!1),r.v_)}))},e}(function(){function t(t,e){this.zf=t,this.Td=e,this.wd=zs(t)}return t.prototype.get=function(t){var e=this,n=sc(t,this.zf),r=new Qu(this.zf);return this.Td.ef([n.S_]).then((function(t){if(!t||1!==t.length)return p();var i=t[0];if(i instanceof Tt)return new Pu(e.zf,r,n.S_,null,n.v_);if(i instanceof Et)return new Pu(e.zf,r,i.key,i,n.v_);throw p()}))},t.prototype.set=function(t,e,n){var r=sc(t,this.zf),i=Gu(r.v_,e,n),o=Hs(this.wd,"Transaction.set",r.S_,i,null!==r.v_,n);return this.Td.set(r.S_,o),this},t.prototype.update=function(t,e,n){for(var r=[],i=3;i=0)throw new T(E.INVALID_ARGUMENT,"Invalid collection ID '"+e+"' passed to function collectionGroup(). Collection IDs must not contain '/'.");return new As(t,null,function(t){return new Kt(q.at(),t)}(e))}(this._,t))}catch(t){throw yc(t,"collectionGroup()","Firestore.collectionGroup()")}},e.prototype.runTransaction=function(t){var e=this;return function(t,e){return function(t,e){var n=this,r=new er;return t.fs.ys((function(){return Object(a.b)(n,void 0,void 0,(function(){var n;return Object(a.d)(this,(function(i){switch(i.label){case 0:return[4,function(t){return vu(t).then((function(t){return t.Dh}))}(t)];case 1:return n=i.sent(),new lu(t.fs,n,e,r).run(),[2]}}))}))})),r.promise}(Ou(t),(function(n){return e(new uc(t,n))}))}(this._,(function(n){return t(new pc(e,n))}))},e.prototype.batch=function(){var t=this;return Ou(this._),new dc(new ac(this._,(function(e){return ic(t._,e)})))},e.prototype.loadBundle=function(t){throw new T(E.FAILED_PRECONDITION,'"loadBundle()" does not exist, have you imported "firebase/firestore/bundle"?')},e.prototype.namedQuery=function(t){throw new T(E.FAILED_PRECONDITION,'"namedQuery()" does not exist, have you imported "firebase/firestore/bundle"?')},e}(S),hc=function(t){function e(e){var n=this;return(n=t.call(this)||this).firestore=e,n}return Object(a.c)(e,t),e.prototype.Uf=function(t){return new k(new I(t))},e.prototype.Qf=function(t){var e=this.Gf(t,this.firestore.I_);return vc.Ad(e,this.firestore,null)},e}(Au);function fc(t){var e;e=t,s.setLogLevel(e)}var pc=function(t){function e(e,n){var r=this;return(r=t.call(this,n)||this).zf=e,r}return Object(a.c)(e,t),e.prototype.get=function(t){var e=this,n=Sc(t);return this._.get(n).then((function(t){return new bc(e.zf,t)}))},e.prototype.set=function(t,e,n){var r=Sc(t);return n?(bs("Transaction.set",n),this._.set(r,e,n)):this._.set(r,e),this},e.prototype.update=function(t,e,n){for(var r,i=[],o=3;o=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var o,a="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof t?t:"undefined"!==typeof self?self:{},s=s||{},u=a||self;function c(){}function l(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function h(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var f="closure_uid_"+(1e9*Math.random()>>>0),p=0;function d(t,e,n){return t.call.apply(t.bind,arguments)}function v(t,e,n){if(!t)throw Error();if(2e?1:0}t:{var A=u.navigator;if(A){var P=A.userAgent;if(P){O=P;break t}}O=""}function R(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function x(t){var e={};for(var n in t)e[n]=t[n];return e}var j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function D(t,e){for(var n,r,i=1;iparseFloat(K)){M=String(G);break t}}M=K}var Q,Y={};function J(t){return function(t,e){var n=Y;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(t,(function(){for(var e=0,n=C(String(M)).split("."),r=C(String(t)).split("."),i=Math.max(n.length,r.length),o=0;0==e&&o=t.keyCode)&&(t.keyCode=-1)}catch(e){}};var ot="closure_listenable_"+(1e6*Math.random()|0),at=0;function st(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ca=i,this.key=++at,this.Y=this.Z=!1}function ut(t){t.Y=!0,t.listener=null,t.proxy=null,t.src=null,t.ca=null}function ct(t){this.src=t,this.a={},this.b=0}function lt(t,e){var n=e.type;if(n in t.a){var r,i=t.a[n],o=w(i,e);(r=0<=o)&&Array.prototype.splice.call(i,o,1),r&&(ut(e),0==t.a[n].length&&(delete t.a[n],t.b--))}}function ht(t,e,n,r){for(var i=0;i>>0);function It(t){return"function"===typeof t?t:(t[Tt]||(t[Tt]=function(e){return t.handleEvent(e)}),t[Tt])}function St(){_.call(this),this.c=new ct(this),this.J=this,this.C=null}function Ot(t,e){var n,r=t.C;if(r)for(n=[];r;r=r.C)n.push(r);if(t=t.J,r=e.type||e,"string"===typeof e)e=new nt(e,t);else if(e instanceof nt)e.target=e.target||t;else{var i=e;D(e=new nt(r,t),i)}if(i=!0,n)for(var o=n.length-1;0<=o;o--){var a=e.a=n[o];i=Ct(a,r,!0,e)&&i}if(i=Ct(a=e.a=t,r,!0,e)&&i,i=Ct(a,r,!1,e)&&i,n)for(o=0;oe.b&&(e.b++,t.next=e.a,e.a=t)}Lt=!1}function Ut(t,e){St.call(this),this.b=t||1,this.a=e||u,this.f=y(this.Za,this),this.g=m()}function Vt(t){t.aa=!1,t.M&&(t.a.clearTimeout(t.M),t.M=null)}function qt(t,e,n){if("function"===typeof t)n&&(t=y(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=y(t.handleEvent,t)}return 2147483647r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var o=i[0];if("noop"!=o&&"stop"!=o&&"close"!=o)for(var a=1;ae.length?me:(e=e.substr(r,n),t.D=r+n,e))}function Te(t){t.T=m()+t.P,Ie(t,t.P)}function Ie(t,e){if(null!=t.o)throw Error("WatchDog timer not null");t.o=ie(y(t.Va,t),e)}function Se(t){t.o&&(u.clearTimeout(t.o),t.o=null)}function Oe(t){0==t.g.v||t.A||Hn(t.g,t)}function Ce(t){Se(t);var e=t.F;e&&"function"==typeof e.ja&&e.ja(),t.F=null,Vt(t.R),Gt(t.J),t.a&&(e=t.a,t.a=null,e.abort(),e.ja())}function ke(t,e){try{var n=t.g;if(0!=n.v&&(n.a==t||un(n.b,t)))if(n.I=t.N,!t.C&&un(n.b,t)&&3==n.v){try{var r=n.ka.a.parse(e)}catch(g){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.j){if(n.a){if(!(n.a.u+3e3i[2]&&n.H&&0==n.o&&!n.m&&(n.m=ie(y(n.Sa,n),6e3));if(1>=sn(n.b)&&n.ea){try{n.ea()}catch(g){}n.ea=void 0}}else Wn(n,11)}else if((t.C||n.a==t)&&zn(n),!S(e))for(e=r=n.ka.a.parse(e),r=0;re||3==e&&!q&&!this.a.$())){this.A||4!=e||7==n||te(8==n||0>=r?3:2),Se(this);var i=this.a.W();this.N=i;var o=this.a.$();if(this.b=200==i,function(t,e,n,r,i,o,a){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+o+" "+a}))}(this.c,this.m,this.l,this.f,this.S,e,i),this.b){if(this.U&&!this.C){e:{if(this.a){var a,s=this.a;if((a=s.a?s.a.getResponseHeader("X-HTTP-Initial-Response"):null)&&!S(a)){var u=a;break e}}u=null}if(!u){this.b=!1,this.h=3,ne(12),Ce(this),Oe(this);break t}Yt(this.c,this.f,u,"Initial handshake response via X-HTTP-Initial-Response"),this.C=!0,ke(this,u)}this.I?(we(this,e,o),q&&this.b&&3==e&&(Wt(this.J,this.R,"tick",this.Wa),this.R.start())):(Yt(this.c,this.f,o,null),ke(this,o)),4==e&&Ce(this),this.b&&!this.A&&(4==e?Hn(this.g,this):(this.b=!1,Te(this)))}else 400==i&&0e)throw Error("Bad port number "+e);t.h=e}else t.h=null}function Ue(t,e,n){e instanceof Je?(t.b=e,function(t,e){e&&!t.f&&(Xe(t),t.c=null,t.a.forEach((function(t,e){var n=e.toLowerCase();e!=n&&($e(this,e),tn(this,n,t))}),t)),t.f=e}(t.b,t.a)):(n||(e=ze(e,Qe)),t.b=new Je(e,t.a))}function Ve(t,e,n){t.b.set(e,n)}function qe(t){return Ve(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^m()).toString(36)),t}function Be(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function ze(t,e,n){return"string"===typeof t?(t=encodeURI(t).replace(e,He),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function He(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}je.prototype.toString=function(){var t=[],e=this.f;e&&t.push(ze(e,Ke,!0),":");var n=this.c;return(n||"file"==e)&&(t.push("//"),(e=this.j)&&t.push(ze(e,Ke,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.h)&&t.push(":",String(n))),(n=this.g)&&(this.c&&"/"!=n.charAt(0)&&t.push("/"),t.push(ze(n,"/"==n.charAt(0)?Ge:We,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",ze(n,Ye)),t.join("")};var Ke=/[#\/\?@]/g,We=/[#\?:]/g,Ge=/[#\?]/g,Qe=/[#\?@]/g,Ye=/#/g;function Je(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Xe(t){t.a||(t.a=new Ae,t.b=0,t.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n2*t.c&&Pe(t)))}function Ze(t,e){return Xe(t),e=en(t,e),Re(t.a.b,e)}function tn(t,e,n){$e(t,e),0=t.f}function sn(t){return t.b?1:t.a?t.a.size:0}function un(t,e){return t.b?t.b==e:!!t.a&&t.a.has(e)}function cn(t,e){t.a?t.a.add(e):t.b=e}function ln(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function hn(t){var e,n;if(null!=t.b)return t.c.concat(t.b.s);if(null!=t.a&&0!==t.a.size){var r=t.c;try{for(var o=i(t.a.values()),a=o.next();!a.done;a=o.next()){var s=a.value;r=r.concat(s.s)}}catch(u){e={error:u}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return r}return I(t.c)}function fn(){}function pn(){this.a=new fn}function dn(t,e,n){var r=n||"";try{Ne(t,(function(t,n){var i=t;h(t)&&(i=kt(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(i){throw e.push(r+"type="+encodeURIComponent("_badmap")),i}}function vn(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(o){}}rn.prototype.cancel=function(){var t,e;if(this.c=hn(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=i(this.a.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(o){t={error:o}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.a.clear()}},fn.prototype.stringify=function(t){return u.JSON.stringify(t,void 0)},fn.prototype.parse=function(t){return u.JSON.parse(t,void 0)};var yn=u.JSON.parse;function gn(t){St.call(this),this.headers=new Ae,this.H=t||null,this.b=!1,this.s=this.a=null,this.B="",this.h=0,this.f="",this.g=this.A=this.l=this.u=!1,this.o=0,this.m=null,this.I=mn,this.D=this.F=!1}b(gn,St);var mn="",bn=/^https?$/i,_n=["POST","PUT"];function wn(t){return"content-type"==t.toLowerCase()}function En(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,Tn(t),Sn(t)}function Tn(t){t.u||(t.u=!0,Ot(t,"complete"),Ot(t,"error"))}function In(t){if(t.b&&"undefined"!=typeof s&&(!t.s[1]||4!=Cn(t)||2!=t.W()))if(t.l&&4==Cn(t))qt(t.za,0,t);else if(Ot(t,"readystatechange"),4==Cn(t)){t.b=!1;try{var e,n=t.W();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var o=String(t.B).match(xe)[1]||null;if(!o&&u.self&&u.self.location){var a=u.self.location.protocol;o=a.substr(0,a.length-1)}i=!bn.test(o?o.toLowerCase():"")}e=i}if(e)Ot(t,"complete"),Ot(t,"success");else{t.h=6;try{var c=2(c-=o))o=Math.max(0,i[u].b-100),s=!1;else try{dn(l,a,"req"+c+"_")}catch(h){r&&r(l)}}if(s){r=a.join("&");break t}}return t=t.g.splice(0,n),e.s=t,r}function Un(t){t.a||t.j||(t.T=1,Dt(t.Aa,t),t.o=0)}function Vn(t){return!(t.a||t.j||3<=t.o)&&(t.T++,t.j=ie(y(t.Aa,t),Kn(t,t.o)),t.o++,!0)}function qn(t){null!=t.s&&(u.clearTimeout(t.s),t.s=null)}function Bn(t){t.a=new ve(t,t.c,"rpc",t.T),null===t.i&&(t.a.B=t.l),t.a.O=0;var e=De(t.la);Ve(e,"RID","rpc"),Ve(e,"SID",t.J),Ve(e,"CI",t.H?"0":"1"),Ve(e,"AID",t.P),Mn(t,e),Ve(e,"TYPE","xmlhttp"),t.i&&t.l&&kn(e,t.i,t.l),t.D&&t.a.setTimeout(t.D);var n=t.a;t=t.ga,n.H=1,n.i=qe(De(e)),n.j=null,n.I=!0,_e(n,t)}function zn(t){null!=t.m&&(u.clearTimeout(t.m),t.m=null)}function Hn(t,e){var n=null;if(t.a==e){zn(t),qn(t),t.a=null;var r=2}else{if(!un(t.b,e))return;n=e.s,ln(t.b,e),r=1}if(t.I=e.N,0!=t.v)if(e.b)if(1==r){n=e.j?e.j.length:0,e=m()-e.u;var i=t.u;Ot(r=$t(),new re(r,n,e,i)),Dn(t)}else Un(t);else if(3==(i=e.h)||0==i&&0=t.b.f-(t.h?1:0))&&(t.h?(t.g=e.s.concat(t.g),!0):!(1==t.v||2==t.v||t.u>=(t.La?0:t.Ma))&&(t.h=ie(y(t.Ba,t,e),Kn(t,t.u)),t.u++,!0))}(t,e)||2==r&&Vn(t)))switch(n&&0e?null:"string"===typeof t?t.charAt(e):t[e]}(i.L()),n=u.FormData&&t instanceof u.FormData,!(0<=w(_n,e))||r||n||i.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),i.forEach((function(t,e){this.a.setRequestHeader(e,t)}),this),this.I&&(this.a.responseType=this.I),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{On(this),0=this.N)){var t=2*this.N;this.c.info("BP detection timer enabled: "+t),this.s=ie(y(this.Ta,this),t)}},o.Ta=function(){this.s&&(this.s=null,this.c.info("BP detection timeout reached."),this.c.info("Buffering proxy detected and switch to long-polling!"),this.H=!1,this.F=!0,ne(10),Rn(this),Bn(this))},o.Sa=function(){null!=this.m&&(this.m=null,Rn(this),Vn(this),ne(19))},o.Ya=function(t){t?(this.c.info("Successfully pinged google.com"),ne(2)):(this.c.info("Failed to ping google.com"),ne(1))},(o=Jn.prototype).ta=function(){},o.sa=function(){},o.ra=function(){},o.qa=function(){},o.Ja=function(){},Xn.prototype.a=function(t,e){return new $n(t,e)},b($n,St),$n.prototype.g=function(){this.a.f=this.f,this.m&&(this.a.C=!0);var t=this.a,e=this.o,n=this.b||void 0;ne(0),t.fa=e,t.V=n||{},t.H=t.S,t.B=Qn(t,null,t.fa),Dn(t)},$n.prototype.close=function(){Pn(this.a)},$n.prototype.h=function(t){if("string"===typeof t){var e={};e.__data__=t,jn(this.a,e)}else this.l?((e={}).__data__=kt(t),jn(this.a,e)):jn(this.a,t)},$n.prototype.G=function(){this.a.f=null,delete this.f,Pn(this.a),delete this.a,$n.X.G.call(this)},b(Zn,fe),b(tr,pe),b(er,Jn),er.prototype.ta=function(){Ot(this.a,"a")},er.prototype.sa=function(t){Ot(this.a,new Zn(t))},er.prototype.ra=function(t){Ot(this.a,new tr(t))},er.prototype.qa=function(){Ot(this.a,"b")},Xn.prototype.createWebChannel=Xn.prototype.a,$n.prototype.send=$n.prototype.h,$n.prototype.open=$n.prototype.g,$n.prototype.close=$n.prototype.close,oe.NO_ERROR=0,oe.TIMEOUT=8,oe.HTTP_ERROR=6,ae.COMPLETE="complete",ce.EventType=he,he.OPEN="a",he.CLOSE="b",he.ERROR="c",he.MESSAGE="d",St.prototype.listen=St.prototype.va,gn.prototype.listenOnce=gn.prototype.wa,gn.prototype.getLastError=gn.prototype.Qa,gn.prototype.getLastErrorCode=gn.prototype.ua,gn.prototype.getStatus=gn.prototype.W,gn.prototype.getResponseJson=gn.prototype.Pa,gn.prototype.getResponseText=gn.prototype.$,gn.prototype.send=gn.prototype.ba;var nr=function(){return new Xn},rr=function(){return $t()},ir=oe,or=ae,ar=Jt,sr={gb:0,jb:1,kb:2,Db:3,Ib:4,Fb:5,Gb:6,Eb:7,Cb:8,Hb:9,PROXY:10,NOPROXY:11,Ab:12,wb:13,xb:14,vb:15,yb:16,zb:17,bb:18,ab:19,cb:20},ur=ce,cr=gn}).call(this,n(13))},function(t,e,n){"use strict";!function t(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}(),t.exports=n(17)},function(t,e,n){"use strict";n.d(e,"a",(function(){return i.a}));var r,i=n(2),o=(n(21),n(22),n(4)),a=n(1),s=(n(7),n(6)),u=n(5),c={Firestore:s.d,GeoPoint:s.q,Timestamp:s.t,Blob:s.c,Transaction:s.e,WriteBatch:s.p,DocumentReference:s.a,DocumentSnapshot:s.g,Query:s.i,QueryDocumentSnapshot:s.f,QuerySnapshot:s.m,CollectionReference:s.j,FieldPath:s.o,FieldValue:s.s,setLogLevel:s.b,CACHE_SIZE_UNLIMITED:s.k};(function(t,e){t.INTERNAL.registerComponent(new u.a("firestore",(function(t){return function(t,e){return new s.d(t,new s.h(t,e),new s.r)}(t.getProvider("app").getImmediate(),t.getProvider("auth-internal"))}),"PUBLIC").setServiceProps(Object.assign({},c)))})(r=i.a),r.registerVersion("@firebase/firestore","2.1.1"),function(t){t.prototype.loadBundle=function(t){return Object(s.l)(this,t)},t.prototype.namedQuery=function(t){return Object(s.n)(this,t)}}(s.d);var l=n(0),h={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"},f=function(t){function e(n,r,i){var o=t.call(this,r)||this;return Object.setPrototypeOf(o,e.prototype),o.code=n,o.details=i,o}return Object(l.c)(e,t),e}(Error);var p=function(){function t(t,e){var n=this;this.auth=null,this.messaging=null,this.auth=t.getImmediate({optional:!0}),this.messaging=e.getImmediate({optional:!0}),this.auth||t.get().then((function(t){return n.auth=t}),(function(){})),this.messaging||e.get().then((function(t){return n.messaging=t}),(function(){}))}return t.prototype.getAuthToken=function(){return Object(l.b)(this,void 0,void 0,(function(){var t;return Object(l.d)(this,(function(e){switch(e.label){case 0:if(!this.auth)return[2,void 0];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.auth.getToken()];case 2:return(t=e.sent())?[2,t.accessToken]:[2,void 0];case 3:return e.sent(),[2,void 0];case 4:return[2]}}))}))},t.prototype.getInstanceIdToken=function(){return Object(l.b)(this,void 0,void 0,(function(){return Object(l.d)(this,(function(t){if(!this.messaging||!("Notification"in self)||"granted"!==Notification.permission)return[2,void 0];try{return[2,this.messaging.getToken()]}catch(r){return[2,void 0]}return[2]}))}))},t.prototype.getContext=function(){return Object(l.b)(this,void 0,void 0,(function(){var t,e;return Object(l.d)(this,(function(n){switch(n.label){case 0:return[4,this.getAuthToken()];case 1:return t=n.sent(),[4,this.getInstanceIdToken()];case 2:return e=n.sent(),[2,{authToken:t,instanceIdToken:e}]}}))}))},t}();function d(t,e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}var v=function(){function t(){}return t.prototype.encode=function(t){var e=this;if(null==t)return null;if(t instanceof Number&&(t=t.valueOf()),"number"===typeof t&&isFinite(t))return t;if(!0===t||!1===t)return t;if("[object String]"===Object.prototype.toString.call(t))return t;if(Array.isArray(t))return t.map((function(t){return e.encode(t)}));if("function"===typeof t||"object"===typeof t)return d(t,(function(t){return e.encode(t)}));throw new Error("Data cannot be encoded in JSON: "+t)},t.prototype.decode=function(t){var e=this;if(null==t)return t;if(t["@type"])switch(t["@type"]){case"type.googleapis.com/google.protobuf.Int64Value":case"type.googleapis.com/google.protobuf.UInt64Value":var n=Number(t.value);if(isNaN(n))throw new Error("Data cannot be decoded from JSON: "+t);return n;default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map((function(t){return e.decode(t)})):"function"===typeof t||"object"===typeof t?d(t,(function(t){return e.decode(t)})):t},t}();var y=function(){function t(t,e,n,i,o){var a=this;void 0===i&&(i="us-central1"),this.app_=t,this.fetchImpl=o,this.serializer=new v,this.emulatorOrigin=null,this.INTERNAL={delete:function(){return Promise.resolve(a.deleteService())}},this.contextProvider=new p(e,n),this.cancelAllRequests=new Promise((function(t){a.deleteService=function(){return t()}}));try{var s=new URL(i);this.customDomain=s.origin,this.region="us-central1"}catch(r){this.customDomain=null,this.region=i}}return Object.defineProperty(t.prototype,"app",{get:function(){return this.app_},enumerable:!1,configurable:!0}),t.prototype._url=function(t){var e=this.app_.options.projectId;return null!==this.emulatorOrigin?this.emulatorOrigin+"/"+e+"/"+this.region+"/"+t:null!==this.customDomain?this.customDomain+"/"+t:"https://"+this.region+"-"+e+".cloudfunctions.net/"+t},t.prototype.useEmulator=function(t,e){this.emulatorOrigin="http://"+t+":"+e},t.prototype.useFunctionsEmulator=function(t){this.emulatorOrigin=t},t.prototype.httpsCallable=function(t,e){var n=this;return function(r){return n.call(t,r,e||{})}},t.prototype.postJSON=function(t,e,n){return Object(l.b)(this,void 0,void 0,(function(){var r,i;return Object(l.d)(this,(function(o){switch(o.label){case 0:n["Content-Type"]="application/json",o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.fetchImpl(t,{method:"POST",body:JSON.stringify(e),headers:n})];case 2:return r=o.sent(),[3,4];case 3:return o.sent(),[2,{status:0,json:null}];case 4:i=null,o.label=5;case 5:return o.trys.push([5,7,,8]),[4,r.json()];case 6:return i=o.sent(),[3,8];case 7:return o.sent(),[3,8];case 8:return[2,{status:r.status,json:i}]}}))}))},t.prototype.call=function(t,e,n){return Object(l.b)(this,void 0,void 0,(function(){var i,o,a,s,u,c,p,d,v,y,m;return Object(l.d)(this,(function(l){switch(l.label){case 0:return i=this._url(t),e=this.serializer.encode(e),o={data:e},a={},[4,this.contextProvider.getContext()];case 1:return(s=l.sent()).authToken&&(a.Authorization="Bearer "+s.authToken),s.instanceIdToken&&(a["Firebase-Instance-ID-Token"]=s.instanceIdToken),u=n.timeout||7e4,c=function(t){var e,n=new Promise((function(n,r){e=setTimeout((function(){r(new f("deadline-exceeded","deadline-exceeded"))}),t)}));return{timer:e,promise:n}}(u),p=c.timer,d=c.promise,[4,Promise.race([g(p,this.postJSON(i,o,a)),d,g(p,this.cancelAllRequests)])];case 2:if(!(v=l.sent()))throw new f("cancelled","Firebase Functions instance was deleted.");if(y=function(t,e,n){var i=function(t){if(t>=200&&t<300)return"ok";switch(t){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}(t),o=i,a=void 0;try{var s=e&&e.error;if(s){var u=s.status;if("string"===typeof u){if(!h[u])return new f("internal","internal");i=h[u],o=u}var c=s.message;"string"===typeof c&&(o=c),void 0!==(a=s.details)&&(a=n.decode(a))}}catch(r){}return"ok"===i?null:new f(i,o,a)}(v.status,v.json,this.serializer))throw y;if(!v.json)throw new f("internal","Response is not valid JSON object.");if("undefined"===typeof(m=v.json.data)&&(m=v.json.result),"undefined"===typeof m)throw new f("internal","Response is missing data field.");return[2,{data:this.serializer.decode(m)}]}}))}))},t}();function g(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n;return Object(l.d)(this,(function(r){switch(r.label){case 0:return[4,e];case 1:return n=r.sent(),clearTimeout(t),[2,n]}}))}))}!function(t,e){var n={Functions:y};t.INTERNAL.registerComponent(new u.a("functions",(function(t,n){var r=t.getProvider("app").getImmediate(),i=t.getProvider("auth-internal"),o=t.getProvider("messaging");return new y(r,i,o,n,e)}),"PUBLIC").setServiceProps(n).setMultipleInstances(!0))}(i.a,fetch.bind(self)),i.a.registerVersion("@firebase/functions","0.6.1");var m,b=n(10),_="0.4.19",w=1e4,E="w:0.4.19",T="FIS_v2",I=36e5,S=((m={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',m["not-registered"]="Firebase Installation is not registered.",m["installation-not-found"]="Firebase Installation not found.",m["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',m["app-offline"]="Could not process request. Application offline.",m["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",m),O=new a.b("installations","Installations",S);function C(t){return t instanceof a.c&&t.code.includes("request-failed")}function k(t){return"https://firebaseinstallations.googleapis.com/v1/projects/"+t.projectId+"/installations"}function N(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}function A(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r;return Object(l.d)(this,(function(i){switch(i.label){case 0:return[4,e.json()];case 1:return n=i.sent(),r=n.error,[2,O.create("request-failed",{requestName:t,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})]}}))}))}function P(t){var e=t.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function R(t,e){var n=e.refreshToken,r=P(t);return r.append("Authorization",function(t){return"FIS_v2 "+t}(n)),r}function x(t){return Object(l.b)(this,void 0,void 0,(function(){var e;return Object(l.d)(this,(function(n){switch(n.label){case 0:return[4,t()];case 1:return(e=n.sent()).status>=500&&e.status<600?[2,t()]:[2,e]}}))}))}function j(t,e){var n=e.fid;return Object(l.b)(this,void 0,void 0,(function(){var e,r,i,o,a,s;return Object(l.d)(this,(function(u){switch(u.label){case 0:return e=k(t),r=P(t),i={fid:n,authVersion:T,appId:t.appId,sdkVersion:E},o={method:"POST",headers:r,body:JSON.stringify(i)},[4,x((function(){return fetch(e,o)}))];case 1:return(a=u.sent()).ok?[4,a.json()]:[3,3];case 2:return s=u.sent(),[2,{fid:s.fid||n,registrationStatus:2,refreshToken:s.refreshToken,authToken:N(s.authToken)}];case 3:return[4,A("Create Installation",a)];case 4:throw u.sent()}}))}))}function D(t){return new Promise((function(e){setTimeout(e,t)}))}var L=/^[cdef][\w-]{21}$/;function M(){try{var t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;var e=function(t){return(e=t,btoa(String.fromCharCode.apply(String,Object(l.f)(e))).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var e}(t);return L.test(e)?e:""}catch(n){return""}}function F(t){return t.appName+"!"+t.appId}var U=new Map;function V(t,e){var n=F(t);q(n,e),function(t,e){var n=z();n&&n.postMessage({key:t,fid:e});H()}(n,e)}function q(t,e){var n,r,i=U.get(t);if(i)try{for(var o=Object(l.h)(i),a=o.next();!a.done;a=o.next()){(0,a.value)(e)}}catch(s){n={error:s}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}var B=null;function z(){return!B&&"BroadcastChannel"in self&&((B=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(t){q(t.data.key,t.data.fid)}),B}function H(){0===U.size&&B&&(B.close(),B=null)}var K,W,G="firebase-installations-store",Q=null;function Y(){return Q||(Q=Object(b.openDb)("firebase-installations-database",1,(function(t){switch(t.oldVersion){case 0:t.createObjectStore(G)}}))),Q}function J(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r,i,o,a;return Object(l.d)(this,(function(s){switch(s.label){case 0:return n=F(t),[4,Y()];case 1:return r=s.sent(),i=r.transaction(G,"readwrite"),[4,(o=i.objectStore(G)).get(n)];case 2:return a=s.sent(),[4,o.put(e,n)];case 3:return s.sent(),[4,i.complete];case 4:return s.sent(),a&&a.fid===e.fid||V(t,e.fid),[2,e]}}))}))}function X(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n,r;return Object(l.d)(this,(function(i){switch(i.label){case 0:return e=F(t),[4,Y()];case 1:return n=i.sent(),[4,(r=n.transaction(G,"readwrite")).objectStore(G).delete(e)];case 2:return i.sent(),[4,r.complete];case 3:return i.sent(),[2]}}))}))}function $(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r,i,o,a,s;return Object(l.d)(this,(function(u){switch(u.label){case 0:return n=F(t),[4,Y()];case 1:return r=u.sent(),i=r.transaction(G,"readwrite"),[4,(o=i.objectStore(G)).get(n)];case 2:return a=u.sent(),void 0!==(s=e(a))?[3,4]:[4,o.delete(n)];case 3:return u.sent(),[3,6];case 4:return[4,o.put(s,n)];case 5:u.sent(),u.label=6;case 6:return[4,i.complete];case 7:return u.sent(),!s||a&&a.fid===s.fid||V(t,s.fid),[2,s]}}))}))}function Z(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n,r;return Object(l.d)(this,(function(i){switch(i.label){case 0:return[4,$(t,(function(n){var r=function(t){return nt(t||{fid:M(),registrationStatus:0})}(n),i=function(t,e){if(0===e.registrationStatus){if(!navigator.onLine)return{installationEntry:e,registrationPromise:Promise.reject(O.create("app-offline"))};var n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()};return{installationEntry:n,registrationPromise:function(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r;return Object(l.d)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,7]),[4,j(t,e)];case 1:return n=i.sent(),[2,J(t,n)];case 2:return C(r=i.sent())&&409===r.customData.serverCode?[4,X(t)]:[3,4];case 3:return i.sent(),[3,6];case 4:return[4,J(t,{fid:e.fid,registrationStatus:0})];case 5:i.sent(),i.label=6;case 6:throw r;case 7:return[2]}}))}))}(t,n)}}return 1===e.registrationStatus?{installationEntry:e,registrationPromise:tt(t)}:{installationEntry:e}}(t,r);return e=i.registrationPromise,i.installationEntry}))];case 1:return""!==(n=i.sent()).fid?[3,3]:(r={},[4,e]);case 2:return[2,(r.installationEntry=i.sent(),r)];case 3:return[2,{installationEntry:n,registrationPromise:e}]}}))}))}function tt(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n,r,i;return Object(l.d)(this,(function(o){switch(o.label){case 0:return[4,et(t)];case 1:e=o.sent(),o.label=2;case 2:return 1!==e.registrationStatus?[3,5]:[4,D(100)];case 3:return o.sent(),[4,et(t)];case 4:return e=o.sent(),[3,2];case 5:return 0!==e.registrationStatus?[3,7]:[4,Z(t)];case 6:return n=o.sent(),r=n.installationEntry,(i=n.registrationPromise)?[2,i]:[2,r];case 7:return[2,e]}}))}))}function et(t){return $(t,(function(t){if(!t)throw O.create("installation-not-found");return nt(t)}))}function nt(t){return 1===(e=t).registrationStatus&&e.registrationTime+w0&&"string"===typeof t.token&&t.token.length>0&&"string"===typeof e.auth&&e.auth.length>0&&"string"===typeof e.p256dh&&e.p256dh.length>0&&"string"===typeof e.endpoint&&e.endpoint.length>0&&"string"===typeof e.swScope&&e.swScope.length>0&&"string"===typeof e.vapidKey&&e.vapidKey.length>0}var Et="firebase-messaging-store",Tt=null;function It(){return Tt||(Tt=Object(b.openDb)("firebase-messaging-database",1,(function(t){switch(t.oldVersion){case 0:t.createObjectStore(Et)}}))),Tt}function St(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n,r;return Object(l.d)(this,(function(i){switch(i.label){case 0:return e=kt(t),[4,It()];case 1:return[4,i.sent().transaction(Et).objectStore(Et).get(e)];case 2:return(n=i.sent())?[2,n]:[3,3];case 3:return[4,_t(t.appConfig.senderId)];case 4:return(r=i.sent())?[4,Ot(t,r)]:[3,6];case 5:return i.sent(),[2,r];case 6:return[2]}}))}))}function Ot(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r,i;return Object(l.d)(this,(function(o){switch(o.label){case 0:return n=kt(t),[4,It()];case 1:return r=o.sent(),[4,(i=r.transaction(Et,"readwrite")).objectStore(Et).put(e,n)];case 2:return o.sent(),[4,i.complete];case 3:return o.sent(),[2,e]}}))}))}function Ct(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n,r;return Object(l.d)(this,(function(i){switch(i.label){case 0:return e=kt(t),[4,It()];case 1:return n=i.sent(),[4,(r=n.transaction(Et,"readwrite")).objectStore(Et).delete(e)];case 2:return i.sent(),[4,r.complete];case 3:return i.sent(),[2]}}))}))}function kt(t){return t.appConfig.appId}function Nt(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r,i,o,a,s;return Object(l.d)(this,(function(u){switch(u.label){case 0:return[4,xt(t)];case 1:n=u.sent(),r=jt(e),i={method:"POST",headers:n,body:JSON.stringify(r)},u.label=2;case 2:return u.trys.push([2,5,,6]),[4,fetch(Rt(t.appConfig),i)];case 3:return[4,u.sent().json()];case 4:return o=u.sent(),[3,6];case 5:throw a=u.sent(),pt.create("token-subscribe-failed",{errorInfo:a});case 6:if(o.error)throw s=o.error.message,pt.create("token-subscribe-failed",{errorInfo:s});if(!o.token)throw pt.create("token-subscribe-no-token");return[2,o.token]}}))}))}function At(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r,i,o,a,s;return Object(l.d)(this,(function(u){switch(u.label){case 0:return[4,xt(t)];case 1:n=u.sent(),r=jt(e.subscriptionOptions),i={method:"PATCH",headers:n,body:JSON.stringify(r)},u.label=2;case 2:return u.trys.push([2,5,,6]),[4,fetch(Rt(t.appConfig)+"/"+e.token,i)];case 3:return[4,u.sent().json()];case 4:return o=u.sent(),[3,6];case 5:throw a=u.sent(),pt.create("token-update-failed",{errorInfo:a});case 6:if(o.error)throw s=o.error.message,pt.create("token-update-failed",{errorInfo:s});if(!o.token)throw pt.create("token-update-no-token");return[2,o.token]}}))}))}function Pt(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r,i,o,a;return Object(l.d)(this,(function(s){switch(s.label){case 0:return[4,xt(t)];case 1:n=s.sent(),r={method:"DELETE",headers:n},s.label=2;case 2:return s.trys.push([2,5,,6]),[4,fetch(Rt(t.appConfig)+"/"+e,r)];case 3:return[4,s.sent().json()];case 4:if((i=s.sent()).error)throw o=i.error.message,pt.create("token-unsubscribe-failed",{errorInfo:o});return[3,6];case 5:throw a=s.sent(),pt.create("token-unsubscribe-failed",{errorInfo:a});case 6:return[2]}}))}))}function Rt(t){return"https://fcmregistrations.googleapis.com/v1/projects/"+t.projectId+"/registrations"}function xt(t){var e=t.appConfig,n=t.installations;return Object(l.b)(this,void 0,void 0,(function(){var t;return Object(l.d)(this,(function(r){switch(r.label){case 0:return[4,n.getToken()];case 1:return t=r.sent(),[2,new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":"FIS "+t})]}}))}))}function jt(t){var e=t.p256dh,n=t.auth,r=t.endpoint,i=t.vapidKey,o={web:{endpoint:r,auth:n,p256dh:e}};return i!==dt&&(o.web.applicationPubKey=i),o}function Dt(t,e,n){return Object(l.b)(this,void 0,void 0,(function(){var r,i,o,a;return Object(l.d)(this,(function(s){switch(s.label){case 0:if("granted"!==Notification.permission)throw pt.create("permission-blocked");return[4,Ut(e,n)];case 1:return r=s.sent(),[4,St(t)];case 2:return i=s.sent(),o={vapidKey:n,swScope:e.scope,endpoint:r.endpoint,auth:yt(r.getKey("auth")),p256dh:yt(r.getKey("p256dh"))},i?[3,3]:[2,Ft(t,o)];case 3:if(function(t,e){var n=e.vapidKey===t.vapidKey,r=e.endpoint===t.endpoint,i=e.auth===t.auth,o=e.p256dh===t.p256dh;return n&&r&&i&&o}(i.subscriptionOptions,o))return[3,8];s.label=4;case 4:return s.trys.push([4,6,,7]),[4,Pt(t,i.token)];case 5:return s.sent(),[3,7];case 6:return a=s.sent(),console.warn(a),[3,7];case 7:return[2,Ft(t,o)];case 8:return Date.now()>=i.createTime+6048e5?[2,Mt({token:i.token,createTime:Date.now(),subscriptionOptions:o},t,e)]:[2,i.token];case 9:return[2]}}))}))}function Lt(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r;return Object(l.d)(this,(function(i){switch(i.label){case 0:return[4,St(t)];case 1:return(n=i.sent())?[4,Pt(t,n.token)]:[3,4];case 2:return i.sent(),[4,Ct(t)];case 3:i.sent(),i.label=4;case 4:return[4,e.pushManager.getSubscription()];case 5:return(r=i.sent())?[2,r.unsubscribe()]:[2,!0]}}))}))}function Mt(t,e,n){return Object(l.b)(this,void 0,void 0,(function(){var r,i,o;return Object(l.d)(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,5]),[4,At(e,t)];case 1:return r=a.sent(),i=Object(l.a)(Object(l.a)({},t),{token:r,createTime:Date.now()}),[4,Ot(e,i)];case 2:return a.sent(),[2,r];case 3:return o=a.sent(),[4,Lt(e,n)];case 4:throw a.sent(),o;case 5:return[2]}}))}))}function Ft(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r;return Object(l.d)(this,(function(i){switch(i.label){case 0:return[4,Nt(t,e)];case 1:return n=i.sent(),r={token:n,createTime:Date.now(),subscriptionOptions:e},[4,Ot(t,r)];case 2:return i.sent(),[2,r.token]}}))}))}function Ut(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n;return Object(l.d)(this,(function(r){switch(r.label){case 0:return[4,t.pushManager.getSubscription()];case 1:return(n=r.sent())?[2,n]:[2,t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:gt(e)})]}}))}))}function Vt(t){return"object"===typeof t&&!!t&&vt in t}function qt(t){return new Promise((function(e){setTimeout(e,t)}))}var Bt=function(){function t(t){var e=this;this.firebaseDependencies=t,this.isOnBackgroundMessageUsed=null,this.vapidKey=null,this.bgMessageHandler=null,self.addEventListener("push",(function(t){t.waitUntil(e.onPush(t))})),self.addEventListener("pushsubscriptionchange",(function(t){t.waitUntil(e.onSubChange(t))})),self.addEventListener("notificationclick",(function(t){t.waitUntil(e.onNotificationClick(t))}))}return Object.defineProperty(t.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),t.prototype.setBackgroundMessageHandler=function(t){if(this.isOnBackgroundMessageUsed=!1,!t||"function"!==typeof t)throw pt.create("invalid-bg-handler");this.bgMessageHandler=t},t.prototype.onBackgroundMessage=function(t){var e=this;return this.isOnBackgroundMessageUsed=!0,this.bgMessageHandler=t,function(){e.bgMessageHandler=null}},t.prototype.getToken=function(){var t,e;return Object(l.b)(this,void 0,void 0,(function(){var n;return Object(l.d)(this,(function(r){switch(r.label){case 0:return this.vapidKey?[3,2]:[4,St(this.firebaseDependencies)];case 1:n=r.sent(),this.vapidKey=null!==(e=null===(t=null===n||void 0===n?void 0:n.subscriptionOptions)||void 0===t?void 0:t.vapidKey)&&void 0!==e?e:dt,r.label=2;case 2:return[2,Dt(this.firebaseDependencies,self.registration,this.vapidKey)]}}))}))},t.prototype.deleteToken=function(){return Lt(this.firebaseDependencies,self.registration)},t.prototype.requestPermission=function(){throw pt.create("only-available-in-window")},t.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw pt.create("use-vapid-key-after-get-token");if("string"!==typeof t||0===t.length)throw pt.create("invalid-vapid-key");this.vapidKey=t},t.prototype.useServiceWorker=function(){throw pt.create("only-available-in-window")},t.prototype.onMessage=function(){throw pt.create("only-available-in-window")},t.prototype.onTokenRefresh=function(){throw pt.create("only-available-in-window")},t.prototype.onPush=function(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n,r,i;return Object(l.d)(this,(function(o){switch(o.label){case 0:return(e=function(t){var e=t.data;if(!e)return null;try{return e.json()}catch(n){return null}}(t))?[4,Wt()]:(console.debug("FirebaseMessaging: failed to get parsed MessagePayload from the PushEvent. Skip handling the push."),[2]);case 1:return function(t){return t.some((function(t){return"visible"===t.visibilityState&&!t.url.startsWith("chrome-extension://")}))}(n=o.sent())?[2,Kt(n,e)]:(r=!1,e.notification?[4,Gt(zt(e))]:[3,3]);case 2:o.sent(),r=!0,o.label=3;case 3:return!0===r&&!1===this.isOnBackgroundMessageUsed?[2]:(this.bgMessageHandler&&(i=function(t){var e={from:t.from,collapseKey:t.collapse_key};return function(t,e){if(e.notification){t.notification={};var n=e.notification.title;n&&(t.notification.title=n);var r=e.notification.body;r&&(t.notification.body=r);var i=e.notification.image;i&&(t.notification.image=i)}}(e,t),function(t,e){e.data&&(t.data=e.data)}(e,t),function(t,e){if(e.fcmOptions){t.fcmOptions={};var n=e.fcmOptions.link;n&&(t.fcmOptions.link=n);var r=e.fcmOptions.analytics_label;r&&(t.fcmOptions.analyticsLabel=r)}}(e,t),e}(e),"function"===typeof this.bgMessageHandler?this.bgMessageHandler(i):this.bgMessageHandler.next(i)),[4,qt(1e3)]);case 4:return o.sent(),[2]}}))}))},t.prototype.onSubChange=function(t){var e,n;return Object(l.b)(this,void 0,void 0,(function(){var r;return Object(l.d)(this,(function(i){switch(i.label){case 0:return t.newSubscription?[3,2]:[4,Lt(this.firebaseDependencies,self.registration)];case 1:return i.sent(),[2];case 2:return[4,St(this.firebaseDependencies)];case 3:return r=i.sent(),[4,Lt(this.firebaseDependencies,self.registration)];case 4:return i.sent(),[4,Dt(this.firebaseDependencies,self.registration,null!==(n=null===(e=null===r||void 0===r?void 0:r.subscriptionOptions)||void 0===e?void 0:e.vapidKey)&&void 0!==n?n:dt)];case 5:return i.sent(),[2]}}))}))},t.prototype.onNotificationClick=function(t){var e,n;return Object(l.b)(this,void 0,void 0,(function(){var r,i,o,a,s;return Object(l.d)(this,(function(u){switch(u.label){case 0:return(r=null===(n=null===(e=t.notification)||void 0===e?void 0:e.data)||void 0===n?void 0:n.FCM_MSG)?t.action?[2]:(t.stopImmediatePropagation(),t.notification.close(),(i=function(t){var e,n,r,i=null!==(n=null===(e=t.fcmOptions)||void 0===e?void 0:e.link)&&void 0!==n?n:null===(r=t.notification)||void 0===r?void 0:r.click_action;if(i)return i;return Vt(t.data)?self.location.origin:null}(r))?(o=new URL(i,self.location.href),a=new URL(self.location.origin),o.host!==a.host?[2]:[4,Ht(o)]):[2]):[2];case 1:return(s=u.sent())?[3,4]:[4,self.clients.openWindow(i)];case 2:return s=u.sent(),[4,qt(3e3)];case 3:return u.sent(),[3,6];case 4:return[4,s.focus()];case 5:s=u.sent(),u.label=6;case 6:return s?(r.messageType=ht.NOTIFICATION_CLICKED,r.isFirebaseMessaging=!0,[2,s.postMessage(r)]):[2]}}))}))},t}();function zt(t){var e,n=Object(l.a)({},t.notification);return n.data=((e={}).FCM_MSG=t,e),n}function Ht(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n,r,i,o,a,s;return Object(l.d)(this,(function(u){switch(u.label){case 0:return[4,Wt()];case 1:e=u.sent();try{for(n=Object(l.h)(e),r=n.next();!r.done;r=n.next())if(i=r.value,o=new URL(i.url,self.location.href),t.host===o.host)return[2,i]}catch(c){a={error:c}}finally{try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(a)throw a.error}}return[2,null]}}))}))}function Kt(t,e){var n,r;e.isFirebaseMessaging=!0,e.messageType=ht.PUSH_RECEIVED;try{for(var i=Object(l.h)(t),o=i.next();!o.done;o=i.next()){o.value.postMessage(e)}}catch(a){n={error:a}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}function Wt(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function Gt(t){var e,n=t.actions,r=Notification.maxActions;return n&&r&&n.length>r&&console.warn("This browser only supports "+r+" actions. The remaining actions will not be displayed."),self.registration.showNotification(null!==(e=t.title)&&void 0!==e?e:"",t)}var Qt=function(){function t(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",(function(t){return e.messageEventListener(t)}))}return Object.defineProperty(t.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),t.prototype.messageEventListener=function(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n;return Object(l.d)(this,(function(r){switch(r.label){case 0:return(e=t.data).isFirebaseMessaging?(this.onMessageCallback&&e.messageType===ht.PUSH_RECEIVED&&("function"===typeof this.onMessageCallback?this.onMessageCallback(function(t){return delete t.messageType,delete t.isFirebaseMessaging,t}(Object.assign({},e))):this.onMessageCallback.next(Object.assign({},e))),Vt(n=e.data)&&"1"===n["google.c.a.e"]?[4,this.logEvent(e.messageType,n)]:[3,2]):[2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.getVapidKey=function(){return this.vapidKey},t.prototype.getSwReg=function(){return this.swRegistration},t.prototype.getToken=function(t){return Object(l.b)(this,void 0,void 0,(function(){return Object(l.d)(this,(function(e){switch(e.label){case 0:return"default"!==Notification.permission?[3,2]:[4,Notification.requestPermission()];case 1:e.sent(),e.label=2;case 2:if("granted"!==Notification.permission)throw pt.create("permission-blocked");return[4,this.updateVapidKey(null===t||void 0===t?void 0:t.vapidKey)];case 3:return e.sent(),[4,this.updateSwReg(null===t||void 0===t?void 0:t.serviceWorkerRegistration)];case 4:return e.sent(),[2,Dt(this.firebaseDependencies,this.swRegistration,this.vapidKey)]}}))}))},t.prototype.updateVapidKey=function(t){return Object(l.b)(this,void 0,void 0,(function(){return Object(l.d)(this,(function(e){return t?this.vapidKey=t:this.vapidKey||(this.vapidKey=dt),[2]}))}))},t.prototype.updateSwReg=function(t){return Object(l.b)(this,void 0,void 0,(function(){return Object(l.d)(this,(function(e){switch(e.label){case 0:return t||this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:e.sent(),e.label=2;case 2:if(!t&&this.swRegistration)return[2];if(!(t instanceof ServiceWorkerRegistration))throw pt.create("invalid-sw-registration");return this.swRegistration=t,[2]}}))}))},t.prototype.registerDefaultSw=function(){return Object(l.b)(this,void 0,void 0,(function(){var t,e;return Object(l.d)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=this,[4,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"})];case 1:return t.swRegistration=n.sent(),this.swRegistration.update().catch((function(){})),[3,3];case 2:throw e=n.sent(),pt.create("failed-service-worker-registration",{browserErrorMessage:e.message});case 3:return[2]}}))}))},t.prototype.deleteToken=function(){return Object(l.b)(this,void 0,void 0,(function(){return Object(l.d)(this,(function(t){switch(t.label){case 0:return this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:t.sent(),t.label=2;case 2:return[2,Lt(this.firebaseDependencies,this.swRegistration)]}}))}))},t.prototype.requestPermission=function(){return Object(l.b)(this,void 0,void 0,(function(){var t;return Object(l.d)(this,(function(e){switch(e.label){case 0:return"granted"===Notification.permission?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(t=e.sent()))return[2];throw"denied"===t?pt.create("permission-blocked"):pt.create("permission-default")}}))}))},t.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw pt.create("use-vapid-key-after-get-token");if("string"!==typeof t||0===t.length)throw pt.create("invalid-vapid-key");this.vapidKey=t},t.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw pt.create("invalid-sw-registration");if(this.swRegistration)throw pt.create("use-sw-after-get-token");this.swRegistration=t},t.prototype.onMessage=function(t){var e=this;return this.onMessageCallback=t,function(){e.onMessageCallback=null}},t.prototype.setBackgroundMessageHandler=function(){throw pt.create("only-available-in-sw")},t.prototype.onBackgroundMessage=function(){throw pt.create("only-available-in-sw")},t.prototype.onTokenRefresh=function(){return function(){}},t.prototype.logEvent=function(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n;return Object(l.d)(this,(function(r){switch(r.label){case 0:return n=function(t){switch(t){case ht.NOTIFICATION_CLICKED:return"notification_open";case ht.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t),[4,this.firebaseDependencies.analyticsProvider.get()];case 1:return r.sent().logEvent(n,{message_id:e["google.c.a.c_id"],message_name:e["google.c.a.c_l"],message_time:e["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}}))}))},t}();function Yt(t){return pt.create("missing-app-config-values",{valueName:t})}var Jt={isSupported:Xt};function Xt(){return self&&"ServiceWorkerGlobalScope"in self?"indexedDB"in self&&null!==indexedDB&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey"):"indexedDB"in window&&null!==indexedDB&&navigator.cookieEnabled&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}i.a.INTERNAL.registerComponent(new u.a("messaging",(function(t){var e=t.getProvider("app").getImmediate(),n={app:e,appConfig:function(t){var e,n;if(!t||!t.options)throw Yt("App Configuration Object");if(!t.name)throw Yt("App Name");var r=t.options;try{for(var i=Object(l.h)(["projectId","apiKey","appId","messagingSenderId"]),o=i.next();!o.done;o=i.next()){var a=o.value;if(!r[a])throw Yt(a)}}catch(s){e={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return{appName:t.name,projectId:r.projectId,apiKey:r.apiKey,appId:r.appId,senderId:r.messagingSenderId}}(e),installations:t.getProvider("installations").getImmediate(),analyticsProvider:t.getProvider("analytics-internal")};if(!Xt())throw pt.create("unsupported-browser");return self&&"ServiceWorkerGlobalScope"in self?new Bt(n):new Qt(n)}),"PUBLIC").setServiceProps(Jt));var $t="firebasestorage.googleapis.com",Zt=function(t){function e(n,r){var i=t.call(this,be(n),"Firebase Storage: "+r+" ("+be(n)+")")||this;return i.customData={serverResponse:null},Object.setPrototypeOf(i,e.prototype),i}return Object(l.c)(e,t),e.prototype.codeEquals=function(t){return be(t)===this.code},Object.defineProperty(e.prototype,"message",{get:function(){return this.customData.serverResponse?this.message+"\n"+this.customData.serverResponse:this.message},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"serverResponse",{get:function(){return this.customData.serverResponse},set:function(t){this.customData.serverResponse=t},enumerable:!1,configurable:!0}),e}(a.c),te="unknown",ee="object-not-found",ne="quota-exceeded",re="unauthenticated",ie="unauthorized",oe="retry-limit-exceeded",ae="canceled",se="invalid-url",ue="invalid-default-bucket",ce="no-default-bucket",le="cannot-slice-blob",he="server-file-wrong-size",fe="no-download-url",pe="invalid-argument",de="app-deleted",ve="invalid-root-operation",ye="invalid-format",ge="internal-error",me="unsupported-environment";function be(t){return"storage/"+t}function _e(){return new Zt(te,"An unknown error occurred, please check the error payload for server response.")}function we(){return new Zt(ae,"User canceled the upload/download.")}function Ee(){return new Zt(le,"Cannot slice blob for upload. Please retry the upload.")}function Te(t){return new Zt(pe,t)}function Ie(){return new Zt(de,"The Firebase app was deleted.")}function Se(t){return new Zt(ve,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function Oe(t,e){return new Zt(ye,"String does not match format '"+t+"': "+e)}function Ce(t){throw new Zt(ge,"Internal error: "+t)}var ke={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},Ne=function(t,e){this.data=t,this.contentType=e||null};function Ae(t,e){switch(t){case ke.RAW:return new Ne(Pe(e));case ke.BASE64:case ke.BASE64URL:return new Ne(Re(t,e));case ke.DATA_URL:return new Ne(function(t){var e=new xe(t);return e.base64?Re(ke.BASE64,e.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(r){throw Oe(ke.DATA_URL,"Malformed data URL.")}return Pe(e)}(e.rest)}(e),new xe(e).contentType)}throw _e()}function Pe(t){for(var e=[],n=0;n>6,128|63&r);else if(55296===(64512&r))if(n>18,128|r>>12&63,128|r>>6&63,128|63&r);else e.push(239,191,189);else 56320===(64512&r)?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|63&r)}return new Uint8Array(e)}function Re(t,e){switch(t){case ke.BASE64:var n=-1!==e.indexOf("-"),i=-1!==e.indexOf("_");if(n||i)throw Oe(t,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case ke.BASE64URL:var o=-1!==e.indexOf("+"),a=-1!==e.indexOf("/");if(o||a)throw Oe(t,"Invalid character '"+(o?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/")}var s;try{s=atob(e)}catch(r){throw Oe(t,"Invalid character found")}for(var u=new Uint8Array(s.length),c=0;c][;base64],");var n=e[1]||null;null!=n&&(this.base64=(r=n,i=";base64",r.length>=i.length&&r.substring(r.length-i.length)===i),this.contentType=this.base64?n.substring(0,n.length-";base64".length):n),this.rest=t.substring(t.indexOf(",")+1);var r,i};var je,De={STATE_CHANGED:"state_changed"},Le="running",Me="pausing",Fe="paused",Ue="success",Ve="canceling",qe="canceled",Be="error",ze={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function He(t){switch(t){case Le:case Me:case Ve:return ze.RUNNING;case Fe:return ze.PAUSED;case Ue:return ze.SUCCESS;case qe:return ze.CANCELED;case Be:default:return ze.ERROR}}!function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"}(je||(je={}));var Ke=function(){function t(){var t=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=je.NO_ERROR,this.sendPromise_=new Promise((function(e){t.xhr_.addEventListener("abort",(function(){t.errorCode_=je.ABORT,e(t)})),t.xhr_.addEventListener("error",(function(){t.errorCode_=je.NETWORK_ERROR,e(t)})),t.xhr_.addEventListener("load",(function(){e(t)}))}))}return t.prototype.send=function(t,e,n,r){if(this.sent_)throw Ce("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(e,t,!0),void 0!==r)for(var i in r)r.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,r[i].toString());return void 0!==n?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},t.prototype.getErrorCode=function(){if(!this.sent_)throw Ce("cannot .getErrorCode() before sending");return this.errorCode_},t.prototype.getStatus=function(){if(!this.sent_)throw Ce("cannot .getStatus() before sending");try{return this.xhr_.status}catch(r){return-1}},t.prototype.getResponseText=function(){if(!this.sent_)throw Ce("cannot .getResponseText() before sending");return this.xhr_.responseText},t.prototype.abort=function(){this.xhr_.abort()},t.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},t.prototype.addUploadProgressListener=function(t){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",t)},t.prototype.removeUploadProgressListener=function(t){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",t)},t}(),We=function(){function t(){}return t.prototype.createXhrIo=function(){return new Ke},t}();function Ge(t){return"string"===typeof t||t instanceof String}function Qe(t){return Ye()&&t instanceof Blob}function Ye(){return"undefined"!==typeof Blob}function Je(t,e,n,r){if(rn)throw new Zt(pe,"Invalid value for '"+t+"'. Expected "+n+" or less.")}function Xe(){return"undefined"!==typeof BlobBuilder?BlobBuilder:"undefined"!==typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function $e(){for(var t=[],e=0;e0&&(o.delimiter=n),r&&(o.pageToken=r),i&&(o.maxResults=i);var a=rn(e.bucketOnlyServerUrl()),s=t.maxOperationRetryTime,u=new dn(a,"GET",function(t,e){return function(n,r){var i=pn(t,e,r);return vn(null!==i),i}}(t,e.bucket),s);return u.urlParams=o,u.errorHandler=mn(e),u}function En(t,e,n){var r=Object.assign({},n);return r.fullPath=t.path,r.size=e.size(),r.contentType||(r.contentType=function(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}(null,e)),r}var Tn=function(t,e,n,r){this.current=t,this.total=e,this.finalized=!!n,this.metadata=r||null};function In(t,e){var n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(r){vn(!1)}return vn(!!n&&-1!==(e||["active"]).indexOf(n)),n}var Sn=262144;function On(t,e,n,r,i,o,a,s){var u=new Tn(0,0);if(a?(u.current=a.current,u.total=a.total):(u.current=0,u.total=r.size()),r.size()!==u.total)throw new Zt(he,"Server recorded incorrect upload file size, please retry the upload.");var c=u.total-u.current,l=c;i>0&&(l=Math.min(l,i));var h=u.current,f=h+l,p={"X-Goog-Upload-Command":l===c?"upload, finalize":"upload","X-Goog-Upload-Offset":u.current},d=r.slice(h,f);if(null===d)throw Ee();var v=e.maxUploadRetryTime,y=new dn(n,"POST",(function(t,n){var i,a=In(t,["active","final"]),s=u.current+l,c=r.size();return i="final"===a?yn(e,o)(t,n):null,new Tn(s,c,"final"===a,i)}),v);return y.headers=p,y.body=d.uploadData(),y.progressCallback=s||null,y.errorHandler=mn(t),y}var Cn=function(t,e,n){if("function"===typeof t||null!=e||null!=n)this.next=t,this.error=e,this.complete=n;else{var r=t;this.next=r.next,this.error=r.error,this.complete=r.complete}},kn=function(t,e,n,r,i,o){this.bytesTransferred=t,this.totalBytes=e,this.state=n,this.metadata=r,this.task=i,this.ref=o};function Nn(t){return function(){for(var e=[],n=0;n262144},t.prototype._start=function(){this._state===Le&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this._continueUpload():this._oneShotUpload())},t.prototype._resolveToken=function(t){var e=this;this._ref.storage.getAuthToken().then((function(n){switch(e._state){case Le:t(n);break;case Ve:e._transition(qe);break;case Me:e._transition(Fe)}}))},t.prototype._createResumable=function(){var t=this;this._resolveToken((function(e){var n=function(t,e,n,i,o){var a=e.bucketOnlyServerUrl(),s=En(e,i,o),u={name:s.fullPath},c=rn(a),l={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":i.size(),"X-Goog-Upload-Header-Content-Type":s.contentType,"Content-Type":"application/json; charset=utf-8"},h=fn(s,n),f=t.maxUploadRetryTime,p=new dn(c,"POST",(function(t){var e;In(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(r){vn(!1)}return vn(Ge(e)),e}),f);return p.urlParams=u,p.headers=l,p.body=h,p.errorHandler=mn(e),p}(t._ref.storage,t._ref._location,t._mappings,t._blob,t._metadata),i=t._ref.storage.makeRequest(n,e);t._request=i,i.getPromise().then((function(e){t._request=void 0,t._uploadUrl=e,t._needToFetchStatus=!1,t.completeTransitions_()}),t._errorHandler)}))},t.prototype._fetchStatus=function(){var t=this,e=this._uploadUrl;this._resolveToken((function(n){var i=function(t,e,n,i){var o=t.maxUploadRetryTime,a=new dn(n,"POST",(function(t){var e=In(t,["active","final"]),n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(r){vn(!1)}n||vn(!1);var o=Number(n);return vn(!isNaN(o)),new Tn(o,i.size(),"final"===e)}),o);return a.headers={"X-Goog-Upload-Command":"query"},a.errorHandler=mn(e),a}(t._ref.storage,t._ref._location,e,t._blob),o=t._ref.storage.makeRequest(i,n);t._request=o,o.getPromise().then((function(e){e=e,t._request=void 0,t._updateProgress(e.current),t._needToFetchStatus=!1,e.finalized&&(t._needToFetchMetadata=!0),t.completeTransitions_()}),t._errorHandler)}))},t.prototype._continueUpload=function(){var t=this,e=Sn*this._chunkMultiplier,n=new Tn(this._transferred,this._blob.size()),i=this._uploadUrl;this._resolveToken((function(o){var a;try{a=On(t._ref._location,t._ref.storage,i,t._blob,e,t._mappings,n,t._makeProgressCallback())}catch(r){return t._error=r,void t._transition(Be)}var s=t._ref.storage.makeRequest(a,o);t._request=s,s.getPromise().then((function(e){t._increaseMultiplier(),t._request=void 0,t._updateProgress(e.current),e.finalized?(t._metadata=e.metadata,t._transition(Ue)):t.completeTransitions_()}),t._errorHandler)}))},t.prototype._increaseMultiplier=function(){Sn*this._chunkMultiplier<33554432&&(this._chunkMultiplier*=2)},t.prototype._fetchMetadata=function(){var t=this;this._resolveToken((function(e){var n=_n(t._ref.storage,t._ref._location,t._mappings),r=t._ref.storage.makeRequest(n,e);t._request=r,r.getPromise().then((function(e){t._request=void 0,t._metadata=e,t._transition(Ue)}),t._metadataErrorHandler)}))},t.prototype._oneShotUpload=function(){var t=this;this._resolveToken((function(e){var n=function(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"},s=function(){for(var t="",e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();a["Content-Type"]="multipart/related; boundary="+s;var u=En(e,r,i),c="--"+s+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+fn(u,n)+"\r\n--"+s+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",l="\r\n--"+s+"--",h=Ze.getBlob(c,r,l);if(null===h)throw Ee();var f={name:u.fullPath},p=rn(o),d=t.maxUploadRetryTime,v=new dn(p,"POST",yn(t,n),d);return v.urlParams=f,v.headers=a,v.body=h.uploadData(),v.errorHandler=mn(e),v}(t._ref.storage,t._ref._location,t._mappings,t._blob,t._metadata),r=t._ref.storage.makeRequest(n,e);t._request=r,r.getPromise().then((function(e){t._request=void 0,t._metadata=e,t._updateProgress(t._blob.size()),t._transition(Ue)}),t._errorHandler)}))},t.prototype._updateProgress=function(t){var e=this._transferred;this._transferred=t,this._transferred!==e&&this._notifyObservers()},t.prototype._transition=function(t){if(this._state!==t)switch(t){case Ve:case Me:this._state=t,void 0!==this._request&&this._request.cancel();break;case Le:var e=this._state===Fe;this._state=t,e&&(this._notifyObservers(),this._start());break;case Fe:this._state=t,this._notifyObservers();break;case qe:this._error=we(),this._state=t,this._notifyObservers();break;case Be:case Ue:this._state=t,this._notifyObservers()}},t.prototype.completeTransitions_=function(){switch(this._state){case Me:this._transition(Fe);break;case Ve:this._transition(qe);break;case Le:this._start()}},Object.defineProperty(t.prototype,"snapshot",{get:function(){var t=He(this._state);return new kn(this._transferred,this._blob.size(),t,this._metadata,this,this._ref)},enumerable:!1,configurable:!0}),t.prototype.on=function(t,e,n,r){var i=this,o=new Cn(e,n,r);return this._addObserver(o),function(){i._removeObserver(o)}},t.prototype.then=function(t,e){return this._promise.then(t,e)},t.prototype.catch=function(t){return this.then(null,t)},t.prototype._addObserver=function(t){this._observers.push(t),this._notifyObserver(t)},t.prototype._removeObserver=function(t){var e=this._observers.indexOf(t);-1!==e&&this._observers.splice(e,1)},t.prototype._notifyObservers=function(){var t=this;this._finishPromise(),this._observers.slice().forEach((function(e){t._notifyObserver(e)}))},t.prototype._finishPromise=function(){if(void 0!==this._resolve){var t=!0;switch(He(this._state)){case ze.SUCCESS:Nn(this._resolve.bind(null,this.snapshot))();break;case ze.CANCELED:case ze.ERROR:Nn(this._reject.bind(null,this._error))();break;default:t=!1}t&&(this._resolve=void 0,this._reject=void 0)}},t.prototype._notifyObserver=function(t){switch(He(this._state)){case ze.RUNNING:case ze.PAUSED:t.next&&Nn(t.next.bind(t,this.snapshot))();break;case ze.SUCCESS:t.complete&&Nn(t.complete.bind(t))();break;case ze.CANCELED:case ze.ERROR:t.error&&Nn(t.error.bind(t,this._error))();break;default:t.error&&Nn(t.error.bind(t,this._error))()}},t.prototype.resume=function(){var t=this._state===Fe||this._state===Me;return t&&this._transition(Le),t},t.prototype.pause=function(){var t=this._state===Le;return t&&this._transition(Me),t},t.prototype.cancel=function(){var t=this._state===Le||this._state===Me;return t&&this._transition(Ve),t},t}(),Pn=function(){function t(t,e){this._service=t,this._location=e instanceof tn?e:tn.makeFromUrl(e)}return t.prototype.toString=function(){return"gs://"+this._location.bucket+"/"+this._location.path},t.prototype.newRef=function(e,n){return new t(e,n)},Object.defineProperty(t.prototype,"root",{get:function(){var t=new tn(this._location.bucket,"");return this.newRef(this._service,t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bucket",{get:function(){return this._location.bucket},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fullPath",{get:function(){return this._location.path},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return nn(this._location.path)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"storage",{get:function(){return this._service},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){var e=function(t){if(0===t.length)return null;var e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}(this._location.path);if(null===e)return null;var n=new tn(this._location.bucket,e);return new t(this._service,n)},enumerable:!1,configurable:!0}),t.prototype._throwIfRoot=function(t){if(""===this._location.path)throw Se(t)},t}();function Rn(t){var e={prefixes:[],items:[]};return xn(t,e).then((function(){return e}))}function xn(t,e,n){return Object(l.b)(this,void 0,void 0,(function(){var r,i,o;return Object(l.d)(this,(function(a){switch(a.label){case 0:return[4,jn(t,{pageToken:n})];case 1:return r=a.sent(),(i=e.prefixes).push.apply(i,r.prefixes),(o=e.items).push.apply(o,r.items),null==r.nextPageToken?[3,3]:[4,xn(t,e,r.nextPageToken)];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))}function jn(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r,i;return Object(l.d)(this,(function(o){switch(o.label){case 0:return null!=e&&"number"===typeof e.maxResults&&Je("options.maxResults",1,1e3,e.maxResults),[4,t.storage.getAuthToken()];case 1:return n=o.sent(),r=e||{},i=wn(t.storage,t._location,"/",r.pageToken,r.maxResults),[2,t.storage.makeRequest(i,n).getPromise()]}}))}))}function Dn(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,r;return Object(l.d)(this,(function(i){switch(i.label){case 0:return t._throwIfRoot("updateMetadata"),[4,t.storage.getAuthToken()];case 1:return n=i.sent(),r=function(t,e,n,r){var i=rn(e.fullServerUrl()),o=fn(n,r),a=t.maxOperationRetryTime,s=new dn(i,"PATCH",yn(t,r),a);return s.headers={"Content-Type":"application/json; charset=utf-8"},s.body=o,s.errorHandler=bn(e),s}(t.storage,t._location,e,cn()),[2,t.storage.makeRequest(r,n).getPromise()]}}))}))}function Ln(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n;return Object(l.d)(this,(function(r){switch(r.label){case 0:return t._throwIfRoot("getDownloadURL"),[4,t.storage.getAuthToken()];case 1:return e=r.sent(),n=function(t,e,n){var r=rn(e.fullServerUrl()),i=t.maxOperationRetryTime,o=new dn(r,"GET",gn(t,n),i);return o.errorHandler=bn(e),o}(t.storage,t._location,cn()),[2,t.storage.makeRequest(n,e).getPromise().then((function(t){if(null===t)throw new Zt(fe,"The given file does not have any download URLs.");return t}))]}}))}))}function Mn(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n;return Object(l.d)(this,(function(r){switch(r.label){case 0:return t._throwIfRoot("deleteObject"),[4,t.storage.getAuthToken()];case 1:return e=r.sent(),n=function(t,e){var n=rn(e.fullServerUrl()),r=t.maxOperationRetryTime,i=new dn(n,"DELETE",(function(t,e){}),r);return i.successCodes=[200,204],i.errorHandler=bn(e),i}(t.storage,t._location),[2,t.storage.makeRequest(n,e).getPromise()]}}))}))}function Fn(t,e){var n=function(t,e){var n=e.split("/").filter((function(t){return t.length>0})).join("/");return 0===t.length?n:t+"/"+n}(t._location.path,e),r=new tn(t._location.bucket,n);return new Pn(t.storage,r)}var Un=function(){function t(t,e,n){this._delegate=t,this.task=e,this.ref=n}return Object.defineProperty(t.prototype,"bytesTransferred",{get:function(){return this._delegate.bytesTransferred},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._delegate.state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"totalBytes",{get:function(){return this._delegate.totalBytes},enumerable:!1,configurable:!0}),t}(),Vn=function(){function t(t,e){this._delegate=t,this._ref=e,this.cancel=this._delegate.cancel.bind(this._delegate),this.catch=this._delegate.catch.bind(this._delegate),this.pause=this._delegate.pause.bind(this._delegate),this.resume=this._delegate.resume.bind(this._delegate),this._snapshot=new Un(this._delegate.snapshot,this,this._ref)}return Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshot},enumerable:!1,configurable:!0}),t.prototype.then=function(t,e){var n=this;return this._delegate.then((function(e){if(t)return t(new Un(e,n,n._ref))}),e)},t.prototype.on=function(t,e,n,r){var i=this,o=void 0;return e&&(o="function"===typeof e?function(t){return e(new Un(t,i,i._ref))}:{next:e.next?function(t){return e.next(new Un(t,i,i._ref))}:void 0,complete:e.complete||void 0,error:e.error||void 0}),this._delegate.on(t,o,n||void 0,r||void 0)},t}(),qn=function(){function t(t,e){this._delegate=t,this._service=e}return Object.defineProperty(t.prototype,"prefixes",{get:function(){var t=this;return this._delegate.prefixes.map((function(e){return new Bn(e,t._service)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){var t=this;return this._delegate.items.map((function(e){return new Bn(e,t._service)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nextPageToken",{get:function(){return this._delegate.nextPageToken||null},enumerable:!1,configurable:!0}),t}(),Bn=function(){function t(t,e){this._delegate=t,this.storage=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this._delegate.name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bucket",{get:function(){return this._delegate.bucket},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fullPath",{get:function(){return this._delegate.fullPath},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return this._delegate.toString()},t.prototype.child=function(e){return new t(Fn(this._delegate,e),this.storage)},Object.defineProperty(t.prototype,"root",{get:function(){return new t(this._delegate.root,this.storage)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){var e=this._delegate.parent;return null==e?null:new t(e,this.storage)},enumerable:!1,configurable:!0}),t.prototype.put=function(t,e){return this._throwIfRoot("put"),new Vn(function(t,e,n){return void 0===n&&(n=null),t._throwIfRoot("uploadBytesResumable"),new An(t,new Ze(e),n)}(this._delegate,t,e),this)},t.prototype.putString=function(t,e,n){return void 0===e&&(e=ke.RAW),this._throwIfRoot("putString"),new Vn(function(t,e,n,r){void 0===n&&(n=ke.RAW),t._throwIfRoot("putString");var i=Ae(n,e),o=Object(l.a)({},r);return null==o.contentType&&null!=i.contentType&&(o.contentType=i.contentType),new An(t,new Ze(i.data,!0),o)}(this._delegate,t,e,n),this)},t.prototype.listAll=function(){var t=this;return Rn(this._delegate).then((function(e){return new qn(e,t.storage)}))},t.prototype.list=function(t){var e=this;return jn(this._delegate,t).then((function(t){return new qn(t,e.storage)}))},t.prototype.getMetadata=function(){return function(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n;return Object(l.d)(this,(function(r){switch(r.label){case 0:return t._throwIfRoot("getMetadata"),[4,t.storage.getAuthToken()];case 1:return e=r.sent(),n=_n(t.storage,t._location,cn()),[2,t.storage.makeRequest(n,e).getPromise()]}}))}))}(this._delegate)},t.prototype.updateMetadata=function(t){return Dn(this._delegate,t)},t.prototype.getDownloadURL=function(){return Ln(this._delegate)},t.prototype.delete=function(){return this._throwIfRoot("delete"),Mn(this._delegate)},t.prototype._throwIfRoot=function(t){if(""===this._delegate._location.path)throw Se(t)},t}(),zn=function(){function t(t){this.promise_=Promise.reject(t)}return t.prototype.getPromise=function(){return this.promise_},t.prototype.cancel=function(t){},t}();var Hn=function(){function t(t,e,n,r,i,o,a,s,u,c,l){var h=this;this.pendingXhr_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.url_=t,this.method_=e,this.headers_=n,this.body_=r,this.successCodes_=i.slice(),this.additionalRetryCodes_=o.slice(),this.callback_=a,this.errorCallback_=s,this.progressCallback_=c,this.timeout_=u,this.pool_=l,this.promise_=new Promise((function(t,e){h.resolve_=t,h.reject_=e,h.start_()}))}return t.prototype.start_=function(){var t=this;function e(e,n){var i,o=t.resolve_,a=t.reject_,s=n.xhr;if(n.wasSuccessCode)try{var u=t.callback_(s,s.getResponseText());void 0!==u?o(u):o()}catch(r){a(r)}else null!==s?((i=_e()).serverResponse=s.getResponseText(),t.errorCallback_?a(t.errorCallback_(s,i)):a(i)):n.canceled?a(i=t.appDelete_?Ie():we()):a(i=new Zt(oe,"Max retry time for operation exceeded, please try again."))}this.canceled_?e(0,new Kn(!1,null,!0)):this.backoffId_=function(t,e,n){var r=1,i=null,o=!1,a=0;function s(){return 2===a}var u=!1;function c(){for(var t=[],n=0;n=500&&t<600,n=-1!==[408,429].indexOf(t),r=-1!==this.additionalRetryCodes_.indexOf(t);return e||n||r},t}(),Kn=function(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n};function Wn(t,e,n,r){var o=on(t.urlParams),a=t.url+o,s=Object.assign({},t.headers);return function(t,e){e&&(t["X-Firebase-GMPID"]=e)}(s,e),function(t,e){null!==e&&e.length>0&&(t.Authorization="Firebase "+e)}(s,n),function(t){var e="undefined"!==typeof i.a?i.a.SDK_VERSION:"AppManager";t["X-Firebase-Storage-Version"]="webjs/"+e}(s),new Hn(a,t.method,s,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,r)}function Gn(t){return/^[A-Za-z]+:\/\//.test(t)}function Qn(t,e){if(t instanceof Jn){var n=t;if(null==n._bucket)throw new Zt(ce,"No default bucket found. Did you set the 'storageBucket' property when initializing the app?");var r=new Pn(n,n._bucket);return null!=e?Qn(r,e):r}if(void 0!==e){if(e.includes(".."))throw Te('`path` param cannot contain ".."');return Fn(t,e)}return t}function Yn(t,e){if(e&&Gn(e)){if(t instanceof Jn)return new Pn(t,e);throw Te("To use ref(service, url), the first argument must be a Storage instance.")}return Qn(t,e)}var Jn=function(){function t(t,e,n,r){this.app=t,this._authProvider=e,this._pool=n,this._url=r,this._bucket=null,this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=r?tn.makeFromBucketSpec(r):function(t){var e=null===t||void 0===t?void 0:t.storageBucket;return null==e?null:tn.makeFromBucketSpec(e)}(this.app.options)}return Object.defineProperty(t.prototype,"maxUploadRetryTime",{get:function(){return this._maxUploadRetryTime},set:function(t){Je("time",0,Number.POSITIVE_INFINITY,t),this._maxUploadRetryTime=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxOperationRetryTime",{get:function(){return this._maxOperationRetryTime},set:function(t){Je("time",0,Number.POSITIVE_INFINITY,t),this._maxOperationRetryTime=t},enumerable:!1,configurable:!0}),t.prototype.getAuthToken=function(){return Object(l.b)(this,void 0,void 0,(function(){var t,e;return Object(l.d)(this,(function(n){switch(n.label){case 0:return(t=this._authProvider.getImmediate({optional:!0}))?[4,t.getToken()]:[3,2];case 1:if(null!==(e=n.sent()))return[2,e.accessToken];n.label=2;case 2:return[2,null]}}))}))},t.prototype._delete=function(){return this._deleted=!0,this._requests.forEach((function(t){return t.cancel()})),this._requests.clear(),Promise.resolve()},t.prototype.makeStorageReference=function(t){return new Pn(this,t)},t.prototype.makeRequest=function(t,e){var n=this;if(this._deleted)return new zn(Ie());var r=Wn(t,this._appId,e,this._pool);return this._requests.add(r),r.getPromise().then((function(){return n._requests.delete(r)}),(function(){return n._requests.delete(r)})),r},t}(),Xn=function(){function t(t,e){var n=this;this.app=t,this._delegate=e,this.INTERNAL={delete:function(){return n._delegate._delete()}}}return Object.defineProperty(t.prototype,"maxOperationRetryTime",{get:function(){return this._delegate.maxOperationRetryTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxUploadRetryTime",{get:function(){return this._delegate.maxUploadRetryTime},enumerable:!1,configurable:!0}),t.prototype.ref=function(t){if(Gn(t))throw Te("ref() expected a child path but got a URL, use refFromURL instead.");return new Bn(Yn(this._delegate,t),this)},t.prototype.refFromURL=function(t){if(!Gn(t))throw Te("refFromURL() expected a full URL but got a child path, use ref() instead.");try{tn.makeFromUrl(t)}catch(r){throw Te("refFromUrl() expected a valid full URL but got an invalid one.")}return new Bn(Yn(this._delegate,t),this)},t.prototype.setMaxUploadRetryTime=function(t){this._delegate.maxUploadRetryTime=t},t.prototype.setMaxOperationRetryTime=function(t){this._delegate.maxOperationRetryTime=t},t}();function $n(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal");return new Xn(n,new Jn(n,r,new We,e))}!function(t){var e={TaskState:ze,TaskEvent:De,StringFormat:ke,Storage:Jn,Reference:Bn};t.INTERNAL.registerComponent(new u.a("storage",$n,"PUBLIC").setServiceProps(e).setMultipleInstances(!0)),t.registerVersion("@firebase/storage","0.4.2")}(i.a);var Zn,tr,er,nr="0.4.5",rr=nr,ir="FB-PERF-TRACE-MEASURE",or="_wt_",ar="_fcp",sr="_fid",ur="@firebase/performance/config",cr="@firebase/performance/configexpire",lr="Performance",hr=((Zn={})["trace started"]="Trace {$traceName} was started before.",Zn["trace stopped"]="Trace {$traceName} is not running.",Zn["nonpositive trace startTime"]="Trace {$traceName} startTime should be positive.",Zn["nonpositive trace duration"]="Trace {$traceName} duration should be positive.",Zn["no window"]="Window is not available.",Zn["no app id"]="App id is not available.",Zn["no project id"]="Project id is not available.",Zn["no api key"]="Api key is not available.",Zn["invalid cc log"]="Attempted to queue invalid cc event",Zn["FB not default"]="Performance can only start when Firebase app instance is the default one.",Zn["RC response not ok"]="RC response is not ok",Zn["invalid attribute name"]="Attribute name {$attributeName} is invalid.",Zn["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",Zn["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",Zn["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",Zn),fr=new a.b("performance",lr,hr),pr=new o.b(lr);pr.logLevel=o.a.INFO;var dr,vr=function(){function t(t){if(this.window=t,!t)throw fr.create("no window");this.performance=t.performance,this.PerformanceObserver=t.PerformanceObserver,this.windowLocation=t.location,this.navigator=t.navigator,this.document=t.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=t.localStorage),t.perfMetrics&&t.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=t.perfMetrics.onFirstInputDelay)}return t.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},t.prototype.mark=function(t){this.performance&&this.performance.mark&&this.performance.mark(t)},t.prototype.measure=function(t,e,n){this.performance&&this.performance.measure&&this.performance.measure(t,e,n)},t.prototype.getEntriesByType=function(t){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(t):[]},t.prototype.getEntriesByName=function(t){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(t):[]},t.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},t.prototype.requiredApisAvailable=function(){return fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled?!!Object(a.w)()||(pr.info("IndexedDB is not supported by current browswer"),!1):(pr.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)},t.prototype.setupObserver=function(t,e){this.PerformanceObserver&&new this.PerformanceObserver((function(t){for(var n=0,r=t.getEntries();n1)throw fr.create("invalid String merger input");for(var r=[],i=0;ii&&r.push(e.charAt(i));return r.join("")}var gr,mr,br=function(){function t(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.tracesSamplingRate=1,this.networkRequestsSamplingRate=1,this.logEndPointUrl="https://firebaselogging.googleapis.com/v0cc/log?format=json_proto",this.flTransportEndpointUrl=yr("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=yr("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}return t.prototype.getAppId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!t)throw fr.create("no app id");return t},t.prototype.getProjectId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!t)throw fr.create("no project id");return t},t.prototype.getApiKey=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!t)throw fr.create("no api key");return t},t.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},t.getInstance=function(){return void 0===dr&&(dr=new t),dr},t}();function _r(){return gr}!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.VISIBLE=1]="VISIBLE",t[t.HIDDEN=2]="HIDDEN"}(mr||(mr={}));var wr=["firebase_","google_","ga_"],Er=new RegExp("^[a-zA-Z]\\w*$");function Tr(){var t=vr.getInstance().navigator;return"serviceWorker"in t?t.serviceWorker.controller?2:3:1}function Ir(){switch(vr.getInstance().document.visibilityState){case"visible":return mr.VISIBLE;case"hidden":return mr.HIDDEN;default:return mr.UNKNOWN}}function Sr(){var t=vr.getInstance().navigator.connection;switch(t&&t.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}var Or="0.0.1",Cr=!0,kr="FIREBASE_INSTALLATIONS_AUTH";function Nr(t){var e=function(){var t=vr.getInstance().localStorage;if(!t)return;var e=t.getItem(cr);if(!e||(n=e,!(Number(n)>Date.now())))return;var n;var r=t.getItem(ur);if(!r)return;try{return JSON.parse(r)}catch(i){return}}();return e?(Pr(e),Promise.resolve()):function(t){return function(){var t=br.getInstance().installationsService.getToken();return t.then((function(t){})),t}().then((function(e){var n="https://firebaseremoteconfig.googleapis.com/v1/projects/"+br.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+br.getInstance().getApiKey(),r=new Request(n,{method:"POST",headers:{Authorization:kr+" "+e},body:JSON.stringify({app_instance_id:t,app_instance_id_token:e,app_id:br.getInstance().getAppId(),app_version:rr,sdk_version:Or})});return fetch(r).then((function(t){if(t.ok)return t.json();throw fr.create("RC response not ok")}))})).catch((function(){pr.info(Ar)}))}(t).then(Pr).then((function(t){return function(t){var e=vr.getInstance().localStorage;if(!t||!e)return;e.setItem(ur,JSON.stringify(t)),e.setItem(cr,String(Date.now()+60*br.getInstance().configTimeToLive*60*1e3))}(t)}),(function(){}))}var Ar="Could not fetch config, will use default configs";function Pr(t){if(!t)return t;var e=br.getInstance(),n=t.entries||{};return void 0!==n.fpr_enabled?e.loggingEnabled="true"===String(n.fpr_enabled):e.loggingEnabled=Cr,n.fpr_log_source&&(e.logSource=Number(n.fpr_log_source)),n.fpr_log_endpoint_url&&(e.logEndPointUrl=n.fpr_log_endpoint_url),n.fpr_log_transport_key&&(e.transportKey=n.fpr_log_transport_key),void 0!==n.fpr_vc_network_request_sampling_rate&&(e.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate)),void 0!==n.fpr_vc_trace_sampling_rate&&(e.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate)),e.logTraceAfterSampling=Rr(e.tracesSamplingRate),e.logNetworkAfterSampling=Rr(e.networkRequestsSamplingRate),t}function Rr(t){return Math.random()<=t}var xr,jr=1;function Dr(){return jr=2,xr=xr||function(){var t=vr.getInstance().document;return new Promise((function(e){if(t&&"complete"!==t.readyState){var n=function n(){"complete"===t.readyState&&(t.removeEventListener("readystatechange",n),e())};t.addEventListener("readystatechange",n)}else e()}))}().then((function(){return function(){var t=br.getInstance().installationsService.getId();return t.then((function(t){gr=t})),t}()})).then((function(t){return Nr(t)})).then((function(){return Lr()}),(function(){return Lr()}))}function Lr(){jr=3}var Mr,Fr=1e4,Ur=3,Vr=[],qr=!1;function Br(t){setTimeout((function(){if(0!==Ur)return Vr.length?void function(){var t=Vr.splice(0,1e3),e=t.map((function(t){return{source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)}}));(function(t,e){return function(t){var e=br.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then((function(t){return t.ok||pr.info("Call to Firebase backend failed."),t.json()})).then((function(t){var n=Number(t.nextRequestWaitMillis),r=Fr;isNaN(n)||(r=Math.max(n,r));var i=t.logResponseDetails;Array.isArray(i)&&i.length>0&&"RETRY_REQUEST_LATER"===i[0].responseAction&&(Vr=Object(l.g)(e,Vr),pr.info("Retry transport request later.")),Ur=3,Br(r)}))})({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:br.getInstance().logSource,log_event:e},t).catch((function(){Vr=Object(l.g)(t,Vr),Ur--,pr.info("Tries left: "+Ur+"."),Br(Fr)}))}():Br(Fr)}),t)}function zr(t){if(!t.eventTime||!t.message)throw fr.create("invalid cc log");Vr=Object(l.g)(Vr,[t])}function Hr(t,e){Mr||(Mr=function(t){return function(){for(var e=[],n=0;n100)&&(e&&e.startsWith(or)&&Yr.indexOf(t)>-1||!t.startsWith("_"))}(t,this.name))throw fr.create("invalid custom metric name",{customMetricName:t});this.counters[t]=function(t){var e=Math.floor(t);return e40)&&!wr.some((function(e){return t.startsWith(e)}))&&!!t.match(Er)}(t),r=function(t){return 0!==t.length&&t.length<=100}(e);if(n&&r)this.customAttributes[t]=e;else{if(!n)throw fr.create("invalid attribute name",{attributeName:t});if(!r)throw fr.create("invalid attribute value",{attributeValue:e})}},t.prototype.getAttribute=function(t){return this.customAttributes[t]},t.prototype.removeAttribute=function(t){void 0!==this.customAttributes[t]&&delete this.customAttributes[t]},t.prototype.getAttributes=function(){return Object(l.a)({},this.customAttributes)},t.prototype.setStartTime=function(t){this.startTimeUs=t},t.prototype.setDuration=function(t){this.durationUs=t},t.prototype.calculateTraceMetrics=function(){var t=this.api.getEntriesByName(this.traceMeasure),e=t&&t[0];e&&(this.durationUs=Math.floor(1e3*e.duration),this.startTimeUs=Math.floor(1e3*(e.startTime+this.api.getTimeOrigin())))},t.createOobTrace=function(e,n,r){var i=vr.getInstance().getUrl();if(i){var o=new t(or+i,!0),a=Math.floor(1e3*vr.getInstance().getTimeOrigin());o.setStartTime(a),e&&e[0]&&(o.setDuration(Math.floor(1e3*e[0].duration)),o.putMetric("domInteractive",Math.floor(1e3*e[0].domInteractive)),o.putMetric("domContentLoadedEventEnd",Math.floor(1e3*e[0].domContentLoadedEventEnd)),o.putMetric("loadEventEnd",Math.floor(1e3*e[0].loadEventEnd)));if(n){var s=n.find((function(t){return"first-paint"===t.name}));s&&s.startTime&&o.putMetric("_fp",Math.floor(1e3*s.startTime));var u=n.find((function(t){return"first-contentful-paint"===t.name}));u&&u.startTime&&o.putMetric(ar,Math.floor(1e3*u.startTime)),r&&o.putMetric(sr,Math.floor(1e3*r))}Kr(o)}},t.createUserTimingTrace=function(e){Kr(new t(e,!1,e))},t}();function Xr(t){var e=t;if(e&&void 0!==e.responseStart){var n=vr.getInstance().getTimeOrigin(),r=Math.floor(1e3*(e.startTime+n)),i=e.responseStart?Math.floor(1e3*(e.responseStart-e.startTime)):void 0,o=Math.floor(1e3*(e.responseEnd-e.startTime));!function(t){var e=br.getInstance();if(e.instrumentationEnabled){var n=t.url,r=e.logEndPointUrl.split("?")[0],i=e.flTransportEndpointUrl.split("?")[0];n!==r&&n!==i&&e.loggingEnabled&&e.logNetworkAfterSampling&&setTimeout((function(){return Hr(t,0)}),0)}}({url:e.name&&e.name.split("?")[0],responsePayloadBytes:e.transferSize,startTimeUs:r,timeToResponseInitiatedUs:i,timeToResponseCompletedUs:o})}}function $r(){_r()&&(setTimeout((function(){return function(){var t=vr.getInstance(),e=t.getEntriesByType("navigation"),n=t.getEntriesByType("paint");if(t.onFirstInputDelay){var r=setTimeout((function(){Jr.createOobTrace(e,n),r=void 0}),5e3);t.onFirstInputDelay((function(t){r&&(clearTimeout(r),Jr.createOobTrace(e,n,t))}))}else Jr.createOobTrace(e,n)}()}),0),setTimeout((function(){return function(){for(var t=vr.getInstance(),e=t.getEntriesByType("resource"),n=0,r=e;n0){var e=t.map((function(t,e){return"("+(e+1)+") "+t})).join(" "),n=li.create("invalid-analytics-context",{errorInfo:e});oi.warn(n.message)}}();var n=t.options.appId;if(!n)throw li.create("no-app-id");if(!t.options.apiKey){if(!t.options.measurementId)throw li.create("no-api-key");oi.warn('The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID '+t.options.measurementId+' provided in the "measurementId" field in the local Firebase config.')}if(null!=_i[n])throw li.create("already-exists",{id:n});if(!Si){(function(){for(var t=window.document.getElementsByTagName("script"),e=0,n=Object.values(t);e=0},t.prototype.asNumber=function(){if("static"===this._source)return 0;var t=Number(this._value);return isNaN(t)&&(t=0),t},t.prototype.getSource=function(){return this._source},t}(),Fi=function(){function t(t,e,n,r,i){this.app=t,this._client=e,this._storageCache=n,this._storage=r,this._logger=i,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:6e4,minimumFetchIntervalMillis:432e5},this.defaultConfig={}}return t.prototype.setLogLevel=function(t){switch(t){case"debug":this._logger.logLevel=o.a.DEBUG;break;case"silent":this._logger.logLevel=o.a.SILENT;break;default:this._logger.logLevel=o.a.ERROR}},Object.defineProperty(t.prototype,"fetchTimeMillis",{get:function(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastFetchStatus",{get:function(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"},enumerable:!1,configurable:!0}),t.prototype.activate=function(){return Object(l.b)(this,void 0,void 0,(function(){var t,e,n;return Object(l.d)(this,(function(r){switch(r.label){case 0:return[4,Promise.all([this._storage.getLastSuccessfulFetchResponse(),this._storage.getActiveConfigEtag()])];case 1:return t=r.sent(),e=t[0],n=t[1],e&&e.config&&e.eTag&&e.eTag!==n?[4,Promise.all([this._storageCache.setActiveConfig(e.config),this._storage.setActiveConfigEtag(e.eTag)])]:[2,!1];case 2:return r.sent(),[2,!0]}}))}))},t.prototype.ensureInitialized=function(){var t=this;return this._initializePromise||(this._initializePromise=this._storageCache.loadFromStorage().then((function(){t._isInitializationComplete=!0}))),this._initializePromise},t.prototype.fetch=function(){return Object(l.b)(this,void 0,void 0,(function(){var t,e,n,r=this;return Object(l.d)(this,(function(i){switch(i.label){case 0:t=new Di,setTimeout((function(){return Object(l.b)(r,void 0,void 0,(function(){return Object(l.d)(this,(function(e){return t.abort(),[2]}))}))}),this.settings.fetchTimeoutMillis),i.label=1;case 1:return i.trys.push([1,4,,6]),[4,this._client.fetch({cacheMaxAgeMillis:this.settings.minimumFetchIntervalMillis,signal:t})];case 2:return i.sent(),[4,this._storageCache.setLastFetchStatus("success")];case 3:return i.sent(),[3,6];case 4:return e=i.sent(),n=function(t,e){return t instanceof a.c&&-1!==t.code.indexOf(e)}(e,"fetch-throttle")?"throttle":"failure",[4,this._storageCache.setLastFetchStatus(n)];case 5:throw i.sent(),e;case 6:return[2]}}))}))},t.prototype.fetchAndActivate=function(){return Object(l.b)(this,void 0,void 0,(function(){return Object(l.d)(this,(function(t){switch(t.label){case 0:return[4,this.fetch()];case 1:return t.sent(),[2,this.activate()]}}))}))},t.prototype.getAll=function(){var t=this;return function(t,e){void 0===t&&(t={});void 0===e&&(e={});return Object.keys(Object(l.a)(Object(l.a)({},t),e))}(this._storageCache.getActiveConfig(),this.defaultConfig).reduce((function(e,n){return e[n]=t.getValue(n),e}),{})},t.prototype.getBoolean=function(t){return this.getValue(t).asBoolean()},t.prototype.getNumber=function(t){return this.getValue(t).asNumber()},t.prototype.getString=function(t){return this.getValue(t).asString()},t.prototype.getValue=function(t){this._isInitializationComplete||this._logger.debug('A value was requested for key "'+t+'" before SDK initialization completed. Await on ensureInitialized if the intent was to get a previously activated value.');var e=this._storageCache.getActiveConfig();return e&&void 0!==e[t]?new Mi("remote",e[t]):this.defaultConfig&&void 0!==this.defaultConfig[t]?new Mi("default",String(this.defaultConfig[t])):(this._logger.debug('Returning static value for key "'+t+'". Define a default or remote value if this is unintentional.'),new Mi("static"))},t}();function Ui(t,e){var n=t.target.error||void 0;return xi.create(e,{originalErrorMessage:n&&n.message})}var Vi="app_namespace_store";var qi=function(){function t(t,e,n,r){void 0===r&&(r=new Promise((function(t,e){var n=indexedDB.open("firebase_remote_config",1);n.onerror=function(t){e(Ui(t,"storage-open"))},n.onsuccess=function(e){t(e.target.result)},n.onupgradeneeded=function(t){var e=t.target.result;switch(t.oldVersion){case 0:e.createObjectStore(Vi,{keyPath:"compositeKey"})}}}))),this.appId=t,this.appName=e,this.namespace=n,this.openDbPromise=r}return t.prototype.getLastFetchStatus=function(){return this.get("last_fetch_status")},t.prototype.setLastFetchStatus=function(t){return this.set("last_fetch_status",t)},t.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.get("last_successful_fetch_timestamp_millis")},t.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.set("last_successful_fetch_timestamp_millis",t)},t.prototype.getLastSuccessfulFetchResponse=function(){return this.get("last_successful_fetch_response")},t.prototype.setLastSuccessfulFetchResponse=function(t){return this.set("last_successful_fetch_response",t)},t.prototype.getActiveConfig=function(){return this.get("active_config")},t.prototype.setActiveConfig=function(t){return this.set("active_config",t)},t.prototype.getActiveConfigEtag=function(){return this.get("active_config_etag")},t.prototype.setActiveConfigEtag=function(t){return this.set("active_config_etag",t)},t.prototype.getThrottleMetadata=function(){return this.get("throttle_metadata")},t.prototype.setThrottleMetadata=function(t){return this.set("throttle_metadata",t)},t.prototype.deleteThrottleMetadata=function(){return this.delete("throttle_metadata")},t.prototype.get=function(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n=this;return Object(l.d)(this,(function(i){switch(i.label){case 0:return[4,this.openDbPromise];case 1:return e=i.sent(),[2,new Promise((function(i,o){var a=e.transaction([Vi],"readonly").objectStore(Vi),s=n.createCompositeKey(t);try{var u=a.get(s);u.onerror=function(t){o(Ui(t,"storage-get"))},u.onsuccess=function(t){var e=t.target.result;i(e?e.value:void 0)}}catch(r){o(xi.create("storage-get",{originalErrorMessage:r&&r.message}))}}))]}}))}))},t.prototype.set=function(t,e){return Object(l.b)(this,void 0,void 0,(function(){var n,i=this;return Object(l.d)(this,(function(o){switch(o.label){case 0:return[4,this.openDbPromise];case 1:return n=o.sent(),[2,new Promise((function(o,a){var s=n.transaction([Vi],"readwrite").objectStore(Vi),u=i.createCompositeKey(t);try{var c=s.put({compositeKey:u,value:e});c.onerror=function(t){a(Ui(t,"storage-set"))},c.onsuccess=function(){o()}}catch(r){a(xi.create("storage-set",{originalErrorMessage:r&&r.message}))}}))]}}))}))},t.prototype.delete=function(t){return Object(l.b)(this,void 0,void 0,(function(){var e,n=this;return Object(l.d)(this,(function(i){switch(i.label){case 0:return[4,this.openDbPromise];case 1:return e=i.sent(),[2,new Promise((function(i,o){var a=e.transaction([Vi],"readwrite").objectStore(Vi),s=n.createCompositeKey(t);try{var u=a.delete(s);u.onerror=function(t){o(Ui(t,"storage-delete"))},u.onsuccess=function(){i()}}catch(r){o(xi.create("storage-delete",{originalErrorMessage:r&&r.message}))}}))]}}))}))},t.prototype.createCompositeKey=function(t){return[this.appId,this.appName,this.namespace,t].join()},t}(),Bi=function(){function t(t){this.storage=t}return t.prototype.getLastFetchStatus=function(){return this.lastFetchStatus},t.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.lastSuccessfulFetchTimestampMillis},t.prototype.getActiveConfig=function(){return this.activeConfig},t.prototype.loadFromStorage=function(){return Object(l.b)(this,void 0,void 0,(function(){var t,e,n,r,i,o;return Object(l.d)(this,(function(a){switch(a.label){case 0:return t=this.storage.getLastFetchStatus(),e=this.storage.getLastSuccessfulFetchTimestampMillis(),n=this.storage.getActiveConfig(),[4,t];case 1:return(r=a.sent())&&(this.lastFetchStatus=r),[4,e];case 2:return(i=a.sent())&&(this.lastSuccessfulFetchTimestampMillis=i),[4,n];case 3:return(o=a.sent())&&(this.activeConfig=o),[2]}}))}))},t.prototype.setLastFetchStatus=function(t){return this.lastFetchStatus=t,this.storage.setLastFetchStatus(t)},t.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.lastSuccessfulFetchTimestampMillis=t,this.storage.setLastSuccessfulFetchTimestampMillis(t)},t.prototype.setActiveConfig=function(t){return this.activeConfig=t,this.storage.setActiveConfig(t)},t}();function zi(t,e){return new Promise((function(n,r){var i=Math.max(e-Date.now(),0),o=setTimeout(n,i);t.addEventListener((function(){clearTimeout(o),r(xi.create("fetch-throttle",{throttleEndTimeMillis:e}))}))}))}var Hi,Ki=function(){function t(t,e){this.client=t,this.storage=e}return t.prototype.fetch=function(t){return Object(l.b)(this,void 0,void 0,(function(){var e;return Object(l.d)(this,(function(n){switch(n.label){case 0:return[4,this.storage.getThrottleMetadata()];case 1:return e=n.sent()||{backoffCount:0,throttleEndTimeMillis:Date.now()},[2,this.attemptFetch(t,e)]}}))}))},t.prototype.attemptFetch=function(t,e){var n=e.throttleEndTimeMillis,r=e.backoffCount;return Object(l.b)(this,void 0,void 0,(function(){var e,i,o;return Object(l.d)(this,(function(s){switch(s.label){case 0:return[4,zi(t.signal,n)];case 1:s.sent(),s.label=2;case 2:return s.trys.push([2,5,,7]),[4,this.client.fetch(t)];case 3:return e=s.sent(),[4,this.storage.deleteThrottleMetadata()];case 4:return s.sent(),[2,e];case 5:if(!function(t){if(!(t instanceof a.c)||!t.customData)return!1;var e=Number(t.customData.httpStatus);return 429===e||500===e||503===e||504===e}(i=s.sent()))throw i;return o={throttleEndTimeMillis:Date.now()+Object(a.j)(r),backoffCount:r+1},[4,this.storage.setThrottleMetadata(o)];case 6:return s.sent(),[2,this.attemptFetch(t,o)];case 7:return[2]}}))}))},t}(),Wi="@firebase/remote-config";(Hi=i.a).INTERNAL.registerComponent(new u.a("remoteConfig",(function(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("installations").getImmediate();if("undefined"===typeof window)throw xi.create("registration-window");var i=n.options,a=i.projectId,s=i.apiKey,u=i.appId;if(!a)throw xi.create("registration-project-id");if(!s)throw xi.create("registration-api-key");if(!u)throw xi.create("registration-app-id");e=e||"firebase";var c=new qi(u,n.name,e),l=new Bi(c),h=new o.b(Wi);h.logLevel=o.a.ERROR;var f=new ji(r,Hi.SDK_VERSION,e,a,s,u),p=new Ki(f,c),d=new Pi(p,c,l,h),v=new Fi(n,d,l,c,h);return v.ensureInitialized(),v}),"PUBLIC").setMultipleInstances(!0)),Hi.registerVersion(Wi,"0.1.30");i.a.registerVersion("firebase","8.2.1","app");console.warn("\nIt looks like you're using the development build of the Firebase JS SDK.\nWhen deploying Firebase apps to production, it is advisable to only import\nthe individual SDK components you intend to use.\n\nFor the module builds, these are available in the following manner\n(replace with the name of a component - i.e. auth, database, etc):\n\nCommonJS Modules:\nconst firebase = require('firebase/app');\nrequire('firebase/');\n\nES Modules:\nimport firebase from 'firebase/app';\nimport 'firebase/';\n\nTypescript:\nimport firebase from 'firebase/app';\nimport 'firebase/';\n"),i.a.registerVersion("firebase","8.2.1")},function(t,e,n){!function(t){"use strict";function e(t){return Array.prototype.slice.call(t)}function n(t){return new Promise((function(e,n){t.onsuccess=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function r(t,e,r){var i,o=new Promise((function(o,a){n(i=t[e].apply(t,r)).then(o,a)}));return o.request=i,o}function i(t,e,n){var i=r(t,e,n);return i.then((function(t){if(t)return new l(t,i.request)}))}function o(t,e,n){n.forEach((function(n){Object.defineProperty(t.prototype,n,{get:function(){return this[e][n]},set:function(t){this[e][n]=t}})}))}function a(t,e,n,i){i.forEach((function(i){i in n.prototype&&(t.prototype[i]=function(){return r(this[e],i,arguments)})}))}function s(t,e,n,r){r.forEach((function(r){r in n.prototype&&(t.prototype[r]=function(){return this[e][r].apply(this[e],arguments)})}))}function u(t,e,n,r){r.forEach((function(r){r in n.prototype&&(t.prototype[r]=function(){return i(this[e],r,arguments)})}))}function c(t){this._index=t}function l(t,e){this._cursor=t,this._request=e}function h(t){this._store=t}function f(t){this._tx=t,this.complete=new Promise((function(e,n){t.oncomplete=function(){e()},t.onerror=function(){n(t.error)},t.onabort=function(){n(t.error)}}))}function p(t,e,n){this._db=t,this.oldVersion=e,this.transaction=new f(n)}function d(t){this._db=t}function v(t,e,n){var i=r(indexedDB,"open",[t,e]),o=i.request;return o&&(o.onupgradeneeded=function(t){n&&n(new p(o.result,t.oldVersion,o.transaction))}),i.then((function(t){return new d(t)}))}function y(t){return r(indexedDB,"deleteDatabase",[t])}o(c,"_index",["name","keyPath","multiEntry","unique"]),a(c,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),u(c,"_index",IDBIndex,["openCursor","openKeyCursor"]),o(l,"_cursor",["direction","key","primaryKey","value"]),a(l,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach((function(t){t in IDBCursor.prototype&&(l.prototype[t]=function(){var e=this,r=arguments;return Promise.resolve().then((function(){return e._cursor[t].apply(e._cursor,r),n(e._request).then((function(t){if(t)return new l(t,e._request)}))}))})})),h.prototype.createIndex=function(){return new c(this._store.createIndex.apply(this._store,arguments))},h.prototype.index=function(){return new c(this._store.index.apply(this._store,arguments))},o(h,"_store",["name","keyPath","indexNames","autoIncrement"]),a(h,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),u(h,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),s(h,"_store",IDBObjectStore,["deleteIndex"]),f.prototype.objectStore=function(){return new h(this._tx.objectStore.apply(this._tx,arguments))},o(f,"_tx",["objectStoreNames","mode"]),s(f,"_tx",IDBTransaction,["abort"]),p.prototype.createObjectStore=function(){return new h(this._db.createObjectStore.apply(this._db,arguments))},o(p,"_db",["name","version","objectStoreNames"]),s(p,"_db",IDBDatabase,["deleteObjectStore","close"]),d.prototype.transaction=function(){return new f(this._db.transaction.apply(this._db,arguments))},o(d,"_db",["name","version","objectStoreNames"]),s(d,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach((function(t){[h,c].forEach((function(n){t in n.prototype&&(n.prototype[t.replace("open","iterate")]=function(){var n=e(arguments),r=n[n.length-1],i=this._store||this._index,o=i[t].apply(i,n.slice(0,-1));o.onsuccess=function(){r(o.result)}})}))})),[c,h].forEach((function(t){t.prototype.getAll||(t.prototype.getAll=function(t,e){var n=this,r=[];return new Promise((function(i){n.iterateCursor(t,(function(t){t?(r.push(t.value),void 0===e||r.length!=e?t.continue():i(r)):i(r)}))}))})})),t.openDb=v,t.deleteDb=y,Object.defineProperty(t,"__esModule",{value:!0})}(e)},function(t,e,n){"use strict";t.exports=n(16)},function(t,e,n){"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(t,e){for(var n,s,u=a(t),c=1;c1)for(var n=1;n