diff --git a/asset-manifest.json b/asset-manifest.json
index ea2bd7a..82e8c09 100644
--- a/asset-manifest.json
+++ b/asset-manifest.json
@@ -1,7 +1,7 @@
{
"files": {
- "main.css": "/backgammon/static/css/main.d409741d.css",
- "main.js": "/backgammon/static/js/main.de308495.js",
+ "main.css": "/backgammon/static/css/main.04a1a27a.css",
+ "main.js": "/backgammon/static/js/main.2a1b5b7c.js",
"static/media/match-settings-title.svg": "/backgammon/static/media/match-settings-title.410d7b07ad339c9a3c12.svg",
"static/media/backgammon-title.svg": "/backgammon/static/media/backgammon-title.34ee913e01db821eea92.svg",
"static/media/allow-doubling.svg": "/backgammon/static/media/allow-doubling.46f6b3ad75e29c193106.svg",
@@ -40,11 +40,11 @@
"static/media/checker-home-light.svg": "/backgammon/static/media/checker-home-light.8aa4877b9e0f9f946c24.svg",
"static/media/online-multiplayer-button-spinner.svg": "/backgammon/static/media/online-multiplayer-button-spinner.7c87ae20b24b79031ab9.svg",
"static/media/loading-spinner.svg": "/backgammon/static/media/loading-spinner.2e1c3e92b0cc05ad6bdd.svg",
- "main.d409741d.css.map": "/backgammon/static/css/main.d409741d.css.map",
- "main.de308495.js.map": "/backgammon/static/js/main.de308495.js.map"
+ "main.04a1a27a.css.map": "/backgammon/static/css/main.04a1a27a.css.map",
+ "main.2a1b5b7c.js.map": "/backgammon/static/js/main.2a1b5b7c.js.map"
},
"entrypoints": [
- "static/css/main.d409741d.css",
- "static/js/main.de308495.js"
+ "static/css/main.04a1a27a.css",
+ "static/js/main.2a1b5b7c.js"
]
}
\ No newline at end of file
diff --git a/index.html b/index.html
index 1c816de..703e468 100644
--- a/index.html
+++ b/index.html
@@ -1 +1 @@
-
Backgammon
\ No newline at end of file
+Backgammon
\ No newline at end of file
diff --git a/static/css/main.d409741d.css b/static/css/main.04a1a27a.css
similarity index 56%
rename from static/css/main.d409741d.css
rename to static/css/main.04a1a27a.css
index 5c18851..46cf971 100644
--- a/static/css/main.d409741d.css
+++ b/static/css/main.04a1a27a.css
@@ -1,2 +1,2 @@
-.App{text-align:center}.App-logo{height:40vmin;pointer-events:none}@media(prefers-reduced-motion:no-preference){.App-logo{animation:App-logo-spin 20s linear infinite}}.App-wrapper{align-items:center;background:linear-gradient(180deg,#3b4587,#151516) border-box;display:flex;flex-direction:column;font-family:Barlow,sans-serif;justify-content:center;min-height:300px;min-width:400px;overflow:hidden;position:relative}.App-wrapper,.App-wrapper.mainmenu{height:100vh;width:100vw}.App-header{align-items:center;background-color:#282c34;color:#fff;display:flex;flex-direction:column;font-family:Barlow,sans-serif;font-size:calc(10px + 2vmin);justify-content:center;min-height:100vh}.App-link{color:#61dafb}@keyframes App-logo-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.Waiting-text-wrapper{display:flex}.Begin-game-button-wrapper.waiting-text{color:#b8b8b8;font-size:.8em;justify-content:center}.Waiting-spinner{animation-duration:2s;animation-iteration-count:infinite;animation-name:spin;animation-timing-function:linear;background-image:url(/backgammon/static/media/loading-spinner.2e1c3e92b0cc05ad6bdd.svg);background-position:50%;background-repeat:no-repeat;height:40%;margin-top:1%;width:8%}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.Accept-double-button,.Begin-game-button,.Forfeit-game-button,.Offer-double-button,.Roll-button{background:linear-gradient(90deg,#3f3217,#564112);border:.2em double #816c3d;border-radius:min(1vw,1em);color:#b8b8b8;font-family:Barlow,sans-serif;font-size:max(1.5vh,1.5vw);font-weight:700;padding:.5vh;text-align:center;transition:.2s;width:10vw}.Accept-double-button:hover,.Begin-game-button:hover,.Forfeit-game-button:hover,.Offer-double-button:hover,.Roll-button:hover,.Settings-menu-button:hover{transform:scale(110%)}.Game-board-wrapper{align-items:center;color:#fff;display:flex;height:30vw;justify-content:center;min-height:150px;min-width:300px;width:60vw}.Networked-gameboard-spinner{animation-duration:2s;animation-iteration-count:infinite;animation-name:spin;animation-timing-function:linear;background-image:url(/backgammon/static/media/online-multiplayer-button-spinner.7c87ae20b24b79031ab9.svg);background-position:50%;background-repeat:no-repeat;height:20%;width:20%}.Main-menu-wrapper{align-items:center;color:#fff;display:flex;flex-direction:column;height:60%;min-height:300px;min-width:400px;width:60%}.Title-wrapper{container:title-container/inline-size;background-image:url(/backgammon/static/media/backgammon-title.34ee913e01db821eea92.svg);background-position:50%;background-repeat:no-repeat;filter:drop-shadow(0 1vh .3vh rgba(0,0,0,.35));height:25%;text-align:center;vertical-align:middle;width:80%}.Title-text{font-size:3.5em}@container title-container (min-width: 400px){.Title-text{font-size:max(3.5em,3.5em + 4cqi)}}.Menu-button-wrapper{container:menu-button-wrapper/inline-size;display:flex;flex-direction:column;height:50%;justify-content:space-around;width:60%}.Local-multiplayer-button,.Online-multiplayer-button{background-position:50%;background-repeat:no-repeat;cursor:pointer;display:flex;filter:drop-shadow(0 1vh .3vh rgba(0,0,0,.35));font-family:Barlow,sans-serif;font-size:max(2vh,2vw);height:40%;transition:.2s;width:100%}@media screen and (orientation:portrait){.Title-wrapper{height:16%}.Menu-button-wrapper{height:30%}}.Local-multiplayer-button{background-image:url(/backgammon/static/media/local-multiplayer-button.04a8bf8817e1c77c6937.svg)}.Online-multiplayer-button{background-image:url(/backgammon/static/media/online-multiplayer-button.967df5a8b632a39956f1.svg)}.Local-multiplayer-button:active,.Local-multiplayer-button:hover,.Online-multiplayer-button:active,.Online-multiplayer-button:hover{transform:scale(105%)}.Online-multiplayer-button-spinner{animation-duration:2s;animation-iteration-count:infinite;animation-name:spin;animation-timing-function:linear;background-image:url(/backgammon/static/media/online-multiplayer-button-spinner.7c87ae20b24b79031ab9.svg);background-position:50%;background-repeat:no-repeat;height:40%;width:100%}.Credits-text{bottom:1%;color:#6b7195;font-size:.6em;position:absolute;right:1%;text-align:right}.Match-settings-menu-wrapper{display:flex;flex-direction:column;height:60%;min-height:300px;min-width:400px;width:45%}.Match-settings-title-wrapper{background-image:url(/backgammon/static/media/match-settings-title.410d7b07ad339c9a3c12.svg);background-position:50%;background-repeat:no-repeat;filter:drop-shadow(0 .5vh .3vh rgba(0,0,0,.35));height:20%;vertical-align:middle;width:35%}.Doubling-cube-settings-row,.Match-points-settings-row,.Url-copy-row{align-items:center;display:flex;height:15%;margin-top:4%;width:100%}.Play-to-wrapper{background-image:url(/backgammon/static/media/play-to.73dda2d0e9b2cc8a3688.svg);background-position-y:center;background-repeat:no-repeat;width:14%}.Doubling-cube-text-wrapper,.Play-to-wrapper{filter:drop-shadow(0 .5vh .3vh rgba(0,0,0,.35));height:60%;vertical-align:middle}.Doubling-cube-text-wrapper{background-image:url(/backgammon/static/media/allow-doubling.46f6b3ad75e29c193106.svg);background-position-y:center;background-repeat:no-repeat;width:24%}.Url-title-wrapper{background-image:url(/backgammon/static/media/url-title.b6f78b0d8897abe0b49e.svg);background-position-y:center;background-repeat:no-repeat;filter:drop-shadow(0 .5vh .3vh rgba(0,0,0,.35));height:40%;vertical-align:middle;width:14%}.Url-form-wrapper{container:url-form-container/inline-size;align-items:flex-start;display:flex;flex-direction:column;height:100%;width:80%}.Url-form .form-control{background-color:#474747;color:#dcd4d4;font-size:1em}.Url-form-text{background-color:#332e2e;border:solid #dcd4d4;border-radius:1vw;color:#dcd4d4;font-size:.9em;padding:1vh 1vw}.Url-form-subtext{color:#dcd4d4;font-size:.7em;margin-left:1vw}@container url-form-container (min-width: 600px){.Url-form-text{font-size:1.5em}.Url-form-subtext{font-size:1em}}.Url-form-text-and-copy{align-items:center;display:flex;width:100%}.Url-form-copy{background-image:url(/backgammon/static/media/copy-icon.65dafb6d3844799c4c65.svg);background-position-y:center;background-repeat:no-repeat;cursor:pointer;height:80%;margin-left:2%;transition:.2s;width:8%}.Url-form-copy.highlight{background-image:url(/backgammon/static/media/copy-icon-clicked.f5926b66db8d1ba23cb1.svg)}.Url-form-copy:active,.Url-form-copy:hover{transform:scale(105%)}.Start-game-button-row{align-items:center;display:flex;height:15%;justify-content:center;margin-top:8%;width:100%}.Start-game-button{background:linear-gradient(90deg,#3f3217,#564112);border:.2em double #816c3d;border-radius:min(1vw,1em);color:#b8b8b8;font-family:Barlow,sans-serif;font-size:max(1.5vh,1.5vw);font-weight:700;padding:.5vh;text-align:center;transition:.2s;width:10vw}.Start-game-button:hover{transform:scale(105%)}.Doubling-cube-toggle-form{align-items:center;display:flex;height:100%;margin-left:4%;width:70%}.Doubling-cube-toggle-off,.Doubling-cube-toggle-on{background-position:50%;background-repeat:no-repeat;height:30%;width:15%}.Doubling-cube-toggle-off{background-image:url(/backgammon/static/media/off-disabled.bac8f3ff3f6583ec64c3.svg)}.Doubling-cube-toggle-on{background-image:url(/backgammon/static/media/on-disabled.48a39b5edf0f54f4e882.svg)}.Doubling-cube-toggle-off.enabled{background-image:url(/backgammon/static/media/off-enabled.d4f9b287b09cd0c7064c.svg)}.Doubling-cube-toggle-on.enabled{background-image:url(/backgammon/static/media/on-enabled.5b26f3fe1de148c69c98.svg)}.Doubling-cube-toggle.form-switch{margin-left:4%;margin-right:4%}.Doubling-cube-toggle .form-check-input{height:4vh;width:6vw}.Doubling-cube-toggle .form-check-input:checked{background-color:#4488ec}.Match-points-buttons-wrapper{display:flex;height:100%;width:86%}.Match-points-button{align-content:center;background-color:#cdb288;background-position:50%;background-repeat:no-repeat;background-size:15%;border-radius:10%;cursor:pointer;font-size:max(1.3em,2vw);font-weight:700;height:max(5vw,5vh);margin-left:2%;opacity:40%;text-align:center;transition:.2s;width:max(5vw,5vh)}.Match-points-button.selected{border:max(3px,.3vw) solid #fff;opacity:100%}.Match-points-button:active,.Match-points-button:hover{transform:scale(105%)}.Player-card-wrapper{background:#0f142f;border:min(5px,.4vw) #22274a;border-radius:min(1vw,1em) min(1vw,1em) 0 0;border-style:solid solid none;color:#b8b8b8;display:flex;height:9%;left:66%;position:relative;width:28%}.Player-card-wrapper.current{filter:drop-shadow(0 0 1vh #f7dcab)}.Player-card-wrapper.cw{left:6%}.Player-card-wrapper.bottom{background:#251f13;border:min(5px,.4vw) solid #564112;border-radius:0 0 min(1vw,1em) min(1vw,1em);border-top-style:none}.Player-card-checker-wrapper{display:flex;width:24%}.Player-card-checker-wrapper .Checker{height:60%;margin:20%;width:60%}.Player-name-and-score-wrapper{display:flex;flex-direction:column;width:52%}.Player-name-wrapper{font-size:2vh;font-weight:700;height:40%}.Player-card-doubling-cube-wrapper{align-content:center;width:24%}.Player-card-doubling-cube-wrapper .Doubling-cube{height:65%;margin-left:20%;width:60%}@media screen and (orientation:landscape){.Player-name-wrapper{font-size:1.2vw;font-weight:700;height:40%;margin-top:4%}.Player-score-wrapper{display:flex;font-size:.8vw;height:50%;margin-top:4%;white-space:nowrap}}@media screen and (orientation:portrait){.Player-name-wrapper{font-size:2vh;font-weight:700;height:40%}.Player-score-wrapper{display:flex;font-size:.8vw;height:50%}}.Player-card-total-match-points{font-weight:700}.Player-points-wrapper{margin-left:.8vw}.Information-text-wrapper{height:4vh;margin-left:5.5%;margin-right:5.5%;width:89%}.Information-text{color:#b8b8b8}.Game-area-wrapper{filter:drop-shadow(0 0 .5vh #000000)}.Game-board-half{background-image:url(/backgammon/static/media/board-background.096c5325cc02d43c3c3b.svg);background-size:cover;border-color:#212529;border-width:.8vh;display:flex;flex-direction:column;height:100%;justify-content:space-between;position:relative;width:45.5%;z-index:1}.Game-board-half.left{background:url(/backgammon/static/media/board-background.096c5325cc02d43c3c3b.svg) padding-box,linear-gradient(180deg,#22274a,#564112) border-box;border:min(5px,.4vw) solid #0000;border-bottom-left-radius:min(1vw,1em);border-right-style:none;border-top-left-radius:min(1vw,1em)}.Game-board-half.left.cw{border-bottom-left-radius:0;border-top-left-radius:0}.Game-board-half.right{background:url(/backgammon/static/media/board-background.096c5325cc02d43c3c3b.svg) padding-box,linear-gradient(180deg,#22274a,#564112) border-box;border:min(5px,.4vw) solid #0000;border-left-style:none}.Game-board-half.right.cw{border-bottom-right-radius:min(1vw,1em);border-top-right-radius:min(1vw,1em)}.Game-board-quadrant{display:flex;height:50%;justify-content:space-evenly;width:100%}.Game-board-quadrant.bottom{align-items:flex-end}.Game-board-bar{background:url(/backgammon/static/media/dots.266ad2859fc9b3aee84f.svg) 50%/420% padding-box,linear-gradient(180deg,#22274a,#564112) border-box;width:4%;z-index:1}.Game-board-bar,.Game-board-home{border:min(5px,.4vw) solid #0000;display:flex;flex-direction:column;height:100%;justify-content:space-around}.Game-board-home{background:url(/backgammon/static/media/dots.266ad2859fc9b3aee84f.svg) 50%/300% padding-box,linear-gradient(180deg,#22274a,#564112) border-box;border-bottom-right-radius:min(1vw,1em);border-left-style:none;border-top-right-radius:min(1vw,1em);width:5%}.Game-board-home.cw{border-bottom-left-radius:min(1vw,1em);border-bottom-right-radius:0;border-left-style:solid;border-right-style:none;border-top-left-radius:min(1vw,1em);border-top-right-radius:0}.Point-wrapper{display:flex;height:87%;position:relative;width:16.667%}.Point-wrapper-highlight{height:100%;margin-left:10%;position:absolute;width:80%;z-index:1}.Point-wrapper-highlight.from{background-color:hsla(48,70%,64%,.329)}.Point-wrapper-highlight.to{background:url(/backgammon/static/media/stripes.c676f00f1b408a99ab96.svg);background-size:cover}.Point-wrapper-highlight.noMove{animation-duration:1s;animation-name:nomove}@keyframes nomove{0%{background:url(/backgammon/static/media/stripes-red.5075527d28b88569681b.svg);background-size:cover}to{background:url(/backgammon/static/media/stripes-red-fade.4cdc118757f83dc7367a.svg);background-size:cover}}.Point-wrapper-highlight.bottom{border-top-left-radius:5vh;border-top-right-radius:5vh}.Point-wrapper-highlight.top{border-bottom-left-radius:5vh;border-bottom-right-radius:5vh}.Point-triangle{height:100%;margin-left:10%;position:absolute;width:80%;z-index:1}.Point-triangle-inner{height:96%;margin-left:12%;position:absolute;width:76%;z-index:2}.Point-triangle-inner.bottom{margin-top:12%}.Point-triangle-inner.even{background-color:#0f1744}.Point-triangle-inner.odd{background-color:#885525}.Point-triangle-inner.top,.Point-triangle.top{-webkit-clip-path:polygon(0 0,50% 100%,100% 0);clip-path:polygon(0 0,50% 100%,100% 0)}.Point-triangle-inner.bottom,.Point-triangle.bottom{-webkit-clip-path:polygon(0 100%,50% 0,100% 100%);clip-path:polygon(0 100%,50% 0,100% 100%)}.Point-triangle.even{background-color:#636781}.Point-triangle.odd{background-color:#997345}.Checkers-wrapper{align-items:center;display:flex;flex-wrap:wrap;height:100%;width:100%;z-index:3}.Checkers-wrapper.top{flex-direction:column}.Checkers-wrapper.bottom{flex-direction:column-reverse}.Point{height:41vh;width:15%}.Checker{filter:drop-shadow(0 0 .2vh rgba(0,0,0,.6));height:15%;transition:transform .3s ease-out,filter .5s ease-in-out;width:45%;will-change:transform,filter;z-index:4}.Checker.white{background-image:url(/backgammon/static/media/checker-light.e1aa85fcf8f8cc1f655d.svg);background-repeat:no-repeat}.Checker.highlighted-pulse,.Checker.selected-pulse{filter:drop-shadow(0 0 .5vh #f7dcab)}.Checker.white.selected-pulse{background-image:url(/backgammon/static/media/checker-light-selected.0682a00050929616b5fa.svg);background-repeat:no-repeat}.Checker.black.selected-pulse{background-image:url(/backgammon/static/media/checker-dark-selected.9076eecdb1839d51a87b.svg);background-repeat:no-repeat}.Checker.highlighted,.Checker.selected{filter:drop-shadow(0 0 .1vh #f7dcab)}.Checker.black{background-image:url(/backgammon/static/media/checker-dark.248faffe392f67eff7e5.svg);background-repeat:no-repeat}.Player-one-bar-checkers,.Player-two-bar-checkers{align-items:center;display:flex;height:47.5%}.Player-one-bar-checkers{flex-direction:column-reverse}.Player-two-bar-checkers{flex-direction:column}.Player-one-bar-checkers.highlight{background-color:hsla(48,70%,64%,.329);border-bottom-left-radius:5vh;border-bottom-right-radius:5vh}.Player-two-bar-checkers.highlight{background-color:hsla(48,70%,64%,.329);border-top-left-radius:5vh;border-top-right-radius:5vh}.Game-board-bar-spacer{height:5%}.Player-one-bar-checkers .Checker,.Player-two-bar-checkers .Checker{height:15%;width:120%}.Player-one-home-checkers,.Player-two-home-checkers{align-items:center;display:flex;flex-direction:column;height:45.5%}.Player-one-home-checkers .Checker.white{background-image:url(/backgammon/static/media/checker-home-light.8aa4877b9e0f9f946c24.svg)}.Player-one-home-checkers .Checker.black{background-image:url(/backgammon/static/media/checker-home-dark.cbae77390308774a0c74.svg)}.Player-two-home-checkers .Checker.white{background-image:url(/backgammon/static/media/checker-home-light.8aa4877b9e0f9f946c24.svg)}.Player-two-home-checkers .Checker.black{background-image:url(/backgammon/static/media/checker-home-dark.cbae77390308774a0c74.svg)}.Player-one-home-checkers,.Player-two-home-checkers.p2{justify-content:flex-end}.Player-one-home-checkers.p2{justify-content:flex-start}.Player-one-home-checkers.highlighted{border-top-left-radius:1vh;border-top-right-radius:1vh}.Player-one-home-checkers.highlighted,.Player-two-home-checkers.highlighted{background:url(/backgammon/static/media/stripes.c676f00f1b408a99ab96.svg);background-size:cover}.Player-two-home-checkers.highlighted{border-bottom-left-radius:1vh;border-bottom-right-radius:1vh}.Game-board-home-spacer{height:9%}.Player-one-home-checkers .Checker,.Player-two-home-checkers .Checker{border-radius:10% 10% 34% 34%;height:4%;margin-bottom:3%;margin-top:3%;padding-top:0;width:80%}.Dice-row-spacer,.Submit-button-wrapper,.Undo-button-wrapper{height:4vw;width:4vw}.Submit-button,.Undo-button{background:url(/backgammon/static/media/checkmark.f0d5863c06fcf58dfa1d.svg) 50%/60% padding-box,linear-gradient(90deg,#3f3217,#564112) border-box;background-repeat:no-repeat;border-color:#816c3d;border-radius:1vh;border-style:double;height:80%;margin-left:10%;margin-top:10%;transition:.2s;width:80%}.Undo-button-wrapper .Undo-button{background:url(/backgammon/static/media/undo-arrow.d3b379507e968a3f8245.svg) 50%/60% padding-box,linear-gradient(90deg,#3f3217,#564112) border-box;background-repeat:no-repeat}.Submit-button:hover,.Undo-button:hover{transform:scale(110%)}.mainmenu .Settings-menu-button-wrapper{right:2vw}.Settings-menu-button-wrapper{position:absolute;right:2%;top:2%}.Game-over-dialog .modal-content,.Settings-menu .modal-content{background-color:#abafc2;border:.5vw solid #636781;border-radius:1vw;font-family:Barlow,sans-serif}.Game-over-dialog{text-align:center}.Game-over-dialog .modal-title{font-size:2em}.Game-over-dialog .modal-header,.Settings-menu .modal-header{border-bottom:1px solid #4e607c}.Game-over-dialog .modal-header{display:block}.Game-over-dialog-winner-wrapper{align-items:center;display:flex;justify-content:center;padding:4%;width:100%}.Game-over-dialog-winner-checker-wrapper{display:flex;height:3.5em;width:12.6%}.Game-over-dialog-winner-checker-wrapper.left{justify-content:flex-end}.Game-over-dialog-winner-text{font-size:1.2em;font-weight:700;width:70%}.Game-over-dialog-gammon-text{font-size:.8em;font-weight:400}.Game-over-dialog-winner-checker-wrapper .Checker{height:100%;width:100%}.Game-over-dialog .modal-footer{justify-content:center}.Game-over-dialog .modal-footer,.Settings-menu .modal-footer{border-top:1px solid #4e607c}.Game-over-dialog .modal-body,.Settings-menu .modal-body{padding:0}.Game-over-dialog .modal-footer .btn,.Settings-menu .modal-footer .btn{background-color:#354e74;border-color:#18263d;border-width:.2vh}.Settings-menu .Settings-option-row{border-bottom:1px solid #4e607c;display:flex;justify-content:space-between}.Settings-menu .Settings-option-row.bottom{border-bottom:none}.Settings-menu-player-names-and-checkers{cursor:pointer;display:flex;justify-content:space-around;padding-right:5%;width:50%}.Settings-menu-player-name-and-checker{align-items:center;display:flex;flex-direction:column;justify-content:center;width:40%}.Settings-menu-player-name{text-align:center}.Settings-menu-checkers-wrapper{display:flex;height:66%;justify-content:space-around;width:100%}.Settings-menu-checker-wrapper{align-items:center;display:flex;height:50%;justify-content:center;width:31%}.Settings-menu-checker-wrapper .Checker{height:100%;width:100%}.Settings-menu-color-swap-arrow-wrapper{align-items:center;display:flex;flex-direction:column;justify-content:center;transition:.2s;width:20%}.Settings-menu-player-names-and-checkers:hover .Settings-menu-color-swap-arrow-wrapper{transform:scale(110%)}.Settings-menu-color-swap{font-size:.6em;font-weight:700;text-align:center}.Settings-menu-color-swap-arrow{background:url(/backgammon/static/media/swap-arrow.adc2648dbfeda0f4cdd7.svg);background-repeat:no-repeat;height:20%;width:50%}.Settings-option-movement-diagram-wrapper{cursor:pointer;display:flex;justify-content:center;padding:2%;width:50%}.Settings-option-movement-diagram{background-repeat:no-repeat;background-size:contain;height:100%;transition:.2s;width:50%}.Settings-option-movement-diagram:hover{transform:scale(105%)}.Settings-option-movement-diagram.light{background-image:url(/backgammon/static/media/diagram-light-ccw.931adeaa0db388308858.svg)}.Settings-option-movement-diagram.light.cw{background-image:url(/backgammon/static/media/diagram-light-cw.68e6b7bbe70ad7e26961.svg)}.Settings-option-movement-diagram.dark{background-image:url(/backgammon/static/media/diagram-dark-ccw.76b61315a54e8704edf2.svg)}.Settings-option-movement-diagram.dark.cw{background-image:url(/backgammon/static/media/diagram-dark-cw.b2e38535766ef2517564.svg)}.Settings-checker-color-label,.Settings-checker-direction-label{padding:4vh}.Settings-option-arrow.clockwise{background:url(/backgammon/static/media/clockwise-arrow.8272b2cca1c1aef8f74d.svg) no-repeat 0 0}.Settings-option-arrow.counterclockwise{background:url(/backgammon/static/media/counterclockwise-arrow.786060271d460b1849ae.svg) no-repeat 0 0}.Settings-menu-button{background:url(/backgammon/static/media/settings-icon.838a43ba31c120380782.svg) no-repeat 0 0;background-size:contain}@media screen and (orientation:landscape){.Settings-menu-button{height:3vw;width:3vw}}@media screen and (orientation:portrait){.Settings-menu-button{height:3vh;width:3vh}}.Accept-double-menu-wrapper,.Begin-game-button-wrapper,.Dice,.Offer-double-button-wrapper,.Roll-button-wrapper{align-items:center;display:flex;height:10%;justify-content:space-evenly;left:10%;position:absolute;top:45%;width:80%;z-index:5}.Die-faces{align-items:center;display:flex;height:114%;justify-content:center;transform-style:preserve-3d;transition:transform 1.3s ease-out;width:15.5%}.Die-face{grid-gap:.4vw;border-radius:.5vw;color:#fff;display:grid;gap:.4vw;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);height:100%;padding:.2vw;position:absolute;width:100%}.Die-faces.white .Die-face{background-color:#fff3db;border:.2vw solid #b49e70}.Die-faces.black .Die-face{background-color:#0f1025;border:.2vw solid #767293}.Die-faces.black.spent .Die-face,.Die-faces.white.spent .Die-face{display:none}.Die-faces.white.spent.five .Die-face.five,.Die-faces.white.spent.four .Die-face.four,.Die-faces.white.spent.one .Die-face.one,.Die-faces.white.spent.six .Die-face.six,.Die-faces.white.spent.three .Die-face.three,.Die-faces.white.spent.two .Die-face.two{background-color:#fff3db4d;border-color:hsla(41,31%,57%,.478);display:grid}.Die-faces.black.spent.five .Die-face.five,.Die-faces.black.spent.four .Die-face.four,.Die-faces.black.spent.one .Die-face.one,.Die-faces.black.spent.six .Die-face.six,.Die-faces.black.spent.three .Die-face.three,.Die-faces.black.spent.two .Die-face.two{background-color:#0f102526;border-color:rgba(118,114,147,.388);display:grid}.Die-pip{border-radius:50%;height:95%;width:95%}.Die-faces.white .Die-pip{background-color:#1b1c22}.Die-faces.black .Die-pip{background-color:#ede2ce}.Die-faces.black.spent .Die-pip{background-color:hsla(0,0%,100%,.439)}.Die-faces.white.spent .Die-pip{background-color:rgba(0,0,0,.439)}.Die-faces.one,.Die-faces.one.black.reroll{transform:rotateX(1turn) rotateY(2turn) rotate(1turn)}.Die-faces.two,.Die-faces.two.black.reroll{transform:rotateX(450deg) rotateY(2turn) rotate(1turn)}.Die-faces.three,.Die-faces.three.black.reroll{transform:rotateX(1turn) rotateY(630deg) rotate(1turn)}.Die-faces.four,.Die-faces.four.black.reroll{transform:rotateX(1turn) rotateY(810deg) rotate(1turn)}.Die-faces.five,.Die-faces.five.black.reroll{transform:rotateX(270deg) rotateY(2turn) rotate(1turn)}.Die-faces.six,.Die-faces.six.black.reroll{transform:rotateX(1turn) rotateY(900deg) rotate(1turn)}.Die-faces.one.black,.Die-faces.one.reroll{transform:rotateX(-1turn) rotateY(-2turn) rotate(-1turn)}.Die-faces.two.black,.Die-faces.two.reroll{transform:rotateX(-270deg) rotateY(-2turn) rotate(-1turn)}.Die-faces.three.black,.Die-faces.three.reroll{transform:rotateX(-1turn) rotateY(-810deg) rotate(-1turn)}.Die-faces.four.black,.Die-faces.four.reroll{transform:rotateX(-1turn) rotateY(-630deg) rotate(-1turn)}.Die-faces.five.black,.Die-faces.five.reroll{transform:rotateX(-450deg) rotateY(-2turn) rotate(-1turn)}.Die-faces.six.black,.Die-faces.six.reroll{transform:rotateX(-1turn) rotateY(-900deg) rotate(-1turn)}.Die-face.one{transform:rotate3d(0,0,0,90deg) translateZ(1.6vw)}.Die-face.two{transform:rotate3d(-1,0,0,90deg) translateZ(1.6vw)}.Die-face.three{transform:rotateY(90deg) translateZ(1.6vw)}.Die-face.four{transform:rotate3d(0,-1,0,90deg) translateZ(1.6vw)}.Die-face.five{transform:rotateX(90deg) translateZ(1.6vw)}.Die-face.six{transform:rotateX(180deg) translateZ(1.6vw)}.Die-pip.one{grid-area:1/1}.Die-pip.three{grid-area:1/3}.Die-pip.four{grid-area:2/1}.Die-pip.five{grid-area:2/2}.Die-pip.six{grid-area:2/3}.Die-pip.seven{grid-area:3/1}.Die-pip.nine{grid-area:3/3}.Doubling-cube{align-content:center;background-image:url(/backgammon/static/media/doubling-cube.f3177f98ab938202e0aa.svg);background-repeat:no-repeat;filter:drop-shadow(1px 1px 1px rgb(58,7,7));height:85%;margin-left:7.5%;width:85%}.Doubling-cube-value-wrapper{align-content:center;color:#fabbbb;font-size:min(1.3vw,1.3em);height:100%;text-align:center;text-shadow:1px 1px 1px #3a0707;width:100%}.Accept-double-menu-wrapper{display:flex;flex-direction:column;height:14%;top:43%}.Accept-double-menu-text-wrapper{color:#b8b8b8;font-size:max(.5em,1.2vw)}.Accept-double-menu-buttons-wrapper{align-items:center;display:flex;height:50%;justify-content:space-evenly;width:100%}.Accept-double-button,.Forfeit-game-button{font-size:min(1em,1vw);height:100%;padding:0;width:34%}.Accept-double-button{color:#62955d}.Forfeit-game-button{color:#c14534}.Waiting-for-accept-double-wrapper{align-items:center;color:#b8b8b8;display:flex;font-size:.7em;height:12%;justify-content:center;left:10%;position:absolute;top:44%;width:80%;z-index:5}.Initial-floating-circle{animation:float-around-none 0s ease 0s 1 normal none running var(--animation-duration) 0s ease-in;animation:float-around-initial var(--animation-duration) 0s ease-in;background-color:rgba(131,145,158,.141);border-radius:50%;bottom:var(--bottom-offset);display:block;height:var(--radius);left:var(--left-offset);opacity:0;pointer-events:none;position:absolute;width:var(--radius)}@keyframes float-around-initial{0%{opacity:var(--starting-opacity)}50%{opacity:var(--max-opacity)}to{opacity:0;transform:translateX(var(--float-x)) translateY(var(--float-y))}}.Initial-floating-circle:nth-child(0){--bottom-offset:30%;--left-offset:6vw;--radius:5vw;--animation-duration:15s;--float-y:-20vh;--float-x:-4vw;--starting-opacity:29%;--max-opacity:62%}.Initial-floating-circle:first-child{--bottom-offset:35%;--left-offset:97vw;--radius:4vw;--animation-duration:24s;--float-y:25vh;--float-x:6vw;--starting-opacity:25%;--max-opacity:69%}.Initial-floating-circle:nth-child(2){--bottom-offset:77%;--left-offset:21vw;--radius:4vw;--animation-duration:30s;--float-y:13vh;--float-x:-17vw;--starting-opacity:36%;--max-opacity:80%}.Initial-floating-circle:nth-child(3){--bottom-offset:42%;--left-offset:0vw;--radius:3vw;--animation-duration:27s;--float-y:-5vh;--float-x:22vw;--starting-opacity:36%;--max-opacity:76%}.Initial-floating-circle:nth-child(4){--bottom-offset:98%;--left-offset:94vw;--radius:3vw;--animation-duration:18s;--float-y:-14vh;--float-x:13vw;--starting-opacity:10%;--max-opacity:57%}.Initial-floating-circle:nth-child(5){--bottom-offset:84%;--left-offset:83vw;--radius:3vw;--animation-duration:27s;--float-y:-7vh;--float-x:-25vw;--starting-opacity:42%;--max-opacity:58%}.Initial-floating-circle:nth-child(6){--bottom-offset:93%;--left-offset:7vw;--radius:5vw;--animation-duration:18s;--float-y:-23vh;--float-x:28vw;--starting-opacity:11%;--max-opacity:66%}.Initial-floating-circle:nth-child(7){--bottom-offset:27%;--left-offset:80vw;--radius:5vw;--animation-duration:20s;--float-y:-4vh;--float-x:23vw;--starting-opacity:12%;--max-opacity:74%}.Initial-floating-circle:nth-child(8){--bottom-offset:46%;--left-offset:45vw;--radius:4vw;--animation-duration:14s;--float-y:13vh;--float-x:-30vw;--starting-opacity:36%;--max-opacity:52%}.Initial-floating-circle:nth-child(9){--bottom-offset:110%;--left-offset:84vw;--radius:6vw;--animation-duration:23s;--float-y:-8vh;--float-x:-22vw;--starting-opacity:16%;--max-opacity:40%}.Initial-floating-circle:nth-child(10){--bottom-offset:1%;--left-offset:39vw;--radius:5vw;--animation-duration:28s;--float-y:17vh;--float-x:-7vw;--starting-opacity:35%;--max-opacity:66%}.Initial-floating-circle:nth-child(11){--bottom-offset:80%;--left-offset:48vw;--radius:4vw;--animation-duration:14s;--float-y:-15vh;--float-x:-26vw;--starting-opacity:36%;--max-opacity:51%}.Initial-floating-circle:nth-child(12){--bottom-offset:32%;--left-offset:95vw;--radius:5vw;--animation-duration:28s;--float-y:5vh;--float-x:-19vw;--starting-opacity:30%;--max-opacity:43%}.Initial-floating-circle:nth-child(13){--bottom-offset:35%;--left-offset:3vw;--radius:4vw;--animation-duration:13s;--float-y:-17vh;--float-x:-16vw;--starting-opacity:11%;--max-opacity:60%}.Initial-floating-circle:nth-child(14){--bottom-offset:84%;--left-offset:69vw;--radius:5vw;--animation-duration:17s;--float-y:30vh;--float-x:-5vw;--starting-opacity:42%;--max-opacity:66%}.Initial-floating-circle:nth-child(15){--bottom-offset:83%;--left-offset:86vw;--radius:6vw;--animation-duration:22s;--float-y:14vh;--float-x:-20vw;--starting-opacity:45%;--max-opacity:57%}.Initial-floating-circle:nth-child(16){--bottom-offset:105%;--left-offset:72vw;--radius:5vw;--animation-duration:26s;--float-y:24vh;--float-x:-10vw;--starting-opacity:50%;--max-opacity:61%}.Initial-floating-circle:nth-child(17){--bottom-offset:89%;--left-offset:14vw;--radius:5vw;--animation-duration:25s;--float-y:3vh;--float-x:21vw;--starting-opacity:11%;--max-opacity:75%}.Initial-floating-circle:nth-child(18){--bottom-offset:82%;--left-offset:49vw;--radius:3vw;--animation-duration:15s;--float-y:-26vh;--float-x:-20vw;--starting-opacity:38%;--max-opacity:47%}.Initial-floating-circle:nth-child(19){--bottom-offset:91%;--left-offset:15vw;--radius:3vw;--animation-duration:27s;--float-y:28vh;--float-x:15vw;--starting-opacity:22%;--max-opacity:69%}.Initial-floating-circle:nth-child(20){--bottom-offset:32%;--left-offset:86vw;--radius:6vw;--animation-duration:27s;--float-y:12vh;--float-x:2vw;--starting-opacity:46%;--max-opacity:53%}.Initial-floating-circle:nth-child(21){--bottom-offset:66%;--left-offset:25vw;--radius:6vw;--animation-duration:16s;--float-y:-22vh;--float-x:24vw;--starting-opacity:15%;--max-opacity:61%}.Initial-floating-circle:nth-child(22){--bottom-offset:24%;--left-offset:51vw;--radius:3vw;--animation-duration:11s;--float-y:10vh;--float-x:-9vw;--starting-opacity:39%;--max-opacity:41%}.Initial-floating-circle:nth-child(23){--bottom-offset:92%;--left-offset:88vw;--radius:4vw;--animation-duration:10s;--float-y:-1vh;--float-x:-7vw;--starting-opacity:40%;--max-opacity:78%}.Initial-floating-circle:nth-child(24){--bottom-offset:15%;--left-offset:100vw;--radius:6vw;--animation-duration:19s;--float-y:26vh;--float-x:-24vw;--starting-opacity:45%;--max-opacity:65%}.Initial-floating-circle:nth-child(25){--bottom-offset:100%;--left-offset:60vw;--radius:4vw;--animation-duration:24s;--float-y:-8vh;--float-x:29vw;--starting-opacity:37%;--max-opacity:43%}.Initial-floating-circle:nth-child(26){--bottom-offset:42%;--left-offset:60vw;--radius:6vw;--animation-duration:29s;--float-y:-28vh;--float-x:3vw;--starting-opacity:43%;--max-opacity:80%}.Initial-floating-circle:nth-child(27){--bottom-offset:98%;--left-offset:39vw;--radius:6vw;--animation-duration:10s;--float-y:5vh;--float-x:-9vw;--starting-opacity:37%;--max-opacity:47%}.Initial-floating-circle:nth-child(28){--bottom-offset:98%;--left-offset:84vw;--radius:4vw;--animation-duration:15s;--float-y:9vh;--float-x:5vw;--starting-opacity:19%;--max-opacity:50%}.Initial-floating-circle:nth-child(29){--bottom-offset:42%;--left-offset:1vw;--radius:6vw;--animation-duration:18s;--float-y:-22vh;--float-x:13vw;--starting-opacity:17%;--max-opacity:51%}.Initial-floating-circle:nth-child(30){--bottom-offset:40%;--left-offset:99vw;--radius:3vw;--animation-duration:23s;--float-y:20vh;--float-x:-10vw;--starting-opacity:32%;--max-opacity:80%}.Initial-floating-circle:nth-child(31){--bottom-offset:69%;--left-offset:42vw;--radius:4vw;--animation-duration:23s;--float-y:-19vh;--float-x:-9vw;--starting-opacity:35%;--max-opacity:78%}.Initial-floating-circle:nth-child(32){--bottom-offset:64%;--left-offset:66vw;--radius:4vw;--animation-duration:11s;--float-y:3vh;--float-x:19vw;--starting-opacity:43%;--max-opacity:41%}.Initial-floating-circle:nth-child(33){--bottom-offset:99%;--left-offset:25vw;--radius:6vw;--animation-duration:11s;--float-y:11vh;--float-x:21vw;--starting-opacity:23%;--max-opacity:61%}.Initial-floating-circle:nth-child(34){--bottom-offset:106%;--left-offset:41vw;--radius:5vw;--animation-duration:26s;--float-y:9vh;--float-x:-10vw;--starting-opacity:49%;--max-opacity:73%}.Initial-floating-circle:nth-child(35){--bottom-offset:72%;--left-offset:77vw;--radius:3vw;--animation-duration:16s;--float-y:9vh;--float-x:8vw;--starting-opacity:25%;--max-opacity:42%}.Initial-floating-circle:nth-child(36){--bottom-offset:76%;--left-offset:50vw;--radius:6vw;--animation-duration:13s;--float-y:-23vh;--float-x:5vw;--starting-opacity:49%;--max-opacity:55%}.Initial-floating-circle:nth-child(37){--bottom-offset:50%;--left-offset:11vw;--radius:3vw;--animation-duration:15s;--float-y:-7vh;--float-x:-27vw;--starting-opacity:22%;--max-opacity:57%}.Initial-floating-circle:nth-child(38){--bottom-offset:2%;--left-offset:89vw;--radius:4vw;--animation-duration:24s;--float-y:-18vh;--float-x:-9vw;--starting-opacity:50%;--max-opacity:62%}.Initial-floating-circle:nth-child(39){--bottom-offset:6%;--left-offset:58vw;--radius:6vw;--animation-duration:23s;--float-y:-4vh;--float-x:-20vw;--starting-opacity:20%;--max-opacity:42%}.Initial-floating-circle:nth-child(40){--bottom-offset:-4%;--left-offset:3vw;--radius:3vw;--animation-duration:10s;--float-y:-11vh;--float-x:-18vw;--starting-opacity:21%;--max-opacity:42%}.Initial-floating-circle:nth-child(41){--bottom-offset:66%;--left-offset:54vw;--radius:3vw;--animation-duration:29s;--float-y:10vh;--float-x:10vw;--starting-opacity:42%;--max-opacity:74%}.Initial-floating-circle:nth-child(42){--bottom-offset:105%;--left-offset:25vw;--radius:5vw;--animation-duration:13s;--float-y:-15vh;--float-x:-3vw;--starting-opacity:28%;--max-opacity:79%}.Initial-floating-circle:nth-child(43){--bottom-offset:12%;--left-offset:0vw;--radius:5vw;--animation-duration:19s;--float-y:0vh;--float-x:15vw;--starting-opacity:43%;--max-opacity:42%}.Initial-floating-circle:nth-child(44){--bottom-offset:62%;--left-offset:37vw;--radius:3vw;--animation-duration:18s;--float-y:-9vh;--float-x:-29vw;--starting-opacity:48%;--max-opacity:75%}.Initial-floating-circle:nth-child(45){--bottom-offset:36%;--left-offset:23vw;--radius:3vw;--animation-duration:28s;--float-y:-12vh;--float-x:-9vw;--starting-opacity:41%;--max-opacity:67%}.Initial-floating-circle:nth-child(46){--bottom-offset:81%;--left-offset:16vw;--radius:3vw;--animation-duration:13s;--float-y:6vh;--float-x:-7vw;--starting-opacity:24%;--max-opacity:52%}.Initial-floating-circle:nth-child(47){--bottom-offset:59%;--left-offset:41vw;--radius:6vw;--animation-duration:12s;--float-y:8vh;--float-x:0vw;--starting-opacity:36%;--max-opacity:56%}.Initial-floating-circle:nth-child(48){--bottom-offset:107%;--left-offset:7vw;--radius:6vw;--animation-duration:15s;--float-y:-2vh;--float-x:-18vw;--starting-opacity:41%;--max-opacity:44%}.Initial-floating-circle:nth-child(49){--bottom-offset:8%;--left-offset:48vw;--radius:5vw;--animation-duration:18s;--float-y:20vh;--float-x:15vw;--starting-opacity:13%;--max-opacity:80%}.Initial-floating-circle:nth-child(50){--bottom-offset:80%;--left-offset:62vw;--radius:4vw;--animation-duration:18s;--float-y:30vh;--float-x:-17vw;--starting-opacity:45%;--max-opacity:60%}.Floating-circle{animation:float-around var(--animation-duration) var(--delay) ease-in infinite;background-color:rgba(131,145,158,.141);border-radius:50%;bottom:var(--bottom-offset);display:block;height:var(--radius);left:var(--left-offset);opacity:0;pointer-events:none;position:absolute;width:var(--radius)}@keyframes float-around{0%{opacity:0}50%{opacity:var(--max-opacity)}to{opacity:0;transform:translateX(var(--float-x)) translateY(var(--float-y))}}.Floating-circle:nth-child(0){--delay:22s;--bottom-offset:69%;--left-offset:36vw;--radius:4vw;--animation-duration:16s;--float-y:-25vh;--float-x:26vw;--max-opacity:48%}.Floating-circle:first-child{--delay:30s;--bottom-offset:58%;--left-offset:83vw;--radius:5vw;--animation-duration:28s;--float-y:-17vh;--float-x:29vw;--max-opacity:66%}.Floating-circle:nth-child(2){--delay:22s;--bottom-offset:75%;--left-offset:66vw;--radius:6vw;--animation-duration:15s;--float-y:6vh;--float-x:23vw;--max-opacity:45%}.Floating-circle:nth-child(3){--delay:23s;--bottom-offset:21%;--left-offset:22vw;--radius:3vw;--animation-duration:29s;--float-y:3vh;--float-x:1vw;--max-opacity:51%}.Floating-circle:nth-child(4){--delay:19s;--bottom-offset:27%;--left-offset:80vw;--radius:5vw;--animation-duration:12s;--float-y:15vh;--float-x:19vw;--max-opacity:58%}.Floating-circle:nth-child(5){--delay:11s;--bottom-offset:70%;--left-offset:80vw;--radius:5vw;--animation-duration:29s;--float-y:11vh;--float-x:-6vw;--max-opacity:45%}.Floating-circle:nth-child(6){--delay:10s;--bottom-offset:76%;--left-offset:14vw;--radius:6vw;--animation-duration:18s;--float-y:16vh;--float-x:1vw;--max-opacity:67%}.Floating-circle:nth-child(7){--delay:25s;--bottom-offset:31%;--left-offset:47vw;--radius:6vw;--animation-duration:21s;--float-y:-18vh;--float-x:8vw;--max-opacity:69%}.Floating-circle:nth-child(8){--delay:29s;--bottom-offset:8%;--left-offset:85vw;--radius:4vw;--animation-duration:22s;--float-y:15vh;--float-x:11vw;--max-opacity:42%}.Floating-circle:nth-child(9){--delay:30s;--bottom-offset:2%;--left-offset:68vw;--radius:5vw;--animation-duration:15s;--float-y:22vh;--float-x:-30vw;--max-opacity:59%}.Floating-circle:nth-child(10){--delay:25s;--bottom-offset:21%;--left-offset:82vw;--radius:6vw;--animation-duration:15s;--float-y:20vh;--float-x:-22vw;--max-opacity:31%}.Floating-circle:nth-child(11){--delay:13s;--bottom-offset:60%;--left-offset:82vw;--radius:6vw;--animation-duration:10s;--float-y:11vh;--float-x:20vw;--max-opacity:39%}.Floating-circle:nth-child(12){--delay:13s;--bottom-offset:54%;--left-offset:96vw;--radius:3vw;--animation-duration:27s;--float-y:17vh;--float-x:9vw;--max-opacity:52%}.Floating-circle:nth-child(13){--delay:17s;--bottom-offset:17%;--left-offset:53vw;--radius:3vw;--animation-duration:16s;--float-y:5vh;--float-x:-8vw;--max-opacity:40%}.Floating-circle:nth-child(14){--delay:24s;--bottom-offset:9%;--left-offset:20vw;--radius:6vw;--animation-duration:27s;--float-y:21vh;--float-x:18vw;--max-opacity:68%}.Floating-circle:nth-child(15){--delay:21s;--bottom-offset:95%;--left-offset:58vw;--radius:4vw;--animation-duration:11s;--float-y:0vh;--float-x:18vw;--max-opacity:30%}.Floating-circle:nth-child(16){--delay:17s;--bottom-offset:21%;--left-offset:75vw;--radius:6vw;--animation-duration:10s;--float-y:8vh;--float-x:13vw;--max-opacity:65%}.Floating-circle:nth-child(17){--delay:30s;--bottom-offset:94%;--left-offset:45vw;--radius:5vw;--animation-duration:18s;--float-y:22vh;--float-x:-10vw;--max-opacity:35%}.Floating-circle:nth-child(18){--delay:11s;--bottom-offset:82%;--left-offset:50vw;--radius:5vw;--animation-duration:30s;--float-y:18vh;--float-x:-10vw;--max-opacity:51%}.Floating-circle:nth-child(19){--delay:13s;--bottom-offset:-7%;--left-offset:23vw;--radius:6vw;--animation-duration:13s;--float-y:-14vh;--float-x:26vw;--max-opacity:43%}.Floating-circle:nth-child(20){--delay:30s;--bottom-offset:46%;--left-offset:2vw;--radius:3vw;--animation-duration:10s;--float-y:13vh;--float-x:17vw;--max-opacity:61%}.Floating-circle:nth-child(21){--delay:30s;--bottom-offset:-10%;--left-offset:63vw;--radius:5vw;--animation-duration:18s;--float-y:13vh;--float-x:26vw;--max-opacity:36%}.Floating-circle:nth-child(22){--delay:10s;--bottom-offset:22%;--left-offset:90vw;--radius:4vw;--animation-duration:15s;--float-y:-12vh;--float-x:3vw;--max-opacity:30%}.Floating-circle:nth-child(23){--delay:14s;--bottom-offset:30%;--left-offset:77vw;--radius:6vw;--animation-duration:29s;--float-y:-8vh;--float-x:-12vw;--max-opacity:53%}.Floating-circle:nth-child(24){--delay:24s;--bottom-offset:27%;--left-offset:89vw;--radius:3vw;--animation-duration:10s;--float-y:-24vh;--float-x:-6vw;--max-opacity:31%}.Floating-circle:nth-child(25){--delay:22s;--bottom-offset:106%;--left-offset:17vw;--radius:6vw;--animation-duration:16s;--float-y:-22vh;--float-x:9vw;--max-opacity:62%}.Floating-circle:nth-child(26){--delay:11s;--bottom-offset:41%;--left-offset:60vw;--radius:3vw;--animation-duration:11s;--float-y:5vh;--float-x:28vw;--max-opacity:34%}.Floating-circle:nth-child(27){--delay:12s;--bottom-offset:29%;--left-offset:89vw;--radius:4vw;--animation-duration:26s;--float-y:-27vh;--float-x:-26vw;--max-opacity:59%}.Floating-circle:nth-child(28){--delay:22s;--bottom-offset:-10%;--left-offset:57vw;--radius:5vw;--animation-duration:25s;--float-y:-3vh;--float-x:-6vw;--max-opacity:55%}.Floating-circle:nth-child(29){--delay:13s;--bottom-offset:62%;--left-offset:28vw;--radius:6vw;--animation-duration:21s;--float-y:23vh;--float-x:5vw;--max-opacity:46%}.Floating-circle:nth-child(30){--delay:22s;--bottom-offset:32%;--left-offset:45vw;--radius:3vw;--animation-duration:24s;--float-y:4vh;--float-x:1vw;--max-opacity:55%}.Floating-circle:nth-child(31){--delay:10s;--bottom-offset:103%;--left-offset:4vw;--radius:3vw;--animation-duration:11s;--float-y:-29vh;--float-x:6vw;--max-opacity:36%}.Floating-circle:nth-child(32){--delay:24s;--bottom-offset:20%;--left-offset:39vw;--radius:5vw;--animation-duration:18s;--float-y:5vh;--float-x:8vw;--max-opacity:55%}.Floating-circle:nth-child(33){--delay:18s;--bottom-offset:38%;--left-offset:71vw;--radius:3vw;--animation-duration:30s;--float-y:26vh;--float-x:-14vw;--max-opacity:61%}.Floating-circle:nth-child(34){--delay:30s;--bottom-offset:75%;--left-offset:2vw;--radius:6vw;--animation-duration:29s;--float-y:28vh;--float-x:4vw;--max-opacity:61%}.Floating-circle:nth-child(35){--delay:16s;--bottom-offset:27%;--left-offset:73vw;--radius:6vw;--animation-duration:23s;--float-y:10vh;--float-x:17vw;--max-opacity:53%}.Floating-circle:nth-child(36){--delay:29s;--bottom-offset:108%;--left-offset:50vw;--radius:6vw;--animation-duration:11s;--float-y:-19vh;--float-x:30vw;--max-opacity:55%}.Floating-circle:nth-child(37){--delay:30s;--bottom-offset:93%;--left-offset:91vw;--radius:4vw;--animation-duration:26s;--float-y:30vh;--float-x:-25vw;--max-opacity:34%}.Floating-circle:nth-child(38){--delay:21s;--bottom-offset:1%;--left-offset:51vw;--radius:6vw;--animation-duration:18s;--float-y:0vh;--float-x:24vw;--max-opacity:35%}.Floating-circle:nth-child(39){--delay:16s;--bottom-offset:23%;--left-offset:22vw;--radius:3vw;--animation-duration:27s;--float-y:-28vh;--float-x:-27vw;--max-opacity:42%}.Floating-circle:nth-child(40){--delay:20s;--bottom-offset:31%;--left-offset:99vw;--radius:3vw;--animation-duration:18s;--float-y:-22vh;--float-x:-5vw;--max-opacity:32%}.Floating-circle:nth-child(41){--delay:16s;--bottom-offset:57%;--left-offset:22vw;--radius:5vw;--animation-duration:13s;--float-y:29vh;--float-x:26vw;--max-opacity:69%}.Floating-circle:nth-child(42){--delay:19s;--bottom-offset:69%;--left-offset:65vw;--radius:5vw;--animation-duration:25s;--float-y:2vh;--float-x:-4vw;--max-opacity:68%}.Floating-circle:nth-child(43){--delay:27s;--bottom-offset:3%;--left-offset:12vw;--radius:5vw;--animation-duration:15s;--float-y:2vh;--float-x:21vw;--max-opacity:50%}.Floating-circle:nth-child(44){--delay:17s;--bottom-offset:47%;--left-offset:28vw;--radius:4vw;--animation-duration:27s;--float-y:-15vh;--float-x:-11vw;--max-opacity:34%}.Floating-circle:nth-child(45){--delay:21s;--bottom-offset:3%;--left-offset:69vw;--radius:6vw;--animation-duration:27s;--float-y:15vh;--float-x:26vw;--max-opacity:50%}.Floating-circle:nth-child(46){--delay:21s;--bottom-offset:16%;--left-offset:11vw;--radius:4vw;--animation-duration:16s;--float-y:5vh;--float-x:25vw;--max-opacity:34%}.Floating-circle:nth-child(47){--delay:27s;--bottom-offset:36%;--left-offset:73vw;--radius:5vw;--animation-duration:14s;--float-y:-9vh;--float-x:2vw;--max-opacity:57%}.Floating-circle:nth-child(48){--delay:11s;--bottom-offset:83%;--left-offset:86vw;--radius:5vw;--animation-duration:10s;--float-y:-24vh;--float-x:-13vw;--max-opacity:65%}.Floating-circle:nth-child(49){--delay:22s;--bottom-offset:96%;--left-offset:60vw;--radius:5vw;--animation-duration:15s;--float-y:26vh;--float-x:-18vw;--max-opacity:39%}.Floating-circle:nth-child(50){--delay:14s;--bottom-offset:9%;--left-offset:90vw;--radius:6vw;--animation-duration:22s;--float-y:12vh;--float-x:9vw;--max-opacity:32%}.Wipe-transition{animation-duration:.3s;animation-iteration-count:1;animation-name:wipe;animation-timing-function:linear;background-color:rgba(0,0,0,.655);height:100%;left:0;pointer-events:none;position:absolute;top:0;width:0;z-index:9}@keyframes wipe{0%{width:100%}to{width:0}}.Wipe-fade{animation-duration:.3s;animation-iteration-count:1;animation-name:fade;animation-timing-function:linear;background-color:#fff0;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:8}@keyframes fade{0%{background-color:hsla(0,0%,100%,.337)}to{background-color:#fff0}}.Room-connection-error-wrapper{align-items:center;color:#b8b8b8;display:flex;flex-direction:column;text-align:center;width:50%}.Room-connection-error-header{font-size:max(2em,2vw)}.Room-connection-error-text{font-size:max(1em,1vw);margin-top:2%;width:100%}.Room-connection-error-roomcode{font-weight:700}.Room-connection-error-subtext{font-size:max(1em,1vw);line-height:1em;margin-top:2%;width:70%}.Room-connection-error-menu-button-wrapper{margin-top:5%}.Room-connection-error-menu-button{background:linear-gradient(90deg,#3f3217,#564112);border:.2em double #816c3d;border-radius:min(1vw,1em);color:#b8b8b8;font-family:Barlow,sans-serif;font-size:max(1em,1vw);font-weight:700;height:5vh;max-width:175px;min-height:35px;min-width:125px;padding:.5vh;text-align:center;transition:.2s;width:12vw}.Room-connection-error-menu-button:active,.Room-connection-error-menu-button:hover{transform:scale(105%)}
-/*# sourceMappingURL=main.d409741d.css.map*/
\ No newline at end of file
+.App{text-align:center}.App-logo{height:40vmin;pointer-events:none}@media(prefers-reduced-motion:no-preference){.App-logo{animation:App-logo-spin 20s linear infinite}}.App-wrapper{align-items:center;background:linear-gradient(180deg,#3b4587,#151516) border-box;display:flex;flex-direction:column;font-family:Barlow,sans-serif;justify-content:center;min-height:300px;min-width:400px;overflow:hidden;position:relative}.App-wrapper,.App-wrapper.mainmenu{height:100vh;width:100vw}.App-header{align-items:center;background-color:#282c34;color:#fff;display:flex;flex-direction:column;font-family:Barlow,sans-serif;font-size:calc(10px + 2vmin);justify-content:center;min-height:100vh}.App-link{color:#61dafb}@keyframes App-logo-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.Waiting-text-wrapper{display:flex}.Begin-game-button-wrapper.waiting-text{color:#b8b8b8;font-size:.8em;justify-content:center}.Waiting-spinner{animation-duration:2s;animation-iteration-count:infinite;animation-name:spin;animation-timing-function:linear;background-image:url(/backgammon/static/media/loading-spinner.2e1c3e92b0cc05ad6bdd.svg);background-position:50%;background-repeat:no-repeat;height:40%;margin-top:1%;width:8%}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.Accept-double-button,.Begin-game-button,.Forfeit-game-button,.Offer-double-button,.Roll-button{background:linear-gradient(90deg,#3f3217,#564112);border:.2em double #816c3d;border-radius:min(1vw,1em);color:#b8b8b8;font-family:Barlow,sans-serif;font-size:max(1.4vh,1.4vw);font-weight:700;padding:.5vh;text-align:center;transition:.2s;width:11vw}.Accept-double-button:hover,.Begin-game-button:hover,.Forfeit-game-button:hover,.Offer-double-button:hover,.Roll-button:hover,.Settings-menu-button:hover{transform:scale(110%)}.Game-board-wrapper{align-items:center;color:#fff;display:flex;height:30vw;justify-content:center;min-height:150px;min-width:300px;width:60vw}.Networked-gameboard-spinner{animation-duration:2s;animation-iteration-count:infinite;animation-name:spin;animation-timing-function:linear;background-image:url(/backgammon/static/media/online-multiplayer-button-spinner.7c87ae20b24b79031ab9.svg);background-position:50%;background-repeat:no-repeat;height:20%;width:20%}.Main-menu-wrapper{align-items:center;color:#fff;display:flex;flex-direction:column;height:60%;min-height:300px;min-width:400px;width:60%}.Title-wrapper{container:title-container/inline-size;background-image:url(/backgammon/static/media/backgammon-title.34ee913e01db821eea92.svg);background-position:50%;background-repeat:no-repeat;filter:drop-shadow(0 1vh .3vh rgba(0,0,0,.35));height:25%;text-align:center;vertical-align:middle;width:80%}.Title-text{font-size:3.5em}@container title-container (min-width: 400px){.Title-text{font-size:max(3.5em,3.5em + 4cqi)}}.Menu-button-wrapper{container:menu-button-wrapper/inline-size;display:flex;flex-direction:column;height:50%;justify-content:space-around;width:60%}.Local-multiplayer-button,.Online-multiplayer-button{background-position:50%;background-repeat:no-repeat;cursor:pointer;display:flex;filter:drop-shadow(0 1vh .3vh rgba(0,0,0,.35));font-family:Barlow,sans-serif;font-size:max(2vh,2vw);height:40%;transition:.2s;width:100%}@media screen and (orientation:portrait){.Title-wrapper{height:16%}.Menu-button-wrapper{height:30%}}.Local-multiplayer-button{background-image:url(/backgammon/static/media/local-multiplayer-button.04a8bf8817e1c77c6937.svg)}.Online-multiplayer-button{background-image:url(/backgammon/static/media/online-multiplayer-button.967df5a8b632a39956f1.svg)}.Local-multiplayer-button:active,.Local-multiplayer-button:hover,.Online-multiplayer-button:active,.Online-multiplayer-button:hover{transform:scale(105%)}.Online-multiplayer-button-spinner{animation-duration:2s;animation-iteration-count:infinite;animation-name:spin;animation-timing-function:linear;background-image:url(/backgammon/static/media/online-multiplayer-button-spinner.7c87ae20b24b79031ab9.svg);background-position:50%;background-repeat:no-repeat;height:40%;width:100%}.Credits-text{bottom:1%;color:#6b7195;font-size:.6em;position:absolute;right:1%;text-align:right}.Match-settings-menu-wrapper{display:flex;flex-direction:column;height:60%;min-height:300px;min-width:400px;width:45%}.Match-settings-title-wrapper{background-image:url(/backgammon/static/media/match-settings-title.410d7b07ad339c9a3c12.svg);background-position:50%;background-repeat:no-repeat;filter:drop-shadow(0 .5vh .3vh rgba(0,0,0,.35));height:20%;vertical-align:middle;width:35%}.Doubling-cube-settings-row,.Match-points-settings-row,.Url-copy-row{align-items:center;display:flex;height:15%;margin-top:4%;width:100%}.Play-to-wrapper{background-image:url(/backgammon/static/media/play-to.73dda2d0e9b2cc8a3688.svg);background-position-y:center;background-repeat:no-repeat;width:14%}.Doubling-cube-text-wrapper,.Play-to-wrapper{filter:drop-shadow(0 .5vh .3vh rgba(0,0,0,.35));height:60%;vertical-align:middle}.Doubling-cube-text-wrapper{background-image:url(/backgammon/static/media/allow-doubling.46f6b3ad75e29c193106.svg);background-position-y:center;background-repeat:no-repeat;width:24%}.Url-title-wrapper{background-image:url(/backgammon/static/media/url-title.b6f78b0d8897abe0b49e.svg);background-position-y:center;background-repeat:no-repeat;filter:drop-shadow(0 .5vh .3vh rgba(0,0,0,.35));height:40%;vertical-align:middle;width:14%}.Url-form-wrapper{container:url-form-container/inline-size;align-items:flex-start;display:flex;flex-direction:column;height:100%;width:80%}.Url-form .form-control{background-color:#474747;color:#dcd4d4;font-size:1em}.Url-form-text{background-color:#332e2e;border:solid #dcd4d4;border-radius:1vw;color:#dcd4d4;font-size:.9em;padding:1vh 1vw}.Url-form-subtext{color:#dcd4d4;font-size:.7em;margin-left:1vw}@container url-form-container (min-width: 600px){.Url-form-text{font-size:1.5em}.Url-form-subtext{font-size:1em}}.Url-form-text-and-copy{align-items:center;display:flex;width:100%}.Url-form-copy{background-image:url(/backgammon/static/media/copy-icon.65dafb6d3844799c4c65.svg);background-position-y:center;background-repeat:no-repeat;cursor:pointer;height:80%;margin-left:2%;transition:.2s;width:8%}.Url-form-copy.highlight{background-image:url(/backgammon/static/media/copy-icon-clicked.f5926b66db8d1ba23cb1.svg)}.Url-form-copy:active,.Url-form-copy:hover{transform:scale(105%)}.Start-game-button-row{align-items:center;display:flex;height:15%;justify-content:center;margin-top:8%;width:100%}.Start-game-button{background:linear-gradient(90deg,#3f3217,#564112);border:.2em double #816c3d;border-radius:min(1vw,1em);color:#b8b8b8;font-family:Barlow,sans-serif;font-size:max(1.5vh,1.5vw);font-weight:700;padding:.5vh;text-align:center;transition:.2s;width:10vw}.Start-game-button:hover{transform:scale(105%)}.Doubling-cube-toggle-form{align-items:center;display:flex;height:100%;margin-left:4%;width:70%}.Doubling-cube-toggle-off,.Doubling-cube-toggle-on{background-position:50%;background-repeat:no-repeat;height:30%;width:15%}.Doubling-cube-toggle-off{background-image:url(/backgammon/static/media/off-disabled.bac8f3ff3f6583ec64c3.svg)}.Doubling-cube-toggle-on{background-image:url(/backgammon/static/media/on-disabled.48a39b5edf0f54f4e882.svg)}.Doubling-cube-toggle-off.enabled{background-image:url(/backgammon/static/media/off-enabled.d4f9b287b09cd0c7064c.svg)}.Doubling-cube-toggle-on.enabled{background-image:url(/backgammon/static/media/on-enabled.5b26f3fe1de148c69c98.svg)}.Doubling-cube-toggle.form-switch{margin-left:4%;margin-right:4%}.Doubling-cube-toggle .form-check-input{height:4vh;width:6vw}.Doubling-cube-toggle .form-check-input:checked{background-color:#4488ec}.Match-points-buttons-wrapper{display:flex;height:100%;width:86%}.Match-points-button{align-content:center;background-color:#cdb288;background-position:50%;background-repeat:no-repeat;background-size:15%;border-radius:10%;cursor:pointer;font-size:max(1.3em,2vw);font-weight:700;height:max(5vw,5vh);margin-left:2%;opacity:40%;text-align:center;transition:.2s;width:max(5vw,5vh)}.Match-points-button.selected{border:max(3px,.3vw) solid #fff;opacity:100%}.Match-points-button:active,.Match-points-button:hover{transform:scale(105%)}.Player-card-wrapper{background:#0f142f;border:min(5px,.4vw) #22274a;border-radius:min(1vw,1em) min(1vw,1em) 0 0;border-style:solid solid none;color:#b8b8b8;display:flex;height:9%;left:66%;position:relative;width:28%}.Player-card-wrapper.current{filter:drop-shadow(0 0 1vh #f7dcab)}.Player-card-wrapper.cw{left:6%}.Player-card-wrapper.bottom{background:#251f13;border:min(5px,.4vw) solid #564112;border-radius:0 0 min(1vw,1em) min(1vw,1em);border-top-style:none}.Player-card-checker-wrapper{display:flex;width:24%}.Player-card-checker-wrapper .Checker{height:60%;margin:20%;width:60%}.Player-name-and-score-wrapper{display:flex;flex-direction:column;width:52%}.Player-name-wrapper{font-size:2vh;font-weight:700;height:40%}.Player-card-doubling-cube-wrapper{align-content:center;width:24%}.Player-card-doubling-cube-wrapper .Doubling-cube{height:65%;margin-left:20%;width:60%}@media screen and (orientation:landscape){.Player-name-wrapper{font-size:1.2vw;font-weight:700;height:40%;margin-top:4%}.Player-score-wrapper{display:flex;font-size:.8vw;height:50%;margin-top:4%;white-space:nowrap}}@media screen and (orientation:portrait){.Player-name-wrapper{font-size:2vh;font-weight:700;height:40%}.Player-score-wrapper{display:flex;font-size:.8vw;height:50%}}.Player-card-total-match-points{font-weight:700}.Player-points-wrapper{margin-left:.8vw}.Information-text-wrapper{height:4vh;margin-left:5.5%;margin-right:5.5%;width:89%}.Information-text{color:#b8b8b8}.Game-area-wrapper{filter:drop-shadow(0 0 .5vh #000000)}.Game-board-half{background-image:url(/backgammon/static/media/board-background.096c5325cc02d43c3c3b.svg);background-size:cover;border-color:#212529;border-width:.8vh;display:flex;flex-direction:column;height:100%;justify-content:space-between;position:relative;width:45.5%;z-index:1}.Game-board-half.left{background:url(/backgammon/static/media/board-background.096c5325cc02d43c3c3b.svg) padding-box,linear-gradient(180deg,#22274a,#564112) border-box;border:min(5px,.4vw) solid #0000;border-bottom-left-radius:min(1vw,1em);border-right-style:none;border-top-left-radius:min(1vw,1em)}.Game-board-half.left.cw{border-bottom-left-radius:0;border-top-left-radius:0}.Game-board-half.right{background:url(/backgammon/static/media/board-background.096c5325cc02d43c3c3b.svg) padding-box,linear-gradient(180deg,#22274a,#564112) border-box;border:min(5px,.4vw) solid #0000;border-left-style:none}.Game-board-half.right.cw{border-bottom-right-radius:min(1vw,1em);border-top-right-radius:min(1vw,1em)}.Game-board-quadrant{display:flex;height:50%;justify-content:space-evenly;width:100%}.Game-board-quadrant.bottom{align-items:flex-end}.Game-board-bar{background:url(/backgammon/static/media/dots.266ad2859fc9b3aee84f.svg) 50%/420% padding-box,linear-gradient(180deg,#22274a,#564112) border-box;width:4%;z-index:1}.Game-board-bar,.Game-board-home{border:min(5px,.4vw) solid #0000;display:flex;flex-direction:column;height:100%;justify-content:space-around}.Game-board-home{background:url(/backgammon/static/media/dots.266ad2859fc9b3aee84f.svg) 50%/300% padding-box,linear-gradient(180deg,#22274a,#564112) border-box;border-bottom-right-radius:min(1vw,1em);border-left-style:none;border-top-right-radius:min(1vw,1em);width:5%}.Game-board-home.cw{border-bottom-left-radius:min(1vw,1em);border-bottom-right-radius:0;border-left-style:solid;border-right-style:none;border-top-left-radius:min(1vw,1em);border-top-right-radius:0}.Point-wrapper{display:flex;height:87%;position:relative;width:16.667%}.Point-wrapper-highlight{height:100%;margin-left:10%;position:absolute;width:80%;z-index:1}.Point-wrapper-highlight.from{background-color:hsla(48,70%,64%,.329)}.Point-wrapper-highlight.to{background:url(/backgammon/static/media/stripes.c676f00f1b408a99ab96.svg);background-size:cover}.Point-wrapper-highlight.noMove{animation-duration:1s;animation-name:nomove}@keyframes nomove{0%{background:url(/backgammon/static/media/stripes-red.5075527d28b88569681b.svg);background-size:cover}to{background:url(/backgammon/static/media/stripes-red-fade.4cdc118757f83dc7367a.svg);background-size:cover}}.Point-wrapper-highlight.bottom{border-top-left-radius:5vh;border-top-right-radius:5vh}.Point-wrapper-highlight.top{border-bottom-left-radius:5vh;border-bottom-right-radius:5vh}.Point-triangle{height:100%;margin-left:10%;position:absolute;width:80%;z-index:1}.Point-triangle-inner{height:96%;margin-left:12%;position:absolute;width:76%;z-index:2}.Point-triangle-inner.bottom{margin-top:12%}.Point-triangle-inner.even{background-color:#0f1744}.Point-triangle-inner.odd{background-color:#885525}.Point-triangle-inner.top,.Point-triangle.top{-webkit-clip-path:polygon(0 0,50% 100%,100% 0);clip-path:polygon(0 0,50% 100%,100% 0)}.Point-triangle-inner.bottom,.Point-triangle.bottom{-webkit-clip-path:polygon(0 100%,50% 0,100% 100%);clip-path:polygon(0 100%,50% 0,100% 100%)}.Point-triangle.even{background-color:#636781}.Point-triangle.odd{background-color:#997345}.Checkers-wrapper{align-items:center;display:flex;flex-wrap:wrap;height:100%;width:100%;z-index:3}.Checkers-wrapper.top{flex-direction:column}.Checkers-wrapper.bottom{flex-direction:column-reverse}.Point{height:41vh;width:15%}.Checker{filter:drop-shadow(0 0 .2vh rgba(0,0,0,.6));height:15%;transition:transform .3s ease-out,filter .5s ease-in-out;width:45%;will-change:transform,filter;z-index:4}.Checker.white{background-image:url(/backgammon/static/media/checker-light.e1aa85fcf8f8cc1f655d.svg);background-repeat:no-repeat}.Checker.highlighted-pulse,.Checker.selected-pulse{filter:drop-shadow(0 0 .5vh #f7dcab)}.Checker.white.selected-pulse{background-image:url(/backgammon/static/media/checker-light-selected.0682a00050929616b5fa.svg);background-repeat:no-repeat}.Checker.black.selected-pulse{background-image:url(/backgammon/static/media/checker-dark-selected.9076eecdb1839d51a87b.svg);background-repeat:no-repeat}.Checker.highlighted,.Checker.selected{filter:drop-shadow(0 0 .1vh #f7dcab)}.Checker.black{background-image:url(/backgammon/static/media/checker-dark.248faffe392f67eff7e5.svg);background-repeat:no-repeat}.Player-one-bar-checkers,.Player-two-bar-checkers{align-items:center;display:flex;height:47.5%}.Player-one-bar-checkers{flex-direction:column-reverse}.Player-two-bar-checkers{flex-direction:column}.Player-one-bar-checkers.highlight{background-color:hsla(48,70%,64%,.329);border-bottom-left-radius:5vh;border-bottom-right-radius:5vh}.Player-two-bar-checkers.highlight{background-color:hsla(48,70%,64%,.329);border-top-left-radius:5vh;border-top-right-radius:5vh}.Game-board-bar-spacer{height:5%}.Player-one-bar-checkers .Checker,.Player-two-bar-checkers .Checker{height:15%;width:120%}.Player-one-home-checkers,.Player-two-home-checkers{align-items:center;display:flex;flex-direction:column;height:45.5%}.Player-one-home-checkers .Checker.white{background-image:url(/backgammon/static/media/checker-home-light.8aa4877b9e0f9f946c24.svg)}.Player-one-home-checkers .Checker.black{background-image:url(/backgammon/static/media/checker-home-dark.cbae77390308774a0c74.svg)}.Player-two-home-checkers .Checker.white{background-image:url(/backgammon/static/media/checker-home-light.8aa4877b9e0f9f946c24.svg)}.Player-two-home-checkers .Checker.black{background-image:url(/backgammon/static/media/checker-home-dark.cbae77390308774a0c74.svg)}.Player-one-home-checkers,.Player-two-home-checkers.p2{justify-content:flex-end}.Player-one-home-checkers.p2{justify-content:flex-start}.Player-one-home-checkers.highlighted{border-top-left-radius:1vh;border-top-right-radius:1vh}.Player-one-home-checkers.highlighted,.Player-two-home-checkers.highlighted{background:url(/backgammon/static/media/stripes.c676f00f1b408a99ab96.svg);background-size:cover}.Player-two-home-checkers.highlighted{border-bottom-left-radius:1vh;border-bottom-right-radius:1vh}.Game-board-home-spacer{height:9%}.Player-one-home-checkers .Checker,.Player-two-home-checkers .Checker{border-radius:10% 10% 34% 34%;height:4%;margin-bottom:3%;margin-top:3%;padding-top:0;width:80%}.Dice-row-spacer,.Submit-button-wrapper,.Undo-button-wrapper{height:4vw;width:4vw}.Submit-button,.Undo-button{background:url(/backgammon/static/media/checkmark.f0d5863c06fcf58dfa1d.svg) 50%/60% padding-box,linear-gradient(90deg,#3f3217,#564112) border-box;background-repeat:no-repeat;border-color:#816c3d;border-radius:1vh;border-style:double;height:80%;margin-left:10%;margin-top:10%;transition:.2s;width:80%}.Undo-button-wrapper .Undo-button{background:url(/backgammon/static/media/undo-arrow.d3b379507e968a3f8245.svg) 50%/60% padding-box,linear-gradient(90deg,#3f3217,#564112) border-box;background-repeat:no-repeat}.Submit-button:hover,.Undo-button:hover{transform:scale(110%)}.mainmenu .Settings-menu-button-wrapper{right:2vw}.Settings-menu-button-wrapper{position:absolute;right:2%;top:2%}.Game-over-dialog .modal-content,.Settings-menu .modal-content{background-color:#abafc2;border:.5vw solid #636781;border-radius:1vw;font-family:Barlow,sans-serif}.Game-over-dialog{text-align:center}.Game-over-dialog .modal-title{font-size:2em}.Game-over-dialog .modal-header,.Settings-menu .modal-header{border-bottom:1px solid #4e607c}.Game-over-dialog .modal-header{display:block}.Game-over-dialog-winner-wrapper{align-items:center;display:flex;justify-content:center;padding:4%;width:100%}.Game-over-dialog-winner-checker-wrapper{display:flex;height:3.5em;width:12.6%}.Game-over-dialog-winner-checker-wrapper.left{justify-content:flex-end}.Game-over-dialog-winner-text{font-size:1.2em;font-weight:700;width:70%}.Game-over-dialog-gammon-text{font-size:.8em;font-weight:400}.Game-over-dialog-winner-checker-wrapper .Checker{height:100%;width:100%}.Game-over-dialog .modal-footer{justify-content:center}.Game-over-dialog .modal-footer,.Settings-menu .modal-footer{border-top:1px solid #4e607c}.Game-over-dialog .modal-body,.Settings-menu .modal-body{padding:0}.Game-over-dialog .modal-footer .btn,.Settings-menu .modal-footer .btn{background-color:#354e74;border-color:#18263d;border-width:.2vh}.Settings-menu .Settings-option-row{border-bottom:1px solid #4e607c;display:flex;justify-content:space-between}.Settings-menu .Settings-option-row.bottom{border-bottom:none}.Settings-menu-player-names-and-checkers{cursor:pointer;display:flex;justify-content:space-around;padding-right:5%;width:50%}.Settings-menu-player-name-and-checker{align-items:center;display:flex;flex-direction:column;justify-content:center;width:40%}.Settings-menu-player-name{text-align:center}.Settings-menu-checkers-wrapper{display:flex;height:66%;justify-content:space-around;width:100%}.Settings-menu-checker-wrapper{align-items:center;display:flex;height:50%;justify-content:center;width:31%}.Settings-menu-checker-wrapper .Checker{height:100%;width:100%}.Settings-menu-color-swap-arrow-wrapper{align-items:center;display:flex;flex-direction:column;justify-content:center;transition:.2s;width:20%}.Settings-menu-player-names-and-checkers:hover .Settings-menu-color-swap-arrow-wrapper{transform:scale(110%)}.Settings-menu-color-swap{font-size:.6em;font-weight:700;text-align:center}.Settings-menu-color-swap-arrow{background:url(/backgammon/static/media/swap-arrow.adc2648dbfeda0f4cdd7.svg);background-repeat:no-repeat;height:20%;width:50%}.Settings-option-movement-diagram-wrapper{cursor:pointer;display:flex;justify-content:center;padding:2%;width:50%}.Settings-option-movement-diagram{background-repeat:no-repeat;background-size:contain;height:100%;transition:.2s;width:50%}.Settings-option-movement-diagram:hover{transform:scale(105%)}.Settings-option-movement-diagram.light{background-image:url(/backgammon/static/media/diagram-light-ccw.931adeaa0db388308858.svg)}.Settings-option-movement-diagram.light.cw{background-image:url(/backgammon/static/media/diagram-light-cw.68e6b7bbe70ad7e26961.svg)}.Settings-option-movement-diagram.dark{background-image:url(/backgammon/static/media/diagram-dark-ccw.76b61315a54e8704edf2.svg)}.Settings-option-movement-diagram.dark.cw{background-image:url(/backgammon/static/media/diagram-dark-cw.b2e38535766ef2517564.svg)}.Settings-checker-color-label,.Settings-checker-direction-label{padding:4vh}.Settings-option-arrow.clockwise{background:url(/backgammon/static/media/clockwise-arrow.8272b2cca1c1aef8f74d.svg) no-repeat 0 0}.Settings-option-arrow.counterclockwise{background:url(/backgammon/static/media/counterclockwise-arrow.786060271d460b1849ae.svg) no-repeat 0 0}.Settings-menu-button{background:url(/backgammon/static/media/settings-icon.838a43ba31c120380782.svg) no-repeat 0 0;background-size:contain}@media screen and (orientation:landscape){.Settings-menu-button{height:3vw;width:3vw}}@media screen and (orientation:portrait){.Settings-menu-button{height:3vh;width:3vh}}.Accept-double-menu-wrapper,.Begin-game-button-wrapper,.Dice,.Offer-double-button-wrapper,.Roll-button-wrapper{align-items:center;display:flex;height:10%;justify-content:space-evenly;left:10%;position:absolute;top:45%;width:80%;z-index:5}.Die-faces{align-items:center;display:flex;height:114%;justify-content:center;transform-style:preserve-3d;transition:transform 1.3s ease-out;width:15.5%}.Die-face{grid-gap:.4vw;border-radius:.5vw;color:#fff;display:grid;gap:.4vw;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);height:100%;padding:.2vw;position:absolute;width:100%}.Die-faces.white .Die-face{background-color:#fff3db;border:.2vw solid #b49e70}.Die-faces.black .Die-face{background-color:#0f1025;border:.2vw solid #767293}.Die-faces.black.spent .Die-face,.Die-faces.white.spent .Die-face{display:none}.Die-faces.white.spent.five .Die-face.five,.Die-faces.white.spent.four .Die-face.four,.Die-faces.white.spent.one .Die-face.one,.Die-faces.white.spent.six .Die-face.six,.Die-faces.white.spent.three .Die-face.three,.Die-faces.white.spent.two .Die-face.two{background-color:#fff3db4d;border-color:hsla(41,31%,57%,.478);display:grid}.Die-faces.black.spent.five .Die-face.five,.Die-faces.black.spent.four .Die-face.four,.Die-faces.black.spent.one .Die-face.one,.Die-faces.black.spent.six .Die-face.six,.Die-faces.black.spent.three .Die-face.three,.Die-faces.black.spent.two .Die-face.two{background-color:#0f102526;border-color:rgba(118,114,147,.388);display:grid}.Die-pip{border-radius:50%;height:95%;width:95%}.Die-faces.white .Die-pip{background-color:#1b1c22}.Die-faces.black .Die-pip{background-color:#ede2ce}.Die-faces.black.spent .Die-pip{background-color:hsla(0,0%,100%,.439)}.Die-faces.white.spent .Die-pip{background-color:rgba(0,0,0,.439)}.Die-faces.one,.Die-faces.one.black.reroll{transform:rotateX(1turn) rotateY(2turn) rotate(1turn)}.Die-faces.two,.Die-faces.two.black.reroll{transform:rotateX(450deg) rotateY(2turn) rotate(1turn)}.Die-faces.three,.Die-faces.three.black.reroll{transform:rotateX(1turn) rotateY(630deg) rotate(1turn)}.Die-faces.four,.Die-faces.four.black.reroll{transform:rotateX(1turn) rotateY(810deg) rotate(1turn)}.Die-faces.five,.Die-faces.five.black.reroll{transform:rotateX(270deg) rotateY(2turn) rotate(1turn)}.Die-faces.six,.Die-faces.six.black.reroll{transform:rotateX(1turn) rotateY(900deg) rotate(1turn)}.Die-faces.one.black,.Die-faces.one.reroll{transform:rotateX(-1turn) rotateY(-2turn) rotate(-1turn)}.Die-faces.two.black,.Die-faces.two.reroll{transform:rotateX(-270deg) rotateY(-2turn) rotate(-1turn)}.Die-faces.three.black,.Die-faces.three.reroll{transform:rotateX(-1turn) rotateY(-810deg) rotate(-1turn)}.Die-faces.four.black,.Die-faces.four.reroll{transform:rotateX(-1turn) rotateY(-630deg) rotate(-1turn)}.Die-faces.five.black,.Die-faces.five.reroll{transform:rotateX(-450deg) rotateY(-2turn) rotate(-1turn)}.Die-faces.six.black,.Die-faces.six.reroll{transform:rotateX(-1turn) rotateY(-900deg) rotate(-1turn)}.Die-face.one{transform:rotate3d(0,0,0,90deg) translateZ(1.6vw)}.Die-face.two{transform:rotate3d(-1,0,0,90deg) translateZ(1.6vw)}.Die-face.three{transform:rotateY(90deg) translateZ(1.6vw)}.Die-face.four{transform:rotate3d(0,-1,0,90deg) translateZ(1.6vw)}.Die-face.five{transform:rotateX(90deg) translateZ(1.6vw)}.Die-face.six{transform:rotateX(180deg) translateZ(1.6vw)}.Die-pip.one{grid-area:1/1}.Die-pip.three{grid-area:1/3}.Die-pip.four{grid-area:2/1}.Die-pip.five{grid-area:2/2}.Die-pip.six{grid-area:2/3}.Die-pip.seven{grid-area:3/1}.Die-pip.nine{grid-area:3/3}.Doubling-cube{align-content:center;background-image:url(/backgammon/static/media/doubling-cube.f3177f98ab938202e0aa.svg);background-repeat:no-repeat;filter:drop-shadow(1px 1px 1px rgb(58,7,7));height:85%;margin-left:7.5%;width:85%}.Doubling-cube-value-wrapper{align-content:center;color:#fabbbb;font-size:min(1.3vw,1.3em);height:100%;text-align:center;text-shadow:1px 1px 1px #3a0707;width:100%}.Accept-double-menu-wrapper{display:flex;flex-direction:column;height:14%;top:43%}.Accept-double-menu-text-wrapper{color:#b8b8b8;font-size:max(.5em,1.2vw)}.Accept-double-menu-buttons-wrapper{align-items:center;display:flex;height:50%;justify-content:space-evenly;width:100%}.Accept-double-button,.Forfeit-game-button{font-size:min(1em,1vw);height:100%;padding:0;width:34%}.Accept-double-button{color:#62955d}.Forfeit-game-button{color:#c14534}.Waiting-for-accept-double-wrapper{align-items:center;color:#b8b8b8;display:flex;font-size:.7em;height:12%;justify-content:center;left:10%;position:absolute;top:44%;width:80%;z-index:5}.Initial-floating-circle{animation:float-around-none 0s ease 0s 1 normal none running var(--animation-duration) 0s ease-in;animation:float-around-initial var(--animation-duration) 0s ease-in;background-color:rgba(131,145,158,.141);border-radius:50%;bottom:var(--bottom-offset);display:block;height:var(--radius);left:var(--left-offset);opacity:0;pointer-events:none;position:absolute;width:var(--radius)}@keyframes float-around-initial{0%{opacity:var(--starting-opacity)}50%{opacity:var(--max-opacity)}to{opacity:0;transform:translateX(var(--float-x)) translateY(var(--float-y))}}.Initial-floating-circle:nth-child(0){--bottom-offset:49%;--left-offset:18vw;--radius:3vw;--animation-duration:28s;--float-y:3vh;--float-x:-26vw;--starting-opacity:18%;--max-opacity:75%}.Initial-floating-circle:first-child{--bottom-offset:64%;--left-offset:91vw;--radius:5vw;--animation-duration:18s;--float-y:4vh;--float-x:0vw;--starting-opacity:42%;--max-opacity:58%}.Initial-floating-circle:nth-child(2){--bottom-offset:101%;--left-offset:52vw;--radius:3vw;--animation-duration:13s;--float-y:18vh;--float-x:10vw;--starting-opacity:49%;--max-opacity:51%}.Initial-floating-circle:nth-child(3){--bottom-offset:41%;--left-offset:99vw;--radius:6vw;--animation-duration:27s;--float-y:-1vh;--float-x:-20vw;--starting-opacity:25%;--max-opacity:61%}.Initial-floating-circle:nth-child(4){--bottom-offset:61%;--left-offset:4vw;--radius:6vw;--animation-duration:30s;--float-y:-17vh;--float-x:30vw;--starting-opacity:29%;--max-opacity:80%}.Initial-floating-circle:nth-child(5){--bottom-offset:101%;--left-offset:51vw;--radius:6vw;--animation-duration:10s;--float-y:-22vh;--float-x:19vw;--starting-opacity:34%;--max-opacity:73%}.Initial-floating-circle:nth-child(6){--bottom-offset:23%;--left-offset:62vw;--radius:3vw;--animation-duration:24s;--float-y:-24vh;--float-x:26vw;--starting-opacity:46%;--max-opacity:71%}.Initial-floating-circle:nth-child(7){--bottom-offset:20%;--left-offset:70vw;--radius:4vw;--animation-duration:18s;--float-y:10vh;--float-x:14vw;--starting-opacity:22%;--max-opacity:68%}.Initial-floating-circle:nth-child(8){--bottom-offset:37%;--left-offset:70vw;--radius:4vw;--animation-duration:23s;--float-y:12vh;--float-x:-26vw;--starting-opacity:31%;--max-opacity:74%}.Initial-floating-circle:nth-child(9){--bottom-offset:17%;--left-offset:83vw;--radius:6vw;--animation-duration:23s;--float-y:23vh;--float-x:2vw;--starting-opacity:48%;--max-opacity:47%}.Initial-floating-circle:nth-child(10){--bottom-offset:80%;--left-offset:87vw;--radius:3vw;--animation-duration:24s;--float-y:-7vh;--float-x:25vw;--starting-opacity:24%;--max-opacity:74%}.Initial-floating-circle:nth-child(11){--bottom-offset:98%;--left-offset:89vw;--radius:6vw;--animation-duration:18s;--float-y:-1vh;--float-x:-9vw;--starting-opacity:31%;--max-opacity:46%}.Initial-floating-circle:nth-child(12){--bottom-offset:99%;--left-offset:4vw;--radius:4vw;--animation-duration:20s;--float-y:21vh;--float-x:10vw;--starting-opacity:27%;--max-opacity:58%}.Initial-floating-circle:nth-child(13){--bottom-offset:57%;--left-offset:19vw;--radius:3vw;--animation-duration:23s;--float-y:-20vh;--float-x:7vw;--starting-opacity:29%;--max-opacity:49%}.Initial-floating-circle:nth-child(14){--bottom-offset:59%;--left-offset:91vw;--radius:3vw;--animation-duration:12s;--float-y:18vh;--float-x:-7vw;--starting-opacity:37%;--max-opacity:42%}.Initial-floating-circle:nth-child(15){--bottom-offset:12%;--left-offset:92vw;--radius:5vw;--animation-duration:17s;--float-y:5vh;--float-x:-11vw;--starting-opacity:45%;--max-opacity:51%}.Initial-floating-circle:nth-child(16){--bottom-offset:24%;--left-offset:97vw;--radius:6vw;--animation-duration:15s;--float-y:20vh;--float-x:-28vw;--starting-opacity:33%;--max-opacity:44%}.Initial-floating-circle:nth-child(17){--bottom-offset:22%;--left-offset:67vw;--radius:5vw;--animation-duration:13s;--float-y:-26vh;--float-x:21vw;--starting-opacity:18%;--max-opacity:52%}.Initial-floating-circle:nth-child(18){--bottom-offset:24%;--left-offset:51vw;--radius:4vw;--animation-duration:29s;--float-y:7vh;--float-x:21vw;--starting-opacity:39%;--max-opacity:61%}.Initial-floating-circle:nth-child(19){--bottom-offset:35%;--left-offset:25vw;--radius:6vw;--animation-duration:11s;--float-y:28vh;--float-x:3vw;--starting-opacity:30%;--max-opacity:57%}.Initial-floating-circle:nth-child(20){--bottom-offset:21%;--left-offset:37vw;--radius:3vw;--animation-duration:25s;--float-y:14vh;--float-x:6vw;--starting-opacity:26%;--max-opacity:49%}.Initial-floating-circle:nth-child(21){--bottom-offset:0%;--left-offset:4vw;--radius:6vw;--animation-duration:24s;--float-y:-10vh;--float-x:-24vw;--starting-opacity:30%;--max-opacity:66%}.Initial-floating-circle:nth-child(22){--bottom-offset:97%;--left-offset:9vw;--radius:3vw;--animation-duration:11s;--float-y:-8vh;--float-x:-1vw;--starting-opacity:28%;--max-opacity:53%}.Initial-floating-circle:nth-child(23){--bottom-offset:89%;--left-offset:52vw;--radius:4vw;--animation-duration:11s;--float-y:-12vh;--float-x:30vw;--starting-opacity:33%;--max-opacity:66%}.Initial-floating-circle:nth-child(24){--bottom-offset:69%;--left-offset:15vw;--radius:4vw;--animation-duration:10s;--float-y:20vh;--float-x:19vw;--starting-opacity:33%;--max-opacity:46%}.Initial-floating-circle:nth-child(25){--bottom-offset:109%;--left-offset:65vw;--radius:6vw;--animation-duration:26s;--float-y:-5vh;--float-x:-7vw;--starting-opacity:28%;--max-opacity:78%}.Initial-floating-circle:nth-child(26){--bottom-offset:17%;--left-offset:63vw;--radius:5vw;--animation-duration:29s;--float-y:14vh;--float-x:20vw;--starting-opacity:48%;--max-opacity:60%}.Initial-floating-circle:nth-child(27){--bottom-offset:52%;--left-offset:34vw;--radius:3vw;--animation-duration:22s;--float-y:-23vh;--float-x:-19vw;--starting-opacity:32%;--max-opacity:44%}.Initial-floating-circle:nth-child(28){--bottom-offset:67%;--left-offset:7vw;--radius:4vw;--animation-duration:24s;--float-y:6vh;--float-x:-28vw;--starting-opacity:24%;--max-opacity:77%}.Initial-floating-circle:nth-child(29){--bottom-offset:106%;--left-offset:20vw;--radius:5vw;--animation-duration:19s;--float-y:18vh;--float-x:-10vw;--starting-opacity:12%;--max-opacity:50%}.Initial-floating-circle:nth-child(30){--bottom-offset:70%;--left-offset:78vw;--radius:3vw;--animation-duration:28s;--float-y:1vh;--float-x:-4vw;--starting-opacity:41%;--max-opacity:50%}.Initial-floating-circle:nth-child(31){--bottom-offset:86%;--left-offset:38vw;--radius:3vw;--animation-duration:10s;--float-y:-6vh;--float-x:-27vw;--starting-opacity:34%;--max-opacity:71%}.Initial-floating-circle:nth-child(32){--bottom-offset:104%;--left-offset:6vw;--radius:3vw;--animation-duration:19s;--float-y:2vh;--float-x:13vw;--starting-opacity:49%;--max-opacity:78%}.Initial-floating-circle:nth-child(33){--bottom-offset:25%;--left-offset:30vw;--radius:4vw;--animation-duration:23s;--float-y:15vh;--float-x:-23vw;--starting-opacity:21%;--max-opacity:66%}.Initial-floating-circle:nth-child(34){--bottom-offset:20%;--left-offset:74vw;--radius:4vw;--animation-duration:22s;--float-y:29vh;--float-x:20vw;--starting-opacity:43%;--max-opacity:46%}.Initial-floating-circle:nth-child(35){--bottom-offset:61%;--left-offset:14vw;--radius:6vw;--animation-duration:23s;--float-y:20vh;--float-x:4vw;--starting-opacity:49%;--max-opacity:69%}.Initial-floating-circle:nth-child(36){--bottom-offset:51%;--left-offset:11vw;--radius:5vw;--animation-duration:20s;--float-y:-18vh;--float-x:28vw;--starting-opacity:42%;--max-opacity:64%}.Initial-floating-circle:nth-child(37){--bottom-offset:30%;--left-offset:96vw;--radius:5vw;--animation-duration:17s;--float-y:-19vh;--float-x:-30vw;--starting-opacity:14%;--max-opacity:66%}.Initial-floating-circle:nth-child(38){--bottom-offset:59%;--left-offset:49vw;--radius:5vw;--animation-duration:13s;--float-y:15vh;--float-x:-22vw;--starting-opacity:17%;--max-opacity:48%}.Initial-floating-circle:nth-child(39){--bottom-offset:-3%;--left-offset:71vw;--radius:3vw;--animation-duration:24s;--float-y:20vh;--float-x:-8vw;--starting-opacity:40%;--max-opacity:78%}.Initial-floating-circle:nth-child(40){--bottom-offset:27%;--left-offset:46vw;--radius:5vw;--animation-duration:18s;--float-y:-14vh;--float-x:-10vw;--starting-opacity:38%;--max-opacity:75%}.Initial-floating-circle:nth-child(41){--bottom-offset:104%;--left-offset:31vw;--radius:3vw;--animation-duration:28s;--float-y:19vh;--float-x:7vw;--starting-opacity:14%;--max-opacity:65%}.Initial-floating-circle:nth-child(42){--bottom-offset:8%;--left-offset:49vw;--radius:3vw;--animation-duration:21s;--float-y:-2vh;--float-x:-12vw;--starting-opacity:29%;--max-opacity:46%}.Initial-floating-circle:nth-child(43){--bottom-offset:51%;--left-offset:25vw;--radius:6vw;--animation-duration:29s;--float-y:27vh;--float-x:-7vw;--starting-opacity:20%;--max-opacity:74%}.Initial-floating-circle:nth-child(44){--bottom-offset:83%;--left-offset:16vw;--radius:5vw;--animation-duration:12s;--float-y:-15vh;--float-x:18vw;--starting-opacity:21%;--max-opacity:58%}.Initial-floating-circle:nth-child(45){--bottom-offset:90%;--left-offset:58vw;--radius:5vw;--animation-duration:16s;--float-y:-1vh;--float-x:18vw;--starting-opacity:50%;--max-opacity:50%}.Initial-floating-circle:nth-child(46){--bottom-offset:16%;--left-offset:62vw;--radius:6vw;--animation-duration:14s;--float-y:18vh;--float-x:4vw;--starting-opacity:45%;--max-opacity:60%}.Initial-floating-circle:nth-child(47){--bottom-offset:38%;--left-offset:27vw;--radius:6vw;--animation-duration:19s;--float-y:-12vh;--float-x:-13vw;--starting-opacity:41%;--max-opacity:77%}.Initial-floating-circle:nth-child(48){--bottom-offset:0%;--left-offset:23vw;--radius:4vw;--animation-duration:10s;--float-y:-25vh;--float-x:6vw;--starting-opacity:41%;--max-opacity:53%}.Initial-floating-circle:nth-child(49){--bottom-offset:106%;--left-offset:38vw;--radius:4vw;--animation-duration:22s;--float-y:12vh;--float-x:21vw;--starting-opacity:37%;--max-opacity:63%}.Initial-floating-circle:nth-child(50){--bottom-offset:96%;--left-offset:51vw;--radius:3vw;--animation-duration:21s;--float-y:-8vh;--float-x:-19vw;--starting-opacity:25%;--max-opacity:50%}.Floating-circle{animation:float-around var(--animation-duration) var(--delay) ease-in infinite;background-color:rgba(131,145,158,.141);border-radius:50%;bottom:var(--bottom-offset);display:block;height:var(--radius);left:var(--left-offset);opacity:0;pointer-events:none;position:absolute;width:var(--radius)}@keyframes float-around{0%{opacity:0}50%{opacity:var(--max-opacity)}to{opacity:0;transform:translateX(var(--float-x)) translateY(var(--float-y))}}.Floating-circle:nth-child(0){--delay:18s;--bottom-offset:102%;--left-offset:76vw;--radius:5vw;--animation-duration:25s;--float-y:19vh;--float-x:-15vw;--max-opacity:32%}.Floating-circle:first-child{--delay:27s;--bottom-offset:46%;--left-offset:18vw;--radius:6vw;--animation-duration:29s;--float-y:11vh;--float-x:-10vw;--max-opacity:39%}.Floating-circle:nth-child(2){--delay:19s;--bottom-offset:7%;--left-offset:93vw;--radius:5vw;--animation-duration:29s;--float-y:8vh;--float-x:-10vw;--max-opacity:61%}.Floating-circle:nth-child(3){--delay:19s;--bottom-offset:50%;--left-offset:32vw;--radius:4vw;--animation-duration:16s;--float-y:19vh;--float-x:29vw;--max-opacity:59%}.Floating-circle:nth-child(4){--delay:13s;--bottom-offset:98%;--left-offset:11vw;--radius:6vw;--animation-duration:13s;--float-y:-9vh;--float-x:9vw;--max-opacity:46%}.Floating-circle:nth-child(5){--delay:20s;--bottom-offset:55%;--left-offset:42vw;--radius:3vw;--animation-duration:23s;--float-y:-26vh;--float-x:22vw;--max-opacity:57%}.Floating-circle:nth-child(6){--delay:13s;--bottom-offset:40%;--left-offset:99vw;--radius:4vw;--animation-duration:22s;--float-y:-8vh;--float-x:28vw;--max-opacity:43%}.Floating-circle:nth-child(7){--delay:22s;--bottom-offset:12%;--left-offset:29vw;--radius:5vw;--animation-duration:16s;--float-y:10vh;--float-x:9vw;--max-opacity:60%}.Floating-circle:nth-child(8){--delay:11s;--bottom-offset:48%;--left-offset:95vw;--radius:3vw;--animation-duration:29s;--float-y:-16vh;--float-x:-28vw;--max-opacity:54%}.Floating-circle:nth-child(9){--delay:23s;--bottom-offset:93%;--left-offset:72vw;--radius:6vw;--animation-duration:30s;--float-y:-5vh;--float-x:20vw;--max-opacity:57%}.Floating-circle:nth-child(10){--delay:19s;--bottom-offset:58%;--left-offset:42vw;--radius:3vw;--animation-duration:16s;--float-y:-23vh;--float-x:28vw;--max-opacity:34%}.Floating-circle:nth-child(11){--delay:19s;--bottom-offset:92%;--left-offset:32vw;--radius:5vw;--animation-duration:16s;--float-y:-4vh;--float-x:-11vw;--max-opacity:38%}.Floating-circle:nth-child(12){--delay:13s;--bottom-offset:44%;--left-offset:93vw;--radius:5vw;--animation-duration:10s;--float-y:30vh;--float-x:-14vw;--max-opacity:33%}.Floating-circle:nth-child(13){--delay:18s;--bottom-offset:54%;--left-offset:92vw;--radius:4vw;--animation-duration:28s;--float-y:29vh;--float-x:-10vw;--max-opacity:69%}.Floating-circle:nth-child(14){--delay:23s;--bottom-offset:2%;--left-offset:56vw;--radius:6vw;--animation-duration:29s;--float-y:26vh;--float-x:4vw;--max-opacity:46%}.Floating-circle:nth-child(15){--delay:17s;--bottom-offset:60%;--left-offset:24vw;--radius:5vw;--animation-duration:20s;--float-y:17vh;--float-x:5vw;--max-opacity:43%}.Floating-circle:nth-child(16){--delay:18s;--bottom-offset:86%;--left-offset:54vw;--radius:4vw;--animation-duration:26s;--float-y:11vh;--float-x:-5vw;--max-opacity:67%}.Floating-circle:nth-child(17){--delay:21s;--bottom-offset:22%;--left-offset:68vw;--radius:5vw;--animation-duration:28s;--float-y:22vh;--float-x:21vw;--max-opacity:45%}.Floating-circle:nth-child(18){--delay:19s;--bottom-offset:38%;--left-offset:9vw;--radius:5vw;--animation-duration:11s;--float-y:-22vh;--float-x:12vw;--max-opacity:58%}.Floating-circle:nth-child(19){--delay:22s;--bottom-offset:90%;--left-offset:89vw;--radius:4vw;--animation-duration:21s;--float-y:8vh;--float-x:-6vw;--max-opacity:33%}.Floating-circle:nth-child(20){--delay:26s;--bottom-offset:-8%;--left-offset:38vw;--radius:4vw;--animation-duration:16s;--float-y:13vh;--float-x:-9vw;--max-opacity:59%}.Floating-circle:nth-child(21){--delay:20s;--bottom-offset:4%;--left-offset:40vw;--radius:5vw;--animation-duration:11s;--float-y:-9vh;--float-x:25vw;--max-opacity:54%}.Floating-circle:nth-child(22){--delay:16s;--bottom-offset:63%;--left-offset:15vw;--radius:6vw;--animation-duration:14s;--float-y:6vh;--float-x:-9vw;--max-opacity:39%}.Floating-circle:nth-child(23){--delay:23s;--bottom-offset:55%;--left-offset:70vw;--radius:5vw;--animation-duration:20s;--float-y:-25vh;--float-x:28vw;--max-opacity:38%}.Floating-circle:nth-child(24){--delay:19s;--bottom-offset:21%;--left-offset:67vw;--radius:3vw;--animation-duration:15s;--float-y:-22vh;--float-x:20vw;--max-opacity:32%}.Floating-circle:nth-child(25){--delay:20s;--bottom-offset:97%;--left-offset:19vw;--radius:5vw;--animation-duration:27s;--float-y:6vh;--float-x:10vw;--max-opacity:45%}.Floating-circle:nth-child(26){--delay:10s;--bottom-offset:106%;--left-offset:0vw;--radius:6vw;--animation-duration:16s;--float-y:-4vh;--float-x:5vw;--max-opacity:52%}.Floating-circle:nth-child(27){--delay:13s;--bottom-offset:66%;--left-offset:78vw;--radius:5vw;--animation-duration:25s;--float-y:-13vh;--float-x:17vw;--max-opacity:53%}.Floating-circle:nth-child(28){--delay:16s;--bottom-offset:1%;--left-offset:34vw;--radius:3vw;--animation-duration:11s;--float-y:14vh;--float-x:-19vw;--max-opacity:58%}.Floating-circle:nth-child(29){--delay:14s;--bottom-offset:2%;--left-offset:69vw;--radius:4vw;--animation-duration:20s;--float-y:-13vh;--float-x:-3vw;--max-opacity:33%}.Floating-circle:nth-child(30){--delay:18s;--bottom-offset:69%;--left-offset:21vw;--radius:6vw;--animation-duration:28s;--float-y:3vh;--float-x:-22vw;--max-opacity:33%}.Floating-circle:nth-child(31){--delay:16s;--bottom-offset:81%;--left-offset:18vw;--radius:4vw;--animation-duration:18s;--float-y:-14vh;--float-x:2vw;--max-opacity:41%}.Floating-circle:nth-child(32){--delay:14s;--bottom-offset:60%;--left-offset:43vw;--radius:3vw;--animation-duration:18s;--float-y:22vh;--float-x:12vw;--max-opacity:62%}.Floating-circle:nth-child(33){--delay:20s;--bottom-offset:62%;--left-offset:85vw;--radius:4vw;--animation-duration:11s;--float-y:9vh;--float-x:23vw;--max-opacity:66%}.Floating-circle:nth-child(34){--delay:19s;--bottom-offset:13%;--left-offset:57vw;--radius:6vw;--animation-duration:12s;--float-y:-23vh;--float-x:30vw;--max-opacity:30%}.Floating-circle:nth-child(35){--delay:20s;--bottom-offset:12%;--left-offset:57vw;--radius:3vw;--animation-duration:20s;--float-y:19vh;--float-x:24vw;--max-opacity:66%}.Floating-circle:nth-child(36){--delay:16s;--bottom-offset:10%;--left-offset:58vw;--radius:3vw;--animation-duration:30s;--float-y:-15vh;--float-x:22vw;--max-opacity:46%}.Floating-circle:nth-child(37){--delay:29s;--bottom-offset:50%;--left-offset:21vw;--radius:5vw;--animation-duration:28s;--float-y:-3vh;--float-x:21vw;--max-opacity:63%}.Floating-circle:nth-child(38){--delay:12s;--bottom-offset:47%;--left-offset:34vw;--radius:6vw;--animation-duration:26s;--float-y:-1vh;--float-x:23vw;--max-opacity:57%}.Floating-circle:nth-child(39){--delay:23s;--bottom-offset:12%;--left-offset:50vw;--radius:4vw;--animation-duration:26s;--float-y:-6vh;--float-x:-5vw;--max-opacity:45%}.Floating-circle:nth-child(40){--delay:27s;--bottom-offset:78%;--left-offset:72vw;--radius:3vw;--animation-duration:17s;--float-y:-18vh;--float-x:-28vw;--max-opacity:58%}.Floating-circle:nth-child(41){--delay:25s;--bottom-offset:23%;--left-offset:57vw;--radius:3vw;--animation-duration:23s;--float-y:27vh;--float-x:8vw;--max-opacity:68%}.Floating-circle:nth-child(42){--delay:18s;--bottom-offset:73%;--left-offset:74vw;--radius:4vw;--animation-duration:17s;--float-y:-1vh;--float-x:28vw;--max-opacity:63%}.Floating-circle:nth-child(43){--delay:10s;--bottom-offset:28%;--left-offset:58vw;--radius:6vw;--animation-duration:15s;--float-y:10vh;--float-x:5vw;--max-opacity:65%}.Floating-circle:nth-child(44){--delay:12s;--bottom-offset:84%;--left-offset:99vw;--radius:4vw;--animation-duration:21s;--float-y:-19vh;--float-x:-26vw;--max-opacity:43%}.Floating-circle:nth-child(45){--delay:25s;--bottom-offset:46%;--left-offset:49vw;--radius:6vw;--animation-duration:20s;--float-y:-7vh;--float-x:-18vw;--max-opacity:38%}.Floating-circle:nth-child(46){--delay:29s;--bottom-offset:108%;--left-offset:94vw;--radius:6vw;--animation-duration:28s;--float-y:-7vh;--float-x:-9vw;--max-opacity:66%}.Floating-circle:nth-child(47){--delay:10s;--bottom-offset:104%;--left-offset:27vw;--radius:5vw;--animation-duration:22s;--float-y:-26vh;--float-x:3vw;--max-opacity:59%}.Floating-circle:nth-child(48){--delay:20s;--bottom-offset:24%;--left-offset:97vw;--radius:3vw;--animation-duration:27s;--float-y:3vh;--float-x:-9vw;--max-opacity:37%}.Floating-circle:nth-child(49){--delay:25s;--bottom-offset:49%;--left-offset:95vw;--radius:3vw;--animation-duration:25s;--float-y:-2vh;--float-x:27vw;--max-opacity:63%}.Floating-circle:nth-child(50){--delay:25s;--bottom-offset:46%;--left-offset:8vw;--radius:5vw;--animation-duration:21s;--float-y:-10vh;--float-x:22vw;--max-opacity:55%}.Wipe-transition{animation-duration:.3s;animation-iteration-count:1;animation-name:wipe;animation-timing-function:linear;background-color:rgba(0,0,0,.655);height:100%;left:0;pointer-events:none;position:absolute;top:0;width:0;z-index:9}@keyframes wipe{0%{width:100%}to{width:0}}.Wipe-fade{animation-duration:.3s;animation-iteration-count:1;animation-name:fade;animation-timing-function:linear;background-color:#fff0;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:8}@keyframes fade{0%{background-color:hsla(0,0%,100%,.337)}to{background-color:#fff0}}.Room-connection-error-wrapper{align-items:center;color:#b8b8b8;display:flex;flex-direction:column;text-align:center;width:50%}.Room-connection-error-header{font-size:max(2em,2vw)}.Room-connection-error-text{font-size:max(1em,1vw);margin-top:2%;width:100%}.Room-connection-error-roomcode{font-weight:700}.Room-connection-error-subtext{font-size:max(1em,1vw);line-height:1em;margin-top:2%;width:70%}.Room-connection-error-menu-button-wrapper{margin-top:5%}.Room-connection-error-menu-button{background:linear-gradient(90deg,#3f3217,#564112);border:.2em double #816c3d;border-radius:min(1vw,1em);color:#b8b8b8;font-family:Barlow,sans-serif;font-size:max(1em,1vw);font-weight:700;height:5vh;max-width:175px;min-height:35px;min-width:125px;padding:.5vh;text-align:center;transition:.2s;width:12vw}.Room-connection-error-menu-button:active,.Room-connection-error-menu-button:hover{transform:scale(105%)}
+/*# sourceMappingURL=main.04a1a27a.css.map*/
\ No newline at end of file
diff --git a/static/css/main.04a1a27a.css.map b/static/css/main.04a1a27a.css.map
new file mode 100644
index 0000000..adbff46
--- /dev/null
+++ b/static/css/main.04a1a27a.css.map
@@ -0,0 +1 @@
+{"version":3,"file":"static/css/main.04a1a27a.css","mappings":"AAAA,KACE,kBAGF,UACE,cACA,oBAGF,6CACE,UACE,6CAIJ,aACE,mBACA,8DACA,aACA,sBACA,8BAMA,uBALA,iBACA,gBAEA,gBACA,iBAEA,CAGF,mCAPE,aAIA,WAKA,CAGF,YAME,mBALA,yBAQA,WANA,aACA,sBACA,8BAGA,6BADA,uBALA,gBAOA,CAGF,UACE,cAGF,yBACE,GACE,uBAEF,GACE,yBAIJ,sBACE,aAGF,wCACE,cACA,eACA,uBAGF,iBAEE,sBACA,mCAFA,oBAGA,iCACA,uFAEA,wBACA,4BAEA,WAGF,cAEM,0BAGA,yBAIN,6HACE,iDAEA,CAGA,0BACA,CAHA,0BACA,CAGA,2CAEA,2BACA,CAHA,gBAIA,8BAIF,qLAIA,qBACE,qBAEA,kBACA,WACA,yBACA,uBACA,iBAIF,2BACE,8BAEA,wDACA,CAFA,mBACA,CACA,gCACA,0GAOF,wBACE,4BAEA,WACA,8BAEA,kBACA,WACA,aAGF,sBACE,sDACA,gBAKA,qCAEA,CAPA,wFAGA,oDAEA,CAEA,8CAOF,CAEI,WAFJ,uCAEI,uBAIJ,8DAEE,YACA,iCAEA,gEAIF,mCACE,wCACA,UACA,sDAEA,uBACA,6BACA,2BACA,+CAKF,8BACE,uBAIA,0BACE,CAIJ,oDACE,+CAGF,UACE,4HAGF,6HAQE,qIAIA,yDAEA,qBAEA,mCAIA,CAPA,mBACA,CAMA,gCAEA,0GASA,wBAEA,4BAIF,qCAGE,UAFA,6BACA,2BADA,gBAEA,8BACA,6CACA,iCAEA,UAGF,2HAIE,CACA,uBAGF,4BACE,gDACA,CACA,WADA,qBACA,CACA,+EAEA,kBAIF,sCACE,4GAGA,yDACA,CAMA,uDANA,+CAKF,CACE,gCAaA,CAbA,4BACA,sFAEA,6BACA,4BAKF,CAGE,SACA,oBACA,iFAMA,CACA,4BAGF,CACE,2BACA,gDAGA,CACA,WADA,qBACA,UAGF,mBAGE,wCAGF,CALE,sBAEA,CAGF,kCACE,YACE,UAGF,yBAKF,wBACE,CALE,aAIJ,CACE,aACA,gBACA,wBAIA,qDACA,+BACA,mBACA,aACA,CACA,cACA,CAFA,eAEA,kDAKA,8DAGF,4CACE,aAGF,2BACE,iFAKA,6BAIA,4CACA,WADA,cACA,CACA,iDAEA,yFAIA,4CAEA,qBAEA,wBAGF,kBACE,cAGF,iCACE,cACA,YACA,mBACA,iDAIF,CAEE,0BAEA,CAHA,0BACA,CAEA,aAGF,CACE,wDAGF,CAJA,eACE,CAGF,8BACE,oDAGF,iDACE,2CAGF,6EACE,uBAGF,4BACE,WACA,qCAGF,oFAKA,CACE,yBAGF,mFAMA,mCAEE,mFAGA,kCAEA,kFAKA,mCAEA,cACA,gBAGF,yCACE,oBACA,iDAGF,wBACE,+BAGF,YACE,sBACA,0CACA,iDACA,4BAEA,CACA,mBACA,kBAEA,CAIA,cAGF,CAPE,wBAGF,gBACE,qBAGF,0BACE,kBAGF,eACE,mBACA,8DACA,qEAKA,qBAIF,wCACE,CAOA,4BACA,CAHF,2CAEE,8BACA,cAGF,aACE,WACA,QACA,CAFA,iBACA,CACA,SAGF,8BACE,mCAIF,6DAEE,kBACA,CAKE,kCAEA,CAJJ,2CAEI,sBAEA,8BAIF,sBACE,uCAIA,WADA,UACA,UAIJ,4CACE,sBACE,UACA,sBAIF,6BACE,WACA,oCAKJ,oBACE,6DAOF,0BACE,UACA,2CAKF,qBACE,eAGF,gBACE,gDAIA,uEACA,2CAEA,qBAEA,6BAEA,kCACA,2BAEA,WAGF,kCACE,kFAGA,WAHA,kCAGA,6BACA,cACA,uDACA,0GAQF,sBACE,oHAGA,wCACA,uBAGF,iJAQE,CAIF,gCACE,CAIA,uCALF,uBACE,oCAIA,sGAGA,iJAUA,mFAGA,uCACA,CAJA,oCAIA,sBACA,oDACA,wCAEA,oBACA,iBACA,8IAUA,CAOA,SACA,2CARA,gCACA,CACA,8CAGF,6BA+BI,CA5BF,iBAIF,8IASE,CAKA,uCAGF,CALA,sBACE,qCACA,CAUE,6BAUJ,sCACE,CANE,4BACA,CANA,uBACA,wBAIA,CACA,mCAIJ,CALI,yBAMF,gBACA,aAGF,WAHE,iBAGF,cACE,0BACA,2BAGF,kBACE,UACA,yCAEA,sCAMA,6BACA,yEASF,sBACE,iCAGF,qBACE,sBAGF,mGACE,4GAIA,8GAIA,8BAGF,6BACE,+BAIA,iBACA,WACA,gBACA,kBACA,CACA,UAGF,gCACE,0BAGF,kBACE,kDAKA,cAIA,oDACA,mDACA,+CAEA,8CAKA,uCACA,qDAGF,iDACE,0CAIA,8CACA,6CAGF,mBACE,0DACA,qBAGF,4CACE,uDAIA,kFAIF,CAMA,WANA,wDACE,CAKF,UALE,4BAKF,UACE,qGAOF,4BACE,oDACA,oCAIF,+BACE,8FAEA,4BAGF,+BAIA,6FAKA,oEAGE,oCAIF,oGAIA,+EACE,kBAGF,oDACE,uDAGF,yDACE,sCAGF,6DACE,CAGF,mCACE,sCAGF,2BACE,oDACA,SACA,qEAIF,0EACE,kBACA,aACA,sBACA,uDAIA,0FAIA,0CAEA,yFAMF,0CAKA,0FACE,mIAIA,wDAGA,wBAEA,8BAGF,0BACE,uCACA,0BAGF,4BACE,6EALA,0EACA,qBAkBA,CAdA,sCAaF,4DACE,yBACA,gFAKF,6BAIA,yCACE,cAGF,wEACE,UAGF,uCACE,iJAWF,CAGE,2BAGF,CANA,oBAEE,kBACA,CAGF,oBAIA,WAJA,eACE,eAGF,eACE,6CAKF,kJAUA,4BACE,yCAGF,8DAIA,yDACE,SAGF,uEACE,wBACA,0BACA,kBAGF,8BACE,oCACA,gCACA,aAGF,8DAIA,+BACE,iCAEA,+CAKF,mBAHE,YAGF,CACE,sBACA,YAFF,UAEE,0CAEA,YAIF,wEAIA,wBAEE,+BACA,eAIF,yDAEE,cACA,CACA,eACA,mDAGF,WACE,WACA,iCAGF,sBACE,8DAGA,4BAEA,0DAGF,iFAKE,wBACA,qBACA,kBAGF,qCACE,gCACA,0CAEA,4CAGF,kBACE,0CAGA,cACA,aAGF,6BACE,2BACA,wCAMF,mBAJE,YACA,sBAGF,uBACE,UAGF,6CACE,8CAGF,kDACE,mDAGF,8CACE,CADF,SACE,yCAGF,+DACE,kBAGF,CAHE,aAGF,sBAHE,uBAGF,wBACE,wFAIA,gDAGF,8BACE,+HAIA,4BACA,sBAGF,wDACE,aACE,uBAKJ,wDAGI,2BAOH,CATC,uBAEE,CAOH,kGAKC,yCAIA,yFAQA,4CAGA,wFAGA,wCAKA,wFAIA,2CAEA,uFAOA,iEAIA,YACA,iCAGF,+FAIA,mQAOE,mEAIF,gPAME,gCACA,uCACA,CADA,SACA,iBAIA,kBACA,UACA,YAGF,+BACE,mCAGF,4BACE,mCAGF,YACE,WAGF,cAHE,6BAGF,sBACE,oCAGF,6CACE,sEAEF,kDACE,oDAEF,6FAGA,2QAOE,0BAGF,mCACE,4QAMA,0BAEF,oCACE,wCAEF,gDACE,mDAEF,yDACE,qCAGF,iCACE,iCAEF,4CACE,qDAGA,4CAGA,sDAEF,gDACE,sDAGA,8CAIA,sDAMA,8CAKF,sDAMA,4CAKE,sDACA,4CAEA,wDAEA,4CAIF,yDAGE,gDAGA,yDAKA,8CAGA,yDAKA,8CAGF,yDAGE,4CAKF,yDAEE,eACA,iDAQF,iEAKE,iBACA,0CAIA,gBACA,kDAIA,gBAsBF,0CAEE,eACA,2CAEA,cACA,aACA,gBACA,wDACA,aACA,cACA,gMAGE,4BACE,4CAMA,oEACA,oBAKF,yCACE,YACA,kBACA,gCAEA,wCAEA,aACA,qBARF,CAOE,UACA,QARF,kCACE,aACA,0BACA,qCAEA,kBACA,aACA,CACA,UARF,CAOE,4BACA,CARF,sDAEE,sBACA,YACA,2CAEA,aACA,mCACA,oCARF,kBACE,cACA,4BACA,WACA,uBACA,CADA,SACA,iBACA,QACA,oBACA,0BARF,iGAKE,oEALF,CAOE,uCAPF,CAKE,iBACA,CALA,2BACA,CACA,cACA,oBACA,CALF,uBACE,CADF,gDAIE,mBAJF,oCACE,+BACA,+BAEA,IAGA,SACA,CAJA,+DAIA,wCARF,mBACE,mBACA,aACA,yBACA,cACA,gBACA,uBACA,kBACA,sCARF,mBACE,mBACA,aACA,yBACA,cACA,cACA,uBACA,kBACA,uCARF,oBACE,mBACA,aACA,yBACA,eACA,eACA,uBACA,kBACA,uCARF,mBACE,mBACA,aACA,yBACA,eACA,gBACA,uBACA,kBACA,uCARF,mBACE,kBACA,cACA,wBACA,gBACA,eACA,uBACA,kBACA,uCARF,oBACE,mBACA,aACA,yBACA,gBACA,eACA,uBACA,kBACA,uCARF,mBACE,mBACA,aACA,yBACA,gBACA,eACA,uBACA,kBACA,uCARF,mBACE,mBACA,aACA,yBACA,eACA,eACA,uBACA,kBACA,uCARF,mBACE,mBACA,aACA,yBACA,eACA,gBACA,uBACA,kBACA,uCARF,mBACE,mBACA,aACA,yBACA,eACA,cACA,uBACA,kBACA,wCARF,mBACE,mBACA,sCAEA,eACA,gBACA,sBACA,kBACA,wCARF,mBACE,mBACA,sCAEA,gBACA,cACA,uBACA,kBACA,wCARF,mBACE,kBACA,sCAEA,gBACA,eACA,sBACA,kBACA,wCARF,mBACE,mBACA,sCAEA,gBACA,cACA,uBACA,kBACA,wCARF,mBACE,mBACA,aACA,yBACA,eACA,eACA,uBACA,kBACA,wCARF,mBACE,mBACA,aACA,yBACA,cACA,gBACA,uBACA,kBACA,wCARF,mBACE,mBACA,aACA,yBACA,eACA,gBACA,uBACA,kBACA,wCARF,mBACE,mBACA,aACA,yBACA,gBACA,eACA,uBACA,kBACA,wCARF,mBACE,mBACA,aACA,yBACA,cACA,eACA,uBACA,kBACA,wCARF,mBACE,mBACA,cACA,wBACA,eACA,cACA,uBACA,kBACA,wCARF,mBACE,mBACA,sCAEA,eACA,qCAEA,kBACA,wCARF,kBACE,mBACA,qCAEA,gCACA,CACA,sBACA,kBACA,wCARF,mBACE,kBACA,sCAEA,8BACA,uBAEA,0DAPF,mBACE,oBACA,qCAEA,+BACA,uBAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,8BACA,uBAEA,mBACA,uCARF,oBACE,mBACA,sCAEA,8BACA,uBAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,8BACA,uBAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,gCACA,CACA,sBACA,kBACA,wCARF,mBACE,kBACA,sCAEA,8BACA,uBAEA,kBACA,wCARF,oBACE,mBACA,sCAEA,eACA,gBACA,uBACA,kBACA,wCARF,mBACE,mBACA,sCAEA,eACA,qCAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,+BACA,uBAEA,kBACA,wCARF,oBACE,kBACA,sCAEA,6BACA,uBAEA,mBACA,uCARF,mBACE,mBACA,sCAEA,+BACA,uBAEA,0DAPF,mBACE,gCACA,yBAEA,8BACA,uBAEA,0DAPF,mBACE,mBACA,sCAEA,6BACA,uBAEA,0DAPF,oBACE,+BACA,yBAEA,+BACA,uBAEA,0DAPF,mBACE,oBACA,qCAEA,gCACA,uBAEA,mBACA,uCARF,mBACE,mBACA,sCAEA,+BACA,uBAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,8BACA,uBAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,iBACA,gBACA,sBACA,kBACA,wCARF,oBACE,mBACA,sCAEA,eACA,qCAEA,kBACA,wCARF,kBACE,mBACA,sCAEA,+BACA,uBAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,8BACA,uBAEA,kBACA,wCAQJ,mBACA,mBACA,sCAEA,+BACA,uBACA,kBACA,wCACA,mBACA,CACA,sFAEA,uBAEI,kBAGA,wCAGA,mDACA,CAKF,uCACE,cACA,uBACA,kBAEA,wCACA,mBAEA,mBARF,sCACE,CACA,+BACA,uBAEA,0DAGA,kBARF,gCACE,yBACA,CACA,6BACA,uBACA,kBACA,CACA,uCAPF,uCAEE,sCAEA,eACA,sCAEA,kBACA,wCARF,mBAEE,mBACA,sCAEA,+BACA,uBAEA,kBARF,kBAGE,8EAIA,CACA,uCAPA,CAMA,iBACA,CALA,2BACA,cACA,CACA,oBACA,CANA,uBAEA,CADA,SACA,CAFA,mBACA,CAFF,iBACE,CAIA,mBAEA,yBACA,GARF,wCACE,IAIA,UAHA,+DAGA,gCAEA,WACA,qBARF,mBACE,aACA,yBACA,eACA,gBACA,kBACA,8BACA,WACA,oBARF,mBACE,aACA,yBACA,eACA,gBACA,kBACA,+BACA,WACA,mBARF,mBACE,aACA,yBACA,cACA,gBACA,iDAEA,WACA,oBARF,oBACE,YACA,yBACA,eACA,eACA,iDAEA,WACA,oBARF,gCACE,yBAEA,gBACA,aACA,iDAEA,WACA,oBARF,gCACE,yBAEA,+BACA,CACA,gDAEA,WACA,oBARF,gCACE,yBAEA,8BACA,kBACA,+BAEA,WACA,oBARF,gCACE,yBAEA,6BACA,kBACA,+BAEA,WACA,oBARF,gCACE,yBACA,CACA,+BACA,CACA,gDAEA,WACA,oBARF,gCACE,yBAEA,8BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBAEA,+BAEA,kDAEA,WACA,oBARF,gCACE,yBAEA,+BAEA,kDAEA,WACA,oBARF,gCACE,yBAEA,gBACA,eACA,kDAEA,WACA,oBARF,gCACE,CACA,wBACA,eACA,gBACA,kDAEA,WACA,mBARF,oBACE,YACA,yBACA,eACA,cACA,kDAEA,WACA,oBARF,oBACE,YACA,yBACA,eACA,cACA,kDAEA,WACA,oBARF,gCACE,yBAEA,gBACA,cACA,kDAEA,WACA,oBARF,gCACE,yBAEA,8BAEA,kDAEA,WACA,oBARF,+BACE,yBAEA,iBACA,cACA,kDAEA,WACA,oBARF,gCACE,CACA,wBACA,eACA,cACA,kDAEA,WACA,oBARF,gCACE,yBAEA,gBACA,cACA,kDAEA,WACA,mBARF,gCACE,yBAEA,8BAEA,kDAEA,WACA,oBARF,gCACE,yBAEA,6BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBAEA,+BACA,CACA,iDAEA,WACA,oBARF,gCACE,yBAEA,+BAEA,kDAEA,WACA,oBARF,gCACE,yBAEA,6BACA,CACA,iDAEA,WACA,qBARF,+BACE,yBAEA,6BACA,CACA,iDAEA,WACA,oBARF,gCACE,yBAEA,+BACA,CACA,iDAEA,WACA,mBARF,gCACE,yBAEA,+BACA,CACA,iDAEA,WACA,mBARF,gCACE,yBACA,CACA,8BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBAEA,8BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBAEA,8BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBAEA,8BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,cACA,eACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,gBACA,eACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,CACA,6BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBAEA,+BACA,CACA,iDAEA,WACA,oBARF,gCACE,yBACA,CACA,6BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,eACA,eACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,eACA,eACA,kBACA,gCAEA,YACA,mBARF,gCACE,yBACA,gBACA,gBACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,CACA,4BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,eACA,eACA,kBACA,gCAEA,WACA,oBAKN,mBACE,aACA,yBACA,6BACA,kDACA,+BACA,mBAEA,aACA,yBAGA,gBAGF,gBAEI,kBAOJ,gCAEE,+BACA,mBACA,sCACA,+BACA,kBACA,gCAGA,WACA,qBAIF,mBAEI,qDAGA,iCAIJ,gCACE,WACA,qBACA,mBACA,aACA,yBAIF,8BACE,kBAGF,gCACE,+BAEA,mBAGF,sCAIA,6BACE,kBACA,gCAEA,WAGF,uCACE,aAGF,wCACE,iEAEA,+BACA,kBACA,aACA,yBACA,gBACA,iCACA,kBAGA,sBACA,4BAEA,CAJA,mBACA,CAGA,gCAKF,mCACE,mBADF,mBACE,CADF,kBACE,cADF,SACE","sources":["App.scss"],"sourcesContent":[".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-wrapper {\n align-items: center;\n background: linear-gradient(to bottom, #3B4587, #151516) border-box;\n display: flex;\n flex-direction: column;\n font-family: 'Barlow', sans-serif;\n min-height: 300px;\n min-width: 400px;\n height: 100vh;\n overflow: hidden;\n position: relative;\n justify-content: center;\n width: 100vw;\n}\n\n.App-wrapper.mainmenu {\n height: 100vh;\n width: 100vw;\n}\n\n.App-header {\n background-color: #282c34;\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n font-family: 'Barlow', sans-serif;\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\n.Waiting-text-wrapper {\n display: flex;\n}\n\n.Begin-game-button-wrapper.waiting-text {\n color: #b8b8b8;\n font-size: 0.8em;\n justify-content: center;\n}\n\n.Waiting-spinner {\n animation-name: spin;\n animation-duration: 2000ms;\n animation-iteration-count: infinite;\n animation-timing-function: linear;\n background-image: url(\"assets/loading-spinner.svg\");\n background-position: center;\n background-repeat: no-repeat;\n height: 40%;\n margin-top: 1%;\n width: 8%;\n}\n\n@keyframes spin {\n from {\n transform:rotate(0deg);\n }\n to {\n transform:rotate(360deg);\n }\n}\n\n.Begin-game-button, .Roll-button, .Offer-double-button, .Forfeit-game-button, .Accept-double-button {\n background: linear-gradient(to right, #3F3217, #564112);\n border-color: #816c3d;\n border-radius: min(1vw, 1em);\n border-style: double;\n border-width: 0.2em;\n color: #b8b8b8;\n font-weight: bold;\n font-family: 'Barlow', sans-serif;\n font-size: max(1.4vh, 1.4vw);\n padding: 0.5vh;\n text-align: center;\n transition: 0.2s;\n width: 11vw;\n}\n\n.Begin-game-button:hover, .Settings-menu-button:hover, .Roll-button:hover, .Offer-double-button:hover, .Forfeit-game-button:hover, .Accept-double-button:hover {\n transform: scale(110%);\n}\n\n.Game-board-wrapper {\n align-items: center;\n color: white;\n display: flex;\n height: 30vw;\n justify-content: center;\n min-height: 150px;\n min-width: 300px;\n width: 60vw;\n}\n\n.Networked-gameboard-spinner {\n animation-name: spin;\n animation-duration: 2000ms;\n animation-iteration-count: infinite;\n animation-timing-function: linear;\n background-image: url(\"assets/online-multiplayer-button-spinner.svg\");\n background-position: center;\n background-repeat: no-repeat;\n height: 20%;\n width: 20%;\n}\n\n.Main-menu-wrapper {\n align-items: center;\n color: white;\n display: flex;\n flex-direction: column;\n height: 60%;\n min-height: 300px;\n min-width: 400px;\n width: 60%;\n}\n\n.Title-wrapper {\n background-image: url(\"assets/backgammon-title.svg\");\n background-position: center;\n background-repeat: no-repeat;\n container: title-container / inline-size;\n filter: drop-shadow(0 1vh 0.3vh rgba(0, 0, 0, 0.35));\n text-align: center;\n vertical-align: middle;\n height: 25%;\n width: 80%;\n}\n\n.Title-text {\n font-size: 3.5em;\n}\n\n@container title-container (min-width: 400px) {\n .Title-text {\n font-size: max(3.5em, 3.5em + 4cqi);\n }\n}\n\n.Menu-button-wrapper {\n container: menu-button-wrapper / inline-size;\n display: flex;\n flex-direction: column;\n height: 50%;\n justify-content: space-around;\n width: 60%;\n}\n\n.Local-multiplayer-button, .Online-multiplayer-button {\n background-position: center;\n background-repeat: no-repeat;\n cursor: pointer;\n display: flex;\n filter: drop-shadow(0 1vh 0.3vh rgba(0, 0, 0, 0.35));\n font-family: 'Barlow', sans-serif;\n font-size: max(2vh, 2vw);\n height: 40%;\n transition: 0.2s;\n width: 100%;\n}\n\n@media screen and (orientation: portrait) {\n .Title-wrapper {\n height: 16%;\n }\n\n .Menu-button-wrapper {\n height: 30%;\n }\n}\n\n.Local-multiplayer-button {\n background-image: url(\"assets/local-multiplayer-button.svg\");\n}\n\n.Online-multiplayer-button {\n background-image: url(\"assets/online-multiplayer-button.svg\");\n}\n\n.Local-multiplayer-button:hover,\n.Local-multiplayer-button:active,\n.Online-multiplayer-button:hover,\n.Online-multiplayer-button:active {\n transform: scale(105%);\n}\n\n.Online-multiplayer-button-spinner {\n animation-name: spin;\n animation-duration: 2000ms;\n animation-iteration-count: infinite;\n animation-timing-function: linear;\n background-image: url(\"assets/online-multiplayer-button-spinner.svg\");\n background-position: center;\n background-repeat: no-repeat;\n height: 40%;\n width: 100%;\n}\n\n.Credits-text {\n color: #6B7195;\n font-size: 0.6em;\n text-align: right;\n position: absolute;\n right: 1%;\n bottom: 1%;\n}\n\n.Match-settings-menu-wrapper {\n display: flex;\n flex-direction: column;\n height: 60%;\n min-height: 300px;\n min-width: 400px;\n width: 45%;\n}\n\n.Match-settings-title-wrapper {\n background-image: url(\"assets/match-settings-title.svg\");\n background-position: center;\n background-repeat: no-repeat;\n filter: drop-shadow(0 0.5vh 0.3vh rgba(0, 0, 0, 0.35));\n vertical-align: middle;\n height: 20%;\n width: 35%;\n}\n\n.Match-points-settings-row, .Doubling-cube-settings-row, .Url-copy-row {\n align-items: center;\n display: flex;\n height: 15%;\n margin-top: 4%;\n width: 100%;\n}\n\n.Play-to-wrapper {\n background-image: url(\"assets/play-to.svg\");\n background-position-y: center;\n background-repeat: no-repeat;\n filter: drop-shadow(0 0.5vh 0.3vh rgba(0, 0, 0, 0.35));\n vertical-align: middle;\n height: 60%;\n width: 14%;\n}\n\n.Doubling-cube-text-wrapper {\n background-image: url(\"assets/allow-doubling.svg\");\n background-position-y: center;\n background-repeat: no-repeat;\n filter: drop-shadow(0 0.5vh 0.3vh rgba(0, 0, 0, 0.35));\n vertical-align: middle;\n height: 60%;\n width: 24%;\n}\n\n.Url-title-wrapper {\n background-image: url(\"assets/url-title.svg\");\n background-position-y: center;\n background-repeat: no-repeat;\n filter: drop-shadow(0 0.5vh 0.3vh rgba(0, 0, 0, 0.35));\n vertical-align: middle;\n height: 40%;\n width: 14%;\n}\n\n.Url-form-wrapper {\n align-items: flex-start;\n container: url-form-container / inline-size;\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 80%;\n}\n\n.Url-form .form-control {\n color: #dcd4d4;\n background-color: #474747;\n font-size: 1em;\n}\n\n.Url-form-text {\n background-color: #332E2E;\n border-radius: 1vw;\n border: solid #dcd4d4;\n color: #dcd4d4;\n font-size: 0.9em;\n padding: 1vh 1vw 1vh 1vw;\n}\n\n.Url-form-subtext {\n color: #dcd4d4;\n margin-left: 1vw;\n font-size: 0.7em;\n}\n\n@container url-form-container (min-width: 600px) {\n .Url-form-text {\n font-size: 1.5em;\n }\n\n .Url-form-subtext {\n font-size: 1em;\n }\n}\n\n.Url-form-text-and-copy {\n align-items: center;\n display: flex;\n width: 100%\n}\n\n.Url-form-copy {\n background-image: url(\"assets/copy-icon.svg\");\n background-position-y: center;\n background-repeat: no-repeat;\n cursor: pointer;\n margin-left: 2%;\n height: 80%;\n transition: 0.2s;\n width: 8%;\n}\n\n.Url-form-copy.highlight {\n background-image: url(\"assets/copy-icon-clicked.svg\");\n}\n\n.Url-form-copy:hover, .Url-form-copy:active {\n transform: scale(105%);\n}\n\n.Start-game-button-row {\n align-items: center;\n display: flex;\n height: 15%;\n justify-content: center;\n margin-top: 8%;\n width: 100%;\n}\n\n.Start-game-button {\n background: linear-gradient(to right, #3F3217, #564112);\n border-color: #816c3d;\n border-radius: min(1vw, 1em);\n border-style: double;\n border-width: 0.2em;\n color: #b8b8b8;\n font-weight: bold;\n font-family: 'Barlow', sans-serif;\n font-size: max(1.5vh, 1.5vw);\n padding: 0.5vh;\n text-align: center;\n transition: 0.2s;\n width: 10vw;\n}\n\n.Start-game-button:hover {\n transform: scale(105%);\n}\n\n.Doubling-cube-toggle-form {\n align-items: center;\n display: flex;\n height: 100%;\n margin-left: 4%;\n width: 70%;\n}\n\n.Doubling-cube-toggle-off, .Doubling-cube-toggle-on {\n background-position: center;\n background-repeat: no-repeat;\n height: 30%;\n width: 15%;\n}\n\n.Doubling-cube-toggle-off {\n background-image: url(\"assets/off-disabled.svg\");\n}\n\n.Doubling-cube-toggle-on {\n background-image: url(\"assets/on-disabled.svg\");\n}\n\n.Doubling-cube-toggle-off.enabled {\n background-image: url(\"assets/off-enabled.svg\");\n}\n\n.Doubling-cube-toggle-on.enabled {\n background-image: url(\"assets/on-enabled.svg\");\n}\n\n.Doubling-cube-toggle.form-switch {\n margin-left: 4%;\n margin-right: 4%;\n}\n\n.Doubling-cube-toggle .form-check-input {\n height: 4vh;\n width: 6vw;\n}\n\n.Doubling-cube-toggle .form-check-input:checked {\n background-color: #4488ec;\n}\n\n.Match-points-buttons-wrapper {\n display: flex;\n height: 100%;\n width: 86%;\n}\n\n.Match-points-button {\n align-content: center;\n background-color: #CDB288;\n background-position: center;\n background-repeat: no-repeat;\n background-size: 15%;\n border-radius: 10%;\n font-size: max(1.3em, 2vw);\n font-weight: bold;\n height: max(5vw, 5vh);\n cursor: pointer;\n margin-left: 2%;\n opacity: 40%;\n text-align: center;\n transition: 0.2s;\n width: max(5vw, 5vh);\n}\n\n.Match-points-button.selected {\n border: white solid max(3px, 0.3vw);\n opacity: 100%;\n}\n\n.Match-points-button:hover, .Match-points-button:active {\n transform: scale(105%);\n}\n\n.Player-card-wrapper {\n background: #0F142F;\n border: min(5px, 0.4vw) solid #22274a;\n border-radius: min(1vw, 1em) min(1vw, 1em) 0 0;\n border-bottom-style: none;\n color: #b8b8b8;\n display: flex;\n height: 9%;\n position: relative;\n left: 66%;\n width: 28%;\n}\n\n.Player-card-wrapper.current {\n filter: drop-shadow(0 0 1vh #f7dcab);\n}\n\n.Player-card-wrapper.cw {\n left: 6%;\n}\n\n.Player-card-wrapper.bottom {\n background: #251F13;\n border: min(5px, 0.4vw) solid #564112;\n border-radius: 0 0 min(1vw, 1em) min(1vw, 1em);\n border-top-style: none;\n}\n\n.Player-card-checker-wrapper {\n display: flex;\n width: 24%;\n}\n\n.Player-card-checker-wrapper .Checker {\n margin: 20% 20%;\n height: 60%;\n width: 60%;\n}\n\n.Player-name-and-score-wrapper {\n display: flex;\n flex-direction: column;\n width: 52%;\n}\n\n.Player-name-wrapper {\n font-size: 2vh;\n font-weight: bold;\n height: 40%;\n}\n\n.Player-card-doubling-cube-wrapper {\n align-content: center;\n width: 24%;\n}\n\n.Player-card-doubling-cube-wrapper .Doubling-cube {\n height: 65%;\n margin-left: 20%;\n width: 60%;\n}\n\n@media screen and (orientation: landscape) {\n .Player-name-wrapper {\n font-size: 1.2vw;\n font-weight: bold;\n height: 40%;\n margin-top: 4%;\n }\n\n .Player-score-wrapper {\n display: flex;\n font-size: 0.8vw;\n height: 50%;\n margin-top: 4%;\n white-space: nowrap;\n }\n}\n\n@media screen and (orientation: portrait) {\n .Player-name-wrapper {\n font-size: 2vh;\n font-weight: bold;\n height: 40%;\n }\n\n .Player-score-wrapper {\n display: flex;\n font-size: 0.8vw;\n height: 50%;\n }\n}\n\n.Player-card-total-match-points {\n font-weight: bold;\n}\n\n.Player-points-wrapper {\n margin-left: 0.8vw;\n}\n\n.Information-text-wrapper {\n margin-left: 5.5%;\n margin-right: 5.5%;\n width: 89%;\n height: 4vh;\n}\n\n.Information-text {\n color: #b8b8b8;\n}\n\n.Game-area-wrapper {\n filter: drop-shadow(0 0 0.5vh #000000);\n}\n\n.Game-board-half {\n background-image: url(\"assets/board-background.svg\");\n background-size: cover;\n border-color: #212529;\n border-width: 0.8vh;\n display: flex;\n flex-direction: column;\n height: 100%;\n justify-content: space-between;\n position: relative;\n width: 45.5%;\n z-index: 1;\n}\n\n.Game-board-half.left {\n background:\n url(\"assets/board-background.svg\") padding-box,\n linear-gradient(to bottom, #22274A, #564112) border-box;\n border: min(5px, 0.4vw) solid transparent;\n border-right-style: none;\n border-top-left-radius: min(1vw, 1em);\n border-bottom-left-radius: min(1vw, 1em);\n}\n\n.Game-board-half.left.cw {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.Game-board-half.right {\n background:\n url(\"assets/board-background.svg\") padding-box,\n linear-gradient(to bottom, #22274A, #564112) border-box;\n border: min(5px, 0.4vw) solid transparent;\n border-left-style: none;\n}\n\n.Game-board-half.right.cw {\n border-top-right-radius: min(1vw, 1em);\n border-bottom-right-radius: min(1vw, 1em);\n}\n\n.Game-board-quadrant {\n display: flex;\n height: 50%;\n justify-content: space-evenly;\n width: 100%;\n}\n\n.Game-board-quadrant.bottom {\n align-items: flex-end;\n}\n\n.Game-board-bar {\n background:\n url(\"assets/dots.svg\") center/420% padding-box,\n linear-gradient(to bottom, #22274A, #564112) border-box;\n border: min(5px, 0.4vw) solid transparent;\n display: flex;\n flex-direction: column;\n height: 100%;\n justify-content: space-around;\n width: 4%;\n z-index: 1;\n}\n\n.Game-board-home {\n background:\n url(\"assets/dots.svg\") center/300% padding-box,\n linear-gradient(to bottom, #22274A, #564112) border-box;\n border: min(5px, 0.4vw) solid transparent;\n border-left-style: none;\n border-top-right-radius: min(1vw, 1em);\n border-bottom-right-radius: min(1vw, 1em);\n display: flex;\n flex-direction: column;\n height: 100%;\n justify-content: space-around;\n width: 5%;\n}\n\n\n\n.Game-board-home.cw {\n border-left-style: solid;\n border-right-style: none;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: min(1vw, 1em);\n border-bottom-left-radius: min(1vw, 1em);\n}\n\n.Point-wrapper {\n display: flex;\n position: relative;\n height: 87%;\n width: 16.667%;\n}\n\n.Point-wrapper-highlight {\n height: 100%;\n margin-left: 10%;\n position: absolute;\n width: 80%;\n z-index: 1;\n}\n\n.Point-wrapper-highlight.from {\n background-color: #e4cb6454;\n}\n\n.Point-wrapper-highlight.to {\n background: url(\"assets/stripes.svg\");\n background-size: cover;\n}\n\n.Point-wrapper-highlight.noMove {\n animation-duration: 1s;\n animation-name: nomove;\n}\n\n@keyframes nomove {\n from {\n background: url(\"assets/stripes-red.svg\");\n background-size: cover;\n }\n\n to {\n background: url(\"assets/stripes-red-fade.svg\");\n background-size: cover;\n }\n}\n\n.Point-wrapper-highlight.bottom {\n border-top-left-radius: 5vh;\n border-top-right-radius: 5vh;\n}\n\n.Point-wrapper-highlight.top {\n border-bottom-left-radius: 5vh;\n border-bottom-right-radius: 5vh;\n}\n\n.Point-triangle {\n height: 100%;\n margin-left: 10%;\n position: absolute;\n width: 80%;\n z-index: 1;\n}\n\n.Point-triangle-inner {\n height: 96%;\n margin-left: 12%;\n position: absolute;\n width: 76%;\n z-index: 2;\n}\n\n.Point-triangle-inner.bottom {\n margin-top: 12%;\n}\n\n.Point-triangle-inner.even {\n background-color: #0F1744;\n}\n\n.Point-triangle-inner.odd {\n background-color: #885525;\n}\n\n.Point-triangle.top, .Point-triangle-inner.top {\n clip-path: polygon(0% 0%, 50% 100%, 100% 0%);\n}\n\n.Point-triangle.bottom, .Point-triangle-inner.bottom {\n clip-path: polygon(0% 100%, 50% 0%, 100% 100%);\n}\n\n.Point-triangle.even {\n background-color: #636781;\n}\n\n.Point-triangle.odd {\n background-color: #997345;\n}\n\n.Checkers-wrapper {\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n height: 100%;\n width: 100%;\n z-index: 3;\n}\n\n.Checkers-wrapper.top {\n flex-direction: column;\n}\n\n.Checkers-wrapper.bottom {\n flex-direction: column-reverse;\n}\n\n.Point {\n height: 41vh;\n width: 15%;\n}\n\n.Checker {\n filter: drop-shadow(0 0 0.2vh rgb(0, 0, 0, 0.6));\n transition: transform 0.3s ease-out, filter 0.5s ease-in-out;\n will-change: transform, filter;\n height: 15%;\n width: 45%;\n z-index: 4;\n}\n\n.Checker.white {\n background-image: url(\"assets/checker-light.svg\");\n background-repeat: no-repeat;\n}\n\n.Checker.highlighted-pulse, .Checker.selected-pulse {\n filter: drop-shadow(0 0 0.5vh #f7dcab);\n}\n\n.Checker.white.selected-pulse {\n background-image: url(\"assets/checker-light-selected.svg\");\n background-repeat: no-repeat;\n}\n\n.Checker.black.selected-pulse {\n background-image: url(\"assets/checker-dark-selected.svg\");\n background-repeat: no-repeat;\n}\n\n.Checker.highlighted, .Checker.selected {\n filter: drop-shadow(0 0 0.1vh #f7dcab);\n}\n\n.Checker.black {\n background-image: url(\"assets/checker-dark.svg\");\n background-repeat: no-repeat;\n}\n\n.Player-one-bar-checkers, .Player-two-bar-checkers {\n align-items: center;\n display: flex;\n height: 47.5%;\n}\n\n.Player-one-bar-checkers {\n flex-direction: column-reverse;\n}\n\n.Player-two-bar-checkers {\n flex-direction: column;\n}\n\n.Player-one-bar-checkers.highlight {\n background-color: #e4cb6454;\n border-bottom-left-radius: 5vh;\n border-bottom-right-radius: 5vh;\n}\n\n.Player-two-bar-checkers.highlight {\n background-color: #e4cb6454;\n border-top-left-radius: 5vh;\n border-top-right-radius: 5vh;\n}\n\n.Game-board-bar-spacer {\n height: 5%\n}\n\n.Player-one-bar-checkers .Checker, .Player-two-bar-checkers .Checker {\n height: 15%;\n width: 120%;\n}\n\n.Player-one-home-checkers, .Player-two-home-checkers {\n align-items: center;\n display: flex;\n flex-direction: column;\n height: 45.5%;\n}\n\n.Player-one-home-checkers .Checker.white {\n background-image: url(\"assets/checker-home-light.svg\");\n}\n\n.Player-one-home-checkers .Checker.black {\n background-image: url(\"assets/checker-home-dark.svg\");\n}\n\n.Player-two-home-checkers .Checker.white {\n background-image: url(\"assets/checker-home-light.svg\");\n}\n\n.Player-two-home-checkers .Checker.black {\n background-image: url(\"assets/checker-home-dark.svg\");\n}\n\n.Player-one-home-checkers, .Player-two-home-checkers.p2 {\n justify-content: flex-end;\n}\n\n.Player-one-home-checkers.p2 {\n justify-content: flex-start;\n}\n\n.Player-one-home-checkers.highlighted {\n background: url(\"assets/stripes.svg\");\n background-size: cover;\n border-top-left-radius: 1vh;\n border-top-right-radius: 1vh;\n}\n\n.Player-two-home-checkers.highlighted {\n background: url(\"assets/stripes.svg\");\n background-size: cover;\n border-bottom-left-radius: 1vh;\n border-bottom-right-radius: 1vh;\n}\n\n.Game-board-home-spacer {\n height: 9%;\n}\n\n.Player-one-home-checkers .Checker, .Player-two-home-checkers .Checker {\n border-radius: 10% 10% 34% 34%;\n height: 4%;\n margin-bottom: 3%;\n margin-top: 3%;\n padding-top: 0;\n width: 80%;\n}\n\n.Submit-button-wrapper, .Undo-button-wrapper, .Dice-row-spacer {\n height: 4vw;\n width: 4vw;\n}\n\n.Submit-button, .Undo-button {\n background: url(\"assets/checkmark.svg\") center / 60% padding-box, linear-gradient(to right, #3F3217, #564112) border-box;\n border-color: #816c3d;\n border-radius: 1vh;\n background-repeat: no-repeat;\n border-style: double;\n margin-left: 10%;\n margin-top: 10%;\n height: 80%;\n transition: 0.2s;\n width: 80%;\n}\n\n.Undo-button-wrapper .Undo-button {\n background: url(\"assets/undo-arrow.svg\") center / 60% padding-box, linear-gradient(to right, #3F3217, #564112) border-box;\n background-repeat: no-repeat;\n}\n\n.Submit-button:hover, .Undo-button:hover {\n transform: scale(110%);\n}\n\n.mainmenu .Settings-menu-button-wrapper {\n right: 2vw;\n}\n\n.Settings-menu-button-wrapper {\n position: absolute;\n right: 2%;\n top: 2%;\n}\n\n.Settings-menu .modal-content, .Game-over-dialog .modal-content {\n background-color: #abafc2;\n border: 0.5vw solid #636781;\n border-radius: 1vw;\n font-family: 'Barlow', sans-serif;\n}\n\n.Game-over-dialog {\n text-align: center;\n}\n\n.Game-over-dialog .modal-title {\n font-size: 2em;\n}\n\n.Settings-menu .modal-header, .Game-over-dialog .modal-header {\n border-bottom: 1px solid rgb(78, 96, 124);\n}\n\n.Game-over-dialog .modal-header {\n display: block;\n}\n\n.Game-over-dialog-winner-wrapper {\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n padding: 4%;\n}\n\n.Game-over-dialog-winner-checker-wrapper {\n display: flex;\n height: 3.5em;\n width: 12.6%;\n}\n\n.Game-over-dialog-winner-checker-wrapper.left {\n justify-content: flex-end;\n}\n\n.Game-over-dialog-winner-text {\n font-size: 1.2em;\n font-weight: bold;\n width: 70%;\n}\n\n.Game-over-dialog-gammon-text {\n font-size: 0.8em;\n font-weight: normal;\n}\n\n.Game-over-dialog-winner-checker-wrapper .Checker {\n height: 100%;\n width: 100%;\n}\n\n.Game-over-dialog .modal-footer {\n justify-content: center;\n}\n\n.Settings-menu .modal-footer, .Game-over-dialog .modal-footer {\n border-top: 1px solid rgb(78, 96, 124);\n}\n\n.Settings-menu .modal-body, .Game-over-dialog .modal-body {\n padding: 0;\n}\n\n.Settings-menu .modal-footer .btn, .Game-over-dialog .modal-footer .btn {\n background-color: #354e74;\n border-color: rgb(24 38 61);\n border-width: 0.2vh;\n}\n\n.Settings-menu .Settings-option-row {\n border-bottom: 1px solid rgb(78, 96, 124);\n display: flex;\n justify-content: space-between;\n}\n\n.Settings-menu .Settings-option-row.bottom {\n border-bottom: none;\n}\n\n.Settings-menu-player-names-and-checkers {\n cursor: pointer;\n display: flex;\n justify-content: space-around;\n padding-right: 5%;\n width: 50%;\n}\n\n.Settings-menu-player-name-and-checker {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 40%;\n}\n\n.Settings-menu-player-name {\n text-align: center;\n}\n\n.Settings-menu-checkers-wrapper {\n display: flex;\n justify-content: space-around;\n height: 66%;\n width: 100%;\n}\n\n.Settings-menu-checker-wrapper {\n align-items: center;\n display: flex;\n height: 50%;\n width: 31%;\n justify-content: center;\n}\n\n.Settings-menu-checker-wrapper .Checker {\n height: 100%;\n width: 100%;\n}\n\n.Settings-menu-color-swap-arrow-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n transition: 0.2s;\n width: 20%;\n}\n\n.Settings-menu-player-names-and-checkers:hover .Settings-menu-color-swap-arrow-wrapper {\n transform: scale(110%);\n}\n\n.Settings-menu-color-swap {\n font-size: 0.6em;\n font-weight: bold;\n text-align: center;\n}\n\n.Settings-menu-color-swap-arrow {\n background: url(\"assets/swap-arrow.svg\");\n background-repeat: no-repeat;\n height: 20%;\n width: 50%;\n}\n\n.Settings-option-movement-diagram-wrapper {\n cursor: pointer;\n display: flex;\n justify-content: center;\n padding: 2%;\n width: 50%;\n}\n\n.Settings-option-movement-diagram {\n background-size: contain;\n background-repeat: no-repeat;\n height: 100%;\n transition: 0.2s;\n width: 50%;\n}\n\n.Settings-option-movement-diagram:hover {\n transform: scale(105%);\n}\n\n.Settings-option-movement-diagram.light {\n background-image: url(\"assets/diagram-light-ccw.svg\");\n}\n\n.Settings-option-movement-diagram.light.cw {\n background-image: url(\"assets/diagram-light-cw.svg\");\n}\n\n.Settings-option-movement-diagram.dark {\n background-image: url(\"assets/diagram-dark-ccw.svg\");\n}\n\n.Settings-option-movement-diagram.dark.cw {\n background-image: url(\"assets/diagram-dark-cw.svg\");\n}\n\n.Settings-checker-color-label, .Settings-checker-direction-label {\n padding: 4vh;\n}\n\n.Settings-option-arrow.clockwise {\n background: url(\"assets/clockwise-arrow.svg\") no-repeat top left;\n}\n\n.Settings-option-arrow.counterclockwise {\n background: url(\"assets/counterclockwise-arrow.svg\") no-repeat top left;\n}\n\n.Settings-menu-button {\n background: url(\"assets/settings-icon.svg\") no-repeat top left;\n background-size: contain;\n}\n\n@media screen and (orientation: landscape) {\n .Settings-menu-button {\n height: 3vw;\n width: 3vw;\n }\n}\n\n@media screen and (orientation: portrait) {\n .Settings-menu-button {\n height: 3vh;\n width: 3vh;\n }\n}\n\n/********\n * DICE *\n ********/\n .Dice,\n .Begin-game-button-wrapper,\n .Roll-button-wrapper,\n .Offer-double-button-wrapper,\n .Accept-double-menu-wrapper {\n align-items: center;\n display: flex;\n height: 10%;\n left: 10%;\n justify-content: space-evenly;\n position: absolute;\n top: 45%;\n width: 80%;\n z-index: 5;\n}\n\n.Die-faces {\n align-items: center;\n display: flex;\n height: 114%;\n justify-content: center;\n transform-style: preserve-3d;\n transition: transform 1.3s ease-out;\n width: 15.5%;\n}\n\n.Die-face {\n border-radius: 0.5vw;\n color: white;\n display: grid;\n gap: 0.4vw;\n grid-template-columns: repeat(3, 1fr);\n grid-template-rows: repeat(3, 1fr);\n height: 100%;\n padding: 0.2vw;\n position: absolute;\n width: 100%;\n}\n\n.Die-faces.white .Die-face {\n background-color: rgb(255 243 219);\n border: 0.2vw solid #b49e70;\n}\n\n.Die-faces.black .Die-face {\n background-color: rgb(15 16 37);\n border: 0.2vw solid #767293;\n}\n\n.Die-faces.white.spent .Die-face, .Die-faces.black.spent .Die-face {\n display: none;\n}\n\n.Die-faces.white.spent.one .Die-face.one,\n.Die-faces.white.spent.two .Die-face.two,\n.Die-faces.white.spent.three .Die-face.three,\n.Die-faces.white.spent.four .Die-face.four,\n.Die-faces.white.spent.five .Die-face.five,\n.Die-faces.white.spent.six .Die-face.six {\n background-color: rgb(255 243 219 / 30%);\n border-color: #b49e707a;\n display: grid;\n}\n\n.Die-faces.black.spent.one .Die-face.one,\n.Die-faces.black.spent.two .Die-face.two,\n.Die-faces.black.spent.three .Die-face.three,\n.Die-faces.black.spent.four .Die-face.four,\n.Die-faces.black.spent.five .Die-face.five,\n.Die-faces.black.spent.six .Die-face.six {\n background-color: rgb(15 16 37 / 15%);\n border-color: #76729363;\n display: grid;\n}\n\n.Die-pip {\n border-radius: 50%;\n height: 95%;\n width: 95%;\n}\n\n.Die-faces.white .Die-pip {\n background-color: #1b1c22;\n}\n\n.Die-faces.black .Die-pip {\n background-color: #ede2ce;\n}\n\n.Die-faces.black.spent .Die-pip {\n background-color: #ffffff70;\n}\n\n.Die-faces.white.spent .Die-pip {\n background-color: #00000070;\n}\n\n.Die-faces.one, .Die-faces.one.black.reroll {\n transform: rotateX(360deg) rotateY(720deg) rotateZ(360deg);\n}\n.Die-faces.two, .Die-faces.two.black.reroll {\n transform: rotateX(450deg) rotateY(720deg) rotateZ(360deg);\n}\n.Die-faces.three, .Die-faces.three.black.reroll {\n transform: rotateX(360deg) rotateY(630deg) rotateZ(360deg);\n}\n.Die-faces.four, .Die-faces.four.black.reroll {\n transform: rotateX(360deg) rotateY(810deg) rotateZ(360deg);\n}\n.Die-faces.five, .Die-faces.five.black.reroll {\n transform: rotateX(270deg) rotateY(720deg) rotateZ(360deg);\n}\n.Die-faces.six, .Die-faces.six.black.reroll {\n transform: rotateX(360deg) rotateY(900deg) rotateZ(360deg);\n}\n\n.Die-faces.one.black, .Die-faces.one.reroll {\n transform: rotateX(-360deg) rotateY(-720deg) rotateZ(-360deg);\n}\n.Die-faces.two.black, .Die-faces.two.reroll {\n transform: rotateX(-270deg) rotateY(-720deg) rotateZ(-360deg);\n}\n.Die-faces.three.black, .Die-faces.three.reroll {\n transform: rotateX(-360deg) rotateY(-810deg) rotateZ(-360deg);\n}\n.Die-faces.four.black, .Die-faces.four.reroll {\n transform: rotateX(-360deg) rotateY(-630deg) rotateZ(-360deg);\n}\n.Die-faces.five.black, .Die-faces.five.reroll {\n transform: rotateX(-450deg) rotateY(-720deg) rotateZ(-360deg);\n}\n.Die-faces.six.black, .Die-faces.six.reroll {\n transform: rotateX(-360deg) rotateY(-900deg) rotateZ(-360deg);\n}\n\n.Die-face.one {\n transform: rotate3d(0, 0, 0, 90deg) translateZ(1.6vw);\n}\n.Die-face.two {\n transform: rotate3d(-1, 0, 0, 90deg) translateZ(1.6vw);\n}\n.Die-face.three {\n transform: rotate3d(0, 1, 0, 90deg) translateZ(1.6vw);\n}\n.Die-face.four {\n transform: rotate3d(0, -1, 0, 90deg) translateZ(1.6vw);\n}\n.Die-face.five {\n transform: rotate3d(1, 0, 0, 90deg) translateZ(1.6vw);\n}\n.Die-face.six {\n transform: rotate3d(1, 0, 0, 180deg) translateZ(1.6vw);\n}\n\n.Die-pip.one {\n grid-area: 1/1;\n}\n.Die-pip.three {\n grid-area: 1/3;\n}\n.Die-pip.four {\n grid-area: 2/1;\n}\n.Die-pip.five {\n grid-area: 2/2;\n}\n.Die-pip.six {\n grid-area: 2/3;\n}\n.Die-pip.seven {\n grid-area: 3/1;\n}\n.Die-pip.nine {\n grid-area: 3/3;\n}\n\n.Doubling-cube {\n align-content: center;\n background-image: url(\"assets/doubling-cube.svg\");\n background-repeat: no-repeat;\n filter: drop-shadow(1px 1px 1px rgb(58, 7, 7));\n height: 85%;\n margin-left: 7.5%;\n width: 85%;\n}\n\n.Doubling-cube-value-wrapper {\n align-content: center;\n color: #FABBBB;\n font-size: min(1.3vw, 1.3em);\n height: 100%;\n text-align: center;\n text-shadow: 1px 1px 1px rgb(58, 7, 7);\n width: 100%;\n}\n\n.Accept-double-menu-wrapper {\n display: flex;\n height: 14%;\n top: 43%;\n flex-direction: column;\n}\n\n.Accept-double-menu-text-wrapper {\n color: #b8b8b8;\n font-size: max(0.5em, 1.2vw);\n}\n\n.Accept-double-menu-buttons-wrapper {\n align-items: center;\n display: flex;\n justify-content: space-evenly;\n height: 50%;\n width: 100%;\n}\n\n.Accept-double-button, .Forfeit-game-button {\n font-size: min(1em, 1vw);\n height: 100%;\n padding: 0;\n width: 34%;\n}\n\n.Accept-double-button {\n color: #62955D;\n}\n\n.Forfeit-game-button {\n color: #C14534;\n}\n\n.Waiting-for-accept-double-wrapper {\n align-items: center;\n color: #b8b8b8;\n display: flex;\n font-size: 0.7em;\n height: 12%;\n left: 10%;\n justify-content: center;\n position: absolute;\n top: 44%;\n width: 80%;\n z-index: 5;\n}\n\n/*****************************\n Floating circles background\n*****************************/\n@function random_range($min, $max) {\n $rand: random();\n $random_range: $min + floor($rand * (($max - $min) + 1));\n @return $random_range;\n}\n\n@function sample($list) {\n @return nth($list, random(length($list)));\n}\n\n$floating-circle-count: 50;\n\n// Initial floating circles start on screen with a randomized non-zero opacity,\n// then animate once and finish with 0 opacity. By that time, the regular\n// floating circles will have begun to animate indefinitely. This way, floating\n// circles are visible immediately on page load.\n.Initial-floating-circle {\n position: absolute;\n left: var(--left-offset);\n bottom: var(--bottom-offset);\n display: block;\n width: var(--radius);\n height: var(--radius);\n border-radius: 50%;\n background-color: #83919e24;\n pointer-events: none;\n opacity: 0%;\n animation: float-around-initial var(--animation-duration) 0s ease-in;\n\n @keyframes float-around-initial {\n 0% {\n opacity: var(--starting-opacity);\n }\n 50% {\n opacity: var(--max-opacity);\n }\n 100% {\n transform: translateX(var(--float-x)) translateY(var(--float-y));\n opacity: 0%;\n }\n }\n\n @for $i from 0 through $floating-circle-count {\n &:nth-child(#{$i}) {\n --bottom-offset: #{random_range(-10%, 110%)};\n --left-offset: #{random_range(0vw, 100vw)};\n --radius: #{random_range(3vw, 6vw)};\n --animation-duration: #{random_range(10s, 30s)};\n --float-y: #{random_range(-30vh, 30vh)};\n --float-x: #{random_range(-30vw, 30vw)};\n --starting-opacity: #{random_range(10%, 50%)};\n --max-opacity: #{random_range(40%, 80%)};\n }\n }\n}\n\n// These floating circles begin to appear and animate indefinitely as the initial\n// floating circles finish their one-time animation.\n.Floating-circle {\n position: absolute;\n left: var(--left-offset);\n bottom: var(--bottom-offset);\n display: block;\n width: var(--radius);\n height: var(--radius);\n border-radius: 50%;\n background-color: #83919e24;\n pointer-events: none;\n opacity: 0%;\n animation: float-around var(--animation-duration) var(--delay) ease-in infinite;\n\n @keyframes float-around {\n 0% {\n opacity: 0%;\n }\n 50% {\n opacity: var(--max-opacity);\n }\n 100% {\n transform: translateX(var(--float-x)) translateY(var(--float-y));\n opacity: 0%;\n }\n }\n\n @for $i from 0 through $floating-circle-count {\n &:nth-child(#{$i}) {\n --delay: #{random_range(10s, 30s)};\n --bottom-offset: #{random_range(-10%, 110%)};\n --left-offset: #{random_range(0vw, 100vw)};\n --radius: #{random_range(3vw, 6vw)};\n --animation-duration: #{random_range(10s, 30s)};\n --float-y: #{random_range(-30vh, 30vh)};\n --float-x: #{random_range(-30vw, 30vw)};\n --max-opacity: #{random_range(30%, 70%)};\n }\n }\n}\n\n.Wipe-transition {\n animation-name: wipe;\n animation-duration: 300ms;\n animation-iteration-count: 1;\n animation-timing-function: linear;\n background-color: #000000a7;\n position: absolute;\n z-index: 9;\n pointer-events: none;\n left: 0;\n top: 0;\n width: 0%;\n height: 100%;\n}\n\n@keyframes wipe {\n from {\n width: 100%;\n }\n to {\n width: 0%;\n }\n}\n\n.Wipe-fade {\n animation-name: fade;\n animation-duration: 300ms;\n animation-iteration-count: 1;\n animation-timing-function: linear;\n background-color: #ffffff00;\n position: absolute;\n z-index: 8;\n pointer-events: none;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n}\n\n@keyframes fade {\n from {\n background-color: #ffffff56;\n }\n to {\n background-color: #ffffff00;\n }\n}\n\n.Room-connection-error-wrapper {\n align-items: center;\n color: #b8b8b8;\n display: flex;\n flex-direction: column;\n text-align: center;\n width: 50%;\n}\n\n.Room-connection-error-header {\n font-size: max(2em, 2vw);\n}\n\n.Room-connection-error-text {\n font-size: max(1em, 1vw);\n margin-top: 2%;\n width: 100%;\n}\n\n.Room-connection-error-roomcode {\n font-weight: bold;\n}\n\n.Room-connection-error-subtext {\n font-size: max(1em, 1vw);\n line-height: 1em;\n margin-top: 2%;\n width: 70%;\n}\n\n.Room-connection-error-menu-button-wrapper {\n margin-top: 5%;\n}\n\n.Room-connection-error-menu-button {\n background: linear-gradient(to right, #3F3217, #564112);\n border-color: #816c3d;\n border-radius: min(1vw, 1em);\n border-style: double;\n border-width: 0.2em;\n color: #b8b8b8;\n font-weight: bold;\n font-family: 'Barlow', sans-serif;\n font-size: max(1em, 1vw);\n height: 5vh;\n min-height: 35px;\n min-width: 125px;\n max-width: 175px;\n padding: 0.5vh;\n text-align: center;\n transition: 0.2s;\n width: 12vw;\n}\n\n.Room-connection-error-menu-button:hover, .Room-connection-error-menu-button:active {\n transform: scale(105%);\n}"],"names":[],"sourceRoot":""}
\ No newline at end of file
diff --git a/static/css/main.d409741d.css.map b/static/css/main.d409741d.css.map
deleted file mode 100644
index a1f7535..0000000
--- a/static/css/main.d409741d.css.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"static/css/main.d409741d.css","mappings":"AAAA,KACE,kBAGF,UACE,cACA,oBAGF,6CACE,UACE,6CAIJ,aACE,mBACA,8DACA,aACA,sBACA,8BAMA,uBALA,iBACA,gBAEA,gBACA,iBAEA,CAGF,mCAPE,aAIA,WAKA,CAGF,YAME,mBALA,yBAQA,WANA,aACA,sBACA,8BAGA,6BADA,uBALA,gBAOA,CAGF,UACE,cAGF,yBACE,GACE,uBAEF,GACE,yBAIJ,sBACE,aAGF,wCACE,cACA,eACA,uBAGF,iBAEE,sBACA,mCAFA,oBAGA,iCACA,uFAEA,wBACA,4BAEA,WAGF,cAEM,0BAGA,yBAIN,6HACE,iDAEA,CAGA,0BACA,CAHA,0BACA,CAGA,2CAEA,2BACA,CAHA,gBAIA,8BAIF,qLAIA,qBACE,qBAEA,kBACA,WACA,yBACA,uBACA,iBAIF,2BACE,8BAEA,wDACA,CAFA,mBACA,CACA,gCACA,0GAOF,wBACE,4BAEA,WACA,8BAEA,kBACA,WACA,aAGF,sBACE,sDACA,gBAKA,qCAEA,CAPA,wFAGA,oDAEA,CAEA,8CAOF,CAEI,WAFJ,uCAEI,uBAIJ,8DAEE,YACA,iCAEA,gEAIF,mCACE,wCACA,UACA,sDAEA,uBACA,6BACA,2BACA,+CAKF,8BACE,uBAIA,0BACE,CAIJ,oDACE,+CAGF,UACE,4HAGF,6HAQE,qIAIA,yDAEA,qBAEA,mCAIA,CAPA,mBACA,CAMA,gCAEA,0GASA,wBAEA,4BAIF,qCAGE,UAFA,6BACA,2BADA,gBAEA,8BACA,6CACA,iCAEA,UAGF,2HAIE,CACA,uBAGF,4BACE,gDACA,CACA,WADA,qBACA,CACA,+EAEA,kBAIF,sCACE,4GAGA,yDACA,CAMA,uDANA,+CAKF,CACE,gCAaA,CAbA,4BACA,sFAEA,6BACA,4BAKF,CAGE,SACA,oBACA,iFAMA,CACA,4BAGF,CACE,2BACA,gDAGA,CACA,WADA,qBACA,UAGF,mBAGE,wCAGF,CALE,sBAEA,CAGF,kCACE,YACE,UAGF,yBAKF,wBACE,CALE,aAIJ,CACE,aACA,gBACA,wBAIA,qDACA,+BACA,mBACA,aACA,CACA,cACA,CAFA,eAEA,kDAKA,8DAGF,4CACE,aAGF,2BACE,iFAKA,6BAIA,4CACA,WADA,cACA,CACA,iDAEA,yFAIA,4CAEA,qBAEA,wBAGF,kBACE,cAGF,iCACE,cACA,YACA,mBACA,iDAIF,CAEE,0BAEA,CAHA,0BACA,CAEA,aAGF,CACE,wDAGF,CAJA,eACE,CAGF,8BACE,oDAGF,iDACE,2CAGF,6EACE,uBAGF,4BACE,WACA,qCAGF,oFAKA,CACE,yBAGF,mFAMA,mCAEE,mFAGA,kCAEA,kFAKA,mCAEA,cACA,gBAGF,yCACE,oBACA,iDAGF,wBACE,+BAGF,YACE,sBACA,0CACA,iDACA,4BAEA,CACA,mBACA,kBAEA,CAIA,cAGF,CAPE,wBAGF,gBACE,qBAGF,0BACE,kBAGF,eACE,mBACA,8DACA,qEAKA,qBAIF,wCACE,CAOA,4BACA,CAHF,2CAEE,8BACA,cAGF,aACE,WACA,QACA,CAFA,iBACA,CACA,SAGF,8BACE,mCAIF,6DAEE,kBACA,CAKE,kCAEA,CAJJ,2CAEI,sBAEA,8BAIF,sBACE,uCAIA,WADA,UACA,UAIJ,4CACE,sBACE,UACA,sBAIF,6BACE,WACA,oCAKJ,oBACE,6DAOF,0BACE,UACA,2CAKF,qBACE,eAGF,gBACE,gDAIA,uEACA,2CAEA,qBAEA,6BAEA,kCACA,2BAEA,WAGF,kCACE,kFAGA,WAHA,kCAGA,6BACA,cACA,uDACA,0GAQF,sBACE,oHAGA,wCACA,uBAGF,iJAQE,CAIF,gCACE,CAIA,uCALF,uBACE,oCAIA,sGAGA,iJAUA,mFAGA,uCACA,CAJA,oCAIA,sBACA,oDACA,wCAEA,oBACA,iBACA,8IAUA,CAOA,SACA,2CARA,gCACA,CACA,8CAGF,6BA+BI,CA5BF,iBAIF,8IASE,CAKA,uCAGF,CALA,sBACE,qCACA,CAUE,6BAUJ,sCACE,CANE,4BACA,CANA,uBACA,wBAIA,CACA,mCAIJ,CALI,yBAMF,gBACA,aAGF,WAHE,iBAGF,cACE,0BACA,2BAGF,kBACE,UACA,yCAEA,sCAMA,6BACA,yEASF,sBACE,iCAGF,qBACE,sBAGF,mGACE,4GAIA,8GAIA,8BAGF,6BACE,+BAIA,iBACA,WACA,gBACA,kBACA,CACA,UAGF,gCACE,0BAGF,kBACE,kDAKA,cAIA,oDACA,mDACA,+CAEA,8CAKA,uCACA,qDAGF,iDACE,0CAIA,8CACA,6CAGF,mBACE,0DACA,qBAGF,4CACE,uDAIA,kFAIF,CAMA,WANA,wDACE,CAKF,UALE,4BAKF,UACE,qGAOF,4BACE,oDACA,oCAIF,+BACE,8FAEA,4BAGF,+BAIA,6FAKA,oEAGE,oCAIF,oGAIA,+EACE,kBAGF,oDACE,uDAGF,yDACE,sCAGF,6DACE,CAGF,mCACE,sCAGF,2BACE,oDACA,SACA,qEAIF,0EACE,kBACA,aACA,sBACA,uDAIA,0FAIA,0CAEA,yFAMF,0CAKA,0FACE,mIAIA,wDAGA,wBAEA,8BAGF,0BACE,uCACA,0BAGF,4BACE,6EALA,0EACA,qBAkBA,CAdA,sCAaF,4DACE,yBACA,gFAKF,6BAIA,yCACE,cAGF,wEACE,UAGF,uCACE,iJAWF,CAGE,2BAGF,CANA,oBAEE,kBACA,CAGF,oBAIA,WAJA,eACE,eAGF,eACE,6CAKF,kJAUA,4BACE,yCAGF,8DAIA,yDACE,SAGF,uEACE,wBACA,0BACA,kBAGF,8BACE,oCACA,gCACA,aAGF,8DAIA,+BACE,iCAEA,+CAKF,mBAHE,YAGF,CACE,sBACA,YAFF,UAEE,0CAEA,YAIF,wEAIA,wBAEE,+BACA,eAIF,yDAEE,cACA,CACA,eACA,mDAGF,WACE,WACA,iCAGF,sBACE,8DAGA,4BAEA,0DAGF,iFAKE,wBACA,qBACA,kBAGF,qCACE,gCACA,0CAEA,4CAGF,kBACE,0CAGA,cACA,aAGF,6BACE,2BACA,wCAMF,mBAJE,YACA,sBAGF,uBACE,UAGF,6CACE,8CAGF,kDACE,mDAGF,8CACE,CADF,SACE,yCAGF,+DACE,kBAGF,CAHE,aAGF,sBAHE,uBAGF,wBACE,wFAIA,gDAGF,8BACE,+HAIA,4BACA,sBAGF,wDACE,aACE,uBAKJ,wDAGI,2BAOH,CATC,uBAEE,CAOH,kGAKC,yCAIA,yFAQA,4CAGA,wFAGA,wCAKA,wFAIA,2CAEA,uFAOA,iEAIA,YACA,iCAGF,+FAIA,mQAOE,mEAIF,gPAME,gCACA,uCACA,CADA,SACA,iBAIA,kBACA,UACA,YAGF,+BACE,mCAGF,4BACE,mCAGF,YACE,WAGF,cAHE,6BAGF,sBACE,oCAGF,6CACE,sEAEF,kDACE,oDAEF,6FAGA,2QAOE,0BAGF,mCACE,4QAMA,0BAEF,oCACE,wCAEF,gDACE,mDAEF,yDACE,qCAGF,iCACE,iCAEF,4CACE,qDAGA,4CAGA,sDAEF,gDACE,sDAGA,8CAIA,sDAMA,8CAKF,sDAMA,4CAKE,sDACA,4CAEA,wDAEA,4CAIF,yDAGE,gDAGA,yDAKA,8CAGA,yDAKA,8CAGF,yDAGE,4CAKF,yDAEE,eACA,iDAQF,iEAKE,iBACA,0CAIA,gBACA,kDAIA,gBAsBF,0CAEE,eACA,2CAEA,cACA,aACA,gBACA,wDACA,aACA,cACA,gMAGE,4BACE,4CAMA,oEACA,oBAKF,yCACE,YACA,kBACA,gCAEA,wCAEA,aACA,qBARF,CAOE,UACA,QARF,kCACE,aACA,0BACA,qCAEA,kBACA,aACA,CACA,UARF,CAOE,4BACA,CARF,sDAEE,sBACA,YACA,2CAEA,cACA,kCACA,oCARF,kBACE,cACA,4BACA,WACA,uBACA,CADA,SACA,iBACA,QACA,oBACA,0BARF,iGAKE,oEALF,CAOE,uCAPF,CAKE,iBACA,CALA,2BACA,CACA,cACA,oBACA,CALF,uBACE,CADF,gDAIE,mBAJF,iCACE,kCACA,+BAEA,IAGA,SACA,CAJA,+DAIA,wCARF,mBACE,kBACA,aACA,yBACA,gBACA,eACA,uBACA,kBACA,sCARF,mBACE,mBACA,aACA,yBACA,eACA,cACA,uBACA,kBACA,uCARF,mBACE,mBACA,aACA,yBACA,eACA,gBACA,uBACA,kBACA,uCARF,mBACE,kBACA,aACA,yBACA,eACA,eACA,uBACA,kBACA,uCARF,mBACE,mBACA,cACA,wBACA,gBACA,eACA,uBACA,kBACA,uCARF,mBACE,mBACA,sCAEA,gBACA,eACA,uBACA,kBACA,uCARF,mBACE,kBACA,sCAEA,gBACA,gBACA,sBACA,kBACA,uCARF,mBACE,mBACA,sCAEA,8BACA,uBAEA,kBACA,uCARF,mBACE,mBACA,sCAEA,+BACA,uBAEA,mBACA,sCARF,oBACE,oBACA,qCAEA,+BACA,uBAEA,0DAPF,mBACE,+BACA,yBAEA,8BACA,uBAEA,0DAPF,mBACE,oBACA,qCAEA,gCACA,uBAEA,0DAPF,mBACE,oBACA,qCAEA,8BACA,uBAEA,0DAPF,mBACE,+BACA,yBAEA,gCACA,uBAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,8BACA,uBAEA,mBACA,uCARF,mBACE,mBACA,sCAEA,+BACA,uBAEA,kBACA,wCARF,oBACE,mBACA,sCAEA,+BACA,CACA,sBACA,kBACA,wCARF,mBACE,mBACA,sCAEA,6BACA,uBAEA,mBACA,uCARF,mBACE,oBACA,qCAEA,gCACA,uBAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,8BACA,uBAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,6BACA,uBAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,+BACA,CACA,sBACA,kBACA,wCARF,mBACE,mBACA,cACA,wBACA,eACA,eACA,uBACA,kBACA,wCARF,mBACE,mBACA,sCAEA,eACA,eACA,uBACA,kBACA,wCARF,mBACE,oBACA,sCAEA,eACA,gBACA,uBACA,kBACA,wCARF,oBACE,mBACA,cACA,wBACA,eACA,eACA,uBACA,kBACA,wCARF,mBACE,mBACA,aACA,yBACA,gBACA,cACA,uBACA,kBACA,wCARF,mBACE,mBACA,cACA,wBACA,cACA,eACA,uBACA,kBACA,wCARF,mBACE,mBACA,sCAEA,eACA,cACA,sBACA,kBACA,wCARF,mBACE,kBACA,sCAEA,gBACA,gBACA,sBACA,kBACA,wCARF,mBACE,mBACA,sCAEA,eACA,gBACA,uBACA,kBACA,wCARF,mBACE,mBACA,cACA,wBACA,gBACA,eACA,uBACA,kBACA,wCARF,mBACE,mBACA,aACA,yBACA,cACA,eACA,uBACA,kBACA,wCARF,mBACE,mBACA,cACA,wBACA,eACA,eACA,uBACA,kBACA,wCARF,oBACE,mBACA,sCAEA,eACA,eACA,uBACA,kBACA,wCARF,mBACE,mBACA,sCAEA,4BACA,uBAEA,mBACA,uCARF,mBACE,mBACA,sCAEA,8BACA,uBAEA,kBACA,wCARF,mBACE,mBACA,sCAEA,+BACA,CACA,sBACA,kBACA,wCARF,kBACE,mBACA,sCAEA,+BACA,uBAEA,kBACA,wCARF,kBACE,mBACA,sCAEA,+BACA,uBAEA,kBACA,wCARF,mBACE,kBACA,sCAEA,gCAEA,uBACA,kBACA,wCARF,mBACE,mBACA,cACA,wBACA,eACA,eACA,uBACA,kBACA,wCARF,oBACE,mBACA,aACA,yBACA,gBACA,eACA,uBACA,kBACA,wCARF,mBACE,kBACA,aACA,yBACA,cACA,eACA,uBACA,kBACA,wCAQJ,mBACA,mBACA,sCAEA,gBACA,sCAEA,0DACA,mBAEA,yEAEA,sCAIE,kBACE,wCAGA,sCACA,aAKF,0BACE,aACA,sCAEA,kBACA,wCAEA,mBACA,mBARF,sCAEE,4BACA,uBAEA,0DAGA,oBARF,+BACE,yBAEA,+BACA,CACA,wCAEA,wCAPF,qCAEE,sCAEA,eACA,sCAEA,kBACA,wCARF,mBAEE,mBACA,sCAEA,gBACA,eACA,uBACA,kBARF,kBAGE,8EAIA,CACA,uCAPA,CAMA,iBACA,CALA,2BACA,cACA,CACA,oBACA,CALA,uBACA,CADA,SACA,CAFA,mBACA,CAFF,iBAEE,CAGA,mBAEA,yBAPF,2CAEE,IAGA,SACA,CAJA,+DAIA,gCAEA,+BARF,mBACE,aACA,yBACA,gBACA,eACA,kBACA,8BAEA,+BARF,mBACE,aACA,yBACA,gBACA,eACA,kBACA,+BAEA,+BARF,mBACE,aACA,yBACA,cACA,eACA,kBACA,+BAEA,+BARF,mBACE,aACA,yBACA,cACA,cACA,mBACA,8BACA,WACA,oBARF,mBACE,aACA,yBACA,eACA,eACA,iDAEA,WACA,oBARF,mBACE,aACA,yBACA,eACA,eACA,iDAEA,WACA,oBARF,mBACE,aACA,yBACA,eACA,cACA,iDAEA,WACA,oBARF,mBACE,aACA,yBACA,gBACA,cACA,iDAEA,WACA,mBARF,oBACE,YACA,yBACA,eACA,eACA,iDAEA,WACA,mBARF,gCACE,CACA,wBACA,eACA,gBACA,kDAEA,WACA,oBARF,gCACE,CACA,wBACA,eACA,gBACA,kDAEA,WACA,oBARF,gCACE,CACA,wBACA,eACA,eACA,kDAEA,WACA,oBARF,gCACE,yBAEA,eACA,cACA,kDAEA,WACA,oBARF,gCACE,yBAEA,6BACA,CACA,iDAEA,WACA,mBARF,gCACE,yBAEA,8BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBAEA,6BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,cACA,eACA,kBACA,gCAEA,YACA,mBARF,gCACE,yBACA,eACA,gBACA,kBACA,gCAEA,YACA,mBARF,gCACE,yBACA,eACA,gBACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,gBACA,eACA,kBACA,gCAEA,WACA,oBARF,+BACE,yBACA,eACA,eACA,kBACA,gCAEA,gCAPF,gCACE,yBACA,eACA,eACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,gBACA,cACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,eACA,gBACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBAEA,+BACA,CACA,iDAEA,WACA,qBARF,gCACE,CACA,wBACA,gBACA,cACA,kDAEA,WACA,oBARF,gCACE,yBAEA,eACA,cACA,kDAEA,WACA,oBARF,gCACE,CACA,wBACA,gBACA,gBACA,kDAEA,WACA,qBARF,mBACE,aACA,yBACA,eACA,eACA,kDAEA,WACA,oBARF,oBACE,YACA,yBACA,eACA,cACA,kDAEA,WACA,oBARF,gCACE,yBAEA,eACA,aACA,kDAEA,WACA,qBARF,+BACE,yBAEA,gBACA,cACA,kDAEA,WACA,oBARF,gCACE,yBAEA,4BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,eACA,gBACA,kBACA,gCAEA,WACA,oBARF,+BACE,yBACA,eACA,cACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBACA,CACA,6BACA,kBACA,gCAEA,WACA,qBARF,gCACE,yBAEA,+BAEA,kDAEA,WACA,oBARF,gCACE,yBAEA,+BAEA,kDAEA,WACA,mBARF,gCACE,yBAEA,6BACA,kBACA,gCAEA,WACA,oBARF,gCACE,yBAEA,gCAEA,kDAEA,WACA,oBARF,gCACE,CACA,wBACA,gBACA,eACA,kDAEA,WACA,oBARF,gCACE,yBAEA,gBACA,cACA,kDAEA,WACA,oBARF,gCACE,yBAEA,6BAEA,kDAEA,WACA,mBAKN,mBACE,aACA,yBACA,6BACA,kDACA,+BAEA,mBACA,aACA,yBAGA,gBAGF,gBAEI,kBAOJ,gCAEE,8BACA,mBACA,sCACA,8BACA,kBACA,gCAGA,WACA,oBAIF,mBAEI,uCAEF,aACE,iCAIJ,gCACE,WACA,oBACA,mBACA,aACA,yBAIF,6BACE,kBAGF,gCACE,+BAEA,mBAGF,sCAIA,gCACE,kBACA,gCAEA,WAGF,uCACE,aAGF,wCACE,kEAEA,8BACA,mBACA,aACA,yBACA,CACA,8CACA,kBAGA,sBACA,4BAEA,CAJA,mBACA,CAGA,gCAKF,mCACE,mBADF,mBACE,CADF,kBACE,cADF,SACE","sources":["App.scss"],"sourcesContent":[".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-wrapper {\n align-items: center;\n background: linear-gradient(to bottom, #3B4587, #151516) border-box;\n display: flex;\n flex-direction: column;\n font-family: 'Barlow', sans-serif;\n min-height: 300px;\n min-width: 400px;\n height: 100vh;\n overflow: hidden;\n position: relative;\n justify-content: center;\n width: 100vw;\n}\n\n.App-wrapper.mainmenu {\n height: 100vh;\n width: 100vw;\n}\n\n.App-header {\n background-color: #282c34;\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n font-family: 'Barlow', sans-serif;\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\n.Waiting-text-wrapper {\n display: flex;\n}\n\n.Begin-game-button-wrapper.waiting-text {\n color: #b8b8b8;\n font-size: 0.8em;\n justify-content: center;\n}\n\n.Waiting-spinner {\n animation-name: spin;\n animation-duration: 2000ms;\n animation-iteration-count: infinite;\n animation-timing-function: linear;\n background-image: url(\"assets/loading-spinner.svg\");\n background-position: center;\n background-repeat: no-repeat;\n height: 40%;\n margin-top: 1%;\n width: 8%;\n}\n\n@keyframes spin {\n from {\n transform:rotate(0deg);\n }\n to {\n transform:rotate(360deg);\n }\n}\n\n.Begin-game-button, .Roll-button, .Offer-double-button, .Forfeit-game-button, .Accept-double-button {\n background: linear-gradient(to right, #3F3217, #564112);\n border-color: #816c3d;\n border-radius: min(1vw, 1em);\n border-style: double;\n border-width: 0.2em;\n color: #b8b8b8;\n font-weight: bold;\n font-family: 'Barlow', sans-serif;\n font-size: max(1.5vh, 1.5vw);\n padding: 0.5vh;\n text-align: center;\n transition: 0.2s;\n width: 10vw;\n}\n\n.Begin-game-button:hover, .Settings-menu-button:hover, .Roll-button:hover, .Offer-double-button:hover, .Forfeit-game-button:hover, .Accept-double-button:hover {\n transform: scale(110%);\n}\n\n.Game-board-wrapper {\n align-items: center;\n color: white;\n display: flex;\n height: 30vw;\n justify-content: center;\n min-height: 150px;\n min-width: 300px;\n width: 60vw;\n}\n\n.Networked-gameboard-spinner {\n animation-name: spin;\n animation-duration: 2000ms;\n animation-iteration-count: infinite;\n animation-timing-function: linear;\n background-image: url(\"assets/online-multiplayer-button-spinner.svg\");\n background-position: center;\n background-repeat: no-repeat;\n height: 20%;\n width: 20%;\n}\n\n.Main-menu-wrapper {\n align-items: center;\n color: white;\n display: flex;\n flex-direction: column;\n height: 60%;\n min-height: 300px;\n min-width: 400px;\n width: 60%;\n}\n\n.Title-wrapper {\n background-image: url(\"assets/backgammon-title.svg\");\n background-position: center;\n background-repeat: no-repeat;\n container: title-container / inline-size;\n filter: drop-shadow(0 1vh 0.3vh rgba(0, 0, 0, 0.35));\n text-align: center;\n vertical-align: middle;\n height: 25%;\n width: 80%;\n}\n\n.Title-text {\n font-size: 3.5em;\n}\n\n@container title-container (min-width: 400px) {\n .Title-text {\n font-size: max(3.5em, 3.5em + 4cqi);\n }\n}\n\n.Menu-button-wrapper {\n container: menu-button-wrapper / inline-size;\n display: flex;\n flex-direction: column;\n height: 50%;\n justify-content: space-around;\n width: 60%;\n}\n\n.Local-multiplayer-button, .Online-multiplayer-button {\n background-position: center;\n background-repeat: no-repeat;\n cursor: pointer;\n display: flex;\n filter: drop-shadow(0 1vh 0.3vh rgba(0, 0, 0, 0.35));\n font-family: 'Barlow', sans-serif;\n font-size: max(2vh, 2vw);\n height: 40%;\n transition: 0.2s;\n width: 100%;\n}\n\n@media screen and (orientation: portrait) {\n .Title-wrapper {\n height: 16%;\n }\n\n .Menu-button-wrapper {\n height: 30%;\n }\n}\n\n.Local-multiplayer-button {\n background-image: url(\"assets/local-multiplayer-button.svg\");\n}\n\n.Online-multiplayer-button {\n background-image: url(\"assets/online-multiplayer-button.svg\");\n}\n\n.Local-multiplayer-button:hover,\n.Local-multiplayer-button:active,\n.Online-multiplayer-button:hover,\n.Online-multiplayer-button:active {\n transform: scale(105%);\n}\n\n.Online-multiplayer-button-spinner {\n animation-name: spin;\n animation-duration: 2000ms;\n animation-iteration-count: infinite;\n animation-timing-function: linear;\n background-image: url(\"assets/online-multiplayer-button-spinner.svg\");\n background-position: center;\n background-repeat: no-repeat;\n height: 40%;\n width: 100%;\n}\n\n.Credits-text {\n color: #6B7195;\n font-size: 0.6em;\n text-align: right;\n position: absolute;\n right: 1%;\n bottom: 1%;\n}\n\n.Match-settings-menu-wrapper {\n display: flex;\n flex-direction: column;\n height: 60%;\n min-height: 300px;\n min-width: 400px;\n width: 45%;\n}\n\n.Match-settings-title-wrapper {\n background-image: url(\"assets/match-settings-title.svg\");\n background-position: center;\n background-repeat: no-repeat;\n filter: drop-shadow(0 0.5vh 0.3vh rgba(0, 0, 0, 0.35));\n vertical-align: middle;\n height: 20%;\n width: 35%;\n}\n\n.Match-points-settings-row, .Doubling-cube-settings-row, .Url-copy-row {\n align-items: center;\n display: flex;\n height: 15%;\n margin-top: 4%;\n width: 100%;\n}\n\n.Play-to-wrapper {\n background-image: url(\"assets/play-to.svg\");\n background-position-y: center;\n background-repeat: no-repeat;\n filter: drop-shadow(0 0.5vh 0.3vh rgba(0, 0, 0, 0.35));\n vertical-align: middle;\n height: 60%;\n width: 14%;\n}\n\n.Doubling-cube-text-wrapper {\n background-image: url(\"assets/allow-doubling.svg\");\n background-position-y: center;\n background-repeat: no-repeat;\n filter: drop-shadow(0 0.5vh 0.3vh rgba(0, 0, 0, 0.35));\n vertical-align: middle;\n height: 60%;\n width: 24%;\n}\n\n.Url-title-wrapper {\n background-image: url(\"assets/url-title.svg\");\n background-position-y: center;\n background-repeat: no-repeat;\n filter: drop-shadow(0 0.5vh 0.3vh rgba(0, 0, 0, 0.35));\n vertical-align: middle;\n height: 40%;\n width: 14%;\n}\n\n.Url-form-wrapper {\n align-items: flex-start;\n container: url-form-container / inline-size;\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 80%;\n}\n\n.Url-form .form-control {\n color: #dcd4d4;\n background-color: #474747;\n font-size: 1em;\n}\n\n.Url-form-text {\n background-color: #332E2E;\n border-radius: 1vw;\n border: solid #dcd4d4;\n color: #dcd4d4;\n font-size: 0.9em;\n padding: 1vh 1vw 1vh 1vw;\n}\n\n.Url-form-subtext {\n color: #dcd4d4;\n margin-left: 1vw;\n font-size: 0.7em;\n}\n\n@container url-form-container (min-width: 600px) {\n .Url-form-text {\n font-size: 1.5em;\n }\n\n .Url-form-subtext {\n font-size: 1em;\n }\n}\n\n.Url-form-text-and-copy {\n align-items: center;\n display: flex;\n width: 100%\n}\n\n.Url-form-copy {\n background-image: url(\"assets/copy-icon.svg\");\n background-position-y: center;\n background-repeat: no-repeat;\n cursor: pointer;\n margin-left: 2%;\n height: 80%;\n transition: 0.2s;\n width: 8%;\n}\n\n.Url-form-copy.highlight {\n background-image: url(\"assets/copy-icon-clicked.svg\");\n}\n\n.Url-form-copy:hover, .Url-form-copy:active {\n transform: scale(105%);\n}\n\n.Start-game-button-row {\n align-items: center;\n display: flex;\n height: 15%;\n justify-content: center;\n margin-top: 8%;\n width: 100%;\n}\n\n.Start-game-button {\n background: linear-gradient(to right, #3F3217, #564112);\n border-color: #816c3d;\n border-radius: min(1vw, 1em);\n border-style: double;\n border-width: 0.2em;\n color: #b8b8b8;\n font-weight: bold;\n font-family: 'Barlow', sans-serif;\n font-size: max(1.5vh, 1.5vw);\n padding: 0.5vh;\n text-align: center;\n transition: 0.2s;\n width: 10vw;\n}\n\n.Start-game-button:hover {\n transform: scale(105%);\n}\n\n.Doubling-cube-toggle-form {\n align-items: center;\n display: flex;\n height: 100%;\n margin-left: 4%;\n width: 70%;\n}\n\n.Doubling-cube-toggle-off, .Doubling-cube-toggle-on {\n background-position: center;\n background-repeat: no-repeat;\n height: 30%;\n width: 15%;\n}\n\n.Doubling-cube-toggle-off {\n background-image: url(\"assets/off-disabled.svg\");\n}\n\n.Doubling-cube-toggle-on {\n background-image: url(\"assets/on-disabled.svg\");\n}\n\n.Doubling-cube-toggle-off.enabled {\n background-image: url(\"assets/off-enabled.svg\");\n}\n\n.Doubling-cube-toggle-on.enabled {\n background-image: url(\"assets/on-enabled.svg\");\n}\n\n.Doubling-cube-toggle.form-switch {\n margin-left: 4%;\n margin-right: 4%;\n}\n\n.Doubling-cube-toggle .form-check-input {\n height: 4vh;\n width: 6vw;\n}\n\n.Doubling-cube-toggle .form-check-input:checked {\n background-color: #4488ec;\n}\n\n.Match-points-buttons-wrapper {\n display: flex;\n height: 100%;\n width: 86%;\n}\n\n.Match-points-button {\n align-content: center;\n background-color: #CDB288;\n background-position: center;\n background-repeat: no-repeat;\n background-size: 15%;\n border-radius: 10%;\n font-size: max(1.3em, 2vw);\n font-weight: bold;\n height: max(5vw, 5vh);\n cursor: pointer;\n margin-left: 2%;\n opacity: 40%;\n text-align: center;\n transition: 0.2s;\n width: max(5vw, 5vh);\n}\n\n.Match-points-button.selected {\n border: white solid max(3px, 0.3vw);\n opacity: 100%;\n}\n\n.Match-points-button:hover, .Match-points-button:active {\n transform: scale(105%);\n}\n\n.Player-card-wrapper {\n background: #0F142F;\n border: min(5px, 0.4vw) solid #22274a;\n border-radius: min(1vw, 1em) min(1vw, 1em) 0 0;\n border-bottom-style: none;\n color: #b8b8b8;\n display: flex;\n height: 9%;\n position: relative;\n left: 66%;\n width: 28%;\n}\n\n.Player-card-wrapper.current {\n filter: drop-shadow(0 0 1vh #f7dcab);\n}\n\n.Player-card-wrapper.cw {\n left: 6%;\n}\n\n.Player-card-wrapper.bottom {\n background: #251F13;\n border: min(5px, 0.4vw) solid #564112;\n border-radius: 0 0 min(1vw, 1em) min(1vw, 1em);\n border-top-style: none;\n}\n\n.Player-card-checker-wrapper {\n display: flex;\n width: 24%;\n}\n\n.Player-card-checker-wrapper .Checker {\n margin: 20% 20%;\n height: 60%;\n width: 60%;\n}\n\n.Player-name-and-score-wrapper {\n display: flex;\n flex-direction: column;\n width: 52%;\n}\n\n.Player-name-wrapper {\n font-size: 2vh;\n font-weight: bold;\n height: 40%;\n}\n\n.Player-card-doubling-cube-wrapper {\n align-content: center;\n width: 24%;\n}\n\n.Player-card-doubling-cube-wrapper .Doubling-cube {\n height: 65%;\n margin-left: 20%;\n width: 60%;\n}\n\n@media screen and (orientation: landscape) {\n .Player-name-wrapper {\n font-size: 1.2vw;\n font-weight: bold;\n height: 40%;\n margin-top: 4%;\n }\n\n .Player-score-wrapper {\n display: flex;\n font-size: 0.8vw;\n height: 50%;\n margin-top: 4%;\n white-space: nowrap;\n }\n}\n\n@media screen and (orientation: portrait) {\n .Player-name-wrapper {\n font-size: 2vh;\n font-weight: bold;\n height: 40%;\n }\n\n .Player-score-wrapper {\n display: flex;\n font-size: 0.8vw;\n height: 50%;\n }\n}\n\n.Player-card-total-match-points {\n font-weight: bold;\n}\n\n.Player-points-wrapper {\n margin-left: 0.8vw;\n}\n\n.Information-text-wrapper {\n margin-left: 5.5%;\n margin-right: 5.5%;\n width: 89%;\n height: 4vh;\n}\n\n.Information-text {\n color: #b8b8b8;\n}\n\n.Game-area-wrapper {\n filter: drop-shadow(0 0 0.5vh #000000);\n}\n\n.Game-board-half {\n background-image: url(\"assets/board-background.svg\");\n background-size: cover;\n border-color: #212529;\n border-width: 0.8vh;\n display: flex;\n flex-direction: column;\n height: 100%;\n justify-content: space-between;\n position: relative;\n width: 45.5%;\n z-index: 1;\n}\n\n.Game-board-half.left {\n background:\n url(\"assets/board-background.svg\") padding-box,\n linear-gradient(to bottom, #22274A, #564112) border-box;\n border: min(5px, 0.4vw) solid transparent;\n border-right-style: none;\n border-top-left-radius: min(1vw, 1em);\n border-bottom-left-radius: min(1vw, 1em);\n}\n\n.Game-board-half.left.cw {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.Game-board-half.right {\n background:\n url(\"assets/board-background.svg\") padding-box,\n linear-gradient(to bottom, #22274A, #564112) border-box;\n border: min(5px, 0.4vw) solid transparent;\n border-left-style: none;\n}\n\n.Game-board-half.right.cw {\n border-top-right-radius: min(1vw, 1em);\n border-bottom-right-radius: min(1vw, 1em);\n}\n\n.Game-board-quadrant {\n display: flex;\n height: 50%;\n justify-content: space-evenly;\n width: 100%;\n}\n\n.Game-board-quadrant.bottom {\n align-items: flex-end;\n}\n\n.Game-board-bar {\n background:\n url(\"assets/dots.svg\") center/420% padding-box,\n linear-gradient(to bottom, #22274A, #564112) border-box;\n border: min(5px, 0.4vw) solid transparent;\n display: flex;\n flex-direction: column;\n height: 100%;\n justify-content: space-around;\n width: 4%;\n z-index: 1;\n}\n\n.Game-board-home {\n background:\n url(\"assets/dots.svg\") center/300% padding-box,\n linear-gradient(to bottom, #22274A, #564112) border-box;\n border: min(5px, 0.4vw) solid transparent;\n border-left-style: none;\n border-top-right-radius: min(1vw, 1em);\n border-bottom-right-radius: min(1vw, 1em);\n display: flex;\n flex-direction: column;\n height: 100%;\n justify-content: space-around;\n width: 5%;\n}\n\n\n\n.Game-board-home.cw {\n border-left-style: solid;\n border-right-style: none;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: min(1vw, 1em);\n border-bottom-left-radius: min(1vw, 1em);\n}\n\n.Point-wrapper {\n display: flex;\n position: relative;\n height: 87%;\n width: 16.667%;\n}\n\n.Point-wrapper-highlight {\n height: 100%;\n margin-left: 10%;\n position: absolute;\n width: 80%;\n z-index: 1;\n}\n\n.Point-wrapper-highlight.from {\n background-color: #e4cb6454;\n}\n\n.Point-wrapper-highlight.to {\n background: url(\"assets/stripes.svg\");\n background-size: cover;\n}\n\n.Point-wrapper-highlight.noMove {\n animation-duration: 1s;\n animation-name: nomove;\n}\n\n@keyframes nomove {\n from {\n background: url(\"assets/stripes-red.svg\");\n background-size: cover;\n }\n\n to {\n background: url(\"assets/stripes-red-fade.svg\");\n background-size: cover;\n }\n}\n\n.Point-wrapper-highlight.bottom {\n border-top-left-radius: 5vh;\n border-top-right-radius: 5vh;\n}\n\n.Point-wrapper-highlight.top {\n border-bottom-left-radius: 5vh;\n border-bottom-right-radius: 5vh;\n}\n\n.Point-triangle {\n height: 100%;\n margin-left: 10%;\n position: absolute;\n width: 80%;\n z-index: 1;\n}\n\n.Point-triangle-inner {\n height: 96%;\n margin-left: 12%;\n position: absolute;\n width: 76%;\n z-index: 2;\n}\n\n.Point-triangle-inner.bottom {\n margin-top: 12%;\n}\n\n.Point-triangle-inner.even {\n background-color: #0F1744;\n}\n\n.Point-triangle-inner.odd {\n background-color: #885525;\n}\n\n.Point-triangle.top, .Point-triangle-inner.top {\n clip-path: polygon(0% 0%, 50% 100%, 100% 0%);\n}\n\n.Point-triangle.bottom, .Point-triangle-inner.bottom {\n clip-path: polygon(0% 100%, 50% 0%, 100% 100%);\n}\n\n.Point-triangle.even {\n background-color: #636781;\n}\n\n.Point-triangle.odd {\n background-color: #997345;\n}\n\n.Checkers-wrapper {\n align-items: center;\n display: flex;\n flex-wrap: wrap;\n height: 100%;\n width: 100%;\n z-index: 3;\n}\n\n.Checkers-wrapper.top {\n flex-direction: column;\n}\n\n.Checkers-wrapper.bottom {\n flex-direction: column-reverse;\n}\n\n.Point {\n height: 41vh;\n width: 15%;\n}\n\n.Checker {\n filter: drop-shadow(0 0 0.2vh rgb(0, 0, 0, 0.6));\n transition: transform 0.3s ease-out, filter 0.5s ease-in-out;\n will-change: transform, filter;\n height: 15%;\n width: 45%;\n z-index: 4;\n}\n\n.Checker.white {\n background-image: url(\"assets/checker-light.svg\");\n background-repeat: no-repeat;\n}\n\n.Checker.highlighted-pulse, .Checker.selected-pulse {\n filter: drop-shadow(0 0 0.5vh #f7dcab);\n}\n\n.Checker.white.selected-pulse {\n background-image: url(\"assets/checker-light-selected.svg\");\n background-repeat: no-repeat;\n}\n\n.Checker.black.selected-pulse {\n background-image: url(\"assets/checker-dark-selected.svg\");\n background-repeat: no-repeat;\n}\n\n.Checker.highlighted, .Checker.selected {\n filter: drop-shadow(0 0 0.1vh #f7dcab);\n}\n\n.Checker.black {\n background-image: url(\"assets/checker-dark.svg\");\n background-repeat: no-repeat;\n}\n\n.Player-one-bar-checkers, .Player-two-bar-checkers {\n align-items: center;\n display: flex;\n height: 47.5%;\n}\n\n.Player-one-bar-checkers {\n flex-direction: column-reverse;\n}\n\n.Player-two-bar-checkers {\n flex-direction: column;\n}\n\n.Player-one-bar-checkers.highlight {\n background-color: #e4cb6454;\n border-bottom-left-radius: 5vh;\n border-bottom-right-radius: 5vh;\n}\n\n.Player-two-bar-checkers.highlight {\n background-color: #e4cb6454;\n border-top-left-radius: 5vh;\n border-top-right-radius: 5vh;\n}\n\n.Game-board-bar-spacer {\n height: 5%\n}\n\n.Player-one-bar-checkers .Checker, .Player-two-bar-checkers .Checker {\n height: 15%;\n width: 120%;\n}\n\n.Player-one-home-checkers, .Player-two-home-checkers {\n align-items: center;\n display: flex;\n flex-direction: column;\n height: 45.5%;\n}\n\n.Player-one-home-checkers .Checker.white {\n background-image: url(\"assets/checker-home-light.svg\");\n}\n\n.Player-one-home-checkers .Checker.black {\n background-image: url(\"assets/checker-home-dark.svg\");\n}\n\n.Player-two-home-checkers .Checker.white {\n background-image: url(\"assets/checker-home-light.svg\");\n}\n\n.Player-two-home-checkers .Checker.black {\n background-image: url(\"assets/checker-home-dark.svg\");\n}\n\n.Player-one-home-checkers, .Player-two-home-checkers.p2 {\n justify-content: flex-end;\n}\n\n.Player-one-home-checkers.p2 {\n justify-content: flex-start;\n}\n\n.Player-one-home-checkers.highlighted {\n background: url(\"assets/stripes.svg\");\n background-size: cover;\n border-top-left-radius: 1vh;\n border-top-right-radius: 1vh;\n}\n\n.Player-two-home-checkers.highlighted {\n background: url(\"assets/stripes.svg\");\n background-size: cover;\n border-bottom-left-radius: 1vh;\n border-bottom-right-radius: 1vh;\n}\n\n.Game-board-home-spacer {\n height: 9%;\n}\n\n.Player-one-home-checkers .Checker, .Player-two-home-checkers .Checker {\n border-radius: 10% 10% 34% 34%;\n height: 4%;\n margin-bottom: 3%;\n margin-top: 3%;\n padding-top: 0;\n width: 80%;\n}\n\n.Submit-button-wrapper, .Undo-button-wrapper, .Dice-row-spacer {\n height: 4vw;\n width: 4vw;\n}\n\n.Submit-button, .Undo-button {\n background: url(\"assets/checkmark.svg\") center / 60% padding-box, linear-gradient(to right, #3F3217, #564112) border-box;\n border-color: #816c3d;\n border-radius: 1vh;\n background-repeat: no-repeat;\n border-style: double;\n margin-left: 10%;\n margin-top: 10%;\n height: 80%;\n transition: 0.2s;\n width: 80%;\n}\n\n.Undo-button-wrapper .Undo-button {\n background: url(\"assets/undo-arrow.svg\") center / 60% padding-box, linear-gradient(to right, #3F3217, #564112) border-box;\n background-repeat: no-repeat;\n}\n\n.Submit-button:hover, .Undo-button:hover {\n transform: scale(110%);\n}\n\n.mainmenu .Settings-menu-button-wrapper {\n right: 2vw;\n}\n\n.Settings-menu-button-wrapper {\n position: absolute;\n right: 2%;\n top: 2%;\n}\n\n.Settings-menu .modal-content, .Game-over-dialog .modal-content {\n background-color: #abafc2;\n border: 0.5vw solid #636781;\n border-radius: 1vw;\n font-family: 'Barlow', sans-serif;\n}\n\n.Game-over-dialog {\n text-align: center;\n}\n\n.Game-over-dialog .modal-title {\n font-size: 2em;\n}\n\n.Settings-menu .modal-header, .Game-over-dialog .modal-header {\n border-bottom: 1px solid rgb(78, 96, 124);\n}\n\n.Game-over-dialog .modal-header {\n display: block;\n}\n\n.Game-over-dialog-winner-wrapper {\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n padding: 4%;\n}\n\n.Game-over-dialog-winner-checker-wrapper {\n display: flex;\n height: 3.5em;\n width: 12.6%;\n}\n\n.Game-over-dialog-winner-checker-wrapper.left {\n justify-content: flex-end;\n}\n\n.Game-over-dialog-winner-text {\n font-size: 1.2em;\n font-weight: bold;\n width: 70%;\n}\n\n.Game-over-dialog-gammon-text {\n font-size: 0.8em;\n font-weight: normal;\n}\n\n.Game-over-dialog-winner-checker-wrapper .Checker {\n height: 100%;\n width: 100%;\n}\n\n.Game-over-dialog .modal-footer {\n justify-content: center;\n}\n\n.Settings-menu .modal-footer, .Game-over-dialog .modal-footer {\n border-top: 1px solid rgb(78, 96, 124);\n}\n\n.Settings-menu .modal-body, .Game-over-dialog .modal-body {\n padding: 0;\n}\n\n.Settings-menu .modal-footer .btn, .Game-over-dialog .modal-footer .btn {\n background-color: #354e74;\n border-color: rgb(24 38 61);\n border-width: 0.2vh;\n}\n\n.Settings-menu .Settings-option-row {\n border-bottom: 1px solid rgb(78, 96, 124);\n display: flex;\n justify-content: space-between;\n}\n\n.Settings-menu .Settings-option-row.bottom {\n border-bottom: none;\n}\n\n.Settings-menu-player-names-and-checkers {\n cursor: pointer;\n display: flex;\n justify-content: space-around;\n padding-right: 5%;\n width: 50%;\n}\n\n.Settings-menu-player-name-and-checker {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 40%;\n}\n\n.Settings-menu-player-name {\n text-align: center;\n}\n\n.Settings-menu-checkers-wrapper {\n display: flex;\n justify-content: space-around;\n height: 66%;\n width: 100%;\n}\n\n.Settings-menu-checker-wrapper {\n align-items: center;\n display: flex;\n height: 50%;\n width: 31%;\n justify-content: center;\n}\n\n.Settings-menu-checker-wrapper .Checker {\n height: 100%;\n width: 100%;\n}\n\n.Settings-menu-color-swap-arrow-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n transition: 0.2s;\n width: 20%;\n}\n\n.Settings-menu-player-names-and-checkers:hover .Settings-menu-color-swap-arrow-wrapper {\n transform: scale(110%);\n}\n\n.Settings-menu-color-swap {\n font-size: 0.6em;\n font-weight: bold;\n text-align: center;\n}\n\n.Settings-menu-color-swap-arrow {\n background: url(\"assets/swap-arrow.svg\");\n background-repeat: no-repeat;\n height: 20%;\n width: 50%;\n}\n\n.Settings-option-movement-diagram-wrapper {\n cursor: pointer;\n display: flex;\n justify-content: center;\n padding: 2%;\n width: 50%;\n}\n\n.Settings-option-movement-diagram {\n background-size: contain;\n background-repeat: no-repeat;\n height: 100%;\n transition: 0.2s;\n width: 50%;\n}\n\n.Settings-option-movement-diagram:hover {\n transform: scale(105%);\n}\n\n.Settings-option-movement-diagram.light {\n background-image: url(\"assets/diagram-light-ccw.svg\");\n}\n\n.Settings-option-movement-diagram.light.cw {\n background-image: url(\"assets/diagram-light-cw.svg\");\n}\n\n.Settings-option-movement-diagram.dark {\n background-image: url(\"assets/diagram-dark-ccw.svg\");\n}\n\n.Settings-option-movement-diagram.dark.cw {\n background-image: url(\"assets/diagram-dark-cw.svg\");\n}\n\n.Settings-checker-color-label, .Settings-checker-direction-label {\n padding: 4vh;\n}\n\n.Settings-option-arrow.clockwise {\n background: url(\"assets/clockwise-arrow.svg\") no-repeat top left;\n}\n\n.Settings-option-arrow.counterclockwise {\n background: url(\"assets/counterclockwise-arrow.svg\") no-repeat top left;\n}\n\n.Settings-menu-button {\n background: url(\"assets/settings-icon.svg\") no-repeat top left;\n background-size: contain;\n}\n\n@media screen and (orientation: landscape) {\n .Settings-menu-button {\n height: 3vw;\n width: 3vw;\n }\n}\n\n@media screen and (orientation: portrait) {\n .Settings-menu-button {\n height: 3vh;\n width: 3vh;\n }\n}\n\n/********\n * DICE *\n ********/\n .Dice,\n .Begin-game-button-wrapper,\n .Roll-button-wrapper,\n .Offer-double-button-wrapper,\n .Accept-double-menu-wrapper {\n align-items: center;\n display: flex;\n height: 10%;\n left: 10%;\n justify-content: space-evenly;\n position: absolute;\n top: 45%;\n width: 80%;\n z-index: 5;\n}\n\n.Die-faces {\n align-items: center;\n display: flex;\n height: 114%;\n justify-content: center;\n transform-style: preserve-3d;\n transition: transform 1.3s ease-out;\n width: 15.5%;\n}\n\n.Die-face {\n border-radius: 0.5vw;\n color: white;\n display: grid;\n gap: 0.4vw;\n grid-template-columns: repeat(3, 1fr);\n grid-template-rows: repeat(3, 1fr);\n height: 100%;\n padding: 0.2vw;\n position: absolute;\n width: 100%;\n}\n\n.Die-faces.white .Die-face {\n background-color: rgb(255 243 219);\n border: 0.2vw solid #b49e70;\n}\n\n.Die-faces.black .Die-face {\n background-color: rgb(15 16 37);\n border: 0.2vw solid #767293;\n}\n\n.Die-faces.white.spent .Die-face, .Die-faces.black.spent .Die-face {\n display: none;\n}\n\n.Die-faces.white.spent.one .Die-face.one,\n.Die-faces.white.spent.two .Die-face.two,\n.Die-faces.white.spent.three .Die-face.three,\n.Die-faces.white.spent.four .Die-face.four,\n.Die-faces.white.spent.five .Die-face.five,\n.Die-faces.white.spent.six .Die-face.six {\n background-color: rgb(255 243 219 / 30%);\n border-color: #b49e707a;\n display: grid;\n}\n\n.Die-faces.black.spent.one .Die-face.one,\n.Die-faces.black.spent.two .Die-face.two,\n.Die-faces.black.spent.three .Die-face.three,\n.Die-faces.black.spent.four .Die-face.four,\n.Die-faces.black.spent.five .Die-face.five,\n.Die-faces.black.spent.six .Die-face.six {\n background-color: rgb(15 16 37 / 15%);\n border-color: #76729363;\n display: grid;\n}\n\n.Die-pip {\n border-radius: 50%;\n height: 95%;\n width: 95%;\n}\n\n.Die-faces.white .Die-pip {\n background-color: #1b1c22;\n}\n\n.Die-faces.black .Die-pip {\n background-color: #ede2ce;\n}\n\n.Die-faces.black.spent .Die-pip {\n background-color: #ffffff70;\n}\n\n.Die-faces.white.spent .Die-pip {\n background-color: #00000070;\n}\n\n.Die-faces.one, .Die-faces.one.black.reroll {\n transform: rotateX(360deg) rotateY(720deg) rotateZ(360deg);\n}\n.Die-faces.two, .Die-faces.two.black.reroll {\n transform: rotateX(450deg) rotateY(720deg) rotateZ(360deg);\n}\n.Die-faces.three, .Die-faces.three.black.reroll {\n transform: rotateX(360deg) rotateY(630deg) rotateZ(360deg);\n}\n.Die-faces.four, .Die-faces.four.black.reroll {\n transform: rotateX(360deg) rotateY(810deg) rotateZ(360deg);\n}\n.Die-faces.five, .Die-faces.five.black.reroll {\n transform: rotateX(270deg) rotateY(720deg) rotateZ(360deg);\n}\n.Die-faces.six, .Die-faces.six.black.reroll {\n transform: rotateX(360deg) rotateY(900deg) rotateZ(360deg);\n}\n\n.Die-faces.one.black, .Die-faces.one.reroll {\n transform: rotateX(-360deg) rotateY(-720deg) rotateZ(-360deg);\n}\n.Die-faces.two.black, .Die-faces.two.reroll {\n transform: rotateX(-270deg) rotateY(-720deg) rotateZ(-360deg);\n}\n.Die-faces.three.black, .Die-faces.three.reroll {\n transform: rotateX(-360deg) rotateY(-810deg) rotateZ(-360deg);\n}\n.Die-faces.four.black, .Die-faces.four.reroll {\n transform: rotateX(-360deg) rotateY(-630deg) rotateZ(-360deg);\n}\n.Die-faces.five.black, .Die-faces.five.reroll {\n transform: rotateX(-450deg) rotateY(-720deg) rotateZ(-360deg);\n}\n.Die-faces.six.black, .Die-faces.six.reroll {\n transform: rotateX(-360deg) rotateY(-900deg) rotateZ(-360deg);\n}\n\n.Die-face.one {\n transform: rotate3d(0, 0, 0, 90deg) translateZ(1.6vw);\n}\n.Die-face.two {\n transform: rotate3d(-1, 0, 0, 90deg) translateZ(1.6vw);\n}\n.Die-face.three {\n transform: rotate3d(0, 1, 0, 90deg) translateZ(1.6vw);\n}\n.Die-face.four {\n transform: rotate3d(0, -1, 0, 90deg) translateZ(1.6vw);\n}\n.Die-face.five {\n transform: rotate3d(1, 0, 0, 90deg) translateZ(1.6vw);\n}\n.Die-face.six {\n transform: rotate3d(1, 0, 0, 180deg) translateZ(1.6vw);\n}\n\n.Die-pip.one {\n grid-area: 1/1;\n}\n.Die-pip.three {\n grid-area: 1/3;\n}\n.Die-pip.four {\n grid-area: 2/1;\n}\n.Die-pip.five {\n grid-area: 2/2;\n}\n.Die-pip.six {\n grid-area: 2/3;\n}\n.Die-pip.seven {\n grid-area: 3/1;\n}\n.Die-pip.nine {\n grid-area: 3/3;\n}\n\n.Doubling-cube {\n align-content: center;\n background-image: url(\"assets/doubling-cube.svg\");\n background-repeat: no-repeat;\n filter: drop-shadow(1px 1px 1px rgb(58, 7, 7));\n height: 85%;\n margin-left: 7.5%;\n width: 85%;\n}\n\n.Doubling-cube-value-wrapper {\n align-content: center;\n color: #FABBBB;\n font-size: min(1.3vw, 1.3em);\n height: 100%;\n text-align: center;\n text-shadow: 1px 1px 1px rgb(58, 7, 7);\n width: 100%;\n}\n\n.Accept-double-menu-wrapper {\n display: flex;\n height: 14%;\n top: 43%;\n flex-direction: column;\n}\n\n.Accept-double-menu-text-wrapper {\n color: #b8b8b8;\n font-size: max(0.5em, 1.2vw);\n}\n\n.Accept-double-menu-buttons-wrapper {\n align-items: center;\n display: flex;\n justify-content: space-evenly;\n height: 50%;\n width: 100%;\n}\n\n.Accept-double-button, .Forfeit-game-button {\n font-size: min(1em, 1vw);\n height: 100%;\n padding: 0;\n width: 34%;\n}\n\n.Accept-double-button {\n color: #62955D;\n}\n\n.Forfeit-game-button {\n color: #C14534;\n}\n\n.Waiting-for-accept-double-wrapper {\n align-items: center;\n color: #b8b8b8;\n display: flex;\n font-size: 0.7em;\n height: 12%;\n left: 10%;\n justify-content: center;\n position: absolute;\n top: 44%;\n width: 80%;\n z-index: 5;\n}\n\n/*****************************\n Floating circles background\n*****************************/\n@function random_range($min, $max) {\n $rand: random();\n $random_range: $min + floor($rand * (($max - $min) + 1));\n @return $random_range;\n}\n\n@function sample($list) {\n @return nth($list, random(length($list)));\n}\n\n$floating-circle-count: 50;\n\n// Initial floating circles start on screen with a randomized non-zero opacity,\n// then animate once and finish with 0 opacity. By that time, the regular\n// floating circles will have begun to animate indefinitely. This way, floating\n// circles are visible immediately on page load.\n.Initial-floating-circle {\n position: absolute;\n left: var(--left-offset);\n bottom: var(--bottom-offset);\n display: block;\n width: var(--radius);\n height: var(--radius);\n border-radius: 50%;\n background-color: #83919e24;\n pointer-events: none;\n opacity: 0%;\n animation: float-around-initial var(--animation-duration) 0s ease-in;\n\n @keyframes float-around-initial {\n 0% {\n opacity: var(--starting-opacity);\n }\n 50% {\n opacity: var(--max-opacity);\n }\n 100% {\n transform: translateX(var(--float-x)) translateY(var(--float-y));\n opacity: 0%;\n }\n }\n\n @for $i from 0 through $floating-circle-count {\n &:nth-child(#{$i}) {\n --bottom-offset: #{random_range(-10%, 110%)};\n --left-offset: #{random_range(0vw, 100vw)};\n --radius: #{random_range(3vw, 6vw)};\n --animation-duration: #{random_range(10s, 30s)};\n --float-y: #{random_range(-30vh, 30vh)};\n --float-x: #{random_range(-30vw, 30vw)};\n --starting-opacity: #{random_range(10%, 50%)};\n --max-opacity: #{random_range(40%, 80%)};\n }\n }\n}\n\n// These floating circles begin to appear and animate indefinitely as the initial\n// floating circles finish their one-time animation.\n.Floating-circle {\n position: absolute;\n left: var(--left-offset);\n bottom: var(--bottom-offset);\n display: block;\n width: var(--radius);\n height: var(--radius);\n border-radius: 50%;\n background-color: #83919e24;\n pointer-events: none;\n opacity: 0%;\n animation: float-around var(--animation-duration) var(--delay) ease-in infinite;\n\n @keyframes float-around {\n 0% {\n opacity: 0%;\n }\n 50% {\n opacity: var(--max-opacity);\n }\n 100% {\n transform: translateX(var(--float-x)) translateY(var(--float-y));\n opacity: 0%;\n }\n }\n\n @for $i from 0 through $floating-circle-count {\n &:nth-child(#{$i}) {\n --delay: #{random_range(10s, 30s)};\n --bottom-offset: #{random_range(-10%, 110%)};\n --left-offset: #{random_range(0vw, 100vw)};\n --radius: #{random_range(3vw, 6vw)};\n --animation-duration: #{random_range(10s, 30s)};\n --float-y: #{random_range(-30vh, 30vh)};\n --float-x: #{random_range(-30vw, 30vw)};\n --max-opacity: #{random_range(30%, 70%)};\n }\n }\n}\n\n.Wipe-transition {\n animation-name: wipe;\n animation-duration: 300ms;\n animation-iteration-count: 1;\n animation-timing-function: linear;\n background-color: #000000a7;\n position: absolute;\n z-index: 9;\n pointer-events: none;\n left: 0;\n top: 0;\n width: 0%;\n height: 100%;\n}\n\n@keyframes wipe {\n from {\n width: 100%;\n }\n to {\n width: 0%;\n }\n}\n\n.Wipe-fade {\n animation-name: fade;\n animation-duration: 300ms;\n animation-iteration-count: 1;\n animation-timing-function: linear;\n background-color: #ffffff00;\n position: absolute;\n z-index: 8;\n pointer-events: none;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n}\n\n@keyframes fade {\n from {\n background-color: #ffffff56;\n }\n to {\n background-color: #ffffff00;\n }\n}\n\n.Room-connection-error-wrapper {\n align-items: center;\n color: #b8b8b8;\n display: flex;\n flex-direction: column;\n text-align: center;\n width: 50%;\n}\n\n.Room-connection-error-header {\n font-size: max(2em, 2vw);\n}\n\n.Room-connection-error-text {\n font-size: max(1em, 1vw);\n margin-top: 2%;\n width: 100%;\n}\n\n.Room-connection-error-roomcode {\n font-weight: bold;\n}\n\n.Room-connection-error-subtext {\n font-size: max(1em, 1vw);\n line-height: 1em;\n margin-top: 2%;\n width: 70%;\n}\n\n.Room-connection-error-menu-button-wrapper {\n margin-top: 5%;\n}\n\n.Room-connection-error-menu-button {\n background: linear-gradient(to right, #3F3217, #564112);\n border-color: #816c3d;\n border-radius: min(1vw, 1em);\n border-style: double;\n border-width: 0.2em;\n color: #b8b8b8;\n font-weight: bold;\n font-family: 'Barlow', sans-serif;\n font-size: max(1em, 1vw);\n height: 5vh;\n min-height: 35px;\n min-width: 125px;\n max-width: 175px;\n padding: 0.5vh;\n text-align: center;\n transition: 0.2s;\n width: 12vw;\n}\n\n.Room-connection-error-menu-button:hover, .Room-connection-error-menu-button:active {\n transform: scale(105%);\n}"],"names":[],"sourceRoot":""}
\ No newline at end of file
diff --git a/static/js/main.de308495.js b/static/js/main.2a1b5b7c.js
similarity index 99%
rename from static/js/main.de308495.js
rename to static/js/main.2a1b5b7c.js
index fec5524..86b231a 100644
--- a/static/js/main.de308495.js
+++ b/static/js/main.2a1b5b7c.js
@@ -1,3 +1,3 @@
-/*! For license information please see main.de308495.js.LICENSE.txt */
-(()=>{var e={600:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e=[],t=0;t{"use strict";var r=n(86),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};function l(e){return r.isMemo(e)?s:a[e.$$typeof]||i}a[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a[r.Memo]=s;var c=Object.defineProperty,u=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,r){if("string"!==typeof n){if(p){var i=f(n);i&&i!==p&&e(t,i,r)}var s=u(n);h&&(s=s.concat(h(n)));for(var a=l(t),m=l(n),g=0;g{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(e,i){for(var o,s,a=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l{"use strict";var r=n(218);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,s){if(s!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},173:(e,t,n)=>{e.exports=n(497)()},218:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},730:(e,t,n)=>{"use strict";var r=n(43),i=n(123),o=n(853);function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;nt}return!1}(t,n,i,r)&&(n=null),r||null===i?function(e){return!!f.call(m,e)||!f.call(p,e)&&(d.test(e)?m[e]=!0:(p[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=null===n?3!==i.type&&"":n:(t=i.attributeName,r=i.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(y,w);v[t]=new g(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(y,w);v[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(y,w);v[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){v[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)})),v.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){v[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)}));var E=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,S=60103,_=60106,k=60107,T=60108,C=60114,x=60109,I=60110,N=60112,O=60113,P=60120,R=60115,A=60116,D=60121,L=60128,M=60129,j=60130,F=60131;if("function"===typeof Symbol&&Symbol.for){var U=Symbol.for;S=U("react.element"),_=U("react.portal"),k=U("react.fragment"),T=U("react.strict_mode"),C=U("react.profiler"),x=U("react.provider"),I=U("react.context"),N=U("react.forward_ref"),O=U("react.suspense"),P=U("react.suspense_list"),R=U("react.memo"),A=U("react.lazy"),D=U("react.block"),U("react.scope"),L=U("react.opaque.id"),M=U("react.debug_trace_mode"),j=U("react.offscreen"),F=U("react.legacy_hidden")}var V,B="function"===typeof Symbol&&Symbol.iterator;function z(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=B&&e[B]||e["@@iterator"])?e:null}function H(e){if(void 0===V)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);V=t&&t[1]||""}return"\n"+V+e}var q=!1;function W(e,t){if(!e||q)return"";q=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(l){var r=l}Reflect.construct(e,[],t)}else{try{t.call()}catch(l){r=l}e.call(t.prototype)}else{try{throw Error()}catch(l){r=l}e()}}catch(l){if(l&&r&&"string"===typeof l.stack){for(var i=l.stack.split("\n"),o=r.stack.split("\n"),s=i.length-1,a=o.length-1;1<=s&&0<=a&&i[s]!==o[a];)a--;for(;1<=s&&0<=a;s--,a--)if(i[s]!==o[a]){if(1!==s||1!==a)do{if(s--,0>--a||i[s]!==o[a])return"\n"+i[s].replace(" at new "," at ")}while(1<=s&&0<=a);break}}}finally{q=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?H(e):""}function G(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=W(e.type,!1);case 11:return e=W(e.type.render,!1);case 22:return e=W(e.type._render,!1);case 1:return e=W(e.type,!0);default:return""}}function K(e){if(null==e)return null;if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case k:return"Fragment";case _:return"Portal";case C:return"Profiler";case T:return"StrictMode";case O:return"Suspense";case P:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case I:return(e.displayName||"Context")+".Consumer";case x:return(e._context.displayName||"Context")+".Provider";case N:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case R:return K(e.type);case D:return K(e._render);case A:t=e._payload,e=e._init;try{return K(e(t))}catch(n){}}return null}function Q(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function $(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Y(e){e._valueTracker||(e._valueTracker=function(e){var t=$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function X(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function J(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Z(e,t){var n=t.checked;return i({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function ee(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=Q(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function te(e,t){null!=(t=t.checked)&&b(e,"checked",t,!1)}function ne(e,t){te(e,t);var n=Q(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ie(e,t.type,n):t.hasOwnProperty("defaultValue")&&ie(e,t.type,Q(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function re(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ie(e,t,n){"number"===t&&J(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}function oe(e,t){return e=i({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function se(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i=n.length))throw Error(s(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:Q(n)}}function ce(e,t){var n=Q(t.value),r=Q(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ue(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var he={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function de(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function fe(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?de(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var pe,me,ge=(me=function(e,t){if(e.namespaceURI!==he.svg||"innerHTML"in e)e.innerHTML=t;else{for((pe=pe||document.createElement("div")).innerHTML="",t=pe.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return me(e,t)}))}:me);function ve(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var ye={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},we=["Webkit","ms","Moz","O"];function be(e,t,n){return null==t||"boolean"===typeof t||""===t?"":n||"number"!==typeof t||0===t||ye.hasOwnProperty(e)&&ye[e]?(""+t).trim():t+"px"}function Ee(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=be(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(ye).forEach((function(e){we.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ye[t]=ye[e]}))}));var Se=i({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function _e(e,t){if(t){if(Se[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(s(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(s(60));if("object"!==typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(s(61))}if(null!=t.style&&"object"!==typeof t.style)throw Error(s(62))}}function ke(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function Te(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Ce=null,xe=null,Ie=null;function Ne(e){if(e=ni(e)){if("function"!==typeof Ce)throw Error(s(280));var t=e.stateNode;t&&(t=ii(t),Ce(e.stateNode,e.type,t))}}function Oe(e){xe?Ie?Ie.push(e):Ie=[e]:xe=e}function Pe(){if(xe){var e=xe,t=Ie;if(Ie=xe=null,Ne(e),t)for(e=0;e(r=31-Ht(r))?0:1<n;n++)t.push(e);return t}function zt(e,t,n){e.pendingLanes|=t;var r=t-1;e.suspendedLanes&=r,e.pingedLanes&=r,(e=e.eventTimes)[t=31-Ht(t)]=n}var Ht=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(qt(e)/Wt|0)|0},qt=Math.log,Wt=Math.LN2;var Gt=o.unstable_UserBlockingPriority,Kt=o.unstable_runWithPriority,Qt=!0;function $t(e,t,n,r){Me||De();var i=Xt,o=Me;Me=!0;try{Ae(i,e,t,n,r)}finally{(Me=o)||Fe()}}function Yt(e,t,n,r){Kt(Gt,Xt.bind(null,e,t,n,r))}function Xt(e,t,n,r){var i;if(Qt)if((i=0===(4&t))&&0=jn),Vn=String.fromCharCode(32),Bn=!1;function zn(e,t){switch(e){case"keyup":return-1!==Ln.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hn(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var qn=!1;var Wn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Gn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Wn[e.type]:"textarea"===t}function Kn(e,t,n,r){Oe(r),0<(t=Mr(t,"onChange")).length&&(n=new dn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Qn=null,$n=null;function Yn(e){Ir(e,0)}function Xn(e){if(X(ri(e)))return e}function Jn(e,t){if("change"===e)return t}var Zn=!1;if(h){var er;if(h){var tr="oninput"in document;if(!tr){var nr=document.createElement("div");nr.setAttribute("oninput","return;"),tr="function"===typeof nr.oninput}er=tr}else er=!1;Zn=er&&(!document.documentMode||9=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=dr(r)}}function pr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?pr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function mr(){for(var e=window,t=J();t instanceof e.HTMLIFrameElement;){try{var n="string"===typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=J((e=t.contentWindow).document)}return t}function gr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var vr=h&&"documentMode"in document&&11>=document.documentMode,yr=null,wr=null,br=null,Er=!1;function Sr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;Er||null==yr||yr!==J(r)||("selectionStart"in(r=yr)&&gr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},br&&hr(br,r)||(br=r,0<(r=Mr(wr,"onSelect")).length&&(t=new dn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=yr)))}Dt("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),Dt("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),Dt(At,2);for(var _r="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),kr=0;kr<_r.length;kr++)Rt.set(_r[kr],0);u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Cr=new Set("cancel close invalid load scroll toggle".split(" ").concat(Tr));function xr(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,i,o,a,l,c){if(Qe.apply(this,arguments),He){if(!He)throw Error(s(198));var u=qe;He=!1,qe=null,We||(We=!0,Ge=u)}}(r,t,void 0,e),e.currentTarget=null}function Ir(e,t){t=0!==(4&t);for(var n=0;nai||(e.current=si[ai],si[ai]=null,ai--)}function ui(e,t){ai++,si[ai]=e.current,e.current=t}var hi={},di=li(hi),fi=li(!1),pi=hi;function mi(e,t){var n=e.type.contextTypes;if(!n)return hi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function gi(e){return null!==(e=e.childContextTypes)&&void 0!==e}function vi(){ci(fi),ci(di)}function yi(e,t,n){if(di.current!==hi)throw Error(s(168));ui(di,t),ui(fi,n)}function wi(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!==typeof r.getChildContext)return n;for(var o in r=r.getChildContext())if(!(o in e))throw Error(s(108,K(t)||"Unknown",o));return i({},n,r)}function bi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hi,pi=di.current,ui(di,e),ui(fi,fi.current),!0}function Ei(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=wi(e,t,pi),r.__reactInternalMemoizedMergedChildContext=e,ci(fi),ci(di),ui(di,e)):ci(fi),ui(fi,n)}var Si=null,_i=null,ki=o.unstable_runWithPriority,Ti=o.unstable_scheduleCallback,Ci=o.unstable_cancelCallback,xi=o.unstable_shouldYield,Ii=o.unstable_requestPaint,Ni=o.unstable_now,Oi=o.unstable_getCurrentPriorityLevel,Pi=o.unstable_ImmediatePriority,Ri=o.unstable_UserBlockingPriority,Ai=o.unstable_NormalPriority,Di=o.unstable_LowPriority,Li=o.unstable_IdlePriority,Mi={},ji=void 0!==Ii?Ii:function(){},Fi=null,Ui=null,Vi=!1,Bi=Ni(),zi=1e4>Bi?Ni:function(){return Ni()-Bi};function Hi(){switch(Oi()){case Pi:return 99;case Ri:return 98;case Ai:return 97;case Di:return 96;case Li:return 95;default:throw Error(s(332))}}function qi(e){switch(e){case 99:return Pi;case 98:return Ri;case 97:return Ai;case 96:return Di;case 95:return Li;default:throw Error(s(332))}}function Wi(e,t){return e=qi(e),ki(e,t)}function Gi(e,t,n){return e=qi(e),Ti(e,t,n)}function Ki(){if(null!==Ui){var e=Ui;Ui=null,Ci(e)}Qi()}function Qi(){if(!Vi&&null!==Fi){Vi=!0;var e=0;try{var t=Fi;Wi(99,(function(){for(;em?(g=h,h=null):g=h.sibling;var v=f(i,h,a[m],l);if(null===v){null===h&&(h=g);break}e&&h&&null===v.alternate&&t(i,h),s=o(v,s,m),null===u?c=v:u.sibling=v,u=v,h=g}if(m===a.length)return n(i,h),c;if(null===h){for(;mg?(v=m,m=null):v=m.sibling;var w=f(i,m,y.value,c);if(null===w){null===m&&(m=v);break}e&&m&&null===w.alternate&&t(i,m),a=o(w,a,g),null===h?u=w:h.sibling=w,h=w,m=v}if(y.done)return n(i,m),u;if(null===m){for(;!y.done;g++,y=l.next())null!==(y=d(i,y.value,c))&&(a=o(y,a,g),null===h?u=y:h.sibling=y,h=y);return u}for(m=r(i,m);!y.done;g++,y=l.next())null!==(y=p(m,i,g,y.value,c))&&(e&&null!==y.alternate&&m.delete(null===y.key?g:y.key),a=o(y,a,g),null===h?u=y:h.sibling=y,h=y);return e&&m.forEach((function(e){return t(i,e)})),u}return function(e,r,o,l){var c="object"===typeof o&&null!==o&&o.type===k&&null===o.key;c&&(o=o.props.children);var u="object"===typeof o&&null!==o;if(u)switch(o.$$typeof){case S:e:{for(u=o.key,c=r;null!==c;){if(c.key===u){if(7===c.tag){if(o.type===k){n(e,c.sibling),(r=i(c,o.props.children)).return=e,e=r;break e}}else if(c.elementType===o.type){n(e,c.sibling),(r=i(c,o.props)).ref=_o(e,c,o),r.return=e,e=r;break e}n(e,c);break}t(e,c),c=c.sibling}o.type===k?((r=Ql(o.props.children,e.mode,l,o.key)).return=e,e=r):((l=Kl(o.type,o.key,o.props,null,e.mode,l)).ref=_o(e,r,o),l.return=e,e=l)}return a(e);case _:e:{for(c=o.key;null!==r;){if(r.key===c){if(4===r.tag&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),(r=i(r,o.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Xl(o,e.mode,l)).return=e,e=r}return a(e)}if("string"===typeof o||"number"===typeof o)return o=""+o,null!==r&&6===r.tag?(n(e,r.sibling),(r=i(r,o)).return=e,e=r):(n(e,r),(r=Yl(o,e.mode,l)).return=e,e=r),a(e);if(So(o))return m(e,r,o,l);if(z(o))return g(e,r,o,l);if(u&&ko(e,o),"undefined"===typeof o&&!c)switch(e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(s(152,K(e.type)||"Component"))}return n(e,r)}}var Co=To(!0),xo=To(!1),Io={},No=li(Io),Oo=li(Io),Po=li(Io);function Ro(e){if(e===Io)throw Error(s(174));return e}function Ao(e,t){switch(ui(Po,t),ui(Oo,e),ui(No,Io),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:fe(null,"");break;default:t=fe(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}ci(No),ui(No,t)}function Do(){ci(No),ci(Oo),ci(Po)}function Lo(e){Ro(Po.current);var t=Ro(No.current),n=fe(t,e.type);t!==n&&(ui(Oo,e),ui(No,n))}function Mo(e){Oo.current===e&&(ci(No),ci(Oo))}var jo=li(0);function Fo(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(64&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Uo=null,Vo=null,Bo=!1;function zo(e,t){var n=ql(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function Ho(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);default:return!1}}function qo(e){if(Bo){var t=Vo;if(t){var n=t;if(!Ho(e,t)){if(!(t=Kr(n.nextSibling))||!Ho(e,t))return e.flags=-1025&e.flags|2,Bo=!1,void(Uo=e);zo(Uo,n)}Uo=e,Vo=Kr(t.firstChild)}else e.flags=-1025&e.flags|2,Bo=!1,Uo=e}}function Wo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Uo=e}function Go(e){if(e!==Uo)return!1;if(!Bo)return Wo(e),Bo=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!Hr(t,e.memoizedProps))for(t=Vo;t;)zo(e,t),t=Kr(t.nextSibling);if(Wo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(s(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){Vo=Kr(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}Vo=null}}else Vo=Uo?Kr(e.stateNode.nextSibling):null;return!0}function Ko(){Vo=Uo=null,Bo=!1}var Qo=[];function $o(){for(var e=0;eo))throw Error(s(301));o+=1,ts=es=null,t.updateQueue=null,Yo.current=Ds,e=n(r,i)}while(rs)}if(Yo.current=Ps,t=null!==es&&null!==es.next,Jo=0,ts=es=Zo=null,ns=!1,t)throw Error(s(300));return e}function as(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ts?Zo.memoizedState=ts=e:ts=ts.next=e,ts}function ls(){if(null===es){var e=Zo.alternate;e=null!==e?e.memoizedState:null}else e=es.next;var t=null===ts?Zo.memoizedState:ts.next;if(null!==t)ts=t,es=e;else{if(null===e)throw Error(s(310));e={memoizedState:(es=e).memoizedState,baseState:es.baseState,baseQueue:es.baseQueue,queue:es.queue,next:null},null===ts?Zo.memoizedState=ts=e:ts=ts.next=e}return ts}function cs(e,t){return"function"===typeof t?t(e):t}function us(e){var t=ls(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=es,i=r.baseQueue,o=n.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(null!==i){i=i.next,r=r.baseState;var l=a=o=null,c=i;do{var u=c.lane;if((Jo&u)===u)null!==l&&(l=l.next={lane:0,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null}),r=c.eagerReducer===e?c.eagerState:e(r,c.action);else{var h={lane:u,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null};null===l?(a=l=h,o=r):l=l.next=h,Zo.lanes|=u,Ba|=u}c=c.next}while(null!==c&&c!==i);null===l?o=r:l.next=a,cr(r,t.memoizedState)||(Ms=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function hs(e){var t=ls(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);cr(o,t.memoizedState)||(Ms=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ds(e,t,n){var r=t._getVersion;r=r(t._source);var i=t._workInProgressVersionPrimary;if(null!==i?e=i===r:(e=e.mutableReadLanes,(e=(Jo&e)===e)&&(t._workInProgressVersionPrimary=r,Qo.push(t))),e)return n(t._source);throw Qo.push(t),Error(s(350))}function fs(e,t,n,r){var i=Aa;if(null===i)throw Error(s(349));var o=t._getVersion,a=o(t._source),l=Yo.current,c=l.useState((function(){return ds(i,t,n)})),u=c[1],h=c[0];c=ts;var d=e.memoizedState,f=d.refs,p=f.getSnapshot,m=d.source;d=d.subscribe;var g=Zo;return e.memoizedState={refs:f,source:t,subscribe:r},l.useEffect((function(){f.getSnapshot=n,f.setSnapshot=u;var e=o(t._source);if(!cr(a,e)){e=n(t._source),cr(h,e)||(u(e),e=fl(g),i.mutableReadLanes|=e&i.pendingLanes),e=i.mutableReadLanes,i.entangledLanes|=e;for(var r=i.entanglements,s=e;0n?98:n,(function(){e(!0)})),Wi(97<\/script>",e=e.removeChild(e.firstChild)):"string"===typeof r.is?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),"select"===n&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[Xr]=t,e[Jr]=r,Ks(e,t,!1,!1),t.stateNode=e,c=ke(n,r),n){case"dialog":Nr("cancel",e),Nr("close",e),o=r;break;case"iframe":case"object":case"embed":Nr("load",e),o=r;break;case"video":case"audio":for(o=0;oGa&&(t.flags|=64,a=!0,sa(r,!1),t.lanes=33554432)}else{if(!a)if(null!==(e=Fo(c))){if(t.flags|=64,a=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),sa(r,!0),null===r.tail&&"hidden"===r.tailMode&&!c.alternate&&!Bo)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*zi()-r.renderingStartTime>Ga&&1073741824!==n&&(t.flags|=64,a=!0,sa(r,!1),t.lanes=33554432);r.isBackwards?(c.sibling=t.child,t.child=c):(null!==(n=r.last)?n.sibling=c:t.child=c,r.last=c)}return null!==r.tail?(n=r.tail,r.rendering=n,r.tail=n.sibling,r.lastEffect=t.lastEffect,r.renderingStartTime=zi(),n.sibling=null,t=jo.current,ui(jo,a?1&t|2:1&t),n):null;case 23:case 24:return _l(),null!==e&&null!==e.memoizedState!==(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==r.mode&&(t.flags|=4),null}throw Error(s(156,t.tag))}function la(e){switch(e.tag){case 1:gi(e.type)&&vi();var t=e.flags;return 4096&t?(e.flags=-4097&t|64,e):null;case 3:if(Do(),ci(fi),ci(di),$o(),0!==(64&(t=e.flags)))throw Error(s(285));return e.flags=-4097&t|64,e;case 5:return Mo(e),null;case 13:return ci(jo),4096&(t=e.flags)?(e.flags=-4097&t|64,e):null;case 19:return ci(jo),null;case 4:return Do(),null;case 10:return no(e),null;case 23:case 24:return _l(),null;default:return null}}function ca(e,t){try{var n="",r=t;do{n+=G(r),r=r.return}while(r);var i=n}catch(o){i="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:i}}function ua(e,t){try{console.error(t.value)}catch(n){setTimeout((function(){throw n}))}}Ks=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Qs=function(){},$s=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Ro(No.current);var s,a=null;switch(n){case"input":o=Z(e,o),r=Z(e,r),a=[];break;case"option":o=oe(e,o),r=oe(e,r),a=[];break;case"select":o=i({},o,{value:void 0}),r=i({},r,{value:void 0}),a=[];break;case"textarea":o=ae(e,o),r=ae(e,r),a=[];break;default:"function"!==typeof o.onClick&&"function"===typeof r.onClick&&(e.onclick=Ur)}for(h in _e(n,r),n=null,o)if(!r.hasOwnProperty(h)&&o.hasOwnProperty(h)&&null!=o[h])if("style"===h){var c=o[h];for(s in c)c.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else"dangerouslySetInnerHTML"!==h&&"children"!==h&&"suppressContentEditableWarning"!==h&&"suppressHydrationWarning"!==h&&"autoFocus"!==h&&(l.hasOwnProperty(h)?a||(a=[]):(a=a||[]).push(h,null));for(h in r){var u=r[h];if(c=null!=o?o[h]:void 0,r.hasOwnProperty(h)&&u!==c&&(null!=u||null!=c))if("style"===h)if(c){for(s in c)!c.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in u)u.hasOwnProperty(s)&&c[s]!==u[s]&&(n||(n={}),n[s]=u[s])}else n||(a||(a=[]),a.push(h,n)),n=u;else"dangerouslySetInnerHTML"===h?(u=u?u.__html:void 0,c=c?c.__html:void 0,null!=u&&c!==u&&(a=a||[]).push(h,u)):"children"===h?"string"!==typeof u&&"number"!==typeof u||(a=a||[]).push(h,""+u):"suppressContentEditableWarning"!==h&&"suppressHydrationWarning"!==h&&(l.hasOwnProperty(h)?(null!=u&&"onScroll"===h&&Nr("scroll",e),a||c===u||(a=[])):"object"===typeof u&&null!==u&&u.$$typeof===L?u.toString():(a=a||[]).push(h,u))}n&&(a=a||[]).push("style",n);var h=a;(t.updateQueue=h)&&(t.flags|=4)}},Ys=function(e,t,n,r){n!==r&&(t.flags|=4)};var ha="function"===typeof WeakMap?WeakMap:Map;function da(e,t,n){(n=co(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ya||(Ya=!0,Xa=r),ua(0,t)},n}function fa(e,t,n){(n=co(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"===typeof r){var i=t.value;n.payload=function(){return ua(0,t),r(i)}}var o=e.stateNode;return null!==o&&"function"===typeof o.componentDidCatch&&(n.callback=function(){"function"!==typeof r&&(null===Ja?Ja=new Set([this]):Ja.add(this),ua(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}var pa="function"===typeof WeakSet?WeakSet:Set;function ma(e){var t=e.ref;if(null!==t)if("function"===typeof t)try{t(null)}catch(n){Vl(e,n)}else t.current=null}function ga(e,t){switch(t.tag){case 0:case 11:case 15:case 22:case 5:case 6:case 4:case 17:return;case 1:if(256&t.flags&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:Yi(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(256&t.flags&&Gr(t.stateNode.containerInfo))}throw Error(s(163))}function va(e,t,n){switch(n.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3===(3&e.tag)){var r=e.create;e.destroy=r()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var i=e;r=i.next,0!==(4&(i=i.tag))&&0!==(1&i)&&(jl(n,e),Ml(n,e)),e=r}while(e!==t)}return;case 1:return e=n.stateNode,4&n.flags&&(null===t?e.componentDidMount():(r=n.elementType===n.type?t.memoizedProps:Yi(n.type,t.memoizedProps),e.componentDidUpdate(r,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=n.updateQueue)&&po(n,t,e));case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:case 1:e=n.child.stateNode}po(n,t,e)}return;case 5:return e=n.stateNode,void(null===t&&4&n.flags&&zr(n.type,n.memoizedProps)&&e.focus());case 6:case 4:case 12:case 19:case 17:case 20:case 21:case 23:case 24:return;case 13:return void(null===n.memoizedState&&(n=n.alternate,null!==n&&(n=n.memoizedState,null!==n&&(n=n.dehydrated,null!==n&&Et(n)))))}throw Error(s(163))}function ya(e,t){for(var n=e;;){if(5===n.tag){var r=n.stateNode;if(t)"function"===typeof(r=r.style).setProperty?r.setProperty("display","none","important"):r.display="none";else{r=n.stateNode;var i=n.memoizedProps.style;i=void 0!==i&&null!==i&&i.hasOwnProperty("display")?i.display:null,r.style.display=be("display",i)}}else if(6===n.tag)n.stateNode.nodeValue=t?"":n.memoizedProps;else if((23!==n.tag&&24!==n.tag||null===n.memoizedState||n===e)&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function wa(e,t){if(_i&&"function"===typeof _i.onCommitFiberUnmount)try{_i.onCommitFiberUnmount(Si,t)}catch(o){}switch(t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var n=e=e.next;do{var r=n,i=r.destroy;if(r=r.tag,void 0!==i)if(0!==(4&r))jl(t,n);else{r=t;try{i()}catch(o){Vl(r,o)}}n=n.next}while(n!==e)}break;case 1:if(ma(t),"function"===typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(o){Vl(t,o)}break;case 5:ma(t);break;case 4:Ta(e,t)}}function ba(e){e.alternate=null,e.child=null,e.dependencies=null,e.firstEffect=null,e.lastEffect=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.return=null,e.updateQueue=null}function Ea(e){return 5===e.tag||3===e.tag||4===e.tag}function Sa(e){e:{for(var t=e.return;null!==t;){if(Ea(t))break e;t=t.return}throw Error(s(160))}var n=t;switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw Error(s(161))}16&n.flags&&(ve(t,""),n.flags&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||Ea(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.flags)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.flags)){n=n.stateNode;break e}}r?_a(e,n,t):ka(e,n,t)}function _a(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!==(n=n._reactRootContainer)&&void 0!==n||null!==t.onclick||(t.onclick=Ur));else if(4!==r&&null!==(e=e.child))for(_a(e,t,n),e=e.sibling;null!==e;)_a(e,t,n),e=e.sibling}function ka(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(ka(e,t,n),e=e.sibling;null!==e;)ka(e,t,n),e=e.sibling}function Ta(e,t){for(var n,r,i=t,o=!1;;){if(!o){o=i.return;e:for(;;){if(null===o)throw Error(s(160));switch(n=o.stateNode,o.tag){case 5:r=!1;break e;case 3:case 4:n=n.containerInfo,r=!0;break e}o=o.return}o=!0}if(5===i.tag||6===i.tag){e:for(var a=e,l=i,c=l;;)if(wa(a,c),null!==c.child&&4!==c.tag)c.child.return=c,c=c.child;else{if(c===l)break e;for(;null===c.sibling;){if(null===c.return||c.return===l)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}r?(a=n,l=i.stateNode,8===a.nodeType?a.parentNode.removeChild(l):a.removeChild(l)):n.removeChild(i.stateNode)}else if(4===i.tag){if(null!==i.child){n=i.stateNode.containerInfo,r=!0,i.child.return=i,i=i.child;continue}}else if(wa(e,i),null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;4===(i=i.return).tag&&(o=!1)}i.sibling.return=i.return,i=i.sibling}}function Ca(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:var n=t.updateQueue;if(null!==(n=null!==n?n.lastEffect:null)){var r=n=n.next;do{3===(3&r.tag)&&(e=r.destroy,r.destroy=void 0,void 0!==e&&e()),r=r.next}while(r!==n)}return;case 1:case 12:case 17:return;case 5:if(null!=(n=t.stateNode)){r=t.memoizedProps;var i=null!==e?e.memoizedProps:r;e=t.type;var o=t.updateQueue;if(t.updateQueue=null,null!==o){for(n[Jr]=r,"input"===e&&"radio"===r.type&&null!=r.name&&te(n,r),ke(e,i),t=ke(e,r),i=0;ii&&(i=a),n&=~o}if(n=i,10<(n=(120>(n=zi()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Na(n/1960))-n)){e.timeoutHandle=qr(Rl.bind(null,e),n);break}Rl(e);break;default:throw Error(s(329))}}return gl(e,zi()),e.callbackNode===t?vl.bind(null,e):null}function yl(e,t){for(t&=~Ha,t&=~za,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0 component higher in the tree to provide a loading indicator or placeholder to display.")}5!==Fa&&(Fa=2),l=ca(l,a),d=s;do{switch(d.tag){case 3:o=l,d.flags|=4096,t&=-t,d.lanes|=t,ho(d,da(0,o,t));break e;case 1:o=l;var E=d.type,S=d.stateNode;if(0===(64&d.flags)&&("function"===typeof E.getDerivedStateFromError||null!==S&&"function"===typeof S.componentDidCatch&&(null===Ja||!Ja.has(S)))){d.flags|=4096,t&=-t,d.lanes|=t,ho(d,fa(d,o,t));break e}}d=d.return}while(null!==d)}Pl(n)}catch(_){t=_,Da===n&&null!==n&&(Da=n=n.return);continue}break}}function Cl(){var e=Oa.current;return Oa.current=Ps,null===e?Ps:e}function xl(e,t){var n=Ra;Ra|=16;var r=Cl();for(Aa===e&&La===t||kl(e,t);;)try{Il();break}catch(i){Tl(e,i)}if(to(),Ra=n,Oa.current=r,null!==Da)throw Error(s(261));return Aa=null,La=0,Fa}function Il(){for(;null!==Da;)Ol(Da)}function Nl(){for(;null!==Da&&!xi();)Ol(Da)}function Ol(e){var t=Qa(e.alternate,e,Ma);e.memoizedProps=e.pendingProps,null===t?Pl(e):Da=t,Pa.current=null}function Pl(e){var t=e;do{var n=t.alternate;if(e=t.return,0===(2048&t.flags)){if(null!==(n=aa(n,t,Ma)))return void(Da=n);if(24!==(n=t).tag&&23!==n.tag||null===n.memoizedState||0!==(1073741824&Ma)||0===(4&n.mode)){for(var r=0,i=n.child;null!==i;)r|=i.lanes|i.childLanes,i=i.sibling;n.childLanes=r}null!==e&&0===(2048&e.flags)&&(null===e.firstEffect&&(e.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=t.firstEffect),e.lastEffect=t.lastEffect),1a&&(l=a,a=S,S=l),l=fr(w,S),o=fr(w,a),l&&o&&(1!==E.rangeCount||E.anchorNode!==l.node||E.anchorOffset!==l.offset||E.focusNode!==o.node||E.focusOffset!==o.offset)&&((b=b.createRange()).setStart(l.node,l.offset),E.removeAllRanges(),S>a?(E.addRange(b),E.extend(o.node,o.offset)):(b.setEnd(o.node,o.offset),E.addRange(b))))),b=[];for(E=w;E=E.parentNode;)1===E.nodeType&&b.push({element:E,left:E.scrollLeft,top:E.scrollTop});for("function"===typeof w.focus&&w.focus(),w=0;wzi()-Wa?kl(e,0):Ha|=n),gl(e,t)}function zl(e,t){var n=e.stateNode;null!==n&&n.delete(t),0===(t=0)&&(0===(2&(t=e.mode))?t=1:0===(4&t)?t=99===Hi()?1:2:(0===ll&&(ll=Va),0===(t=Vt(62914560&~ll))&&(t=4194304))),n=dl(),null!==(e=ml(e,t))&&(zt(e,t,n),gl(e,n))}function Hl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function ql(e,t,n,r){return new Hl(e,t,n,r)}function Wl(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Gl(e,t){var n=e.alternate;return null===n?((n=ql(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Kl(e,t,n,r,i,o){var a=2;if(r=e,"function"===typeof e)Wl(e)&&(a=1);else if("string"===typeof e)a=5;else e:switch(e){case k:return Ql(n.children,i,o,t);case M:a=8,i|=16;break;case T:a=8,i|=1;break;case C:return(e=ql(12,n,t,8|i)).elementType=C,e.type=C,e.lanes=o,e;case O:return(e=ql(13,n,t,i)).type=O,e.elementType=O,e.lanes=o,e;case P:return(e=ql(19,n,t,i)).elementType=P,e.lanes=o,e;case j:return $l(n,i,o,t);case F:return(e=ql(24,n,t,i)).elementType=F,e.lanes=o,e;default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case x:a=10;break e;case I:a=9;break e;case N:a=11;break e;case R:a=14;break e;case A:a=16,r=null;break e;case D:a=22;break e}throw Error(s(130,null==e?e:typeof e,""))}return(t=ql(a,n,t,i)).elementType=e,t.type=r,t.lanes=o,t}function Ql(e,t,n,r){return(e=ql(7,e,r,t)).lanes=n,e}function $l(e,t,n,r){return(e=ql(23,e,r,t)).elementType=j,e.lanes=n,e}function Yl(e,t,n){return(e=ql(6,e,null,t)).lanes=n,e}function Xl(e,t,n){return(t=ql(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Jl(e,t,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=Bt(0),this.expirationTimes=Bt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bt(0),this.mutableSourceEagerHydrationData=null}function Zl(e,t,n,r){var i=t.current,o=dl(),a=fl(i);e:if(n){t:{if($e(n=n._reactInternals)!==n||1!==n.tag)throw Error(s(170));var l=n;do{switch(l.tag){case 3:l=l.stateNode.context;break t;case 1:if(gi(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break t}}l=l.return}while(null!==l);throw Error(s(171))}if(1===n.tag){var c=n.type;if(gi(c)){n=wi(n,c,l);break e}}n=l}else n=hi;return null===t.context?t.context=n:t.pendingContext=n,(t=co(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),uo(i,t),pl(i,a,o),a}function ec(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function tc(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n{"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(730)},82:(e,t)=>{"use strict";var n="function"===typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,i=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,a=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,h=n?Symbol.for("react.concurrent_mode"):60111,d=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,m=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,v=n?Symbol.for("react.block"):60121,y=n?Symbol.for("react.fundamental"):60117,w=n?Symbol.for("react.responder"):60118,b=n?Symbol.for("react.scope"):60119;function E(e){if("object"===typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case h:case o:case a:case s:case f:return e;default:switch(e=e&&e.$$typeof){case c:case d:case g:case m:case l:return e;default:return t}}case i:return t}}}function S(e){return E(e)===h}t.AsyncMode=u,t.ConcurrentMode=h,t.ContextConsumer=c,t.ContextProvider=l,t.Element=r,t.ForwardRef=d,t.Fragment=o,t.Lazy=g,t.Memo=m,t.Portal=i,t.Profiler=a,t.StrictMode=s,t.Suspense=f,t.isAsyncMode=function(e){return S(e)||E(e)===u},t.isConcurrentMode=S,t.isContextConsumer=function(e){return E(e)===c},t.isContextProvider=function(e){return E(e)===l},t.isElement=function(e){return"object"===typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return E(e)===d},t.isFragment=function(e){return E(e)===o},t.isLazy=function(e){return E(e)===g},t.isMemo=function(e){return E(e)===m},t.isPortal=function(e){return E(e)===i},t.isProfiler=function(e){return E(e)===a},t.isStrictMode=function(e){return E(e)===s},t.isSuspense=function(e){return E(e)===f},t.isValidElementType=function(e){return"string"===typeof e||"function"===typeof e||e===o||e===h||e===a||e===s||e===f||e===p||"object"===typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===m||e.$$typeof===l||e.$$typeof===c||e.$$typeof===d||e.$$typeof===y||e.$$typeof===w||e.$$typeof===b||e.$$typeof===v)},t.typeOf=E},86:(e,t,n)=>{"use strict";e.exports=n(82)},153:(e,t,n)=>{"use strict";n(123);var r=n(43),i=60103;if(t.Fragment=60107,"function"===typeof Symbol&&Symbol.for){var o=Symbol.for;i=o("react.element"),t.Fragment=o("react.fragment")}var s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a=Object.prototype.hasOwnProperty,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,o={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!l.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:i,type:e,key:c,ref:u,props:o,_owner:s.current}}t.jsx=c,t.jsxs=c},202:(e,t,n)=>{"use strict";var r=n(123),i=60103,o=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var s=60109,a=60110,l=60112;t.Suspense=60113;var c=60115,u=60116;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;i=h("react.element"),o=h("react.portal"),t.Fragment=h("react.fragment"),t.StrictMode=h("react.strict_mode"),t.Profiler=h("react.profiler"),s=h("react.provider"),a=h("react.context"),l=h("react.forward_ref"),t.Suspense=h("react.suspense"),c=h("react.memo"),u=h("react.lazy")}var d="function"===typeof Symbol&&Symbol.iterator;function f(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n{"use strict";e.exports=n(202)},579:(e,t,n)=>{"use strict";e.exports=n(153)},234:(e,t)=>{"use strict";var n,r,i,o;if("object"===typeof performance&&"function"===typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}if("undefined"===typeof window||"function"!==typeof MessageChannel){var c=null,u=null,h=function(){if(null!==c)try{var e=t.unstable_now();c(!0,e),c=null}catch(n){throw setTimeout(h,0),n}};n=function(e){null!==c?setTimeout(n,0,e):(c=e,setTimeout(h,0))},r=function(e,t){u=setTimeout(e,t)},i=function(){clearTimeout(u)},t.unstable_shouldYield=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var d=window.setTimeout,f=window.clearTimeout;if("undefined"!==typeof console){var p=window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!==typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var m=!1,g=null,v=-1,y=5,w=0;t.unstable_shouldYield=function(){return t.unstable_now()>=w},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125>>1,i=e[r];if(!(void 0!==i&&0T(s,n))void 0!==l&&0>T(l,s)?(e[r]=l,e[a]=n,r=a):(e[r]=s,e[o]=n,r=o);else{if(!(void 0!==l&&0>T(l,n)))break e;e[r]=l,e[a]=n,r=a}}}return t}return null}function T(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var C=[],x=[],I=1,N=null,O=3,P=!1,R=!1,A=!1;function D(e){for(var t=_(x);null!==t;){if(null===t.callback)k(x);else{if(!(t.startTime<=e))break;k(x),t.sortIndex=t.expirationTime,S(C,t)}t=_(x)}}function L(e){if(A=!1,D(e),!R)if(null!==_(C))R=!0,n(M);else{var t=_(x);null!==t&&r(L,t.startTime-e)}}function M(e,n){R=!1,A&&(A=!1,i()),P=!0;var o=O;try{for(D(n),N=_(C);null!==N&&(!(N.expirationTime>n)||e&&!t.unstable_shouldYield());){var s=N.callback;if("function"===typeof s){N.callback=null,O=N.priorityLevel;var a=s(N.expirationTime<=n);n=t.unstable_now(),"function"===typeof a?N.callback=a:N===_(C)&&k(C),D(n)}else k(C);N=_(C)}if(null!==N)var l=!0;else{var c=_(x);null!==c&&r(L,c.startTime-n),l=!1}return l}finally{N=null,O=o,P=!1}}var j=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){R||P||(R=!0,n(M))},t.unstable_getCurrentPriorityLevel=function(){return O},t.unstable_getFirstCallbackNode=function(){return _(C)},t.unstable_next=function(e){switch(O){case 1:case 2:case 3:var t=3;break;default:t=O}var n=O;O=t;try{return e()}finally{O=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=j,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=O;O=e;try{return t()}finally{O=n}},t.unstable_scheduleCallback=function(e,o,s){var a=t.unstable_now();switch("object"===typeof s&&null!==s?s="number"===typeof(s=s.delay)&&0a?(e.sortIndex=s,S(x,e),null===_(C)&&e===_(x)&&(A?i():A=!0,r(L,s-a))):(e.sortIndex=l,S(C,e),R||P||(R=!0,n(M))),e},t.unstable_wrapCallback=function(e){var t=O;return function(){var n=O;O=t;try{return e.apply(this,arguments)}finally{O=n}}}},853:(e,t,n)=>{"use strict";e.exports=n(234)},440:e=>{"use strict";var t=function(){};e.exports=t}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;n.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"===typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"===typeof r.then)return r}var o=Object.create(null);n.r(o);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&r;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>s[e]=()=>r[e]));return s.default=()=>r,n.d(o,s),o}})(),n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e=n(43),t=n.t(e,2),r=n(950),i=n.t(r,2),o=e.createContext(null);var s=function(e){e()},a=function(){return s};var l={notify:function(){},get:function(){return[]}};function c(e,t){var n,r=l;function i(){s.onStateChange&&s.onStateChange()}function o(){n||(n=t?t.addNestedSub(i):e.subscribe(i),r=function(){var e=a(),t=null,n=null;return{clear:function(){t=null,n=null},notify:function(){e((function(){for(var e=t;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],n=t;n;)e.push(n),n=n.next;return e},subscribe:function(e){var r=!0,i=n={callback:e,next:null,prev:n};return i.prev?i.prev.next=i:t=i,function(){r&&null!==t&&(r=!1,i.next?i.next.prev=i.prev:n=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}())}var s={addNestedSub:function(e){return o(),r.subscribe(e)},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:i,isSubscribed:function(){return Boolean(n)},trySubscribe:o,tryUnsubscribe:function(){n&&(n(),n=void 0,r.clear(),r=l)},getListeners:function(){return r}};return s}var u="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?e.useLayoutEffect:e.useEffect;const h=function(t){var n=t.store,r=t.context,i=t.children,s=(0,e.useMemo)((function(){var e=c(n);return e.onStateChange=e.notifyNestedSubs,{store:n,subscription:e}}),[n]),a=(0,e.useMemo)((function(){return n.getState()}),[n]);u((function(){var e=s.subscription;return e.trySubscribe(),a!==n.getState()&&e.notifyNestedSubs(),function(){e.tryUnsubscribe(),e.onStateChange=null}}),[s,a]);var l=r||o;return e.createElement(l.Provider,{value:s},i)};n(219),n(86);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t>6|192,t[n++]=63&i|128):55296===(64512&i)&&r+1>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},T={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"===typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i>2,u=(3&t)<<4|s>>4;let h=(15&s)<<2|l>>6,d=63&l;a||(d=64,o||(h=64)),r.push(n[c],n[u],n[h],n[d])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(k(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n191&&i<224){const o=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){const o=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(o>>10)),t[r++]=String.fromCharCode(56320+(1023&o))}else{const o=e[n++],s=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&s)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i>4;if(r.push(l),64!==s){const e=o<<4&240|s>>2;if(r.push(e),64!==a){const e=s<<6&192|a;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class C extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const x=function(e){return function(e){const t=k(e);return T.encodeByteArray(t,!0)}(e).replace(/\./g,"")},I=function(e){try{return T.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};const N=()=>function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof n.g)return n.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,O=()=>{try{return N()||(()=>{if("undefined"===typeof process)return;const e={NODE_ENV:"production",PUBLIC_URL:"/backgammon",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"===typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(n){return}const t=e&&I(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info("Unable to get __FIREBASE_DEFAULTS__ due to: ".concat(e))}},P=e=>{var t,n;return null===(n=null===(t=O())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},R=e=>{const t=P(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error("Invalid host ".concat(t," with no separate hostname and port!"));const r=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),r]:[t.substring(0,n),r]},A=()=>{var e;return null===(e=O())||void 0===e?void 0:e.config},D=e=>{var t;return null===(t=O())||void 0===t?void 0:t["_".concat(e)]};class L{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"===typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}function M(){return"undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:""}function j(){return!function(){var e;const t=null===(e=O())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(n.g.process)}catch(r){return!1}}()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function F(){try{return"object"===typeof indexedDB}catch(e){return!1}}class U extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,U.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,V.prototype.create)}}class V{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e){const t=(arguments.length<=1?void 0:arguments[1])||{},n="".concat(this.service,"/").concat(e),r=this.errors[e],i=r?function(e,t){return e.replace(B,((e,n)=>{const r=t[n];return null!=r?String(r):"<".concat(n,"?>")}))}(r,t):"Error",o="".concat(this.serviceName,": ").concat(i," (").concat(n,").");return new U(n,o,t)}}const B=/\{\$([^}]+)}/g;function z(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const i of n){if(!r.includes(i))return!1;const n=e[i],o=t[i];if(H(n)&&H(o)){if(!z(n,o))return!1}else if(n!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function H(e){return null!==e&&"object"===typeof e}function q(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach((e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))})):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function W(e){const t={};return e.replace(/^\?/,"").split("&").forEach((e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}})),t}function G(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class K{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((()=>{e(this)})).catch((e=>{this.error(e)}))}next(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}complete(){this.forEachObserver((e=>{e.complete()})),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!==typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"===typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=Q),void 0===r.error&&(r.error=Q),void 0===r.complete&&(r.complete=Q);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}})),this.observers.push(r),i}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(n){"undefined"!==typeof console&&console.error&&console.error(n)}}))}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function Q(){}function $(e){return e&&e._delegate?e._delegate:e}class Y{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const X="[DEFAULT]";class J{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new L;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(n){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null===e||void 0===e?void 0:e.identifier),r=null!==(t=null===e||void 0===e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error("Service ".concat(this.name," is not available"))}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error("Mismatching Component ".concat(e.name," for Provider ").concat(this.name,"."));if(this.component)throw Error("Component for ".concat(this.name," has already been provided"));if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:X})}catch(t){}for(const[e,n]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:r});n.resolve(e)}catch(t){}}}}clearInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;return this.instances.has(e)}getOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;return this.instancesOptions.get(e)||{}}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error("".concat(this.name,"(").concat(n,") has already been initialized"));if(!this.isComponentSet())throw Error("Component ".concat(this.name," has not been registered yet"));const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[i,o]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(i)&&o.resolve(r)}return r}onInit(e,t){var n;const r=this.normalizeInstanceIdentifier(t),i=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;i.add(e),this.onInitCallbacks.set(r,i);const o=this.instances.get(r);return o&&e(o,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const i of n)try{i(e,t)}catch(r){}}getOrInitializeService(e){let{instanceIdentifier:t,options:n={}}=e,r=this.instances.get(t);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(i=t,i===X?void 0:i),options:n}),this.instances.set(t,r),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(r,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,r)}catch(o){}var i;return r||null}normalizeInstanceIdentifier(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;return this.component?this.component.multipleInstances?e:X:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class Z{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error("Component ".concat(e.name," has already been registered with ").concat(this.name));t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new J(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const ee=[];var te;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(te||(te={}));const ne={debug:te.DEBUG,verbose:te.VERBOSE,info:te.INFO,warn:te.WARN,error:te.ERROR,silent:te.SILENT},re=te.INFO,ie={[te.DEBUG]:"log",[te.VERBOSE]:"log",[te.INFO]:"info",[te.WARN]:"warn",[te.ERROR]:"error"},oe=function(e,t){if(t2?i-2:0),s=2;st.some((t=>e instanceof t));let le,ce;const ue=new WeakMap,he=new WeakMap,de=new WeakMap,fe=new WeakMap,pe=new WeakMap;let me={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return he.get(e);if("objectStoreNames"===t)return e.objectStoreNames||de.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return ye(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function ge(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(ce||(ce=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(){for(var t=arguments.length,n=new Array(t),r=0;r1?n-1:0),i=1;i{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)}));he.set(e,t)}(e),ae(e,le||(le=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,me):e)}function ye(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(ye(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)}));return t.then((t=>{t instanceof IDBCursor&&ue.set(t,e)})).catch((()=>{})),pe.set(t,e),t}(e);if(fe.has(e))return fe.get(e);const t=ve(e);return t!==e&&(fe.set(e,t),pe.set(t,e)),t}const we=e=>pe.get(e);const be=["get","getKey","getAll","getAllKeys","count"],Ee=["put","add","delete","clear"],Se=new Map;function _e(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!==typeof t)return;if(Se.get(t))return Se.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=Ee.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!be.includes(n))return;const o=async function(e){const t=this.transaction(e,i?"readwrite":"readonly");let o=t.store;for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l({...e,get:(t,n,r)=>_e(t,n)||e.get(t,n,r),has:(t,n)=>!!_e(t,n)||e.has(t,n)}))(me);class ke{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null===t||void 0===t?void 0:t.type)}(e)){const t=e.getImmediate();return"".concat(t.library,"/").concat(t.version)}return null})).filter((e=>e)).join(" ")}}const Te="@firebase/app",Ce="0.9.27",xe=new se("@firebase/app"),Ie="@firebase/app-compat",Ne="@firebase/analytics-compat",Oe="@firebase/analytics",Pe="@firebase/app-check-compat",Re="@firebase/app-check",Ae="@firebase/auth",De="@firebase/auth-compat",Le="@firebase/database",Me="@firebase/database-compat",je="@firebase/functions",Fe="@firebase/functions-compat",Ue="@firebase/installations",Ve="@firebase/installations-compat",Be="@firebase/messaging",ze="@firebase/messaging-compat",He="@firebase/performance",qe="@firebase/performance-compat",We="@firebase/remote-config",Ge="@firebase/remote-config-compat",Ke="@firebase/storage",Qe="@firebase/storage-compat",$e="@firebase/firestore",Ye="@firebase/firestore-compat",Xe="firebase",Je="[DEFAULT]",Ze={[Te]:"fire-core",[Ie]:"fire-core-compat",[Oe]:"fire-analytics",[Ne]:"fire-analytics-compat",[Re]:"fire-app-check",[Pe]:"fire-app-check-compat",[Ae]:"fire-auth",[De]:"fire-auth-compat",[Le]:"fire-rtdb",[Me]:"fire-rtdb-compat",[je]:"fire-fn",[Fe]:"fire-fn-compat",[Ue]:"fire-iid",[Ve]:"fire-iid-compat",[Be]:"fire-fcm",[ze]:"fire-fcm-compat",[He]:"fire-perf",[qe]:"fire-perf-compat",[We]:"fire-rc",[Ge]:"fire-rc-compat",[Ke]:"fire-gcs",[Qe]:"fire-gcs-compat",[$e]:"fire-fst",[Ye]:"fire-fst-compat","fire-js":"fire-js",[Xe]:"fire-js-all"},et=new Map,tt=new Map;function nt(e,t){try{e.container.addComponent(t)}catch(n){xe.debug("Component ".concat(t.name," failed to register with FirebaseApp ").concat(e.name),n)}}function rt(e){const t=e.name;if(tt.has(t))return xe.debug("There were multiple attempts to register component ".concat(t,".")),!1;tt.set(t,e);for(const n of et.values())nt(n,e);return!0}function it(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}const ot=new V("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});class st{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new Y("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw ot.create("app-deleted",{appName:this._name})}}const at="10.8.0";function lt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;if("object"!==typeof t){t={name:t}}const r=Object.assign({name:Je,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!==typeof i||!i)throw ot.create("bad-app-name",{appName:String(i)});if(n||(n=A()),!n)throw ot.create("no-options");const o=et.get(i);if(o){if(z(n,o.options)&&z(r,o.config))return o;throw ot.create("duplicate-app",{appName:i})}const s=new Z(i);for(const l of tt.values())s.addComponent(l);const a=new st(n,r,s);return et.set(i,a),a}function ct(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Je;const t=et.get(e);if(!t&&e===Je&&A())return lt();if(!t)throw ot.create("no-app",{appName:e});return t}function ut(e,t,n){var r;let i=null!==(r=Ze[e])&&void 0!==r?r:e;n&&(i+="-".concat(n));const o=i.match(/\s|\//),s=t.match(/\s|\//);if(o||s){const e=['Unable to register library "'.concat(i,'" with version "').concat(t,'":')];return o&&e.push('library name "'.concat(i,'" contains illegal characters (whitespace or "/")')),o&&s&&e.push("and"),s&&e.push('version name "'.concat(t,'" contains illegal characters (whitespace or "/")')),void xe.warn(e.join(" "))}rt(new Y("".concat(i,"-version"),(()=>({library:i,version:t})),"VERSION"))}const ht="firebase-heartbeat-database",dt=1,ft="firebase-heartbeat-store";let pt=null;function mt(){return pt||(pt=function(e,t){let{blocked:n,upgrade:r,blocking:i,terminated:o}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=indexedDB.open(e,t),a=ye(s);return r&&s.addEventListener("upgradeneeded",(e=>{r(ye(s.result),e.oldVersion,e.newVersion,ye(s.transaction),e)})),n&&s.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),a.then((e=>{o&&e.addEventListener("close",(()=>o())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),a}(ht,dt,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(ft)}catch(n){console.warn(n)}}}).catch((e=>{throw ot.create("idb-open",{originalErrorMessage:e.message})}))),pt}async function gt(e,t){try{const n=(await mt()).transaction(ft,"readwrite"),r=n.objectStore(ft);await r.put(t,vt(e)),await n.done}catch(n){if(n instanceof U)xe.warn(n.message);else{const e=ot.create("idb-set",{originalErrorMessage:null===n||void 0===n?void 0:n.message});xe.warn(e.message)}}}function vt(e){return"".concat(e.name,"!").concat(e.options.appId)}class yt{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new bt(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){var e,t;const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=wt();if((null!=(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||(this._heartbeatsCache=await this._heartbeatsCachePromise,null!=(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))&&this._heartbeatsCache.lastSentHeartbeatDate!==r&&!this._heartbeatsCache.heartbeats.some((e=>e.date===r)))return this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var e;if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=wt(),{heartbeatsToSend:n,unsentEntries:r}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024;const n=[];let r=e.slice();for(const i of e){const e=n.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),Et(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Et(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),i=x(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function wt(){return(new Date).toISOString().substring(0,10)}class bt{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!F()&&new Promise(((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(n){t(n)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await mt()).transaction(ft),n=await t.objectStore(ft).get(vt(e));return await t.done,n}catch(t){if(t instanceof U)xe.warn(t.message);else{const e=ot.create("idb-get",{originalErrorMessage:null===t||void 0===t?void 0:t.message});xe.warn(e.message)}}}(this.app);return(null===e||void 0===e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return gt(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return gt(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function Et(e){return x(JSON.stringify({version:2,heartbeats:e})).length}var St;St="",rt(new Y("platform-logger",(e=>new ke(e)),"PRIVATE")),rt(new Y("heartbeat",(e=>new yt(e)),"PRIVATE")),ut(Te,Ce,St),ut(Te,Ce,"esm2017"),ut("fire-js","");function _t(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r2?n-2:0),i=2;ie,"Short delay should be less than long delay!"),this.isMobile="undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(M())||"object"===typeof navigator&&"ReactNative"===navigator.product}get(){return Ut()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Bt(e,t){Lt(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?"".concat(n).concat(t.startsWith("/")?t.slice(1):t):n}class zt{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!==typeof self&&"fetch"in self?self.fetch:"undefined"!==typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!==typeof fetch?fetch:void Dt("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!==typeof self&&"Headers"in self?self.Headers:"undefined"!==typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!==typeof Headers?Headers:void Dt("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!==typeof self&&"Response"in self?self.Response:"undefined"!==typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!==typeof Response?Response:void Dt("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Ht={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},qt=new Vt(3e4,6e4);function Wt(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function Gt(e,t,n,r){return Kt(e,arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},(async()=>{let i={},o={};r&&("GET"===t?o=r:i={body:JSON.stringify(r)});const s=q(Object.assign({key:e.config.apiKey},o)).slice(1),a=await e._getAdditionalHeaders();return a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode),zt.fetch()($t(e,e.config.apiHost,n,s),Object.assign({method:t,headers:a,referrerPolicy:"no-referrer"},i))}))}async function Kt(e,t,n){e._canInitEmulator=!1;const r=Object.assign(Object.assign({},Ht),t);try{const t=new Xt(e),i=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw Jt(e,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const t=i.ok?o.errorMessage:o.error.message,[n,s]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Jt(e,"credential-already-in-use",o);if("EMAIL_EXISTS"===n)throw Jt(e,"email-already-in-use",o);if("USER_DISABLED"===n)throw Jt(e,"user-disabled",o);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(s)throw Pt(e,a,s);Nt(e,a)}}catch(i){if(i instanceof U)throw i;Nt(e,"network-request-failed",{message:String(i)})}}async function Qt(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const o=await Gt(e,t,n,r,i);return"mfaPendingCredential"in o&&Nt(e,"multi-factor-auth-required",{_serverResponse:o}),o}function $t(e,t,n,r){const i="".concat(t).concat(n,"?").concat(r);return e.config.emulator?Bt(e.config,i):"".concat(e.config.apiScheme,"://").concat(i)}function Yt(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Xt{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise(((e,t)=>{this.timer=setTimeout((()=>t(Ot(this.auth,"network-request-failed"))),qt.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Jt(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=Ot(e,t,r);return i.customData._tokenResponse=n,i}function Zt(e){return void 0!==e&&void 0!==e.enterprise}class en{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return Yt(t.enforcementState);return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}}async function tn(e,t){return Gt(e,"GET","/v2/recaptchaConfig",Wt(e,t))}function nn(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(t){}}function rn(e){return 1e3*Number(e)}function on(e){const[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return It("JWT malformed, contained fewer than 3 sections"),null;try{const e=I(n);return e?JSON.parse(e):(It("Failed to decode base64 JWT payload"),null)}catch(i){return It("Caught error parsing JWT payload as JSON",null===i||void 0===i?void 0:i.toString()),null}}async function sn(e,t){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2])return t;try{return await t}catch(n){throw n instanceof U&&function(e){let{code:t}=e;return t==="auth/".concat("user-disabled")||t==="auth/".concat("user-token-expired")}(n)&&e.auth.currentUser===e&&await e.auth.signOut(),n}}class an{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,e)}}schedule(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout((async()=>{await this.iteration()}),t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void((null===e||void 0===e?void 0:e.code)==="auth/".concat("network-request-failed")&&this.schedule(!0))}this.schedule()}}class ln{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=nn(this.lastLoginAt),this.creationTime=nn(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function cn(e){var t;const n=e.auth,r=await e.getIdToken(),i=await sn(e,async function(e,t){return Gt(e,"POST","/v1/accounts:lookup",t)}(n,{idToken:r}));At(null===i||void 0===i?void 0:i.users.length,n,"internal-error");const o=i.users[0];e._notifyReloadListener(o);const s=(null===(t=o.providerUserInfo)||void 0===t?void 0:t.length)?o.providerUserInfo.map((e=>{var{providerId:t}=e,n=_t(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=function(e,t){const n=e.filter((e=>!t.some((t=>t.providerId===e.providerId))));return[...n,...t]}(e.providerData,s),l=e.isAnonymous,c=!(e.email&&o.passwordHash)&&!(null===a||void 0===a?void 0:a.length),u=!!l&&c,h={uid:o.localId,displayName:o.displayName||null,photoURL:o.photoUrl||null,email:o.email||null,emailVerified:o.emailVerified||!1,phoneNumber:o.phoneNumber||null,tenantId:o.tenantId||null,providerData:a,metadata:new ln(o.createdAt,o.lastLoginAt),isAnonymous:u};Object.assign(e,h)}class un{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){At(e.idToken,"internal-error"),At("undefined"!==typeof e.idToken,"internal-error"),At("undefined"!==typeof e.refreshToken,"internal-error");const t="expiresIn"in e&&"undefined"!==typeof e.expiresIn?Number(e.expiresIn):function(e){const t=on(e);return At(t,"internal-error"),At("undefined"!==typeof t.exp,"internal-error"),At("undefined"!==typeof t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return At(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:r,expiresIn:i}=await async function(e,t){const n=await Kt(e,{},(async()=>{const n=q({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:i}=e.config,o=$t(e,r,"/v1/token","key=".concat(i)),s=await e._getAdditionalHeaders();return s["Content-Type"]="application/x-www-form-urlencoded",zt.fetch()(o,{method:"POST",headers:s,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:r,expirationTime:i}=t,o=new un;return n&&(At("string"===typeof n,"internal-error",{appName:e}),o.refreshToken=n),r&&(At("string"===typeof r,"internal-error",{appName:e}),o.accessToken=r),i&&(At("number"===typeof i,"internal-error",{appName:e}),o.expirationTime=i),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new un,this.toJSON())}_performRefresh(){return Dt("not implemented")}}function hn(e,t){At("string"===typeof e||"undefined"===typeof e,"internal-error",{appName:t})}class dn{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,i=_t(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new an(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new ln(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await sn(this,this.stsTokenManager.getToken(this.auth,e));return At(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=$(e),r=await n.getIdToken(t),i=on(r);At(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const o="object"===typeof i.firebase?i.firebase:void 0,s=null===o||void 0===o?void 0:o.sign_in_provider;return{claims:i,token:r,authTime:nn(rn(i.auth_time)),issuedAtTime:nn(rn(i.iat)),expirationTime:nn(rn(i.exp)),signInProvider:s||null,signInSecondFactor:(null===o||void 0===o?void 0:o.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=$(e);await cn(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(At(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map((e=>Object.assign({},e))),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new dn(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){At(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await cn(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await sn(this,async function(e,t){return Gt(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((e=>Object.assign({},e))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var n,r,i,o,s,a,l,c;const u=null!==(n=t.displayName)&&void 0!==n?n:void 0,h=null!==(r=t.email)&&void 0!==r?r:void 0,d=null!==(i=t.phoneNumber)&&void 0!==i?i:void 0,f=null!==(o=t.photoURL)&&void 0!==o?o:void 0,p=null!==(s=t.tenantId)&&void 0!==s?s:void 0,m=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,g=null!==(l=t.createdAt)&&void 0!==l?l:void 0,v=null!==(c=t.lastLoginAt)&&void 0!==c?c:void 0,{uid:y,emailVerified:w,isAnonymous:b,providerData:E,stsTokenManager:S}=t;At(y&&S,e,"internal-error");const _=un.fromJSON(this.name,S);At("string"===typeof y,e,"internal-error"),hn(u,e.name),hn(h,e.name),At("boolean"===typeof w,e,"internal-error"),At("boolean"===typeof b,e,"internal-error"),hn(d,e.name),hn(f,e.name),hn(p,e.name),hn(m,e.name),hn(g,e.name),hn(v,e.name);const k=new dn({uid:y,auth:e,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:_,createdAt:g,lastLoginAt:v});return E&&Array.isArray(E)&&(k.providerData=E.map((e=>Object.assign({},e)))),m&&(k._redirectEventId=m),k}static async _fromIdTokenResponse(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=new un;r.updateFromServerResponse(t);const i=new dn({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await cn(i),i}}const fn=new Map;function pn(e){Lt(e instanceof Function,"Expected a class definition");let t=fn.get(e);return t?(Lt(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,fn.set(e,t),t)}class mn{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}mn.type="NONE";const gn=mn;function vn(e,t,n){return"firebase".concat(":",e,":").concat(t,":").concat(n)}class yn{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:r,name:i}=this.auth;this.fullUserKey=vn(this.userKey,r.apiKey,i),this.fullPersistenceKey=vn("persistence",r.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?dn._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"authUser";if(!t.length)return new yn(pn(gn),e,n);const r=(await Promise.all(t.map((async e=>{if(await e._isAvailable())return e})))).filter((e=>e));let i=r[0]||pn(gn);const o=vn(n,e.config.apiKey,e.name);let s=null;for(const c of t)try{const t=await c._get(o);if(t){const n=dn._fromJSON(e,t);c!==i&&(s=n),i=c;break}}catch(l){}const a=r.filter((e=>e._shouldAllowMigration));return i._shouldAllowMigration&&a.length?(i=a[0],s&&await i._set(o,s.toJSON()),await Promise.all(t.map((async e=>{if(e!==i)try{await e._remove(o)}catch(l){}}))),new yn(i,e,n)):new yn(i,e,n)}}function wn(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(_n(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(bn(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Tn(t))return"Blackberry";if(Cn(t))return"Webos";if(En(t))return"Safari";if((t.includes("chrome/")||Sn(t))&&!t.includes("edge/"))return"Chrome";if(kn(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===(null===n||void 0===n?void 0:n.length))return n[1]}return"Other"}function bn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/firefox\//i.test(e)}function En(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:M()).toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Sn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/crios\//i.test(e)}function _n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/iemobile/i.test(e)}function kn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/android/i.test(e)}function Tn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/blackberry/i.test(e)}function Cn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/webos/i.test(e)}function xn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function In(){return function(){const e=M();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function Nn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return xn(e)||kn(e)||Cn(e)||Tn(e)||/windows phone/i.test(e)||_n(e)}function On(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];switch(e){case"Browser":t=wn(M());break;case"Worker":t="".concat(wn(M()),"-").concat(e);break;default:t=e}const r=n.length?n.join(","):"FirebaseCore-web";return"".concat(t,"/","JsCore","/").concat(at,"/").concat(r)}class Pn{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise(((n,r)=>{try{n(e(t))}catch(i){r(i)}}));n.onAbort=t,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(n){t.reverse();for(const e of t)try{e()}catch(Av){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===n||void 0===n?void 0:n.message})}}}class Rn{constructor(e){var t,n,r,i;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=o.minPasswordLength)&&void 0!==t?t:6,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),void 0!==o.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),void 0!==o.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),void 0!==o.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),void 0!==o.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(r=null===(n=e.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==r?r:"",this.forceUpgradeOnSignin=null!==(i=e.forceUpgradeOnSignin)&&void 0!==i&&i,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,r,i,o,s;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&(a.isValid=null===(t=a.meetsMinPasswordLength)||void 0===t||t),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(r=a.containsLowercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(i=a.containsUppercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(o=a.containsNumericCharacter)||void 0===o||o),a.isValid&&(a.isValid=null===(s=a.containsNonAlphanumericCharacter)||void 0===s||s),a}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let r=0;r="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,r,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}class An{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ln(this),this.idTokenSubscription=new Ln(this),this.beforeStateQueue=new Pn(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Ct,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=pn(t)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await yn.create(this,e),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(i){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUser(e){var t;const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,o=null===r||void 0===r?void 0:r._redirectEventId,s=await this.tryRedirectSignIn(e);n&&n!==o||!(null===s||void 0===s?void 0:s.user)||(r=s.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(o)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return At(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(n){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await cn(e)}catch(t){if((null===t||void 0===t?void 0:t.code)!=="auth/".concat("network-request-failed"))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"===typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?$(e):null;return t&&At(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this._deleted)return e&&At(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue((async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue((async()=>{await this.assertedPersistence.setPersistence(pn(e))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await async function(e){return Gt(e,"GET","/v2/passwordPolicy",Wt(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}(this),t=new Rn(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new V("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise(((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged((()=>{n(),e()}),t)}}))}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return Gt(e,"POST","/v2/accounts:revokeToken",Wt(e,t))}(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&pn(e)||this._popupRedirectResolver;At(t,this,"argument-error"),this.redirectPersistenceManager=await yn.create(this,[pn(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(e)))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return"".concat(this.config.authDomain,":").concat(this.config.apiKey,":").concat(this.name)}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const i="function"===typeof t?t:t.next.bind(t);let o=!1;const s=this._isInitialized?Promise.resolve():this._initializationPromise;if(At(s,this,"internal-error"),s.then((()=>{o||i(this.currentUser)})),"function"===typeof t){const i=e.addObserver(t,n,r);return()=>{o=!0,i()}}{const n=e.addObserver(t);return()=>{o=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return At(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=On(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var e;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null===t||void 0===t?void 0:t.error)&&function(e){if(xt.logLevel<=te.WARN){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rthis.observer=e))}get next(){return At(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Mn={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function jn(e){return Mn.loadJS(e)}function Fn(e){return"__".concat(e).concat(Math.floor(1e6*Math.random()))}class Un{constructor(e){this.type="recaptcha-enterprise",this.auth=Dn(e)}async verify(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"verify",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function n(t,n,r){const i=window.grecaptcha;Zt(i)?i.enterprise.ready((()=>{i.enterprise.execute(t,{action:e}).then((e=>{n(e)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((e,r)=>{(async function(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise((async(t,n)=>{tn(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new en(r);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((e=>{n(e)}))}))})(this.auth).then((i=>{if(!t&&Zt(window.grecaptcha))n(i,e,r);else{if("undefined"===typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));let t=Mn.recaptchaEnterpriseScript;0!==t.length&&(t+=i),jn(t).then((()=>{n(i,e,r)})).catch((e=>{r(e)}))}})).catch((e=>{r(e)}))}))}}async function Vn(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=new Un(e);let o;try{o=await i.verify(n)}catch(a){o=await i.verify(n,!0)}const s=Object.assign({},t);return r?Object.assign(s,{captchaResp:o}):Object.assign(s,{captchaResponse:o}),Object.assign(s,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(s,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),s}async function Bn(e,t,n,r){var i;if(null===(i=e._getRecaptchaConfig())||void 0===i?void 0:i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await Vn(e,t,n,"getOobCode"===n);return r(e,i)}return r(e,t).catch((async i=>{if(i.code==="auth/".concat("missing-recaptcha-token")){console.log("".concat(n," is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow."));const i=await Vn(e,t,n,"getOobCode"===n);return r(e,i)}return Promise.reject(i)}))}function zn(e,t,n){const r=Dn(e);At(r._canInitEmulator,r,"emulator-config-failed"),At(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const i=!!(null===n||void 0===n?void 0:n.disableWarnings),o=Hn(t),{host:s,port:a}=function(e){const t=Hn(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const e=i[1];return{host:e,port:qn(r.substr(e.length+1))}}{const[e,t]=r.split(":");return{host:e,port:qn(t)}}}(t),l=null===a?"":":".concat(a);r.config.emulator={url:"".concat(o,"//").concat(s).concat(l,"/")},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:s,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!==typeof console&&"function"===typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!==typeof window&&"undefined"!==typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function Hn(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function qn(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class Wn{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Dt("not implemented")}_getIdTokenResponse(e){return Dt("not implemented")}_linkToIdToken(e,t){return Dt("not implemented")}_getReauthenticationResolver(e){return Dt("not implemented")}}async function Gn(e,t){return Gt(e,"POST","/v1/accounts:signUp",t)}async function Kn(e,t){return Qt(e,"POST","/v1/accounts:signInWithPassword",Wt(e,t))}class Qn extends Wn{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new Qn(e,t,"password")}static _fromEmailAndCode(e,t){return new Qn(e,t,"emailLink",arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"===typeof e?JSON.parse(e):e;if((null===t||void 0===t?void 0:t.email)&&(null===t||void 0===t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return Bn(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",Kn);case"emailLink":return async function(e,t){return Qt(e,"POST","/v1/accounts:signInWithEmailLink",Wt(e,t))}(e,{email:this._email,oobCode:this._password});default:Nt(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return Bn(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Gn);case"emailLink":return async function(e,t){return Qt(e,"POST","/v1/accounts:signInWithEmailLink",Wt(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:Nt(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function $n(e,t){return Qt(e,"POST","/v1/accounts:signInWithIdp",Wt(e,t))}class Yn extends Wn{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Yn(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):Nt("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"===typeof e?JSON.parse(e):e,{providerId:n,signInMethod:r}=t,i=_t(t,["providerId","signInMethod"]);if(!n||!r)return null;const o=new Yn(n,r);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){return $n(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,$n(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,$n(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=q(t)}return e}}const Xn={USER_NOT_FOUND:"user-not-found"};class Jn extends Wn{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new Jn({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new Jn({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return Qt(e,"POST","/v1/accounts:signInWithPhoneNumber",Wt(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){const n=await Qt(e,"POST","/v1/accounts:signInWithPhoneNumber",Wt(e,t));if(n.temporaryProof)throw Jt(e,"account-exists-with-different-credential",n);return n}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return Qt(e,"POST","/v1/accounts:signInWithPhoneNumber",Wt(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),Xn)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:r}}toJSON(){const e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"===typeof e&&(e=JSON.parse(e));const{verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:i}=e;return n||t||r||i?new Jn({verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:i}):null}}class Zn{constructor(e){var t,n,r,i,o,s;const a=W(G(e)),l=null!==(t=a.apiKey)&&void 0!==t?t:null,c=null!==(n=a.oobCode)&&void 0!==n?n:null,u=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);At(l&&c&&u,"argument-error"),this.apiKey=l,this.operation=u,this.code=c,this.continueUrl=null!==(i=a.continueUrl)&&void 0!==i?i:null,this.languageCode=null!==(o=a.languageCode)&&void 0!==o?o:null,this.tenantId=null!==(s=a.tenantId)&&void 0!==s?s:null}static parseLink(e){const t=function(e){const t=W(G(e)).link,n=t?W(G(t)).deep_link_id:null,r=W(G(e)).deep_link_id;return(r?W(G(r)).link:null)||r||n||t||e}(e);try{return new Zn(t)}catch(n){return null}}}class er{constructor(){this.providerId=er.PROVIDER_ID}static credential(e,t){return Qn._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=Zn.parseLink(t);return At(n,"argument-error"),Qn._fromEmailAndCode(e,n.code,n.tenantId)}}er.PROVIDER_ID="password",er.EMAIL_PASSWORD_SIGN_IN_METHOD="password",er.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class tr{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class nr extends tr{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class rr extends nr{constructor(){super("facebook.com")}static credential(e){return Yn._fromParams({providerId:rr.PROVIDER_ID,signInMethod:rr.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return rr.credentialFromTaggedObject(e)}static credentialFromError(e){return rr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return rr.credential(t.oauthAccessToken)}catch(n){return null}}}rr.FACEBOOK_SIGN_IN_METHOD="facebook.com",rr.PROVIDER_ID="facebook.com";class ir extends nr{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Yn._fromParams({providerId:ir.PROVIDER_ID,signInMethod:ir.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return ir.credentialFromTaggedObject(e)}static credentialFromError(e){return ir.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return ir.credential(n,r)}catch(i){return null}}}ir.GOOGLE_SIGN_IN_METHOD="google.com",ir.PROVIDER_ID="google.com";class or extends nr{constructor(){super("github.com")}static credential(e){return Yn._fromParams({providerId:or.PROVIDER_ID,signInMethod:or.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return or.credentialFromTaggedObject(e)}static credentialFromError(e){return or.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return or.credential(t.oauthAccessToken)}catch(n){return null}}}or.GITHUB_SIGN_IN_METHOD="github.com",or.PROVIDER_ID="github.com";class sr extends nr{constructor(){super("twitter.com")}static credential(e,t){return Yn._fromParams({providerId:sr.PROVIDER_ID,signInMethod:sr.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return sr.credentialFromTaggedObject(e)}static credentialFromError(e){return sr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return sr.credential(n,r)}catch(i){return null}}}async function ar(e,t){return Qt(e,"POST","/v1/accounts:signUp",Wt(e,t))}sr.TWITTER_SIGN_IN_METHOD="twitter.com",sr.PROVIDER_ID="twitter.com";class lr{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=await dn._fromIdTokenResponse(e,n,r),o=cr(n);return new lr({user:i,providerId:o,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const r=cr(n);return new lr({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function cr(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class ur extends U{constructor(e,t,n,r){var i;super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,ur.prototype),this.customData={appName:e.name,tenantId:null!==(i=e.tenantId)&&void 0!==i?i:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new ur(e,t,n,r)}}function hr(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch((n=>{if(n.code==="auth/".concat("multi-factor-auth-required"))throw ur._fromErrorAndOperation(e,n,t,r);throw n}))}async function dr(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=await sn(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return lr._forOperation(e,"link",r)}async function fr(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{auth:r}=e,i="reauthenticate";try{const o=await sn(e,hr(r,i,t,e),n);At(o.idToken,r,"internal-error");const s=on(o.idToken);At(s,r,"internal-error");const{sub:a}=s;return At(e.uid===a,r,"user-mismatch"),lr._forOperation(e,i,o)}catch(o){throw(null===o||void 0===o?void 0:o.code)==="auth/".concat("user-not-found")&&Nt(r,"user-mismatch"),o}}async function pr(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r="signIn",i=await hr(e,r,t),o=await lr._fromIdTokenResponse(e,r,i);return n||await e._updateCurrentUser(o.user),o}new WeakMap;const mr="__sak";class gr{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(mr,"1"),this.storage.removeItem(mr),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class vr extends gr{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const e=M();return En(e)||xn(e)}()&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=Nn(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}onStorageEvent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e.key)return void this.forAllChangedKeys(((e,t,n)=>{this.notifyListeners(e,n)}));const n=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(e.newValue!==r)null!==e.newValue?this.storage.setItem(n,e.newValue):this.storage.removeItem(n);else if(this.localCache[n]===e.newValue&&!t)return}const r=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},i=this.storage.getItem(n);In()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,10):r()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const r of Array.from(n))r(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}vr.type="LOCAL";const yr=vr;class wr extends gr{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}wr.type="SESSION";const br=wr;class Er{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find((t=>t.isListeningto(e)));if(t)return t;const n=new Er(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:i}=t.data,o=this.handlersMap[r];if(!(null===o||void 0===o?void 0:o.size))return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const s=Array.from(o).map((async e=>e(t.origin,i))),a=await function(e){return Promise.all(e.map((async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}})))}(s);t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function Sr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n="";for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:50;const r="undefined"!==typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let i,o;return new Promise(((s,a)=>{const l=Sr("",20);r.port1.start();const c=setTimeout((()=>{a(new Error("unsupported_event"))}),n);o={messageChannel:r,onMessage(e){const t=e;if(t.data.eventId===l)switch(t.data.status){case"ack":clearTimeout(c),i=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(i),s(t.data.response);break;default:clearTimeout(c),clearTimeout(i),a(new Error("invalid_response"))}}},this.handlers.add(o),r.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[r.port2])})).finally((()=>{o&&this.removeMessageHandler(o)}))}}function kr(){return window}function Tr(){return"undefined"!==typeof kr().WorkerGlobalScope&&"function"===typeof kr().importScripts}const Cr="firebaseLocalStorageDb",xr="firebaseLocalStorage",Ir="fbase_key";class Nr{constructor(e){this.request=e}toPromise(){return new Promise(((e,t)=>{this.request.addEventListener("success",(()=>{e(this.request.result)})),this.request.addEventListener("error",(()=>{t(this.request.error)}))}))}}function Or(e,t){return e.transaction([xr],t?"readwrite":"readonly").objectStore(xr)}function Pr(){const e=indexedDB.open(Cr,1);return new Promise(((t,n)=>{e.addEventListener("error",(()=>{n(e.error)})),e.addEventListener("upgradeneeded",(()=>{const t=e.result;try{t.createObjectStore(xr,{keyPath:Ir})}catch(r){n(r)}})),e.addEventListener("success",(async()=>{const n=e.result;n.objectStoreNames.contains(xr)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Cr);return new Nr(e).toPromise()}(),t(await Pr()))}))}))}async function Rr(e,t,n){const r=Or(e,!0).put({[Ir]:t,value:n});return new Nr(r).toPromise()}function Ar(e,t){const n=Or(e,!0).delete(t);return new Nr(n).toPromise()}class Dr{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Pr()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(n){if(t++>3)throw n;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Tr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Er._getInstance(Tr()?self:null),this.receiver._subscribe("keyChanged",(async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)}))),this.receiver._subscribe("ping",(async(e,t)=>["keyChanged"]))}async initializeSender(){var e,t;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),!this.activeServiceWorker)return;this.sender=new _r(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(this.sender&&this.activeServiceWorker&&function(){var e;return(null===(e=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===e?void 0:e.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Pr();return await Rr(e,mr,"1"),await Ar(e,mr),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite((async()=>(await this._withRetries((n=>Rr(n,e,t))),this.localCache[e]=t,this.notifyServiceWorker(e))))}async _get(e){const t=await this._withRetries((t=>async function(e,t){const n=Or(e,!1).get(t),r=await new Nr(n).toPromise();return void 0===r?null:r.value}(t,e)));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite((async()=>(await this._withRetries((t=>Ar(t,e))),delete this.localCache[e],this.notifyServiceWorker(e))))}async _poll(){const e=await this._withRetries((e=>{const t=Or(e,!1).getAll();return new Nr(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:r,value:i}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),t.push(r));for(const r of Object.keys(this.localCache))this.localCache[r]&&!n.has(r)&&(this.notifyListeners(r,null),t.push(r));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const r of Array.from(n))r(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Dr.type="LOCAL";const Lr=Dr;Fn("rcb"),new Vt(3e4,6e4);const Mr="recaptcha";async function jr(e,t,n){var r;const i=await n.verify();try{let o;if(At("string"===typeof i,e,"argument-error"),At(n.type===Mr,e,"argument-error"),o="string"===typeof t?{phoneNumber:t}:t,"session"in o){const t=o.session;if("phoneNumber"in o){At("enroll"===t.type,e,"internal-error");const n=await function(e,t){return Gt(e,"POST","/v2/accounts/mfaEnrollment:start",Wt(e,t))}(e,{idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:o.phoneNumber,recaptchaToken:i}});return n.phoneSessionInfo.sessionInfo}{At("signin"===t.type,e,"internal-error");const n=(null===(r=o.multiFactorHint)||void 0===r?void 0:r.uid)||o.multiFactorUid;At(n,e,"missing-multi-factor-info");const s=await function(e,t){return Gt(e,"POST","/v2/accounts/mfaSignIn:start",Wt(e,t))}(e,{mfaPendingCredential:t.credential,mfaEnrollmentId:n,phoneSignInInfo:{recaptchaToken:i}});return s.phoneResponseInfo.sessionInfo}}{const{sessionInfo:t}=await async function(e,t){return Gt(e,"POST","/v1/accounts:sendVerificationCode",Wt(e,t))}(e,{phoneNumber:o.phoneNumber,recaptchaToken:i});return t}}finally{n._reset()}}class Fr{constructor(e){this.providerId=Fr.PROVIDER_ID,this.auth=Dn(e)}verifyPhoneNumber(e,t){return jr(this.auth,e,$(t))}static credential(e,t){return Jn._fromVerification(e,t)}static credentialFromResult(e){const t=e;return Fr.credentialFromTaggedObject(t)}static credentialFromError(e){return Fr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{phoneNumber:n,temporaryProof:r}=t;return n&&r?Jn._fromTokenResponse(n,r):null}}function Ur(e,t){return t?pn(t):(At(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}Fr.PROVIDER_ID="phone",Fr.PHONE_SIGN_IN_METHOD="phone";class Vr extends Wn{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return $n(e,this._buildIdpRequest())}_linkToIdToken(e,t){return $n(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return $n(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function Br(e){return pr(e.auth,new Vr(e),e.bypassAuthState)}function zr(e){const{auth:t,user:n}=e;return At(n,t,"internal-error"),fr(n,new Vr(e),e.bypassAuthState)}async function Hr(e){const{auth:t,user:n}=e;return At(n,t,"internal-error"),dr(n,new Vr(e),e.bypassAuthState)}class qr{constructor(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise((async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(n){this.reject(n)}}))}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:r,tenantId:i,error:o,type:s}=e;if(o)return void this.reject(o);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(s)(a))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Br;case"linkViaPopup":case"linkViaRedirect":return Hr;case"reauthViaPopup":case"reauthViaRedirect":return zr;default:Nt(this.auth,"internal-error")}}resolve(e){Lt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Lt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const Wr=new Vt(2e3,1e4);class Gr extends qr{constructor(e,t,n,r,i){super(e,t,r,i),this.provider=n,this.authWindow=null,this.pollId=null,Gr.currentPopupAction&&Gr.currentPopupAction.cancel(),Gr.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return At(e,this.auth,"internal-error"),e}async onExecution(){Lt(1===this.filter.length,"Popup operations only handle one event");const e=Sr();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch((e=>{this.reject(e)})),this.resolver._isIframeWebStorageSupported(this.auth,(e=>{e||this.reject(Ot(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(Ot(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Gr.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,n;(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(Ot(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(e,Wr.get())};e()}}Gr.currentPopupAction=null;const Kr="pendingRedirect",Qr=new Map;class $r extends qr{constructor(e,t){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,arguments.length>2&&void 0!==arguments[2]&&arguments[2]),this.eventId=null}async execute(){let e=Qr.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=Jr(t),r=Xr(e);if(!await r._isAvailable())return!1;const i="true"===await r._get(n);return await r._remove(n),i}(this.resolver,this.auth),n=t?await super.execute():null;e=()=>Promise.resolve(n)}catch(t){e=()=>Promise.reject(t)}Qr.set(this.auth._key(),e)}return this.bypassAuthState||Qr.set(this.auth._key(),(()=>Promise.resolve(null))),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Yr(e,t){Qr.set(e._key(),t)}function Xr(e){return pn(e._redirectPersistence)}function Jr(e){return vn(Kr,e.config.apiKey,e.name)}async function Zr(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=Dn(e),i=Ur(r,t),o=new $r(r,i,n),s=await o.execute();return s&&!n&&(delete s.user._redirectEventId,await r._persistUserIfCurrent(s.user),await r._setRedirectUser(null,t)),s}class ei{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))})),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return ni(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!ni(e)){const r=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(Ot(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(ti(e))}saveEventToCache(e){this.cachedEventUids.add(ti(e)),this.lastProcessedEventTime=Date.now()}}function ti(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((e=>e)).join("-")}function ni(e){let{type:t,error:n}=e;return"unknown"===t&&(null===n||void 0===n?void 0:n.code)==="auth/".concat("no-auth-event")}const ri=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ii=/^https?/;async function oi(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e){return Gt(e,"GET","/v1/projects",arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}(e);for(const r of t)try{if(si(r))return}catch(n){}Nt(e,"unauthorized-domain")}function si(e){const t=Mt(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const i=new URL(e);return""===i.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!ii.test(n))return!1;if(ri.test(e))return r===e;const i=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}const ai=new Vt(3e4,6e4);function li(){const e=kr().___jsl;if(null===e||void 0===e?void 0:e.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let n=0;n{var r,i,o;function s(){li(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{li(),n(Ot(e,"network-request-failed"))},timeout:ai.get()})}if(null===(i=null===(r=kr().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)t(gapi.iframes.getContext());else{if(!(null===(o=kr().gapi)||void 0===o?void 0:o.load)){const t=Fn("iframefcb");return kr()[t]=()=>{gapi.load?s():n(Ot(e,"network-request-failed"))},jn("".concat(Mn.gapiScript,"?onload=").concat(t)).catch((e=>n(e)))}s()}})).catch((e=>{throw ui=null,e}))}let ui=null;const hi=new Vt(5e3,15e3),di="__/auth/iframe",fi="emulator/auth/iframe",pi={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},mi=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function gi(e){const t=e.config;At(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Bt(t,fi):"https://".concat(e.config.authDomain,"/").concat(di),r={apiKey:t.apiKey,appName:e.name,v:at},i=mi.get(e.config.apiHost);i&&(r.eid=i);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),"".concat(n,"?").concat(q(r).slice(1))}async function vi(e){const t=await function(e){return ui=ui||ci(e),ui}(e),n=kr().gapi;return At(n,e,"internal-error"),t.open({where:document.body,url:gi(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:pi,dontclear:!0},(t=>new Promise((async(n,r)=>{await t.restyle({setHideOnLeave:!1});const i=Ot(e,"network-request-failed"),o=kr().setTimeout((()=>{r(i)}),hi.get());function s(){kr().clearTimeout(o),n(t)}t.ping(s).then(s,(()=>{r(i)}))}))))}const yi={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class wi{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function bi(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:500,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:600;const o=Math.max((window.screen.availHeight-i)/2,0).toString(),s=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const l=Object.assign(Object.assign({},yi),{width:r.toString(),height:i.toString(),top:o,left:s}),c=M().toLowerCase();n&&(a=Sn(c)?"_blank":n),bn(c)&&(t=t||"http://localhost",l.scrollbars="yes");const u=Object.entries(l).reduce(((e,t)=>{let[n,r]=t;return"".concat(e).concat(n,"=").concat(r,",")}),"");if(function(){var e;return xn(arguments.length>0&&void 0!==arguments[0]?arguments[0]:M())&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(c)&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",a),new wi(null);const h=window.open(t||"",a,u);At(h,e,"popup-blocked");try{h.focus()}catch(d){}return new wi(h)}const Ei="__/auth/handler",Si="emulator/auth/handler",_i=encodeURIComponent("fac");async function ki(e,t,n,r,i,o){At(e.config.authDomain,e,"auth-domain-config-required"),At(e.config.apiKey,e,"invalid-api-key");const s={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:at,eventId:i};if(t instanceof tr){t.setDefaultLanguage(e.languageCode),s.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(s.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries(o||{}))s[e]=t}if(t instanceof nr){const e=t.getScopes().filter((e=>""!==e));e.length>0&&(s.scopes=e.join(","))}e.tenantId&&(s.tid=e.tenantId);const a=s;for(const u of Object.keys(a))void 0===a[u]&&delete a[u];const l=await e._getAppCheckToken(),c=l?"#".concat(_i,"=").concat(encodeURIComponent(l)):"";return"".concat(function(e){let{config:t}=e;if(!t.emulator)return"https://".concat(t.authDomain,"/").concat(Ei);return Bt(t,Si)}(e),"?").concat(q(a).slice(1)).concat(c)}const Ti="webStorageSupport";const Ci=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=br,this._completeRedirectFn=Zr,this._overrideRedirectResult=Yr}async _openPopup(e,t,n,r){var i;Lt(null===(i=this.eventManagers[e._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return bi(e,await ki(e,t,n,Mt(),r),Sr())}async _openRedirect(e,t,n,r){await this._originValidation(e);return function(e){kr().location.href=e}(await ki(e,t,n,Mt(),r)),new Promise((()=>{}))}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(Lt(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch((()=>{delete this.eventManagers[t]})),n}async initAndGetManager(e){const t=await vi(e),n=new ei(e);return t.register("authEvent",(t=>{At(null===t||void 0===t?void 0:t.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Ti,{type:Ti},(n=>{var r;const i=null===(r=null===n||void 0===n?void 0:n[0])||void 0===r?void 0:r[Ti];void 0!==i&&t(!!i),Nt(e,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=oi(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Nn()||En()||xn()}};var xi="@firebase/auth",Ii="1.6.0";class Ni{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged((t=>{e((null===t||void 0===t?void 0:t.stsTokenManager.accessToken)||null)}));this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){At(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const Oi=D("authIdTokenMaxAge")||300;let Pi=null;const Ri=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&((new Date).getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>Oi)return;const i=null===n||void 0===n?void 0:n.token;Pi!==i&&(Pi=i,await fetch(e,{method:i?"POST":"DELETE",headers:i?{Authorization:"Bearer ".concat(i)}:{}}))};function Ai(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct();const t=it(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=it(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(z(n.getOptions(),null!==t&&void 0!==t?t:{}))return e;Nt(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:Ci,persistence:[Lr,yr,br]}),r=D("authTokenSyncURL");if(r){const e=Ri(r);!function(e,t,n){$(e).beforeAuthStateChanged(t,n)}(n,e,(()=>e(n.currentUser))),function(e,t,n,r){$(e).onIdTokenChanged(t,n,r)}(n,(t=>e(t)))}const i=P("auth");return i&&zn(n,"http://".concat(i)),n}var Di;!function(e){Mn=e}({loadJS:e=>new Promise(((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=Ot("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",function(){var e,t;return null!==(t=null===(e=document.getElementsByTagName("head"))||void 0===e?void 0:e[0])&&void 0!==t?t:document}().appendChild(r)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),Di="Browser",rt(new Y("auth",((e,t)=>{let{options:n}=t;const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:s,authDomain:a}=r.options;At(s&&!s.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:s,authDomain:a,clientPlatform:Di,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:On(Di)},c=new An(r,i,o,l);return function(e,t){const n=(null===t||void 0===t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(pn);(null===t||void 0===t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null===t||void 0===t?void 0:t.popupRedirectResolver)}(c,n),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,n)=>{e.getProvider("auth-internal").initialize()}))),rt(new Y("auth-internal",(e=>(e=>new Ni(e))(Dn(e.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),ut(xi,Ii,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Di)),ut(xi,Ii,"esm2017");ut("firebase","10.8.0","app");var Li,Mi="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{},ji={},Fi=Fi||{},Ui=Mi||self;function Vi(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function Bi(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}var zi="closure_uid_"+(1e9*Math.random()>>>0),Hi=0;function qi(e,t,n){return e.call.apply(e.bind,arguments)}function Wi(e,t,n){if(!e)throw Error();if(2{};Ui.addEventListener("test",e,t),Ui.removeEventListener("test",e,t)}catch(_v){}return e}();function to(e){return/^[\s\xa0]*$/.test(e)}function no(){var e=Ui.navigator;return e&&(e=e.userAgent)?e:""}function ro(e){return-1!=no().indexOf(e)}function io(e){return io[" "](e),e}io[" "]=function(){};var oo,so,ao=ro("Opera"),lo=ro("Trident")||ro("MSIE"),co=ro("Edge"),uo=co||lo,ho=ro("Gecko")&&!(-1!=no().toLowerCase().indexOf("webkit")&&!ro("Edge"))&&!(ro("Trident")||ro("MSIE"))&&!ro("Edge"),fo=-1!=no().toLowerCase().indexOf("webkit")&&!ro("Edge");function po(){var e=Ui.document;return e?e.documentMode:void 0}e:{var mo="",go=function(){var e=no();return ho?/rv:([^\);]+)(\)|;)/.exec(e):co?/Edge\/([\d\.]+)/.exec(e):lo?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):fo?/WebKit\/(\S+)/.exec(e):ao?/(?:Version)[ \/]?(\S+)/.exec(e):void 0}();if(go&&(mo=go?go[1]:""),lo){var vo=po();if(null!=vo&&vo>parseFloat(mo)){oo=String(vo);break e}}oo=mo}if(Ui.document&&lo){var yo=po();so=yo||(parseInt(oo,10)||void 0)}else so=void 0;var wo=so;function bo(e,t){if(Zi.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(ho){e:{try{io(t.nodeName);var i=!0;break e}catch(Sv){}i=!1}i||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"===typeof e.pointerType?e.pointerType:Eo[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&bo.$.h.call(this)}}Qi(bo,Zi);var Eo={2:"touch",3:"pen",4:"mouse"};bo.prototype.h=function(){bo.$.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var So="closure_listenable_"+(1e6*Math.random()|0),_o=0;function ko(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.la=i,this.key=++_o,this.fa=this.ia=!1}function To(e){e.fa=!0,e.listener=null,e.proxy=null,e.src=null,e.la=null}function Co(e,t,n){for(const r in e)t.call(n,e[r],r,e)}function xo(e){const t={};for(const n in e)t[n]=e[n];return t}const Io="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function No(e,t){let n,r;for(let i=1;i>>0);function qo(e){return"function"===typeof e?e:(e[Ho]||(e[Ho]=function(t){return e.handleEvent(t)}),e[Ho])}function Wo(){$i.call(this),this.i=new Oo(this),this.S=this,this.J=null}function Go(e,t){var n,r=e.J;if(r)for(n=[];r;r=r.J)n.push(r);if(e=e.S,r=t.type||t,"string"===typeof t)t=new Zi(t,e);else if(t instanceof Zi)t.target=t.target||e;else{var i=t;No(t=new Zi(r,e),i)}if(i=!0,n)for(var o=n.length-1;0<=o;o--){var s=t.g=n[o];i=Ko(s,r,!0,t)&&i}if(i=Ko(s=t.g=e,r,!0,t)&&i,i=Ko(s,r,!1,t)&&i,n)for(o=0;onew Xo),(e=>e.reset()));class Xo{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}function Jo(e){var t=1;e=e.split(":");const n=[];for(;0{throw e}),0)}let es,ts=!1,ns=new class{constructor(){this.h=this.g=null}add(e,t){const n=Yo.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},rs=()=>{const e=Ui.Promise.resolve(void 0);es=()=>{e.then(is)}};var is=()=>{for(var e;e=$o();){try{e.h.call(e.g)}catch(_v){Zo(_v)}var t=Yo;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}ts=!1};function os(e,t){Wo.call(this),this.h=e||1,this.g=t||Ui,this.j=Gi(this.qb,this),this.l=Date.now()}function ss(e){e.ga=!1,e.T&&(e.g.clearTimeout(e.T),e.T=null)}function as(e,t,n){if("function"===typeof e)n&&(e=Gi(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=Gi(e.handleEvent,e)}return 2147483647{e.g=null,e.i&&(e.i=!1,ls(e))}),e.j);const t=e.h;e.h=null,e.m.apply(null,t)}Qi(os,Wo),(Li=os.prototype).ga=!1,Li.T=null,Li.qb=function(){if(this.ga){var e=Date.now()-this.l;0r.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 s=1;st.length?Us:(t=t.slice(r,r+n),e.o=r+n,t))}function Ws(e){e.Y=Date.now()+e.P,Gs(e,e.P)}function Gs(e,t){if(null!=e.C)throw Error("WatchDog timer not null");e.C=ks(Gi(e.lb,e),t)}function Ks(e){e.C&&(Ui.clearTimeout(e.C),e.C=null)}function Qs(e){0==e.l.H||e.J||fl(e.l,e)}function $s(e){Ks(e);var t=e.M;t&&"function"==typeof t.sa&&t.sa(),e.M=null,ss(e.V),fs(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.sa())}function Ys(e,t){try{var n=e.l;if(0!=n.H&&(n.g==e||Ta(n.i,e)))if(!e.K&&Ta(n.i,e)&&3==n.H){try{var r=n.Ja.g.parse(t)}catch(Rv){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){e:if(!n.u){if(n.g){if(!(n.g.G+3e3i[2]&&n.G&&0==n.A&&!n.v&&(n.v=ks(Gi(n.ib,n),6e3));if(1>=ka(n.i)&&n.oa){try{n.oa()}catch(Rv){}n.oa=void 0}}else ml(n,11)}else if((e.K||n.g==e)&&dl(n),!to(t))for(i=n.Ja.g.parse(t),t=0;tu)&&(3!=u||uo||this.g&&(this.h.h||this.g.ja()||Ya(this.g)))){this.J||4!=u||7==t||bs(),Ks(this);var n=this.g.da();this.ca=n;t:if(zs(this)){var r=Ya(this.g);e="";var i=r.length,o=4==$a(this.g);if(!this.h.i){if("undefined"===typeof TextDecoder){$s(this),Qs(this);var s="";break t}this.h.i=new Ui.TextDecoder}for(t=0;tt)throw Error("Bad port number "+t);e.m=t}else e.m=null}function ra(e,t,n){t instanceof pa?(e.i=t,function(e,t){t&&!e.j&&(ma(e),e.i=null,e.g.forEach((function(e,t){var n=t.toLowerCase();t!=n&&(ga(this,t),ya(this,n,e))}),e)),e.j=t}(e.i,e.h)):(n||(t=aa(t,da)),e.i=new pa(t,e.h))}function ia(e,t,n){e.i.set(t,n)}function oa(e){return ia(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function sa(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function aa(e,t,n){return"string"===typeof e?(e=encodeURI(e).replace(t,la),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function la(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}Zs.prototype.toString=function(){var e=[],t=this.j;t&&e.push(aa(t,ca,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.s)&&e.push(aa(t,ca,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(aa(n,"/"==n.charAt(0)?ha:ua,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.o)&&e.push("#",aa(n,fa)),e.join("")};var ca=/[#\/\?@]/g,ua=/[#\?:]/g,ha=/[#\?]/g,da=/[#\?@]/g,fa=/#/g;function pa(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function ma(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n=e.j}function ka(e){return e.h?1:e.g?e.g.size:0}function Ta(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function Ca(e,t){e.g?e.g.add(t):e.h=t}function xa(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function Ia(e){if(null!=e.h)return e.i.concat(e.h.F);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.F);return t}return Xi(e.i)}Ea.prototype.cancel=function(){if(this.i=Ia(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var Na=class{stringify(e){return Ui.JSON.stringify(e,void 0)}parse(e){return Ui.JSON.parse(e,void 0)}};function Oa(){this.g=new Na}function Pa(e,t,n){const r=n||"";try{Xs(e,(function(e,n){let i=e;Bi(e)&&(i=Qo(e)),t.push(r+n+"="+encodeURIComponent(i))}))}catch(i){throw t.push(r+"type="+encodeURIComponent("_badmap")),i}}function Ra(e,t,n,r,i){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,i(r)}catch(Sv){}}function Aa(e){this.l=e.ec||null,this.j=e.ob||!1}function Da(e,t){Wo.call(this),this.F=e,this.u=t,this.m=void 0,this.readyState=La,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}Qi(Aa,xs),Aa.prototype.g=function(){return new Da(this.l,this.j)},Aa.prototype.i=function(e){return function(){return e}}({}),Qi(Da,Wo);var La=0;function Ma(e){e.j.read().then(e.Xa.bind(e)).catch(e.ka.bind(e))}function ja(e){e.readyState=4,e.l=null,e.j=null,e.A=null,Fa(e)}function Fa(e){e.onreadystatechange&&e.onreadystatechange.call(e)}(Li=Da.prototype).open=function(e,t){if(this.readyState!=La)throw this.abort(),Error("Error reopening a connection");this.C=e,this.B=t,this.readyState=1,Fa(this)},Li.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.v,method:this.C,credentials:this.m,cache:void 0};e&&(t.body=e),(this.F||Ui).fetch(new Request(this.B,t)).then(this.$a.bind(this),this.ka.bind(this))},Li.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((()=>{})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,ja(this)),this.readyState=La},Li.$a=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,Fa(this)),this.g&&(this.readyState=3,Fa(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if("undefined"!==typeof Ui.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Ma(this)}else e.text().then(this.Za.bind(this),this.ka.bind(this))},Li.Xa=function(e){if(this.g){if(this.u&&e.value)this.response.push(e.value);else if(!this.u){var t=e.value?e.value:new Uint8Array(0);(t=this.A.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?ja(this):Fa(this),3==this.readyState&&Ma(this)}},Li.Za=function(e){this.g&&(this.response=this.responseText=e,ja(this))},Li.Ya=function(e){this.g&&(this.response=e,ja(this))},Li.ka=function(){this.g&&ja(this)},Li.setRequestHeader=function(e,t){this.v.append(e,t)},Li.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},Li.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(Da.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}});var Ua=Ui.JSON.parse;function Va(e){Wo.call(this),this.headers=new Map,this.u=e||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=Ba,this.L=this.M=!1}Qi(Va,Wo);var Ba="",za=/^https?$/i,Ha=["POST","PUT"];function qa(e,t){e.h=!1,e.g&&(e.l=!0,e.g.abort(),e.l=!1),e.j=t,e.m=5,Wa(e),Ka(e)}function Wa(e){e.F||(e.F=!0,Go(e,"complete"),Go(e,"error"))}function Ga(e){if(e.h&&"undefined"!=typeof Fi&&(!e.C[1]||4!=$a(e)||2!=e.da()))if(e.v&&4==$a(e))as(e.La,0,e);else if(Go(e,"readystatechange"),4==$a(e)){e.h=!1;try{const s=e.da();e:switch(s){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var r;if(r=0===s){var i=String(e.I).match(Js)[1]||null;!i&&Ui.self&&Ui.self.location&&(i=Ui.self.location.protocol.slice(0,-1)),r=!za.test(i?i.toLowerCase():"")}n=r}if(n)Go(e,"complete"),Go(e,"success");else{e.m=6;try{var o=2<$a(e)?e.g.statusText:""}catch(mv){o=""}e.j=o+" ["+e.da()+"]",Wa(e)}}finally{Ka(e)}}}function Ka(e,t){if(e.g){Qa(e);const r=e.g,i=e.C[0]?()=>{}:null;e.g=null,e.C=null,t||Go(e,"ready");try{r.onreadystatechange=i}catch(n){}}}function Qa(e){e.g&&e.L&&(e.g.ontimeout=null),e.A&&(Ui.clearTimeout(e.A),e.A=null)}function $a(e){return e.g?e.g.readyState:0}function Ya(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.K){case Ba:case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(rc){return null}}function Xa(e){let t="";return Co(e,(function(e,n){t+=n,t+=":",t+=e,t+="\r\n"})),t}function Ja(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=Xa(n),"string"===typeof e?null!=n&&encodeURIComponent(String(n)):ia(e,t,n))}function Za(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function el(e){this.Ga=0,this.j=[],this.l=new ps,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=Za("failFast",!1,e),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=Za("baseRetryDelayMs",5e3,e),this.hb=Za("retryDelaySeedMs",1e4,e),this.eb=Za("forwardChannelMaxRetries",2,e),this.xa=Za("forwardChannelRequestTimeoutMs",2e4,e),this.va=e&&e.xmlHttpFactory||void 0,this.Ha=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.i=new Ea(e&&e.concurrentRequestLimit),this.Ja=new Oa,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=e&&e.bc||!1,e&&e.Ea&&this.l.Ea(),e&&e.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&e&&e.detectBufferingProxy||!1,this.qa=void 0,e&&e.longPollingTimeout&&0n)t=Math.max(0,i[a].g-100),s=!1;else try{Pa(l,e,"req"+n+"_")}catch(o){r&&r(l)}}if(s){r=e.join("&");break e}}}return e=e.j.splice(0,n),t.F=e,r}function ll(e){if(!e.g&&!e.u){e.ba=1;var t=e.Ma;es||rs(),ts||(es(),ts=!0),ns.add(t,e),e.A=0}}function cl(e){return!(e.g||e.u||3<=e.A)&&(e.ba++,e.u=ks(Gi(e.Ma,e),pl(e,e.A)),e.A++,!0)}function ul(e){null!=e.B&&(Ui.clearTimeout(e.B),e.B=null)}function hl(e){e.g=new Ls(e,e.l,"rpc",e.ba),null===e.o&&(e.g.I=e.s),e.g.O=0;var t=ea(e.wa);ia(t,"RID","rpc"),ia(t,"SID",e.K),ia(t,"AID",e.V),ia(t,"CI",e.G?"0":"1"),!e.G&&e.qa&&ia(t,"TO",e.qa),ia(t,"TYPE","xmlhttp"),sl(e,t),e.o&&e.s&&Ja(t,e.o,e.s),e.L&&e.g.setTimeout(e.L);var n=e.g;e=e.pa,n.L=1,n.A=oa(ea(t)),n.u=null,n.S=!0,Bs(n,e)}function dl(e){null!=e.v&&(Ui.clearTimeout(e.v),e.v=null)}function fl(e,t){var n=null;if(e.g==t){dl(e),ul(e),e.g=null;var r=2}else{if(!Ta(e.i,t))return;n=t.F,xa(e.i,t),r=1}if(0!=e.H)if(t.i)if(1==r){n=t.u?t.u.length:0,t=Date.now()-t.G;var i=e.C;Go(r=ys(),new _s(r,n)),il(e)}else ll(e);else if(3==(i=t.s)||0==i&&0=e.i.j-(e.m?1:0))&&(e.m?(e.j=t.F.concat(e.j),!0):!(1==e.H||2==e.H||e.C>=(e.cb?0:e.eb))&&(e.m=ks(Gi(e.Na,e,t),pl(e,e.C)),e.C++,!0))}(e,t)||2==r&&cl(e)))switch(n&&0i;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;16>i;++i)r[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];var o=e.g[3],s=t+(o^n&(i^o))+r[0]+3614090360&4294967295;s=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=n+(s<<7&4294967295|s>>>25))+((s=o+(i^t&(n^i))+r[1]+3905402710&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^o&(t^n))+r[2]+606105819&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(o^t))+r[3]+3250441966&4294967295)<<22&4294967295|s>>>10))+((s=t+(o^n&(i^o))+r[4]+4118548399&4294967295)<<7&4294967295|s>>>25))+((s=o+(i^t&(n^i))+r[5]+1200080426&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^o&(t^n))+r[6]+2821735955&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(o^t))+r[7]+4249261313&4294967295)<<22&4294967295|s>>>10))+((s=t+(o^n&(i^o))+r[8]+1770035416&4294967295)<<7&4294967295|s>>>25))+((s=o+(i^t&(n^i))+r[9]+2336552879&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^o&(t^n))+r[10]+4294925233&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(o^t))+r[11]+2304563134&4294967295)<<22&4294967295|s>>>10))+((s=t+(o^n&(i^o))+r[12]+1804603682&4294967295)<<7&4294967295|s>>>25))+((s=o+(i^t&(n^i))+r[13]+4254626195&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^o&(t^n))+r[14]+2792965006&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(o^t))+r[15]+1236535329&4294967295)<<22&4294967295|s>>>10))+((s=t+(i^o&(n^i))+r[1]+4129170786&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^i&(t^n))+r[6]+3225465664&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(o^t))+r[11]+643717713&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(i^o))+r[0]+3921069994&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^o&(n^i))+r[5]+3593408605&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^i&(t^n))+r[10]+38016083&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(o^t))+r[15]+3634488961&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(i^o))+r[4]+3889429448&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^o&(n^i))+r[9]+568446438&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^i&(t^n))+r[14]+3275163606&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(o^t))+r[3]+4107603335&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(i^o))+r[8]+1163531501&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^o&(n^i))+r[13]+2850285829&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^i&(t^n))+r[2]+4243563512&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(o^t))+r[7]+1735328473&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(i^o))+r[12]+2368359562&4294967295)<<20&4294967295|s>>>12))+((s=t+(n^i^o)+r[5]+4294588738&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^i)+r[8]+2272392833&4294967295)<<11&4294967295|s>>>21))+((s=i+(o^t^n)+r[11]+1839030562&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^o^t)+r[14]+4259657740&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^o)+r[1]+2763975236&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^i)+r[4]+1272893353&4294967295)<<11&4294967295|s>>>21))+((s=i+(o^t^n)+r[7]+4139469664&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^o^t)+r[10]+3200236656&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^o)+r[13]+681279174&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^i)+r[0]+3936430074&4294967295)<<11&4294967295|s>>>21))+((s=i+(o^t^n)+r[3]+3572445317&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^o^t)+r[6]+76029189&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^o)+r[9]+3654602809&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^i)+r[12]+3873151461&4294967295)<<11&4294967295|s>>>21))+((s=i+(o^t^n)+r[15]+530742520&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^o^t)+r[2]+3299628645&4294967295)<<23&4294967295|s>>>9))+((s=t+(i^(n|~o))+r[0]+4096336452&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~i))+r[7]+1126891415&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(o|~n))+r[14]+2878612391&4294967295)<<15&4294967295|s>>>17))+((s=n+(o^(i|~t))+r[5]+4237533241&4294967295)<<21&4294967295|s>>>11))+((s=t+(i^(n|~o))+r[12]+1700485571&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~i))+r[3]+2399980690&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(o|~n))+r[10]+4293915773&4294967295)<<15&4294967295|s>>>17))+((s=n+(o^(i|~t))+r[1]+2240044497&4294967295)<<21&4294967295|s>>>11))+((s=t+(i^(n|~o))+r[8]+1873313359&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~i))+r[15]+4264355552&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(o|~n))+r[6]+2734768916&4294967295)<<15&4294967295|s>>>17))+((s=n+(o^(i|~t))+r[13]+1309151649&4294967295)<<21&4294967295|s>>>11))+((o=(t=n+((s=t+(i^(n|~o))+r[4]+4149444226&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~i))+r[11]+3174756917&4294967295)<<10&4294967295|s>>>22))^((i=o+((s=i+(t^(o|~n))+r[2]+718787259&4294967295)<<15&4294967295|s>>>17))|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(s<<21&4294967295|s>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+o&4294967295}function xl(e,t){this.h=t;for(var n=[],r=!0,i=e.length-1;0<=i;i--){var o=0|e[i];r&&o==t||(n[i]=o,r=!1)}this.g=n}(Li=Va.prototype).Oa=function(e){this.M=e},Li.ha=function(e,t,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+e);t=t?t.toUpperCase():"GET",this.I=e,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():Os.g(),this.C=this.u?Is(this.u):Is(Os),this.g.onreadystatechange=Gi(this.La,this);try{this.G=!0,this.g.open(t,String(e),!0),this.G=!1}catch(Sv){return void qa(this,Sv)}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else{if("function"!==typeof r.keys||"function"!==typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));for(const e of r.keys())n.set(e,r.get(e))}r=Array.from(n.keys()).find((e=>"content-type"==e.toLowerCase())),i=Ui.FormData&&e instanceof Ui.FormData,!(0<=Yi(Ha,t))||r||i||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[o,s]of n)this.g.setRequestHeader(o,s);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{Qa(this),0=this.S)){var e=2*this.S;this.l.info("BP detection timer enabled: "+e),this.B=ks(Gi(this.jb,this),e)}},Li.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,Ss(10),nl(this),hl(this))},Li.ib=function(){null!=this.v&&(this.v=null,nl(this),cl(this),Ss(19))},Li.pb=function(e){e?(this.l.info("Successfully pinged google.com"),Ss(2)):(this.l.info("Failed to ping google.com"),Ss(1))},Li.isActive=function(){return!!this.h&&this.h.isActive(this)},(Li=wl.prototype).Ba=function(){},Li.Aa=function(){},Li.za=function(){},Li.ya=function(){},Li.isActive=function(){return!0},Li.Va=function(){},bl.prototype.g=function(e,t){return new El(e,t)},Qi(El,Wo),El.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var e=this.g,t=this.l,n=this.h||void 0;Ss(0),e.Y=t,e.na=n||{},e.G=e.aa,e.I=vl(e,null,e.Y),il(e)},El.prototype.close=function(){tl(this.g)},El.prototype.u=function(e){var t=this.g;if("string"===typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=Qo(e),e=n);t.j.push(new ba(t.fb++,e)),3==t.H&&il(t)},El.prototype.N=function(){this.g.h=null,delete this.j,tl(this.g),delete this.g,El.$.N.call(this)},Qi(Sl,Rs),Qi(_l,As),Qi(kl,wl),kl.prototype.Ba=function(){Go(this.g,"a")},kl.prototype.Aa=function(e){Go(this.g,new Sl(e))},kl.prototype.za=function(e){Go(this.g,new _l)},kl.prototype.ya=function(){Go(this.g,"b")},Qi(Tl,(function(){this.blockSize=-1})),Tl.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0},Tl.prototype.j=function(e,t){void 0===t&&(t=e.length);for(var n=t-this.blockSize,r=this.m,i=this.h,o=0;othis.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;tt;++t)for(var r=0;32>r;r+=8)e[n++]=this.g[t]>>>r&255;return e};var Il={};function Nl(e){return-128<=e&&128>e?function(e,t){var n=Il;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,(function(e){return new xl([0|e],0>e?-1:0)})):new xl([0|e],0>e?-1:0)}function Ol(e){if(isNaN(e)||!isFinite(e))return Rl;if(0>e)return jl(Ol(-e));for(var t=[],n=1,r=0;e>=n;r++)t[r]=e/n|0,n*=Pl;return new xl(t,0)}var Pl=4294967296,Rl=Nl(0),Al=Nl(1),Dl=Nl(16777216);function Ll(e){if(0!=e.h)return!1;for(var t=0;t>>16,e[t]&=65535,t++}function Vl(e,t){this.g=e,this.h=t}function Bl(e,t){if(Ll(t))throw Error("division by zero");if(Ll(e))return new Vl(Rl,Rl);if(Ml(e))return t=Bl(jl(e),t),new Vl(jl(t.g),jl(t.h));if(Ml(t))return t=Bl(e,jl(t)),new Vl(jl(t.g),t.h);if(30=r.X(e);)n=zl(n),r=zl(r);var i=Hl(n,1),o=Hl(r,1);for(r=Hl(r,2),n=Hl(n,2);!Ll(r);){var s=o.add(r);0>=s.X(e)&&(i=i.add(n),o=s),r=Hl(r,1),n=Hl(n,1)}return t=Fl(e,i.R(t)),new Vl(i,t)}for(i=Rl;0<=e.X(t);){for(n=Math.max(1,Math.floor(e.ea()/t.ea())),r=48>=(r=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,r-48),s=(o=Ol(n)).R(t);Ml(s)||0>>31;return new xl(n,e.h)}function Hl(e,t){var n=t>>5;t%=32;for(var r=e.g.length-n,i=[],o=0;o>>t|e.D(o+n+1)<<32-t:e.D(o+n);return new xl(i,e.h)}(Li=xl.prototype).ea=function(){if(Ml(this))return-jl(this).ea();for(var e=0,t=1,n=0;n(e=e||10)||36>>0).toString(e);if(Ll(n=i))return o+r;for(;6>o.length;)o="0"+o;r=o+r}},Li.D=function(e){return 0>e?0:e>>16)+(this.D(i)>>>16)+(e.D(i)>>>16);r=s>>>16,o&=65535,s&=65535,n[i]=s<<16|o}return new xl(n,-2147483648&n[n.length-1]?-1:0)},Li.R=function(e){if(Ll(this)||Ll(e))return Rl;if(Ml(this))return Ml(e)?jl(this).R(jl(e)):jl(jl(this).R(e));if(Ml(e))return jl(this.R(jl(e)));if(0>this.X(Dl)&&0>e.X(Dl))return Ol(this.ea()*e.ea());for(var t=this.g.length+e.g.length,n=[],r=0;r<2*t;r++)n[r]=0;for(r=0;r>>16,s=65535&this.D(r),a=e.D(i)>>>16,l=65535&e.D(i);n[2*r+2*i]+=s*l,Ul(n,2*r+2*i),n[2*r+2*i+1]+=o*l,Ul(n,2*r+2*i+1),n[2*r+2*i+1]+=s*a,Ul(n,2*r+2*i+1),n[2*r+2*i+2]+=o*a,Ul(n,2*r+2*i+2)}for(r=0;r(n=n||10)||36s?(s=Ol(Math.pow(n,s)),i=i.R(s).add(Ol(a))):i=(i=i.R(r)).add(Ol(a))}return i};var ql=ji.createWebChannelTransport=function(){return new bl},Wl=ji.getStatEventTarget=function(){return ys()},Gl=ji.ErrorCode=Ts,Kl=ji.EventType=Cs,Ql=ji.Event=gs,$l=ji.Stat={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},Yl=(ji.FetchXmlHttpFactory=Aa,ji.WebChannel=Ns),Xl=ji.XhrIo=Va,Jl=ji.Md5=Tl,Zl=ji.Integer=xl;const ec="@firebase/firestore";class tc{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}tc.UNAUTHENTICATED=new tc(null),tc.GOOGLE_CREDENTIALS=new tc("google-credentials-uid"),tc.FIRST_PARTY=new tc("first-party-uid"),tc.MOCK_USER=new tc("mock-user");let nc="10.8.0";const rc=new se("@firebase/firestore");function ic(){return rc.logLevel}function oc(e){if(rc.logLevel<=te.DEBUG){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:"Unexpected state";const t="FIRESTORE (".concat(nc,") INTERNAL ASSERTION FAILED: ")+e;throw sc(t),new Error(t)}function uc(e,t){e||cc()}function hc(e,t){return e}const dc={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class fc extends U{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>"".concat(this.name,": [code=").concat(this.code,"]: ").concat(this.message)}}class pc{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class mc{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization","Bearer ".concat(e))}}class gc{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(tc.UNAUTHENTICATED)))}shutdown(){}}class vc{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable((()=>t(this.token.user)))}shutdown(){this.changeListener=null}}class yc{constructor(e){this.t=e,this.currentUser=tc.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let n=this.i;const r=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let i=new pc;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new pc,e.enqueueRetryable((()=>r(this.currentUser)))};const o=()=>{const t=i;e.enqueueRetryable((async()=>{await t.promise,await r(this.currentUser)}))},s=e=>{oc("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.auth.addAuthTokenListener(this.o),o()};this.t.onInit((e=>s(e))),setTimeout((()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?s(e):(oc("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new pc)}}),0),o()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i!==e?(oc("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(uc("string"==typeof t.accessToken),new mc(t.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const e=this.auth&&this.auth.getUid();return uc(null===e||"string"==typeof e),new tc(e)}}class wc{constructor(e,t,n){this.l=e,this.h=t,this.P=n,this.type="FirstParty",this.user=tc.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class bc{constructor(e,t,n){this.l=e,this.h=t,this.P=n}getToken(){return Promise.resolve(new wc(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable((()=>t(tc.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Ec{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Sc{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){const n=e=>{null!=e.error&&oc("FirebaseAppCheckTokenProvider","Error getting App Check token; using placeholder token instead. Error: ".concat(e.error.message));const n=e.token!==this.R;return this.R=e.token,oc("FirebaseAppCheckTokenProvider","Received ".concat(n?"new":"existing"," token.")),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};const r=e=>{oc("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.appCheck.addTokenListener(this.o)};this.A.onInit((e=>r(e))),setTimeout((()=>{if(!this.appCheck){const e=this.A.getImmediate({optional:!0});e?r(e):oc("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(uc("string"==typeof e.token),this.R=e.token,new Ec(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}function _c(e){const t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let r=0;rt?1:0}function Cc(e,t,n){return e.length===t.length&&e.every(((e,r)=>n(e,t[r])))}class xc{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new fc(dc.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new fc(dc.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new fc(dc.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new fc(dc.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return xc.fromMillis(Date.now())}static fromDate(e){return xc.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor(1e6*(e-1e3*t));return new xc(t,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?Tc(this.nanoseconds,e.nanoseconds):Tc(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}class Ic{constructor(e){this.timestamp=e}static fromTimestamp(e){return new Ic(e)}static min(){return new Ic(new xc(0,0))}static max(){return new Ic(new xc(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}class Nc{constructor(e,t,n){void 0===t?t=0:t>e.length&&cc(),void 0===n?n=e.length-t:n>e.length-t&&cc(),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===Nc.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Nc?e.forEach((e=>{t.push(e)})):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.lengthi)return 1}return e.lengtht.length?1:0}}class Oc extends Nc{construct(e,t,n){return new Oc(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(){const e=[];for(var t=arguments.length,n=new Array(t),r=0;r=0)throw new fc(dc.INVALID_ARGUMENT,"Invalid segment (".concat(i,"). Paths must not contain // in them."));e.push(...i.split("/").filter((e=>e.length>0)))}return new Oc(e)}static emptyPath(){return new Oc([])}}const Pc=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Rc extends Nc{construct(e,t,n){return new Rc(e,t,n)}static isValidIdentifier(e){return Pc.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Rc.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new Rc(["__name__"])}static fromServerFormat(e){const t=[];let n="",r=0;const i=()=>{if(0===n.length)throw new fc(dc.INVALID_ARGUMENT,"Invalid field path (".concat(e,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"));t.push(n),n=""};let o=!1;for(;r=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===Oc.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return Oc.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new Ac(new Oc(e.slice()))}}class Dc{constructor(e,t,n,r){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=r}}Dc.UNKNOWN_ID=-1;function Lc(e,t){const n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,i=Ic.fromTimestamp(1e9===r?new xc(n+1,0):new xc(n,r));return new jc(i,Ac.empty(),t)}function Mc(e){return new jc(e.readTime,e.key,-1)}class jc{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new jc(Ic.min(),Ac.empty(),-1)}static max(){return new jc(Ic.max(),Ac.empty(),-1)}}function Fc(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=Ac.comparator(e.documentKey,t.documentKey),0!==n?n:Tc(e.largestBatchId,t.largestBatchId))}const Uc="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Vc{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}async function Bc(e){if(e.code!==dc.FAILED_PRECONDITION||e.message!==Uc)throw e;oc("LocalStore","Unexpectedly lost primary lease")}class zc{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)}),(e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)}))}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&cc(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new zc(((n,r)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,r)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,r)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{const t=e();return t instanceof zc?t:zc.resolve(t)}catch(e){return zc.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction((()=>e(t))):zc.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction((()=>e(t))):zc.reject(t)}static resolve(e){return new zc(((t,n)=>{t(e)}))}static reject(e){return new zc(((t,n)=>{n(e)}))}static waitFor(e){return new zc(((t,n)=>{let r=0,i=0,o=!1;e.forEach((e=>{++r,e.next((()=>{++i,o&&i===r&&t()}),(e=>n(e)))})),o=!0,i===r&&t()}))}static or(e){let t=zc.resolve(!1);for(const n of e)t=t.next((e=>e?zc.resolve(e):n()));return t}static forEach(e,t){const n=[];return e.forEach(((e,r)=>{n.push(t.call(this,e,r))})),this.waitFor(n)}static mapArray(e,t){return new zc(((n,r)=>{const i=e.length,o=new Array(i);let s=0;for(let a=0;a{o[l]=e,++s,s===i&&n(o)}),(e=>r(e)))}}))}static doWhile(e,t){return new zc(((n,r)=>{const i=()=>{!0===e()?t().next((()=>{i()}),r):n()};i()}))}}class Hc{constructor(e,t){this.action=e,this.transaction=t,this.aborted=!1,this.V=new pc,this.transaction.oncomplete=()=>{this.V.resolve()},this.transaction.onabort=()=>{t.error?this.V.reject(new Gc(e,t.error)):this.V.resolve()},this.transaction.onerror=t=>{const n=Xc(t.target.error);this.V.reject(new Gc(e,n))}}static open(e,t,n,r){try{return new Hc(t,e.transaction(r,n))}catch(e){throw new Gc(t,e)}}get m(){return this.V.promise}abort(e){e&&this.V.reject(e),this.aborted||(oc("SimpleDb","Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}g(){const e=this.transaction;this.aborted||"function"!=typeof e.commit||e.commit()}store(e){const t=this.transaction.objectStore(e);return new Qc(t)}}class qc{constructor(e,t,n){this.name=e,this.version=t,this.p=n,12.2===qc.S(M())&&sc("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}static delete(e){return oc("SimpleDb","Removing database:",e),$c(window.indexedDB.deleteDatabase(e)).toPromise()}static D(){if(!F())return!1;if(qc.C())return!0;const e=M(),t=qc.S(e),n=00||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||n||i)}static C(){var e;return"undefined"!=typeof process&&"YES"===(null===(e=process.__PRIVATE_env)||void 0===e?void 0:e.F)}static M(e,t){return e.store(t)}static S(e){const t=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(n)}static v(e){const t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}async O(e){return this.db||(oc("SimpleDb","Opening database:",this.name),this.db=await new Promise(((t,n)=>{const r=indexedDB.open(this.name,this.version);r.onsuccess=e=>{const n=e.target.result;t(n)},r.onblocked=()=>{n(new Gc(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},r.onerror=t=>{const r=t.target.error;"VersionError"===r.name?n(new fc(dc.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):"InvalidStateError"===r.name?n(new fc(dc.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+r)):n(new Gc(e,r))},r.onupgradeneeded=e=>{oc("SimpleDb",'Database "'+this.name+'" requires upgrade from version:',e.oldVersion);const t=e.target.result;this.p.N(t,r.transaction,e.oldVersion,this.version).next((()=>{oc("SimpleDb","Database upgrade to version "+this.version+" complete")}))}}))),this.B&&(this.db.onversionchange=e=>this.B(e)),this.db}L(e){this.B=e,this.db&&(this.db.onversionchange=t=>e(t))}async runTransaction(e,t,n,r){const i="readonly"===t;let o=0;for(;;){++o;try{this.db=await this.O(e);const t=Hc.open(this.db,e,i?"readonly":"readwrite",n),o=r(t).next((e=>(t.g(),e))).catch((e=>(t.abort(e),zc.reject(e)))).toPromise();return o.catch((()=>{})),await t.m,o}catch(e){const t=e,n="FirebaseError"!==t.name&&o<3;if(oc("SimpleDb","Transaction failed with error:",t.message,"Retrying:",n),this.close(),!n)return Promise.reject(t)}}}close(){this.db&&this.db.close(),this.db=void 0}}class Wc{constructor(e){this.k=e,this.q=!1,this.K=null}get isDone(){return this.q}get $(){return this.K}set cursor(e){this.k=e}done(){this.q=!0}U(e){this.K=e}delete(){return $c(this.k.delete())}}class Gc extends fc{constructor(e,t){super(dc.UNAVAILABLE,"IndexedDB transaction '".concat(e,"' failed: ").concat(t)),this.name="IndexedDbTransactionError"}}function Kc(e){return"IndexedDbTransactionError"===e.name}class Qc{constructor(e){this.store=e}put(e,t){let n;return void 0!==t?(oc("SimpleDb","PUT",this.store.name,e,t),n=this.store.put(t,e)):(oc("SimpleDb","PUT",this.store.name,"",e),n=this.store.put(e)),$c(n)}add(e){return oc("SimpleDb","ADD",this.store.name,e,e),$c(this.store.add(e))}get(e){return $c(this.store.get(e)).next((t=>(void 0===t&&(t=null),oc("SimpleDb","GET",this.store.name,e,t),t)))}delete(e){return oc("SimpleDb","DELETE",this.store.name,e),$c(this.store.delete(e))}count(){return oc("SimpleDb","COUNT",this.store.name),$c(this.store.count())}W(e,t){const n=this.options(e,t),r=n.index?this.store.index(n.index):this.store;if("function"==typeof r.getAll){const e=r.getAll(n.range);return new zc(((t,n)=>{e.onerror=e=>{n(e.target.error)},e.onsuccess=e=>{t(e.target.result)}}))}{const e=this.cursor(n),t=[];return this.G(e,((e,n)=>{t.push(n)})).next((()=>t))}}j(e,t){const n=this.store.getAll(e,null===t?void 0:t);return new zc(((e,t)=>{n.onerror=e=>{t(e.target.error)},n.onsuccess=t=>{e(t.target.result)}}))}H(e,t){oc("SimpleDb","DELETE ALL",this.store.name);const n=this.options(e,t);n.J=!1;const r=this.cursor(n);return this.G(r,((e,t,n)=>n.delete()))}Y(e,t){let n;t?n=e:(n={},t=e);const r=this.cursor(n);return this.G(r,t)}Z(e){const t=this.cursor({});return new zc(((n,r)=>{t.onerror=e=>{const t=Xc(e.target.error);r(t)},t.onsuccess=t=>{const r=t.target.result;r?e(r.primaryKey,r.value).next((e=>{e?r.continue():n()})):n()}}))}G(e,t){const n=[];return new zc(((r,i)=>{e.onerror=e=>{i(e.target.error)},e.onsuccess=e=>{const i=e.target.result;if(!i)return void r();const o=new Wc(i),s=t(i.primaryKey,i.value,o);if(s instanceof zc){const e=s.catch((e=>(o.done(),zc.reject(e))));n.push(e)}o.isDone?r():null===o.$?i.continue():i.continue(o.$)}})).next((()=>zc.waitFor(n)))}options(e,t){let n;return void 0!==e&&("string"==typeof e?n=e:t=e),{index:n,range:t}}cursor(e){let t="next";if(e.reverse&&(t="prev"),e.index){const n=this.store.index(e.index);return e.J?n.openKeyCursor(e.range,t):n.openCursor(e.range,t)}return this.store.openCursor(e.range,t)}}function $c(e){return new zc(((t,n)=>{e.onsuccess=e=>{const n=e.target.result;t(n)},e.onerror=e=>{const t=Xc(e.target.error);n(t)}}))}let Yc=!1;function Xc(e){const t=qc.S(M());if(t>=12.2&&t<13){const t="An internal error was encountered in the Indexed Database server";if(e.message.indexOf(t)>=0){const e=new fc("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '".concat(t,"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround."));return Yc||(Yc=!0,setTimeout((()=>{throw e}),0)),e}}return e}class Jc{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.se(e),this.oe=e=>t.writeSequenceNumber(e))}se(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.oe&&this.oe(e),e}}function Zc(e){return null==e}function eu(e){return 0===e&&1/e==-1/0}function tu(e){return"number"==typeof e&&Number.isInteger(e)&&!eu(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}Jc._e=-1;const nu=["mutationQueues","mutations","documentMutations","remoteDocuments","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries"],ru=["mutationQueues","mutations","documentMutations","remoteDocumentsV14","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries","documentOverlays"],iu=ru;function ou(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function su(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function au(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class lu{constructor(e,t){this.comparator=e,this.root=t||uu.EMPTY}insert(e,t){return new lu(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,uu.BLACK,null,null))}remove(e){return new lu(this.comparator,this.root.remove(e,this.comparator).copy(null,null,uu.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((t,n)=>(e(t,n),!1)))}toString(){const e=[];return this.inorderTraversal(((t,n)=>(e.push("".concat(t,":").concat(n)),!1))),"{".concat(e.join(", "),"}")}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new cu(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new cu(this.root,e,this.comparator,!1)}getReverseIterator(){return new cu(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new cu(this.root,e,this.comparator,!0)}}class cu{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?n(e.key,t):1,t&&r&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(0===i){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class uu{constructor(e,t,n,r,i){this.key=e,this.value=t,this.color=null!=n?n:uu.RED,this.left=null!=r?r:uu.EMPTY,this.right=null!=i?i:uu.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,r,i){return new uu(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let r=this;const i=n(e,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return uu.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let n,r=this;if(t(e,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(e,t),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===t(e,r.key)){if(r.right.isEmpty())return uu.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(e,t))}return r.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,uu.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,uu.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw cc();if(this.right.isRed())throw cc();const e=this.left.check();if(e!==this.right.check())throw cc();return e+(this.isRed()?0:1)}}uu.EMPTY=null,uu.RED=!0,uu.BLACK=!1,uu.EMPTY=new class{constructor(){this.size=0}get key(){throw cc()}get value(){throw cc()}get color(){throw cc()}get left(){throw cc()}get right(){throw cc()}copy(e,t,n,r,i){return this}insert(e,t,n){return new uu(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class hu{constructor(e){this.comparator=e,this.data=new lu(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,n)=>(e(t),!1)))}forEachInRange(e,t){const n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new du(this.data.getIterator())}getIteratorFrom(e){return new du(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size{t=t.add(e)})),t}isEqual(e){if(!(e instanceof hu))return!1;if(this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(0!==this.comparator(e,r))return!1}return!0}toArray(){const e=[];return this.forEach((t=>{e.push(t)})),e}toString(){const e=[];return this.forEach((t=>e.push(t))),"SortedSet("+e.toString()+")"}copy(e){const t=new hu(this.comparator);return t.data=e,t}}class du{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class fu{constructor(e){this.fields=e,e.sort(Rc.comparator)}static empty(){return new fu([])}unionWith(e){let t=new hu(Rc.comparator);for(const n of this.fields)t=t.add(n);for(const n of e)t=t.add(n);return new fu(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Cc(this.fields,e.fields,((e,t)=>e.isEqual(t)))}}class pu extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class mu{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new pu("Invalid base64 string: "+e):e}}(e);return new mu(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;nexu(e,t)))}function Nu(e,t){if(e===t)return 0;const n=Cu(e),r=Cu(t);if(n!==r)return Tc(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Tc(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=yu(e.integerValue||e.doubleValue),r=yu(t.integerValue||t.doubleValue);return nr?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return Ou(e.timestampValue,t.timestampValue);case 4:return Ou(Su(e),Su(t));case 5:return Tc(e.stringValue,t.stringValue);case 6:return function(e,t){const n=wu(e),r=wu(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),r=t.split("/");for(let i=0;it.mapValue.fields[e]=Uu(n))),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=Uu(e.arrayValue.values[n]);return t}return Object.assign({},e)}function Vu(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}class Bu{constructor(e){this.value=e}static empty(){return new Bu({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n{if(!t.isImmediateParentOf(i)){const e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=i.popLast()}e?n[i.lastSegment()]=Uu(e):r.push(i.lastSegment())}));const i=this.getFieldsMap(t);this.applyChanges(i,n,r)}delete(e){const t=this.field(e.popLast());Fu(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return xu(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;ne[t]=n));for(const r of n)delete e[r]}clone(){return new Bu(Uu(this.value))}}function zu(e){const t=[];return su(e.fields,((e,n)=>{const r=new Rc([e]);if(Fu(n)){const e=zu(n.mapValue).fields;if(0===e.length)t.push(r);else for(const n of e)t.push(r.child(n))}else t.push(r)})),new fu(t)}class Hu{constructor(e,t,n,r,i,o,s){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=i,this.data=o,this.documentState=s}static newInvalidDocument(e){return new Hu(e,0,Ic.min(),Ic.min(),Ic.min(),Bu.empty(),0)}static newFoundDocument(e,t,n,r){return new Hu(e,1,t,Ic.min(),n,r,0)}static newNoDocument(e,t){return new Hu(e,2,t,Ic.min(),Ic.min(),Bu.empty(),0)}static newUnknownDocument(e,t){return new Hu(e,3,t,Ic.min(),Ic.min(),Bu.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(Ic.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Bu.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Bu.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Ic.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof Hu&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Hu(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return"Document(".concat(this.key,", ").concat(this.version,", ").concat(JSON.stringify(this.data.value),", {createTime: ").concat(this.createTime,"}), {documentType: ").concat(this.documentType,"}), {documentState: ").concat(this.documentState,"})")}}class qu{constructor(e,t){this.position=e,this.inclusive=t}}function Wu(e,t,n){let r=0;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:"asc";this.field=e,this.dir=t}}function Qu(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}class $u{}class Yu extends $u{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new ih(e,t,n):"array-contains"===t?new lh(e,n):"in"===t?new ch(e,n):"not-in"===t?new uh(e,n):"array-contains-any"===t?new hh(e,n):new Yu(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new oh(e,n):new sh(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(Nu(t,this.value)):null!==t&&Cu(this.value)===Cu(t)&&this.matchesComparison(Nu(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return cc()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Xu extends $u{constructor(e,t){super(),this.filters=e,this.op=t,this.ue=null}static create(e,t){return new Xu(e,t)}matches(e){return Ju(this)?void 0===this.filters.find((t=>!t.matches(e))):void 0!==this.filters.find((t=>t.matches(e)))}getFlattenedFilters(){return null!==this.ue||(this.ue=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.ue}getFilters(){return Object.assign([],this.filters)}}function Ju(e){return"and"===e.op}function Zu(e){return eh(e)&&Ju(e)}function eh(e){for(const t of e.filters)if(t instanceof Xu)return!1;return!0}function th(e){if(e instanceof Yu)return e.field.canonicalString()+e.op.toString()+Pu(e.value);if(Zu(e))return e.filters.map((e=>th(e))).join(",");{const t=e.filters.map((e=>th(e))).join(",");return"".concat(e.op,"(").concat(t,")")}}function nh(e,t){return e instanceof Yu?function(e,t){return t instanceof Yu&&e.op===t.op&&e.field.isEqual(t.field)&&xu(e.value,t.value)}(e,t):e instanceof Xu?function(e,t){return t instanceof Xu&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce(((e,n,r)=>e&&nh(n,t.filters[r])),!0)}(e,t):void cc()}function rh(e){return e instanceof Yu?function(e){return"".concat(e.field.canonicalString()," ").concat(e.op," ").concat(Pu(e.value))}(e):e instanceof Xu?function(e){return e.op.toString()+" {"+e.getFilters().map(rh).join(" ,")+"}"}(e):"Filter"}class ih extends Yu{constructor(e,t,n){super(e,t,n),this.key=Ac.fromName(n.referenceValue)}matches(e){const t=Ac.comparator(e.key,this.key);return this.matchesComparison(t)}}class oh extends Yu{constructor(e,t){super(e,"in",t),this.keys=ah("in",t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}}class sh extends Yu{constructor(e,t){super(e,"not-in",t),this.keys=ah("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}}function ah(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map((e=>Ac.fromName(e.referenceValue)))}class lh extends Yu{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Lu(t)&&Iu(t.arrayValue,this.value)}}class ch extends Yu{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&Iu(this.value.arrayValue,t)}}class uh extends Yu{constructor(e,t){super(e,"not-in",t)}matches(e){if(Iu(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&!Iu(this.value.arrayValue,t)}}class hh extends Yu{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Lu(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>Iu(this.value.arrayValue,e)))}}class dh{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=s,this.ce=null}}function fh(e){return new dh(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,arguments.length>6&&void 0!==arguments[6]?arguments[6]:null)}function ph(e){const t=hc(e);if(null===t.ce){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map((e=>th(e))).join(","),e+="|ob:",e+=t.orderBy.map((e=>function(e){return e.field.canonicalString()+e.dir}(e))).join(","),Zc(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((e=>Pu(e))).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((e=>Pu(e))).join(",")),t.ce=e}return t.ce}function mh(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"F",s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=o,this.startAt=s,this.endAt=a,this.le=null,this.he=null,this.Pe=null,this.startAt,this.endAt}}function yh(e,t,n,r,i,o,s,a){return new vh(e,t,n,r,i,o,s,a)}function wh(e){return new vh(e)}function bh(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function Eh(e){return null!==e.collectionGroup}function Sh(e){const t=hc(e);if(null===t.le){t.le=[];const e=new Set;for(const i of t.explicitOrderBy)t.le.push(i),e.add(i.field.canonicalString());const n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",r=function(e){let t=new hu(Rc.comparator);return e.filters.forEach((e=>{e.getFlattenedFilters().forEach((e=>{e.isInequality()&&(t=t.add(e.field))}))})),t}(t);r.forEach((r=>{e.has(r.canonicalString())||r.isKeyField()||t.le.push(new Ku(r,n))})),e.has(Rc.keyField().canonicalString())||t.le.push(new Ku(Rc.keyField(),n))}return t.le}function _h(e){const t=hc(e);return t.he||(t.he=kh(t,Sh(e))),t.he}function kh(e,t){if("F"===e.limitType)return fh(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map((e=>{const t="desc"===e.dir?"asc":"desc";return new Ku(e.field,t)}));const n=e.endAt?new qu(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new qu(e.startAt.position,e.startAt.inclusive):null;return fh(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}function Th(e,t){const n=e.filters.concat([t]);return new vh(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function Ch(e,t,n){return new vh(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function xh(e,t){return mh(_h(e),_h(t))&&e.limitType===t.limitType}function Ih(e){return"".concat(ph(_h(e)),"|lt:").concat(e.limitType)}function Nh(e){return"Query(target=".concat(function(e){let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=", filters: [".concat(e.filters.map((e=>rh(e))).join(", "),"]")),Zc(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=", orderBy: [".concat(e.orderBy.map((e=>function(e){return"".concat(e.field.canonicalString()," (").concat(e.dir,")")}(e))).join(", "),"]")),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((e=>Pu(e))).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((e=>Pu(e))).join(",")),"Target(".concat(t,")")}(_h(e)),"; limitType=").concat(e.limitType,")")}function Oh(e,t){return t.isFoundDocument()&&function(e,t){const n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):Ac.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of Sh(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(const n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){const r=Wu(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,Sh(e),t))&&!(e.endAt&&!function(e,t,n){const r=Wu(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,Sh(e),t))}(e,t)}function Ph(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function Rh(e){return(t,n)=>{let r=!1;for(const i of Sh(e)){const e=Ah(i,t,n);if(0!==e)return e;r=r||i.field.isKeyField()}return 0}}function Ah(e,t,n){const r=e.field.isKeyField()?Ac.comparator(t.key,n.key):function(e,t,n){const r=t.data.field(e),i=n.data.field(e);return null!==r&&null!==i?Nu(r,i):cc()}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return cc()}}class Dh{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n)for(const[r,i]of n)if(this.equalsFn(r,e))return i}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(let i=0;i{for(const[r,i]of n)e(r,i)}))}isEmpty(){return au(this.inner)}size(){return this.innerSize}}const Lh=new lu(Ac.comparator);function Mh(){return Lh}const jh=new lu(Ac.comparator);function Fh(){let e=jh;for(var t=arguments.length,n=new Array(t),r=0;rt=t.insert(e,n.overlayedDocument))),t}function Vh(){return zh()}function Bh(){return zh()}function zh(){return new Dh((e=>e.toString()),((e,t)=>e.isEqual(t)))}const Hh=new lu(Ac.comparator),qh=new hu(Ac.comparator);function Wh(){let e=qh;for(var t=arguments.length,n=new Array(t),r=0;rxu(e,r)))||n.push(r);return{arrayValue:{values:n}}}class id extends Xh{constructor(e){super(),this.elements=e}}function od(e,t){let n=ld(t);for(const r of e.elements)n=n.filter((e=>!xu(e,r)));return{arrayValue:{values:n}}}class sd extends Xh{constructor(e,t){super(),this.serializer=e,this.Ie=t}}function ad(e){return yu(e.integerValue||e.doubleValue)}function ld(e){return Lu(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class cd{constructor(e,t){this.field=e,this.transform=t}}class ud{constructor(e,t){this.version=e,this.transformResults=t}}class hd{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new hd}static exists(e){return new hd(void 0,e)}static updateTime(e){return new hd(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function dd(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class fd{}function pd(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new kd(e.key,hd.none()):new wd(e.key,e.data,hd.none());{const n=e.data,r=Bu.empty();let i=new hu(Rc.comparator);for(let e of t.fields)if(!i.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?r.delete(e):r.set(e,t),i=i.add(e)}return new bd(e.key,r,new fu(i.toArray()),hd.none())}}function md(e,t,n){e instanceof wd?function(e,t,n){const r=e.value.clone(),i=Sd(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof bd?function(e,t,n){if(!dd(e.precondition,t))return void t.convertToUnknownDocument(n.version);const r=Sd(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(Ed(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function gd(e,t,n,r){return e instanceof wd?function(e,t,n,r){if(!dd(e.precondition,t))return n;const i=e.value.clone(),o=_d(e.fieldTransforms,r,t);return i.setAll(o),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof bd?function(e,t,n,r){if(!dd(e.precondition,t))return n;const i=_d(e.fieldTransforms,r,t),o=t.data;return o.setAll(Ed(e)),o.setAll(i),t.convertToFoundDocument(t.version,o).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,r):function(e,t,n){return dd(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function vd(e,t){let n=null;for(const r of e.fieldTransforms){const e=t.data.field(r.field),i=ed(r.transform,e||null);null!=i&&(null===n&&(n=Bu.empty()),n.set(r.field,i))}return n||null}function yd(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Cc(e,t,((e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof nd&&t instanceof nd||e instanceof id&&t instanceof id?Cc(e.elements,t.elements,xu):e instanceof sd&&t instanceof sd?xu(e.Ie,t.Ie):e instanceof td&&t instanceof td}(e.transform,t.transform)}(e,t)))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class wd extends fd{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class bd extends fd{constructor(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function Ed(e){const t=new Map;return e.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=e.data.field(n);t.set(n,r)}})),t}function Sd(e,t,n){const r=new Map;uc(e.length===n.length);for(let i=0;i{const i=e.get(r.key),o=i.overlayedDocument;let s=this.applyToLocalView(o,i.mutatedFields);s=t.has(r.key)?null:s;const a=pd(o,s);null!==a&&n.set(r.key,a),o.isValidDocument()||o.convertToNoDocument(Ic.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),Wh())}isEqual(e){return this.batchId===e.batchId&&Cc(this.mutations,e.mutations,((e,t)=>yd(e,t)))&&Cc(this.baseMutations,e.baseMutations,((e,t)=>yd(e,t)))}}class xd{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(e,t,n){uc(e.mutations.length===n.length);let r=Hh;const i=e.mutations;for(let o=0;o=8)throw new Vd("Invalid padding: ".concat(t));if(n<0)throw new Vd("Invalid hash count: ".concat(n));if(e.length>0&&0===this.hashCount)throw new Vd("Invalid hash count: ".concat(n));if(0===e.length&&0!==t)throw new Vd("Invalid padding when bitmap length is 0: ".concat(t));this.Te=8*e.length-t,this.Ee=Zl.fromNumber(this.Te)}de(e,t,n){let r=e.add(t.multiply(Zl.fromNumber(n)));return 1===r.compare(Md)&&(r=new Zl([r.getBits(0),r.getBits(1)],0)),r.modulo(this.Ee).toNumber()}Ae(e){return 0!=(this.bitmap[Math.floor(e/8)]&1<o.insert(e))),o}insert(e){if(0===this.Te)return;const t=jd(e),[n,r]=Fd(t);for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:mu.EMPTY_BYTE_STRING,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}}class Gd{constructor(){this.ge=0,this.pe=$d(),this.ye=mu.EMPTY_BYTE_STRING,this.we=!1,this.Se=!0}get current(){return this.we}get resumeToken(){return this.ye}get be(){return 0!==this.ge}get De(){return this.Se}Ce(e){e.approximateByteSize()>0&&(this.Se=!0,this.ye=e)}ve(){let e=Wh(),t=Wh(),n=Wh();return this.pe.forEach(((r,i)=>{switch(i){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:cc()}})),new zd(this.ye,this.we,e,t,n)}Fe(){this.Se=!1,this.pe=$d()}Me(e,t){this.Se=!0,this.pe=this.pe.insert(e,t)}xe(e){this.Se=!0,this.pe=this.pe.remove(e)}Oe(){this.ge+=1}Ne(){this.ge-=1,uc(this.ge>=0)}Be(){this.Se=!0,this.we=!0}}class Kd{constructor(e){this.Le=e,this.ke=new Map,this.qe=Mh(),this.Qe=Qd(),this.Ke=new lu(Tc)}$e(e){for(const t of e.Ve)e.me&&e.me.isFoundDocument()?this.Ue(t,e.me):this.We(t,e.key,e.me);for(const t of e.removedTargetIds)this.We(t,e.key,e.me)}Ge(e){this.forEachTarget(e,(t=>{const n=this.ze(t);switch(e.state){case 0:this.je(t)&&n.Ce(e.resumeToken);break;case 1:n.Ne(),n.be||n.Fe(),n.Ce(e.resumeToken);break;case 2:n.Ne(),n.be||this.removeTarget(t);break;case 3:this.je(t)&&(n.Be(),n.Ce(e.resumeToken));break;case 4:this.je(t)&&(this.He(t),n.Ce(e.resumeToken));break;default:cc()}}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.ke.forEach(((e,n)=>{this.je(n)&&t(n)}))}Je(e){const t=e.targetId,n=e.fe.count,r=this.Ye(t);if(r){const i=r.target;if(gh(i))if(0===n){const e=new Ac(i.path);this.We(t,e,Hu.newNoDocument(e,Ic.min()))}else uc(1===n);else{const r=this.Ze(t);if(r!==n){const n=this.Xe(e),i=n?this.et(n,e,r):1;if(0!==i){this.He(t);const e=2===i?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ke=this.Ke.insert(t,e)}null==Dd||Dd.tt(function(e,t,n,r,i){var o,s,a,l,c,u;const h={localCacheCount:e,existenceFilterCount:t.count,databaseId:n.database,projectId:n.projectId},d=t.unchangedNames;return d&&(h.bloomFilter={applied:0===i,hashCount:null!==(o=null==d?void 0:d.hashCount)&&void 0!==o?o:0,bitmapLength:null!==(l=null===(a=null===(s=null==d?void 0:d.bits)||void 0===s?void 0:s.bitmap)||void 0===a?void 0:a.length)&&void 0!==l?l:0,padding:null!==(u=null===(c=null==d?void 0:d.bits)||void 0===c?void 0:c.padding)&&void 0!==u?u:0,mightContain:e=>{var t;return null!==(t=null==r?void 0:r.mightContain(e))&&void 0!==t&&t}}),h}(r,e.fe,this.Le.nt(),n,i))}}}}Xe(e){const t=e.fe.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:n="",padding:r=0},hashCount:i=0}=t;let o,s;try{o=wu(n).toUint8Array()}catch(e){if(e instanceof pu)return ac("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{s=new Ud(o,r,i)}catch(e){return ac(e instanceof Vd?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===s.Te?null:s}et(e,t,n){return t.fe.count===n-this.rt(e,t.targetId)?0:2}rt(e,t){const n=this.Le.getRemoteKeysForTarget(t);let r=0;return n.forEach((n=>{const i=this.Le.nt(),o="projects/".concat(i.projectId,"/databases/").concat(i.database,"/documents/").concat(n.path.canonicalString());e.mightContain(o)||(this.We(t,n,null),r++)})),r}it(e){const t=new Map;this.ke.forEach(((n,r)=>{const i=this.Ye(r);if(i){if(n.current&&gh(i.target)){const t=new Ac(i.target.path);null!==this.qe.get(t)||this.st(r,t)||this.We(r,t,Hu.newNoDocument(t,e))}n.De&&(t.set(r,n.ve()),n.Fe())}}));let n=Wh();this.Qe.forEach(((e,t)=>{let r=!0;t.forEachWhile((e=>{const t=this.Ye(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(r=!1,!1)})),r&&(n=n.add(e))})),this.qe.forEach(((t,n)=>n.setReadTime(e)));const r=new Bd(e,t,this.Ke,this.qe,n);return this.qe=Mh(),this.Qe=Qd(),this.Ke=new lu(Tc),r}Ue(e,t){if(!this.je(e))return;const n=this.st(e,t.key)?2:0;this.ze(e).Me(t.key,n),this.qe=this.qe.insert(t.key,t),this.Qe=this.Qe.insert(t.key,this.ot(t.key).add(e))}We(e,t,n){if(!this.je(e))return;const r=this.ze(e);this.st(e,t)?r.Me(t,1):r.xe(t),this.Qe=this.Qe.insert(t,this.ot(t).delete(e)),n&&(this.qe=this.qe.insert(t,n))}removeTarget(e){this.ke.delete(e)}Ze(e){const t=this.ze(e).ve();return this.Le.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Oe(e){this.ze(e).Oe()}ze(e){let t=this.ke.get(e);return t||(t=new Gd,this.ke.set(e,t)),t}ot(e){let t=this.Qe.get(e);return t||(t=new hu(Tc),this.Qe=this.Qe.insert(e,t)),t}je(e){const t=null!==this.Ye(e);return t||oc("WatchChangeAggregator","Detected inactive target",e),t}Ye(e){const t=this.ke.get(e);return t&&t.be?null:this.Le._t(e)}He(e){this.ke.set(e,new Gd),this.Le.getRemoteKeysForTarget(e).forEach((t=>{this.We(e,t,null)}))}st(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}function Qd(){return new lu(Ac.comparator)}function $d(){return new lu(Ac.comparator)}const Yd={asc:"ASCENDING",desc:"DESCENDING"},Xd={"<":"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"},Jd={and:"AND",or:"OR"};class Zd{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function ef(e,t){return e.useProto3Json||Zc(t)?t:{value:t}}function tf(e,t){return e.useProto3Json?"".concat(new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z",""),".").concat(("000000000"+t.nanoseconds).slice(-9),"Z"):{seconds:""+t.seconds,nanos:t.nanoseconds}}function nf(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function rf(e,t){return tf(e,t.toTimestamp())}function of(e){return uc(!!e),Ic.fromTimestamp(function(e){const t=vu(e);return new xc(t.seconds,t.nanos)}(e))}function sf(e,t){return af(e,t).canonicalString()}function af(e,t){const n=function(e){return new Oc(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function lf(e){const t=Oc.fromString(e);return uc(If(t)),t}function cf(e,t){return sf(e.databaseId,t.path)}function uf(e,t){const n=lf(t);if(n.get(1)!==e.databaseId.projectId)throw new fc(dc.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new fc(dc.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new Ac(pf(n))}function hf(e,t){return sf(e.databaseId,t)}function df(e){const t=lf(e);return 4===t.length?Oc.emptyPath():pf(t)}function ff(e){return new Oc(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function pf(e){return uc(e.length>4&&"documents"===e.get(4)),e.popFirst(5)}function mf(e,t,n){return{name:cf(e,t),fields:n.value.mapValue.fields}}function gf(e,t){let n;if(t instanceof wd)n={update:mf(e,t.key,t.value)};else if(t instanceof kd)n={delete:cf(e,t.key)};else if(t instanceof bd)n={update:mf(e,t.key,t.data),updateMask:xf(t.fieldMask)};else{if(!(t instanceof Td))return cc();n={verify:cf(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map((e=>function(e,t){const n=t.transform;if(n instanceof td)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof nd)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof id)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof sd)return{fieldPath:t.field.canonicalString(),increment:n.Ie};throw cc()}(0,e)))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:rf(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:cc()}(e,t.precondition)),n}function vf(e,t){return{documents:[hf(e,t.path)]}}function yf(e,t){const n={structuredQuery:{}},r=t.path;let i;null!==t.collectionGroup?(i=r,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=hf(e,i);const o=function(e){if(0!==e.length)return Cf(Xu.create(e,"and"))}(t.filters);o&&(n.structuredQuery.where=o);const s=function(e){if(0!==e.length)return e.map((e=>function(e){return{field:kf(e.field),direction:Ef(e.dir)}}(e)))}(t.orderBy);s&&(n.structuredQuery.orderBy=s);const a=ef(e,t.limit);return null!==a&&(n.structuredQuery.limit=a),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{ut:n,parent:i}}function wf(e){let t=df(e.parent);const n=e.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){uc(1===r);const e=n.from[0];e.allDescendants?i=e.collectionId:t=t.child(e.collectionId)}let o=[];n.where&&(o=function(e){const t=bf(e);return t instanceof Xu&&Zu(t)?t.getFilters():[t]}(n.where));let s=[];n.orderBy&&(s=function(e){return e.map((e=>function(e){return new Ku(Tf(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e)))}(n.orderBy));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,Zc(t)?null:t}(n.limit));let l=null;n.startAt&&(l=function(e){const t=!!e.before,n=e.values||[];return new qu(n,t)}(n.startAt));let c=null;return n.endAt&&(c=function(e){const t=!e.before,n=e.values||[];return new qu(n,t)}(n.endAt)),yh(t,i,s,o,a,"F",l,c)}function bf(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=Tf(e.unaryFilter.field);return Yu.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=Tf(e.unaryFilter.field);return Yu.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=Tf(e.unaryFilter.field);return Yu.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=Tf(e.unaryFilter.field);return Yu.create(i,"!=",{nullValue:"NULL_VALUE"});default:return cc()}}(e):void 0!==e.fieldFilter?function(e){return Yu.create(Tf(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return cc()}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return Xu.create(e.compositeFilter.filters.map((e=>bf(e))),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return cc()}}(e.compositeFilter.op))}(e):cc()}function Ef(e){return Yd[e]}function Sf(e){return Xd[e]}function _f(e){return Jd[e]}function kf(e){return{fieldPath:e.canonicalString()}}function Tf(e){return Rc.fromServerFormat(e.fieldPath)}function Cf(e){return e instanceof Yu?function(e){if("=="===e.op){if(ju(e.value))return{unaryFilter:{field:kf(e.field),op:"IS_NAN"}};if(Mu(e.value))return{unaryFilter:{field:kf(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(ju(e.value))return{unaryFilter:{field:kf(e.field),op:"IS_NOT_NAN"}};if(Mu(e.value))return{unaryFilter:{field:kf(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:kf(e.field),op:Sf(e.op),value:e.value}}}(e):e instanceof Xu?function(e){const t=e.getFilters().map((e=>Cf(e)));return 1===t.length?t[0]:{compositeFilter:{op:_f(e.op),filters:t}}}(e):cc()}function xf(e){const t=[];return e.fields.forEach((e=>t.push(e.canonicalString()))),{fieldPaths:t}}function If(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}class Nf{constructor(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Ic.min(),o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Ic.min(),s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:mu.EMPTY_BYTE_STRING,a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s,this.expectedCount=a}withSequenceNumber(e){return new Nf(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new Nf(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Nf(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Nf(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class Of{constructor(e){this.ct=e}}function Pf(e){const t=wf({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?Ch(t,t.limit,"L"):t}class Rf{constructor(){}Pt(e,t){this.It(e,t),t.Tt()}It(e,t){if("nullValue"in e)this.Et(t,5);else if("booleanValue"in e)this.Et(t,10),t.dt(e.booleanValue?1:0);else if("integerValue"in e)this.Et(t,15),t.dt(yu(e.integerValue));else if("doubleValue"in e){const n=yu(e.doubleValue);isNaN(n)?this.Et(t,13):(this.Et(t,15),eu(n)?t.dt(0):t.dt(n))}else if("timestampValue"in e){const n=e.timestampValue;this.Et(t,20),"string"==typeof n?t.At(n):(t.At("".concat(n.seconds||"")),t.dt(n.nanos||0))}else if("stringValue"in e)this.Rt(e.stringValue,t),this.Vt(t);else if("bytesValue"in e)this.Et(t,30),t.ft(wu(e.bytesValue)),this.Vt(t);else if("referenceValue"in e)this.gt(e.referenceValue,t);else if("geoPointValue"in e){const n=e.geoPointValue;this.Et(t,45),t.dt(n.latitude||0),t.dt(n.longitude||0)}else"mapValue"in e?Vu(e)?this.Et(t,Number.MAX_SAFE_INTEGER):(this.yt(e.mapValue,t),this.Vt(t)):"arrayValue"in e?(this.wt(e.arrayValue,t),this.Vt(t)):cc()}Rt(e,t){this.Et(t,25),this.St(e,t)}St(e,t){t.At(e)}yt(e,t){const n=e.fields||{};this.Et(t,55);for(const r of Object.keys(n))this.Rt(r,t),this.It(n[r],t)}wt(e,t){const n=e.values||[];this.Et(t,50);for(const r of n)this.It(r,t)}gt(e,t){this.Et(t,37),Ac.fromName(e).path.forEach((e=>{this.Et(t,60),this.St(e,t)}))}Et(e,t){e.dt(t)}Vt(e){e.dt(2)}}Rf.bt=new Rf;class Af{constructor(){this._n=new Df}addToCollectionParentIndex(e,t){return this._n.add(t),zc.resolve()}getCollectionParents(e,t){return zc.resolve(this._n.getEntries(t))}addFieldIndex(e,t){return zc.resolve()}deleteFieldIndex(e,t){return zc.resolve()}deleteAllFieldIndexes(e){return zc.resolve()}createTargetIndexes(e,t){return zc.resolve()}getDocumentsMatchingTarget(e,t){return zc.resolve(null)}getIndexType(e,t){return zc.resolve(0)}getFieldIndexes(e,t){return zc.resolve([])}getNextCollectionGroupToUpdate(e){return zc.resolve(null)}getMinOffset(e,t){return zc.resolve(jc.min())}getMinOffsetFromCollectionGroup(e,t){return zc.resolve(jc.min())}updateCollectionGroup(e,t,n){return zc.resolve()}updateIndexEntries(e,t){return zc.resolve()}}class Df{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new hu(Oc.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}has(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}getEntries(e){return(this.index[e]||new hu(Oc.comparator)).toArray()}}new Uint8Array(0);class Lf{constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}static withCacheSize(e){return new Lf(e,Lf.DEFAULT_COLLECTION_PERCENTILE,Lf.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}Lf.DEFAULT_COLLECTION_PERCENTILE=10,Lf.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Lf.DEFAULT=new Lf(41943040,Lf.DEFAULT_COLLECTION_PERCENTILE,Lf.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Lf.DISABLED=new Lf(-1,0,0);class Mf{constructor(e){this.On=e}next(){return this.On+=2,this.On}static Nn(){return new Mf(0)}static Bn(){return new Mf(-1)}}class jf{constructor(){this.changes=new Dh((e=>e.toString()),((e,t)=>e.isEqual(t))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,Hu.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?zc.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}class Ff{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class Uf{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next((r=>(n=r,this.remoteDocumentCache.getEntry(e,t)))).next((e=>(null!==n&&gd(n.mutation,e,fu.empty(),xc.now()),e)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.getLocalViewOfDocuments(e,t,Wh()).next((()=>t))))}getLocalViewOfDocuments(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Wh();const r=Vh();return this.populateOverlays(e,r,t).next((()=>this.computeViews(e,t,r,n).next((e=>{let t=Fh();return e.forEach(((e,n)=>{t=t.insert(e,n.overlayedDocument)})),t}))))}getOverlayedDocuments(e,t){const n=Vh();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,Wh())))}populateOverlays(e,t,n){const r=[];return n.forEach((e=>{t.has(e)||r.push(e)})),this.documentOverlayCache.getOverlays(e,r).next((e=>{e.forEach(((e,n)=>{t.set(e,n)}))}))}computeViews(e,t,n,r){let i=Mh();const o=zh(),s=zh();return t.forEach(((e,t)=>{const s=n.get(t.key);r.has(t.key)&&(void 0===s||s.mutation instanceof bd)?i=i.insert(t.key,t):void 0!==s?(o.set(t.key,s.mutation.getFieldMask()),gd(s.mutation,t,s.mutation.getFieldMask(),xc.now())):o.set(t.key,fu.empty())})),this.recalculateAndSaveOverlays(e,i).next((e=>(e.forEach(((e,t)=>o.set(e,t))),t.forEach(((e,t)=>{var n;return s.set(e,new Ff(t,null!==(n=o.get(e))&&void 0!==n?n:null))})),s)))}recalculateAndSaveOverlays(e,t){const n=zh();let r=new lu(((e,t)=>e-t)),i=Wh();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((e=>{for(const i of e)i.keys().forEach((e=>{const o=t.get(e);if(null===o)return;let s=n.get(e)||fu.empty();s=i.applyToLocalView(o,s),n.set(e,s);const a=(r.get(i.batchId)||Wh()).add(e);r=r.insert(i.batchId,a)}))})).next((()=>{const o=[],s=r.getReverseIterator();for(;s.hasNext();){const r=s.getNext(),a=r.key,l=r.value,c=Bh();l.forEach((e=>{if(!i.has(e)){const r=pd(t.get(e),n.get(e));null!==r&&c.set(e,r),i=i.add(e)}})),o.push(this.documentOverlayCache.saveOverlays(e,a,c))}return zc.waitFor(o)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.recalculateAndSaveOverlays(e,t)))}getDocumentsMatchingQuery(e,t,n,r){return function(e){return Ac.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Eh(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next((i=>{const o=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-i.size):zc.resolve(Vh());let s=-1,a=i;return o.next((t=>zc.forEach(t,((t,n)=>(s{a=a.insert(t,e)}))))).next((()=>this.populateOverlays(e,t,i))).next((()=>this.computeViews(e,a,t,Wh()))).next((e=>({batchId:s,changes:Uh(e)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new Ac(t)).next((e=>{let t=Fh();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){const i=t.collectionGroup;let o=Fh();return this.indexManager.getCollectionParents(e,i).next((s=>zc.forEach(s,(s=>{const a=function(e,t){return new vh(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,s.child(i));return this.getDocumentsMatchingCollectionQuery(e,a,n,r).next((e=>{e.forEach(((e,t)=>{o=o.insert(e,t)}))}))})).next((()=>o))))}getDocumentsMatchingCollectionQuery(e,t,n,r){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r)))).next((e=>{i.forEach(((t,n)=>{const r=n.getKey();null===e.get(r)&&(e=e.insert(r,Hu.newInvalidDocument(r)))}));let n=Fh();return e.forEach(((e,r)=>{const o=i.get(e);void 0!==o&&gd(o.mutation,r,fu.empty(),xc.now()),Oh(t,r)&&(n=n.insert(e,r))})),n}))}}class Vf{constructor(e){this.serializer=e,this.cr=new Map,this.lr=new Map}getBundleMetadata(e,t){return zc.resolve(this.cr.get(t))}saveBundleMetadata(e,t){return this.cr.set(t.id,function(e){return{id:e.id,version:e.version,createTime:of(e.createTime)}}(t)),zc.resolve()}getNamedQuery(e,t){return zc.resolve(this.lr.get(t))}saveNamedQuery(e,t){return this.lr.set(t.name,function(e){return{name:e.name,query:Pf(e.bundledQuery),readTime:of(e.readTime)}}(t)),zc.resolve()}}class Bf{constructor(){this.overlays=new lu(Ac.comparator),this.hr=new Map}getOverlay(e,t){return zc.resolve(this.overlays.get(t))}getOverlays(e,t){const n=Vh();return zc.forEach(t,(t=>this.getOverlay(e,t).next((e=>{null!==e&&n.set(t,e)})))).next((()=>n))}saveOverlays(e,t,n){return n.forEach(((n,r)=>{this.ht(e,t,r)})),zc.resolve()}removeOverlaysForBatchId(e,t,n){const r=this.hr.get(n);return void 0!==r&&(r.forEach((e=>this.overlays=this.overlays.remove(e))),this.hr.delete(n)),zc.resolve()}getOverlaysForCollection(e,t,n){const r=Vh(),i=t.length+1,o=new Ac(t.child("")),s=this.overlays.getIteratorFrom(o);for(;s.hasNext();){const e=s.getNext().value,o=e.getKey();if(!t.isPrefixOf(o.path))break;o.path.length===i&&e.largestBatchId>n&&r.set(e.getKey(),e)}return zc.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let i=new lu(((e,t)=>e-t));const o=this.overlays.getIterator();for(;o.hasNext();){const e=o.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=i.get(e.largestBatchId);null===t&&(t=Vh(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const s=Vh(),a=i.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((e,t)=>s.set(e,t))),!(s.size()>=r)););return zc.resolve(s)}ht(e,t,n){const r=this.overlays.get(n.key);if(null!==r){const e=this.hr.get(r.largestBatchId).delete(n.key);this.hr.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new Id(t,n));let i=this.hr.get(t);void 0===i&&(i=Wh(),this.hr.set(t,i)),this.hr.set(t,i.add(n.key))}}class zf{constructor(){this.Pr=new hu(Hf.Ir),this.Tr=new hu(Hf.Er)}isEmpty(){return this.Pr.isEmpty()}addReference(e,t){const n=new Hf(e,t);this.Pr=this.Pr.add(n),this.Tr=this.Tr.add(n)}dr(e,t){e.forEach((e=>this.addReference(e,t)))}removeReference(e,t){this.Ar(new Hf(e,t))}Rr(e,t){e.forEach((e=>this.removeReference(e,t)))}Vr(e){const t=new Ac(new Oc([])),n=new Hf(t,e),r=new Hf(t,e+1),i=[];return this.Tr.forEachInRange([n,r],(e=>{this.Ar(e),i.push(e.key)})),i}mr(){this.Pr.forEach((e=>this.Ar(e)))}Ar(e){this.Pr=this.Pr.delete(e),this.Tr=this.Tr.delete(e)}gr(e){const t=new Ac(new Oc([])),n=new Hf(t,e),r=new Hf(t,e+1);let i=Wh();return this.Tr.forEachInRange([n,r],(e=>{i=i.add(e.key)})),i}containsKey(e){const t=new Hf(e,0),n=this.Pr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class Hf{constructor(e,t){this.key=e,this.pr=t}static Ir(e,t){return Ac.comparator(e.key,t.key)||Tc(e.pr,t.pr)}static Er(e,t){return Tc(e.pr,t.pr)||Ac.comparator(e.key,t.key)}}class qf{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.yr=1,this.wr=new hu(Hf.Ir)}checkEmpty(e){return zc.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,r){const i=this.yr;this.yr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new Cd(i,t,n,r);this.mutationQueue.push(o);for(const s of r)this.wr=this.wr.add(new Hf(s.key,i)),this.indexManager.addToCollectionParentIndex(e,s.key.path.popLast());return zc.resolve(o)}lookupMutationBatch(e,t){return zc.resolve(this.Sr(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,r=this.br(n),i=r<0?0:r;return zc.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return zc.resolve(0===this.mutationQueue.length?-1:this.yr-1)}getAllMutationBatches(e){return zc.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new Hf(t,0),r=new Hf(t,Number.POSITIVE_INFINITY),i=[];return this.wr.forEachInRange([n,r],(e=>{const t=this.Sr(e.pr);i.push(t)})),zc.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new hu(Tc);return t.forEach((e=>{const t=new Hf(e,0),r=new Hf(e,Number.POSITIVE_INFINITY);this.wr.forEachInRange([t,r],(e=>{n=n.add(e.pr)}))})),zc.resolve(this.Dr(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,r=n.length+1;let i=n;Ac.isDocumentKey(i)||(i=i.child(""));const o=new Hf(new Ac(i),0);let s=new hu(Tc);return this.wr.forEachWhile((e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(s=s.add(e.pr)),!0)}),o),zc.resolve(this.Dr(s))}Dr(e){const t=[];return e.forEach((e=>{const n=this.Sr(e);null!==n&&t.push(n)})),t}removeMutationBatch(e,t){uc(0===this.Cr(t.batchId,"removed")),this.mutationQueue.shift();let n=this.wr;return zc.forEach(t.mutations,(r=>{const i=new Hf(r.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)})).next((()=>{this.wr=n}))}Mn(e){}containsKey(e,t){const n=new Hf(t,0),r=this.wr.firstAfterOrEqual(n);return zc.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,zc.resolve()}Cr(e,t){return this.br(e)}br(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Sr(e){const t=this.br(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class Wf{constructor(e){this.vr=e,this.docs=new lu(Ac.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,r=this.docs.get(n),i=r?r.size:0,o=this.vr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:o}),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return zc.resolve(n?n.document.mutableCopy():Hu.newInvalidDocument(t))}getEntries(e,t){let n=Mh();return t.forEach((e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():Hu.newInvalidDocument(e))})),zc.resolve(n)}getDocumentsMatchingQuery(e,t,n,r){let i=Mh();const o=t.path,s=new Ac(o.child("")),a=this.docs.getIteratorFrom(s);for(;a.hasNext();){const{key:e,value:{document:s}}=a.getNext();if(!o.isPrefixOf(e.path))break;e.path.length>o.length+1||Fc(Mc(s),n)<=0||(r.has(s.key)||Oh(t,s))&&(i=i.insert(s.key,s.mutableCopy()))}return zc.resolve(i)}getAllFromCollectionGroup(e,t,n,r){cc()}Fr(e,t){return zc.forEach(this.docs,(e=>t(e)))}newChangeBuffer(e){return new Gf(this)}getSize(e){return zc.resolve(this.size)}}class Gf extends jf{constructor(e){super(),this.ar=e}applyChanges(e){const t=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?t.push(this.ar.addEntry(e,r)):this.ar.removeEntry(n)})),zc.waitFor(t)}getFromCache(e,t){return this.ar.getEntry(e,t)}getAllFromCache(e,t){return this.ar.getEntries(e,t)}}class Kf{constructor(e){this.persistence=e,this.Mr=new Dh((e=>ph(e)),mh),this.lastRemoteSnapshotVersion=Ic.min(),this.highestTargetId=0,this.Or=0,this.Nr=new zf,this.targetCount=0,this.Br=Mf.Nn()}forEachTarget(e,t){return this.Mr.forEach(((e,n)=>t(n))),zc.resolve()}getLastRemoteSnapshotVersion(e){return zc.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return zc.resolve(this.Or)}allocateTargetId(e){return this.highestTargetId=this.Br.next(),zc.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Or&&(this.Or=t),zc.resolve()}qn(e){this.Mr.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.Br=new Mf(t),this.highestTargetId=t),e.sequenceNumber>this.Or&&(this.Or=e.sequenceNumber)}addTargetData(e,t){return this.qn(t),this.targetCount+=1,zc.resolve()}updateTargetData(e,t){return this.qn(t),zc.resolve()}removeTargetData(e,t){return this.Mr.delete(t.target),this.Nr.Vr(t.targetId),this.targetCount-=1,zc.resolve()}removeTargets(e,t,n){let r=0;const i=[];return this.Mr.forEach(((o,s)=>{s.sequenceNumber<=t&&null===n.get(s.targetId)&&(this.Mr.delete(o),i.push(this.removeMatchingKeysForTargetId(e,s.targetId)),r++)})),zc.waitFor(i).next((()=>r))}getTargetCount(e){return zc.resolve(this.targetCount)}getTargetData(e,t){const n=this.Mr.get(t)||null;return zc.resolve(n)}addMatchingKeys(e,t,n){return this.Nr.dr(t,n),zc.resolve()}removeMatchingKeys(e,t,n){this.Nr.Rr(t,n);const r=this.persistence.referenceDelegate,i=[];return r&&t.forEach((t=>{i.push(r.markPotentiallyOrphaned(e,t))})),zc.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.Nr.Vr(t),zc.resolve()}getMatchingKeysForTargetId(e,t){const n=this.Nr.gr(t);return zc.resolve(n)}containsKey(e,t){return zc.resolve(this.Nr.containsKey(t))}}class Qf{constructor(e,t){this.Lr={},this.overlays={},this.kr=new Jc(0),this.qr=!1,this.qr=!0,this.referenceDelegate=e(this),this.Qr=new Kf(this),this.indexManager=new Af,this.remoteDocumentCache=function(e){return new Wf(e)}((e=>this.referenceDelegate.Kr(e))),this.serializer=new Of(t),this.$r=new Vf(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.qr=!1,Promise.resolve()}get started(){return this.qr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Bf,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.Lr[e.toKey()];return n||(n=new qf(t,this.referenceDelegate),this.Lr[e.toKey()]=n),n}getTargetCache(){return this.Qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.$r}runTransaction(e,t,n){oc("MemoryPersistence","Starting transaction:",e);const r=new $f(this.kr.next());return this.referenceDelegate.Ur(),n(r).next((e=>this.referenceDelegate.Wr(r).next((()=>e)))).toPromise().then((e=>(r.raiseOnCommittedEvent(),e)))}Gr(e,t){return zc.or(Object.values(this.Lr).map((n=>()=>n.containsKey(e,t))))}}class $f extends Vc{constructor(e){super(),this.currentSequenceNumber=e}}class Yf{constructor(e){this.persistence=e,this.zr=new zf,this.jr=null}static Hr(e){return new Yf(e)}get Jr(){if(this.jr)return this.jr;throw cc()}addReference(e,t,n){return this.zr.addReference(n,t),this.Jr.delete(n.toString()),zc.resolve()}removeReference(e,t,n){return this.zr.removeReference(n,t),this.Jr.add(n.toString()),zc.resolve()}markPotentiallyOrphaned(e,t){return this.Jr.add(t.toString()),zc.resolve()}removeTarget(e,t){this.zr.Vr(t.targetId).forEach((e=>this.Jr.add(e.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((e=>{e.forEach((e=>this.Jr.add(e.toString())))})).next((()=>n.removeTargetData(e,t)))}Ur(){this.jr=new Set}Wr(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return zc.forEach(this.Jr,(n=>{const r=Ac.fromPath(n);return this.Yr(e,r).next((e=>{e||t.removeEntry(r,Ic.min())}))})).next((()=>(this.jr=null,t.apply(e))))}updateLimboDocument(e,t){return this.Yr(e,t).next((e=>{e?this.Jr.delete(t.toString()):this.Jr.add(t.toString())}))}Kr(e){return 0}Yr(e,t){return zc.or([()=>zc.resolve(this.zr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Gr(e,t)])}}class Xf{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.qi=n,this.Qi=r}static Ki(e,t){let n=Wh(),r=Wh();for(const i of t.docChanges)switch(i.type){case 0:n=n.add(i.doc.key);break;case 1:r=r.add(i.doc.key)}return new Xf(e,t.fromCache,n,r)}}class Jf{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class Zf{constructor(){this.$i=!1,this.Ui=!1,this.Wi=100,this.Gi=j()?8:qc.v(M())>0?6:4}initialize(e,t){this.zi=e,this.indexManager=t,this.$i=!0}getDocumentsMatchingQuery(e,t,n,r){const i={result:null};return this.ji(e,t).next((e=>{i.result=e})).next((()=>{if(!i.result)return this.Hi(e,t,r,n).next((e=>{i.result=e}))})).next((()=>{if(i.result)return;const n=new Jf;return this.Ji(e,t,n).next((r=>{if(i.result=r,this.Ui)return this.Yi(e,t,n,r.size)}))})).next((()=>i.result))}Yi(e,t,n,r){return n.documentReadCountthis.Gi*r?(ic()<=te.DEBUG&&oc("QueryEngine","The SDK decides to create cache indexes for query:",Nh(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,_h(t))):zc.resolve())}ji(e,t){if(bh(t))return zc.resolve(null);let n=_h(t);return this.indexManager.getIndexType(e,n).next((r=>0===r?null:(null!==t.limit&&1===r&&(t=Ch(t,null,"F"),n=_h(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next((r=>{const i=Wh(...r);return this.zi.getDocuments(e,i).next((r=>this.indexManager.getMinOffset(e,n).next((n=>{const o=this.Zi(t,r);return this.Xi(t,o,i,n.readTime)?this.ji(e,Ch(t,null,"F")):this.es(e,o,t,n)}))))})))))}Hi(e,t,n,r){return bh(t)||r.isEqual(Ic.min())?zc.resolve(null):this.zi.getDocuments(e,n).next((i=>{const o=this.Zi(t,i);return this.Xi(t,o,n,r)?zc.resolve(null):(ic()<=te.DEBUG&&oc("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Nh(t)),this.es(e,o,t,Lc(r,-1)).next((e=>e)))}))}Zi(e,t){let n=new hu(Rh(e));return t.forEach(((t,r)=>{Oh(e,r)&&(n=n.add(r))})),n}Xi(e,t,n,r){if(null===e.limit)return!1;if(n.size!==t.size)return!0;const i="F"===e.limitType?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}Ji(e,t,n){return ic()<=te.DEBUG&&oc("QueryEngine","Using full collection scan to execute query:",Nh(t)),this.zi.getDocumentsMatchingQuery(e,t,jc.min(),n)}es(e,t,n,r){return this.zi.getDocumentsMatchingQuery(e,n,r).next((e=>(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}}class ep{constructor(e,t,n,r){this.persistence=e,this.ts=t,this.serializer=r,this.ns=new lu(Tc),this.rs=new Dh((e=>ph(e)),mh),this.ss=new Map,this.os=e.getRemoteDocumentCache(),this.Qr=e.getTargetCache(),this.$r=e.getBundleCache(),this._s(n)}_s(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Uf(this.os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.os.setIndexManager(this.indexManager),this.ts.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(t=>e.collect(t,this.ns)))}}function tp(e,t,n,r){return new ep(e,t,n,r)}async function np(e,t){const n=hc(e);return await n.persistence.runTransaction("Handle user change","readonly",(e=>{let r;return n.mutationQueue.getAllMutationBatches(e).next((i=>(r=i,n._s(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{const i=[],o=[];let s=Wh();for(const e of r){i.push(e.batchId);for(const t of e.mutations)s=s.add(t.key)}for(const e of t){o.push(e.batchId);for(const t of e.mutations)s=s.add(t.key)}return n.localDocuments.getDocuments(e,s).next((e=>({us:e,removedBatchIds:i,addedBatchIds:o})))}))}))}function rp(e){const t=hc(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",(e=>t.Qr.getLastRemoteSnapshotVersion(e)))}function ip(e,t,n){let r=Wh(),i=Wh();return n.forEach((e=>r=r.add(e))),t.getEntries(e,r).next((e=>{let r=Mh();return n.forEach(((n,o)=>{const s=e.get(n);o.isFoundDocument()!==s.isFoundDocument()&&(i=i.add(n)),o.isNoDocument()&&o.version.isEqual(Ic.min())?(t.removeEntry(n,o.readTime),r=r.insert(n,o)):!s.isValidDocument()||o.version.compareTo(s.version)>0||0===o.version.compareTo(s.version)&&s.hasPendingWrites?(t.addEntry(o),r=r.insert(n,o)):oc("LocalStore","Ignoring outdated watch update for ",n,". Current version:",s.version," Watch version:",o.version)})),{cs:r,ls:i}}))}function op(e,t){const n=hc(e);return n.persistence.runTransaction("Get next mutation batch","readonly",(e=>(void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t))))}function sp(e,t){const n=hc(e);return n.persistence.runTransaction("Allocate target","readwrite",(e=>{let r;return n.Qr.getTargetData(e,t).next((i=>i?(r=i,zc.resolve(r)):n.Qr.allocateTargetId(e).next((i=>(r=new Nf(t,i,"TargetPurposeListen",e.currentSequenceNumber),n.Qr.addTargetData(e,r).next((()=>r)))))))})).then((e=>{const r=n.ns.get(e.targetId);return(null===r||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.ns=n.ns.insert(e.targetId,e),n.rs.set(t,e.targetId)),e}))}async function ap(e,t,n){const r=hc(e),i=r.ns.get(t),o=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",o,(e=>r.persistence.referenceDelegate.removeTarget(e,i)))}catch(e){if(!Kc(e))throw e;oc("LocalStore","Failed to update sequence numbers for target ".concat(t,": ").concat(e))}r.ns=r.ns.remove(t),r.rs.delete(i.target)}function lp(e,t,n){const r=hc(e);let i=Ic.min(),o=Wh();return r.persistence.runTransaction("Execute query","readwrite",(e=>function(e,t,n){const r=hc(e),i=r.rs.get(n);return void 0!==i?zc.resolve(r.ns.get(i)):r.Qr.getTargetData(t,n)}(r,e,_h(t)).next((t=>{if(t)return i=t.lastLimboFreeSnapshotVersion,r.Qr.getMatchingKeysForTargetId(e,t.targetId).next((e=>{o=e}))})).next((()=>r.ts.getDocumentsMatchingQuery(e,t,n?i:Ic.min(),n?o:Wh()))).next((e=>(cp(r,Ph(t),e),{documents:e,hs:o})))))}function cp(e,t,n){let r=e.ss.get(t)||Ic.min();n.forEach(((e,t)=>{t.readTime.compareTo(r)>0&&(r=t.readTime)})),e.ss.set(t,r)}class up{constructor(){this.activeTargetIds=Kh()}As(e){this.activeTargetIds=this.activeTargetIds.add(e)}Rs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ds(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class hp{constructor(){this.no=new up,this.ro={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e){return this.no.As(e),this.ro[e]||"not-current"}updateQueryState(e,t,n){this.ro[e]=t}removeLocalQueryTarget(e){this.no.Rs(e)}isLocalQueryTarget(e){return this.no.activeTargetIds.has(e)}clearQueryState(e){delete this.ro[e]}getAllActiveQueryTargets(){return this.no.activeTargetIds}isActiveQueryTarget(e){return this.no.activeTargetIds.has(e)}start(){return this.no=new up,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class dp{io(e){}shutdown(){}}class fp{constructor(){this.so=()=>this.oo(),this._o=()=>this.ao(),this.uo=[],this.co()}io(e){this.uo.push(e)}shutdown(){window.removeEventListener("online",this.so),window.removeEventListener("offline",this._o)}co(){window.addEventListener("online",this.so),window.addEventListener("offline",this._o)}oo(){oc("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.uo)e(0)}ao(){oc("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.uo)e(1)}static D(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let pp=null;function mp(){return null===pp?pp=268435456+Math.round(2147483648*Math.random()):pp++,"0x"+pp.toString(16)}const gp={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class vp{constructor(e){this.lo=e.lo,this.ho=e.ho}Po(e){this.Io=e}To(e){this.Eo=e}onMessage(e){this.Ao=e}close(){this.ho()}send(e){this.lo(e)}Ro(){this.Io()}Vo(e){this.Eo(e)}mo(e){this.Ao(e)}}const yp="WebChannelConnection";class wp extends class{constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.fo=t+"://"+e.host,this.po="projects/".concat(n,"/databases/").concat(r),this.yo="(default)"===this.databaseId.database?"project_id=".concat(n):"project_id=".concat(n,"&database_id=").concat(r)}get wo(){return!1}So(e,t,n,r,i){const o=mp(),s=this.bo(e,t.toUriEncodedString());oc("RestConnection","Sending RPC '".concat(e,"' ").concat(o,":"),s,n);const a={"google-cloud-resource-prefix":this.po,"x-goog-request-params":this.yo};return this.Do(a,r,i),this.Co(e,s,a,n).then((t=>(oc("RestConnection","Received RPC '".concat(e,"' ").concat(o,": "),t),t)),(t=>{throw ac("RestConnection","RPC '".concat(e,"' ").concat(o," failed with error: "),t,"url: ",s,"request:",n),t}))}vo(e,t,n,r,i,o){return this.So(e,t,n,r,i)}Do(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+nc,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach(((t,n)=>e[n]=t)),n&&n.headers.forEach(((t,n)=>e[n]=t))}bo(e,t){const n=gp[e];return"".concat(this.fo,"/v1/").concat(t,":").concat(n)}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Co(e,t,n,r){const i=mp();return new Promise(((o,s)=>{const a=new Xl;a.setWithCredentials(!0),a.listenOnce(Kl.COMPLETE,(()=>{try{switch(a.getLastErrorCode()){case Gl.NO_ERROR:const t=a.getResponseJson();oc(yp,"XHR for RPC '".concat(e,"' ").concat(i," received:"),JSON.stringify(t)),o(t);break;case Gl.TIMEOUT:oc(yp,"RPC '".concat(e,"' ").concat(i," timed out")),s(new fc(dc.DEADLINE_EXCEEDED,"Request time out"));break;case Gl.HTTP_ERROR:const n=a.getStatus();if(oc(yp,"RPC '".concat(e,"' ").concat(i," failed with status:"),n,"response text:",a.getResponseText()),n>0){let e=a.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=null==e?void 0:e.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(dc).indexOf(t)>=0?t:dc.UNKNOWN}(t.status);s(new fc(e,t.message))}else s(new fc(dc.UNKNOWN,"Server responded with status "+a.getStatus()))}else s(new fc(dc.UNAVAILABLE,"Connection failed."));break;default:cc()}}finally{oc(yp,"RPC '".concat(e,"' ").concat(i," completed."))}}));const l=JSON.stringify(r);oc(yp,"RPC '".concat(e,"' ").concat(i," sending request:"),r),a.send(t,"POST",l,n,15)}))}Fo(e,t,n){const r=mp(),i=[this.fo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=ql(),s=Wl(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/".concat(this.databaseId.projectId,"/databases/").concat(this.databaseId.database)},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},l=this.longPollingOptions.timeoutSeconds;void 0!==l&&(a.longPollingTimeout=Math.round(1e3*l)),this.useFetchStreams&&(a.useFetchStreams=!0),this.Do(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const c=i.join("");oc(yp,"Creating RPC '".concat(e,"' stream ").concat(r,": ").concat(c),a);const u=o.createWebChannel(c,a);let h=!1,d=!1;const f=new vp({lo:t=>{d?oc(yp,"Not sending because RPC '".concat(e,"' stream ").concat(r," is closed:"),t):(h||(oc(yp,"Opening RPC '".concat(e,"' stream ").concat(r," transport.")),u.open(),h=!0),oc(yp,"RPC '".concat(e,"' stream ").concat(r," sending:"),t),u.send(t))},ho:()=>u.close()}),p=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(e){setTimeout((()=>{throw e}),0)}}))};return p(u,Yl.EventType.OPEN,(()=>{d||oc(yp,"RPC '".concat(e,"' stream ").concat(r," transport opened."))})),p(u,Yl.EventType.CLOSE,(()=>{d||(d=!0,oc(yp,"RPC '".concat(e,"' stream ").concat(r," transport closed")),f.Vo())})),p(u,Yl.EventType.ERROR,(t=>{d||(d=!0,ac(yp,"RPC '".concat(e,"' stream ").concat(r," transport errored:"),t),f.Vo(new fc(dc.UNAVAILABLE,"The operation could not be completed")))})),p(u,Yl.EventType.MESSAGE,(t=>{var n;if(!d){const i=t.data[0];uc(!!i);const o=i,s=o.error||(null===(n=o[0])||void 0===n?void 0:n.error);if(s){oc(yp,"RPC '".concat(e,"' stream ").concat(r," received error:"),s);const t=s.status;let n=function(e){const t=Od[e];if(void 0!==t)return Ad(t)}(t),i=s.message;void 0===n&&(n=dc.INTERNAL,i="Unknown error status: "+t+" with message "+s.message),d=!0,f.Vo(new fc(n,i)),u.close()}else oc(yp,"RPC '".concat(e,"' stream ").concat(r," received:"),i),f.mo(i)}})),p(s,Ql.STAT_EVENT,(t=>{t.stat===$l.PROXY?oc(yp,"RPC '".concat(e,"' stream ").concat(r," detected buffering proxy")):t.stat===$l.NOPROXY&&oc(yp,"RPC '".concat(e,"' stream ").concat(r," detected no buffering proxy"))})),setTimeout((()=>{f.Ro()}),0),f}}function bp(){return"undefined"!=typeof document?document:null}function Ep(e){return new Zd(e,!0)}class Sp{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.5,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:6e4;this.oi=e,this.timerId=t,this.Mo=n,this.xo=r,this.Oo=i,this.No=0,this.Bo=null,this.Lo=Date.now(),this.reset()}reset(){this.No=0}ko(){this.No=this.Oo}qo(e){this.cancel();const t=Math.floor(this.No+this.Qo()),n=Math.max(0,Date.now()-this.Lo),r=Math.max(0,t-n);r>0&&oc("ExponentialBackoff","Backing off for ".concat(r," ms (base delay: ").concat(this.No," ms, delay with jitter: ").concat(t," ms, last attempt: ").concat(n," ms ago)")),this.Bo=this.oi.enqueueAfterDelay(this.timerId,r,(()=>(this.Lo=Date.now(),e()))),this.No*=this.xo,this.Nothis.Oo&&(this.No=this.Oo)}Ko(){null!==this.Bo&&(this.Bo.skipDelay(),this.Bo=null)}cancel(){null!==this.Bo&&(this.Bo.cancel(),this.Bo=null)}Qo(){return(Math.random()-.5)*this.No}}class _p{constructor(e,t,n,r,i,o,s,a){this.oi=e,this.$o=n,this.Uo=r,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=s,this.listener=a,this.state=0,this.Wo=0,this.Go=null,this.zo=null,this.stream=null,this.jo=new Sp(e,t)}Ho(){return 1===this.state||5===this.state||this.Jo()}Jo(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Yo()}async stop(){this.Ho()&&await this.close(0)}Zo(){this.state=0,this.jo.reset()}Xo(){this.Jo()&&null===this.Go&&(this.Go=this.oi.enqueueAfterDelay(this.$o,6e4,(()=>this.e_())))}t_(e){this.n_(),this.stream.send(e)}async e_(){if(this.Jo())return this.close(0)}n_(){this.Go&&(this.Go.cancel(),this.Go=null)}r_(){this.zo&&(this.zo.cancel(),this.zo=null)}async close(e,t){this.n_(),this.r_(),this.jo.cancel(),this.Wo++,4!==e?this.jo.reset():t&&t.code===dc.RESOURCE_EXHAUSTED?(sc(t.toString()),sc("Using maximum backoff delay to prevent overloading the backend."),this.jo.ko()):t&&t.code===dc.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.i_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.To(t)}i_(){}auth(){this.state=1;const e=this.s_(this.Wo),t=this.Wo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((e=>{let[n,r]=e;this.Wo===t&&this.o_(n,r)}),(t=>{e((()=>{const e=new fc(dc.UNKNOWN,"Fetching auth token failed: "+t.message);return this.__(e)}))}))}o_(e,t){const n=this.s_(this.Wo);this.stream=this.a_(e,t),this.stream.Po((()=>{n((()=>(this.state=2,this.zo=this.oi.enqueueAfterDelay(this.Uo,1e4,(()=>(this.Jo()&&(this.state=3),Promise.resolve()))),this.listener.Po())))})),this.stream.To((e=>{n((()=>this.__(e)))})),this.stream.onMessage((e=>{n((()=>this.onMessage(e)))}))}Yo(){this.state=5,this.jo.qo((async()=>{this.state=0,this.start()}))}__(e){return oc("PersistentStream","close with error: ".concat(e)),this.stream=null,this.close(4,e)}s_(e){return t=>{this.oi.enqueueAndForget((()=>this.Wo===e?t():(oc("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class kp extends _p{constructor(e,t,n,r,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,r,o),this.serializer=i}a_(e,t){return this.connection.Fo("Listen",e,t)}onMessage(e){this.jo.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const r=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:cc()}(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],o=function(e,t){return e.useProto3Json?(uc(void 0===t||"string"==typeof t),mu.fromBase64String(t||"")):(uc(void 0===t||t instanceof Uint8Array),mu.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),s=t.targetChange.cause,a=s&&function(e){const t=void 0===e.code?dc.UNKNOWN:Ad(e.code);return new fc(t,e.message||"")}(s);n=new Wd(r,i,o,a||null)}else if("documentChange"in t){t.documentChange;const r=t.documentChange;r.document,r.document.name,r.document.updateTime;const i=uf(e,r.document.name),o=of(r.document.updateTime),s=r.document.createTime?of(r.document.createTime):Ic.min(),a=new Bu({mapValue:{fields:r.document.fields}}),l=Hu.newFoundDocument(i,o,s,a),c=r.targetIds||[],u=r.removedTargetIds||[];n=new Hd(c,u,l.key,l)}else if("documentDelete"in t){t.documentDelete;const r=t.documentDelete;r.document;const i=uf(e,r.document),o=r.readTime?of(r.readTime):Ic.min(),s=Hu.newNoDocument(i,o),a=r.removedTargetIds||[];n=new Hd([],a,s.key,s)}else if("documentRemove"in t){t.documentRemove;const r=t.documentRemove;r.document;const i=uf(e,r.document),o=r.removedTargetIds||[];n=new Hd([],o,i,null)}else{if(!("filter"in t))return cc();{t.filter;const e=t.filter;e.targetId;const{count:r=0,unchangedNames:i}=e,o=new Nd(r,i),s=e.targetId;n=new qd(s,o)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return Ic.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?Ic.min():t.readTime?of(t.readTime):Ic.min()}(e);return this.listener.u_(t,n)}c_(e){const t={};t.database=ff(this.serializer),t.addTarget=function(e,t){let n;const r=t.target;if(n=gh(r)?{documents:vf(e,r)}:{query:yf(e,r).ut},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=nf(e,t.resumeToken);const r=ef(e,t.expectedCount);null!==r&&(n.expectedCount=r)}else if(t.snapshotVersion.compareTo(Ic.min())>0){n.readTime=tf(e,t.snapshotVersion.toTimestamp());const r=ef(e,t.expectedCount);null!==r&&(n.expectedCount=r)}return n}(this.serializer,e);const n=function(e,t){const n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return cc()}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.t_(t)}l_(e){const t={};t.database=ff(this.serializer),t.removeTarget=e,this.t_(t)}}class Tp extends _p{constructor(e,t,n,r,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,r,o),this.serializer=i,this.h_=!1}get P_(){return this.h_}start(){this.h_=!1,this.lastStreamToken=void 0,super.start()}i_(){this.h_&&this.I_([])}a_(e,t){return this.connection.Fo("Write",e,t)}onMessage(e){if(uc(!!e.streamToken),this.lastStreamToken=e.streamToken,this.h_){this.jo.reset();const t=function(e,t){return e&&e.length>0?(uc(void 0!==t),e.map((e=>function(e,t){let n=e.updateTime?of(e.updateTime):of(t);return n.isEqual(Ic.min())&&(n=of(t)),new ud(n,e.transformResults||[])}(e,t)))):[]}(e.writeResults,e.commitTime),n=of(e.commitTime);return this.listener.T_(n,t)}return uc(!e.writeResults||0===e.writeResults.length),this.h_=!0,this.listener.E_()}d_(){const e={};e.database=ff(this.serializer),this.t_(e)}I_(e){const t={streamToken:this.lastStreamToken,writes:e.map((e=>gf(this.serializer,e)))};this.t_(t)}}class Cp extends class{}{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.A_=!1}R_(){if(this.A_)throw new fc(dc.FAILED_PRECONDITION,"The client has already been terminated.")}So(e,t,n,r){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((i=>{let[o,s]=i;return this.connection.So(e,af(t,n),r,o,s)})).catch((e=>{throw"FirebaseError"===e.name?(e.code===dc.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new fc(dc.UNKNOWN,e.toString())}))}vo(e,t,n,r,i){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((o=>{let[s,a]=o;return this.connection.vo(e,af(t,n),r,s,a,i)})).catch((e=>{throw"FirebaseError"===e.name?(e.code===dc.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new fc(dc.UNKNOWN,e.toString())}))}terminate(){this.A_=!0,this.connection.terminate()}}class xp{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.m_=0,this.f_=null,this.g_=!0}p_(){0===this.m_&&(this.y_("Unknown"),this.f_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.f_=null,this.w_("Backend didn't respond within 10 seconds."),this.y_("Offline"),Promise.resolve()))))}S_(e){"Online"===this.state?this.y_("Unknown"):(this.m_++,this.m_>=1&&(this.b_(),this.w_("Connection failed 1 times. Most recent error: ".concat(e.toString())),this.y_("Offline")))}set(e){this.b_(),this.m_=0,"Online"===e&&(this.g_=!1),this.y_(e)}y_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}w_(e){const t="Could not reach Cloud Firestore backend. ".concat(e,"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.");this.g_?(sc(t),this.g_=!1):oc("OnlineStateTracker",t)}b_(){null!==this.f_&&(this.f_.cancel(),this.f_=null)}}class Ip{constructor(e,t,n,r,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.D_=[],this.C_=new Map,this.v_=new Set,this.F_=[],this.M_=i,this.M_.io((e=>{n.enqueueAndForget((async()=>{jp(this)&&(oc("RemoteStore","Restarting streams for network reachability change."),await async function(e){const t=hc(e);t.v_.add(4),await Op(t),t.x_.set("Unknown"),t.v_.delete(4),await Np(t)}(this))}))})),this.x_=new xp(n,r)}}async function Np(e){if(jp(e))for(const t of e.F_)await t(!0)}async function Op(e){for(const t of e.F_)await t(!1)}function Pp(e,t){const n=hc(e);n.C_.has(t.targetId)||(n.C_.set(t.targetId,t),Mp(n)?Lp(n):tm(n).Jo()&&Ap(n,t))}function Rp(e,t){const n=hc(e),r=tm(n);n.C_.delete(t),r.Jo()&&Dp(n,t),0===n.C_.size&&(r.Jo()?r.Xo():jp(n)&&n.x_.set("Unknown"))}function Ap(e,t){if(e.O_.Oe(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(Ic.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}tm(e).c_(t)}function Dp(e,t){e.O_.Oe(t),tm(e).l_(t)}function Lp(e){e.O_=new Kd({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),_t:t=>e.C_.get(t)||null,nt:()=>e.datastore.serializer.databaseId}),tm(e).start(),e.x_.p_()}function Mp(e){return jp(e)&&!tm(e).Ho()&&e.C_.size>0}function jp(e){return 0===hc(e).v_.size}function Fp(e){e.O_=void 0}async function Up(e){e.C_.forEach(((t,n)=>{Ap(e,t)}))}async function Vp(e,t){Fp(e),Mp(e)?(e.x_.S_(t),Lp(e)):e.x_.set("Unknown")}async function Bp(e,t,n){if(e.x_.set("Online"),t instanceof Wd&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const r of t.targetIds)e.C_.has(r)&&(await e.remoteSyncer.rejectListen(r,n),e.C_.delete(r),e.O_.removeTarget(r))}(e,t)}catch(n){oc("RemoteStore","Failed to remove targets %s: %s ",t.targetIds.join(","),n),await zp(e,n)}else if(t instanceof Hd?e.O_.$e(t):t instanceof qd?e.O_.Je(t):e.O_.Ge(t),!n.isEqual(Ic.min()))try{const t=await rp(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.O_.it(t);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const i=e.C_.get(r);i&&e.C_.set(r,i.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach(((t,n)=>{const r=e.C_.get(t);if(!r)return;e.C_.set(t,r.withResumeToken(mu.EMPTY_BYTE_STRING,r.snapshotVersion)),Dp(e,t);const i=new Nf(r.target,t,n,r.sequenceNumber);Ap(e,i)})),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){oc("RemoteStore","Failed to raise snapshot:",t),await zp(e,t)}}async function zp(e,t,n){if(!Kc(t))throw t;e.v_.add(1),await Op(e),e.x_.set("Offline"),n||(n=()=>rp(e.localStore)),e.asyncQueue.enqueueRetryable((async()=>{oc("RemoteStore","Retrying IndexedDB access"),await n(),e.v_.delete(1),await Np(e)}))}function Hp(e,t){return t().catch((n=>zp(e,n,t)))}async function qp(e){const t=hc(e),n=nm(t);let r=t.D_.length>0?t.D_[t.D_.length-1].batchId:-1;for(;Wp(t);)try{const e=await op(t.localStore,r);if(null===e){0===t.D_.length&&n.Xo();break}r=e.batchId,Gp(t,e)}catch(e){await zp(t,e)}Kp(t)&&Qp(t)}function Wp(e){return jp(e)&&e.D_.length<10}function Gp(e,t){e.D_.push(t);const n=nm(e);n.Jo()&&n.P_&&n.I_(t.mutations)}function Kp(e){return jp(e)&&!nm(e).Ho()&&e.D_.length>0}function Qp(e){nm(e).start()}async function $p(e){nm(e).d_()}async function Yp(e){const t=nm(e);for(const n of e.D_)t.I_(n.mutations)}async function Xp(e,t,n){const r=e.D_.shift(),i=xd.from(r,t,n);await Hp(e,(()=>e.remoteSyncer.applySuccessfulWrite(i))),await qp(e)}async function Jp(e,t){t&&nm(e).P_&&await async function(e,t){if(function(e){return Rd(e)&&e!==dc.ABORTED}(t.code)){const n=e.D_.shift();nm(e).Zo(),await Hp(e,(()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t))),await qp(e)}}(e,t),Kp(e)&&Qp(e)}async function Zp(e,t){const n=hc(e);n.asyncQueue.verifyOperationInProgress(),oc("RemoteStore","RemoteStore received new credentials");const r=jp(n);n.v_.add(3),await Op(n),r&&n.x_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.v_.delete(3),await Np(n)}async function em(e,t){const n=hc(e);t?(n.v_.delete(2),await Np(n)):t||(n.v_.add(2),await Op(n),n.x_.set("Unknown"))}function tm(e){return e.N_||(e.N_=function(e,t,n){const r=hc(e);return r.R_(),new kp(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Po:Up.bind(null,e),To:Vp.bind(null,e),u_:Bp.bind(null,e)}),e.F_.push((async t=>{t?(e.N_.Zo(),Mp(e)?Lp(e):e.x_.set("Unknown")):(await e.N_.stop(),Fp(e))}))),e.N_}function nm(e){return e.B_||(e.B_=function(e,t,n){const r=hc(e);return r.R_(),new Tp(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Po:$p.bind(null,e),To:Jp.bind(null,e),E_:Yp.bind(null,e),T_:Xp.bind(null,e)}),e.F_.push((async t=>{t?(e.B_.Zo(),await qp(e)):(await e.B_.stop(),e.D_.length>0&&(oc("RemoteStore","Stopping write stream with ".concat(e.D_.length," pending writes")),e.D_=[]))}))),e.B_}class rm{constructor(e,t,n,r,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new pc,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,r,i){const o=Date.now()+n,s=new rm(e,t,o,r,i);return s.start(n),s}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new fc(dc.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function im(e,t){if(sc("AsyncQueue","".concat(t,": ").concat(e)),Kc(e))return new fc(dc.UNAVAILABLE,"".concat(t,": ").concat(e));throw e}class om{constructor(e){this.comparator=e?(t,n)=>e(t,n)||Ac.comparator(t.key,n.key):(e,t)=>Ac.comparator(e.key,t.key),this.keyedMap=Fh(),this.sortedSet=new lu(this.comparator)}static emptySet(e){return new om(e.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((t,n)=>(e(t),!1)))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof om))return!1;if(this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(!e.isEqual(r))return!1}return!0}toString(){const e=[];return this.forEach((t=>{e.push(t.toString())})),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){const n=new om;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}class sm{constructor(){this.L_=new lu(Ac.comparator)}track(e){const t=e.doc.key,n=this.L_.get(t);n?0!==e.type&&3===n.type?this.L_=this.L_.insert(t,e):3===e.type&&1!==n.type?this.L_=this.L_.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.L_=this.L_.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.L_=this.L_.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.L_=this.L_.remove(t):1===e.type&&2===n.type?this.L_=this.L_.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.L_=this.L_.insert(t,{type:2,doc:e.doc}):cc():this.L_=this.L_.insert(t,e)}k_(){const e=[];return this.L_.inorderTraversal(((t,n)=>{e.push(n)})),e}}class am{constructor(e,t,n,r,i,o,s,a,l){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=s,this.excludesMetadataChanges=a,this.hasCachedResults=l}static fromInitialDocuments(e,t,n,r,i){const o=[];return t.forEach((e=>{o.push({type:0,doc:e})})),new am(e,t,om.emptySet(t),o,n,r,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&xh(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let r=0;rIh(e)),xh),this.onlineState="Unknown",this.K_=new Set}}async function um(e,t){const n=hc(e),r=t.query;let i=!1,o=n.queries.get(r);if(o||(i=!0,o=new lm),i)try{o.q_=await n.onListen(r)}catch(e){const n=im(e,"Initialization of query '".concat(Nh(t.query),"' failed"));return void t.onError(n)}n.queries.set(r,o),o.Q_.push(t),t.U_(n.onlineState),o.q_&&t.W_(o.q_)&&pm(n)}async function hm(e,t){const n=hc(e),r=t.query;let i=!1;const o=n.queries.get(r);if(o){const e=o.Q_.indexOf(t);e>=0&&(o.Q_.splice(e,1),i=0===o.Q_.length)}if(i)return n.queries.delete(r),n.onUnlisten(r)}function dm(e,t){const n=hc(e);let r=!1;for(const i of t){const e=i.query,t=n.queries.get(e);if(t){for(const e of t.Q_)e.W_(i)&&(r=!0);t.q_=i}}r&&pm(n)}function fm(e,t,n){const r=hc(e),i=r.queries.get(t);if(i)for(const o of i.Q_)o.onError(n);r.queries.delete(t)}function pm(e){e.K_.forEach((e=>{e.next()}))}class mm{constructor(e,t,n){this.query=e,this.G_=t,this.z_=!1,this.j_=null,this.onlineState="Unknown",this.options=n||{}}W_(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new am(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.z_?this.H_(e)&&(this.G_.next(e),t=!0):this.J_(e,this.onlineState)&&(this.Y_(e),t=!0),this.j_=e,t}onError(e){this.G_.error(e)}U_(e){this.onlineState=e;let t=!1;return this.j_&&!this.z_&&this.J_(this.j_,e)&&(this.Y_(this.j_),t=!0),t}J_(e,t){if(!e.fromCache)return!0;const n="Offline"!==t;return(!this.options.Z_||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}H_(e){if(e.docChanges.length>0)return!0;const t=this.j_&&this.j_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}Y_(e){e=am.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.z_=!0,this.G_.next(e)}}class gm{constructor(e){this.key=e}}class vm{constructor(e){this.key=e}}class ym{constructor(e,t){this.query=e,this.oa=t,this._a=null,this.hasCachedResults=!1,this.current=!1,this.aa=Wh(),this.mutatedKeys=Wh(),this.ua=Rh(e),this.ca=new om(this.ua)}get la(){return this.oa}ha(e,t){const n=t?t.Pa:new sm,r=t?t.ca:this.ca;let i=t?t.mutatedKeys:this.mutatedKeys,o=r,s=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,l="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(e.inorderTraversal(((e,t)=>{const c=r.get(e),u=Oh(this.query,t)?t:null,h=!!c&&this.mutatedKeys.has(c.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations);let f=!1;c&&u?c.data.isEqual(u.data)?h!==d&&(n.track({type:3,doc:u}),f=!0):this.Ia(c,u)||(n.track({type:2,doc:u}),f=!0,(a&&this.ua(u,a)>0||l&&this.ua(u,l)<0)&&(s=!0)):!c&&u?(n.track({type:0,doc:u}),f=!0):c&&!u&&(n.track({type:1,doc:c}),f=!0,(a||l)&&(s=!0)),f&&(u?(o=o.add(u),i=d?i.add(e):i.delete(e)):(o=o.delete(e),i=i.delete(e)))})),null!==this.query.limit)for(;o.size>this.query.limit;){const e="F"===this.query.limitType?o.last():o.first();o=o.delete(e.key),i=i.delete(e.key),n.track({type:1,doc:e})}return{ca:o,Pa:n,Xi:s,mutatedKeys:i}}Ia(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,r){const i=this.ca;this.ca=e.ca,this.mutatedKeys=e.mutatedKeys;const o=e.Pa.k_();o.sort(((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return cc()}};return n(e)-n(t)}(e.type,t.type)||this.ua(e.doc,t.doc))),this.Ta(n),r=null!=r&&r;const s=t&&!r?this.Ea():[],a=0===this.aa.size&&this.current&&!r?1:0,l=a!==this._a;return this._a=a,0!==o.length||l?{snapshot:new am(this.query,e.ca,i,o,e.mutatedKeys,0===a,l,!1,!!n&&n.resumeToken.approximateByteSize()>0),da:s}:{da:s}}U_(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({ca:this.ca,Pa:new sm,mutatedKeys:this.mutatedKeys,Xi:!1},!1)):{da:[]}}Aa(e){return!this.oa.has(e)&&!!this.ca.has(e)&&!this.ca.get(e).hasLocalMutations}Ta(e){e&&(e.addedDocuments.forEach((e=>this.oa=this.oa.add(e))),e.modifiedDocuments.forEach((e=>{})),e.removedDocuments.forEach((e=>this.oa=this.oa.delete(e))),this.current=e.current)}Ea(){if(!this.current)return[];const e=this.aa;this.aa=Wh(),this.ca.forEach((e=>{this.Aa(e.key)&&(this.aa=this.aa.add(e.key))}));const t=[];return e.forEach((e=>{this.aa.has(e)||t.push(new vm(e))})),this.aa.forEach((n=>{e.has(n)||t.push(new gm(n))})),t}Ra(e){this.oa=e.hs,this.aa=Wh();const t=this.ha(e.documents);return this.applyChanges(t,!0)}Va(){return am.fromInitialDocuments(this.query,this.ca,this.mutatedKeys,0===this._a,this.hasCachedResults)}}class wm{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class bm{constructor(e){this.key=e,this.ma=!1}}class Em{constructor(e,t,n,r,i,o){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.fa={},this.ga=new Dh((e=>Ih(e)),xh),this.pa=new Map,this.ya=new Set,this.wa=new lu(Ac.comparator),this.Sa=new Map,this.ba=new zf,this.Da={},this.Ca=new Map,this.va=Mf.Bn(),this.onlineState="Unknown",this.Fa=void 0}get isPrimaryClient(){return!0===this.Fa}}async function Sm(e,t){const n=Vm(e);let r,i;const o=n.ga.get(t);if(o)r=o.targetId,n.sharedClientState.addLocalQueryTarget(r),i=o.view.Va();else{const e=await sp(n.localStore,_h(t)),o=n.sharedClientState.addLocalQueryTarget(e.targetId);r=e.targetId,i=await _m(n,t,r,"current"===o,e.resumeToken),n.isPrimaryClient&&Pp(n.remoteStore,e)}return i}async function _m(e,t,n,r,i){e.Ma=(t,n,r)=>async function(e,t,n,r){let i=t.view.ha(n);i.Xi&&(i=await lp(e.localStore,t.query,!1).then((e=>{let{documents:n}=e;return t.view.ha(n,i)})));const o=r&&r.targetChanges.get(t.targetId),s=r&&null!=r.targetMismatches.get(t.targetId),a=t.view.applyChanges(i,e.isPrimaryClient,o,s);return Dm(e,t.targetId,a.da),a.snapshot}(e,t,n,r);const o=await lp(e.localStore,t,!0),s=new ym(t,o.hs),a=s.ha(o.documents),l=zd.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==e.onlineState,i),c=s.applyChanges(a,e.isPrimaryClient,l);Dm(e,n,c.da);const u=new wm(t,n,s);return e.ga.set(t,u),e.pa.has(n)?e.pa.get(n).push(t):e.pa.set(n,[t]),c.snapshot}async function km(e,t){const n=hc(e),r=n.ga.get(t),i=n.pa.get(r.targetId);if(i.length>1)return n.pa.set(r.targetId,i.filter((e=>!xh(e,t)))),void n.ga.delete(t);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await ap(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),Rp(n.remoteStore,r.targetId),Rm(n,r.targetId)})).catch(Bc)):(Rm(n,r.targetId),await ap(n.localStore,r.targetId,!0))}async function Tm(e,t){const n=hc(e);try{const e=await function(e,t){const n=hc(e),r=t.snapshotVersion;let i=n.ns;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(e=>{const o=n.os.newChangeBuffer({trackRemovals:!0});i=n.ns;const s=[];t.targetChanges.forEach(((o,a)=>{const l=i.get(a);if(!l)return;s.push(n.Qr.removeMatchingKeys(e,o.removedDocuments,a).next((()=>n.Qr.addMatchingKeys(e,o.addedDocuments,a))));let c=l.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?c=c.withResumeToken(mu.EMPTY_BYTE_STRING,Ic.min()).withLastLimboFreeSnapshotVersion(Ic.min()):o.resumeToken.approximateByteSize()>0&&(c=c.withResumeToken(o.resumeToken,r)),i=i.insert(a,c),function(e,t,n){return 0===e.resumeToken.approximateByteSize()||t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(l,c,o)&&s.push(n.Qr.updateTargetData(e,c))}));let a=Mh(),l=Wh();if(t.documentUpdates.forEach((r=>{t.resolvedLimboDocuments.has(r)&&s.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))})),s.push(ip(e,o,t.documentUpdates).next((e=>{a=e.cs,l=e.ls}))),!r.isEqual(Ic.min())){const t=n.Qr.getLastRemoteSnapshotVersion(e).next((t=>n.Qr.setTargetsMetadata(e,e.currentSequenceNumber,r)));s.push(t)}return zc.waitFor(s).next((()=>o.apply(e))).next((()=>n.localDocuments.getLocalViewOfDocuments(e,a,l))).next((()=>a))})).then((e=>(n.ns=i,e)))}(n.localStore,t);t.targetChanges.forEach(((e,t)=>{const r=n.Sa.get(t);r&&(uc(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1),e.addedDocuments.size>0?r.ma=!0:e.modifiedDocuments.size>0?uc(r.ma):e.removedDocuments.size>0&&(uc(r.ma),r.ma=!1))})),await jm(n,e,t)}catch(e){await Bc(e)}}function Cm(e,t,n){const r=hc(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const e=[];r.ga.forEach(((n,r)=>{const i=r.view.U_(t);i.snapshot&&e.push(i.snapshot)})),function(e,t){const n=hc(e);n.onlineState=t;let r=!1;n.queries.forEach(((e,n)=>{for(const i of n.Q_)i.U_(t)&&(r=!0)})),r&&pm(n)}(r.eventManager,t),e.length&&r.fa.u_(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function xm(e,t,n){const r=hc(e);r.sharedClientState.updateQueryState(t,"rejected",n);const i=r.Sa.get(t),o=i&&i.key;if(o){let e=new lu(Ac.comparator);e=e.insert(o,Hu.newNoDocument(o,Ic.min()));const n=Wh().add(o),i=new Bd(Ic.min(),new Map,new lu(Tc),e,n);await Tm(r,i),r.wa=r.wa.remove(o),r.Sa.delete(t),Mm(r)}else await ap(r.localStore,t,!1).then((()=>Rm(r,t,n))).catch(Bc)}async function Im(e,t){const n=hc(e),r=t.batch.batchId;try{const e=await function(e,t){const n=hc(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(e=>{const r=t.batch.keys(),i=n.os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){const i=n.batch,o=i.keys();let s=zc.resolve();return o.forEach((e=>{s=s.next((()=>r.getEntry(t,e))).next((t=>{const o=n.docVersions.get(e);uc(null!==o),t.version.compareTo(o)<0&&(i.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))}))})),s.next((()=>e.mutationQueue.removeMutationBatch(t,i)))}(n,e,t,i).next((()=>i.apply(e))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=Wh();for(let n=0;n0&&(t=t.add(e.batch.mutations[n].key));return t}(t)))).next((()=>n.localDocuments.getDocuments(e,r)))}))}(n.localStore,t);Pm(n,r,null),Om(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await jm(n,e)}catch(e){await Bc(e)}}async function Nm(e,t,n){const r=hc(e);try{const e=await function(e,t){const n=hc(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",(e=>{let r;return n.mutationQueue.lookupMutationBatch(e,t).next((t=>(uc(null!==t),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t)))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r))).next((()=>n.localDocuments.getDocuments(e,r)))}))}(r.localStore,t);Pm(r,t,n),Om(r,t),r.sharedClientState.updateMutationState(t,"rejected",n),await jm(r,e)}catch(n){await Bc(n)}}function Om(e,t){(e.Ca.get(t)||[]).forEach((e=>{e.resolve()})),e.Ca.delete(t)}function Pm(e,t,n){const r=hc(e);let i=r.Da[r.currentUser.toKey()];if(i){const e=i.get(t);e&&(n?e.reject(n):e.resolve(),i=i.remove(t)),r.Da[r.currentUser.toKey()]=i}}function Rm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.sharedClientState.removeLocalQueryTarget(t);for(const r of e.pa.get(t))e.ga.delete(r),n&&e.fa.xa(r,n);e.pa.delete(t),e.isPrimaryClient&&e.ba.Vr(t).forEach((t=>{e.ba.containsKey(t)||Am(e,t)}))}function Am(e,t){e.ya.delete(t.path.canonicalString());const n=e.wa.get(t);null!==n&&(Rp(e.remoteStore,n),e.wa=e.wa.remove(t),e.Sa.delete(n),Mm(e))}function Dm(e,t,n){for(const r of n)r instanceof gm?(e.ba.addReference(r.key,t),Lm(e,r)):r instanceof vm?(oc("SyncEngine","Document no longer in limbo: "+r.key),e.ba.removeReference(r.key,t),e.ba.containsKey(r.key)||Am(e,r.key)):cc()}function Lm(e,t){const n=t.key,r=n.path.canonicalString();e.wa.get(n)||e.ya.has(r)||(oc("SyncEngine","New document in limbo: "+n),e.ya.add(r),Mm(e))}function Mm(e){for(;e.ya.size>0&&e.wa.size{s.push(r.Ma(a,t,n).then((e=>{if((e||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==e?void 0:e.fromCache)?"not-current":"current"),e){i.push(e);const t=Xf.Ki(a.targetId,e);o.push(t)}})))})),await Promise.all(s),r.fa.u_(i),await async function(e,t){const n=hc(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(e=>zc.forEach(t,(t=>zc.forEach(t.qi,(r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r))).next((()=>zc.forEach(t.Qi,(r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))))))}catch(e){if(!Kc(e))throw e;oc("LocalStore","Failed to update sequence numbers: "+e)}for(const r of t){const e=r.targetId;if(!r.fromCache){const t=n.ns.get(e),r=t.snapshotVersion,i=t.withLastLimboFreeSnapshotVersion(r);n.ns=n.ns.insert(e,i)}}}(r.localStore,o))}async function Fm(e,t){const n=hc(e);if(!n.currentUser.isEqual(t)){oc("SyncEngine","User change. New user:",t.toKey());const e=await np(n.localStore,t);n.currentUser=t,function(e,t){e.Ca.forEach((e=>{e.forEach((e=>{e.reject(new fc(dc.CANCELLED,t))}))})),e.Ca.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await jm(n,e.us)}}function Um(e,t){const n=hc(e),r=n.Sa.get(t);if(r&&r.ma)return Wh().add(r.key);{let e=Wh();const r=n.pa.get(t);if(!r)return e;for(const t of r){const r=n.ga.get(t);e=e.unionWith(r.view.la)}return e}}function Vm(e){const t=hc(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=Tm.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Um.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=xm.bind(null,t),t.fa.u_=dm.bind(null,t.eventManager),t.fa.xa=fm.bind(null,t.eventManager),t}function Bm(e){const t=hc(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=Im.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=Nm.bind(null,t),t}class zm{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=Ep(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){return tp(this.persistence,new Zf,e.initialUser,this.serializer)}createPersistence(e){return new Qf(Yf.Hr,this.serializer)}createSharedClientState(e){return new hp}async terminate(){var e,t;null===(e=this.gcScheduler)||void 0===e||e.stop(),null===(t=this.indexBackfillerScheduler)||void 0===t||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Hm{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>Cm(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Fm.bind(null,this.syncEngine),await em(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new cm}createDatastore(e){const t=Ep(e.databaseInfo.databaseId),n=function(e){return new wp(e)}(e.databaseInfo);return function(e,t,n,r){return new Cp(e,t,n,r)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,r,i){return new Ip(e,t,n,r,i)}(this.localStore,this.datastore,e.asyncQueue,(e=>Cm(this.syncEngine,e,0)),fp.D()?new fp:new dp)}createSyncEngine(e,t){return function(e,t,n,r,i,o,s){const a=new Em(e,t,n,r,i,o);return s&&(a.Fa=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e;await async function(e){const t=hc(e);oc("RemoteStore","RemoteStore shutting down."),t.v_.add(5),await Op(t),t.M_.shutdown(),t.x_.set("Unknown")}(this.remoteStore),null===(e=this.datastore)||void 0===e||e.terminate()}}class qm{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Ba(this.observer.next,e)}error(e){this.observer.error?this.Ba(this.observer.error,e):sc("Uncaught Error in snapshot listener:",e.toString())}La(){this.muted=!0}Ba(e,t){this.muted||setTimeout((()=>{this.muted||e(t)}),0)}}class Wm{constructor(e,t,n,r){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=r,this.user=tc.UNAUTHENTICATED,this.clientId=kc.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async e=>{oc("FirestoreClient","Received user=",e.uid),await this.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(oc("FirestoreClient","Received new app check token=",e),this.appCheckCredentialListener(e,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new fc(dc.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new pc;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(vv){const n=im(vv,"Failed to shutdown persistence");e.reject(n)}})),e.promise}}async function Gm(e,t){e.asyncQueue.verifyOperationInProgress(),oc("FirestoreClient","Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener((async e=>{r.isEqual(e)||(await np(t.localStore,e),r=e)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e._offlineComponents=t}async function Km(e,t){e.asyncQueue.verifyOperationInProgress();const n=await $m(e);oc("FirestoreClient","Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener((e=>Zp(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>Zp(t.remoteStore,n))),e._onlineComponents=t}function Qm(e){return"FirebaseError"===e.name?e.code===dc.FAILED_PRECONDITION||e.code===dc.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}async function $m(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){oc("FirestoreClient","Using user provided OfflineComponentProvider");try{await Gm(e,e._uninitializedComponentsProvider._offline)}catch(vv){const n=vv;if(!Qm(n))throw n;ac("Error using user provided cache. Falling back to memory cache: "+n),await Gm(e,new zm)}}else oc("FirestoreClient","Using default OfflineComponentProvider"),await Gm(e,new zm);return e._offlineComponents}async function Ym(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(oc("FirestoreClient","Using user provided OnlineComponentProvider"),await Km(e,e._uninitializedComponentsProvider._online)):(oc("FirestoreClient","Using default OnlineComponentProvider"),await Km(e,new Hm))),e._onlineComponents}function Xm(e){return Ym(e).then((e=>e.syncEngine))}async function Jm(e){const t=await Ym(e),n=t.eventManager;return n.onListen=Sm.bind(null,t.syncEngine),n.onUnlisten=km.bind(null,t.syncEngine),n}function Zm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new pc;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,r,i){const o=new qm({next:n=>{t.enqueueAndForget((()=>hm(e,s))),n.fromCache&&"server"===r.source?i.reject(new fc(dc.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):i.resolve(n)},error:e=>i.reject(e)}),s=new mm(n,o,{includeMetadataChanges:!0,Z_:!0});return um(e,s)}(await Jm(e),e.asyncQueue,t,n,r))),r.promise}function eg(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}const tg=new Map;function ng(e,t,n){if(!n)throw new fc(dc.INVALID_ARGUMENT,"Function ".concat(e,"() cannot be called with an empty ").concat(t,"."))}function rg(e){if(!Ac.isDocumentKey(e))throw new fc(dc.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but ".concat(e," has ").concat(e.length,"."))}function ig(e){if(Ac.isDocumentKey(e))throw new fc(dc.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but ".concat(e," has ").concat(e.length,"."))}function og(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e="".concat(e.substring(0,20),"...")),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?"a custom ".concat(t," object"):"an object"}}return"function"==typeof e?"a function":cc()}function sg(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new fc(dc.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=og(e);throw new fc(dc.INVALID_ARGUMENT,"Expected type '".concat(t.name,"', but it was: ").concat(n))}}return e}function ag(e,t){if(t<=0)throw new fc(dc.INVALID_ARGUMENT,"Function ".concat(e,"() requires a positive number, but it was: ").concat(t,"."))}class lg{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new fc(dc.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=null===(t=e.ssl)||void 0===t||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new fc(dc.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,r){if(!0===t&&!0===r)throw new fc(dc.INVALID_ARGUMENT,"".concat(e," and ").concat(n," cannot be used together."))})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=eg(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new fc(dc.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (must not be NaN)"));if(e.timeoutSeconds<5)throw new fc(dc.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (minimum allowed value is 5)"));if(e.timeoutSeconds>30)throw new fc(dc.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (maximum allowed value is 30)"))}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class cg{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new lg({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new fc(dc.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new fc(dc.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new lg(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new gc;switch(e.type){case"firstParty":return new bc(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new fc(dc.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=tg.get(e);t&&(oc("ComponentProvider","Removing Datastore"),tg.delete(e),t.terminate())}(this),Promise.resolve()}}function ug(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};var i;const o=(e=sg(e,cg))._getSettings(),s="".concat(t,":").concat(n);if("firestore.googleapis.com"!==o.host&&o.host!==s&&ac("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),e._setSettings(Object.assign(Object.assign({},o),{host:s,ssl:!1})),r.mockUserToken){let t,n;if("string"==typeof r.mockUserToken)t=r.mockUserToken,n=tc.MOCK_USER;else{t=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",r=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:"https://securetoken.google.com/".concat(n),aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e);return[x(JSON.stringify({alg:"none",type:"JWT"})),x(JSON.stringify(o)),""].join(".")}(r.mockUserToken,null===(i=e._app)||void 0===i?void 0:i.options.projectId);const o=r.mockUserToken.sub||r.mockUserToken.user_id;if(!o)throw new fc(dc.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new tc(o)}e._authCredentials=new vc(new mc(t,n))}}class hg{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new hg(this.firestore,e,this._query)}}class dg{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new fg(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new dg(this.firestore,e,this._key)}}class fg extends hg{constructor(e,t,n){super(e,t,wh(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new dg(this.firestore,null,new Ac(e))}withConverter(e){return new fg(this.firestore,e,this._path)}}function pg(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i{const e=bp();e&&oc("AsyncQueue","Visibility state changed to "+e.visibilityState),this.jo.Ko()};const e=bp();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this._u)}get isShuttingDown(){return this.tu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.au(),this.uu(e)}enterRestrictedMode(e){if(!this.tu){this.tu=!0,this.su=e||!1;const t=bp();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this._u)}}enqueue(e){if(this.au(),this.tu)return new Promise((()=>{}));const t=new pc;return this.uu((()=>this.tu&&this.su?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.eu.push(e),this.cu())))}async cu(){if(0!==this.eu.length){try{await this.eu[0](),this.eu.shift(),this.jo.reset()}catch(e){if(!Kc(e))throw e;oc("AsyncQueue","Operation failed with retryable error: "+e)}this.eu.length>0&&this.jo.qo((()=>this.cu()))}}uu(e){const t=this.Xa.then((()=>(this.iu=!0,e().catch((e=>{this.ru=e,this.iu=!1;const t=function(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}(e);throw sc("INTERNAL UNHANDLED ERROR: ",t),e})).then((e=>(this.iu=!1,e))))));return this.Xa=t,t}enqueueAfterDelay(e,t,n){this.au(),this.ou.indexOf(e)>-1&&(t=0);const r=rm.createAndSchedule(this,e,t,n,(e=>this.lu(e)));return this.nu.push(r),r}au(){this.ru&&cc()}verifyOperationInProgress(){}async hu(){let e;do{e=this.Xa,await e}while(e!==this.Xa)}Pu(e){for(const t of this.nu)if(t.timerId===e)return!0;return!1}Iu(e){return this.hu().then((()=>{this.nu.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(const t of this.nu)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.hu()}))}Tu(e){this.ou.push(e)}lu(e){const t=this.nu.indexOf(e);this.nu.splice(t,1)}}function gg(e){return function(e,t){if("object"!=typeof e||null===e)return!1;const n=e;for(const r of t)if(r in n&&"function"==typeof n[r])return!0;return!1}(e,["next","error","complete"])}class vg extends cg{constructor(e,t,n,r){super(e,t,n,r),this.type="firestore",this._queue=new mg,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||wg(this),this._firestoreClient.terminate()}}function yg(e){return e._firestoreClient||wg(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function wg(e){var t,n,r;const i=e._freezeSettings(),o=function(e,t,n,r){return new _u(e,t,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,eg(r.experimentalLongPollingOptions),r.useFetchStreams)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,i);e._firestoreClient=new Wm(e._authCredentials,e._appCheckCredentials,e._queue,o),(null===(n=i.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(r=i.localCache)||void 0===r?void 0:r._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.localCache.kind,_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider})}class bg{constructor(e){this._byteString=e}static fromBase64String(e){try{return new bg(mu.fromBase64String(e))}catch(e){throw new fc(dc.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new bg(mu.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}class Eg{constructor(){for(var e=arguments.length,t=new Array(e),n=0;n90)throw new fc(dc.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new fc(dc.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return Tc(this._lat,e._lat)||Tc(this._long,e._long)}}const kg=/^__.*__$/;class Tg{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new bd(e,this.data,this.fieldMask,t,this.fieldTransforms):new wd(e,this.data,t,this.fieldTransforms)}}function Cg(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw cc()}}class xg{constructor(e,t,n,r,i,o){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this.Eu(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get du(){return this.settings.du}Au(e){return new xg(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Ru(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.Au({path:n,Vu:!1});return r.mu(e),r}fu(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.Au({path:n,Vu:!1});return r.Eu(),r}gu(e){return this.Au({path:void 0,Vu:!0})}pu(e){return Vg(e,this.settings.methodName,this.settings.yu||!1,this.path,this.settings.wu)}contains(e){return void 0!==this.fieldMask.find((t=>e.isPrefixOf(t)))||void 0!==this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))}Eu(){if(this.path)for(let e=0;e3&&void 0!==arguments[3]&&arguments[3];return new xg({du:e,methodName:t,wu:n,path:Rc.emptyPath(),Vu:!1,yu:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function Ng(e){const t=e._freezeSettings(),n=Ep(e._databaseId);return new Ig(e._databaseId,!!t.ignoreUndefinedProperties,n)}function Og(e,t,n,r,i){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const s=e.Su(o.merge||o.mergeFields?2:0,t,n,i);Mg("Data must be an object, but it was:",s,r);const a=Dg(r,s);let l,c;if(o.merge)l=new fu(s.fieldMask),c=s.fieldTransforms;else if(o.mergeFields){const e=[];for(const r of o.mergeFields){const i=jg(t,r,n);if(!s.contains(i))throw new fc(dc.INVALID_ARGUMENT,"Field '".concat(i,"' is specified in your field mask but missing from your input data."));Bg(e,i)||e.push(i)}l=new fu(e),c=s.fieldTransforms.filter((e=>l.covers(e.field)))}else l=null,c=s.fieldTransforms;return new Tg(new Bu(a),l,c)}class Pg extends Sg{_toFieldTransform(e){return new cd(e.path,new td)}isEqual(e){return e instanceof Pg}}function Rg(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Ag(n,e.Su(r?4:3,t))}function Ag(e,t){if(Lg(e=$(e)))return Mg("Unsupported field value:",t,e),Dg(e,t);if(e instanceof Sg)return function(e,t){if(!Cg(t.du))throw t.pu("".concat(e._methodName,"() can only be used with update() and set()"));if(!t.path)throw t.pu("".concat(e._methodName,"() is not currently supported inside arrays"));const n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.Vu&&4!==t.du)throw t.pu("Nested arrays are not supported");return function(e,t){const n=[];let r=0;for(const i of e){let e=Ag(i,t.gu(r));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),r++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=$(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return Yh(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=xc.fromDate(e);return{timestampValue:tf(t.serializer,n)}}if(e instanceof xc){const n=new xc(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:tf(t.serializer,n)}}if(e instanceof _g)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof bg)return{bytesValue:nf(t.serializer,e._byteString)};if(e instanceof dg){const n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.pu("Document reference is for database ".concat(r.projectId,"/").concat(r.database," but should be for database ").concat(n.projectId,"/").concat(n.database));return{referenceValue:sf(e.firestore._databaseId||t.databaseId,e._key.path)}}throw t.pu("Unsupported field value: ".concat(og(e)))}(e,t)}function Dg(e,t){const n={};return au(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):su(e,((e,r)=>{const i=Ag(r,t.Ru(e));null!=i&&(n[e]=i)})),{mapValue:{fields:n}}}function Lg(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof xc||e instanceof _g||e instanceof bg||e instanceof dg||e instanceof Sg)}function Mg(e,t,n){if(!Lg(n)||!function(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}(n)){const r=og(n);throw"an object"===r?t.pu(e+" a custom object"):t.pu(e+" "+r)}}function jg(e,t,n){if((t=$(t))instanceof Eg)return t._internalPath;if("string"==typeof t)return Ug(e,t);throw Vg("Field path arguments must be of type string or ",e,!1,void 0,n)}const Fg=new RegExp("[~\\*/\\[\\]]");function Ug(e,t,n){if(t.search(Fg)>=0)throw Vg("Invalid field path (".concat(t,"). Paths must not contain '~', '*', '/', '[', or ']'"),e,!1,void 0,n);try{return new Eg(...t.split("."))._internalPath}catch(Qi){throw Vg("Invalid field path (".concat(t,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"),e,!1,void 0,n)}}function Vg(e,t,n,r,i){const o=r&&!r.isEmpty(),s=void 0!==i;let a="Function ".concat(t,"() called with invalid data");n&&(a+=" (via `toFirestore()`)"),a+=". ";let l="";return(o||s)&&(l+=" (found",o&&(l+=" in field ".concat(r)),s&&(l+=" in document ".concat(i)),l+=")"),new fc(dc.INVALID_ARGUMENT,a+e+l)}function Bg(e,t){return e.some((e=>e.isEqual(t)))}class zg{constructor(e,t,n,r,i){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new dg(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new Hg(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const t=this._document.data.field(qg("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class Hg extends zg{data(){return super.data()}}function qg(e,t){return"string"==typeof t?Ug(e,t):t instanceof Eg?t._internalPath:t._delegate._internalPath}function Wg(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new fc(dc.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Gg{}class Kg extends Gg{}class Qg extends Kg{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new Qg(e,t,n)}_apply(e){const t=this._parse(e);return tv(e._query,t),new hg(e.firestore,e.converter,Th(e._query,t))}_parse(e){const t=Ng(e.firestore),n=function(e,t,n,r,i,o,s){let a;if(i.isKeyField()){if("array-contains"===o||"array-contains-any"===o)throw new fc(dc.INVALID_ARGUMENT,"Invalid Query. You can't perform '".concat(o,"' queries on documentId()."));if("in"===o||"not-in"===o){ev(s,o);const t=[];for(const n of s)t.push(Zg(r,e,n));a={arrayValue:{values:t}}}else a=Zg(r,e,s)}else"in"!==o&&"not-in"!==o&&"array-contains-any"!==o||ev(s,o),a=Rg(n,t,s,"in"===o||"not-in"===o);return Yu.create(i,o,a)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value);return n}}function $g(e,t,n){const r=t,i=qg("where",e);return Qg._create(i,r,n)}class Yg extends Gg{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Yg(e,t)}_parse(e){const t=this._queryConstraints.map((t=>t._parse(e))).filter((e=>e.getFilters().length>0));return 1===t.length?t[0]:Xu.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const r=t.getFlattenedFilters();for(const i of r)tv(n,i),n=Th(n,i)}(e._query,t),new hg(e.firestore,e.converter,Th(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}class Xg extends Kg{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new Xg(e,t)}_apply(e){const t=function(e,t,n){if(null!==e.startAt)throw new fc(dc.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==e.endAt)throw new fc(dc.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Ku(t,n)}(e._query,this._field,this._direction);return new hg(e.firestore,e.converter,function(e,t){const n=e.explicitOrderBy.concat([t]);return new vh(e.path,e.collectionGroup,n,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(e._query,t))}}class Jg extends Kg{constructor(e,t,n){super(),this.type=e,this._limit=t,this._limitType=n}static _create(e,t,n){return new Jg(e,t,n)}_apply(e){return new hg(e.firestore,e.converter,Ch(e._query,this._limit,this._limitType))}}function Zg(e,t,n){if("string"==typeof(n=$(n))){if(""===n)throw new fc(dc.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Eh(t)&&-1!==n.indexOf("/"))throw new fc(dc.INVALID_ARGUMENT,"Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '".concat(n,"' contains a '/' character."));const r=t.path.child(Oc.fromString(n));if(!Ac.isDocumentKey(r))throw new fc(dc.INVALID_ARGUMENT,"Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '".concat(r,"' is not because it has an odd number of segments (").concat(r.length,")."));return Au(e,new Ac(r))}if(n instanceof dg)return Au(e,n._key);throw new fc(dc.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ".concat(og(n),"."))}function ev(e,t){if(!Array.isArray(e)||0===e.length)throw new fc(dc.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '".concat(t.toString(),"' filters."))}function tv(e,t){const n=function(e,t){for(const n of e)for(const e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new fc(dc.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '".concat(t.op.toString(),"' filter.")):new fc(dc.INVALID_ARGUMENT,"Invalid query. You cannot use '".concat(t.op.toString(),"' filters with '").concat(n.toString(),"' filters."))}function nv(e,t){if(!(t instanceof Qg||t instanceof Yg))throw new fc(dc.INVALID_ARGUMENT,"Function ".concat(e,"() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'."))}class rv{convertValue(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";switch(Cu(e)){case 0:return null;case 1:return e.booleanValue;case 2:return yu(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(wu(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 10:return this.convertObject(e.mapValue,t);default:throw cc()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";const n={};return su(e,((e,r)=>{n[e]=this.convertValue(r,t)})),n}convertGeoPoint(e){return new _g(yu(e.latitude),yu(e.longitude))}convertArray(e,t){return(e.values||[]).map((e=>this.convertValue(e,t)))}convertServerTimestamp(e,t){switch(t){case"previous":const n=Eu(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Su(e));default:return null}}convertTimestamp(e){const t=vu(e);return new xc(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=Oc.fromString(e);uc(If(n));const r=new ku(n.get(1),n.get(3)),i=new Ac(n.popFirst(5));return r.isEqual(t)||sc("Document ".concat(i," contains a document reference within a different database (").concat(r.projectId,"/").concat(r.database,") which is not supported. It will be treated as a reference in the current database (").concat(t.projectId,"/").concat(t.database,") instead.")),i}}function iv(e,t,n){let r;return r=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,r}class ov{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class sv extends zg{constructor(e,t,n,r,i,o){super(e,t,n,r,o),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._document){if(this._converter){const t=new av(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._document){const n=this._document.data.field(qg("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}}class av extends sv{data(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return super.data(e)}}class lv{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new ov(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new av(this._firestore,this._userDataWriter,n.key,n,new ov(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(){const e=!!(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new fc(dc.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map((n=>{const r=new av(e._firestore,e._userDataWriter,n.doc.key,n.doc,new ov(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:t++}}))}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((e=>t||3!==e.type)).map((t=>{const r=new av(e._firestore,e._userDataWriter,t.doc.key,t.doc,new ov(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let i=-1,o=-1;return 0!==t.type&&(i=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),o=n.indexOf(t.doc.key)),{type:cv(t.type),doc:r,oldIndex:i,newIndex:o}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function cv(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return cc()}}class uv extends rv{constructor(e){super(),this.firestore=e}convertBytes(e){return new bg(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new dg(this.firestore,null,t)}}function hv(e,t,n){e=sg(e,dg);const r=sg(e.firestore,vg),i=iv(e.converter,t,n);return fv(r,[Og(Ng(r),"setDoc",e._key,i,null!==e.converter,n).toMutation(e._key,hd.none())])}function dv(e,t){const n=sg(e.firestore,vg),r=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;ir))}function fv(e,t){return function(e,t){const n=new pc;return e.asyncQueue.enqueueAndForget((async()=>async function(e,t,n){const r=Bm(e);try{const e=await function(e,t){const n=hc(e),r=xc.now(),i=t.reduce(((e,t)=>e.add(t.key)),Wh());let o,s;return n.persistence.runTransaction("Locally write mutations","readwrite",(e=>{let a=Mh(),l=Wh();return n.os.getEntries(e,i).next((e=>{a=e,a.forEach(((e,t)=>{t.isValidDocument()||(l=l.add(e))}))})).next((()=>n.localDocuments.getOverlayedDocuments(e,a))).next((i=>{o=i;const s=[];for(const e of t){const t=vd(e,o.get(e.key).overlayedDocument);null!=t&&s.push(new bd(e.key,t,zu(t.value.mapValue),hd.exists(!0)))}return n.mutationQueue.addMutationBatch(e,r,s,t)})).next((t=>{s=t;const r=t.applyToLocalDocumentSet(o,l);return n.documentOverlayCache.saveOverlays(e,t.batchId,r)}))})).then((()=>({batchId:s.batchId,changes:Uh(o)})))}(r.localStore,t);r.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let r=e.Da[e.currentUser.toKey()];r||(r=new lu(Tc)),r=r.insert(t,n),e.Da[e.currentUser.toKey()]=r}(r,e.batchId,n),await jm(r,e.changes),await qp(r.remoteStore)}catch(e){const t=im(e,"Failed to persist write");n.reject(t)}}(await Xm(e),t,n))),n.promise}(yg(e),t)}function pv(e,t,n){const r=n.docs.get(t._key),i=new uv(e);return new sv(e,i,t._key,r,new ov(n.hasPendingWrites,n.fromCache),t.converter)}new WeakMap;function mv(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:kv(e)?2:Tv(e)?3:0}function bv(e,t){return 2===wv(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ev(e,t){return 2===wv(e)?e.get(t):e[t]}function Sv(e,t,n){var r=wv(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function _v(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function kv(e){return ey&&e instanceof Map}function Tv(e){return ty&&e instanceof Set}function Cv(e){return e.o||e.t}function xv(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ly(e);delete t[oy];for(var n=ay(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=Nv),Object.freeze(e),t&&yv(e,(function(e,t){return Iv(t,!0)}),!0)),e}function Nv(){mv(2)}function Ov(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Pv(e){var t=cy[e];return t||mv(18,e),t}function Rv(e,t){cy[e]||(cy[e]=t)}function Av(){return Jv}function Dv(e,t){t&&(Pv("Patches"),e.u=[],e.s=[],e.v=t)}function Lv(e){Mv(e),e.p.forEach(Fv),e.p=null}function Mv(e){e===Jv&&(Jv=e.l)}function jv(e){return Jv={p:[],l:Jv,h:e,m:!0,_:0}}function Fv(e){var t=e[oy];0===t.i||1===t.i?t.j():t.O=!0}function Uv(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.g||Pv("ES5").S(t,e,r),r?(n[oy].P&&(Lv(t),mv(4)),vv(e)&&(e=Vv(t,e),t.l||zv(t,e)),t.u&&Pv("Patches").M(n[oy].t,e,t.u,t.s)):e=Vv(t,n,[]),Lv(t),t.u&&t.v(t.u,t.s),e!==ry?e:void 0}function Vv(e,t,n){if(Ov(t))return t;var r=t[oy];if(!r)return yv(t,(function(i,o){return Bv(e,r,t,i,o,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return zv(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=xv(r.k):r.o;yv(3===r.i?new Set(i):i,(function(t,o){return Bv(e,r,i,t,o,n)})),zv(e,i,!1),n&&e.u&&Pv("Patches").N(r,n,e.u,e.s)}return r.o}function Bv(e,t,n,r,i,o){if(gv(i)){var s=Vv(e,i,o&&t&&3!==t.i&&!bv(t.R,r)?o.concat(r):void 0);if(Sv(n,r,s),!gv(s))return;e.m=!1}if(vv(i)&&!Ov(i)){if(!e.h.D&&e._<1)return;Vv(e,i),t&&t.A.l||zv(e,i)}}function zv(e,t,n){void 0===n&&(n=!1),e.h.D&&e.m&&Iv(t,n)}function Hv(e,t){var n=e[oy];return(n?Cv(n):e)[t]}function qv(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function Wv(e){e.P||(e.P=!0,e.l&&Wv(e.l))}function Gv(e){e.o||(e.o=xv(e.t))}function Kv(e,t,n){var r=kv(t)?Pv("MapSet").F(t,n):Tv(t)?Pv("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:Av(),P:!1,I:!1,R:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,o=uy;n&&(i=[r],o=hy);var s=Proxy.revocable(i,o),a=s.revoke,l=s.proxy;return r.k=l,r.j=a,l}(t,n):Pv("ES5").J(t,n);return(n?n.A:Av()).p.push(r),r}function Qv(e){return gv(e)||mv(22,e),function e(t){if(!vv(t))return t;var n,r=t[oy],i=wv(t);if(r){if(!r.P&&(r.i<4||!Pv("ES5").K(r)))return r.t;r.I=!0,n=$v(t,i),r.I=!1}else n=$v(t,i);return yv(n,(function(t,i){r&&Ev(r.t,t)===i||Sv(n,t,e(i))})),3===i?new Set(n):n}(e)}function $v(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return xv(e)}function Yv(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[oy];return uy.get(t,e)},set:function(t){var n=this[oy];uy.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][oy];if(!i.P)switch(i.i){case 5:r(i)&&Wv(i);break;case 4:n(i)&&Wv(i)}}}function n(e){for(var t=e.t,n=e.k,r=ay(n),i=r.length-1;i>=0;i--){var o=r[i];if(o!==oy){var s=t[o];if(void 0===s&&!bv(t,o))return!0;var a=n[o],l=a&&a[oy];if(l?l.t!==s:!_v(a,s))return!0}}var c=!!t[oy];return r.length!==ay(t).length+(c?0:1)}function r(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var r=0;r1&&void 0!==arguments[1])||arguments[1];!function(e){nc=e}(at),rt(new Y("firestore",((e,n)=>{let{instanceIdentifier:r,options:i}=n;const o=e.getProvider("app").getImmediate(),s=new vg(new yc(e.getProvider("auth-internal")),new Sc(e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new fc(dc.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new ku(e.options.projectId,t)}(o,r),o);return i=Object.assign({useFetchStreams:t},i),s._setSettings(i),s}),"PUBLIC").setMultipleInstances(!0)),ut(ec,"4.4.2",e),ut(ec,"4.4.2","esm2017")}();var Xv,Jv,Zv="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ey="undefined"!=typeof Map,ty="undefined"!=typeof Set,ny="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ry=Zv?Symbol.for("immer-nothing"):((Xv={})["immer-nothing"]=!0,Xv),iy=Zv?Symbol.for("immer-draftable"):"__$immer_draftable",oy=Zv?Symbol.for("immer-state"):"__$immer_state",sy=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ay="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,ly=Object.getOwnPropertyDescriptors||function(e){var t={};return ay(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},cy={},uy={get:function(e,t){if(t===oy)return e;var n=Cv(e);if(!bv(n,t))return function(e,t,n){var r,i=qv(t,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!vv(r)?r:r===Hv(e.t,t)?(Gv(e),e.o[t]=Kv(e.A.h,r,e)):r},has:function(e,t){return t in Cv(e)},ownKeys:function(e){return Reflect.ownKeys(Cv(e))},set:function(e,t,n){var r=qv(Cv(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var i=Hv(Cv(e),t),o=null==i?void 0:i[oy];if(o&&o.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(_v(n,i)&&(void 0!==n||bv(e.t,t)))return!0;Gv(e),Wv(e)}return e.o[t]===n&&(void 0!==n||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==Hv(e.t,t)||t in e.t?(e.R[t]=!1,Gv(e),Wv(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=Cv(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){mv(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){mv(12)}},hy={};yv(uy,(function(e,t){hy[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),hy.deleteProperty=function(e,t){return hy.set.call(this,e,t,void 0)},hy.set=function(e,t,n){return uy.set.call(this,e[0],t,n,e[0])};var dy=function(){function e(e){var t=this;this.g=ny,this.D=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var o=t;return function(e){var t=this;void 0===e&&(e=i);for(var r=arguments.length,s=Array(r>1?r-1:0),a=1;a1?r-1:0),o=1;o=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));var i=Pv("Patches").$;return gv(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),fy=new dy,py=fy.produce;fy.produceWithPatches.bind(fy),fy.setAutoFreeze.bind(fy),fy.setUseProxies.bind(fy),fy.applyPatches.bind(fy),fy.createDraft.bind(fy),fy.finishDraft.bind(fy);const my=py;function gy(e,t){return e===t}!function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:gy,n=null,r=null;return function(){return function(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,i=0;it.payload}}),{setState:Xy}=Yy.actions,Jy=Yy.reducer;function Zy(){const e=Math.floor(6*Math.random())+1,t=Math.floor(6*Math.random())+1;return e===t?[e,e,e,e]:[e,t]}function ew(){let e=[],t=null;do{t=Zy(),e.push(t)}while(4===t.length);e=e.slice(-2);let n={};for(let r=0;rt.payload,reset:()=>lw}}),{setReadyForNextGameData:uw,reset:hw}=cw.actions,dw=cw.reducer,fw={owner:null,gameStakes:1,enabled:!0},pw=Qy({name:"doublingCubeState",initialState:fw,reducers:{setDoublingCubeData:(e,t)=>t.payload,resetDoublingCubeData:e=>({...fw,enabled:e.enabled})}}),{setDoublingCubeData:mw,resetDoublingCubeData:gw}=pw.actions,vw=pw.reducer,yw={[tw.One]:0,[tw.Two]:0,pointsRequiredToWin:1},ww=Qy({name:"matchScoreState",initialState:yw,reducers:{setMatchScore:(e,t)=>t.payload,setPointsRequiredToWin:(e,t)=>(e.pointsRequiredToWin=t.payload,e),resetMatchScore:()=>yw}}),{setMatchScore:bw,setPointsRequiredToWin:Ew,resetMatchScore:Sw}=ww.actions,_w=ww.reducer,kw={apiKey:"AIzaSyBEAjHStQSJVxt6gxABDueJ4JdSPEjlHXE",authDomain:"backgammon-574d7.firebaseapp.com",projectId:"backgammon-574d7",storageBucket:"backgammon-574d7.appspot.com",messagingSenderId:"455319890911",appId:"1:455319890911:web:43cfebdc213fa57a44726a",measurementId:"G-74HHQTBN9B"};let Tw,Cw,xw,Iw=!1;function Nw(){Iw||(Tw=lt(kw),Cw=Ai(Tw),xw=function(e,t){const n="string"==typeof e?e:t||"(default)",r=it("object"==typeof e?e:ct(),"firestore").getImmediate({identifier:n});if(!r._initialized){const e=R("firestore");e&&ug(r,...e)}return r}(Tw),Iw=!0)}async function Ow(){if(Nw(),null!=Cw.currentUser)return Cw.currentUser;const e=await async function(e){var t;const n=Dn(e);if(await n._initializationPromise,null===(t=n.currentUser)||void 0===t?void 0:t.isAnonymous)return new lr({user:n.currentUser,providerId:null,operationType:"signIn"});const r=await ar(n,{returnSecureToken:!0}),i=await lr._fromIdTokenResponse(n,"signIn",r,!0);return await n._updateCurrentUser(i.user),i}(Cw);return e.user}function Pw(){if(Nw(),null!=Cw.currentUser)return Cw.currentUser;throw Error("Trying to access current user without signing in.")}async function Rw(){Nw();const e=function(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(var t="",n=0;n<4;n++)t+=e.charAt(Math.floor(26*Math.random()));return t}(),t=ew(),n=t[Object.keys(t).length-1],r={roomCode:e,gameBoard:sw,gameState:$y.WaitingForPlayers,players:{playerOne:{uid:(await Ow()).uid},playerTwo:null},currentPlayer:n[0]>n[1]?tw.One:tw.Two,dice:{initialRolls:t,currentRoll:n},networkedMoves:null,doublingCube:fw,matchScore:yw,readyForNextGame:lw,timeCreated:new Pg("serverTimestamp")};return{roomCode:e,docRef:await dv(pg(xw,"lobbies"),r)}}async function Aw(e){Nw();const t=pg(xw,"lobbies"),n=xc.fromDate(new Date(Date.now()-216e5)),r=(await Ow()).uid,i=function(e,t){let n=[];for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;oe instanceof Yg)).length,n=e.filter((e=>e instanceof Qg)).length;if(t>1||t>0&&n>0)throw new fc(dc.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(n);for(const s of n)e=s._apply(e);return e}(t,function(){for(var e=arguments.length,t=new Array(e),n=0;nnv("and",e))),Yg._create("and",t)}($g("roomCode","==",e),$g("timeCreated",">=",n),function(){for(var e=arguments.length,t=new Array(e),n=0;nnv("or",e))),Yg._create("or",t)}($g("players.playerOne.uid","==",r),$g("players.playerTwo","==",null),$g("players.playerTwo.uid","==",r))),function(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc",n=qg("orderBy",e);return Xg._create(n,t)}("timeCreated","desc"),function(e){return ag("limit",e),Jg._create("limit",e,"F")}(1)),o=await function(e){e=sg(e,hg);const t=sg(e.firestore,vg),n=yg(t),r=new uv(t);return Wg(e._query),Zm(n,e._query).then((n=>new lv(t,r,e,n)))}(i);return o.empty?null:o.docs[0].ref}async function Dw(e,t){return await hv(e,{gameState:t},{merge:!0})}function Lw(){return Lw=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Ww(e,t,n,r){void 0===r&&(r={});let{window:i=document.defaultView,v5Compat:o=!1}=r,s=i.history,a=Mw.Pop,l=null,c=u();function u(){return(s.state||{idx:null}).idx}function h(){a=Mw.Pop;let e=u(),t=null==e?null:e-c;c=e,l&&l({action:a,location:f.location,delta:t})}function d(e){let t="null"!==i.location.origin?i.location.origin:i.location.href,n="string"===typeof e?e:Hw(e);return n=n.replace(/ $/,"%20"),Uw(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==c&&(c=0,s.replaceState(Lw({},s.state,{idx:c}),""));let f={get action(){return a},get location(){return e(i,s)},listen(e){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(jw,h),l=e,()=>{i.removeEventListener(jw,h),l=null}},createHref:e=>t(i,e),createURL:d,encodeLocation(e){let t=d(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){a=Mw.Push;let r=zw(f.location,e,t);n&&n(r,e),c=u()+1;let h=Bw(r,c),d=f.createHref(r);try{s.pushState(h,"",d)}catch(p){if(p instanceof DOMException&&"DataCloneError"===p.name)throw p;i.location.assign(d)}o&&l&&l({action:a,location:f.location,delta:1})},replace:function(e,t){a=Mw.Replace;let r=zw(f.location,e,t);n&&n(r,e),c=u();let i=Bw(r,c),h=f.createHref(r);s.replaceState(i,"",h),o&&l&&l({action:a,location:f.location,delta:0})},go:e=>s.go(e)};return f}var Gw;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(Gw||(Gw={}));const Kw=new Set(["lazy","caseSensitive","path","id","index","children"]);function Qw(e,t,n,r){return void 0===n&&(n=[]),void 0===r&&(r={}),e.map(((e,i)=>{let o=[...n,i],s="string"===typeof e.id?e.id:o.join("-");if(Uw(!0!==e.index||!e.children,"Cannot specify children on an index route"),Uw(!r[s],'Found a route id collision on id "'+s+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){let n=Lw({},e,t(e),{id:s});return r[s]=n,n}{let n=Lw({},e,t(e),{id:s,children:void 0});return r[s]=n,e.children&&(n.children=Qw(e.children,t,o,r)),n}}))}function $w(e,t,n){void 0===n&&(n="/");let r=cb(("string"===typeof t?qw(t):t).pathname||"/",n);if(null==r)return null;let i=Yw(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(i);let o=null;for(let s=0;null==o&&s{let s={relativePath:void 0===o?e.path||"":o,caseSensitive:!0===e.caseSensitive,childrenIndex:i,route:e};s.relativePath.startsWith("/")&&(Uw(s.relativePath.startsWith(r),'Absolute route path "'+s.relativePath+'" nested under path "'+r+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),s.relativePath=s.relativePath.slice(r.length));let a=pb([r,s.relativePath]),l=n.concat(s);e.children&&e.children.length>0&&(Uw(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+a+'".'),Yw(e.children,t,l,a)),(null!=e.path||e.index)&&t.push({path:a,score:ob(a,e.index),routesMeta:l})};return e.forEach(((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let r of Xw(e.path))i(e,t,r);else i(e,t)})),t}function Xw(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return i?[o,""]:[o];let s=Xw(r.join("/")),a=[];return a.push(...s.map((e=>""===e?o:[o,e].join("/")))),i&&a.push(...s),a.map((t=>e.startsWith("/")&&""===t?"/":t))}const Jw=/^:[\w-]+$/,Zw=3,eb=2,tb=1,nb=10,rb=-2,ib=e=>"*"===e;function ob(e,t){let n=e.split("/"),r=n.length;return n.some(ib)&&(r+=rb),t&&(r+=eb),n.filter((e=>!ib(e))).reduce(((e,t)=>e+(Jw.test(t)?Zw:""===t?tb:nb)),r)}function sb(e,t){let{routesMeta:n}=e,r={},i="/",o=[];for(let s=0;s(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(r.push({paramName:"*"}),i+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":""!==e&&"/"!==e&&(i+="(?:(?=\\/|$))");let o=new RegExp(i,t?void 0:"i");return[o,r]}(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let o=i[0],s=o.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce(((e,t,n)=>{let{paramName:r,isOptional:i}=t;if("*"===r){let e=a[n]||"";s=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const l=a[n];return e[r]=i&&!l?void 0:(l||"").replace(/%2F/g,"/"),e}),{}),pathname:o,pathnameBase:s,pattern:e}}function lb(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return Vw(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function cb(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function ub(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in and the router will parse it for you.'}function hb(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function db(e,t){let n=hb(e);return t?n.map(((t,n)=>n===e.length-1?t.pathname:t.pathnameBase)):n.map((e=>e.pathnameBase))}function fb(e,t,n,r){let i;void 0===r&&(r=!1),"string"===typeof e?i=qw(e):(i=Lw({},e),Uw(!i.pathname||!i.pathname.includes("?"),ub("?","pathname","search",i)),Uw(!i.pathname||!i.pathname.includes("#"),ub("#","pathname","hash",i)),Uw(!i.search||!i.search.includes("#"),ub("#","search","hash",i)));let o,s=""===e||""===i.pathname,a=s?"/":i.pathname;if(null==a)o=n;else{let e=t.length-1;if(!r&&a.startsWith("..")){let t=a.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}o=e>=0?t[e]:"/"}let l=function(e,t){void 0===t&&(t="/");let{pathname:n,search:r="",hash:i=""}="string"===typeof e?qw(e):e,o=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:o,search:gb(r),hash:vb(i)}}(i,o),c=a&&"/"!==a&&a.endsWith("/"),u=(s||"."===a)&&n.endsWith("/");return l.pathname.endsWith("/")||!c&&!u||(l.pathname+="/"),l}const pb=e=>e.join("/").replace(/\/\/+/g,"/"),mb=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),gb=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",vb=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";Error;class yb{constructor(e,t,n,r){void 0===r&&(r=!1),this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function wb(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"boolean"===typeof e.internal&&"data"in e}const bb=["post","put","patch","delete"],Eb=new Set(bb),Sb=["get",...bb],_b=new Set(Sb),kb=new Set([301,302,303,307,308]),Tb=new Set([307,308]),Cb={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},xb={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ib={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Nb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ob=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),Pb="remix-router-transitions";function Rb(e){const t=e.window?e.window:"undefined"!==typeof window?window:void 0,n="undefined"!==typeof t&&"undefined"!==typeof t.document&&"undefined"!==typeof t.document.createElement,r=!n;let i;if(Uw(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)i=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;i=e=>({hasErrorBoundary:t(e)})}else i=Ob;let o,s,a={},l=Qw(e.routes,i,void 0,a),c=e.basename||"/",u=Lw({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},e.future),h=null,d=new Set,f=null,p=null,m=null,g=null!=e.hydrationData,v=$w(l,e.history.location,c),y=null;if(null==v){let t=$b(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Qb(l);v=n,y={[r.id]:t}}let w,b=v.some((e=>e.route.lazy)),E=v.some((e=>e.route.loader));if(b)s=!1;else if(E)if(u.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null;s=v.every((e=>e.route.loader&&!0!==e.route.loader.hydrate&&(t&&void 0!==t[e.route.id]||n&&void 0!==n[e.route.id])))}else s=null!=e.hydrationData;else s=!0;let S,_={historyAction:e.history.action,location:e.history.location,matches:v,initialized:s,navigation:Cb,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||y,fetchers:new Map,blockers:new Map},k=Mw.Pop,T=!1,C=!1,x=new Map,I=null,N=!1,O=!1,P=[],R=[],A=new Map,D=0,L=-1,M=new Map,j=new Set,F=new Map,U=new Map,V=new Set,B=new Map,z=new Map,H=!1;function q(e,t){void 0===t&&(t={}),_=Lw({},_,e);let n=[],r=[];u.v7_fetcherPersist&&_.fetchers.forEach(((e,t)=>{"idle"===e.state&&(V.has(t)?r.push(t):n.push(t))})),[...d].forEach((e=>e(_,{deletedFetchers:r,unstable_viewTransitionOpts:t.viewTransitionOpts,unstable_flushSync:!0===t.flushSync}))),u.v7_fetcherPersist&&(n.forEach((e=>_.fetchers.delete(e))),r.forEach((e=>Z(e))))}function W(t,n,r){var i,s;let a,{flushSync:c}=void 0===r?{}:r,u=null!=_.actionData&&null!=_.navigation.formMethod&&rE(_.navigation.formMethod)&&"loading"===_.navigation.state&&!0!==(null==(i=t.state)?void 0:i._isRedirect);a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:u?_.actionData:null;let h=n.loaderData?Gb(_.loaderData,n.loaderData,n.matches||[],n.errors):_.loaderData,d=_.blockers;d.size>0&&(d=new Map(d),d.forEach(((e,t)=>d.set(t,Ib))));let f,p=!0===T||null!=_.navigation.formMethod&&rE(_.navigation.formMethod)&&!0!==(null==(s=t.state)?void 0:s._isRedirect);if(o&&(l=o,o=void 0),N||k===Mw.Pop||(k===Mw.Push?e.history.push(t,t.state):k===Mw.Replace&&e.history.replace(t,t.state)),k===Mw.Pop){let e=x.get(_.location.pathname);e&&e.has(t.pathname)?f={currentLocation:_.location,nextLocation:t}:x.has(t.pathname)&&(f={currentLocation:t,nextLocation:_.location})}else if(C){let e=x.get(_.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),x.set(_.location.pathname,e)),f={currentLocation:_.location,nextLocation:t}}q(Lw({},n,{actionData:a,loaderData:h,historyAction:k,location:t,initialized:!0,navigation:Cb,revalidation:"idle",restoreScrollPosition:ce(t,n.matches||_.matches),preventScrollReset:p,blockers:d}),{viewTransitionOpts:f,flushSync:!0===c}),k=Mw.Pop,T=!1,C=!1,N=!1,O=!1,P=[],R=[]}async function G(t,n,r){S&&S.abort(),S=null,k=t,N=!0===(r&&r.startUninterruptedRevalidation),function(e,t){if(f&&m){let n=le(e,t);f[n]=m()}}(_.location,_.matches),T=!0===(r&&r.preventScrollReset),C=!0===(r&&r.enableViewTransition);let s=o||l,h=r&&r.overrideNavigation,d=$w(s,n,c),p=!0===(r&&r.flushSync);if(!d){let e=$b(404,{pathname:n.pathname}),{matches:t,route:r}=Qb(s);return ae(),void W(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:p})}if(_.initialized&&!O&&function(e,t){if(e.pathname!==t.pathname||e.search!==t.search)return!1;if(""===e.hash)return""!==t.hash;if(e.hash===t.hash)return!0;if(""!==t.hash)return!0;return!1}(_.location,n)&&!(r&&r.submission&&rE(r.submission.formMethod)))return void W(n,{matches:d},{flushSync:p});S=new AbortController;let g,v,y=Bb(e.history,n,S.signal,r&&r.submission);if(r&&r.pendingError)v={[Kb(d).route.id]:r.pendingError};else if(r&&r.submission&&rE(r.submission.formMethod)){let e=await async function(e,t,n,r,o){void 0===o&&(o={});$();let s,l=function(e,t){let n={state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text};return n}(t,n);q({navigation:l},{flushSync:!0===o.flushSync});let h=aE(r,t);if(h.route.action||h.route.lazy){if(s=await Vb("action",e,h,r,a,i,c,u.v7_relativeSplatPath),e.signal.aborted)return{shortCircuited:!0}}else s={type:Gw.error,error:$b(405,{method:e.method,pathname:t.pathname,routeId:h.route.id})};if(eE(s)){let e;return e=o&&null!=o.replace?o.replace:s.location===_.location.pathname+_.location.search,await K(_,s,{submission:n,replace:e}),{shortCircuited:!0}}if(Zb(s)){let e=Kb(r,h.route.id);return!0!==(o&&o.replace)&&(k=Mw.Push),{pendingActionData:{},pendingActionError:{[e.route.id]:s.error}}}if(Jb(s))throw $b(400,{type:"defer-action"});return{pendingActionData:{[h.route.id]:s.data}}}(y,n,r.submission,d,{replace:r.replace,flushSync:p});if(e.shortCircuited)return;g=e.pendingActionData,v=e.pendingActionError,h=cE(n,r.submission),p=!1,y=new Request(y.url,{signal:y.signal})}let{shortCircuited:w,loaderData:b,errors:E}=await async function(t,n,r,i,s,a,h,d,f,p,m){let g=i||cE(n,s),v=s||a||lE(g),y=o||l,[w,b]=Mb(e.history,_,r,v,n,u.v7_partialHydration&&!0===d,O,P,R,V,F,j,y,c,p,m);if(ae((e=>!(r&&r.some((t=>t.route.id===e)))||w&&w.some((t=>t.route.id===e)))),L=++D,0===w.length&&0===b.length){let e=ne();return W(n,Lw({matches:r,loaderData:{},errors:m||null},p?{actionData:p}:{},e?{fetchers:new Map(_.fetchers)}:{}),{flushSync:f}),{shortCircuited:!0}}if(!N&&(!u.v7_partialHydration||!d)){b.forEach((e=>{let t=_.fetchers.get(e.key),n=uE(void 0,t?t.data:void 0);_.fetchers.set(e.key,n)}));let e=p||_.actionData;q(Lw({navigation:g},e?0===Object.keys(e).length?{actionData:null}:{actionData:e}:{},b.length>0?{fetchers:new Map(_.fetchers)}:{}),{flushSync:f})}b.forEach((e=>{A.has(e.key)&&ee(e.key),e.controller&&A.set(e.key,e.controller)}));let E=()=>b.forEach((e=>ee(e.key)));S&&S.signal.addEventListener("abort",E);let{results:k,loaderResults:T,fetcherResults:C}=await Q(_.matches,r,w,b,t);if(t.signal.aborted)return{shortCircuited:!0};S&&S.signal.removeEventListener("abort",E);b.forEach((e=>A.delete(e.key)));let x=Yb(k);if(x){if(x.idx>=w.length){let e=b[x.idx-w.length].key;j.add(e)}return await K(_,x.result,{replace:h}),{shortCircuited:!0}}let{loaderData:I,errors:M}=Wb(_,r,w,T,m,b,C,B);B.forEach(((e,t)=>{e.subscribe((n=>{(n||e.done)&&B.delete(t)}))}));let U=ne(),z=re(L),H=U||z||b.length>0;return Lw({loaderData:I,errors:M},H?{fetchers:new Map(_.fetchers)}:{})}(y,n,d,h,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&!0===r.initialHydration,p,g,v);w||(S=null,W(n,Lw({matches:d},g?{actionData:g}:{},{loaderData:b,errors:E})))}async function K(r,i,o){let{submission:s,fetcherSubmission:a,replace:l}=void 0===o?{}:o;i.revalidate&&(O=!0);let u=zw(r.location,i.location,{_isRedirect:!0});if(Uw(u,"Expected a location on the redirect navigation"),n){let n=!1;if(i.reloadDocument)n=!0;else if(Nb.test(i.location)){const r=e.history.createURL(i.location);n=r.origin!==t.location.origin||null==cb(r.pathname,c)}if(n)return void(l?t.location.replace(i.location):t.location.assign(i.location))}S=null;let h=!0===l?Mw.Replace:Mw.Push,{formMethod:d,formAction:f,formEncType:p}=r.navigation;!s&&!a&&d&&f&&p&&(s=lE(r.navigation));let m=s||a;if(Tb.has(i.status)&&m&&rE(m.formMethod))await G(h,u,{submission:Lw({},m,{formAction:i.location}),preventScrollReset:T});else{let e=cE(u,s);await G(h,u,{overrideNavigation:e,fetcherSubmission:a,preventScrollReset:T})}}async function Q(t,n,r,o,s){let l=await Promise.all([...r.map((e=>Vb("loader",s,e,n,a,i,c,u.v7_relativeSplatPath))),...o.map((t=>{if(t.matches&&t.match&&t.controller)return Vb("loader",Bb(e.history,t.path,t.controller.signal),t.match,t.matches,a,i,c,u.v7_relativeSplatPath);return{type:Gw.error,error:$b(404,{pathname:t.path})}}))]),h=l.slice(0,r.length),d=l.slice(r.length);return await Promise.all([iE(t,r,h,h.map((()=>s.signal)),!1,_.loaderData),iE(t,o.map((e=>e.match)),d,o.map((e=>e.controller?e.controller.signal:null)),!0)]),{results:l,loaderResults:h,fetcherResults:d}}function $(){O=!0,P.push(...ae()),F.forEach(((e,t)=>{A.has(t)&&(R.push(t),ee(t))}))}function Y(e,t,n){void 0===n&&(n={}),_.fetchers.set(e,t),q({fetchers:new Map(_.fetchers)},{flushSync:!0===(n&&n.flushSync)})}function X(e,t,n,r){void 0===r&&(r={});let i=Kb(_.matches,t);Z(e),q({errors:{[i.route.id]:n},fetchers:new Map(_.fetchers)},{flushSync:!0===(r&&r.flushSync)})}function J(e){return u.v7_fetcherPersist&&(U.set(e,(U.get(e)||0)+1),V.has(e)&&V.delete(e)),_.fetchers.get(e)||xb}function Z(e){let t=_.fetchers.get(e);!A.has(e)||t&&"loading"===t.state&&M.has(e)||ee(e),F.delete(e),M.delete(e),j.delete(e),V.delete(e),_.fetchers.delete(e)}function ee(e){let t=A.get(e);Uw(t,"Expected fetch controller: "+e),t.abort(),A.delete(e)}function te(e){for(let t of e){let e=hE(J(t).data);_.fetchers.set(t,e)}}function ne(){let e=[],t=!1;for(let n of j){let r=_.fetchers.get(n);Uw(r,"Expected fetcher: "+n),"loading"===r.state&&(j.delete(n),e.push(n),t=!0)}return te(e),t}function re(e){let t=[];for(let[n,r]of M)if(r0}function ie(e){_.blockers.delete(e),z.delete(e)}function oe(e,t){let n=_.blockers.get(e)||Ib;Uw("unblocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"proceeding"===t.state||"blocked"===n.state&&"unblocked"===t.state||"proceeding"===n.state&&"unblocked"===t.state,"Invalid blocker state transition: "+n.state+" -> "+t.state);let r=new Map(_.blockers);r.set(e,t),q({blockers:r})}function se(e){let{currentLocation:t,nextLocation:n,historyAction:r}=e;if(0===z.size)return;z.size>1&&Vw(!1,"A router only supports one blocker at a time");let i=Array.from(z.entries()),[o,s]=i[i.length-1],a=_.blockers.get(o);return a&&"proceeding"===a.state?void 0:s({currentLocation:t,nextLocation:n,historyAction:r})?o:void 0}function ae(e){let t=[];return B.forEach(((n,r)=>{e&&!e(r)||(n.cancel(),t.push(r),B.delete(r))})),t}function le(e,t){if(p){let n=p(e,t.map((e=>function(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],handle:n.handle}}(e,_.loaderData))));return n||e.key}return e.key}function ce(e,t){if(f){let n=le(e,t),r=f[n];if("number"===typeof r)return r}return null}return w={get basename(){return c},get future(){return u},get state(){return _},get routes(){return l},get window(){return t},initialize:function(){if(h=e.history.listen((t=>{let{action:n,location:r,delta:i}=t;if(H)return void(H=!1);Vw(0===z.size||null!=i,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let o=se({currentLocation:_.location,nextLocation:r,historyAction:n});return o&&null!=i?(H=!0,e.history.go(-1*i),void oe(o,{state:"blocked",location:r,proceed(){oe(o,{state:"proceeding",proceed:void 0,reset:void 0,location:r}),e.history.go(i)},reset(){let e=new Map(_.blockers);e.set(o,Ib),q({blockers:e})}})):G(n,r)})),n){!function(e,t){try{let n=e.sessionStorage.getItem(Pb);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch(n){}}(t,x);let e=()=>function(e,t){if(t.size>0){let r={};for(let[e,n]of t)r[e]=[...n];try{e.sessionStorage.setItem(Pb,JSON.stringify(r))}catch(n){Vw(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}(t,x);t.addEventListener("pagehide",e),I=()=>t.removeEventListener("pagehide",e)}return _.initialized||G(Mw.Pop,_.location,{initialHydration:!0}),w},subscribe:function(e){return d.add(e),()=>d.delete(e)},enableScrollRestoration:function(e,t,n){if(f=e,m=t,p=n||null,!g&&_.navigation===Cb){g=!0;let e=ce(_.location,_.matches);null!=e&&q({restoreScrollPosition:e})}return()=>{f=null,m=null,p=null}},navigate:async function t(n,r){if("number"===typeof n)return void e.history.go(n);let i=Ab(_.location,_.matches,c,u.v7_prependBasename,n,u.v7_relativeSplatPath,null==r?void 0:r.fromRouteId,null==r?void 0:r.relative),{path:o,submission:s,error:a}=Db(u.v7_normalizeFormMethod,!1,i,r),l=_.location,h=zw(_.location,o,r&&r.state);h=Lw({},h,e.history.encodeLocation(h));let d=r&&null!=r.replace?r.replace:void 0,f=Mw.Push;!0===d?f=Mw.Replace:!1===d||null!=s&&rE(s.formMethod)&&s.formAction===_.location.pathname+_.location.search&&(f=Mw.Replace);let p=r&&"preventScrollReset"in r?!0===r.preventScrollReset:void 0,m=!0===(r&&r.unstable_flushSync),g=se({currentLocation:l,nextLocation:h,historyAction:f});if(!g)return await G(f,h,{submission:s,pendingError:a,preventScrollReset:p,replace:r&&r.replace,enableViewTransition:r&&r.unstable_viewTransition,flushSync:m});oe(g,{state:"blocked",location:h,proceed(){oe(g,{state:"proceeding",proceed:void 0,reset:void 0,location:h}),t(n,r)},reset(){let e=new Map(_.blockers);e.set(g,Ib),q({blockers:e})}})},fetch:function(t,n,s,h){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");A.has(t)&&ee(t);let d=!0===(h&&h.unstable_flushSync),f=o||l,p=Ab(_.location,_.matches,c,u.v7_prependBasename,s,u.v7_relativeSplatPath,n,null==h?void 0:h.relative),m=$w(f,p,c);if(!m)return void X(t,n,$b(404,{pathname:p}),{flushSync:d});let{path:g,submission:v,error:y}=Db(u.v7_normalizeFormMethod,!0,p,h);if(y)return void X(t,n,y,{flushSync:d});let w=aE(m,g);T=!0===(h&&h.preventScrollReset),v&&rE(v.formMethod)?async function(t,n,r,s,h,d,f){if($(),F.delete(t),!s.route.action&&!s.route.lazy){let e=$b(405,{method:f.formMethod,pathname:r,routeId:n});return void X(t,n,e,{flushSync:d})}let p=_.fetchers.get(t);Y(t,function(e,t){let n={state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0};return n}(f,p),{flushSync:d});let m=new AbortController,g=Bb(e.history,r,m.signal,f);A.set(t,m);let v=D,y=await Vb("action",g,s,h,a,i,c,u.v7_relativeSplatPath);if(g.signal.aborted)return void(A.get(t)===m&&A.delete(t));if(u.v7_fetcherPersist&&V.has(t)){if(eE(y)||Zb(y))return void Y(t,hE(void 0))}else{if(eE(y))return A.delete(t),L>v?void Y(t,hE(void 0)):(j.add(t),Y(t,uE(f)),K(_,y,{fetcherSubmission:f}));if(Zb(y))return void X(t,n,y.error)}if(Jb(y))throw $b(400,{type:"defer-action"});let w=_.navigation.location||_.location,b=Bb(e.history,w,m.signal),E=o||l,T="idle"!==_.navigation.state?$w(E,_.navigation.location,c):_.matches;Uw(T,"Didn't find any matches after fetcher action");let C=++D;M.set(t,C);let x=uE(f,y.data);_.fetchers.set(t,x);let[I,N]=Mb(e.history,_,T,f,w,!1,O,P,R,V,F,j,E,c,{[s.route.id]:y.data},void 0);N.filter((e=>e.key!==t)).forEach((e=>{let t=e.key,n=_.fetchers.get(t),r=uE(void 0,n?n.data:void 0);_.fetchers.set(t,r),A.has(t)&&ee(t),e.controller&&A.set(t,e.controller)})),q({fetchers:new Map(_.fetchers)});let U=()=>N.forEach((e=>ee(e.key)));m.signal.addEventListener("abort",U);let{results:z,loaderResults:H,fetcherResults:G}=await Q(_.matches,T,I,N,b);if(m.signal.aborted)return;m.signal.removeEventListener("abort",U),M.delete(t),A.delete(t),N.forEach((e=>A.delete(e.key)));let J=Yb(z);if(J){if(J.idx>=I.length){let e=N[J.idx-I.length].key;j.add(e)}return K(_,J.result)}let{loaderData:Z,errors:te}=Wb(_,_.matches,I,H,void 0,N,G,B);if(_.fetchers.has(t)){let e=hE(y.data);_.fetchers.set(t,e)}re(C),"loading"===_.navigation.state&&C>L?(Uw(k,"Expected pending action"),S&&S.abort(),W(_.navigation.location,{matches:T,loaderData:Z,errors:te,fetchers:new Map(_.fetchers)})):(q({errors:te,loaderData:Gb(_.loaderData,Z,T,te),fetchers:new Map(_.fetchers)}),O=!1)}(t,n,g,w,m,d,v):(F.set(t,{routeId:n,path:g}),async function(t,n,r,o,s,l,h){let d=_.fetchers.get(t);Y(t,uE(h,d?d.data:void 0),{flushSync:l});let f=new AbortController,p=Bb(e.history,r,f.signal);A.set(t,f);let m=D,g=await Vb("loader",p,o,s,a,i,c,u.v7_relativeSplatPath);Jb(g)&&(g=await oE(g,p.signal,!0)||g);A.get(t)===f&&A.delete(t);if(p.signal.aborted)return;if(V.has(t))return void Y(t,hE(void 0));if(eE(g))return L>m?void Y(t,hE(void 0)):(j.add(t),void await K(_,g));if(Zb(g))return void X(t,n,g.error);Uw(!Jb(g),"Unhandled fetcher deferred data"),Y(t,hE(g.data))}(t,n,g,w,m,d,v))},revalidate:function(){$(),q({revalidation:"loading"}),"submitting"!==_.navigation.state&&("idle"!==_.navigation.state?G(k||_.historyAction,_.navigation.location,{overrideNavigation:_.navigation}):G(_.historyAction,_.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:J,deleteFetcher:function(e){if(u.v7_fetcherPersist){let t=(U.get(e)||0)-1;t<=0?(U.delete(e),V.add(e)):U.set(e,t)}else Z(e);q({fetchers:new Map(_.fetchers)})},dispose:function(){h&&h(),I&&I(),d.clear(),S&&S.abort(),_.fetchers.forEach(((e,t)=>Z(t))),_.blockers.forEach(((e,t)=>ie(t)))},getBlocker:function(e,t){let n=_.blockers.get(e)||Ib;return z.get(e)!==t&&z.set(e,t),n},deleteBlocker:ie,_internalFetchControllers:A,_internalActiveDeferreds:B,_internalSetRoutes:function(e){a={},o=Qw(e,i,void 0,a)}},w}Symbol("deferred");function Ab(e,t,n,r,i,o,s,a){let l,c;if(s){l=[];for(let e of t)if(l.push(e),e.route.id===s){c=e;break}}else l=t,c=t[t.length-1];let u=fb(i||".",db(l,o),cb(e.pathname,n)||e.pathname,"path"===a);return null==i&&(u.search=e.search,u.hash=e.hash),null!=i&&""!==i&&"."!==i||!c||!c.route.index||sE(u.search)||(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r&&"/"!==n&&(u.pathname="/"===u.pathname?n:pb([n,u.pathname])),Hw(u)}function Db(e,t,n,r){if(!r||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(r))return{path:n};if(r.formMethod&&!nE(r.formMethod))return{path:n,error:$b(405,{method:r.formMethod})};let i,o,s=()=>({path:n,error:$b(400,{type:"invalid-body"})}),a=r.formMethod||"get",l=e?a.toUpperCase():a.toLowerCase(),c=Xb(n);if(void 0!==r.body){if("text/plain"===r.formEncType){if(!rE(l))return s();let e="string"===typeof r.body?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce(((e,t)=>{let[n,r]=t;return""+e+n+"="+r+"\n"}),""):String(r.body);return{path:n,submission:{formMethod:l,formAction:c,formEncType:r.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===r.formEncType){if(!rE(l))return s();try{let e="string"===typeof r.body?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:l,formAction:c,formEncType:r.formEncType,formData:void 0,json:e,text:void 0}}}catch(d){return s()}}}if(Uw("function"===typeof FormData,"FormData is not available in this environment"),r.formData)i=zb(r.formData),o=r.formData;else if(r.body instanceof FormData)i=zb(r.body),o=r.body;else if(r.body instanceof URLSearchParams)i=r.body,o=Hb(i);else if(null==r.body)i=new URLSearchParams,o=new FormData;else try{i=new URLSearchParams(r.body),o=Hb(i)}catch(d){return s()}let u={formMethod:l,formAction:c,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:o,json:void 0,text:void 0};if(rE(u.formMethod))return{path:n,submission:u};let h=qw(n);return t&&h.search&&sE(h.search)&&i.append("index",""),h.search="?"+i,{path:Hw(h),submission:u}}function Lb(e,t){let n=e;if(t){let r=e.findIndex((e=>e.route.id===t));r>=0&&(n=e.slice(0,r))}return n}function Mb(e,t,n,r,i,o,s,a,l,c,u,h,d,f,p,m){let g=m?Object.values(m)[0]:p?Object.values(p)[0]:void 0,v=e.createURL(t.location),y=e.createURL(i),w=m?Object.keys(m)[0]:void 0,b=Lb(n,w).filter(((e,n)=>{let{route:i}=e;if(i.lazy)return!0;if(null==i.loader)return!1;if(o)return!!i.loader.hydrate||void 0===t.loaderData[i.id]&&(!t.errors||void 0===t.errors[i.id]);if(function(e,t,n){let r=!t||n.route.id!==t.route.id,i=void 0===e[n.route.id];return r||i}(t.loaderData,t.matches[n],e)||a.some((t=>t===e.route.id)))return!0;let l=t.matches[n],c=e;return Fb(e,Lw({currentUrl:v,currentParams:l.params,nextUrl:y,nextParams:c.params},r,{actionResult:g,defaultShouldRevalidate:s||v.pathname+v.search===y.pathname+y.search||v.search!==y.search||jb(l,c)}))})),E=[];return u.forEach(((e,i)=>{if(o||!n.some((t=>t.route.id===e.routeId))||c.has(i))return;let a=$w(d,e.path,f);if(!a)return void E.push({key:i,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let u=t.fetchers.get(i),p=aE(a,e.path),m=!1;m=!h.has(i)&&(!!l.includes(i)||(u&&"idle"!==u.state&&void 0===u.data?s:Fb(p,Lw({currentUrl:v,currentParams:t.matches[t.matches.length-1].params,nextUrl:y,nextParams:n[n.length-1].params},r,{actionResult:g,defaultShouldRevalidate:s})))),m&&E.push({key:i,routeId:e.routeId,path:e.path,matches:a,match:p,controller:new AbortController})})),[b,E]}function jb(e,t){let n=e.route.path;return e.pathname!==t.pathname||null!=n&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Fb(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if("boolean"===typeof n)return n}return t.defaultShouldRevalidate}async function Ub(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let i=n[e.id];Uw(i,"No route found in manifest");let o={};for(let s in r){let e=void 0!==i[s]&&"hasErrorBoundary"!==s;Vw(!e,'Route "'+i.id+'" has a static property "'+s+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+s+'" will be ignored.'),e||Kw.has(s)||(o[s]=r[s])}Object.assign(i,o),Object.assign(i,Lw({},t(i),{lazy:void 0}))}async function Vb(e,t,n,r,i,o,s,a,l){let c,u,h;void 0===l&&(l={});let d=e=>{let r,i=new Promise(((e,t)=>r=t));return h=()=>r(),t.signal.addEventListener("abort",h),Promise.race([e({request:t,params:n.params,context:l.requestContext}),i])};try{let r=n.route[e];if(n.route.lazy)if(r){let e,t=await Promise.all([d(r).catch((t=>{e=t})),Ub(n.route,o,i)]);if(e)throw e;u=t[0]}else{if(await Ub(n.route,o,i),r=n.route[e],!r){if("action"===e){let e=new URL(t.url),r=e.pathname+e.search;throw $b(405,{method:t.method,pathname:r,routeId:n.route.id})}return{type:Gw.data,data:void 0}}u=await d(r)}else{if(!r){let e=new URL(t.url);throw $b(404,{pathname:e.pathname+e.search})}u=await d(r)}Uw(void 0!==u,"You defined "+("action"===e?"an action":"a loader")+' for route "'+n.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(m){c=Gw.error,u=m}finally{h&&t.signal.removeEventListener("abort",h)}if(tE(u)){let e,i=u.status;if(kb.has(i)){let e=u.headers.get("Location");if(Uw(e,"Redirects returned/thrown from loaders/actions must have a Location header"),Nb.test(e)){if(!l.isStaticRequest){let n=new URL(t.url),r=e.startsWith("//")?new URL(n.protocol+e):new URL(e),i=null!=cb(r.pathname,s);r.origin===n.origin&&i&&(e=r.pathname+r.search+r.hash)}}else e=Ab(new URL(t.url),r.slice(0,r.indexOf(n)+1),s,!0,e,a);if(l.isStaticRequest)throw u.headers.set("Location",e),u;return{type:Gw.redirect,status:i,location:e,revalidate:null!==u.headers.get("X-Remix-Revalidate"),reloadDocument:null!==u.headers.get("X-Remix-Reload-Document")}}if(l.isRouteRequest){throw{type:c===Gw.error?Gw.error:Gw.data,response:u}}try{let t=u.headers.get("Content-Type");e=t&&/\bapplication\/json\b/.test(t)?null==u.body?null:await u.json():await u.text()}catch(m){return{type:Gw.error,error:m}}return c===Gw.error?{type:c,error:new yb(i,u.statusText,e),headers:u.headers}:{type:Gw.data,data:e,statusCode:u.status,headers:u.headers}}return c===Gw.error?{type:c,error:u}:function(e){let t=e;return t&&"object"===typeof t&&"object"===typeof t.data&&"function"===typeof t.subscribe&&"function"===typeof t.cancel&&"function"===typeof t.resolveData}(u)?{type:Gw.deferred,deferredData:u,statusCode:null==(f=u.init)?void 0:f.status,headers:(null==(p=u.init)?void 0:p.headers)&&new Headers(u.init.headers)}:{type:Gw.data,data:u};var f,p}function Bb(e,t,n,r){let i=e.createURL(Xb(t)).toString(),o={signal:n};if(r&&rE(r.formMethod)){let{formMethod:e,formEncType:t}=r;o.method=e.toUpperCase(),"application/json"===t?(o.headers=new Headers({"Content-Type":t}),o.body=JSON.stringify(r.json)):"text/plain"===t?o.body=r.text:"application/x-www-form-urlencoded"===t&&r.formData?o.body=zb(r.formData):o.body=r.formData}return new Request(i,o)}function zb(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,"string"===typeof r?r:r.name);return t}function Hb(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function qb(e,t,n,r,i){let o,s={},a=null,l=!1,c={};return n.forEach(((n,u)=>{let h=t[u].route.id;if(Uw(!eE(n),"Cannot handle redirect results in processLoaderData"),Zb(n)){let t=Kb(e,h),i=n.error;r&&(i=Object.values(r)[0],r=void 0),a=a||{},null==a[t.route.id]&&(a[t.route.id]=i),s[h]=void 0,l||(l=!0,o=wb(n.error)?n.error.status:500),n.headers&&(c[h]=n.headers)}else Jb(n)?(i.set(h,n.deferredData),s[h]=n.deferredData.data):s[h]=n.data,null==n.statusCode||200===n.statusCode||l||(o=n.statusCode),n.headers&&(c[h]=n.headers)})),r&&(a=r,s[Object.keys(r)[0]]=void 0),{loaderData:s,errors:a,statusCode:o||200,loaderHeaders:c}}function Wb(e,t,n,r,i,o,s,a){let{loaderData:l,errors:c}=qb(t,n,r,i,a);for(let u=0;ue.route.id===t))+1):[...e];return n.reverse().find((e=>!0===e.route.hasErrorBoundary))||e[0]}function Qb(e){let t=1===e.length?e[0]:e.find((e=>e.index||!e.path||"/"===e.path))||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function $b(e,t){let{pathname:n,routeId:r,method:i,type:o}=void 0===t?{}:t,s="Unknown Server Error",a="Unknown @remix-run/router error";return 400===e?(s="Bad Request",i&&n&&r?a="You made a "+i+' request to "'+n+'" but did not provide a `loader` for route "'+r+'", so there is no way to handle the request.':"defer-action"===o?a="defer() is not supported in actions":"invalid-body"===o&&(a="Unable to encode submission body")):403===e?(s="Forbidden",a='Route "'+r+'" does not match URL "'+n+'"'):404===e?(s="Not Found",a='No route matches URL "'+n+'"'):405===e&&(s="Method Not Allowed",i&&n&&r?a="You made a "+i.toUpperCase()+' request to "'+n+'" but did not provide an `action` for route "'+r+'", so there is no way to handle the request.':i&&(a='Invalid request method "'+i.toUpperCase()+'"')),new yb(e||500,s,new Error(a),!0)}function Yb(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(eE(n))return{result:n,idx:t}}}function Xb(e){return Hw(Lw({},"string"===typeof e?qw(e):e,{hash:""}))}function Jb(e){return e.type===Gw.deferred}function Zb(e){return e.type===Gw.error}function eE(e){return(e&&e.type)===Gw.redirect}function tE(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"object"===typeof e.headers&&"undefined"!==typeof e.body}function nE(e){return _b.has(e.toLowerCase())}function rE(e){return Eb.has(e.toLowerCase())}async function iE(e,t,n,r,i,o){for(let s=0;se.route.id===l.route.id)),u=null!=c&&!jb(c,l)&&void 0!==(o&&o[l.route.id]);if(Jb(a)&&(i||u)){let e=r[s];Uw(e,"Expected an AbortSignal for revalidating fetcher deferred result"),await oE(a,e,i).then((e=>{e&&(n[s]=e||n[s])}))}}}async function oE(e,t,n){if(void 0===n&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:Gw.data,data:e.deferredData.unwrappedData}}catch(r){return{type:Gw.error,error:r}}return{type:Gw.data,data:e.deferredData.data}}}function sE(e){return new URLSearchParams(e).getAll("index").some((e=>""===e))}function aE(e,t){let n="string"===typeof t?qw(t).search:t.search;if(e[e.length-1].route.index&&sE(n||""))return e[e.length-1];let r=hb(e);return r[r.length-1]}function lE(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:o,json:s}=e;if(t&&n&&r)return null!=i?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i}:null!=o?{formMethod:t,formAction:n,formEncType:r,formData:o,json:void 0,text:void 0}:void 0!==s?{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:s,text:void 0}:void 0}function cE(e,t){if(t){return{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}return{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function uE(e,t){if(e){return{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}}return{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function hE(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function dE(){return dE=Object.assign?Object.assign.bind():function(e){for(var t=1;t{r.current=!0}));let i=e.useCallback((function(e,i){void 0===i&&(i={}),r.current&&("number"===typeof e?t.navigate(e):t.navigate(e,dE({fromRouteId:n},i)))}),[t,n]);return i}():function(){wE()||Uw(!1);let t=e.useContext(fE),{basename:n,future:r,navigator:i}=e.useContext(mE),{matches:o}=e.useContext(vE),{pathname:s}=bE(),a=JSON.stringify(db(o,r.v7_relativeSplatPath)),l=e.useRef(!1);EE((()=>{l.current=!0}));let c=e.useCallback((function(e,r){if(void 0===r&&(r={}),!l.current)return;if("number"===typeof e)return void i.go(e);let o=fb(e,JSON.parse(a),s,"path"===r.relative);null==t&&"/"!==n&&(o.pathname="/"===o.pathname?n:pb([n,o.pathname])),(r.replace?i.replace:i.push)(o,r.state,r)}),[n,i,a,s,t]);return c}()}function _E(t,n,r,i){wE()||Uw(!1);let{navigator:o}=e.useContext(mE),{matches:s}=e.useContext(vE),a=s[s.length-1],l=a?a.params:{},c=(a&&a.pathname,a?a.pathnameBase:"/");a&&a.route;let u,h=bE();if(n){var d;let e="string"===typeof n?qw(n):n;"/"===c||(null==(d=e.pathname)?void 0:d.startsWith(c))||Uw(!1),u=e}else u=h;let f=u.pathname||"/",p=f;if("/"!==c){let e=c.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(e.length).join("/")}let m=$w(t,{pathname:p});let g=IE(m&&m.map((e=>Object.assign({},e,{params:Object.assign({},l,e.params),pathname:pb([c,o.encodeLocation?o.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?c:pb([c,o.encodeLocation?o.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),s,r,i);return n&&g?e.createElement(gE.Provider,{value:{location:dE({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:Mw.Pop}},g):g}function kE(){let t=function(){var t;let n=e.useContext(yE),r=RE(OE.UseRouteError),i=AE(OE.UseRouteError);if(void 0!==n)return n;return null==(t=r.errors)?void 0:t[i]}(),n=wb(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:i};return e.createElement(e.Fragment,null,e.createElement("h2",null,"Unexpected Application Error!"),e.createElement("h3",{style:{fontStyle:"italic"}},n),r?e.createElement("pre",{style:o},r):null,null)}const TE=e.createElement(kE,null);class CE extends e.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?e.createElement(vE.Provider,{value:this.props.routeContext},e.createElement(yE.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function xE(t){let{routeContext:n,match:r,children:i}=t,o=e.useContext(fE);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),e.createElement(vE.Provider,{value:n},i)}function IE(t,n,r,i){var o;if(void 0===n&&(n=[]),void 0===r&&(r=null),void 0===i&&(i=null),null==t){var s;if(null==(s=r)||!s.errors)return null;t=r.matches}let a=t,l=null==(o=r)?void 0:o.errors;if(null!=l){let e=a.findIndex((e=>e.route.id&&(null==l?void 0:l[e.route.id])));e>=0||Uw(!1),a=a.slice(0,Math.min(a.length,e+1))}let c=!1,u=-1;if(r&&i&&i.v7_partialHydration)for(let e=0;e=0?a.slice(0,u+1):[a[0]];break}}}return a.reduceRight(((t,i,o)=>{let s,h=!1,d=null,f=null;var p;r&&(s=l&&i.route.id?l[i.route.id]:void 0,d=i.route.errorElement||TE,c&&(u<0&&0===o?(p="route-fallback",!1||DE[p]||(DE[p]=!0),h=!0,f=null):u===o&&(h=!0,f=i.route.hydrateFallbackElement||null)));let m=n.concat(a.slice(0,o+1)),g=()=>{let n;return n=s?d:h?f:i.route.Component?e.createElement(i.route.Component,null):i.route.element?i.route.element:t,e.createElement(xE,{match:i,routeContext:{outlet:t,matches:m,isDataRoute:null!=r},children:n})};return r&&(i.route.ErrorBoundary||i.route.errorElement||0===o)?e.createElement(CE,{location:r.location,revalidation:r.revalidation,component:d,error:s,children:g(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):g()}),null)}var NE=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(NE||{}),OE=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(OE||{});function PE(t){let n=e.useContext(fE);return n||Uw(!1),n}function RE(t){let n=e.useContext(pE);return n||Uw(!1),n}function AE(t){let n=function(t){let n=e.useContext(vE);return n||Uw(!1),n}(),r=n.matches[n.matches.length-1];return r.route.id||Uw(!1),r.route.id}const DE={};t.startTransition;function LE(t){let{basename:n="/",children:r=null,location:i,navigationType:o=Mw.Pop,navigator:s,static:a=!1,future:l}=t;wE()&&Uw(!1);let c=n.replace(/^\/*/,"/"),u=e.useMemo((()=>({basename:c,navigator:s,static:a,future:dE({v7_relativeSplatPath:!1},l)})),[c,l,s,a]);"string"===typeof i&&(i=qw(i));let{pathname:h="/",search:d="",hash:f="",state:p=null,key:m="default"}=i,g=e.useMemo((()=>{let e=cb(h,c);return null==e?null:{location:{pathname:e,search:d,hash:f,state:p,key:m},navigationType:o}}),[c,h,d,f,p,m,o]);return null==g?null:e.createElement(mE.Provider,{value:u},e.createElement(gE.Provider,{children:r,value:g}))}new Promise((()=>{}));e.Component;function ME(t){let n={hasErrorBoundary:null!=t.ErrorBoundary||null!=t.errorElement};return t.Component&&Object.assign(n,{element:e.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(n,{hydrateFallbackElement:e.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(n,{errorElement:e.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),n}const jE=()=>v(),FE=E,UE=Qy({name:"provisionalMovesState",initialState:[],reducers:{appendProvisionalMove:(e,t)=>[...e,t.payload],clearProvisionalMoves:()=>[]}}),{appendProvisionalMove:VE,clearProvisionalMoves:BE}=UE.actions,zE=UE.reducer,HE={point:-1},qE=Qy({name:"lastPointClickedState",initialState:HE,reducers:{setLastPointClicked:(e,t)=>t.payload.point===e.point?HE:t.payload,clearLastPointClicked:()=>HE}}),{setLastPointClicked:WE,clearLastPointClicked:GE}=qE.actions,KE=qE.reducer,QE=Qy({name:"currentPlayerState",initialState:tw.One,reducers:{setCurrentPlayer:(e,t)=>t.payload}}),{setCurrentPlayer:$E}=QE.actions,YE=QE.reducer,XE=ew(),JE=Qy({name:"diceState",initialState:{initialRolls:XE,currentRoll:XE[Object.keys(XE).length-1]},reducers:{rollDice:e=>({initialRolls:e.initialRolls,currentRoll:Zy()}),setDiceState:(e,t)=>t.payload}}),{rollDice:ZE,setDiceState:eS}=JE.actions,tS=JE.reducer,nS=Qy({name:"gameBoardState",initialState:sw,reducers:{setGameBoardState:(e,t)=>t.payload,reset:()=>sw}});function rS(e,t){let n=t.checkerOwner,r=t.checkerOwner===tw.One?tw.Two:tw.One;const i=function(e){const t=[];for(let n=0;n<=23;n++){const r={...e.pointsState[n]};t.push(r)}return{pointsState:t,barState:{...e.barState},homeState:{...e.homeState}}}(e);if("BAR"===t.from)i.barState[n]-=1;else if("HOME"===t.from)i.homeState[n]-=1;else{const o=i.pointsState[t.from];o[n]-=1,t.hitStatus===iw.UndoesHit&&(0===o[n]&&0===o[r]||(console.error("Trying to undo a hit but from point is unexpectedly occupied."),console.error(e),console.error(t)),i.barState[r]<=0&&(console.error("Trying to undo a hit but non-moving player has no checkers on the bar."),console.error(e),console.error(t)),i.barState[r]-=1,o[r]+=1)}if("HOME"===t.to)i.homeState[n]+=1;else if("BAR"===t.to)i.barState[n]+=1;else{const o=i.pointsState[t.to];o[r]>1&&(console.error("Trying to apply invalid move. Destination occupied by 2+ opposing checkers"),console.error(e),console.error(t)),t.hitStatus===iw.IsHit?(1!==o[r]&&(console.error("Trying to apply a hit but destination does not have a single opposing checker."),console.error(e),console.error(t)),i.barState[r]+=1,o[r]-=1):o[r]>0&&(console.error("Trying to apply a non-hit move but destination contains opposing checkers."),console.error(e),console.error(t)),o[n]+=1}return i}function iS(e,t){let n=0;n+=25*e.barState[t];for(let r=0;r<24;r++){n+=e.pointsState[r][t]*(t===tw.One?r+1:24-r)}return n}const{setGameBoardState:oS,reset:sS}=nS.actions,aS=nS.reducer,lS=Qy({name:"settings",initialState:{movementDirection:rw.CounterClockwise,playerOneColor:nw.White,showGameOverDialog:!1,showSettingsMenu:!1,showMatchSetupScreen:!1},reducers:{setMovementDirection:(e,t)=>(e.movementDirection=t.payload,e),setPlayerOneColor:(e,t)=>(e.playerOneColor=t.payload,e),setShowGameOverDialog:(e,t)=>(e.showGameOverDialog=t.payload,e),setShowSettingsMenu:(e,t)=>(e.showSettingsMenu=t.payload,e),setShowMatchSetupScreen:(e,t)=>(e.showMatchSetupScreen=t.payload,e)}}),{setMovementDirection:cS,setPlayerOneColor:uS,setShowGameOverDialog:hS,setShowSettingsMenu:dS,setShowMatchSetupScreen:fS}=lS.actions,pS=lS.reducer,mS=Qy({name:"wipeTransitionState",initialState:!1,reducers:{setWipeTransition:(e,t)=>t.payload}}),{setWipeTransition:gS}=mS.actions,vS=mS.reducer;class yS{isHostClient(){return console.error("Unexpected use of default ActionsContext."),!1}beginCoinFlip(){console.error("Unexpected use of default ActionsContext.")}beginFirstTurn(e){console.error("Unexpected use of default ActionsContext.")}async rollButtonClicked(){console.error("Unexpected use of default ActionsContext.")}async offerDoubleButtonClicked(){console.error("Unexpected use of default ActionsContext.")}async acceptDoubleButtonClicked(e,t){console.error("Unexpected use of default ActionsContext.")}async automaticDouble(){console.error("Unexpected use of default ActionsContext.")}async forfeitButtonClicked(e,t){console.error("Unexpected use of default ActionsContext.")}async submitMoves(e,t,n){console.error("Unexpected use of default ActionsContext.")}async gameOver(e,t,n,r,i){console.error("Unexpected use of default ActionsContext.")}async updateMatchSettings(e,t){console.error("Unexpected use of default ActionsContext.")}async nextGameButtonClicked(e){console.error("Unexpected use of default ActionsContext.")}async bothPlayersReadyForNextGame(){console.error("Unexpected use of default ActionsContext.")}}class wS extends yS{constructor(e){super(),this.dispatchFn=void 0,this.dispatchFn=e}isHostClient(){return!0}beginCoinFlip(){this.dispatchFn(Xy($y.CoinFlip))}beginFirstTurn(e){this.dispatchFn($E(e)),this.dispatchFn(Xy($y.PlayerMoving))}async rollButtonClicked(){this.dispatchFn(Xy($y.PlayerMoving))}async offerDoubleButtonClicked(){this.dispatchFn(Xy($y.PlayerOfferingDouble))}async acceptDoubleButtonClicked(e,t){this.dispatchFn(mw({owner:e,gameStakes:t,enabled:!0})),this.dispatchFn(Xy($y.PlayerRolling))}async automaticDouble(){this.dispatchFn(mw({owner:null,gameStakes:2,enabled:!0}))}async forfeitButtonClicked(e,t){this.dispatchFn(BE()),this.dispatchFn(GE()),this.dispatchFn(Xy($y.GameOverForfeit)),this.dispatchFn(oS(e)),this.dispatchFn(bw(t)),this.dispatchFn(hS(!0))}async submitMoves(e,t,n){this.dispatchFn(BE()),this.dispatchFn(GE()),this.dispatchFn(Xy($y.PlayerRolling)),this.dispatchFn(oS(e)),this.dispatchFn($E(t)),this.dispatchFn(ZE())}async gameOver(e,t,n,r,i){this.dispatchFn(BE()),this.dispatchFn(GE()),this.dispatchFn(Xy(t)),this.dispatchFn(oS(e)),this.dispatchFn(bw(n)),this.dispatchFn(hS(!0))}async updateMatchSettings(e,t){this.dispatchFn(Ew(e)),this.dispatchFn(mw({...fw,enabled:t})),this.dispatchFn(fS(!1)),this.dispatchFn(gS(!0))}async nextGameButtonClicked(e){VS(this.dispatchFn,!1),this.dispatchFn(hS(!1)),this.dispatchFn(gS(!0))}async bothPlayersReadyForNextGame(){console.error("Unexpected use of default ActionsContext.")}}class bS extends yS{constructor(e,t,n){super(),this.isHost=void 0,this.dispatchFn=void 0,this.docRef=void 0,this.isHost=e,this.dispatchFn=t,this.docRef=n}isHostClient(){return this.isHost}beginCoinFlip(){Dw(this.docRef,$y.CoinFlip)}beginFirstTurn(e){Dw(this.docRef,$y.PlayerMoving)}async offerDoubleButtonClicked(){Dw(this.docRef,$y.PlayerOfferingDouble)}async acceptDoubleButtonClicked(e,t){const n={owner:e,gameStakes:t,enabled:!0};return this.dispatchFn(mw(n)),this.dispatchFn(Xy($y.PlayerRolling)),await async function(e,t){return await hv(e,{gameState:$y.PlayerRolling,doublingCube:t},{merge:!0})}(this.docRef,n)}async automaticDouble(){return this.dispatchFn(mw({owner:null,gameStakes:2,enabled:!0})),await async function(e){return await hv(e,{doublingCube:{owner:null,gameStakes:2}},{merge:!0})}(this.docRef)}async forfeitButtonClicked(e,t){return this.dispatchFn(BE()),this.dispatchFn(GE()),this.dispatchFn(Xy($y.GameOverForfeit)),this.dispatchFn(oS(e)),this.dispatchFn(bw(t)),this.dispatchFn(hS(!0)),await async function(e,t,n){return await hv(e,{gameBoard:t,gameState:$y.GameOverForfeit,matchScore:n},{merge:!0})}(this.docRef,e,t)}async rollButtonClicked(){await Dw(this.docRef,$y.PlayerMoving)}async submitMoves(e,t,n){let r={animateFor:t,id:US(),moves:n};return this.dispatchFn(BE()),this.dispatchFn(GE()),this.dispatchFn(Xy($y.PlayerRolling)),this.dispatchFn(oS(e)),this.dispatchFn($E(t)),await async function(e,t,n,r){return await hv(e,{gameBoard:t,currentPlayer:n,dice:{currentRoll:Zy()},gameState:$y.PlayerRolling,networkedMoves:r},{merge:!0})}(this.docRef,e,t,r)}async gameOver(e,t,n,r,i){let o={animateFor:r,id:US(),moves:i};return this.dispatchFn(BE()),this.dispatchFn(GE()),this.dispatchFn(Xy(t)),this.dispatchFn(oS(e)),this.dispatchFn(bw(n)),this.dispatchFn(hS(!0)),await async function(e,t,n,r,i){return await hv(e,{gameBoard:t,gameState:n,networkedMoves:i,matchScore:r},{merge:!0})}(this.docRef,e,t,n,o)}async updateMatchSettings(e,t){return this.dispatchFn(Ew(e)),this.dispatchFn(mw({...fw,enabled:t})),this.dispatchFn(fS(!1)),this.dispatchFn(gS(!0)),await async function(e,t,n){return await hv(e,{matchScore:{pointsRequiredToWin:t},doublingCube:{owner:null,gameStakes:1,enabled:n}},{merge:!0})}(this.docRef,e,t)}async nextGameButtonClicked(e){return this.dispatchFn(hS(!1)),this.dispatchFn(gS(!0)),this.dispatchFn(uw(e)),await async function(e,t){return await hv(e,{readyForNextGame:t},{merge:!0})}(this.docRef,e)}async bothPlayersReadyForNextGame(){return await async function(e){const t=ew(),n=t[Object.keys(t).length-1];return await hv(e,{gameBoard:sw,gameState:$y.WaitingToBegin,currentPlayer:n[0]>n[1]?tw.One:tw.Two,dice:{initialRolls:t,currentRoll:n},networkedMoves:null,doublingCube:{owner:null,gameStakes:1},readyForNextGame:lw},{merge:!0})}(this.docRef)}}const ES=(0,e.createContext)(new yS),SS=[],_S=new Set,kS=Qy({name:"animatableMovesSlice",initialState:SS,reducers:{enqueueAnimatableMoves:(e,t)=>{let n=[];for(let r of t.payload)n.push({animationID:US(),move:r});return[...e,...n]},enqueueNetworkedMoves:(e,t)=>{if(_S.has(t.payload.id))return e;{_S.add(t.payload.id);let n=[];for(let e of t.payload.moves)n.push({animationID:US(),move:e});return[...e,...n]}},invalidateNetworkedMoves:(e,t)=>(_S.add(t.payload.id),e),dequeueAnimatableMove:e=>e.slice(1),reset:()=>SS}}),{enqueueAnimatableMoves:TS,enqueueNetworkedMoves:CS,invalidateNetworkedMoves:xS,dequeueAnimatableMove:IS,reset:NS}=kS.actions,OS=kS.reducer,PS={playerOne:null,playerTwo:null,isHost:!1},RS=Qy({name:"playersState",initialState:PS,reducers:{setPlayersState:(e,t)=>{let n=!1;return null!=t.payload.playerOne&&(n=Pw().uid===t.payload.playerOne.uid),{playerOne:t.payload.playerOne,playerTwo:t.payload.playerTwo,isHost:n}},reset:()=>PS}}),{setPlayersState:AS,reset:DS}=RS.actions,LS=RS.reducer;function MS(e,t,n){if(n instanceof wS)return!0;if(null==e.playerOne||null==e.playerTwo)throw new Error("Player data unexpectedly null.");let r=Pw().uid;return e.playerOne.uid===r&&t===tw.One||e.playerTwo.uid===r&&t===tw.Two}function jS(e){if(null==e.playerOne||null==e.playerTwo)throw new Error("Player data unexpectedly null.");let t=Pw().uid;if(e.playerOne.uid===t)return tw.One;if(e.playerTwo.uid===t)return tw.Two;throw new Error("Unable to find player uid in player data.")}let FS=1;function US(){return FS++%Number.MAX_SAFE_INTEGER}function VS(e,t){const n=ew(),r={initialRolls:n,currentRoll:n[Object.keys(n).length-1]};e(hS(!1)),e(dS(!1)),e(Xy($y.WaitingToBegin)),e(eS(r)),e(sS()),e($E(r.currentRoll[0]>r.currentRoll[1]?tw.One:tw.Two)),e(DS()),e(BE()),e(GE()),e(NS()),e(gw()),t&&e(Sw())}function BS(e){return e===$y.GameOver||e===$y.GameOverGammon||e===$y.GameOverBackgammon||e===$y.GameOverForfeit}var zS=n(579);const HS=()=>{const t=SE(),n=jE(),[r,i]=(0,e.useState)(!1);let o=(0,zS.jsx)("div",{className:"Online-multiplayer-button",onClick:async()=>{if(r)return;i(!0);const e=await Rw();n(fS(!0)),n(gS(!0)),t("/"+e.roomCode)}});return r&&(o=(0,zS.jsx)("div",{className:"Online-multiplayer-button-spinner"})),(0,zS.jsxs)("div",{className:"Main-menu-wrapper",children:[(0,zS.jsx)("div",{className:"Title-wrapper",children:(0,zS.jsx)("div",{className:"Title-text"})}),(0,zS.jsxs)("div",{className:"Menu-button-wrapper",children:[(0,zS.jsx)("div",{className:"Local-multiplayer-button",onClick:()=>{r||(VS(n,!0),n(fS(!0)),n(gS(!0)),t("/local"))}}),o]}),(0,zS.jsxs)("div",{className:"Credits-text",children:[(0,zS.jsx)("div",{children:"Backgammon v 1.0.1.a605efc"}),(0,zS.jsx)("div",{children:"by Sam Swarr (sam-swarr.github.io)"}),(0,zS.jsx)("div",{children:"font Barlow by Jeremy Tribby"})]})]})};function qS(){return qS=Object.assign?Object.assign.bind():function(e){for(var t=1;t{this.resolve=t=>{"pending"===this.status&&(this.status="resolved",e(t))},this.reject=e=>{"pending"===this.status&&(this.status="rejected",t(e))}}))}}function ZS(t){let{fallbackElement:n,router:r,future:i}=t,[o,s]=e.useState(r.state),[a,l]=e.useState(),[c,u]=e.useState({isTransitioning:!1}),[h,d]=e.useState(),[f,p]=e.useState(),[m,g]=e.useState(),v=e.useRef(new Map),{v7_startTransition:y}=i||{},w=e.useCallback((e=>{y?function(e){$S?$S(e):e()}(e):e()}),[y]),b=e.useCallback(((e,t)=>{let{deletedFetchers:n,unstable_flushSync:i,unstable_viewTransitionOpts:o}=t;n.forEach((e=>v.current.delete(e))),e.fetchers.forEach(((e,t)=>{void 0!==e.data&&v.current.set(t,e.data)}));let a=null==r.window||"function"!==typeof r.window.document.startViewTransition;if(o&&!a){if(i){XS((()=>{f&&(h&&h.resolve(),f.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:o.currentLocation,nextLocation:o.nextLocation})}));let t=r.window.document.startViewTransition((()=>{XS((()=>s(e)))}));return t.finished.finally((()=>{XS((()=>{d(void 0),p(void 0),l(void 0),u({isTransitioning:!1})}))})),void XS((()=>p(t)))}f?(h&&h.resolve(),f.skipTransition(),g({state:e,currentLocation:o.currentLocation,nextLocation:o.nextLocation})):(l(e),u({isTransitioning:!0,flushSync:!1,currentLocation:o.currentLocation,nextLocation:o.nextLocation}))}else i?XS((()=>s(e))):w((()=>s(e)))}),[r.window,f,h,v,w]);e.useLayoutEffect((()=>r.subscribe(b)),[r,b]),e.useEffect((()=>{c.isTransitioning&&!c.flushSync&&d(new JS)}),[c]),e.useEffect((()=>{if(h&&a&&r.window){let e=a,t=h.promise,n=r.window.document.startViewTransition((async()=>{w((()=>s(e))),await t}));n.finished.finally((()=>{d(void 0),p(void 0),l(void 0),u({isTransitioning:!1})})),p(n)}}),[w,a,h,r.window]),e.useEffect((()=>{h&&a&&o.location.key===a.location.key&&h.resolve()}),[h,f,o.location,a]),e.useEffect((()=>{!c.isTransitioning&&m&&(l(m.state),u({isTransitioning:!0,flushSync:!1,currentLocation:m.currentLocation,nextLocation:m.nextLocation}),g(void 0))}),[c.isTransitioning,m]),e.useEffect((()=>{}),[]);let E=e.useMemo((()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:e=>r.navigate(e),push:(e,t,n)=>r.navigate(e,{state:t,preventScrollReset:null==n?void 0:n.preventScrollReset}),replace:(e,t,n)=>r.navigate(e,{replace:!0,state:t,preventScrollReset:null==n?void 0:n.preventScrollReset})})),[r]),S=r.basename||"/",_=e.useMemo((()=>({router:r,navigator:E,static:!1,basename:S})),[r,E,S]);return e.createElement(e.Fragment,null,e.createElement(fE.Provider,{value:_},e.createElement(pE.Provider,{value:o},e.createElement(QS.Provider,{value:v.current},e.createElement(KS.Provider,{value:c},e.createElement(LE,{basename:S,location:o.location,navigationType:o.historyAction,navigator:E,future:{v7_relativeSplatPath:r.future.v7_relativeSplatPath}},o.initialized||r.future.v7_partialHydration?e.createElement(e_,{routes:r.routes,future:r.future,state:o}):n))))),null)}function e_(e){let{routes:t,future:n,state:r}=e;return _E(t,void 0,r,n)}"undefined"!==typeof window&&"undefined"!==typeof window.document&&window.document.createElement;var t_,n_;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(t_||(t_={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(n_||(n_={}));function r_(e,t){return"BAR"===t?e.barState:"HOME"===t?e.homeState:e.pointsState[t]}let i_=function(e){return e.No="NO",e.Yes="YES",e.Hit="HIT",e}({});function o_(e,t,n,r){if(0===r_(e,t)[r])return null;if(function(e,t){return r_(e,"BAR")[t]>0}(e,r)&&"BAR"!==t)return null;const i=function(e,t,n){const r=n===tw.One?-1:1,i=("BAR"===e?n===tw.One?24:-1:e)+t*r;return n===tw.One?i<0?"HOME":i:i>23?"HOME":i}(t,n,r);if("HOME"===i&&"BAR"!==t){if(!function(e,t){if(r_(e,"BAR")[t]>0)return!1;if(t===tw.One){for(let n=6;n<=23;n++)if(r_(e,n)[t]>0)return!1}else for(let n=0;n<=17;n++)if(r_(e,n)[t]>0)return!1;return!0}(e,r))return null;if(n>function(e,t){return"BAR"===e?25:t===tw.One?e+1:24-e}(t,r))if(r===tw.One){for(let n=t+1;n<=5;n++)if(r_(e,n)[tw.One]>0)return null}else for(let n=t-1;n>=18;n--)if(r_(e,n)[tw.Two]>0)return null}const o=function(e,t,n){if("HOME"===t)return i_.Yes;const r=r_(e,t),i=n===tw.One?tw.Two:tw.One;return r[i]>=2?i_.No:1===r[i]?i_.Hit:i_.Yes}(e,i,r);if(o===i_.Yes||o===i_.Hit){return{from:t,to:i,dieUsed:n,hitStatus:o===i_.Hit?iw.IsHit:iw.NoHit,checkerOwner:r}}return null}function s_(e){return{from:e.to,to:e.from,dieUsed:e.dieUsed,hitStatus:e.hitStatus===iw.IsHit?iw.UndoesHit:iw.NoHit,checkerOwner:e.checkerOwner}}function a_(e,t,n,r,i,o){if(r>=n.length)return o;const s="HOME"===t?null:o_(e,t,n[r],i);if(null==s)return o;{const t=rS(e,s);let a=o.length>0?[[...o[o.length-1],s]]:[[s]];return a_(t,s.to,n,r+1,i,[...o,...a])}}function l_(e,t,n,r,i){const o=c_(e,t[n],r);if(0===o.length)return[[...i]];if(n===t.length-1)return o.map((e=>[...i,e]));let s=[];return o.forEach((o=>{const a=rS(e,o);s=s.concat(l_(a,t,n+1,r,[...i,o]))})),s}function c_(e,t,n){const r=[];return aw.forEach((i=>{const o=o_(e,i,t,n);null!==o&&r.push(o)})),r}function u_(e,t,n,r){const i=function(e,t,n){let r=[];if(r=r.concat(l_(e,t,0,n,[])),2===t.length){const i=[...t].reverse();r=r.concat(l_(e,i,0,n,[]))}return r}(e,t,n),o=i.reduce(((e,t)=>t.length>e?t.length:e),0);if(r.lengthe.length===o)).reduce(((e,t)=>{const n=h_(t);return n>e?n:e}),0);return h_(r)===s}function h_(e){return e.reduce(((e,t)=>t.dieUsed>e?t.dieUsed:e),0)}function d_(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}function f_(e,t){return f_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f_(e,t)}function p_(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,f_(e,t)}function m_(e,t){e.classList?e.classList.add(t):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(e,t)||("string"===typeof e.className?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function g_(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function v_(e,t){e.classList?e.classList.remove(t):"string"===typeof e.className?e.className=g_(e.className,t):e.setAttribute("class",g_(e.className&&e.className.baseVal||"",t))}const y_=!1,w_=e.createContext(null);var b_="unmounted",E_="exited",S_="entering",__="entered",k_="exiting",T_=function(t){function n(e,n){var r;r=t.call(this,e,n)||this;var i,o=n&&!n.isMounting?e.enter:e.appear;return r.appearStatus=null,e.in?o?(i=E_,r.appearStatus=S_):i=__:i=e.unmountOnExit||e.mountOnEnter?b_:E_,r.state={status:i},r.nextCallback=null,r}p_(n,t),n.getDerivedStateFromProps=function(e,t){return e.in&&t.status===b_?{status:E_}:null};var i=n.prototype;return i.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},i.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==S_&&n!==__&&(t=S_):n!==S_&&n!==__||(t=k_)}this.updateStatus(!1,t)},i.componentWillUnmount=function(){this.cancelNextCallback()},i.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!==typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},i.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===S_?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&this.state.status===E_&&this.setState({status:b_})},i.performEnter=function(e){var t=this,n=this.props.enter,i=this.context?this.context.isMounting:e,o=this.props.nodeRef?[i]:[r.findDOMNode(this),i],s=o[0],a=o[1],l=this.getTimeouts(),c=i?l.appear:l.enter;!e&&!n||y_?this.safeSetState({status:__},(function(){t.props.onEntered(s)})):(this.props.onEnter(s,a),this.safeSetState({status:S_},(function(){t.props.onEntering(s,a),t.onTransitionEnd(c,(function(){t.safeSetState({status:__},(function(){t.props.onEntered(s,a)}))}))})))},i.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),i=this.props.nodeRef?void 0:r.findDOMNode(this);t&&!y_?(this.props.onExit(i),this.safeSetState({status:k_},(function(){e.props.onExiting(i),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:E_},(function(){e.props.onExited(i)}))}))}))):this.safeSetState({status:E_},(function(){e.props.onExited(i)}))},i.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},i.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},i.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},i.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:r.findDOMNode(this),i=null==e&&!this.props.addEndListener;if(n&&!i){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],s=o[0],a=o[1];this.props.addEndListener(s,a)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},i.render=function(){var t=this.state.status;if(t===b_)return null;var n=this.props,r=n.children,i=(n.in,n.mountOnEnter,n.unmountOnExit,n.appear,n.enter,n.exit,n.timeout,n.addEndListener,n.onEnter,n.onEntering,n.onEntered,n.onExit,n.onExiting,n.onExited,n.nodeRef,d_(n,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return e.createElement(w_.Provider,{value:null},"function"===typeof r?r(t,i):e.cloneElement(e.Children.only(r),i))},n}(e.Component);function C_(){}T_.contextType=w_,T_.propTypes={},T_.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:C_,onEntering:C_,onEntered:C_,onExit:C_,onExiting:C_,onExited:C_},T_.UNMOUNTED=b_,T_.EXITED=E_,T_.ENTERING=S_,T_.ENTERED=__,T_.EXITING=k_;const x_=T_;var I_=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return v_(e,t)}))},N_=function(t){function n(){for(var e,n=arguments.length,r=new Array(n),i=0;i=12?e-11:12-e,t*P_+(t>6?R_:0)}}function B_(e){if("BAR"===e)return L_+F_;if("HOME"===e)return 0;{let t;return t=e>=12?24-e:e+1,t*P_+(t>6?R_:0)}}function z_(e,t,n,r){return"BAR"===e?n===tw.One?A_-t*M_:A_+D_+(t-1)*M_:"HOME"===e?n===tw.One?r===tw.One?j_-M_:0:r===tw.One?0:j_-M_:r===tw.One&&e>=12||r===tw.Two&&e<12?M_*(t-1):j_-M_*t}let H_=function(e){return e.Highlighted="HIGHLIGHTED",e.Selected="SELECTED",e.None="NONE",e}({});const q_=t=>{let{animation:n,checkerPulse:r,color:i,status:o,onAnimationComplete:s}=t;const a=i===nw.White?"white":"black",l=e.useRef(null);let c={transform:"none"};var u;null!=n&&(c={transform:(u=n.translation,"translate("+u.translateX+"vw, "+u.translateY+"vw)")});const h={entering:c,entered:{transform:"none"},exiting:{},exited:{},unmounted:{}};return(0,zS.jsx)(O_,{in:!0,appear:!0,nodeRef:l,timeout:0,children:e=>(0,zS.jsx)("div",{className:_()("Checker",a,{highlighted:o===H_.Highlighted&&!r,"highlighted-pulse":o===H_.Highlighted&&r,"selected-pulse":o===H_.Selected}),ref:l,style:h[e],onTransitionEnd:()=>{null!=n&&s(n.id)}})})},W_=e=>{let{barState:t,clickHandler:n,currentPlayer:r,playerOneColor:i,playerTwoColor:o,currAnimations:s,onAnimationComplete:a,allPossibleMoves:l,lastPointClicked:c,checkerPulse:u}=e;const h="BAR"===c.point,d=-1===c.point&&l.some((e=>"BAR"===e.from)),f=[];for(let m=0;m"BAR"===e.location&&e.checkerOwner===tw.One&&e.checkerNumber===m+1)),n=H_.None;m===t[tw.One]-1&&r===tw.One&&(h?n=H_.Selected:d&&(n=H_.Highlighted)),f.push((0,zS.jsx)(q_,{color:i,checkerPulse:u,status:n,onAnimationComplete:a,animation:e},m))}const p=[];for(let m=0;m"BAR"===e.location&&e.checkerOwner===tw.Two&&e.checkerNumber===m+1)),n=H_.None;m===t[tw.Two]-1&&r===tw.Two&&(h?n=H_.Selected:d&&(n=H_.Highlighted)),p.push((0,zS.jsx)(q_,{color:o,checkerPulse:u,status:n,onAnimationComplete:a,animation:e},m))}return(0,zS.jsxs)("div",{className:"Game-board-bar",onClick:()=>{n("BAR")},children:[(0,zS.jsx)("div",{className:"Player-one-bar-checkers",children:f}),(0,zS.jsx)("div",{className:"Game-board-bar-spacer"}),(0,zS.jsx)("div",{className:"Player-two-bar-checkers",children:p})]})};let G_=function(e){return e.Top="TOP",e.Bottom="BOTTOM",e}({});const K_=t=>{let{pointState:n,location:r,playerOneColor:i,playerTwoColor:o,pointNumber:s,clickHandler:a,allPossibleInitialMoves:l,allPossibleMoveSetsFromSelectedPoint:c,lastPointClicked:u,currAnimations:h,onAnimationComplete:d,checkerPulse:f}=t;n[tw.One]>0&&n[tw.Two]>0&&(console.error("Invalid PointState on point "+s),console.error(n));const[p,m]=(0,e.useState)(!1),g={top:r===G_.Top,bottom:r===G_.Bottom};let v=null;const y=-1!==u.point&&c.some((e=>e[e.length-1].to===s&&e[0].from===u.point));(y||p)&&(v=(0,zS.jsx)("div",{className:_()("Point-wrapper-highlight",{...g,to:y,noMove:p})}));const w=u.point===s,b=-1===u.point&&l.some((e=>e.from===s)),E=n[tw.One]>n[tw.Two]?tw.One:tw.Two,S=n[tw.One]>n[tw.Two]?n[tw.One]:n[tw.Two],k=[];for(let e=0;et.location===s&&t.checkerNumber===e+1)),r=H_.None;e===S-1&&(w?r=H_.Selected:b&&(r=H_.Highlighted)),k.push((0,zS.jsx)(q_,{color:t,checkerPulse:f,status:r,animation:n,onAnimationComplete:d},e+t))}return(0,zS.jsxs)("div",{className:_()("Point-wrapper",g),onClick:()=>{a(s)||(m(!0),setTimeout((()=>{m(!1)}),1e3))},children:[(0,zS.jsx)("div",{className:_()("Checkers-wrapper",g),children:k}),v,(0,zS.jsx)("div",{className:_()("Point-triangle-inner",{...g,even:s%2===0,odd:s%2!==0})}),(0,zS.jsx)("div",{className:_()("Point-triangle",{...g,even:s%2===0,odd:s%2!==0})})]})},Q_=e=>{let{dieValue:t,dieSpent:n,color:r,forceReroll:i}=e;return(0,zS.jsxs)("div",{className:_()("Die-faces",{white:r===nw.White,black:r===nw.Black,reroll:i,one:1===t,two:2===t,three:3===t,four:4===t,five:5===t,six:6===t,spent:n}),children:[(0,zS.jsx)("div",{className:_()("Die-face","one"),children:(0,zS.jsx)("div",{className:_()("Die-pip","five")})}),(0,zS.jsxs)("div",{className:_()("Die-face","two"),children:[(0,zS.jsx)("div",{className:_()("Die-pip","three")}),(0,zS.jsx)("div",{className:_()("Die-pip","seven")})]}),(0,zS.jsxs)("div",{className:_()("Die-face","three"),children:[(0,zS.jsx)("div",{className:_()("Die-pip","three")}),(0,zS.jsx)("div",{className:_()("Die-pip","five")}),(0,zS.jsx)("div",{className:_()("Die-pip","seven")})]}),(0,zS.jsxs)("div",{className:_()("Die-face","four"),children:[(0,zS.jsx)("div",{className:_()("Die-pip","one")}),(0,zS.jsx)("div",{className:_()("Die-pip","three")}),(0,zS.jsx)("div",{className:_()("Die-pip","seven")}),(0,zS.jsx)("div",{className:_()("Die-pip","nine")})]}),(0,zS.jsxs)("div",{className:_()("Die-face","five"),children:[(0,zS.jsx)("div",{className:_()("Die-pip","one")}),(0,zS.jsx)("div",{className:_()("Die-pip","three")}),(0,zS.jsx)("div",{className:_()("Die-pip","five")}),(0,zS.jsx)("div",{className:_()("Die-pip","seven")}),(0,zS.jsx)("div",{className:_()("Die-pip","nine")})]}),(0,zS.jsxs)("div",{className:_()("Die-face","six"),children:[(0,zS.jsx)("div",{className:_()("Die-pip","one")}),(0,zS.jsx)("div",{className:_()("Die-pip","three")}),(0,zS.jsx)("div",{className:_()("Die-pip","four")}),(0,zS.jsx)("div",{className:_()("Die-pip","six")}),(0,zS.jsx)("div",{className:_()("Die-pip","seven")}),(0,zS.jsx)("div",{className:_()("Die-pip","nine")})]})]})},$_=e=>{let{canSubmit:t,submitButtonHandler:n}=e;return(0,zS.jsx)("div",{className:"Submit-button-wrapper",children:(0,zS.jsx)("div",{className:"Submit-button",hidden:!t,onClick:()=>{n()}})})},Y_=()=>{const[e]=FE((e=>[e.provisionalMoves,e.currentPlayer,e.settings])),t=jE();return(0,zS.jsx)("div",{className:"Undo-button-wrapper",children:(0,zS.jsx)("div",{className:"Undo-button",hidden:e.length<=0,onClick:()=>{let n=[];for(let t=e.length-1;t>=0;t--)n.push(s_(e[t]));t(TS(n)),t(BE()),t(GE())}})})},X_=t=>{let{currentPlayerColor:n,diceValues:r,availableDice:i,canSubmit:o,submitButtonHandler:s}=t,a=!1,l=!1;const c=FE((e=>e.gameBoard)),[u,h]=(0,e.useState)(function(e,t){if(e.barState[tw.One]!==t.barState[tw.One]||e.barState[tw.Two]!==t.barState[tw.Two])return!1;if(e.homeState[tw.One]!==t.homeState[tw.One]||e.homeState[tw.Two]!==t.homeState[tw.Two])return!1;for(let n=0;n<=23;n++)if(e.pointsState[n][tw.One]!==t.pointsState[n][tw.One]||e.pointsState[n][tw.Two]!==t.pointsState[n][tw.Two])return!1;return!0}(c,sw));4===r.length?0===i.length?(a=!0,l=!0):i.length>=1&&i.length<=2&&(a=!0):(i.includes(r[0])||(a=!0),i.includes(r[1])||(l=!0));const d=(0,e.useRef)(null);return(0,zS.jsx)(O_,{nodeRef:d,in:!0,appear:!0,timeout:0,onEntered:()=>{setTimeout((()=>{h(!0)}),0)},children:(0,zS.jsxs)("div",{className:"Dice",children:[(0,zS.jsx)(Y_,{}),(0,zS.jsx)(Q_,{dieValue:r[0],dieSpent:a,color:n,forceReroll:!u}),(0,zS.jsx)(Q_,{dieValue:r[1],dieSpent:l,color:n,forceReroll:!u}),(0,zS.jsx)($_,{canSubmit:o,submitButtonHandler:s})]})})},J_=()=>{const[e]=FE((e=>[e.doublingCube]));return e.enabled?(0,zS.jsx)("div",{className:"Doubling-cube",children:(0,zS.jsx)("div",{className:"Doubling-cube-value-wrapper",children:e.gameStakes})}):null},Z_=e=>{let{homeState:t,isHighlighted:n,clickHandler:r,currentPlayer:i,playerOneColor:o,playerTwoColor:s,currAnimations:a,onAnimationComplete:l,checkerPulse:c,playerMovementDirection:u,playerPerspective:h}=e;const[d]=FE((e=>[e.doublingCube])),f=[];for(let y=0;y"HOME"===e.location&&e.checkerOwner===tw.One&&e.checkerNumber===y+1));f.push((0,zS.jsx)(q_,{color:o,checkerPulse:c,status:H_.None,onAnimationComplete:l,animation:e},y))}const p=[];for(let y=0;y"HOME"===e.location&&e.checkerOwner===tw.Two&&e.checkerNumber===y+1));p.push((0,zS.jsx)(q_,{color:s,checkerPulse:c,status:H_.None,onAnimationComplete:l,animation:e},y))}let m=null;null===d.owner&&(m=(0,zS.jsx)(J_,{}));const g=(0,zS.jsx)("div",{className:_()("Player-one-home-checkers",{highlighted:n&&i===tw.One,p2:h===tw.Two}),children:f}),v=(0,zS.jsx)("div",{className:_()("Player-two-home-checkers",{highlighted:n&&i===tw.Two,p2:h===tw.Two}),children:p});return(0,zS.jsxs)("div",{className:_()("Game-board-home",{cw:h===tw.One&&u===rw.Clockwise||h===tw.Two&&u===rw.CounterClockwise}),onClick:()=>{r("HOME")},children:[h===tw.One?v:g,(0,zS.jsx)("div",{className:"Game-board-home-spacer",children:m}),h===tw.One?g:v]})},ek=()=>{const[t,n]=FE((e=>[e.gameState,e.settings])),r=(0,e.useContext)(ES);return t===$y.WaitingForPlayers?(0,zS.jsxs)("div",{className:"Begin-game-button-wrapper waiting-text",children:[(0,zS.jsx)("div",{className:"Waiting-text-wrapper",children:"Waiting for opponent to join"}),(0,zS.jsx)("div",{className:"Waiting-spinner"})]}):t===$y.WaitingToBegin?r.isHostClient()?(0,zS.jsx)("div",{className:"Begin-game-button-wrapper",children:(0,zS.jsx)("button",{className:"Begin-game-button",onClick:()=>{r.beginCoinFlip()},children:"Begin Game"})}):(0,zS.jsxs)("div",{className:"Begin-game-button-wrapper waiting-text",children:[(0,zS.jsx)("div",{className:"Waiting-text-wrapper",children:"Waiting for host to begin game"}),(0,zS.jsx)("div",{className:"Waiting-spinner"})]}):BS(t)&&!n.showGameOverDialog?(0,zS.jsxs)("div",{className:"Begin-game-button-wrapper waiting-text",children:[(0,zS.jsx)("div",{className:"Waiting-text-wrapper",children:"Waiting for opponent"}),(0,zS.jsx)("div",{className:"Waiting-spinner"})]}):null},tk=()=>{const t=(0,e.useContext)(ES),[n,r]=FE((e=>[e.dice,e.settings])),[i,o]=(0,e.useState)(0),[s,a]=(0,e.useState)(!1);let l=n.initialRolls[i];const c=(0,e.useRef)(null),u=n.initialRolls[Object.keys(n.initialRolls).length-1],h=u[0]>u[1]?tw.One:tw.Two;return(0,zS.jsx)(O_,{nodeRef:c,in:!0,appear:!0,timeout:0,classNames:"Dice-roll",onEntered:()=>{setTimeout((()=>{a(!0),setTimeout((()=>{4===l.length?(t.automaticDouble(),o(i+1),a(!1),t.isHostClient()&&setTimeout((()=>{t.beginFirstTurn(h)}),1500)):t.isHostClient()&&t.beginFirstTurn(h)}),1500)}),0)},children:(0,zS.jsxs)("div",{className:"Dice",ref:c,children:[(0,zS.jsx)("div",{className:"Dice-row-spacer"}),(0,zS.jsx)(Q_,{dieValue:l[0],dieSpent:!1,color:r.playerOneColor,forceReroll:s}),(0,zS.jsx)(Q_,{dieValue:l[1],dieSpent:!1,color:r.playerOneColor===nw.White?nw.Black:nw.White,forceReroll:s}),(0,zS.jsx)("div",{className:"Dice-row-spacer"})]})})},nk=t=>{let{onRollButtonClicked:n}=t;const[r,i,o]=FE((e=>[e.gameState,e.players,e.currentPlayer])),s=(0,e.useContext)(ES);return r===$y.PlayerRolling&&MS(i,o,s)?(0,zS.jsx)("div",{className:"Roll-button-wrapper",children:(0,zS.jsx)("button",{className:"Roll-button",onClick:async()=>{n(),await s.rollButtonClicked()},children:"Roll Dice"})}):null},rk=()=>{const[t,n,r,i,o,s]=FE((e=>[e.gameState,e.players,e.currentPlayer,e.doublingCube,e.gameBoard,e.matchScore])),a=(0,e.useContext)(ES);if(!i.enabled)return null;if(t!==$y.PlayerRolling&&t!==$y.PlayerOfferingDouble)return null;let l=!1;l=a instanceof wS?null===i.owner||i.owner===r:MS(n,r,a)&&(null===i.owner||i.owner===jS(n));let c=!1,u=!1;if(a instanceof wS?c=!0:(c=!MS(n,r,a),u=!c),t===$y.PlayerRolling&&l)return(0,zS.jsx)("div",{className:"Offer-double-button-wrapper",children:(0,zS.jsx)("button",{className:"Offer-double-button",onClick:async()=>{await a.offerDoubleButtonClicked()},children:"Double x2"})});if(t===$y.PlayerOfferingDouble&&c){let e=null;return e=a instanceof wS?"Player "+(r===tw.One?"1":"2")+" offers a double!":"Opponent offers a double!",(0,zS.jsxs)("div",{className:"Accept-double-menu-wrapper",children:[(0,zS.jsx)("div",{className:"Accept-double-menu-text-wrapper",children:e}),(0,zS.jsxs)("div",{className:"Accept-double-menu-buttons-wrapper",children:[(0,zS.jsx)("button",{className:"Forfeit-game-button",onClick:async()=>{const e=i.enabled?i.gameStakes:1,t={[tw.One]:s[tw.One]+(r===tw.One?e:0),[tw.Two]:s[tw.Two]+(r===tw.Two?e:0),pointsRequiredToWin:s.pointsRequiredToWin};await a.forfeitButtonClicked(o,t)},children:"Forfeit"}),(0,zS.jsx)("button",{className:"Accept-double-button",onClick:async()=>{const e=r===tw.One?tw.Two:tw.One;await a.acceptDoubleButtonClicked(e,2*i.gameStakes)},children:"Accept"})]})]})}return t===$y.PlayerOfferingDouble&&u?(0,zS.jsxs)("div",{className:"Waiting-for-accept-double-wrapper",children:[(0,zS.jsx)("div",{className:"Waiting-for-accept-double-text-wrapper",children:"Waiting for opponent to accept or forfeit"}),(0,zS.jsx)("div",{className:"Waiting-spinner"})]}):null};var ik=function(e){return e.TopLeft="TOP_LEFT",e.TopRight="TOP_RIGHT",e.BottomLeft="BOTTOM_LEFT",e.BottomRight="BOTTOM_RIGHT",e}(ik||{});const ok={[tw.One]:{[rw.CounterClockwise]:{[ik.TopLeft]:{start:12,end:17,increment:1},[ik.TopRight]:{start:18,end:23,increment:1},[ik.BottomLeft]:{start:11,end:6,increment:-1},[ik.BottomRight]:{start:5,end:0,increment:-1}},[rw.Clockwise]:{[ik.TopLeft]:{start:23,end:18,increment:-1},[ik.TopRight]:{start:17,end:12,increment:-1},[ik.BottomLeft]:{start:0,end:5,increment:1},[ik.BottomRight]:{start:6,end:11,increment:1}}},[tw.Two]:{[rw.CounterClockwise]:{[ik.TopLeft]:{start:0,end:5,increment:1},[ik.TopRight]:{start:6,end:11,increment:1},[ik.BottomLeft]:{start:23,end:18,increment:-1},[ik.BottomRight]:{start:17,end:12,increment:-1}},[rw.Clockwise]:{[ik.TopLeft]:{start:11,end:6,increment:-1},[ik.TopRight]:{start:5,end:0,increment:-1},[ik.BottomLeft]:{start:12,end:17,increment:1},[ik.BottomRight]:{start:18,end:23,increment:1}}}},sk=t=>{let{playerPerspective:n}=t;const[r,i,o,s,a,l,c,u,h,d,f,p]=FE((e=>[e.currentPlayer,e.settings,e.dice,e.gameBoard,e.gameState,e.lastPointClicked,e.provisionalMoves,e.players,e.animatableMoves,e.matchScore,e.doublingCube,e.readyForNextGame])),m=(0,e.useContext)(ES),g=i.playerOneColor,v=i.playerOneColor===nw.White?nw.Black:nw.White,y=i.movementDirection,w=jE(),[b,E]=(0,e.useState)(!1),[S,k]=(0,e.useState)(!1),[T,C]=(0,e.useState)(new Array),x=h.length>0?h[0]:null,I=null!=x?rS(s,x.move):s,N=e=>{if(!T.some((t=>t.id===e)))return;null==x&&console.error("Current animatable move is unexpectedly null."),w(oS(I)),w(IS()),C([]);const t=function(e,t){if(e.barState[t]>0||e.pointsState.some((e=>e[t]>0)))return ow.NotOver;const n=t===tw.One?tw.Two:tw.One;if(e.homeState[n]>0)return ow.PlayerWon;let r=!1;if(n===tw.One){for(let i=18;i<23;i++)if(e.pointsState[i][n]>0){r=!0;break}}else for(let i=0;i<5;i++)if(e.pointsState[i][n]>0){r=!0;break}return e.barState[n]>0||r?ow.PlayerWonBackgammon:ow.PlayerWonGammon}(I,r);if(t!==ow.NotOver)if(MS(u,r,m)){let e=$y.GameOver,n=1;t===ow.PlayerWonGammon?(e=$y.GameOverGammon,n=2):t===ow.PlayerWonBackgammon&&(e=$y.GameOverBackgammon,n=3);const i=(f.enabled?f.gameStakes:1)*n,o={[tw.One]:d[tw.One]+(r===tw.One?i:0),[tw.Two]:d[tw.Two]+(r===tw.Two?i:0),pointsRequiredToWin:d.pointsRequiredToWin};m.gameOver(I,e,o,r===tw.One?tw.Two:tw.One,c)}else w(hS(!0))};null!=x&&0===T.length&&C(function(e,t,n,r){let i=t.move,o=[];if(i.hitStatus===iw.UndoesHit){const s=i.checkerOwner===tw.One?tw.Two:tw.One;o.push(U_(e,"BAR",i.from,t.animationID,s,n,r))}if(o.push(U_(e,i.from,i.to,t.animationID,i.checkerOwner,n,r)),i.hitStatus===iw.IsHit){const s=i.checkerOwner===tw.One?tw.Two:tw.One;o.push(U_(e,i.to,"BAR",t.animationID,s,n,r))}return o}(s,x,y,n));const O=function(e,t){return 4===e.length?e.slice(t.length):e.filter((e=>!t.some((t=>t.dieUsed===e))))}(o.currentRoll,c);(0,e.useEffect)((()=>{const e=e=>{e.preventDefault(),e.returnValue=!0};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[]);const[P,R]=(0,e.useState)(!1);(0,e.useEffect)((()=>{const e=setInterval((()=>{R(!P)}),700);return()=>clearInterval(e)}),[P]),(0,e.useEffect)((()=>{m.isHostClient()&&BS(a)&&p[tw.One]&&p[tw.Two]&&m.bothPlayersReadyForNextGame()}),[m,a,p]);const A=a===$y.PlayerMoving&&MS(u,r,m);let D=[],L=[];A&&null===x&&!S&&(-1===l.point?D=function(e,t,n){let r=[],i=new Set;for(let o=0;o{if(!A)return!0;const t=L.filter((t=>t[0].from===l.point&&t[t.length-1].to===e));if(t.length>0){let e=t[0];for(let n=1;ne>t.dieUsed?e:t.dieUsed),0);t[n].reduce(((e,t)=>e>t.dieUsed?e:t.dieUsed),0)>r&&(e=t[n])}return e.forEach((e=>w(VE(e)))),w(TS(e)),w(GE()),!0}if("HOME"!==e){let t=D.some((t=>t.from===e));if(t)w(WE({point:e}));else if(w(GE()),e===l.point)return!0;return t}return!1},j=async()=>{E(!0),setTimeout((()=>{E(!1)}),1300),await m.submitMoves(I,r===tw.One?tw.Two:tw.One,c)},F=[],U=[],V=[],B=[],z=I.pointsState;let H=ok[n][y],q=H[ik.TopLeft];for(let e=q.start;e!==q.end+q.increment;e+=q.increment)F.push((0,zS.jsx)(K_,{pointState:z[e],clickHandler:M,allPossibleInitialMoves:D,allPossibleMoveSetsFromSelectedPoint:L,lastPointClicked:l,location:G_.Top,playerOneColor:g,playerTwoColor:v,pointNumber:e,currAnimations:T,onAnimationComplete:N,checkerPulse:P},e));let W=H[ik.TopRight];for(let e=W.start;e!==W.end+W.increment;e+=W.increment)V.push((0,zS.jsx)(K_,{pointState:z[e],clickHandler:M,allPossibleInitialMoves:D,allPossibleMoveSetsFromSelectedPoint:L,lastPointClicked:l,location:G_.Top,playerOneColor:g,playerTwoColor:v,pointNumber:e,currAnimations:T,onAnimationComplete:N,checkerPulse:P},e));let G=H[ik.BottomLeft];for(let e=G.start;e!==G.end+G.increment;e+=G.increment)U.push((0,zS.jsx)(K_,{pointState:z[e],clickHandler:M,allPossibleInitialMoves:D,allPossibleMoveSetsFromSelectedPoint:L,lastPointClicked:l,location:G_.Bottom,playerOneColor:g,playerTwoColor:v,pointNumber:e,currAnimations:T,onAnimationComplete:N,checkerPulse:P},e));let K=H[ik.BottomRight];for(let e=K.start;e!==K.end+K.increment;e+=K.increment)B.push((0,zS.jsx)(K_,{pointState:z[e],clickHandler:M,allPossibleInitialMoves:D,allPossibleMoveSetsFromSelectedPoint:L,lastPointClicked:l,location:G_.Bottom,playerOneColor:g,playerTwoColor:v,pointNumber:e,currAnimations:T,onAnimationComplete:N,checkerPulse:P},e));const Q=(0,zS.jsx)(Z_,{homeState:I.homeState,isHighlighted:L.some((e=>"HOME"===e[e.length-1].to)),clickHandler:M,currentPlayer:r,playerOneColor:g,playerTwoColor:v,currAnimations:T,onAnimationComplete:N,checkerPulse:P,playerMovementDirection:y,playerPerspective:n});let $=null;if(a===$y.CoinFlip)$=(0,zS.jsx)(tk,{});else if(a===$y.PlayerMoving){let e=!1;if(null===x){let t=I;for(let e=c.length-1;e>=0;e--)t=rS(t,s_(c[e]));e=!b&&u_(t,o.currentRoll,r,c)}$=(0,zS.jsx)(X_,{currentPlayerColor:r===tw.One?g:v,availableDice:O,diceValues:o.currentRoll,canSubmit:e,submitButtonHandler:j})}else $=null;return(0,zS.jsxs)("div",{className:"Game-board-wrapper",children:[n===tw.One&&y===rw.Clockwise||n===tw.Two&&y===rw.CounterClockwise?Q:null,(0,zS.jsxs)("div",{className:_()("Game-board-half left",{cw:n===tw.One&&y===rw.Clockwise||n===tw.Two&&y===rw.CounterClockwise}),children:[(0,zS.jsx)(rk,{}),(0,zS.jsx)("div",{className:"Game-board-quadrant top",children:F}),(0,zS.jsx)("div",{className:"Game-board-quadrant bottom",children:U})]}),(0,zS.jsx)(W_,{barState:I.barState,checkerPulse:P,clickHandler:M,currentPlayer:r,playerOneColor:g,playerTwoColor:v,currAnimations:T,onAnimationComplete:N,allPossibleMoves:D,lastPointClicked:l}),(0,zS.jsxs)("div",{className:_()("Game-board-half right",{cw:n===tw.One&&y===rw.Clockwise||n===tw.Two&&y===rw.CounterClockwise}),children:[(0,zS.jsx)(ek,{}),(0,zS.jsx)(nk,{onRollButtonClicked:()=>{k(!0),setTimeout((()=>{k(!1)}),1300)}}),$,(0,zS.jsx)("div",{className:"Game-board-quadrant top",children:V}),(0,zS.jsx)("div",{className:"Game-board-quadrant bottom",children:B})]}),n===tw.One&&y===rw.CounterClockwise||n===tw.Two&&y===rw.Clockwise?Q:null]})};let ak=function(e){return e.Top="TOP",e.Bottom="BOTTOM",e}({});const lk=t=>{let{side:n,playerPerspective:r}=t;const[i,o,s,a,l,c]=FE((e=>[e.gameBoard,e.settings,e.currentPlayer,e.doublingCube,e.gameState,e.matchScore]));let u=(0,e.useContext)(ES),h=o.playerOneColor,d=h===nw.White?nw.Black:nw.White,f=null,p="",m=167,g=nw.Black,v=0;return n===ak.Bottom?(p=u instanceof wS?r===tw.One?"Player 1":"Player 2":"You",m=iS(i,r),g=r===tw.One?h:d,a.owner===r&&(f=(0,zS.jsx)(J_,{})),v=c[r]):(p=u instanceof wS?r===tw.One?"Player 2":"Player 1":"Opponent",m=iS(i,r===tw.One?tw.Two:tw.One),g=r===tw.Two?h:d,null!==a.owner&&a.owner!==r&&(f=(0,zS.jsx)(J_,{})),v=r===tw.One?c[tw.Two]:c[tw.One]),(0,zS.jsxs)("div",{className:_()("Player-card-wrapper",{bottom:n===ak.Bottom,cw:o.movementDirection===rw.Clockwise&&r===tw.One||o.movementDirection===rw.CounterClockwise&&r===tw.Two,current:(l===$y.PlayerMoving||l===$y.PlayerOfferingDouble||l===$y.PlayerRolling)&&(n===ak.Bottom&&s===r||n===ak.Top&&s!==r)}),children:[(0,zS.jsx)("div",{className:"Player-card-checker-wrapper",children:(0,zS.jsx)(q_,{color:g,checkerPulse:!1,status:H_.None,onAnimationComplete:()=>{},animation:null})}),(0,zS.jsxs)("div",{className:"Player-name-and-score-wrapper",children:[(0,zS.jsx)("div",{className:"Player-name-wrapper",children:p}),(0,zS.jsxs)("div",{className:"Player-score-wrapper",children:[(0,zS.jsx)("div",{className:"Player-pip-count-wrapper",children:"Pips: "+m}),(0,zS.jsxs)("div",{className:"Player-points-wrapper",children:["Points: "+v+" of ",(0,zS.jsx)("span",{className:"Player-card-total-match-points",children:c.pointsRequiredToWin})]})]})]}),(0,zS.jsx)("div",{className:"Player-card-doubling-cube-wrapper",children:f})]})},ck=["as","disabled"];function uk(e){let{tagName:t,disabled:n,href:r,target:i,rel:o,onClick:s,tabIndex:a=0,type:l}=e;t||(t=null!=r||null!=i||null!=o?"a":"button");const c={tagName:t};if("button"===t)return[{type:l||"button",disabled:n},c];const u=e=>{(n||"a"===t&&function(e){return!e||"#"===e.trim()}(r))&&e.preventDefault(),n?e.stopPropagation():null==s||s(e)};return[{role:"button",disabled:void 0,tabIndex:n?void 0:a,href:"a"===t&&n?void 0:r,target:"a"===t?i:void 0,"aria-disabled":n||void 0,rel:"a"===t?o:void 0,onClick:u,onKeyDown:e=>{" "===e.key&&(e.preventDefault(),u(e))}},c]}const hk=e.forwardRef(((e,t)=>{let{as:n,disabled:r}=e,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,ck);const[o,{tagName:s}]=uk(Object.assign({tagName:n,disabled:r},i));return(0,zS.jsx)(s,Object.assign({},i,o,{ref:t}))}));hk.displayName="Button";const dk=e.createContext({prefixes:{}}),{Consumer:fk,Provider:pk}=dk;function mk(t,n){const{prefixes:r}=(0,e.useContext)(dk);return t||r[n]||n}const gk=e.forwardRef(((e,t)=>{let{as:n,bsPrefix:r,variant:i,size:o,active:s,className:a,...l}=e;const c=mk(r,"btn"),[u,{tagName:h}]=uk({tagName:n,...l}),d=h;return(0,zS.jsx)(d,{...l,...u,ref:t,className:_()(a,c,s&&"active",i&&"".concat(c,"-").concat(i),o&&"".concat(c,"-").concat(o),l.href&&l.disabled&&"disabled")})}));gk.displayName="Button",gk.defaultProps={variant:"primary",active:!1,disabled:!1};const vk=gk,yk=!("undefined"===typeof window||!window.document||!window.document.createElement);var wk=!1,bk=!1;try{var Ek={get passive(){return wk=!0},get once(){return bk=wk=!0}};yk&&(window.addEventListener("test",Ek,Ek),window.removeEventListener("test",Ek,!0))}catch(RC){}const Sk=function(e,t,n,r){if(r&&"boolean"!==typeof r&&!bk){var i=r.once,o=r.capture,s=n;!bk&&i&&(s=n.__once||function e(r){this.removeEventListener(t,e,o),n.call(this,r)},n.__once=s),e.addEventListener(t,s,wk?r:o)}e.addEventListener(t,n,r)};function _k(e){return e&&e.ownerDocument||document}const kk=function(e,t,n,r){var i=r&&"boolean"!==typeof r?r.capture:r;e.removeEventListener(t,n,i),n.__once&&e.removeEventListener(t,n.__once,i)};var Tk;function Ck(e){if((!Tk&&0!==Tk||e)&&yk){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),Tk=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Tk}const xk=function(t){var n=(0,e.useRef)(t);return(0,e.useEffect)((function(){n.current=t}),[t]),n};function Ik(t){var n=xk(t);return(0,e.useCallback)((function(){return n.current&&n.current.apply(n,arguments)}),[n])}var Nk=function(e){return e&&"function"!==typeof e?function(t){e.current=t}:e};const Ok=function(t,n){return(0,e.useMemo)((function(){return function(e,t){var n=Nk(e),r=Nk(t);return function(e){n&&n(e),r&&r(e)}}(t,n)}),[t,n])};function Pk(t){var n=function(t){var n=(0,e.useRef)(t);return n.current=t,n}(t);(0,e.useEffect)((function(){return function(){return n.current()}}),[])}function Rk(e,t){return function(e){var t=_k(e);return t&&t.defaultView||window}(e).getComputedStyle(e,t)}var Ak=/([A-Z])/g;var Dk=/^ms-/;function Lk(e){return function(e){return e.replace(Ak,"-$1").toLowerCase()}(e).replace(Dk,"-ms-")}var Mk=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;const jk=function(e,t){var n="",r="";if("string"===typeof t)return e.style.getPropertyValue(Lk(t))||Rk(e).getPropertyValue(Lk(t));Object.keys(t).forEach((function(i){var o=t[i];o||0===o?!function(e){return!(!e||!Mk.test(e))}(i)?n+=Lk(i)+": "+o+";":r+=i+"("+o+") ":e.style.removeProperty(Lk(i))})),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n};const Fk=function(e,t,n,r){return Sk(e,t,n,r),function(){kk(e,t,n,r)}};function Uk(e,t,n){void 0===n&&(n=5);var r=!1,i=setTimeout((function(){r||function(e,t,n,r){if(void 0===n&&(n=!1),void 0===r&&(r=!0),e){var i=document.createEvent("HTMLEvents");i.initEvent(t,n,r),e.dispatchEvent(i)}}(e,"transitionend",!0)}),t+n),o=Fk(e,"transitionend",(function(){r=!0}),{once:!0});return function(){clearTimeout(i),o()}}function Vk(e,t,n,r){null==n&&(n=function(e){var t=jk(e,"transitionDuration")||"",n=-1===t.indexOf("ms")?1e3:1;return parseFloat(t)*n}(e)||0);var i=Uk(e,n,r),o=Fk(e,"transitionend",t);return function(){i(),o()}}function Bk(e){void 0===e&&(e=_k());try{var t=e.activeElement;return t&&t.nodeName?t:null}catch(RC){return e.body}}function zk(e,t){return e.contains?e.contains(t):e.compareDocumentPosition?e===t||!!(16&e.compareDocumentPosition(t)):void 0}function Hk(t){var n=function(t){var n=(0,e.useRef)(t);return n.current=t,n}(t);(0,e.useEffect)((function(){return function(){return n.current()}}),[])}const qk=function(t){var n=(0,e.useRef)(t);return(0,e.useEffect)((function(){n.current=t}),[t]),n};function Wk(t){var n=qk(t);return(0,e.useCallback)((function(){return n.current&&n.current.apply(n,arguments)}),[n])}const Gk=(Kk="modal-open","".concat("data-rr-ui-").concat(Kk));var Kk;const Qk=class{constructor(){let{handleContainerOverflow:e=!0,isRTL:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.handleContainerOverflow=e,this.isRTL=t,this.modals=[]}getScrollbarWidth(){return Math.abs(window.innerWidth-document.documentElement.clientWidth)}getElement(){return document.body}setModalAttributes(e){}removeModalAttributes(e){}setContainerStyle(e){const t={overflow:"hidden"},n=this.isRTL?"paddingLeft":"paddingRight",r=this.getElement();e.style={overflow:r.style.overflow,[n]:r.style[n]},e.scrollBarWidth&&(t[n]="".concat(parseInt(jk(r,n)||"0",10)+e.scrollBarWidth,"px")),r.setAttribute(Gk,""),jk(r,t)}reset(){[...this.modals].forEach((e=>this.remove(e)))}removeContainerStyle(e){const t=this.getElement();t.removeAttribute(Gk),Object.assign(t.style,e.style)}add(e){let t=this.modals.indexOf(e);return-1!==t?t:(t=this.modals.length,this.modals.push(e),this.setModalAttributes(e),0!==t||(this.state={scrollBarWidth:this.getScrollbarWidth(),style:{}},this.handleContainerOverflow&&this.setContainerStyle(this.state)),t)}remove(e){const t=this.modals.indexOf(e);-1!==t&&(this.modals.splice(t,1),!this.modals.length&&this.handleContainerOverflow&&this.removeContainerStyle(this.state),this.removeModalAttributes(e))}isTopModal(e){return!!this.modals.length&&this.modals[this.modals.length-1]===e}},$k=e=>{var t;return"undefined"===typeof document?null:null==e?_k().body:("function"===typeof e&&(e=e()),e&&"current"in e&&(e=e.current),null!=(t=e)&&t.nodeType&&e||null)};const Yk=["show","role","className","style","children","backdrop","keyboard","onBackdropClick","onEscapeKeyDown","transition","backdropTransition","autoFocus","enforceFocus","restoreFocus","restoreFocusOptions","renderDialog","renderBackdrop","manager","container","onShow","onHide","onExit","onExited","onExiting","onEnter","onEntering","onEntered"];let Xk;function Jk(t){const n=t||(Xk||(Xk=new Qk),Xk),r=(0,e.useRef)({dialog:null,backdrop:null});return Object.assign(r.current,{add:()=>n.add(r.current),remove:()=>n.remove(r.current),isTopModal:()=>n.isTopModal(r.current),setDialogRef:(0,e.useCallback)((e=>{r.current.dialog=e}),[]),setBackdropRef:(0,e.useCallback)((e=>{r.current.backdrop=e}),[])})}const Zk=(0,e.forwardRef)(((t,n)=>{let{show:i=!1,role:o="dialog",className:s,style:a,children:l,backdrop:c=!0,keyboard:u=!0,onBackdropClick:h,onEscapeKeyDown:d,transition:f,backdropTransition:p,autoFocus:m=!0,enforceFocus:g=!0,restoreFocus:v=!0,restoreFocusOptions:y,renderDialog:w,renderBackdrop:b=(e=>(0,zS.jsx)("div",Object.assign({},e))),manager:E,container:S,onShow:_,onHide:k=(()=>{}),onExit:T,onExited:C,onExiting:x,onEnter:I,onEntering:N,onEntered:O}=t,P=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(t,Yk);const R=function(t,n){const[r,i]=(0,e.useState)((()=>$k(t)));if(!r){const e=$k(t);e&&i(e)}return(0,e.useEffect)((()=>{n&&r&&n(r)}),[n,r]),(0,e.useEffect)((()=>{const e=$k(t);e!==r&&i(e)}),[t,r]),r}(S),A=Jk(E),D=function(){var t=(0,e.useRef)(!0),n=(0,e.useRef)((function(){return t.current}));return(0,e.useEffect)((function(){return function(){t.current=!1}}),[]),n.current}(),L=function(t){var n=(0,e.useRef)(null);return(0,e.useEffect)((function(){n.current=t})),n.current}(i),[M,j]=(0,e.useState)(!i),F=(0,e.useRef)(null);(0,e.useImperativeHandle)(n,(()=>A),[A]),yk&&!L&&i&&(F.current=Bk()),f||i||M?i&&M&&j(!1):j(!0);const U=Wk((()=>{if(A.add(),W.current=Fk(document,"keydown",H),q.current=Fk(document,"focus",(()=>setTimeout(B)),!0),_&&_(),m){const e=Bk(document);A.dialog&&e&&!zk(A.dialog,e)&&(F.current=e,A.dialog.focus())}})),V=Wk((()=>{var e;(A.remove(),null==W.current||W.current(),null==q.current||q.current(),v)&&(null==(e=F.current)||null==e.focus||e.focus(y),F.current=null)}));(0,e.useEffect)((()=>{i&&R&&U()}),[i,R,U]),(0,e.useEffect)((()=>{M&&V()}),[M,V]),Hk((()=>{V()}));const B=Wk((()=>{if(!g||!D()||!A.isTopModal())return;const e=Bk();A.dialog&&e&&!zk(A.dialog,e)&&A.dialog.focus()})),z=Wk((e=>{e.target===e.currentTarget&&(null==h||h(e),!0===c&&k())})),H=Wk((e=>{u&&27===e.keyCode&&A.isTopModal()&&(null==d||d(e),e.defaultPrevented||k())})),q=(0,e.useRef)(),W=(0,e.useRef)(),G=function(){j(!0),null==C||C(...arguments)},K=f;if(!R||!(i||K&&!M))return null;const Q=Object.assign({role:o,ref:A.setDialogRef,"aria-modal":"dialog"===o||void 0},P,{style:a,className:s,tabIndex:-1});let $=w?w(Q):(0,zS.jsx)("div",Object.assign({},Q,{children:e.cloneElement(l,{role:"document"})}));K&&($=(0,zS.jsx)(K,{appear:!0,unmountOnExit:!0,in:!!i,onExit:T,onExiting:x,onExited:G,onEnter:I,onEntering:N,onEntered:O,children:$}));let Y=null;if(c){const e=p;Y=b({ref:A.setBackdropRef,onClick:z}),e&&(Y=(0,zS.jsx)(e,{appear:!0,in:!!i,children:Y}))}return(0,zS.jsx)(zS.Fragment,{children:r.createPortal((0,zS.jsxs)(zS.Fragment,{children:[Y,$]}),R)})}));Zk.displayName="Modal";const eT=Object.assign(Zk,{Manager:Qk});var tT=Function.prototype.bind.call(Function.prototype.call,[].slice);function nT(e,t){return tT(e.querySelectorAll(t))}const rT=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",iT=".sticky-top",oT=".navbar-toggler";class sT extends Qk{adjustAndStore(e,t,n){const r=t.style[e];t.dataset[e]=r,jk(t,{[e]:"".concat(parseFloat(jk(t,e))+n,"px")})}restore(e,t){const n=t.dataset[e];void 0!==n&&(delete t.dataset[e],jk(t,{[e]:n}))}setContainerStyle(e){super.setContainerStyle(e);const t=this.getElement();if(m_(t,"modal-open"),!e.scrollBarWidth)return;const n=this.isRTL?"paddingLeft":"paddingRight",r=this.isRTL?"marginLeft":"marginRight";nT(t,rT).forEach((t=>this.adjustAndStore(n,t,e.scrollBarWidth))),nT(t,iT).forEach((t=>this.adjustAndStore(r,t,-e.scrollBarWidth))),nT(t,oT).forEach((t=>this.adjustAndStore(r,t,e.scrollBarWidth)))}removeContainerStyle(e){super.removeContainerStyle(e);const t=this.getElement();v_(t,"modal-open");const n=this.isRTL?"paddingLeft":"paddingRight",r=this.isRTL?"marginLeft":"marginRight";nT(t,rT).forEach((e=>this.restore(n,e))),nT(t,iT).forEach((e=>this.restore(r,e))),nT(t,oT).forEach((e=>this.restore(r,e)))}}let aT;function lT(e,t){const n=jk(e,t)||"",r=-1===n.indexOf("ms")?1e3:1;return parseFloat(n)*r}function cT(e,t){const n=lT(e,"transitionDuration"),r=lT(e,"transitionDelay"),i=Vk(e,(n=>{n.target===e&&(i(),t(n))}),n+r)}const uT=e.forwardRef(((t,n)=>{let{onEnter:i,onEntering:o,onEntered:s,onExit:a,onExiting:l,onExited:c,addEndListener:u,children:h,childRef:d,...f}=t;const p=(0,e.useRef)(null),m=Ok(p,d),g=e=>{var t;m((t=e)&&"setState"in t?r.findDOMNode(t):null!=t?t:null)},v=e=>t=>{e&&p.current&&e(p.current,t)},y=(0,e.useCallback)(v(i),[i]),w=(0,e.useCallback)(v(o),[o]),b=(0,e.useCallback)(v(s),[s]),E=(0,e.useCallback)(v(a),[a]),S=(0,e.useCallback)(v(l),[l]),_=(0,e.useCallback)(v(c),[c]),k=(0,e.useCallback)(v(u),[u]);return(0,zS.jsx)(x_,{ref:n,...f,onEnter:y,onEntered:b,onEntering:w,onExit:E,onExited:_,onExiting:S,addEndListener:k,nodeRef:p,children:"function"===typeof h?(e,t)=>h(e,{...t,ref:g}):e.cloneElement(h,{ref:g})})})),hT=uT,dT={[S_]:"show",[__]:"show"},fT=e.forwardRef(((t,n)=>{let{className:r,children:i,transitionClasses:o={},...s}=t;const a=(0,e.useCallback)(((e,t)=>{!function(e){e.offsetHeight}(e),null==s.onEnter||s.onEnter(e,t)}),[s]);return(0,zS.jsx)(hT,{ref:n,addEndListener:cT,...s,onEnter:a,childRef:i.ref,children:(t,n)=>e.cloneElement(i,{...n,className:_()("fade",r,i.props.className,dT[t],o[t])})})}));fT.defaultProps={in:!1,timeout:300,mountOnEnter:!1,unmountOnExit:!1,appear:!1},fT.displayName="Fade";const pT=fT;var mT=/-(.)/g;const gT=e=>{return e[0].toUpperCase()+(t=e,t.replace(mT,(function(e,t){return t.toUpperCase()}))).slice(1);var t};function vT(t){let{displayName:n=gT(t),Component:r,defaultProps:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=e.forwardRef(((e,n)=>{let{className:i,bsPrefix:o,as:s=r||"div",...a}=e;const l=mk(o,t);return(0,zS.jsx)(s,{ref:n,className:_()(i,l),...a})}));return o.defaultProps=i,o.displayName=n,o}const yT=vT("modal-body"),wT=e.createContext({onHide(){}}),bT=e.forwardRef(((e,t)=>{let{bsPrefix:n,className:r,contentClassName:i,centered:o,size:s,fullscreen:a,children:l,scrollable:c,...u}=e;n=mk(n,"modal");const h="".concat(n,"-dialog"),d="string"===typeof a?"".concat(n,"-fullscreen-").concat(a):"".concat(n,"-fullscreen");return(0,zS.jsx)("div",{...u,ref:t,className:_()(h,r,s&&"".concat(n,"-").concat(s),o&&"".concat(h,"-centered"),c&&"".concat(h,"-scrollable"),a&&d),children:(0,zS.jsx)("div",{className:_()("".concat(n,"-content"),i),children:l})})}));bT.displayName="ModalDialog";const ET=bT,ST=vT("modal-footer");var _T=n(173),kT=n.n(_T);const TT={"aria-label":kT().string,onClick:kT().func,variant:kT().oneOf(["white"])},CT=e.forwardRef(((e,t)=>{let{className:n,variant:r,...i}=e;return(0,zS.jsx)("button",{ref:t,type:"button",className:_()("btn-close",r&&"btn-close-".concat(r),n),...i})}));CT.displayName="CloseButton",CT.propTypes=TT,CT.defaultProps={"aria-label":"Close"};const xT=CT,IT=e.forwardRef(((t,n)=>{let{closeLabel:r,closeVariant:i,closeButton:o,onHide:s,children:a,...l}=t;const c=(0,e.useContext)(wT),u=Ik((()=>{null==c||c.onHide(),null==s||s()}));return(0,zS.jsxs)("div",{ref:n,...l,children:[a,o&&(0,zS.jsx)(xT,{"aria-label":r,variant:i,onClick:u})]})}));IT.defaultProps={closeLabel:"Close",closeButton:!1};const NT=IT,OT=e.forwardRef(((e,t)=>{let{bsPrefix:n,className:r,...i}=e;return n=mk(n,"modal-header"),(0,zS.jsx)(NT,{ref:t,...i,className:_()(r,n)})}));OT.displayName="ModalHeader",OT.defaultProps={closeLabel:"Close",closeButton:!1};const PT=OT,RT=(AT="h4",e.forwardRef(((e,t)=>(0,zS.jsx)("div",{...e,ref:t,className:_()(e.className,AT)}))));var AT;const DT=vT("modal-title",{Component:RT}),LT={show:!1,backdrop:!0,keyboard:!0,autoFocus:!0,enforceFocus:!0,restoreFocus:!0,animation:!0,dialogAs:ET};function MT(e){return(0,zS.jsx)(pT,{...e,timeout:null})}function jT(e){return(0,zS.jsx)(pT,{...e,timeout:null})}const FT=e.forwardRef(((t,n)=>{let{bsPrefix:r,className:i,style:o,dialogClassName:s,contentClassName:a,children:l,dialogAs:c,"aria-labelledby":u,show:h,animation:d,backdrop:f,keyboard:p,onEscapeKeyDown:m,onShow:g,onHide:v,container:y,autoFocus:w,enforceFocus:b,restoreFocus:E,restoreFocusOptions:S,onEntered:k,onExit:T,onExiting:C,onEnter:x,onEntering:I,onExited:N,backdropClassName:O,manager:P,...R}=t;const[A,D]=(0,e.useState)({}),[L,M]=(0,e.useState)(!1),j=(0,e.useRef)(!1),F=(0,e.useRef)(!1),U=(0,e.useRef)(null),[V,B]=(0,e.useState)(null),z=Ok(n,B),H=Ik(v),q=function(){const{dir:t}=(0,e.useContext)(dk);return"rtl"===t}();r=mk(r,"modal");const W=(0,e.useMemo)((()=>({onHide:H})),[H]);function G(){return P||function(e){return aT||(aT=new sT(e)),aT}({isRTL:q})}function K(e){if(!yk)return;const t=G().getScrollbarWidth()>0,n=e.scrollHeight>_k(e).documentElement.clientHeight;D({paddingRight:t&&!n?Ck():void 0,paddingLeft:!t&&n?Ck():void 0})}const Q=Ik((()=>{V&&K(V.dialog)}));Pk((()=>{kk(window,"resize",Q),null==U.current||U.current()}));const $=()=>{j.current=!0},Y=e=>{j.current&&V&&e.target===V.dialog&&(F.current=!0),j.current=!1},X=()=>{M(!0),U.current=Vk(V.dialog,(()=>{M(!1)}))},J=e=>{"static"!==f?F.current||e.target!==e.currentTarget?F.current=!1:null==v||v():(e=>{e.target===e.currentTarget&&X()})(e)},Z=(0,e.useCallback)((e=>(0,zS.jsx)("div",{...e,className:_()("".concat(r,"-backdrop"),O,!d&&"show")})),[d,O,r]),ee={...o,...A};d||(ee.display="block");return(0,zS.jsx)(wT.Provider,{value:W,children:(0,zS.jsx)(eT,{show:h,ref:z,backdrop:f,container:y,keyboard:!0,autoFocus:w,enforceFocus:b,restoreFocus:E,restoreFocusOptions:S,onEscapeKeyDown:e=>{p||"static"!==f?p&&m&&m(e):(e.preventDefault(),X())},onShow:g,onHide:v,onEnter:(e,t)=>{e&&(e.style.display="block",K(e)),null==x||x(e,t)},onEntering:(e,t)=>{null==I||I(e,t),Sk(window,"resize",Q)},onEntered:k,onExit:e=>{null==U.current||U.current(),null==T||T(e)},onExiting:C,onExited:e=>{e&&(e.style.display=""),null==N||N(e),kk(window,"resize",Q)},manager:G(),transition:d?MT:void 0,backdropTransition:d?jT:void 0,renderBackdrop:Z,renderDialog:e=>(0,zS.jsx)("div",{role:"dialog",...e,style:ee,className:_()(i,r,L&&"".concat(r,"-static")),onClick:f?J:void 0,onMouseUp:Y,"aria-labelledby":u,children:(0,zS.jsx)(c,{...R,onMouseDown:$,className:s,contentClassName:a,children:l})})})})}));FT.displayName="Modal",FT.defaultProps=LT;const UT=Object.assign(FT,{Body:yT,Header:PT,Title:DT,Footer:ST,Dialog:ET,TRANSITION_DURATION:300,BACKDROP_TRANSITION_DURATION:150}),VT=t=>{let{playerPerspective:n}=t;const r=FE((e=>e.settings));let i=(0,e.useContext)(ES);const o=jE();let s=r.playerOneColor,a=s===nw.White?nw.Black:nw.White;const l=()=>o(dS(!1));let c="",u="",h=n===tw.One?s:a,d=h===nw.White?nw.Black:nw.White;return i instanceof wS?(c=n===tw.One?"Player 1":"Player 2",u=n===tw.One?"Player 2":"Player 1"):(c="You",u="Opponent"),(0,zS.jsxs)(UT,{show:r.showSettingsMenu,centered:!0,dialogClassName:"Settings-menu",keyboard:!0,onHide:l,children:[(0,zS.jsx)(UT.Header,{children:(0,zS.jsx)(UT.Title,{children:"Settings"})}),(0,zS.jsxs)(UT.Body,{children:[(0,zS.jsxs)("div",{className:"Settings-option-row",children:[(0,zS.jsx)("div",{className:"Settings-checker-color-label",children:"Checker color"}),(0,zS.jsxs)("div",{className:"Settings-menu-player-names-and-checkers",onClick:()=>{const e=r.playerOneColor===nw.Black?nw.White:nw.Black;o(uS(e))},children:[(0,zS.jsxs)("div",{className:"Settings-menu-player-name-and-checker",children:[(0,zS.jsx)("div",{className:"Settings-menu-player-name",children:c}),(0,zS.jsx)("div",{className:"Settings-menu-checker-wrapper",children:(0,zS.jsx)(q_,{color:h,checkerPulse:!1,status:H_.None,onAnimationComplete:()=>{},animation:null})})]}),(0,zS.jsxs)("div",{className:"Settings-menu-color-swap-arrow-wrapper",children:[(0,zS.jsx)("div",{className:"Settings-menu-color-swap",children:"SWAP"}),(0,zS.jsx)("div",{className:"Settings-menu-color-swap-arrow"})]}),(0,zS.jsxs)("div",{className:"Settings-menu-player-name-and-checker",children:[(0,zS.jsx)("div",{className:"Settings-menu-player-name",children:u}),(0,zS.jsx)("div",{className:"Settings-menu-checker-wrapper",children:(0,zS.jsx)(q_,{color:d,checkerPulse:!1,status:H_.None,onAnimationComplete:()=>{},animation:null})})]})]})]}),(0,zS.jsxs)("div",{className:"Settings-option-row bottom",children:[(0,zS.jsx)("div",{className:"Settings-checker-direction-label",children:"Movement direction"}),(0,zS.jsx)("div",{className:"Settings-option-movement-diagram-wrapper",onClick:()=>{const e=r.movementDirection===rw.Clockwise?rw.CounterClockwise:rw.Clockwise;o(cS(e))},children:(0,zS.jsx)("div",{className:_()("Settings-option-movement-diagram",{light:h===nw.White,dark:h===nw.Black,cw:n===tw.One&&r.movementDirection===rw.Clockwise||n===tw.Two&&r.movementDirection===rw.CounterClockwise})})})]})]}),(0,zS.jsx)(UT.Footer,{children:(0,zS.jsx)(vk,{variant:"primary",onClick:l,children:"Close"})})]})},BT=t=>{let{playerPerspective:n}=t;const[r,i,o,s,a]=FE((e=>[e.gameState,e.settings,e.currentPlayer,e.matchScore,e.readyForNextGame]));let l=(0,e.useContext)(ES);const c=SE(),u=jE(),h=s[o]>=s.pointsRequiredToWin;let d="",f="";l instanceof wS?(d=o===tw.One?"Player One wins":"Player Two wins",f=o===tw.One?"Player Two forfeited.":"Player One forfeited."):(d=o===n?"You win":"Opponent wins",f=o===n?"Opponent forfeited.":"You forfeited."),d+=h?" the match!":" the game!";let p=null;switch(r){case $y.GameOverGammon:p=(0,zS.jsx)("div",{className:"Game-over-dialog-gammon-text",children:"It's a gammon and is worth double!"});break;case $y.GameOverBackgammon:p=(0,zS.jsx)("div",{className:"Game-over-dialog-gammon-text",children:"It's a backgammon and is worth triple!"});break;case $y.GameOverForfeit:p=(0,zS.jsx)("div",{className:"Game-over-dialog-gammon-text",children:f});break;default:p=null}const m=h?"Match Over":"Game Over";let g=null;g=o===tw.One?i.playerOneColor:i.playerOneColor===nw.White?nw.Black:nw.White;const v=h?"Return to Menu":"Next Game";return(0,zS.jsxs)(UT,{show:i.showGameOverDialog,backdrop:"static",centered:!0,dialogClassName:"Game-over-dialog",children:[(0,zS.jsx)(UT.Header,{children:(0,zS.jsx)(UT.Title,{children:m})}),(0,zS.jsx)(UT.Body,{children:(0,zS.jsxs)("div",{className:"Game-over-dialog-winner-wrapper",children:[(0,zS.jsx)("div",{className:"Game-over-dialog-winner-checker-wrapper left",children:(0,zS.jsx)(q_,{color:g,checkerPulse:!1,status:H_.None,onAnimationComplete:()=>{},animation:null})}),(0,zS.jsxs)("div",{className:"Game-over-dialog-winner-text",children:[d,p]}),(0,zS.jsx)("div",{className:"Game-over-dialog-winner-checker-wrapper",children:(0,zS.jsx)(q_,{color:g,checkerPulse:!1,status:H_.None,onAnimationComplete:()=>{},animation:null})})]})}),(0,zS.jsx)(UT.Footer,{children:(0,zS.jsx)(vk,{variant:"primary",onClick:h?()=>{VS(u,!0),u(gS(!0)),c("/")}:()=>{l.isHostClient()?l.nextGameButtonClicked({...a,[tw.One]:!0}):l.nextGameButtonClicked({...a,[tw.Two]:!0})},children:v})})]})},zT=e=>{let{playerPerspective:t}=e;return(0,zS.jsxs)("div",{className:"Game-area-wrapper",children:[(0,zS.jsx)(VT,{playerPerspective:t}),(0,zS.jsx)(BT,{playerPerspective:t}),(0,zS.jsx)(lk,{side:ak.Top,playerPerspective:t}),(0,zS.jsx)(sk,{playerPerspective:t}),(0,zS.jsx)(lk,{side:ak.Bottom,playerPerspective:t})]})},HT={type:kT().string,tooltip:kT().bool,as:kT().elementType},qT=e.forwardRef(((e,t)=>{let{as:n="div",className:r,type:i="valid",tooltip:o=!1,...s}=e;return(0,zS.jsx)(n,{...s,ref:t,className:_()(r,"".concat(i,"-").concat(o?"tooltip":"feedback"))})}));qT.displayName="Feedback",qT.propTypes=HT;const WT=qT,GT=e.createContext({}),KT=e.forwardRef(((t,n)=>{let{id:r,bsPrefix:i,className:o,type:s="checkbox",isValid:a=!1,isInvalid:l=!1,as:c="input",...u}=t;const{controlId:h}=(0,e.useContext)(GT);return i=mk(i,"form-check-input"),(0,zS.jsx)(c,{...u,ref:n,type:s,id:r||h,className:_()(o,i,a&&"is-valid",l&&"is-invalid")})}));KT.displayName="FormCheckInput";const QT=KT,$T=e.forwardRef(((t,n)=>{let{bsPrefix:r,className:i,htmlFor:o,...s}=t;const{controlId:a}=(0,e.useContext)(GT);return r=mk(r,"form-check-label"),(0,zS.jsx)("label",{...s,ref:n,htmlFor:o||a,className:_()(i,r)})}));$T.displayName="FormCheckLabel";const YT=$T,XT=e.forwardRef(((t,n)=>{let{id:r,bsPrefix:i,bsSwitchPrefix:o,inline:s=!1,disabled:a=!1,isValid:l=!1,isInvalid:c=!1,feedbackTooltip:u=!1,feedback:h,feedbackType:d,className:f,style:p,title:m="",type:g="checkbox",label:v,children:y,as:w="input",...b}=t;i=mk(i,"form-check"),o=mk(o,"form-switch");const{controlId:E}=(0,e.useContext)(GT),S=(0,e.useMemo)((()=>({controlId:r||E})),[E,r]),k=null!=v&&!1!==v&&!y,T=(0,zS.jsx)(QT,{...b,type:"switch"===g?"checkbox":g,ref:n,isValid:l,isInvalid:c,disabled:a,as:w});return(0,zS.jsx)(GT.Provider,{value:S,children:(0,zS.jsx)("div",{style:p,className:_()(f,v&&i,s&&"".concat(i,"-inline"),"switch"===g&&o),children:y||(0,zS.jsxs)(zS.Fragment,{children:[T,k&&(0,zS.jsx)(YT,{title:m,children:v}),h&&(0,zS.jsx)(WT,{type:d,tooltip:u,children:h})]})})})}));XT.displayName="FormCheck";const JT=Object.assign(XT,{Input:QT,Label:YT});n(440);const ZT=e.forwardRef(((t,n)=>{let{bsPrefix:r,type:i,size:o,htmlSize:s,id:a,className:l,isValid:c=!1,isInvalid:u=!1,plaintext:h,readOnly:d,as:f="input",...p}=t;const{controlId:m}=(0,e.useContext)(GT);let g;return r=mk(r,"form-control"),g=h?{["".concat(r,"-plaintext")]:!0}:{[r]:!0,["".concat(r,"-").concat(o)]:o},(0,zS.jsx)(f,{...p,type:i,size:s,ref:n,readOnly:d,id:a||m,className:_()(l,g,c&&"is-valid",u&&"is-invalid","color"===i&&"".concat(r,"-color"))})}));ZT.displayName="FormControl";const eC=Object.assign(ZT,{Feedback:WT}),tC=vT("form-floating"),nC=e.forwardRef(((t,n)=>{let{controlId:r,as:i="div",...o}=t;const s=(0,e.useMemo)((()=>({controlId:r})),[r]);return(0,zS.jsx)(GT.Provider,{value:s,children:(0,zS.jsx)(i,{...o,ref:n})})}));nC.displayName="FormGroup";const rC=nC,iC=["xxl","xl","lg","md","sm","xs"];const oC=e.forwardRef(((e,t)=>{const[{className:n,...r},{as:i="div",bsPrefix:o,spans:s}]=function(e){let{as:t,bsPrefix:n,className:r,...i}=e;n=mk(n,"col");const o=[],s=[];return iC.forEach((e=>{const t=i[e];let r,a,l;delete i[e],"object"===typeof t&&null!=t?({span:r,offset:a,order:l}=t):r=t;const c="xs"!==e?"-".concat(e):"";r&&o.push(!0===r?"".concat(n).concat(c):"".concat(n).concat(c,"-").concat(r)),null!=l&&s.push("order".concat(c,"-").concat(l)),null!=a&&s.push("offset".concat(c,"-").concat(a))})),[{...i,className:_()(r,...o,...s)},{as:t,bsPrefix:n,spans:o}]}(e);return(0,zS.jsx)(i,{...r,ref:t,className:_()(n,!s.length&&o)})}));oC.displayName="Col";const sC=oC,aC=e.forwardRef(((t,n)=>{let{as:r="label",bsPrefix:i,column:o,visuallyHidden:s,className:a,htmlFor:l,...c}=t;const{controlId:u}=(0,e.useContext)(GT);i=mk(i,"form-label");let h="col-form-label";"string"===typeof o&&(h="".concat(h," ").concat(h,"-").concat(o));const d=_()(a,i,s&&"visually-hidden",o&&h);return l=l||u,o?(0,zS.jsx)(sC,{ref:n,as:"label",className:d,htmlFor:l,...c}):(0,zS.jsx)(r,{ref:n,className:d,htmlFor:l,...c})}));aC.displayName="FormLabel",aC.defaultProps={column:!1,visuallyHidden:!1};const lC=aC,cC=e.forwardRef(((t,n)=>{let{bsPrefix:r,className:i,id:o,...s}=t;const{controlId:a}=(0,e.useContext)(GT);return r=mk(r,"form-range"),(0,zS.jsx)("input",{...s,type:"range",ref:n,className:_()(i,r),id:o||a})}));cC.displayName="FormRange";const uC=cC,hC=e.forwardRef(((t,n)=>{let{bsPrefix:r,size:i,htmlSize:o,className:s,isValid:a=!1,isInvalid:l=!1,id:c,...u}=t;const{controlId:h}=(0,e.useContext)(GT);return r=mk(r,"form-select"),(0,zS.jsx)("select",{...u,size:o,ref:n,className:_()(s,r,i&&"".concat(r,"-").concat(i),a&&"is-valid",l&&"is-invalid"),id:c||h})}));hC.displayName="FormSelect";const dC=hC,fC=e.forwardRef(((e,t)=>{let{bsPrefix:n,className:r,as:i="small",muted:o,...s}=e;return n=mk(n,"form-text"),(0,zS.jsx)(i,{...s,ref:t,className:_()(r,n,o&&"text-muted")})}));fC.displayName="FormText";const pC=fC,mC=e.forwardRef(((e,t)=>(0,zS.jsx)(JT,{...e,ref:t,type:"switch"})));mC.displayName="Switch";const gC=Object.assign(mC,{Input:JT.Input,Label:JT.Label}),vC=e.forwardRef(((e,t)=>{let{bsPrefix:n,className:r,children:i,controlId:o,label:s,...a}=e;return n=mk(n,"form-floating"),(0,zS.jsxs)(rC,{ref:t,className:_()(r,n),controlId:o,...a,children:[i,(0,zS.jsx)("label",{htmlFor:o,children:s})]})}));vC.displayName="FloatingLabel";const yC=vC,wC={_ref:kT().any,validated:kT().bool,as:kT().elementType},bC=e.forwardRef(((e,t)=>{let{className:n,validated:r,as:i="form",...o}=e;return(0,zS.jsx)(i,{...o,ref:t,className:_()(n,r&&"was-validated")})}));bC.displayName="Form",bC.propTypes=wC;const EC=Object.assign(bC,{Group:rC,Control:eC,Floating:tC,Check:JT,Switch:gC,Label:lC,Text:pC,Range:uC,Select:dC,FloatingLabel:yC}),SC=t=>{let{roomCode:n,matchPointsValue:r,enableDoubling:i,onMatchPointsChanged:o,onEnableDoublingChanged:s}=t;const a=(0,e.useContext)(ES),[l,c]=(0,e.useState)(!1);let u=null;if(null!==n){const e="sam-swarr.github.io/backgammon/"+n;u=(0,zS.jsxs)("div",{className:"Url-copy-row",children:[(0,zS.jsx)("div",{className:"Url-title-wrapper"}),(0,zS.jsxs)("div",{className:"Url-form-wrapper",children:[(0,zS.jsxs)("div",{className:"Url-form-text-and-copy",children:[(0,zS.jsx)("div",{className:"Url-form-text",children:e}),(0,zS.jsx)("div",{className:_()("Url-form-copy",{highlight:l}),onClick:()=>{navigator.clipboard.writeText(e),c(!0),setTimeout((()=>{c(!1)}),300)}})]}),(0,zS.jsx)("div",{className:"Url-form-subtext",children:"Have your friend connect to this address"})]})]})}return(0,zS.jsxs)("div",{className:"Match-settings-menu-wrapper",children:[(0,zS.jsx)("div",{className:"Match-settings-title-wrapper"}),(0,zS.jsxs)("div",{className:"Match-points-settings-row",children:[(0,zS.jsx)("div",{className:"Play-to-wrapper"}),(0,zS.jsxs)("div",{className:"Match-points-buttons-wrapper",children:[(0,zS.jsx)("div",{className:_()("Match-points-button",{selected:1===r}),onClick:()=>o(1),children:"1"}),(0,zS.jsx)("div",{className:_()("Match-points-button",{selected:3===r}),onClick:()=>o(3),children:"3"}),(0,zS.jsx)("div",{className:_()("Match-points-button",{selected:5===r}),onClick:()=>o(5),children:"5"}),(0,zS.jsx)("div",{className:_()("Match-points-button",{selected:7===r}),onClick:()=>o(7),children:"7"}),(0,zS.jsx)("div",{className:_()("Match-points-button",{selected:9===r}),onClick:()=>o(9),children:"9"}),(0,zS.jsx)("div",{className:_()("Match-points-button",{selected:11===r}),onClick:()=>o(11),children:"11"})]})]}),(0,zS.jsxs)("div",{className:"Doubling-cube-settings-row",children:[(0,zS.jsx)("div",{className:"Doubling-cube-text-wrapper"}),(0,zS.jsxs)(EC,{className:"Doubling-cube-toggle-form",children:[(0,zS.jsx)("div",{className:_()("Doubling-cube-toggle-off",{enabled:!i})}),(0,zS.jsx)(EC.Check,{type:"switch",className:"Doubling-cube-toggle",onChange:e=>s(e.target.checked),checked:i}),(0,zS.jsx)("div",{className:_()("Doubling-cube-toggle-on",{enabled:i})})]})]}),u,(0,zS.jsx)("div",{className:"Start-game-button-row",children:(0,zS.jsx)("button",{className:"Start-game-button",onClick:()=>{a.updateMatchSettings(r,i)},children:"Start Game"})})]})},_C=()=>{const e=jE();return(0,zS.jsx)("div",{className:"Settings-menu-button-wrapper",children:(0,zS.jsx)("div",{className:"Settings-menu-button",onClick:()=>{e(dS(!0))}})})};let kC=function(e){return e.None="None",e.NotFound="NotFound",e.TooManyPlayers="TooManyPlayers",e}({});const TC=e=>{let{type:t,roomCode:n}=e;const r=jE(),i=SE();let o=null,s=null;return t===kC.NotFound?(o="Room Not Found",s="Could not find room with code: "):(o="Room Full",s="Two players have already connected to room: "),(0,zS.jsxs)("div",{className:"Room-connection-error-wrapper",children:[(0,zS.jsx)("div",{className:"Room-connection-error-header",children:o}),(0,zS.jsxs)("div",{className:"Room-connection-error-text",children:[s,(0,zS.jsx)("span",{className:"Room-connection-error-roomcode",children:n})]}),(0,zS.jsx)("div",{className:"Room-connection-error-subtext",children:"Please double check the code or try creating another room."}),(0,zS.jsx)("div",{className:"Room-connection-error-menu-button-wrapper",children:(0,zS.jsx)("button",{className:"Room-connection-error-menu-button",onClick:()=>{VS(r,!0),r(gS(!0)),i("/")},children:"Return To Menu"})})]})};function CC(e){let{params:t}=e;return{roomCode:t.roomCode}}const xC=()=>{const{roomCode:t}=function(){let e=RE(OE.UseLoaderData),t=AE(OE.UseLoaderData);if(!e.errors||null==e.errors[t])return e.loaderData[t];console.error("You cannot `useLoaderData` in an errorElement (routeId: "+t+")")}(),[n,r]=FE((e=>[e.settings,e.gameState])),i=jE(),[o,s]=(0,e.useState)(5),[a,l]=(0,e.useState)(!0),[c,u]=(0,e.useState)(kC.None),[h,d]=(0,e.useState)(null),f=(0,e.useRef)(h);const[p,m]=(0,e.useState)(r),g=(0,e.useRef)(p);if((0,e.useEffect)((()=>{!async function(){await Ow();const e=await Aw(t);null!=e?function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{n[l]&&n[l](pv(h,e,t))},error:n[l+1],complete:n[l+2]};else{const t=sg(e,hg);h=sg(t.firestore,vg),d=t._query;const r=new uv(h);u={next:e=>{n[l]&&n[l](new lv(h,r,t,e))},error:n[l+1],complete:n[l+2]},Wg(e._query)}(function(e,t,n,r){const i=new qm(r),o=new mm(t,i,n);e.asyncQueue.enqueueAndForget((async()=>um(await Jm(e),o)))})(yg(h),d,c,u)}(e,(t=>{let n=t.data();i(Xy(n.gameState)),i(AS(n.players)),i($E(n.currentPlayer)),i(eS(n.dice)),i(mw(n.doublingCube)),i(bw(n.matchScore)),i(uw(n.readyForNextGame)),null!=n.networkedMoves&&jS(n.players)===n.networkedMoves.animateFor&&(null==f.current?i(xS(n.networkedMoves)):i(CS(n.networkedMoves))),n.gameState===$y.WaitingToBegin&&i(oS(n.gameBoard)),g.current!==$y.GameOverForfeit&&n.gameState===$y.GameOverForfeit&&i(hS(!0)),function(e){g.current=e,m(e)}(n.gameState);let r=!0;if(function(e){let t=Pw().uid;return null!=e.playerOne&&e.playerOne.uid===t||null!=e.playerTwo&&e.playerTwo.uid===t}(n.players)){let e=Pw().uid;r=null!=n.players.playerOne&&n.players.playerOne.uid===e}else{if(null!=n.players.playerTwo)return void u(kC.TooManyPlayers);!async function(e){await hv(e,{gameState:$y.WaitingToBegin,players:{playerTwo:{uid:Pw().uid}}},{merge:!0})}(e),r=!1}var o;null==f.current&&(i(oS(n.gameBoard)),o=new bS(r,i,e),f.current=o,d(o),BS(n.gameState)&&i(hS(!0)))})):u(kC.NotFound)}()}),[i,t]),null==f.current){if(n.showMatchSetupScreen)return(0,zS.jsx)(SC,{matchPointsValue:o,enableDoubling:a,onMatchPointsChanged:e=>s(e),onEnableDoublingChanged:e=>l(e),roomCode:t});let e=null;return e=c!==kC.None?(0,zS.jsx)(TC,{type:c,roomCode:t}):(0,zS.jsx)("div",{className:"Networked-gameboard-spinner"}),e}{let e=null;return e=n.showMatchSetupScreen?(0,zS.jsx)(SC,{matchPointsValue:o,enableDoubling:a,onMatchPointsChanged:e=>s(e),onEnableDoublingChanged:e=>l(e),roomCode:t}):(0,zS.jsxs)("div",{children:[(0,zS.jsx)(_C,{}),(0,zS.jsx)(zT,{playerPerspective:f.current.isHostClient()?tw.One:tw.Two})]}),(0,zS.jsx)(ES.Provider,{value:f.current,children:e})}},IC=()=>{const[t]=FE((e=>[e.settings])),n=jE(),[r,i]=(0,e.useState)(5),[o,s]=(0,e.useState)(!0);let a=null;return a=t.showMatchSetupScreen?(0,zS.jsx)(SC,{matchPointsValue:r,enableDoubling:o,onMatchPointsChanged:e=>i(e),onEnableDoublingChanged:e=>s(e),roomCode:null}):(0,zS.jsxs)("div",{children:[(0,zS.jsx)(_C,{}),(0,zS.jsx)(zT,{playerPerspective:tw.One})]}),(0,zS.jsx)(ES.Provider,{value:new wS(n),children:a})},NC=()=>{const t=jE(),[n]=FE((e=>[e.wipeTransition]));return(0,e.useEffect)((()=>{n&&setTimeout((()=>{t(gS(!1))}),300)}),[t,n]),(0,zS.jsxs)("div",{children:[(0,zS.jsx)("div",{className:_()({"Wipe-transition":n})}),(0,zS.jsx)("div",{className:_()({"Wipe-fade":n})})]})},OC=()=>{const e=(t=[{path:"/",element:(0,zS.jsx)(HS,{})},{path:"/local",element:(0,zS.jsx)(IC,{})},{path:"/:roomCode",element:(0,zS.jsx)(xC,{}),loader:CC}],Rb({basename:null==(n={basename:"/backgammon/"})?void 0:n.basename,future:qS({},null==n?void 0:n.future,{v7_prependBasename:!0}),history:Fw({window:null==n?void 0:n.window}),hydrationData:(null==n?void 0:n.hydrationData)||WS(),routes:t,mapRouteProperties:ME,window:null==n?void 0:n.window}).initialize());var t,n;const r=new Array(50);for(let o=0;o<50;o++)r.push((0,zS.jsx)("div",{className:"Initial-floating-circle"},o));const i=new Array(50);for(let o=0;o<50;o++)i.push((0,zS.jsx)("div",{className:"Floating-circle"},o));return(0,zS.jsxs)("div",{className:_()("App-wrapper"),children:[(0,zS.jsx)(NC,{}),(0,zS.jsx)("div",{children:r}),(0,zS.jsx)("div",{children:i}),(0,zS.jsx)(ZS,{router:e})]})},PC=function(e){var t,n=Wy(),r=e||{},i=r.reducer,o=void 0===i?void 0:i,s=r.middleware,a=void 0===s?n():s,l=r.devTools,c=void 0===l||l,u=r.preloadedState,h=void 0===u?void 0:u,d=r.enhancers,f=void 0===d?void 0:d;if("function"===typeof o)t=o;else{if(!Hy(o))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Iy(o)}var p=a;"function"===typeof p&&(p=p(n));var m=Oy.apply(void 0,p),g=Ny;c&&(g=zy(By({trace:!1},"object"===typeof c&&c)));var v=[m];return Array.isArray(f)?v=Ly([m],f):"function"===typeof f&&(v=f(v)),xy(t,h,g.apply(void 0,v))}({reducer:{gameBoard:aS,gameState:Jy,lastPointClicked:KE,provisionalMoves:zE,dice:tS,currentPlayer:YE,players:LS,settings:pS,animatableMoves:OS,doublingCube:vw,matchScore:_w,wipeTransition:vS,readyForNextGame:dw}});r.render((0,zS.jsx)(e.StrictMode,{children:(0,zS.jsx)(h,{store:PC,children:(0,zS.jsx)(OC,{})})}),document.getElementById("root"))})()})();
-//# sourceMappingURL=main.de308495.js.map
\ No newline at end of file
+/*! For license information please see main.2a1b5b7c.js.LICENSE.txt */
+(()=>{var e={600:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e=[],t=0;t{"use strict";var r=n(86),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};function l(e){return r.isMemo(e)?s:a[e.$$typeof]||i}a[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},a[r.Memo]=s;var c=Object.defineProperty,u=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,r){if("string"!==typeof n){if(p){var i=f(n);i&&i!==p&&e(t,i,r)}var s=u(n);h&&(s=s.concat(h(n)));for(var a=l(t),m=l(n),g=0;g{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(e,i){for(var o,s,a=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l{"use strict";var r=n(218);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,s){if(s!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},173:(e,t,n)=>{e.exports=n(497)()},218:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},730:(e,t,n)=>{"use strict";var r=n(43),i=n(123),o=n(853);function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;nt}return!1}(t,n,i,r)&&(n=null),r||null===i?function(e){return!!f.call(m,e)||!f.call(p,e)&&(d.test(e)?m[e]=!0:(p[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=null===n?3!==i.type&&"":n:(t=i.attributeName,r=i.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(y,w);v[t]=new g(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(y,w);v[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(y,w);v[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){v[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)})),v.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){v[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)}));var E=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,S=60103,_=60106,k=60107,T=60108,C=60114,x=60109,I=60110,N=60112,O=60113,P=60120,R=60115,A=60116,D=60121,L=60128,M=60129,j=60130,F=60131;if("function"===typeof Symbol&&Symbol.for){var U=Symbol.for;S=U("react.element"),_=U("react.portal"),k=U("react.fragment"),T=U("react.strict_mode"),C=U("react.profiler"),x=U("react.provider"),I=U("react.context"),N=U("react.forward_ref"),O=U("react.suspense"),P=U("react.suspense_list"),R=U("react.memo"),A=U("react.lazy"),D=U("react.block"),U("react.scope"),L=U("react.opaque.id"),M=U("react.debug_trace_mode"),j=U("react.offscreen"),F=U("react.legacy_hidden")}var V,B="function"===typeof Symbol&&Symbol.iterator;function z(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=B&&e[B]||e["@@iterator"])?e:null}function H(e){if(void 0===V)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);V=t&&t[1]||""}return"\n"+V+e}var q=!1;function W(e,t){if(!e||q)return"";q=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(l){var r=l}Reflect.construct(e,[],t)}else{try{t.call()}catch(l){r=l}e.call(t.prototype)}else{try{throw Error()}catch(l){r=l}e()}}catch(l){if(l&&r&&"string"===typeof l.stack){for(var i=l.stack.split("\n"),o=r.stack.split("\n"),s=i.length-1,a=o.length-1;1<=s&&0<=a&&i[s]!==o[a];)a--;for(;1<=s&&0<=a;s--,a--)if(i[s]!==o[a]){if(1!==s||1!==a)do{if(s--,0>--a||i[s]!==o[a])return"\n"+i[s].replace(" at new "," at ")}while(1<=s&&0<=a);break}}}finally{q=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?H(e):""}function G(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=W(e.type,!1);case 11:return e=W(e.type.render,!1);case 22:return e=W(e.type._render,!1);case 1:return e=W(e.type,!0);default:return""}}function K(e){if(null==e)return null;if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case k:return"Fragment";case _:return"Portal";case C:return"Profiler";case T:return"StrictMode";case O:return"Suspense";case P:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case I:return(e.displayName||"Context")+".Consumer";case x:return(e._context.displayName||"Context")+".Provider";case N:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case R:return K(e.type);case D:return K(e._render);case A:t=e._payload,e=e._init;try{return K(e(t))}catch(n){}}return null}function Q(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function $(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Y(e){e._valueTracker||(e._valueTracker=function(e){var t=$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function X(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function J(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Z(e,t){var n=t.checked;return i({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function ee(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=Q(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function te(e,t){null!=(t=t.checked)&&b(e,"checked",t,!1)}function ne(e,t){te(e,t);var n=Q(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ie(e,t.type,n):t.hasOwnProperty("defaultValue")&&ie(e,t.type,Q(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function re(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ie(e,t,n){"number"===t&&J(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}function oe(e,t){return e=i({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function se(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i=n.length))throw Error(s(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:Q(n)}}function ce(e,t){var n=Q(t.value),r=Q(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ue(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var he={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function de(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function fe(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?de(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var pe,me,ge=(me=function(e,t){if(e.namespaceURI!==he.svg||"innerHTML"in e)e.innerHTML=t;else{for((pe=pe||document.createElement("div")).innerHTML="",t=pe.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return me(e,t)}))}:me);function ve(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var ye={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},we=["Webkit","ms","Moz","O"];function be(e,t,n){return null==t||"boolean"===typeof t||""===t?"":n||"number"!==typeof t||0===t||ye.hasOwnProperty(e)&&ye[e]?(""+t).trim():t+"px"}function Ee(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=be(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(ye).forEach((function(e){we.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ye[t]=ye[e]}))}));var Se=i({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function _e(e,t){if(t){if(Se[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(s(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(s(60));if("object"!==typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(s(61))}if(null!=t.style&&"object"!==typeof t.style)throw Error(s(62))}}function ke(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function Te(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Ce=null,xe=null,Ie=null;function Ne(e){if(e=ni(e)){if("function"!==typeof Ce)throw Error(s(280));var t=e.stateNode;t&&(t=ii(t),Ce(e.stateNode,e.type,t))}}function Oe(e){xe?Ie?Ie.push(e):Ie=[e]:xe=e}function Pe(){if(xe){var e=xe,t=Ie;if(Ie=xe=null,Ne(e),t)for(e=0;e(r=31-Ht(r))?0:1<n;n++)t.push(e);return t}function zt(e,t,n){e.pendingLanes|=t;var r=t-1;e.suspendedLanes&=r,e.pingedLanes&=r,(e=e.eventTimes)[t=31-Ht(t)]=n}var Ht=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(qt(e)/Wt|0)|0},qt=Math.log,Wt=Math.LN2;var Gt=o.unstable_UserBlockingPriority,Kt=o.unstable_runWithPriority,Qt=!0;function $t(e,t,n,r){Me||De();var i=Xt,o=Me;Me=!0;try{Ae(i,e,t,n,r)}finally{(Me=o)||Fe()}}function Yt(e,t,n,r){Kt(Gt,Xt.bind(null,e,t,n,r))}function Xt(e,t,n,r){var i;if(Qt)if((i=0===(4&t))&&0=jn),Vn=String.fromCharCode(32),Bn=!1;function zn(e,t){switch(e){case"keyup":return-1!==Ln.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hn(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var qn=!1;var Wn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Gn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Wn[e.type]:"textarea"===t}function Kn(e,t,n,r){Oe(r),0<(t=Mr(t,"onChange")).length&&(n=new dn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Qn=null,$n=null;function Yn(e){Ir(e,0)}function Xn(e){if(X(ri(e)))return e}function Jn(e,t){if("change"===e)return t}var Zn=!1;if(h){var er;if(h){var tr="oninput"in document;if(!tr){var nr=document.createElement("div");nr.setAttribute("oninput","return;"),tr="function"===typeof nr.oninput}er=tr}else er=!1;Zn=er&&(!document.documentMode||9=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=dr(r)}}function pr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?pr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function mr(){for(var e=window,t=J();t instanceof e.HTMLIFrameElement;){try{var n="string"===typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=J((e=t.contentWindow).document)}return t}function gr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var vr=h&&"documentMode"in document&&11>=document.documentMode,yr=null,wr=null,br=null,Er=!1;function Sr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;Er||null==yr||yr!==J(r)||("selectionStart"in(r=yr)&&gr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},br&&hr(br,r)||(br=r,0<(r=Mr(wr,"onSelect")).length&&(t=new dn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=yr)))}Dt("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),Dt("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),Dt(At,2);for(var _r="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),kr=0;kr<_r.length;kr++)Rt.set(_r[kr],0);u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Cr=new Set("cancel close invalid load scroll toggle".split(" ").concat(Tr));function xr(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,i,o,a,l,c){if(Qe.apply(this,arguments),He){if(!He)throw Error(s(198));var u=qe;He=!1,qe=null,We||(We=!0,Ge=u)}}(r,t,void 0,e),e.currentTarget=null}function Ir(e,t){t=0!==(4&t);for(var n=0;nai||(e.current=si[ai],si[ai]=null,ai--)}function ui(e,t){ai++,si[ai]=e.current,e.current=t}var hi={},di=li(hi),fi=li(!1),pi=hi;function mi(e,t){var n=e.type.contextTypes;if(!n)return hi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function gi(e){return null!==(e=e.childContextTypes)&&void 0!==e}function vi(){ci(fi),ci(di)}function yi(e,t,n){if(di.current!==hi)throw Error(s(168));ui(di,t),ui(fi,n)}function wi(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!==typeof r.getChildContext)return n;for(var o in r=r.getChildContext())if(!(o in e))throw Error(s(108,K(t)||"Unknown",o));return i({},n,r)}function bi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hi,pi=di.current,ui(di,e),ui(fi,fi.current),!0}function Ei(e,t,n){var r=e.stateNode;if(!r)throw Error(s(169));n?(e=wi(e,t,pi),r.__reactInternalMemoizedMergedChildContext=e,ci(fi),ci(di),ui(di,e)):ci(fi),ui(fi,n)}var Si=null,_i=null,ki=o.unstable_runWithPriority,Ti=o.unstable_scheduleCallback,Ci=o.unstable_cancelCallback,xi=o.unstable_shouldYield,Ii=o.unstable_requestPaint,Ni=o.unstable_now,Oi=o.unstable_getCurrentPriorityLevel,Pi=o.unstable_ImmediatePriority,Ri=o.unstable_UserBlockingPriority,Ai=o.unstable_NormalPriority,Di=o.unstable_LowPriority,Li=o.unstable_IdlePriority,Mi={},ji=void 0!==Ii?Ii:function(){},Fi=null,Ui=null,Vi=!1,Bi=Ni(),zi=1e4>Bi?Ni:function(){return Ni()-Bi};function Hi(){switch(Oi()){case Pi:return 99;case Ri:return 98;case Ai:return 97;case Di:return 96;case Li:return 95;default:throw Error(s(332))}}function qi(e){switch(e){case 99:return Pi;case 98:return Ri;case 97:return Ai;case 96:return Di;case 95:return Li;default:throw Error(s(332))}}function Wi(e,t){return e=qi(e),ki(e,t)}function Gi(e,t,n){return e=qi(e),Ti(e,t,n)}function Ki(){if(null!==Ui){var e=Ui;Ui=null,Ci(e)}Qi()}function Qi(){if(!Vi&&null!==Fi){Vi=!0;var e=0;try{var t=Fi;Wi(99,(function(){for(;em?(g=h,h=null):g=h.sibling;var v=f(i,h,a[m],l);if(null===v){null===h&&(h=g);break}e&&h&&null===v.alternate&&t(i,h),s=o(v,s,m),null===u?c=v:u.sibling=v,u=v,h=g}if(m===a.length)return n(i,h),c;if(null===h){for(;mg?(v=m,m=null):v=m.sibling;var w=f(i,m,y.value,c);if(null===w){null===m&&(m=v);break}e&&m&&null===w.alternate&&t(i,m),a=o(w,a,g),null===h?u=w:h.sibling=w,h=w,m=v}if(y.done)return n(i,m),u;if(null===m){for(;!y.done;g++,y=l.next())null!==(y=d(i,y.value,c))&&(a=o(y,a,g),null===h?u=y:h.sibling=y,h=y);return u}for(m=r(i,m);!y.done;g++,y=l.next())null!==(y=p(m,i,g,y.value,c))&&(e&&null!==y.alternate&&m.delete(null===y.key?g:y.key),a=o(y,a,g),null===h?u=y:h.sibling=y,h=y);return e&&m.forEach((function(e){return t(i,e)})),u}return function(e,r,o,l){var c="object"===typeof o&&null!==o&&o.type===k&&null===o.key;c&&(o=o.props.children);var u="object"===typeof o&&null!==o;if(u)switch(o.$$typeof){case S:e:{for(u=o.key,c=r;null!==c;){if(c.key===u){if(7===c.tag){if(o.type===k){n(e,c.sibling),(r=i(c,o.props.children)).return=e,e=r;break e}}else if(c.elementType===o.type){n(e,c.sibling),(r=i(c,o.props)).ref=_o(e,c,o),r.return=e,e=r;break e}n(e,c);break}t(e,c),c=c.sibling}o.type===k?((r=Ql(o.props.children,e.mode,l,o.key)).return=e,e=r):((l=Kl(o.type,o.key,o.props,null,e.mode,l)).ref=_o(e,r,o),l.return=e,e=l)}return a(e);case _:e:{for(c=o.key;null!==r;){if(r.key===c){if(4===r.tag&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),(r=i(r,o.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Xl(o,e.mode,l)).return=e,e=r}return a(e)}if("string"===typeof o||"number"===typeof o)return o=""+o,null!==r&&6===r.tag?(n(e,r.sibling),(r=i(r,o)).return=e,e=r):(n(e,r),(r=Yl(o,e.mode,l)).return=e,e=r),a(e);if(So(o))return m(e,r,o,l);if(z(o))return g(e,r,o,l);if(u&&ko(e,o),"undefined"===typeof o&&!c)switch(e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(s(152,K(e.type)||"Component"))}return n(e,r)}}var Co=To(!0),xo=To(!1),Io={},No=li(Io),Oo=li(Io),Po=li(Io);function Ro(e){if(e===Io)throw Error(s(174));return e}function Ao(e,t){switch(ui(Po,t),ui(Oo,e),ui(No,Io),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:fe(null,"");break;default:t=fe(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}ci(No),ui(No,t)}function Do(){ci(No),ci(Oo),ci(Po)}function Lo(e){Ro(Po.current);var t=Ro(No.current),n=fe(t,e.type);t!==n&&(ui(Oo,e),ui(No,n))}function Mo(e){Oo.current===e&&(ci(No),ci(Oo))}var jo=li(0);function Fo(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(64&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Uo=null,Vo=null,Bo=!1;function zo(e,t){var n=ql(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function Ho(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);default:return!1}}function qo(e){if(Bo){var t=Vo;if(t){var n=t;if(!Ho(e,t)){if(!(t=Kr(n.nextSibling))||!Ho(e,t))return e.flags=-1025&e.flags|2,Bo=!1,void(Uo=e);zo(Uo,n)}Uo=e,Vo=Kr(t.firstChild)}else e.flags=-1025&e.flags|2,Bo=!1,Uo=e}}function Wo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Uo=e}function Go(e){if(e!==Uo)return!1;if(!Bo)return Wo(e),Bo=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!Hr(t,e.memoizedProps))for(t=Vo;t;)zo(e,t),t=Kr(t.nextSibling);if(Wo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(s(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){Vo=Kr(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}Vo=null}}else Vo=Uo?Kr(e.stateNode.nextSibling):null;return!0}function Ko(){Vo=Uo=null,Bo=!1}var Qo=[];function $o(){for(var e=0;eo))throw Error(s(301));o+=1,ts=es=null,t.updateQueue=null,Yo.current=Ds,e=n(r,i)}while(rs)}if(Yo.current=Ps,t=null!==es&&null!==es.next,Jo=0,ts=es=Zo=null,ns=!1,t)throw Error(s(300));return e}function as(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ts?Zo.memoizedState=ts=e:ts=ts.next=e,ts}function ls(){if(null===es){var e=Zo.alternate;e=null!==e?e.memoizedState:null}else e=es.next;var t=null===ts?Zo.memoizedState:ts.next;if(null!==t)ts=t,es=e;else{if(null===e)throw Error(s(310));e={memoizedState:(es=e).memoizedState,baseState:es.baseState,baseQueue:es.baseQueue,queue:es.queue,next:null},null===ts?Zo.memoizedState=ts=e:ts=ts.next=e}return ts}function cs(e,t){return"function"===typeof t?t(e):t}function us(e){var t=ls(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=es,i=r.baseQueue,o=n.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}r.baseQueue=i=o,n.pending=null}if(null!==i){i=i.next,r=r.baseState;var l=a=o=null,c=i;do{var u=c.lane;if((Jo&u)===u)null!==l&&(l=l.next={lane:0,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null}),r=c.eagerReducer===e?c.eagerState:e(r,c.action);else{var h={lane:u,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null};null===l?(a=l=h,o=r):l=l.next=h,Zo.lanes|=u,Ba|=u}c=c.next}while(null!==c&&c!==i);null===l?o=r:l.next=a,cr(r,t.memoizedState)||(Ms=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function hs(e){var t=ls(),n=t.queue;if(null===n)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);cr(o,t.memoizedState)||(Ms=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ds(e,t,n){var r=t._getVersion;r=r(t._source);var i=t._workInProgressVersionPrimary;if(null!==i?e=i===r:(e=e.mutableReadLanes,(e=(Jo&e)===e)&&(t._workInProgressVersionPrimary=r,Qo.push(t))),e)return n(t._source);throw Qo.push(t),Error(s(350))}function fs(e,t,n,r){var i=Aa;if(null===i)throw Error(s(349));var o=t._getVersion,a=o(t._source),l=Yo.current,c=l.useState((function(){return ds(i,t,n)})),u=c[1],h=c[0];c=ts;var d=e.memoizedState,f=d.refs,p=f.getSnapshot,m=d.source;d=d.subscribe;var g=Zo;return e.memoizedState={refs:f,source:t,subscribe:r},l.useEffect((function(){f.getSnapshot=n,f.setSnapshot=u;var e=o(t._source);if(!cr(a,e)){e=n(t._source),cr(h,e)||(u(e),e=fl(g),i.mutableReadLanes|=e&i.pendingLanes),e=i.mutableReadLanes,i.entangledLanes|=e;for(var r=i.entanglements,s=e;0n?98:n,(function(){e(!0)})),Wi(97<\/script>",e=e.removeChild(e.firstChild)):"string"===typeof r.is?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),"select"===n&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[Xr]=t,e[Jr]=r,Ks(e,t,!1,!1),t.stateNode=e,c=ke(n,r),n){case"dialog":Nr("cancel",e),Nr("close",e),o=r;break;case"iframe":case"object":case"embed":Nr("load",e),o=r;break;case"video":case"audio":for(o=0;oGa&&(t.flags|=64,a=!0,sa(r,!1),t.lanes=33554432)}else{if(!a)if(null!==(e=Fo(c))){if(t.flags|=64,a=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),sa(r,!0),null===r.tail&&"hidden"===r.tailMode&&!c.alternate&&!Bo)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*zi()-r.renderingStartTime>Ga&&1073741824!==n&&(t.flags|=64,a=!0,sa(r,!1),t.lanes=33554432);r.isBackwards?(c.sibling=t.child,t.child=c):(null!==(n=r.last)?n.sibling=c:t.child=c,r.last=c)}return null!==r.tail?(n=r.tail,r.rendering=n,r.tail=n.sibling,r.lastEffect=t.lastEffect,r.renderingStartTime=zi(),n.sibling=null,t=jo.current,ui(jo,a?1&t|2:1&t),n):null;case 23:case 24:return _l(),null!==e&&null!==e.memoizedState!==(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==r.mode&&(t.flags|=4),null}throw Error(s(156,t.tag))}function la(e){switch(e.tag){case 1:gi(e.type)&&vi();var t=e.flags;return 4096&t?(e.flags=-4097&t|64,e):null;case 3:if(Do(),ci(fi),ci(di),$o(),0!==(64&(t=e.flags)))throw Error(s(285));return e.flags=-4097&t|64,e;case 5:return Mo(e),null;case 13:return ci(jo),4096&(t=e.flags)?(e.flags=-4097&t|64,e):null;case 19:return ci(jo),null;case 4:return Do(),null;case 10:return no(e),null;case 23:case 24:return _l(),null;default:return null}}function ca(e,t){try{var n="",r=t;do{n+=G(r),r=r.return}while(r);var i=n}catch(o){i="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:i}}function ua(e,t){try{console.error(t.value)}catch(n){setTimeout((function(){throw n}))}}Ks=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Qs=function(){},$s=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Ro(No.current);var s,a=null;switch(n){case"input":o=Z(e,o),r=Z(e,r),a=[];break;case"option":o=oe(e,o),r=oe(e,r),a=[];break;case"select":o=i({},o,{value:void 0}),r=i({},r,{value:void 0}),a=[];break;case"textarea":o=ae(e,o),r=ae(e,r),a=[];break;default:"function"!==typeof o.onClick&&"function"===typeof r.onClick&&(e.onclick=Ur)}for(h in _e(n,r),n=null,o)if(!r.hasOwnProperty(h)&&o.hasOwnProperty(h)&&null!=o[h])if("style"===h){var c=o[h];for(s in c)c.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else"dangerouslySetInnerHTML"!==h&&"children"!==h&&"suppressContentEditableWarning"!==h&&"suppressHydrationWarning"!==h&&"autoFocus"!==h&&(l.hasOwnProperty(h)?a||(a=[]):(a=a||[]).push(h,null));for(h in r){var u=r[h];if(c=null!=o?o[h]:void 0,r.hasOwnProperty(h)&&u!==c&&(null!=u||null!=c))if("style"===h)if(c){for(s in c)!c.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in u)u.hasOwnProperty(s)&&c[s]!==u[s]&&(n||(n={}),n[s]=u[s])}else n||(a||(a=[]),a.push(h,n)),n=u;else"dangerouslySetInnerHTML"===h?(u=u?u.__html:void 0,c=c?c.__html:void 0,null!=u&&c!==u&&(a=a||[]).push(h,u)):"children"===h?"string"!==typeof u&&"number"!==typeof u||(a=a||[]).push(h,""+u):"suppressContentEditableWarning"!==h&&"suppressHydrationWarning"!==h&&(l.hasOwnProperty(h)?(null!=u&&"onScroll"===h&&Nr("scroll",e),a||c===u||(a=[])):"object"===typeof u&&null!==u&&u.$$typeof===L?u.toString():(a=a||[]).push(h,u))}n&&(a=a||[]).push("style",n);var h=a;(t.updateQueue=h)&&(t.flags|=4)}},Ys=function(e,t,n,r){n!==r&&(t.flags|=4)};var ha="function"===typeof WeakMap?WeakMap:Map;function da(e,t,n){(n=co(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ya||(Ya=!0,Xa=r),ua(0,t)},n}function fa(e,t,n){(n=co(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"===typeof r){var i=t.value;n.payload=function(){return ua(0,t),r(i)}}var o=e.stateNode;return null!==o&&"function"===typeof o.componentDidCatch&&(n.callback=function(){"function"!==typeof r&&(null===Ja?Ja=new Set([this]):Ja.add(this),ua(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}var pa="function"===typeof WeakSet?WeakSet:Set;function ma(e){var t=e.ref;if(null!==t)if("function"===typeof t)try{t(null)}catch(n){Vl(e,n)}else t.current=null}function ga(e,t){switch(t.tag){case 0:case 11:case 15:case 22:case 5:case 6:case 4:case 17:return;case 1:if(256&t.flags&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:Yi(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(256&t.flags&&Gr(t.stateNode.containerInfo))}throw Error(s(163))}function va(e,t,n){switch(n.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3===(3&e.tag)){var r=e.create;e.destroy=r()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var i=e;r=i.next,0!==(4&(i=i.tag))&&0!==(1&i)&&(jl(n,e),Ml(n,e)),e=r}while(e!==t)}return;case 1:return e=n.stateNode,4&n.flags&&(null===t?e.componentDidMount():(r=n.elementType===n.type?t.memoizedProps:Yi(n.type,t.memoizedProps),e.componentDidUpdate(r,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=n.updateQueue)&&po(n,t,e));case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:case 1:e=n.child.stateNode}po(n,t,e)}return;case 5:return e=n.stateNode,void(null===t&&4&n.flags&&zr(n.type,n.memoizedProps)&&e.focus());case 6:case 4:case 12:case 19:case 17:case 20:case 21:case 23:case 24:return;case 13:return void(null===n.memoizedState&&(n=n.alternate,null!==n&&(n=n.memoizedState,null!==n&&(n=n.dehydrated,null!==n&&Et(n)))))}throw Error(s(163))}function ya(e,t){for(var n=e;;){if(5===n.tag){var r=n.stateNode;if(t)"function"===typeof(r=r.style).setProperty?r.setProperty("display","none","important"):r.display="none";else{r=n.stateNode;var i=n.memoizedProps.style;i=void 0!==i&&null!==i&&i.hasOwnProperty("display")?i.display:null,r.style.display=be("display",i)}}else if(6===n.tag)n.stateNode.nodeValue=t?"":n.memoizedProps;else if((23!==n.tag&&24!==n.tag||null===n.memoizedState||n===e)&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function wa(e,t){if(_i&&"function"===typeof _i.onCommitFiberUnmount)try{_i.onCommitFiberUnmount(Si,t)}catch(o){}switch(t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var n=e=e.next;do{var r=n,i=r.destroy;if(r=r.tag,void 0!==i)if(0!==(4&r))jl(t,n);else{r=t;try{i()}catch(o){Vl(r,o)}}n=n.next}while(n!==e)}break;case 1:if(ma(t),"function"===typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(o){Vl(t,o)}break;case 5:ma(t);break;case 4:Ta(e,t)}}function ba(e){e.alternate=null,e.child=null,e.dependencies=null,e.firstEffect=null,e.lastEffect=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.return=null,e.updateQueue=null}function Ea(e){return 5===e.tag||3===e.tag||4===e.tag}function Sa(e){e:{for(var t=e.return;null!==t;){if(Ea(t))break e;t=t.return}throw Error(s(160))}var n=t;switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw Error(s(161))}16&n.flags&&(ve(t,""),n.flags&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||Ea(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.flags)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.flags)){n=n.stateNode;break e}}r?_a(e,n,t):ka(e,n,t)}function _a(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!==(n=n._reactRootContainer)&&void 0!==n||null!==t.onclick||(t.onclick=Ur));else if(4!==r&&null!==(e=e.child))for(_a(e,t,n),e=e.sibling;null!==e;)_a(e,t,n),e=e.sibling}function ka(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(ka(e,t,n),e=e.sibling;null!==e;)ka(e,t,n),e=e.sibling}function Ta(e,t){for(var n,r,i=t,o=!1;;){if(!o){o=i.return;e:for(;;){if(null===o)throw Error(s(160));switch(n=o.stateNode,o.tag){case 5:r=!1;break e;case 3:case 4:n=n.containerInfo,r=!0;break e}o=o.return}o=!0}if(5===i.tag||6===i.tag){e:for(var a=e,l=i,c=l;;)if(wa(a,c),null!==c.child&&4!==c.tag)c.child.return=c,c=c.child;else{if(c===l)break e;for(;null===c.sibling;){if(null===c.return||c.return===l)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}r?(a=n,l=i.stateNode,8===a.nodeType?a.parentNode.removeChild(l):a.removeChild(l)):n.removeChild(i.stateNode)}else if(4===i.tag){if(null!==i.child){n=i.stateNode.containerInfo,r=!0,i.child.return=i,i=i.child;continue}}else if(wa(e,i),null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;4===(i=i.return).tag&&(o=!1)}i.sibling.return=i.return,i=i.sibling}}function Ca(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:var n=t.updateQueue;if(null!==(n=null!==n?n.lastEffect:null)){var r=n=n.next;do{3===(3&r.tag)&&(e=r.destroy,r.destroy=void 0,void 0!==e&&e()),r=r.next}while(r!==n)}return;case 1:case 12:case 17:return;case 5:if(null!=(n=t.stateNode)){r=t.memoizedProps;var i=null!==e?e.memoizedProps:r;e=t.type;var o=t.updateQueue;if(t.updateQueue=null,null!==o){for(n[Jr]=r,"input"===e&&"radio"===r.type&&null!=r.name&&te(n,r),ke(e,i),t=ke(e,r),i=0;ii&&(i=a),n&=~o}if(n=i,10<(n=(120>(n=zi()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Na(n/1960))-n)){e.timeoutHandle=qr(Rl.bind(null,e),n);break}Rl(e);break;default:throw Error(s(329))}}return gl(e,zi()),e.callbackNode===t?vl.bind(null,e):null}function yl(e,t){for(t&=~Ha,t&=~za,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0 component higher in the tree to provide a loading indicator or placeholder to display.")}5!==Fa&&(Fa=2),l=ca(l,a),d=s;do{switch(d.tag){case 3:o=l,d.flags|=4096,t&=-t,d.lanes|=t,ho(d,da(0,o,t));break e;case 1:o=l;var E=d.type,S=d.stateNode;if(0===(64&d.flags)&&("function"===typeof E.getDerivedStateFromError||null!==S&&"function"===typeof S.componentDidCatch&&(null===Ja||!Ja.has(S)))){d.flags|=4096,t&=-t,d.lanes|=t,ho(d,fa(d,o,t));break e}}d=d.return}while(null!==d)}Pl(n)}catch(_){t=_,Da===n&&null!==n&&(Da=n=n.return);continue}break}}function Cl(){var e=Oa.current;return Oa.current=Ps,null===e?Ps:e}function xl(e,t){var n=Ra;Ra|=16;var r=Cl();for(Aa===e&&La===t||kl(e,t);;)try{Il();break}catch(i){Tl(e,i)}if(to(),Ra=n,Oa.current=r,null!==Da)throw Error(s(261));return Aa=null,La=0,Fa}function Il(){for(;null!==Da;)Ol(Da)}function Nl(){for(;null!==Da&&!xi();)Ol(Da)}function Ol(e){var t=Qa(e.alternate,e,Ma);e.memoizedProps=e.pendingProps,null===t?Pl(e):Da=t,Pa.current=null}function Pl(e){var t=e;do{var n=t.alternate;if(e=t.return,0===(2048&t.flags)){if(null!==(n=aa(n,t,Ma)))return void(Da=n);if(24!==(n=t).tag&&23!==n.tag||null===n.memoizedState||0!==(1073741824&Ma)||0===(4&n.mode)){for(var r=0,i=n.child;null!==i;)r|=i.lanes|i.childLanes,i=i.sibling;n.childLanes=r}null!==e&&0===(2048&e.flags)&&(null===e.firstEffect&&(e.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=t.firstEffect),e.lastEffect=t.lastEffect),1a&&(l=a,a=S,S=l),l=fr(w,S),o=fr(w,a),l&&o&&(1!==E.rangeCount||E.anchorNode!==l.node||E.anchorOffset!==l.offset||E.focusNode!==o.node||E.focusOffset!==o.offset)&&((b=b.createRange()).setStart(l.node,l.offset),E.removeAllRanges(),S>a?(E.addRange(b),E.extend(o.node,o.offset)):(b.setEnd(o.node,o.offset),E.addRange(b))))),b=[];for(E=w;E=E.parentNode;)1===E.nodeType&&b.push({element:E,left:E.scrollLeft,top:E.scrollTop});for("function"===typeof w.focus&&w.focus(),w=0;wzi()-Wa?kl(e,0):Ha|=n),gl(e,t)}function zl(e,t){var n=e.stateNode;null!==n&&n.delete(t),0===(t=0)&&(0===(2&(t=e.mode))?t=1:0===(4&t)?t=99===Hi()?1:2:(0===ll&&(ll=Va),0===(t=Vt(62914560&~ll))&&(t=4194304))),n=dl(),null!==(e=ml(e,t))&&(zt(e,t,n),gl(e,n))}function Hl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function ql(e,t,n,r){return new Hl(e,t,n,r)}function Wl(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Gl(e,t){var n=e.alternate;return null===n?((n=ql(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Kl(e,t,n,r,i,o){var a=2;if(r=e,"function"===typeof e)Wl(e)&&(a=1);else if("string"===typeof e)a=5;else e:switch(e){case k:return Ql(n.children,i,o,t);case M:a=8,i|=16;break;case T:a=8,i|=1;break;case C:return(e=ql(12,n,t,8|i)).elementType=C,e.type=C,e.lanes=o,e;case O:return(e=ql(13,n,t,i)).type=O,e.elementType=O,e.lanes=o,e;case P:return(e=ql(19,n,t,i)).elementType=P,e.lanes=o,e;case j:return $l(n,i,o,t);case F:return(e=ql(24,n,t,i)).elementType=F,e.lanes=o,e;default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case x:a=10;break e;case I:a=9;break e;case N:a=11;break e;case R:a=14;break e;case A:a=16,r=null;break e;case D:a=22;break e}throw Error(s(130,null==e?e:typeof e,""))}return(t=ql(a,n,t,i)).elementType=e,t.type=r,t.lanes=o,t}function Ql(e,t,n,r){return(e=ql(7,e,r,t)).lanes=n,e}function $l(e,t,n,r){return(e=ql(23,e,r,t)).elementType=j,e.lanes=n,e}function Yl(e,t,n){return(e=ql(6,e,null,t)).lanes=n,e}function Xl(e,t,n){return(t=ql(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Jl(e,t,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=Bt(0),this.expirationTimes=Bt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bt(0),this.mutableSourceEagerHydrationData=null}function Zl(e,t,n,r){var i=t.current,o=dl(),a=fl(i);e:if(n){t:{if($e(n=n._reactInternals)!==n||1!==n.tag)throw Error(s(170));var l=n;do{switch(l.tag){case 3:l=l.stateNode.context;break t;case 1:if(gi(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break t}}l=l.return}while(null!==l);throw Error(s(171))}if(1===n.tag){var c=n.type;if(gi(c)){n=wi(n,c,l);break e}}n=l}else n=hi;return null===t.context?t.context=n:t.pendingContext=n,(t=co(o,a)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),uo(i,t),pl(i,a,o),a}function ec(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function tc(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n{"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(730)},82:(e,t)=>{"use strict";var n="function"===typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,i=n?Symbol.for("react.portal"):60106,o=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,a=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,h=n?Symbol.for("react.concurrent_mode"):60111,d=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,m=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,v=n?Symbol.for("react.block"):60121,y=n?Symbol.for("react.fundamental"):60117,w=n?Symbol.for("react.responder"):60118,b=n?Symbol.for("react.scope"):60119;function E(e){if("object"===typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case h:case o:case a:case s:case f:return e;default:switch(e=e&&e.$$typeof){case c:case d:case g:case m:case l:return e;default:return t}}case i:return t}}}function S(e){return E(e)===h}t.AsyncMode=u,t.ConcurrentMode=h,t.ContextConsumer=c,t.ContextProvider=l,t.Element=r,t.ForwardRef=d,t.Fragment=o,t.Lazy=g,t.Memo=m,t.Portal=i,t.Profiler=a,t.StrictMode=s,t.Suspense=f,t.isAsyncMode=function(e){return S(e)||E(e)===u},t.isConcurrentMode=S,t.isContextConsumer=function(e){return E(e)===c},t.isContextProvider=function(e){return E(e)===l},t.isElement=function(e){return"object"===typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return E(e)===d},t.isFragment=function(e){return E(e)===o},t.isLazy=function(e){return E(e)===g},t.isMemo=function(e){return E(e)===m},t.isPortal=function(e){return E(e)===i},t.isProfiler=function(e){return E(e)===a},t.isStrictMode=function(e){return E(e)===s},t.isSuspense=function(e){return E(e)===f},t.isValidElementType=function(e){return"string"===typeof e||"function"===typeof e||e===o||e===h||e===a||e===s||e===f||e===p||"object"===typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===m||e.$$typeof===l||e.$$typeof===c||e.$$typeof===d||e.$$typeof===y||e.$$typeof===w||e.$$typeof===b||e.$$typeof===v)},t.typeOf=E},86:(e,t,n)=>{"use strict";e.exports=n(82)},153:(e,t,n)=>{"use strict";n(123);var r=n(43),i=60103;if(t.Fragment=60107,"function"===typeof Symbol&&Symbol.for){var o=Symbol.for;i=o("react.element"),t.Fragment=o("react.fragment")}var s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a=Object.prototype.hasOwnProperty,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,o={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!l.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:i,type:e,key:c,ref:u,props:o,_owner:s.current}}t.jsx=c,t.jsxs=c},202:(e,t,n)=>{"use strict";var r=n(123),i=60103,o=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var s=60109,a=60110,l=60112;t.Suspense=60113;var c=60115,u=60116;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;i=h("react.element"),o=h("react.portal"),t.Fragment=h("react.fragment"),t.StrictMode=h("react.strict_mode"),t.Profiler=h("react.profiler"),s=h("react.provider"),a=h("react.context"),l=h("react.forward_ref"),t.Suspense=h("react.suspense"),c=h("react.memo"),u=h("react.lazy")}var d="function"===typeof Symbol&&Symbol.iterator;function f(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n{"use strict";e.exports=n(202)},579:(e,t,n)=>{"use strict";e.exports=n(153)},234:(e,t)=>{"use strict";var n,r,i,o;if("object"===typeof performance&&"function"===typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}if("undefined"===typeof window||"function"!==typeof MessageChannel){var c=null,u=null,h=function(){if(null!==c)try{var e=t.unstable_now();c(!0,e),c=null}catch(n){throw setTimeout(h,0),n}};n=function(e){null!==c?setTimeout(n,0,e):(c=e,setTimeout(h,0))},r=function(e,t){u=setTimeout(e,t)},i=function(){clearTimeout(u)},t.unstable_shouldYield=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var d=window.setTimeout,f=window.clearTimeout;if("undefined"!==typeof console){var p=window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!==typeof p&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var m=!1,g=null,v=-1,y=5,w=0;t.unstable_shouldYield=function(){return t.unstable_now()>=w},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125>>1,i=e[r];if(!(void 0!==i&&0T(s,n))void 0!==l&&0>T(l,s)?(e[r]=l,e[a]=n,r=a):(e[r]=s,e[o]=n,r=o);else{if(!(void 0!==l&&0>T(l,n)))break e;e[r]=l,e[a]=n,r=a}}}return t}return null}function T(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var C=[],x=[],I=1,N=null,O=3,P=!1,R=!1,A=!1;function D(e){for(var t=_(x);null!==t;){if(null===t.callback)k(x);else{if(!(t.startTime<=e))break;k(x),t.sortIndex=t.expirationTime,S(C,t)}t=_(x)}}function L(e){if(A=!1,D(e),!R)if(null!==_(C))R=!0,n(M);else{var t=_(x);null!==t&&r(L,t.startTime-e)}}function M(e,n){R=!1,A&&(A=!1,i()),P=!0;var o=O;try{for(D(n),N=_(C);null!==N&&(!(N.expirationTime>n)||e&&!t.unstable_shouldYield());){var s=N.callback;if("function"===typeof s){N.callback=null,O=N.priorityLevel;var a=s(N.expirationTime<=n);n=t.unstable_now(),"function"===typeof a?N.callback=a:N===_(C)&&k(C),D(n)}else k(C);N=_(C)}if(null!==N)var l=!0;else{var c=_(x);null!==c&&r(L,c.startTime-n),l=!1}return l}finally{N=null,O=o,P=!1}}var j=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){R||P||(R=!0,n(M))},t.unstable_getCurrentPriorityLevel=function(){return O},t.unstable_getFirstCallbackNode=function(){return _(C)},t.unstable_next=function(e){switch(O){case 1:case 2:case 3:var t=3;break;default:t=O}var n=O;O=t;try{return e()}finally{O=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=j,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=O;O=e;try{return t()}finally{O=n}},t.unstable_scheduleCallback=function(e,o,s){var a=t.unstable_now();switch("object"===typeof s&&null!==s?s="number"===typeof(s=s.delay)&&0a?(e.sortIndex=s,S(x,e),null===_(C)&&e===_(x)&&(A?i():A=!0,r(L,s-a))):(e.sortIndex=l,S(C,e),R||P||(R=!0,n(M))),e},t.unstable_wrapCallback=function(e){var t=O;return function(){var n=O;O=t;try{return e.apply(this,arguments)}finally{O=n}}}},853:(e,t,n)=>{"use strict";e.exports=n(234)},440:e=>{"use strict";var t=function(){};e.exports=t}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;n.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"===typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"===typeof r.then)return r}var o=Object.create(null);n.r(o);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&r;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>s[e]=()=>r[e]));return s.default=()=>r,n.d(o,s),o}})(),n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e=n(43),t=n.t(e,2),r=n(950),i=n.t(r,2),o=e.createContext(null);var s=function(e){e()},a=function(){return s};var l={notify:function(){},get:function(){return[]}};function c(e,t){var n,r=l;function i(){s.onStateChange&&s.onStateChange()}function o(){n||(n=t?t.addNestedSub(i):e.subscribe(i),r=function(){var e=a(),t=null,n=null;return{clear:function(){t=null,n=null},notify:function(){e((function(){for(var e=t;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],n=t;n;)e.push(n),n=n.next;return e},subscribe:function(e){var r=!0,i=n={callback:e,next:null,prev:n};return i.prev?i.prev.next=i:t=i,function(){r&&null!==t&&(r=!1,i.next?i.next.prev=i.prev:n=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}())}var s={addNestedSub:function(e){return o(),r.subscribe(e)},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:i,isSubscribed:function(){return Boolean(n)},trySubscribe:o,tryUnsubscribe:function(){n&&(n(),n=void 0,r.clear(),r=l)},getListeners:function(){return r}};return s}var u="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?e.useLayoutEffect:e.useEffect;const h=function(t){var n=t.store,r=t.context,i=t.children,s=(0,e.useMemo)((function(){var e=c(n);return e.onStateChange=e.notifyNestedSubs,{store:n,subscription:e}}),[n]),a=(0,e.useMemo)((function(){return n.getState()}),[n]);u((function(){var e=s.subscription;return e.trySubscribe(),a!==n.getState()&&e.notifyNestedSubs(),function(){e.tryUnsubscribe(),e.onStateChange=null}}),[s,a]);var l=r||o;return e.createElement(l.Provider,{value:s},i)};n(219),n(86);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t>6|192,t[n++]=63&i|128):55296===(64512&i)&&r+1>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},T={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"===typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i>2,u=(3&t)<<4|s>>4;let h=(15&s)<<2|l>>6,d=63&l;a||(d=64,o||(h=64)),r.push(n[c],n[u],n[h],n[d])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(k(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n191&&i<224){const o=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){const o=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(o>>10)),t[r++]=String.fromCharCode(56320+(1023&o))}else{const o=e[n++],s=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&s)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i>4;if(r.push(l),64!==s){const e=o<<4&240|s>>2;if(r.push(e),64!==a){const e=s<<6&192|a;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class C extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const x=function(e){return function(e){const t=k(e);return T.encodeByteArray(t,!0)}(e).replace(/\./g,"")},I=function(e){try{return T.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};const N=()=>function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof n.g)return n.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,O=()=>{try{return N()||(()=>{if("undefined"===typeof process)return;const e={NODE_ENV:"production",PUBLIC_URL:"/backgammon",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"===typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(n){return}const t=e&&I(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info("Unable to get __FIREBASE_DEFAULTS__ due to: ".concat(e))}},P=e=>{var t,n;return null===(n=null===(t=O())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},R=e=>{const t=P(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error("Invalid host ".concat(t," with no separate hostname and port!"));const r=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),r]:[t.substring(0,n),r]},A=()=>{var e;return null===(e=O())||void 0===e?void 0:e.config},D=e=>{var t;return null===(t=O())||void 0===t?void 0:t["_".concat(e)]};class L{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"===typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}function M(){return"undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:""}function j(){return!function(){var e;const t=null===(e=O())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(n.g.process)}catch(r){return!1}}()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function F(){try{return"object"===typeof indexedDB}catch(e){return!1}}class U extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,U.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,V.prototype.create)}}class V{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e){const t=(arguments.length<=1?void 0:arguments[1])||{},n="".concat(this.service,"/").concat(e),r=this.errors[e],i=r?function(e,t){return e.replace(B,((e,n)=>{const r=t[n];return null!=r?String(r):"<".concat(n,"?>")}))}(r,t):"Error",o="".concat(this.serviceName,": ").concat(i," (").concat(n,").");return new U(n,o,t)}}const B=/\{\$([^}]+)}/g;function z(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const i of n){if(!r.includes(i))return!1;const n=e[i],o=t[i];if(H(n)&&H(o)){if(!z(n,o))return!1}else if(n!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function H(e){return null!==e&&"object"===typeof e}function q(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach((e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))})):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function W(e){const t={};return e.replace(/^\?/,"").split("&").forEach((e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}})),t}function G(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class K{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((()=>{e(this)})).catch((e=>{this.error(e)}))}next(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}complete(){this.forEachObserver((e=>{e.complete()})),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!==typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"===typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=Q),void 0===r.error&&(r.error=Q),void 0===r.complete&&(r.complete=Q);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}})),this.observers.push(r),i}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(n){"undefined"!==typeof console&&console.error&&console.error(n)}}))}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function Q(){}function $(e){return e&&e._delegate?e._delegate:e}class Y{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const X="[DEFAULT]";class J{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new L;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(n){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null===e||void 0===e?void 0:e.identifier),r=null!==(t=null===e||void 0===e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error("Service ".concat(this.name," is not available"))}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error("Mismatching Component ".concat(e.name," for Provider ").concat(this.name,"."));if(this.component)throw Error("Component for ".concat(this.name," has already been provided"));if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:X})}catch(t){}for(const[e,n]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:r});n.resolve(e)}catch(t){}}}}clearInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;return this.instances.has(e)}getOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;return this.instancesOptions.get(e)||{}}initialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error("".concat(this.name,"(").concat(n,") has already been initialized"));if(!this.isComponentSet())throw Error("Component ".concat(this.name," has not been registered yet"));const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[i,o]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(i)&&o.resolve(r)}return r}onInit(e,t){var n;const r=this.normalizeInstanceIdentifier(t),i=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;i.add(e),this.onInitCallbacks.set(r,i);const o=this.instances.get(r);return o&&e(o,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const i of n)try{i(e,t)}catch(r){}}getOrInitializeService(e){let{instanceIdentifier:t,options:n={}}=e,r=this.instances.get(t);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(i=t,i===X?void 0:i),options:n}),this.instances.set(t,r),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(r,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,r)}catch(o){}var i;return r||null}normalizeInstanceIdentifier(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;return this.component?this.component.multipleInstances?e:X:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class Z{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error("Component ".concat(e.name," has already been registered with ").concat(this.name));t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new J(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const ee=[];var te;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(te||(te={}));const ne={debug:te.DEBUG,verbose:te.VERBOSE,info:te.INFO,warn:te.WARN,error:te.ERROR,silent:te.SILENT},re=te.INFO,ie={[te.DEBUG]:"log",[te.VERBOSE]:"log",[te.INFO]:"info",[te.WARN]:"warn",[te.ERROR]:"error"},oe=function(e,t){if(t2?i-2:0),s=2;st.some((t=>e instanceof t));let le,ce;const ue=new WeakMap,he=new WeakMap,de=new WeakMap,fe=new WeakMap,pe=new WeakMap;let me={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return he.get(e);if("objectStoreNames"===t)return e.objectStoreNames||de.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return ye(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function ge(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(ce||(ce=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(){for(var t=arguments.length,n=new Array(t),r=0;r1?n-1:0),i=1;i{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)}));he.set(e,t)}(e),ae(e,le||(le=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,me):e)}function ye(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(ye(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)}));return t.then((t=>{t instanceof IDBCursor&&ue.set(t,e)})).catch((()=>{})),pe.set(t,e),t}(e);if(fe.has(e))return fe.get(e);const t=ve(e);return t!==e&&(fe.set(e,t),pe.set(t,e)),t}const we=e=>pe.get(e);const be=["get","getKey","getAll","getAllKeys","count"],Ee=["put","add","delete","clear"],Se=new Map;function _e(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!==typeof t)return;if(Se.get(t))return Se.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=Ee.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!be.includes(n))return;const o=async function(e){const t=this.transaction(e,i?"readwrite":"readonly");let o=t.store;for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l({...e,get:(t,n,r)=>_e(t,n)||e.get(t,n,r),has:(t,n)=>!!_e(t,n)||e.has(t,n)}))(me);class ke{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null===t||void 0===t?void 0:t.type)}(e)){const t=e.getImmediate();return"".concat(t.library,"/").concat(t.version)}return null})).filter((e=>e)).join(" ")}}const Te="@firebase/app",Ce="0.9.27",xe=new se("@firebase/app"),Ie="@firebase/app-compat",Ne="@firebase/analytics-compat",Oe="@firebase/analytics",Pe="@firebase/app-check-compat",Re="@firebase/app-check",Ae="@firebase/auth",De="@firebase/auth-compat",Le="@firebase/database",Me="@firebase/database-compat",je="@firebase/functions",Fe="@firebase/functions-compat",Ue="@firebase/installations",Ve="@firebase/installations-compat",Be="@firebase/messaging",ze="@firebase/messaging-compat",He="@firebase/performance",qe="@firebase/performance-compat",We="@firebase/remote-config",Ge="@firebase/remote-config-compat",Ke="@firebase/storage",Qe="@firebase/storage-compat",$e="@firebase/firestore",Ye="@firebase/firestore-compat",Xe="firebase",Je="[DEFAULT]",Ze={[Te]:"fire-core",[Ie]:"fire-core-compat",[Oe]:"fire-analytics",[Ne]:"fire-analytics-compat",[Re]:"fire-app-check",[Pe]:"fire-app-check-compat",[Ae]:"fire-auth",[De]:"fire-auth-compat",[Le]:"fire-rtdb",[Me]:"fire-rtdb-compat",[je]:"fire-fn",[Fe]:"fire-fn-compat",[Ue]:"fire-iid",[Ve]:"fire-iid-compat",[Be]:"fire-fcm",[ze]:"fire-fcm-compat",[He]:"fire-perf",[qe]:"fire-perf-compat",[We]:"fire-rc",[Ge]:"fire-rc-compat",[Ke]:"fire-gcs",[Qe]:"fire-gcs-compat",[$e]:"fire-fst",[Ye]:"fire-fst-compat","fire-js":"fire-js",[Xe]:"fire-js-all"},et=new Map,tt=new Map;function nt(e,t){try{e.container.addComponent(t)}catch(n){xe.debug("Component ".concat(t.name," failed to register with FirebaseApp ").concat(e.name),n)}}function rt(e){const t=e.name;if(tt.has(t))return xe.debug("There were multiple attempts to register component ".concat(t,".")),!1;tt.set(t,e);for(const n of et.values())nt(n,e);return!0}function it(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}const ot=new V("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});class st{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new Y("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw ot.create("app-deleted",{appName:this._name})}}const at="10.8.0";function lt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;if("object"!==typeof t){t={name:t}}const r=Object.assign({name:Je,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!==typeof i||!i)throw ot.create("bad-app-name",{appName:String(i)});if(n||(n=A()),!n)throw ot.create("no-options");const o=et.get(i);if(o){if(z(n,o.options)&&z(r,o.config))return o;throw ot.create("duplicate-app",{appName:i})}const s=new Z(i);for(const l of tt.values())s.addComponent(l);const a=new st(n,r,s);return et.set(i,a),a}function ct(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Je;const t=et.get(e);if(!t&&e===Je&&A())return lt();if(!t)throw ot.create("no-app",{appName:e});return t}function ut(e,t,n){var r;let i=null!==(r=Ze[e])&&void 0!==r?r:e;n&&(i+="-".concat(n));const o=i.match(/\s|\//),s=t.match(/\s|\//);if(o||s){const e=['Unable to register library "'.concat(i,'" with version "').concat(t,'":')];return o&&e.push('library name "'.concat(i,'" contains illegal characters (whitespace or "/")')),o&&s&&e.push("and"),s&&e.push('version name "'.concat(t,'" contains illegal characters (whitespace or "/")')),void xe.warn(e.join(" "))}rt(new Y("".concat(i,"-version"),(()=>({library:i,version:t})),"VERSION"))}const ht="firebase-heartbeat-database",dt=1,ft="firebase-heartbeat-store";let pt=null;function mt(){return pt||(pt=function(e,t){let{blocked:n,upgrade:r,blocking:i,terminated:o}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=indexedDB.open(e,t),a=ye(s);return r&&s.addEventListener("upgradeneeded",(e=>{r(ye(s.result),e.oldVersion,e.newVersion,ye(s.transaction),e)})),n&&s.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),a.then((e=>{o&&e.addEventListener("close",(()=>o())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),a}(ht,dt,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(ft)}catch(n){console.warn(n)}}}).catch((e=>{throw ot.create("idb-open",{originalErrorMessage:e.message})}))),pt}async function gt(e,t){try{const n=(await mt()).transaction(ft,"readwrite"),r=n.objectStore(ft);await r.put(t,vt(e)),await n.done}catch(n){if(n instanceof U)xe.warn(n.message);else{const e=ot.create("idb-set",{originalErrorMessage:null===n||void 0===n?void 0:n.message});xe.warn(e.message)}}}function vt(e){return"".concat(e.name,"!").concat(e.options.appId)}class yt{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new bt(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){var e,t;const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=wt();if((null!=(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||(this._heartbeatsCache=await this._heartbeatsCachePromise,null!=(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))&&this._heartbeatsCache.lastSentHeartbeatDate!==r&&!this._heartbeatsCache.heartbeats.some((e=>e.date===r)))return this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var e;if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=wt(),{heartbeatsToSend:n,unsentEntries:r}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024;const n=[];let r=e.slice();for(const i of e){const e=n.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),Et(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Et(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),i=x(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function wt(){return(new Date).toISOString().substring(0,10)}class bt{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!F()&&new Promise(((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(n){t(n)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await mt()).transaction(ft),n=await t.objectStore(ft).get(vt(e));return await t.done,n}catch(t){if(t instanceof U)xe.warn(t.message);else{const e=ot.create("idb-get",{originalErrorMessage:null===t||void 0===t?void 0:t.message});xe.warn(e.message)}}}(this.app);return(null===e||void 0===e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return gt(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return gt(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function Et(e){return x(JSON.stringify({version:2,heartbeats:e})).length}var St;St="",rt(new Y("platform-logger",(e=>new ke(e)),"PRIVATE")),rt(new Y("heartbeat",(e=>new yt(e)),"PRIVATE")),ut(Te,Ce,St),ut(Te,Ce,"esm2017"),ut("fire-js","");function _t(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r2?n-2:0),i=2;ie,"Short delay should be less than long delay!"),this.isMobile="undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(M())||"object"===typeof navigator&&"ReactNative"===navigator.product}get(){return Ut()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Bt(e,t){Lt(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?"".concat(n).concat(t.startsWith("/")?t.slice(1):t):n}class zt{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!==typeof self&&"fetch"in self?self.fetch:"undefined"!==typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!==typeof fetch?fetch:void Dt("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!==typeof self&&"Headers"in self?self.Headers:"undefined"!==typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!==typeof Headers?Headers:void Dt("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!==typeof self&&"Response"in self?self.Response:"undefined"!==typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!==typeof Response?Response:void Dt("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Ht={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},qt=new Vt(3e4,6e4);function Wt(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function Gt(e,t,n,r){return Kt(e,arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},(async()=>{let i={},o={};r&&("GET"===t?o=r:i={body:JSON.stringify(r)});const s=q(Object.assign({key:e.config.apiKey},o)).slice(1),a=await e._getAdditionalHeaders();return a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode),zt.fetch()($t(e,e.config.apiHost,n,s),Object.assign({method:t,headers:a,referrerPolicy:"no-referrer"},i))}))}async function Kt(e,t,n){e._canInitEmulator=!1;const r=Object.assign(Object.assign({},Ht),t);try{const t=new Xt(e),i=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw Jt(e,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const t=i.ok?o.errorMessage:o.error.message,[n,s]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Jt(e,"credential-already-in-use",o);if("EMAIL_EXISTS"===n)throw Jt(e,"email-already-in-use",o);if("USER_DISABLED"===n)throw Jt(e,"user-disabled",o);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(s)throw Pt(e,a,s);Nt(e,a)}}catch(i){if(i instanceof U)throw i;Nt(e,"network-request-failed",{message:String(i)})}}async function Qt(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const o=await Gt(e,t,n,r,i);return"mfaPendingCredential"in o&&Nt(e,"multi-factor-auth-required",{_serverResponse:o}),o}function $t(e,t,n,r){const i="".concat(t).concat(n,"?").concat(r);return e.config.emulator?Bt(e.config,i):"".concat(e.config.apiScheme,"://").concat(i)}function Yt(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Xt{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise(((e,t)=>{this.timer=setTimeout((()=>t(Ot(this.auth,"network-request-failed"))),qt.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Jt(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=Ot(e,t,r);return i.customData._tokenResponse=n,i}function Zt(e){return void 0!==e&&void 0!==e.enterprise}class en{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return Yt(t.enforcementState);return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}}async function tn(e,t){return Gt(e,"GET","/v2/recaptchaConfig",Wt(e,t))}function nn(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(t){}}function rn(e){return 1e3*Number(e)}function on(e){const[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return It("JWT malformed, contained fewer than 3 sections"),null;try{const e=I(n);return e?JSON.parse(e):(It("Failed to decode base64 JWT payload"),null)}catch(i){return It("Caught error parsing JWT payload as JSON",null===i||void 0===i?void 0:i.toString()),null}}async function sn(e,t){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2])return t;try{return await t}catch(n){throw n instanceof U&&function(e){let{code:t}=e;return t==="auth/".concat("user-disabled")||t==="auth/".concat("user-token-expired")}(n)&&e.auth.currentUser===e&&await e.auth.signOut(),n}}class an{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,e)}}schedule(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout((async()=>{await this.iteration()}),t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void((null===e||void 0===e?void 0:e.code)==="auth/".concat("network-request-failed")&&this.schedule(!0))}this.schedule()}}class ln{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=nn(this.lastLoginAt),this.creationTime=nn(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function cn(e){var t;const n=e.auth,r=await e.getIdToken(),i=await sn(e,async function(e,t){return Gt(e,"POST","/v1/accounts:lookup",t)}(n,{idToken:r}));At(null===i||void 0===i?void 0:i.users.length,n,"internal-error");const o=i.users[0];e._notifyReloadListener(o);const s=(null===(t=o.providerUserInfo)||void 0===t?void 0:t.length)?o.providerUserInfo.map((e=>{var{providerId:t}=e,n=_t(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=function(e,t){const n=e.filter((e=>!t.some((t=>t.providerId===e.providerId))));return[...n,...t]}(e.providerData,s),l=e.isAnonymous,c=!(e.email&&o.passwordHash)&&!(null===a||void 0===a?void 0:a.length),u=!!l&&c,h={uid:o.localId,displayName:o.displayName||null,photoURL:o.photoUrl||null,email:o.email||null,emailVerified:o.emailVerified||!1,phoneNumber:o.phoneNumber||null,tenantId:o.tenantId||null,providerData:a,metadata:new ln(o.createdAt,o.lastLoginAt),isAnonymous:u};Object.assign(e,h)}class un{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){At(e.idToken,"internal-error"),At("undefined"!==typeof e.idToken,"internal-error"),At("undefined"!==typeof e.refreshToken,"internal-error");const t="expiresIn"in e&&"undefined"!==typeof e.expiresIn?Number(e.expiresIn):function(e){const t=on(e);return At(t,"internal-error"),At("undefined"!==typeof t.exp,"internal-error"),At("undefined"!==typeof t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return At(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:r,expiresIn:i}=await async function(e,t){const n=await Kt(e,{},(async()=>{const n=q({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:i}=e.config,o=$t(e,r,"/v1/token","key=".concat(i)),s=await e._getAdditionalHeaders();return s["Content-Type"]="application/x-www-form-urlencoded",zt.fetch()(o,{method:"POST",headers:s,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:r,expirationTime:i}=t,o=new un;return n&&(At("string"===typeof n,"internal-error",{appName:e}),o.refreshToken=n),r&&(At("string"===typeof r,"internal-error",{appName:e}),o.accessToken=r),i&&(At("number"===typeof i,"internal-error",{appName:e}),o.expirationTime=i),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new un,this.toJSON())}_performRefresh(){return Dt("not implemented")}}function hn(e,t){At("string"===typeof e||"undefined"===typeof e,"internal-error",{appName:t})}class dn{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,i=_t(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new an(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new ln(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await sn(this,this.stsTokenManager.getToken(this.auth,e));return At(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=$(e),r=await n.getIdToken(t),i=on(r);At(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const o="object"===typeof i.firebase?i.firebase:void 0,s=null===o||void 0===o?void 0:o.sign_in_provider;return{claims:i,token:r,authTime:nn(rn(i.auth_time)),issuedAtTime:nn(rn(i.iat)),expirationTime:nn(rn(i.exp)),signInProvider:s||null,signInSecondFactor:(null===o||void 0===o?void 0:o.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=$(e);await cn(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(At(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map((e=>Object.assign({},e))),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new dn(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){At(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await cn(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await sn(this,async function(e,t){return Gt(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((e=>Object.assign({},e))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var n,r,i,o,s,a,l,c;const u=null!==(n=t.displayName)&&void 0!==n?n:void 0,h=null!==(r=t.email)&&void 0!==r?r:void 0,d=null!==(i=t.phoneNumber)&&void 0!==i?i:void 0,f=null!==(o=t.photoURL)&&void 0!==o?o:void 0,p=null!==(s=t.tenantId)&&void 0!==s?s:void 0,m=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,g=null!==(l=t.createdAt)&&void 0!==l?l:void 0,v=null!==(c=t.lastLoginAt)&&void 0!==c?c:void 0,{uid:y,emailVerified:w,isAnonymous:b,providerData:E,stsTokenManager:S}=t;At(y&&S,e,"internal-error");const _=un.fromJSON(this.name,S);At("string"===typeof y,e,"internal-error"),hn(u,e.name),hn(h,e.name),At("boolean"===typeof w,e,"internal-error"),At("boolean"===typeof b,e,"internal-error"),hn(d,e.name),hn(f,e.name),hn(p,e.name),hn(m,e.name),hn(g,e.name),hn(v,e.name);const k=new dn({uid:y,auth:e,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:_,createdAt:g,lastLoginAt:v});return E&&Array.isArray(E)&&(k.providerData=E.map((e=>Object.assign({},e)))),m&&(k._redirectEventId=m),k}static async _fromIdTokenResponse(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=new un;r.updateFromServerResponse(t);const i=new dn({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await cn(i),i}}const fn=new Map;function pn(e){Lt(e instanceof Function,"Expected a class definition");let t=fn.get(e);return t?(Lt(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,fn.set(e,t),t)}class mn{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}mn.type="NONE";const gn=mn;function vn(e,t,n){return"firebase".concat(":",e,":").concat(t,":").concat(n)}class yn{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:r,name:i}=this.auth;this.fullUserKey=vn(this.userKey,r.apiKey,i),this.fullPersistenceKey=vn("persistence",r.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?dn._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"authUser";if(!t.length)return new yn(pn(gn),e,n);const r=(await Promise.all(t.map((async e=>{if(await e._isAvailable())return e})))).filter((e=>e));let i=r[0]||pn(gn);const o=vn(n,e.config.apiKey,e.name);let s=null;for(const c of t)try{const t=await c._get(o);if(t){const n=dn._fromJSON(e,t);c!==i&&(s=n),i=c;break}}catch(l){}const a=r.filter((e=>e._shouldAllowMigration));return i._shouldAllowMigration&&a.length?(i=a[0],s&&await i._set(o,s.toJSON()),await Promise.all(t.map((async e=>{if(e!==i)try{await e._remove(o)}catch(l){}}))),new yn(i,e,n)):new yn(i,e,n)}}function wn(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(_n(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(bn(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Tn(t))return"Blackberry";if(Cn(t))return"Webos";if(En(t))return"Safari";if((t.includes("chrome/")||Sn(t))&&!t.includes("edge/"))return"Chrome";if(kn(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===(null===n||void 0===n?void 0:n.length))return n[1]}return"Other"}function bn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/firefox\//i.test(e)}function En(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:M()).toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Sn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/crios\//i.test(e)}function _n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/iemobile/i.test(e)}function kn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/android/i.test(e)}function Tn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/blackberry/i.test(e)}function Cn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/webos/i.test(e)}function xn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function In(){return function(){const e=M();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function Nn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M();return xn(e)||kn(e)||Cn(e)||Tn(e)||/windows phone/i.test(e)||_n(e)}function On(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];switch(e){case"Browser":t=wn(M());break;case"Worker":t="".concat(wn(M()),"-").concat(e);break;default:t=e}const r=n.length?n.join(","):"FirebaseCore-web";return"".concat(t,"/","JsCore","/").concat(at,"/").concat(r)}class Pn{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise(((n,r)=>{try{n(e(t))}catch(i){r(i)}}));n.onAbort=t,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(n){t.reverse();for(const e of t)try{e()}catch(Av){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===n||void 0===n?void 0:n.message})}}}class Rn{constructor(e){var t,n,r,i;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=o.minPasswordLength)&&void 0!==t?t:6,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),void 0!==o.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),void 0!==o.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),void 0!==o.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),void 0!==o.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(r=null===(n=e.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==r?r:"",this.forceUpgradeOnSignin=null!==(i=e.forceUpgradeOnSignin)&&void 0!==i&&i,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,r,i,o,s;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&(a.isValid=null===(t=a.meetsMinPasswordLength)||void 0===t||t),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(r=a.containsLowercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(i=a.containsUppercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(o=a.containsNumericCharacter)||void 0===o||o),a.isValid&&(a.isValid=null===(s=a.containsNonAlphanumericCharacter)||void 0===s||s),a}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let r=0;r="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,r,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}class An{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ln(this),this.idTokenSubscription=new Ln(this),this.beforeStateQueue=new Pn(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Ct,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=pn(t)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await yn.create(this,e),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(i){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUser(e){var t;const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,o=null===r||void 0===r?void 0:r._redirectEventId,s=await this.tryRedirectSignIn(e);n&&n!==o||!(null===s||void 0===s?void 0:s.user)||(r=s.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(o)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return At(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(n){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await cn(e)}catch(t){if((null===t||void 0===t?void 0:t.code)!=="auth/".concat("network-request-failed"))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"===typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?$(e):null;return t&&At(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this._deleted)return e&&At(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue((async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue((async()=>{await this.assertedPersistence.setPersistence(pn(e))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await async function(e){return Gt(e,"GET","/v2/passwordPolicy",Wt(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))}(this),t=new Rn(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new V("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise(((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged((()=>{n(),e()}),t)}}))}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return Gt(e,"POST","/v2/accounts:revokeToken",Wt(e,t))}(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&pn(e)||this._popupRedirectResolver;At(t,this,"argument-error"),this.redirectPersistenceManager=await yn.create(this,[pn(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(e)))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return"".concat(this.config.authDomain,":").concat(this.config.apiKey,":").concat(this.name)}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const i="function"===typeof t?t:t.next.bind(t);let o=!1;const s=this._isInitialized?Promise.resolve():this._initializationPromise;if(At(s,this,"internal-error"),s.then((()=>{o||i(this.currentUser)})),"function"===typeof t){const i=e.addObserver(t,n,r);return()=>{o=!0,i()}}{const n=e.addObserver(t);return()=>{o=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return At(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=On(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var e;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null===t||void 0===t?void 0:t.error)&&function(e){if(xt.logLevel<=te.WARN){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rthis.observer=e))}get next(){return At(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let Mn={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function jn(e){return Mn.loadJS(e)}function Fn(e){return"__".concat(e).concat(Math.floor(1e6*Math.random()))}class Un{constructor(e){this.type="recaptcha-enterprise",this.auth=Dn(e)}async verify(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"verify",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function n(t,n,r){const i=window.grecaptcha;Zt(i)?i.enterprise.ready((()=>{i.enterprise.execute(t,{action:e}).then((e=>{n(e)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((e,r)=>{(async function(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise((async(t,n)=>{tn(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new en(r);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((e=>{n(e)}))}))})(this.auth).then((i=>{if(!t&&Zt(window.grecaptcha))n(i,e,r);else{if("undefined"===typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));let t=Mn.recaptchaEnterpriseScript;0!==t.length&&(t+=i),jn(t).then((()=>{n(i,e,r)})).catch((e=>{r(e)}))}})).catch((e=>{r(e)}))}))}}async function Vn(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=new Un(e);let o;try{o=await i.verify(n)}catch(a){o=await i.verify(n,!0)}const s=Object.assign({},t);return r?Object.assign(s,{captchaResp:o}):Object.assign(s,{captchaResponse:o}),Object.assign(s,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(s,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),s}async function Bn(e,t,n,r){var i;if(null===(i=e._getRecaptchaConfig())||void 0===i?void 0:i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await Vn(e,t,n,"getOobCode"===n);return r(e,i)}return r(e,t).catch((async i=>{if(i.code==="auth/".concat("missing-recaptcha-token")){console.log("".concat(n," is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow."));const i=await Vn(e,t,n,"getOobCode"===n);return r(e,i)}return Promise.reject(i)}))}function zn(e,t,n){const r=Dn(e);At(r._canInitEmulator,r,"emulator-config-failed"),At(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const i=!!(null===n||void 0===n?void 0:n.disableWarnings),o=Hn(t),{host:s,port:a}=function(e){const t=Hn(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const e=i[1];return{host:e,port:qn(r.substr(e.length+1))}}{const[e,t]=r.split(":");return{host:e,port:qn(t)}}}(t),l=null===a?"":":".concat(a);r.config.emulator={url:"".concat(o,"//").concat(s).concat(l,"/")},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:s,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!==typeof console&&"function"===typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!==typeof window&&"undefined"!==typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function Hn(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function qn(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class Wn{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Dt("not implemented")}_getIdTokenResponse(e){return Dt("not implemented")}_linkToIdToken(e,t){return Dt("not implemented")}_getReauthenticationResolver(e){return Dt("not implemented")}}async function Gn(e,t){return Gt(e,"POST","/v1/accounts:signUp",t)}async function Kn(e,t){return Qt(e,"POST","/v1/accounts:signInWithPassword",Wt(e,t))}class Qn extends Wn{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new Qn(e,t,"password")}static _fromEmailAndCode(e,t){return new Qn(e,t,"emailLink",arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"===typeof e?JSON.parse(e):e;if((null===t||void 0===t?void 0:t.email)&&(null===t||void 0===t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return Bn(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",Kn);case"emailLink":return async function(e,t){return Qt(e,"POST","/v1/accounts:signInWithEmailLink",Wt(e,t))}(e,{email:this._email,oobCode:this._password});default:Nt(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return Bn(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Gn);case"emailLink":return async function(e,t){return Qt(e,"POST","/v1/accounts:signInWithEmailLink",Wt(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:Nt(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function $n(e,t){return Qt(e,"POST","/v1/accounts:signInWithIdp",Wt(e,t))}class Yn extends Wn{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Yn(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):Nt("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"===typeof e?JSON.parse(e):e,{providerId:n,signInMethod:r}=t,i=_t(t,["providerId","signInMethod"]);if(!n||!r)return null;const o=new Yn(n,r);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){return $n(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,$n(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,$n(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=q(t)}return e}}const Xn={USER_NOT_FOUND:"user-not-found"};class Jn extends Wn{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new Jn({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new Jn({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return Qt(e,"POST","/v1/accounts:signInWithPhoneNumber",Wt(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){const n=await Qt(e,"POST","/v1/accounts:signInWithPhoneNumber",Wt(e,t));if(n.temporaryProof)throw Jt(e,"account-exists-with-different-credential",n);return n}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return Qt(e,"POST","/v1/accounts:signInWithPhoneNumber",Wt(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),Xn)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:r}}toJSON(){const e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"===typeof e&&(e=JSON.parse(e));const{verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:i}=e;return n||t||r||i?new Jn({verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:i}):null}}class Zn{constructor(e){var t,n,r,i,o,s;const a=W(G(e)),l=null!==(t=a.apiKey)&&void 0!==t?t:null,c=null!==(n=a.oobCode)&&void 0!==n?n:null,u=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);At(l&&c&&u,"argument-error"),this.apiKey=l,this.operation=u,this.code=c,this.continueUrl=null!==(i=a.continueUrl)&&void 0!==i?i:null,this.languageCode=null!==(o=a.languageCode)&&void 0!==o?o:null,this.tenantId=null!==(s=a.tenantId)&&void 0!==s?s:null}static parseLink(e){const t=function(e){const t=W(G(e)).link,n=t?W(G(t)).deep_link_id:null,r=W(G(e)).deep_link_id;return(r?W(G(r)).link:null)||r||n||t||e}(e);try{return new Zn(t)}catch(n){return null}}}class er{constructor(){this.providerId=er.PROVIDER_ID}static credential(e,t){return Qn._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=Zn.parseLink(t);return At(n,"argument-error"),Qn._fromEmailAndCode(e,n.code,n.tenantId)}}er.PROVIDER_ID="password",er.EMAIL_PASSWORD_SIGN_IN_METHOD="password",er.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class tr{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class nr extends tr{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class rr extends nr{constructor(){super("facebook.com")}static credential(e){return Yn._fromParams({providerId:rr.PROVIDER_ID,signInMethod:rr.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return rr.credentialFromTaggedObject(e)}static credentialFromError(e){return rr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return rr.credential(t.oauthAccessToken)}catch(n){return null}}}rr.FACEBOOK_SIGN_IN_METHOD="facebook.com",rr.PROVIDER_ID="facebook.com";class ir extends nr{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Yn._fromParams({providerId:ir.PROVIDER_ID,signInMethod:ir.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return ir.credentialFromTaggedObject(e)}static credentialFromError(e){return ir.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return ir.credential(n,r)}catch(i){return null}}}ir.GOOGLE_SIGN_IN_METHOD="google.com",ir.PROVIDER_ID="google.com";class or extends nr{constructor(){super("github.com")}static credential(e){return Yn._fromParams({providerId:or.PROVIDER_ID,signInMethod:or.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return or.credentialFromTaggedObject(e)}static credentialFromError(e){return or.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return or.credential(t.oauthAccessToken)}catch(n){return null}}}or.GITHUB_SIGN_IN_METHOD="github.com",or.PROVIDER_ID="github.com";class sr extends nr{constructor(){super("twitter.com")}static credential(e,t){return Yn._fromParams({providerId:sr.PROVIDER_ID,signInMethod:sr.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return sr.credentialFromTaggedObject(e)}static credentialFromError(e){return sr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return sr.credential(n,r)}catch(i){return null}}}async function ar(e,t){return Qt(e,"POST","/v1/accounts:signUp",Wt(e,t))}sr.TWITTER_SIGN_IN_METHOD="twitter.com",sr.PROVIDER_ID="twitter.com";class lr{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=await dn._fromIdTokenResponse(e,n,r),o=cr(n);return new lr({user:i,providerId:o,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const r=cr(n);return new lr({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function cr(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class ur extends U{constructor(e,t,n,r){var i;super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,ur.prototype),this.customData={appName:e.name,tenantId:null!==(i=e.tenantId)&&void 0!==i?i:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new ur(e,t,n,r)}}function hr(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch((n=>{if(n.code==="auth/".concat("multi-factor-auth-required"))throw ur._fromErrorAndOperation(e,n,t,r);throw n}))}async function dr(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=await sn(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return lr._forOperation(e,"link",r)}async function fr(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{auth:r}=e,i="reauthenticate";try{const o=await sn(e,hr(r,i,t,e),n);At(o.idToken,r,"internal-error");const s=on(o.idToken);At(s,r,"internal-error");const{sub:a}=s;return At(e.uid===a,r,"user-mismatch"),lr._forOperation(e,i,o)}catch(o){throw(null===o||void 0===o?void 0:o.code)==="auth/".concat("user-not-found")&&Nt(r,"user-mismatch"),o}}async function pr(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r="signIn",i=await hr(e,r,t),o=await lr._fromIdTokenResponse(e,r,i);return n||await e._updateCurrentUser(o.user),o}new WeakMap;const mr="__sak";class gr{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(mr,"1"),this.storage.removeItem(mr),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class vr extends gr{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const e=M();return En(e)||xn(e)}()&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=Nn(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}onStorageEvent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e.key)return void this.forAllChangedKeys(((e,t,n)=>{this.notifyListeners(e,n)}));const n=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(e.newValue!==r)null!==e.newValue?this.storage.setItem(n,e.newValue):this.storage.removeItem(n);else if(this.localCache[n]===e.newValue&&!t)return}const r=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},i=this.storage.getItem(n);In()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,10):r()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const r of Array.from(n))r(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}vr.type="LOCAL";const yr=vr;class wr extends gr{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}wr.type="SESSION";const br=wr;class Er{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find((t=>t.isListeningto(e)));if(t)return t;const n=new Er(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:i}=t.data,o=this.handlersMap[r];if(!(null===o||void 0===o?void 0:o.size))return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const s=Array.from(o).map((async e=>e(t.origin,i))),a=await function(e){return Promise.all(e.map((async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}})))}(s);t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function Sr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n="";for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:50;const r="undefined"!==typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let i,o;return new Promise(((s,a)=>{const l=Sr("",20);r.port1.start();const c=setTimeout((()=>{a(new Error("unsupported_event"))}),n);o={messageChannel:r,onMessage(e){const t=e;if(t.data.eventId===l)switch(t.data.status){case"ack":clearTimeout(c),i=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(i),s(t.data.response);break;default:clearTimeout(c),clearTimeout(i),a(new Error("invalid_response"))}}},this.handlers.add(o),r.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[r.port2])})).finally((()=>{o&&this.removeMessageHandler(o)}))}}function kr(){return window}function Tr(){return"undefined"!==typeof kr().WorkerGlobalScope&&"function"===typeof kr().importScripts}const Cr="firebaseLocalStorageDb",xr="firebaseLocalStorage",Ir="fbase_key";class Nr{constructor(e){this.request=e}toPromise(){return new Promise(((e,t)=>{this.request.addEventListener("success",(()=>{e(this.request.result)})),this.request.addEventListener("error",(()=>{t(this.request.error)}))}))}}function Or(e,t){return e.transaction([xr],t?"readwrite":"readonly").objectStore(xr)}function Pr(){const e=indexedDB.open(Cr,1);return new Promise(((t,n)=>{e.addEventListener("error",(()=>{n(e.error)})),e.addEventListener("upgradeneeded",(()=>{const t=e.result;try{t.createObjectStore(xr,{keyPath:Ir})}catch(r){n(r)}})),e.addEventListener("success",(async()=>{const n=e.result;n.objectStoreNames.contains(xr)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Cr);return new Nr(e).toPromise()}(),t(await Pr()))}))}))}async function Rr(e,t,n){const r=Or(e,!0).put({[Ir]:t,value:n});return new Nr(r).toPromise()}function Ar(e,t){const n=Or(e,!0).delete(t);return new Nr(n).toPromise()}class Dr{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Pr()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(n){if(t++>3)throw n;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Tr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Er._getInstance(Tr()?self:null),this.receiver._subscribe("keyChanged",(async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)}))),this.receiver._subscribe("ping",(async(e,t)=>["keyChanged"]))}async initializeSender(){var e,t;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),!this.activeServiceWorker)return;this.sender=new _r(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(this.sender&&this.activeServiceWorker&&function(){var e;return(null===(e=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===e?void 0:e.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Pr();return await Rr(e,mr,"1"),await Ar(e,mr),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite((async()=>(await this._withRetries((n=>Rr(n,e,t))),this.localCache[e]=t,this.notifyServiceWorker(e))))}async _get(e){const t=await this._withRetries((t=>async function(e,t){const n=Or(e,!1).get(t),r=await new Nr(n).toPromise();return void 0===r?null:r.value}(t,e)));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite((async()=>(await this._withRetries((t=>Ar(t,e))),delete this.localCache[e],this.notifyServiceWorker(e))))}async _poll(){const e=await this._withRetries((e=>{const t=Or(e,!1).getAll();return new Nr(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:r,value:i}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),t.push(r));for(const r of Object.keys(this.localCache))this.localCache[r]&&!n.has(r)&&(this.notifyListeners(r,null),t.push(r));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const r of Array.from(n))r(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Dr.type="LOCAL";const Lr=Dr;Fn("rcb"),new Vt(3e4,6e4);const Mr="recaptcha";async function jr(e,t,n){var r;const i=await n.verify();try{let o;if(At("string"===typeof i,e,"argument-error"),At(n.type===Mr,e,"argument-error"),o="string"===typeof t?{phoneNumber:t}:t,"session"in o){const t=o.session;if("phoneNumber"in o){At("enroll"===t.type,e,"internal-error");const n=await function(e,t){return Gt(e,"POST","/v2/accounts/mfaEnrollment:start",Wt(e,t))}(e,{idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:o.phoneNumber,recaptchaToken:i}});return n.phoneSessionInfo.sessionInfo}{At("signin"===t.type,e,"internal-error");const n=(null===(r=o.multiFactorHint)||void 0===r?void 0:r.uid)||o.multiFactorUid;At(n,e,"missing-multi-factor-info");const s=await function(e,t){return Gt(e,"POST","/v2/accounts/mfaSignIn:start",Wt(e,t))}(e,{mfaPendingCredential:t.credential,mfaEnrollmentId:n,phoneSignInInfo:{recaptchaToken:i}});return s.phoneResponseInfo.sessionInfo}}{const{sessionInfo:t}=await async function(e,t){return Gt(e,"POST","/v1/accounts:sendVerificationCode",Wt(e,t))}(e,{phoneNumber:o.phoneNumber,recaptchaToken:i});return t}}finally{n._reset()}}class Fr{constructor(e){this.providerId=Fr.PROVIDER_ID,this.auth=Dn(e)}verifyPhoneNumber(e,t){return jr(this.auth,e,$(t))}static credential(e,t){return Jn._fromVerification(e,t)}static credentialFromResult(e){const t=e;return Fr.credentialFromTaggedObject(t)}static credentialFromError(e){return Fr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject(e){let{_tokenResponse:t}=e;if(!t)return null;const{phoneNumber:n,temporaryProof:r}=t;return n&&r?Jn._fromTokenResponse(n,r):null}}function Ur(e,t){return t?pn(t):(At(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}Fr.PROVIDER_ID="phone",Fr.PHONE_SIGN_IN_METHOD="phone";class Vr extends Wn{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return $n(e,this._buildIdpRequest())}_linkToIdToken(e,t){return $n(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return $n(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function Br(e){return pr(e.auth,new Vr(e),e.bypassAuthState)}function zr(e){const{auth:t,user:n}=e;return At(n,t,"internal-error"),fr(n,new Vr(e),e.bypassAuthState)}async function Hr(e){const{auth:t,user:n}=e;return At(n,t,"internal-error"),dr(n,new Vr(e),e.bypassAuthState)}class qr{constructor(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise((async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(n){this.reject(n)}}))}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:r,tenantId:i,error:o,type:s}=e;if(o)return void this.reject(o);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(s)(a))}catch(l){this.reject(l)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Br;case"linkViaPopup":case"linkViaRedirect":return Hr;case"reauthViaPopup":case"reauthViaRedirect":return zr;default:Nt(this.auth,"internal-error")}}resolve(e){Lt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Lt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const Wr=new Vt(2e3,1e4);class Gr extends qr{constructor(e,t,n,r,i){super(e,t,r,i),this.provider=n,this.authWindow=null,this.pollId=null,Gr.currentPopupAction&&Gr.currentPopupAction.cancel(),Gr.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return At(e,this.auth,"internal-error"),e}async onExecution(){Lt(1===this.filter.length,"Popup operations only handle one event");const e=Sr();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch((e=>{this.reject(e)})),this.resolver._isIframeWebStorageSupported(this.auth,(e=>{e||this.reject(Ot(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(Ot(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Gr.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,n;(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(Ot(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(e,Wr.get())};e()}}Gr.currentPopupAction=null;const Kr="pendingRedirect",Qr=new Map;class $r extends qr{constructor(e,t){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,arguments.length>2&&void 0!==arguments[2]&&arguments[2]),this.eventId=null}async execute(){let e=Qr.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=Jr(t),r=Xr(e);if(!await r._isAvailable())return!1;const i="true"===await r._get(n);return await r._remove(n),i}(this.resolver,this.auth),n=t?await super.execute():null;e=()=>Promise.resolve(n)}catch(t){e=()=>Promise.reject(t)}Qr.set(this.auth._key(),e)}return this.bypassAuthState||Qr.set(this.auth._key(),(()=>Promise.resolve(null))),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Yr(e,t){Qr.set(e._key(),t)}function Xr(e){return pn(e._redirectPersistence)}function Jr(e){return vn(Kr,e.config.apiKey,e.name)}async function Zr(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=Dn(e),i=Ur(r,t),o=new $r(r,i,n),s=await o.execute();return s&&!n&&(delete s.user._redirectEventId,await r._persistUserIfCurrent(s.user),await r._setRedirectUser(null,t)),s}class ei{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))})),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return ni(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!ni(e)){const r=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(Ot(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(ti(e))}saveEventToCache(e){this.cachedEventUids.add(ti(e)),this.lastProcessedEventTime=Date.now()}}function ti(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((e=>e)).join("-")}function ni(e){let{type:t,error:n}=e;return"unknown"===t&&(null===n||void 0===n?void 0:n.code)==="auth/".concat("no-auth-event")}const ri=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ii=/^https?/;async function oi(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e){return Gt(e,"GET","/v1/projects",arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}(e);for(const r of t)try{if(si(r))return}catch(n){}Nt(e,"unauthorized-domain")}function si(e){const t=Mt(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const i=new URL(e);return""===i.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!ii.test(n))return!1;if(ri.test(e))return r===e;const i=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}const ai=new Vt(3e4,6e4);function li(){const e=kr().___jsl;if(null===e||void 0===e?void 0:e.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let n=0;n{var r,i,o;function s(){li(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{li(),n(Ot(e,"network-request-failed"))},timeout:ai.get()})}if(null===(i=null===(r=kr().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)t(gapi.iframes.getContext());else{if(!(null===(o=kr().gapi)||void 0===o?void 0:o.load)){const t=Fn("iframefcb");return kr()[t]=()=>{gapi.load?s():n(Ot(e,"network-request-failed"))},jn("".concat(Mn.gapiScript,"?onload=").concat(t)).catch((e=>n(e)))}s()}})).catch((e=>{throw ui=null,e}))}let ui=null;const hi=new Vt(5e3,15e3),di="__/auth/iframe",fi="emulator/auth/iframe",pi={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},mi=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function gi(e){const t=e.config;At(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Bt(t,fi):"https://".concat(e.config.authDomain,"/").concat(di),r={apiKey:t.apiKey,appName:e.name,v:at},i=mi.get(e.config.apiHost);i&&(r.eid=i);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),"".concat(n,"?").concat(q(r).slice(1))}async function vi(e){const t=await function(e){return ui=ui||ci(e),ui}(e),n=kr().gapi;return At(n,e,"internal-error"),t.open({where:document.body,url:gi(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:pi,dontclear:!0},(t=>new Promise((async(n,r)=>{await t.restyle({setHideOnLeave:!1});const i=Ot(e,"network-request-failed"),o=kr().setTimeout((()=>{r(i)}),hi.get());function s(){kr().clearTimeout(o),n(t)}t.ping(s).then(s,(()=>{r(i)}))}))))}const yi={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class wi{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function bi(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:500,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:600;const o=Math.max((window.screen.availHeight-i)/2,0).toString(),s=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const l=Object.assign(Object.assign({},yi),{width:r.toString(),height:i.toString(),top:o,left:s}),c=M().toLowerCase();n&&(a=Sn(c)?"_blank":n),bn(c)&&(t=t||"http://localhost",l.scrollbars="yes");const u=Object.entries(l).reduce(((e,t)=>{let[n,r]=t;return"".concat(e).concat(n,"=").concat(r,",")}),"");if(function(){var e;return xn(arguments.length>0&&void 0!==arguments[0]?arguments[0]:M())&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(c)&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",a),new wi(null);const h=window.open(t||"",a,u);At(h,e,"popup-blocked");try{h.focus()}catch(d){}return new wi(h)}const Ei="__/auth/handler",Si="emulator/auth/handler",_i=encodeURIComponent("fac");async function ki(e,t,n,r,i,o){At(e.config.authDomain,e,"auth-domain-config-required"),At(e.config.apiKey,e,"invalid-api-key");const s={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:at,eventId:i};if(t instanceof tr){t.setDefaultLanguage(e.languageCode),s.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(s.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries(o||{}))s[e]=t}if(t instanceof nr){const e=t.getScopes().filter((e=>""!==e));e.length>0&&(s.scopes=e.join(","))}e.tenantId&&(s.tid=e.tenantId);const a=s;for(const u of Object.keys(a))void 0===a[u]&&delete a[u];const l=await e._getAppCheckToken(),c=l?"#".concat(_i,"=").concat(encodeURIComponent(l)):"";return"".concat(function(e){let{config:t}=e;if(!t.emulator)return"https://".concat(t.authDomain,"/").concat(Ei);return Bt(t,Si)}(e),"?").concat(q(a).slice(1)).concat(c)}const Ti="webStorageSupport";const Ci=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=br,this._completeRedirectFn=Zr,this._overrideRedirectResult=Yr}async _openPopup(e,t,n,r){var i;Lt(null===(i=this.eventManagers[e._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return bi(e,await ki(e,t,n,Mt(),r),Sr())}async _openRedirect(e,t,n,r){await this._originValidation(e);return function(e){kr().location.href=e}(await ki(e,t,n,Mt(),r)),new Promise((()=>{}))}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(Lt(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch((()=>{delete this.eventManagers[t]})),n}async initAndGetManager(e){const t=await vi(e),n=new ei(e);return t.register("authEvent",(t=>{At(null===t||void 0===t?void 0:t.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Ti,{type:Ti},(n=>{var r;const i=null===(r=null===n||void 0===n?void 0:n[0])||void 0===r?void 0:r[Ti];void 0!==i&&t(!!i),Nt(e,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=oi(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Nn()||En()||xn()}};var xi="@firebase/auth",Ii="1.6.0";class Ni{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged((t=>{e((null===t||void 0===t?void 0:t.stsTokenManager.accessToken)||null)}));this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){At(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const Oi=D("authIdTokenMaxAge")||300;let Pi=null;const Ri=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&((new Date).getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>Oi)return;const i=null===n||void 0===n?void 0:n.token;Pi!==i&&(Pi=i,await fetch(e,{method:i?"POST":"DELETE",headers:i?{Authorization:"Bearer ".concat(i)}:{}}))};function Ai(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct();const t=it(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=it(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(z(n.getOptions(),null!==t&&void 0!==t?t:{}))return e;Nt(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:Ci,persistence:[Lr,yr,br]}),r=D("authTokenSyncURL");if(r){const e=Ri(r);!function(e,t,n){$(e).beforeAuthStateChanged(t,n)}(n,e,(()=>e(n.currentUser))),function(e,t,n,r){$(e).onIdTokenChanged(t,n,r)}(n,(t=>e(t)))}const i=P("auth");return i&&zn(n,"http://".concat(i)),n}var Di;!function(e){Mn=e}({loadJS:e=>new Promise(((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=Ot("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",function(){var e,t;return null!==(t=null===(e=document.getElementsByTagName("head"))||void 0===e?void 0:e[0])&&void 0!==t?t:document}().appendChild(r)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),Di="Browser",rt(new Y("auth",((e,t)=>{let{options:n}=t;const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:s,authDomain:a}=r.options;At(s&&!s.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:s,authDomain:a,clientPlatform:Di,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:On(Di)},c=new An(r,i,o,l);return function(e,t){const n=(null===t||void 0===t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(pn);(null===t||void 0===t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null===t||void 0===t?void 0:t.popupRedirectResolver)}(c,n),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,n)=>{e.getProvider("auth-internal").initialize()}))),rt(new Y("auth-internal",(e=>(e=>new Ni(e))(Dn(e.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),ut(xi,Ii,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Di)),ut(xi,Ii,"esm2017");ut("firebase","10.8.0","app");var Li,Mi="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{},ji={},Fi=Fi||{},Ui=Mi||self;function Vi(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function Bi(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}var zi="closure_uid_"+(1e9*Math.random()>>>0),Hi=0;function qi(e,t,n){return e.call.apply(e.bind,arguments)}function Wi(e,t,n){if(!e)throw Error();if(2{};Ui.addEventListener("test",e,t),Ui.removeEventListener("test",e,t)}catch(_v){}return e}();function to(e){return/^[\s\xa0]*$/.test(e)}function no(){var e=Ui.navigator;return e&&(e=e.userAgent)?e:""}function ro(e){return-1!=no().indexOf(e)}function io(e){return io[" "](e),e}io[" "]=function(){};var oo,so,ao=ro("Opera"),lo=ro("Trident")||ro("MSIE"),co=ro("Edge"),uo=co||lo,ho=ro("Gecko")&&!(-1!=no().toLowerCase().indexOf("webkit")&&!ro("Edge"))&&!(ro("Trident")||ro("MSIE"))&&!ro("Edge"),fo=-1!=no().toLowerCase().indexOf("webkit")&&!ro("Edge");function po(){var e=Ui.document;return e?e.documentMode:void 0}e:{var mo="",go=function(){var e=no();return ho?/rv:([^\);]+)(\)|;)/.exec(e):co?/Edge\/([\d\.]+)/.exec(e):lo?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):fo?/WebKit\/(\S+)/.exec(e):ao?/(?:Version)[ \/]?(\S+)/.exec(e):void 0}();if(go&&(mo=go?go[1]:""),lo){var vo=po();if(null!=vo&&vo>parseFloat(mo)){oo=String(vo);break e}}oo=mo}if(Ui.document&&lo){var yo=po();so=yo||(parseInt(oo,10)||void 0)}else so=void 0;var wo=so;function bo(e,t){if(Zi.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(ho){e:{try{io(t.nodeName);var i=!0;break e}catch(Sv){}i=!1}i||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"===typeof e.pointerType?e.pointerType:Eo[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&bo.$.h.call(this)}}Qi(bo,Zi);var Eo={2:"touch",3:"pen",4:"mouse"};bo.prototype.h=function(){bo.$.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var So="closure_listenable_"+(1e6*Math.random()|0),_o=0;function ko(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.la=i,this.key=++_o,this.fa=this.ia=!1}function To(e){e.fa=!0,e.listener=null,e.proxy=null,e.src=null,e.la=null}function Co(e,t,n){for(const r in e)t.call(n,e[r],r,e)}function xo(e){const t={};for(const n in e)t[n]=e[n];return t}const Io="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function No(e,t){let n,r;for(let i=1;i>>0);function qo(e){return"function"===typeof e?e:(e[Ho]||(e[Ho]=function(t){return e.handleEvent(t)}),e[Ho])}function Wo(){$i.call(this),this.i=new Oo(this),this.S=this,this.J=null}function Go(e,t){var n,r=e.J;if(r)for(n=[];r;r=r.J)n.push(r);if(e=e.S,r=t.type||t,"string"===typeof t)t=new Zi(t,e);else if(t instanceof Zi)t.target=t.target||e;else{var i=t;No(t=new Zi(r,e),i)}if(i=!0,n)for(var o=n.length-1;0<=o;o--){var s=t.g=n[o];i=Ko(s,r,!0,t)&&i}if(i=Ko(s=t.g=e,r,!0,t)&&i,i=Ko(s,r,!1,t)&&i,n)for(o=0;onew Xo),(e=>e.reset()));class Xo{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}function Jo(e){var t=1;e=e.split(":");const n=[];for(;0{throw e}),0)}let es,ts=!1,ns=new class{constructor(){this.h=this.g=null}add(e,t){const n=Yo.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},rs=()=>{const e=Ui.Promise.resolve(void 0);es=()=>{e.then(is)}};var is=()=>{for(var e;e=$o();){try{e.h.call(e.g)}catch(_v){Zo(_v)}var t=Yo;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}ts=!1};function os(e,t){Wo.call(this),this.h=e||1,this.g=t||Ui,this.j=Gi(this.qb,this),this.l=Date.now()}function ss(e){e.ga=!1,e.T&&(e.g.clearTimeout(e.T),e.T=null)}function as(e,t,n){if("function"===typeof e)n&&(e=Gi(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=Gi(e.handleEvent,e)}return 2147483647{e.g=null,e.i&&(e.i=!1,ls(e))}),e.j);const t=e.h;e.h=null,e.m.apply(null,t)}Qi(os,Wo),(Li=os.prototype).ga=!1,Li.T=null,Li.qb=function(){if(this.ga){var e=Date.now()-this.l;0r.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 s=1;st.length?Us:(t=t.slice(r,r+n),e.o=r+n,t))}function Ws(e){e.Y=Date.now()+e.P,Gs(e,e.P)}function Gs(e,t){if(null!=e.C)throw Error("WatchDog timer not null");e.C=ks(Gi(e.lb,e),t)}function Ks(e){e.C&&(Ui.clearTimeout(e.C),e.C=null)}function Qs(e){0==e.l.H||e.J||fl(e.l,e)}function $s(e){Ks(e);var t=e.M;t&&"function"==typeof t.sa&&t.sa(),e.M=null,ss(e.V),fs(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.sa())}function Ys(e,t){try{var n=e.l;if(0!=n.H&&(n.g==e||Ta(n.i,e)))if(!e.K&&Ta(n.i,e)&&3==n.H){try{var r=n.Ja.g.parse(t)}catch(Rv){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){e:if(!n.u){if(n.g){if(!(n.g.G+3e3i[2]&&n.G&&0==n.A&&!n.v&&(n.v=ks(Gi(n.ib,n),6e3));if(1>=ka(n.i)&&n.oa){try{n.oa()}catch(Rv){}n.oa=void 0}}else ml(n,11)}else if((e.K||n.g==e)&&dl(n),!to(t))for(i=n.Ja.g.parse(t),t=0;tu)&&(3!=u||uo||this.g&&(this.h.h||this.g.ja()||Ya(this.g)))){this.J||4!=u||7==t||bs(),Ks(this);var n=this.g.da();this.ca=n;t:if(zs(this)){var r=Ya(this.g);e="";var i=r.length,o=4==$a(this.g);if(!this.h.i){if("undefined"===typeof TextDecoder){$s(this),Qs(this);var s="";break t}this.h.i=new Ui.TextDecoder}for(t=0;tt)throw Error("Bad port number "+t);e.m=t}else e.m=null}function ra(e,t,n){t instanceof pa?(e.i=t,function(e,t){t&&!e.j&&(ma(e),e.i=null,e.g.forEach((function(e,t){var n=t.toLowerCase();t!=n&&(ga(this,t),ya(this,n,e))}),e)),e.j=t}(e.i,e.h)):(n||(t=aa(t,da)),e.i=new pa(t,e.h))}function ia(e,t,n){e.i.set(t,n)}function oa(e){return ia(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function sa(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function aa(e,t,n){return"string"===typeof e?(e=encodeURI(e).replace(t,la),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function la(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}Zs.prototype.toString=function(){var e=[],t=this.j;t&&e.push(aa(t,ca,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.s)&&e.push(aa(t,ca,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(aa(n,"/"==n.charAt(0)?ha:ua,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.o)&&e.push("#",aa(n,fa)),e.join("")};var ca=/[#\/\?@]/g,ua=/[#\?:]/g,ha=/[#\?]/g,da=/[#\?@]/g,fa=/#/g;function pa(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function ma(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n=e.j}function ka(e){return e.h?1:e.g?e.g.size:0}function Ta(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function Ca(e,t){e.g?e.g.add(t):e.h=t}function xa(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function Ia(e){if(null!=e.h)return e.i.concat(e.h.F);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.F);return t}return Xi(e.i)}Ea.prototype.cancel=function(){if(this.i=Ia(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var Na=class{stringify(e){return Ui.JSON.stringify(e,void 0)}parse(e){return Ui.JSON.parse(e,void 0)}};function Oa(){this.g=new Na}function Pa(e,t,n){const r=n||"";try{Xs(e,(function(e,n){let i=e;Bi(e)&&(i=Qo(e)),t.push(r+n+"="+encodeURIComponent(i))}))}catch(i){throw t.push(r+"type="+encodeURIComponent("_badmap")),i}}function Ra(e,t,n,r,i){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,i(r)}catch(Sv){}}function Aa(e){this.l=e.ec||null,this.j=e.ob||!1}function Da(e,t){Wo.call(this),this.F=e,this.u=t,this.m=void 0,this.readyState=La,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}Qi(Aa,xs),Aa.prototype.g=function(){return new Da(this.l,this.j)},Aa.prototype.i=function(e){return function(){return e}}({}),Qi(Da,Wo);var La=0;function Ma(e){e.j.read().then(e.Xa.bind(e)).catch(e.ka.bind(e))}function ja(e){e.readyState=4,e.l=null,e.j=null,e.A=null,Fa(e)}function Fa(e){e.onreadystatechange&&e.onreadystatechange.call(e)}(Li=Da.prototype).open=function(e,t){if(this.readyState!=La)throw this.abort(),Error("Error reopening a connection");this.C=e,this.B=t,this.readyState=1,Fa(this)},Li.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.v,method:this.C,credentials:this.m,cache:void 0};e&&(t.body=e),(this.F||Ui).fetch(new Request(this.B,t)).then(this.$a.bind(this),this.ka.bind(this))},Li.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((()=>{})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,ja(this)),this.readyState=La},Li.$a=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,Fa(this)),this.g&&(this.readyState=3,Fa(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if("undefined"!==typeof Ui.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Ma(this)}else e.text().then(this.Za.bind(this),this.ka.bind(this))},Li.Xa=function(e){if(this.g){if(this.u&&e.value)this.response.push(e.value);else if(!this.u){var t=e.value?e.value:new Uint8Array(0);(t=this.A.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?ja(this):Fa(this),3==this.readyState&&Ma(this)}},Li.Za=function(e){this.g&&(this.response=this.responseText=e,ja(this))},Li.Ya=function(e){this.g&&(this.response=e,ja(this))},Li.ka=function(){this.g&&ja(this)},Li.setRequestHeader=function(e,t){this.v.append(e,t)},Li.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},Li.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(Da.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}});var Ua=Ui.JSON.parse;function Va(e){Wo.call(this),this.headers=new Map,this.u=e||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=Ba,this.L=this.M=!1}Qi(Va,Wo);var Ba="",za=/^https?$/i,Ha=["POST","PUT"];function qa(e,t){e.h=!1,e.g&&(e.l=!0,e.g.abort(),e.l=!1),e.j=t,e.m=5,Wa(e),Ka(e)}function Wa(e){e.F||(e.F=!0,Go(e,"complete"),Go(e,"error"))}function Ga(e){if(e.h&&"undefined"!=typeof Fi&&(!e.C[1]||4!=$a(e)||2!=e.da()))if(e.v&&4==$a(e))as(e.La,0,e);else if(Go(e,"readystatechange"),4==$a(e)){e.h=!1;try{const s=e.da();e:switch(s){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var r;if(r=0===s){var i=String(e.I).match(Js)[1]||null;!i&&Ui.self&&Ui.self.location&&(i=Ui.self.location.protocol.slice(0,-1)),r=!za.test(i?i.toLowerCase():"")}n=r}if(n)Go(e,"complete"),Go(e,"success");else{e.m=6;try{var o=2<$a(e)?e.g.statusText:""}catch(mv){o=""}e.j=o+" ["+e.da()+"]",Wa(e)}}finally{Ka(e)}}}function Ka(e,t){if(e.g){Qa(e);const r=e.g,i=e.C[0]?()=>{}:null;e.g=null,e.C=null,t||Go(e,"ready");try{r.onreadystatechange=i}catch(n){}}}function Qa(e){e.g&&e.L&&(e.g.ontimeout=null),e.A&&(Ui.clearTimeout(e.A),e.A=null)}function $a(e){return e.g?e.g.readyState:0}function Ya(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.K){case Ba:case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(rc){return null}}function Xa(e){let t="";return Co(e,(function(e,n){t+=n,t+=":",t+=e,t+="\r\n"})),t}function Ja(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=Xa(n),"string"===typeof e?null!=n&&encodeURIComponent(String(n)):ia(e,t,n))}function Za(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function el(e){this.Ga=0,this.j=[],this.l=new ps,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=Za("failFast",!1,e),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=Za("baseRetryDelayMs",5e3,e),this.hb=Za("retryDelaySeedMs",1e4,e),this.eb=Za("forwardChannelMaxRetries",2,e),this.xa=Za("forwardChannelRequestTimeoutMs",2e4,e),this.va=e&&e.xmlHttpFactory||void 0,this.Ha=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.i=new Ea(e&&e.concurrentRequestLimit),this.Ja=new Oa,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=e&&e.bc||!1,e&&e.Ea&&this.l.Ea(),e&&e.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&e&&e.detectBufferingProxy||!1,this.qa=void 0,e&&e.longPollingTimeout&&0n)t=Math.max(0,i[a].g-100),s=!1;else try{Pa(l,e,"req"+n+"_")}catch(o){r&&r(l)}}if(s){r=e.join("&");break e}}}return e=e.j.splice(0,n),t.F=e,r}function ll(e){if(!e.g&&!e.u){e.ba=1;var t=e.Ma;es||rs(),ts||(es(),ts=!0),ns.add(t,e),e.A=0}}function cl(e){return!(e.g||e.u||3<=e.A)&&(e.ba++,e.u=ks(Gi(e.Ma,e),pl(e,e.A)),e.A++,!0)}function ul(e){null!=e.B&&(Ui.clearTimeout(e.B),e.B=null)}function hl(e){e.g=new Ls(e,e.l,"rpc",e.ba),null===e.o&&(e.g.I=e.s),e.g.O=0;var t=ea(e.wa);ia(t,"RID","rpc"),ia(t,"SID",e.K),ia(t,"AID",e.V),ia(t,"CI",e.G?"0":"1"),!e.G&&e.qa&&ia(t,"TO",e.qa),ia(t,"TYPE","xmlhttp"),sl(e,t),e.o&&e.s&&Ja(t,e.o,e.s),e.L&&e.g.setTimeout(e.L);var n=e.g;e=e.pa,n.L=1,n.A=oa(ea(t)),n.u=null,n.S=!0,Bs(n,e)}function dl(e){null!=e.v&&(Ui.clearTimeout(e.v),e.v=null)}function fl(e,t){var n=null;if(e.g==t){dl(e),ul(e),e.g=null;var r=2}else{if(!Ta(e.i,t))return;n=t.F,xa(e.i,t),r=1}if(0!=e.H)if(t.i)if(1==r){n=t.u?t.u.length:0,t=Date.now()-t.G;var i=e.C;Go(r=ys(),new _s(r,n)),il(e)}else ll(e);else if(3==(i=t.s)||0==i&&0=e.i.j-(e.m?1:0))&&(e.m?(e.j=t.F.concat(e.j),!0):!(1==e.H||2==e.H||e.C>=(e.cb?0:e.eb))&&(e.m=ks(Gi(e.Na,e,t),pl(e,e.C)),e.C++,!0))}(e,t)||2==r&&cl(e)))switch(n&&0i;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;16>i;++i)r[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];var o=e.g[3],s=t+(o^n&(i^o))+r[0]+3614090360&4294967295;s=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=(n=(i=(o=(t=n+(s<<7&4294967295|s>>>25))+((s=o+(i^t&(n^i))+r[1]+3905402710&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^o&(t^n))+r[2]+606105819&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(o^t))+r[3]+3250441966&4294967295)<<22&4294967295|s>>>10))+((s=t+(o^n&(i^o))+r[4]+4118548399&4294967295)<<7&4294967295|s>>>25))+((s=o+(i^t&(n^i))+r[5]+1200080426&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^o&(t^n))+r[6]+2821735955&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(o^t))+r[7]+4249261313&4294967295)<<22&4294967295|s>>>10))+((s=t+(o^n&(i^o))+r[8]+1770035416&4294967295)<<7&4294967295|s>>>25))+((s=o+(i^t&(n^i))+r[9]+2336552879&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^o&(t^n))+r[10]+4294925233&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(o^t))+r[11]+2304563134&4294967295)<<22&4294967295|s>>>10))+((s=t+(o^n&(i^o))+r[12]+1804603682&4294967295)<<7&4294967295|s>>>25))+((s=o+(i^t&(n^i))+r[13]+4254626195&4294967295)<<12&4294967295|s>>>20))+((s=i+(n^o&(t^n))+r[14]+2792965006&4294967295)<<17&4294967295|s>>>15))+((s=n+(t^i&(o^t))+r[15]+1236535329&4294967295)<<22&4294967295|s>>>10))+((s=t+(i^o&(n^i))+r[1]+4129170786&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^i&(t^n))+r[6]+3225465664&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(o^t))+r[11]+643717713&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(i^o))+r[0]+3921069994&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^o&(n^i))+r[5]+3593408605&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^i&(t^n))+r[10]+38016083&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(o^t))+r[15]+3634488961&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(i^o))+r[4]+3889429448&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^o&(n^i))+r[9]+568446438&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^i&(t^n))+r[14]+3275163606&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(o^t))+r[3]+4107603335&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(i^o))+r[8]+1163531501&4294967295)<<20&4294967295|s>>>12))+((s=t+(i^o&(n^i))+r[13]+2850285829&4294967295)<<5&4294967295|s>>>27))+((s=o+(n^i&(t^n))+r[2]+4243563512&4294967295)<<9&4294967295|s>>>23))+((s=i+(t^n&(o^t))+r[7]+1735328473&4294967295)<<14&4294967295|s>>>18))+((s=n+(o^t&(i^o))+r[12]+2368359562&4294967295)<<20&4294967295|s>>>12))+((s=t+(n^i^o)+r[5]+4294588738&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^i)+r[8]+2272392833&4294967295)<<11&4294967295|s>>>21))+((s=i+(o^t^n)+r[11]+1839030562&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^o^t)+r[14]+4259657740&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^o)+r[1]+2763975236&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^i)+r[4]+1272893353&4294967295)<<11&4294967295|s>>>21))+((s=i+(o^t^n)+r[7]+4139469664&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^o^t)+r[10]+3200236656&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^o)+r[13]+681279174&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^i)+r[0]+3936430074&4294967295)<<11&4294967295|s>>>21))+((s=i+(o^t^n)+r[3]+3572445317&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^o^t)+r[6]+76029189&4294967295)<<23&4294967295|s>>>9))+((s=t+(n^i^o)+r[9]+3654602809&4294967295)<<4&4294967295|s>>>28))+((s=o+(t^n^i)+r[12]+3873151461&4294967295)<<11&4294967295|s>>>21))+((s=i+(o^t^n)+r[15]+530742520&4294967295)<<16&4294967295|s>>>16))+((s=n+(i^o^t)+r[2]+3299628645&4294967295)<<23&4294967295|s>>>9))+((s=t+(i^(n|~o))+r[0]+4096336452&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~i))+r[7]+1126891415&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(o|~n))+r[14]+2878612391&4294967295)<<15&4294967295|s>>>17))+((s=n+(o^(i|~t))+r[5]+4237533241&4294967295)<<21&4294967295|s>>>11))+((s=t+(i^(n|~o))+r[12]+1700485571&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~i))+r[3]+2399980690&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(o|~n))+r[10]+4293915773&4294967295)<<15&4294967295|s>>>17))+((s=n+(o^(i|~t))+r[1]+2240044497&4294967295)<<21&4294967295|s>>>11))+((s=t+(i^(n|~o))+r[8]+1873313359&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~i))+r[15]+4264355552&4294967295)<<10&4294967295|s>>>22))+((s=i+(t^(o|~n))+r[6]+2734768916&4294967295)<<15&4294967295|s>>>17))+((s=n+(o^(i|~t))+r[13]+1309151649&4294967295)<<21&4294967295|s>>>11))+((o=(t=n+((s=t+(i^(n|~o))+r[4]+4149444226&4294967295)<<6&4294967295|s>>>26))+((s=o+(n^(t|~i))+r[11]+3174756917&4294967295)<<10&4294967295|s>>>22))^((i=o+((s=i+(t^(o|~n))+r[2]+718787259&4294967295)<<15&4294967295|s>>>17))|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(s<<21&4294967295|s>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+o&4294967295}function xl(e,t){this.h=t;for(var n=[],r=!0,i=e.length-1;0<=i;i--){var o=0|e[i];r&&o==t||(n[i]=o,r=!1)}this.g=n}(Li=Va.prototype).Oa=function(e){this.M=e},Li.ha=function(e,t,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+e);t=t?t.toUpperCase():"GET",this.I=e,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():Os.g(),this.C=this.u?Is(this.u):Is(Os),this.g.onreadystatechange=Gi(this.La,this);try{this.G=!0,this.g.open(t,String(e),!0),this.G=!1}catch(Sv){return void qa(this,Sv)}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else{if("function"!==typeof r.keys||"function"!==typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));for(const e of r.keys())n.set(e,r.get(e))}r=Array.from(n.keys()).find((e=>"content-type"==e.toLowerCase())),i=Ui.FormData&&e instanceof Ui.FormData,!(0<=Yi(Ha,t))||r||i||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[o,s]of n)this.g.setRequestHeader(o,s);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{Qa(this),0=this.S)){var e=2*this.S;this.l.info("BP detection timer enabled: "+e),this.B=ks(Gi(this.jb,this),e)}},Li.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,Ss(10),nl(this),hl(this))},Li.ib=function(){null!=this.v&&(this.v=null,nl(this),cl(this),Ss(19))},Li.pb=function(e){e?(this.l.info("Successfully pinged google.com"),Ss(2)):(this.l.info("Failed to ping google.com"),Ss(1))},Li.isActive=function(){return!!this.h&&this.h.isActive(this)},(Li=wl.prototype).Ba=function(){},Li.Aa=function(){},Li.za=function(){},Li.ya=function(){},Li.isActive=function(){return!0},Li.Va=function(){},bl.prototype.g=function(e,t){return new El(e,t)},Qi(El,Wo),El.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var e=this.g,t=this.l,n=this.h||void 0;Ss(0),e.Y=t,e.na=n||{},e.G=e.aa,e.I=vl(e,null,e.Y),il(e)},El.prototype.close=function(){tl(this.g)},El.prototype.u=function(e){var t=this.g;if("string"===typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=Qo(e),e=n);t.j.push(new ba(t.fb++,e)),3==t.H&&il(t)},El.prototype.N=function(){this.g.h=null,delete this.j,tl(this.g),delete this.g,El.$.N.call(this)},Qi(Sl,Rs),Qi(_l,As),Qi(kl,wl),kl.prototype.Ba=function(){Go(this.g,"a")},kl.prototype.Aa=function(e){Go(this.g,new Sl(e))},kl.prototype.za=function(e){Go(this.g,new _l)},kl.prototype.ya=function(){Go(this.g,"b")},Qi(Tl,(function(){this.blockSize=-1})),Tl.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0},Tl.prototype.j=function(e,t){void 0===t&&(t=e.length);for(var n=t-this.blockSize,r=this.m,i=this.h,o=0;othis.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;tt;++t)for(var r=0;32>r;r+=8)e[n++]=this.g[t]>>>r&255;return e};var Il={};function Nl(e){return-128<=e&&128>e?function(e,t){var n=Il;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,(function(e){return new xl([0|e],0>e?-1:0)})):new xl([0|e],0>e?-1:0)}function Ol(e){if(isNaN(e)||!isFinite(e))return Rl;if(0>e)return jl(Ol(-e));for(var t=[],n=1,r=0;e>=n;r++)t[r]=e/n|0,n*=Pl;return new xl(t,0)}var Pl=4294967296,Rl=Nl(0),Al=Nl(1),Dl=Nl(16777216);function Ll(e){if(0!=e.h)return!1;for(var t=0;t>>16,e[t]&=65535,t++}function Vl(e,t){this.g=e,this.h=t}function Bl(e,t){if(Ll(t))throw Error("division by zero");if(Ll(e))return new Vl(Rl,Rl);if(Ml(e))return t=Bl(jl(e),t),new Vl(jl(t.g),jl(t.h));if(Ml(t))return t=Bl(e,jl(t)),new Vl(jl(t.g),t.h);if(30=r.X(e);)n=zl(n),r=zl(r);var i=Hl(n,1),o=Hl(r,1);for(r=Hl(r,2),n=Hl(n,2);!Ll(r);){var s=o.add(r);0>=s.X(e)&&(i=i.add(n),o=s),r=Hl(r,1),n=Hl(n,1)}return t=Fl(e,i.R(t)),new Vl(i,t)}for(i=Rl;0<=e.X(t);){for(n=Math.max(1,Math.floor(e.ea()/t.ea())),r=48>=(r=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,r-48),s=(o=Ol(n)).R(t);Ml(s)||0>>31;return new xl(n,e.h)}function Hl(e,t){var n=t>>5;t%=32;for(var r=e.g.length-n,i=[],o=0;o>>t|e.D(o+n+1)<<32-t:e.D(o+n);return new xl(i,e.h)}(Li=xl.prototype).ea=function(){if(Ml(this))return-jl(this).ea();for(var e=0,t=1,n=0;n(e=e||10)||36>>0).toString(e);if(Ll(n=i))return o+r;for(;6>o.length;)o="0"+o;r=o+r}},Li.D=function(e){return 0>e?0:e>>16)+(this.D(i)>>>16)+(e.D(i)>>>16);r=s>>>16,o&=65535,s&=65535,n[i]=s<<16|o}return new xl(n,-2147483648&n[n.length-1]?-1:0)},Li.R=function(e){if(Ll(this)||Ll(e))return Rl;if(Ml(this))return Ml(e)?jl(this).R(jl(e)):jl(jl(this).R(e));if(Ml(e))return jl(this.R(jl(e)));if(0>this.X(Dl)&&0>e.X(Dl))return Ol(this.ea()*e.ea());for(var t=this.g.length+e.g.length,n=[],r=0;r<2*t;r++)n[r]=0;for(r=0;r>>16,s=65535&this.D(r),a=e.D(i)>>>16,l=65535&e.D(i);n[2*r+2*i]+=s*l,Ul(n,2*r+2*i),n[2*r+2*i+1]+=o*l,Ul(n,2*r+2*i+1),n[2*r+2*i+1]+=s*a,Ul(n,2*r+2*i+1),n[2*r+2*i+2]+=o*a,Ul(n,2*r+2*i+2)}for(r=0;r(n=n||10)||36s?(s=Ol(Math.pow(n,s)),i=i.R(s).add(Ol(a))):i=(i=i.R(r)).add(Ol(a))}return i};var ql=ji.createWebChannelTransport=function(){return new bl},Wl=ji.getStatEventTarget=function(){return ys()},Gl=ji.ErrorCode=Ts,Kl=ji.EventType=Cs,Ql=ji.Event=gs,$l=ji.Stat={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},Yl=(ji.FetchXmlHttpFactory=Aa,ji.WebChannel=Ns),Xl=ji.XhrIo=Va,Jl=ji.Md5=Tl,Zl=ji.Integer=xl;const ec="@firebase/firestore";class tc{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}tc.UNAUTHENTICATED=new tc(null),tc.GOOGLE_CREDENTIALS=new tc("google-credentials-uid"),tc.FIRST_PARTY=new tc("first-party-uid"),tc.MOCK_USER=new tc("mock-user");let nc="10.8.0";const rc=new se("@firebase/firestore");function ic(){return rc.logLevel}function oc(e){if(rc.logLevel<=te.DEBUG){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:"Unexpected state";const t="FIRESTORE (".concat(nc,") INTERNAL ASSERTION FAILED: ")+e;throw sc(t),new Error(t)}function uc(e,t){e||cc()}function hc(e,t){return e}const dc={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class fc extends U{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>"".concat(this.name,": [code=").concat(this.code,"]: ").concat(this.message)}}class pc{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class mc{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization","Bearer ".concat(e))}}class gc{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(tc.UNAUTHENTICATED)))}shutdown(){}}class vc{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable((()=>t(this.token.user)))}shutdown(){this.changeListener=null}}class yc{constructor(e){this.t=e,this.currentUser=tc.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let n=this.i;const r=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let i=new pc;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new pc,e.enqueueRetryable((()=>r(this.currentUser)))};const o=()=>{const t=i;e.enqueueRetryable((async()=>{await t.promise,await r(this.currentUser)}))},s=e=>{oc("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.auth.addAuthTokenListener(this.o),o()};this.t.onInit((e=>s(e))),setTimeout((()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?s(e):(oc("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new pc)}}),0),o()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i!==e?(oc("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(uc("string"==typeof t.accessToken),new mc(t.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const e=this.auth&&this.auth.getUid();return uc(null===e||"string"==typeof e),new tc(e)}}class wc{constructor(e,t,n){this.l=e,this.h=t,this.P=n,this.type="FirstParty",this.user=tc.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class bc{constructor(e,t,n){this.l=e,this.h=t,this.P=n}getToken(){return Promise.resolve(new wc(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable((()=>t(tc.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Ec{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Sc{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){const n=e=>{null!=e.error&&oc("FirebaseAppCheckTokenProvider","Error getting App Check token; using placeholder token instead. Error: ".concat(e.error.message));const n=e.token!==this.R;return this.R=e.token,oc("FirebaseAppCheckTokenProvider","Received ".concat(n?"new":"existing"," token.")),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};const r=e=>{oc("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.appCheck.addTokenListener(this.o)};this.A.onInit((e=>r(e))),setTimeout((()=>{if(!this.appCheck){const e=this.A.getImmediate({optional:!0});e?r(e):oc("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(uc("string"==typeof e.token),this.R=e.token,new Ec(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}function _c(e){const t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let r=0;rt?1:0}function Cc(e,t,n){return e.length===t.length&&e.every(((e,r)=>n(e,t[r])))}class xc{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new fc(dc.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new fc(dc.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new fc(dc.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new fc(dc.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return xc.fromMillis(Date.now())}static fromDate(e){return xc.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor(1e6*(e-1e3*t));return new xc(t,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?Tc(this.nanoseconds,e.nanoseconds):Tc(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}class Ic{constructor(e){this.timestamp=e}static fromTimestamp(e){return new Ic(e)}static min(){return new Ic(new xc(0,0))}static max(){return new Ic(new xc(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}class Nc{constructor(e,t,n){void 0===t?t=0:t>e.length&&cc(),void 0===n?n=e.length-t:n>e.length-t&&cc(),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===Nc.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Nc?e.forEach((e=>{t.push(e)})):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.lengthi)return 1}return e.lengtht.length?1:0}}class Oc extends Nc{construct(e,t,n){return new Oc(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(){const e=[];for(var t=arguments.length,n=new Array(t),r=0;r=0)throw new fc(dc.INVALID_ARGUMENT,"Invalid segment (".concat(i,"). Paths must not contain // in them."));e.push(...i.split("/").filter((e=>e.length>0)))}return new Oc(e)}static emptyPath(){return new Oc([])}}const Pc=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Rc extends Nc{construct(e,t,n){return new Rc(e,t,n)}static isValidIdentifier(e){return Pc.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Rc.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new Rc(["__name__"])}static fromServerFormat(e){const t=[];let n="",r=0;const i=()=>{if(0===n.length)throw new fc(dc.INVALID_ARGUMENT,"Invalid field path (".concat(e,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"));t.push(n),n=""};let o=!1;for(;r=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===Oc.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return Oc.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new Ac(new Oc(e.slice()))}}class Dc{constructor(e,t,n,r){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=r}}Dc.UNKNOWN_ID=-1;function Lc(e,t){const n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,i=Ic.fromTimestamp(1e9===r?new xc(n+1,0):new xc(n,r));return new jc(i,Ac.empty(),t)}function Mc(e){return new jc(e.readTime,e.key,-1)}class jc{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new jc(Ic.min(),Ac.empty(),-1)}static max(){return new jc(Ic.max(),Ac.empty(),-1)}}function Fc(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=Ac.comparator(e.documentKey,t.documentKey),0!==n?n:Tc(e.largestBatchId,t.largestBatchId))}const Uc="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Vc{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}async function Bc(e){if(e.code!==dc.FAILED_PRECONDITION||e.message!==Uc)throw e;oc("LocalStore","Unexpectedly lost primary lease")}class zc{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)}),(e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)}))}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&cc(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new zc(((n,r)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,r)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,r)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{const t=e();return t instanceof zc?t:zc.resolve(t)}catch(e){return zc.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction((()=>e(t))):zc.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction((()=>e(t))):zc.reject(t)}static resolve(e){return new zc(((t,n)=>{t(e)}))}static reject(e){return new zc(((t,n)=>{n(e)}))}static waitFor(e){return new zc(((t,n)=>{let r=0,i=0,o=!1;e.forEach((e=>{++r,e.next((()=>{++i,o&&i===r&&t()}),(e=>n(e)))})),o=!0,i===r&&t()}))}static or(e){let t=zc.resolve(!1);for(const n of e)t=t.next((e=>e?zc.resolve(e):n()));return t}static forEach(e,t){const n=[];return e.forEach(((e,r)=>{n.push(t.call(this,e,r))})),this.waitFor(n)}static mapArray(e,t){return new zc(((n,r)=>{const i=e.length,o=new Array(i);let s=0;for(let a=0;a{o[l]=e,++s,s===i&&n(o)}),(e=>r(e)))}}))}static doWhile(e,t){return new zc(((n,r)=>{const i=()=>{!0===e()?t().next((()=>{i()}),r):n()};i()}))}}class Hc{constructor(e,t){this.action=e,this.transaction=t,this.aborted=!1,this.V=new pc,this.transaction.oncomplete=()=>{this.V.resolve()},this.transaction.onabort=()=>{t.error?this.V.reject(new Gc(e,t.error)):this.V.resolve()},this.transaction.onerror=t=>{const n=Xc(t.target.error);this.V.reject(new Gc(e,n))}}static open(e,t,n,r){try{return new Hc(t,e.transaction(r,n))}catch(e){throw new Gc(t,e)}}get m(){return this.V.promise}abort(e){e&&this.V.reject(e),this.aborted||(oc("SimpleDb","Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}g(){const e=this.transaction;this.aborted||"function"!=typeof e.commit||e.commit()}store(e){const t=this.transaction.objectStore(e);return new Qc(t)}}class qc{constructor(e,t,n){this.name=e,this.version=t,this.p=n,12.2===qc.S(M())&&sc("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}static delete(e){return oc("SimpleDb","Removing database:",e),$c(window.indexedDB.deleteDatabase(e)).toPromise()}static D(){if(!F())return!1;if(qc.C())return!0;const e=M(),t=qc.S(e),n=00||e.indexOf("Trident/")>0||e.indexOf("Edge/")>0||n||i)}static C(){var e;return"undefined"!=typeof process&&"YES"===(null===(e=process.__PRIVATE_env)||void 0===e?void 0:e.F)}static M(e,t){return e.store(t)}static S(e){const t=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(n)}static v(e){const t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}async O(e){return this.db||(oc("SimpleDb","Opening database:",this.name),this.db=await new Promise(((t,n)=>{const r=indexedDB.open(this.name,this.version);r.onsuccess=e=>{const n=e.target.result;t(n)},r.onblocked=()=>{n(new Gc(e,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},r.onerror=t=>{const r=t.target.error;"VersionError"===r.name?n(new fc(dc.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):"InvalidStateError"===r.name?n(new fc(dc.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+r)):n(new Gc(e,r))},r.onupgradeneeded=e=>{oc("SimpleDb",'Database "'+this.name+'" requires upgrade from version:',e.oldVersion);const t=e.target.result;this.p.N(t,r.transaction,e.oldVersion,this.version).next((()=>{oc("SimpleDb","Database upgrade to version "+this.version+" complete")}))}}))),this.B&&(this.db.onversionchange=e=>this.B(e)),this.db}L(e){this.B=e,this.db&&(this.db.onversionchange=t=>e(t))}async runTransaction(e,t,n,r){const i="readonly"===t;let o=0;for(;;){++o;try{this.db=await this.O(e);const t=Hc.open(this.db,e,i?"readonly":"readwrite",n),o=r(t).next((e=>(t.g(),e))).catch((e=>(t.abort(e),zc.reject(e)))).toPromise();return o.catch((()=>{})),await t.m,o}catch(e){const t=e,n="FirebaseError"!==t.name&&o<3;if(oc("SimpleDb","Transaction failed with error:",t.message,"Retrying:",n),this.close(),!n)return Promise.reject(t)}}}close(){this.db&&this.db.close(),this.db=void 0}}class Wc{constructor(e){this.k=e,this.q=!1,this.K=null}get isDone(){return this.q}get $(){return this.K}set cursor(e){this.k=e}done(){this.q=!0}U(e){this.K=e}delete(){return $c(this.k.delete())}}class Gc extends fc{constructor(e,t){super(dc.UNAVAILABLE,"IndexedDB transaction '".concat(e,"' failed: ").concat(t)),this.name="IndexedDbTransactionError"}}function Kc(e){return"IndexedDbTransactionError"===e.name}class Qc{constructor(e){this.store=e}put(e,t){let n;return void 0!==t?(oc("SimpleDb","PUT",this.store.name,e,t),n=this.store.put(t,e)):(oc("SimpleDb","PUT",this.store.name,"",e),n=this.store.put(e)),$c(n)}add(e){return oc("SimpleDb","ADD",this.store.name,e,e),$c(this.store.add(e))}get(e){return $c(this.store.get(e)).next((t=>(void 0===t&&(t=null),oc("SimpleDb","GET",this.store.name,e,t),t)))}delete(e){return oc("SimpleDb","DELETE",this.store.name,e),$c(this.store.delete(e))}count(){return oc("SimpleDb","COUNT",this.store.name),$c(this.store.count())}W(e,t){const n=this.options(e,t),r=n.index?this.store.index(n.index):this.store;if("function"==typeof r.getAll){const e=r.getAll(n.range);return new zc(((t,n)=>{e.onerror=e=>{n(e.target.error)},e.onsuccess=e=>{t(e.target.result)}}))}{const e=this.cursor(n),t=[];return this.G(e,((e,n)=>{t.push(n)})).next((()=>t))}}j(e,t){const n=this.store.getAll(e,null===t?void 0:t);return new zc(((e,t)=>{n.onerror=e=>{t(e.target.error)},n.onsuccess=t=>{e(t.target.result)}}))}H(e,t){oc("SimpleDb","DELETE ALL",this.store.name);const n=this.options(e,t);n.J=!1;const r=this.cursor(n);return this.G(r,((e,t,n)=>n.delete()))}Y(e,t){let n;t?n=e:(n={},t=e);const r=this.cursor(n);return this.G(r,t)}Z(e){const t=this.cursor({});return new zc(((n,r)=>{t.onerror=e=>{const t=Xc(e.target.error);r(t)},t.onsuccess=t=>{const r=t.target.result;r?e(r.primaryKey,r.value).next((e=>{e?r.continue():n()})):n()}}))}G(e,t){const n=[];return new zc(((r,i)=>{e.onerror=e=>{i(e.target.error)},e.onsuccess=e=>{const i=e.target.result;if(!i)return void r();const o=new Wc(i),s=t(i.primaryKey,i.value,o);if(s instanceof zc){const e=s.catch((e=>(o.done(),zc.reject(e))));n.push(e)}o.isDone?r():null===o.$?i.continue():i.continue(o.$)}})).next((()=>zc.waitFor(n)))}options(e,t){let n;return void 0!==e&&("string"==typeof e?n=e:t=e),{index:n,range:t}}cursor(e){let t="next";if(e.reverse&&(t="prev"),e.index){const n=this.store.index(e.index);return e.J?n.openKeyCursor(e.range,t):n.openCursor(e.range,t)}return this.store.openCursor(e.range,t)}}function $c(e){return new zc(((t,n)=>{e.onsuccess=e=>{const n=e.target.result;t(n)},e.onerror=e=>{const t=Xc(e.target.error);n(t)}}))}let Yc=!1;function Xc(e){const t=qc.S(M());if(t>=12.2&&t<13){const t="An internal error was encountered in the Indexed Database server";if(e.message.indexOf(t)>=0){const e=new fc("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '".concat(t,"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround."));return Yc||(Yc=!0,setTimeout((()=>{throw e}),0)),e}}return e}class Jc{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.se(e),this.oe=e=>t.writeSequenceNumber(e))}se(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.oe&&this.oe(e),e}}function Zc(e){return null==e}function eu(e){return 0===e&&1/e==-1/0}function tu(e){return"number"==typeof e&&Number.isInteger(e)&&!eu(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}Jc._e=-1;const nu=["mutationQueues","mutations","documentMutations","remoteDocuments","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries"],ru=["mutationQueues","mutations","documentMutations","remoteDocumentsV14","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries","documentOverlays"],iu=ru;function ou(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function su(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function au(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class lu{constructor(e,t){this.comparator=e,this.root=t||uu.EMPTY}insert(e,t){return new lu(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,uu.BLACK,null,null))}remove(e){return new lu(this.comparator,this.root.remove(e,this.comparator).copy(null,null,uu.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((t,n)=>(e(t,n),!1)))}toString(){const e=[];return this.inorderTraversal(((t,n)=>(e.push("".concat(t,":").concat(n)),!1))),"{".concat(e.join(", "),"}")}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new cu(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new cu(this.root,e,this.comparator,!1)}getReverseIterator(){return new cu(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new cu(this.root,e,this.comparator,!0)}}class cu{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?n(e.key,t):1,t&&r&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(0===i){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class uu{constructor(e,t,n,r,i){this.key=e,this.value=t,this.color=null!=n?n:uu.RED,this.left=null!=r?r:uu.EMPTY,this.right=null!=i?i:uu.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,r,i){return new uu(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let r=this;const i=n(e,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return uu.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let n,r=this;if(t(e,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(e,t),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===t(e,r.key)){if(r.right.isEmpty())return uu.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(e,t))}return r.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,uu.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,uu.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw cc();if(this.right.isRed())throw cc();const e=this.left.check();if(e!==this.right.check())throw cc();return e+(this.isRed()?0:1)}}uu.EMPTY=null,uu.RED=!0,uu.BLACK=!1,uu.EMPTY=new class{constructor(){this.size=0}get key(){throw cc()}get value(){throw cc()}get color(){throw cc()}get left(){throw cc()}get right(){throw cc()}copy(e,t,n,r,i){return this}insert(e,t,n){return new uu(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class hu{constructor(e){this.comparator=e,this.data=new lu(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,n)=>(e(t),!1)))}forEachInRange(e,t){const n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new du(this.data.getIterator())}getIteratorFrom(e){return new du(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size{t=t.add(e)})),t}isEqual(e){if(!(e instanceof hu))return!1;if(this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(0!==this.comparator(e,r))return!1}return!0}toArray(){const e=[];return this.forEach((t=>{e.push(t)})),e}toString(){const e=[];return this.forEach((t=>e.push(t))),"SortedSet("+e.toString()+")"}copy(e){const t=new hu(this.comparator);return t.data=e,t}}class du{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class fu{constructor(e){this.fields=e,e.sort(Rc.comparator)}static empty(){return new fu([])}unionWith(e){let t=new hu(Rc.comparator);for(const n of this.fields)t=t.add(n);for(const n of e)t=t.add(n);return new fu(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Cc(this.fields,e.fields,((e,t)=>e.isEqual(t)))}}class pu extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class mu{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new pu("Invalid base64 string: "+e):e}}(e);return new mu(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;nexu(e,t)))}function Nu(e,t){if(e===t)return 0;const n=Cu(e),r=Cu(t);if(n!==r)return Tc(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Tc(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=yu(e.integerValue||e.doubleValue),r=yu(t.integerValue||t.doubleValue);return nr?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return Ou(e.timestampValue,t.timestampValue);case 4:return Ou(Su(e),Su(t));case 5:return Tc(e.stringValue,t.stringValue);case 6:return function(e,t){const n=wu(e),r=wu(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),r=t.split("/");for(let i=0;it.mapValue.fields[e]=Uu(n))),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=Uu(e.arrayValue.values[n]);return t}return Object.assign({},e)}function Vu(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}class Bu{constructor(e){this.value=e}static empty(){return new Bu({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n{if(!t.isImmediateParentOf(i)){const e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=i.popLast()}e?n[i.lastSegment()]=Uu(e):r.push(i.lastSegment())}));const i=this.getFieldsMap(t);this.applyChanges(i,n,r)}delete(e){const t=this.field(e.popLast());Fu(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return xu(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;ne[t]=n));for(const r of n)delete e[r]}clone(){return new Bu(Uu(this.value))}}function zu(e){const t=[];return su(e.fields,((e,n)=>{const r=new Rc([e]);if(Fu(n)){const e=zu(n.mapValue).fields;if(0===e.length)t.push(r);else for(const n of e)t.push(r.child(n))}else t.push(r)})),new fu(t)}class Hu{constructor(e,t,n,r,i,o,s){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=i,this.data=o,this.documentState=s}static newInvalidDocument(e){return new Hu(e,0,Ic.min(),Ic.min(),Ic.min(),Bu.empty(),0)}static newFoundDocument(e,t,n,r){return new Hu(e,1,t,Ic.min(),n,r,0)}static newNoDocument(e,t){return new Hu(e,2,t,Ic.min(),Ic.min(),Bu.empty(),0)}static newUnknownDocument(e,t){return new Hu(e,3,t,Ic.min(),Ic.min(),Bu.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(Ic.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Bu.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Bu.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Ic.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof Hu&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Hu(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return"Document(".concat(this.key,", ").concat(this.version,", ").concat(JSON.stringify(this.data.value),", {createTime: ").concat(this.createTime,"}), {documentType: ").concat(this.documentType,"}), {documentState: ").concat(this.documentState,"})")}}class qu{constructor(e,t){this.position=e,this.inclusive=t}}function Wu(e,t,n){let r=0;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:"asc";this.field=e,this.dir=t}}function Qu(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}class $u{}class Yu extends $u{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new ih(e,t,n):"array-contains"===t?new lh(e,n):"in"===t?new ch(e,n):"not-in"===t?new uh(e,n):"array-contains-any"===t?new hh(e,n):new Yu(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new oh(e,n):new sh(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(Nu(t,this.value)):null!==t&&Cu(this.value)===Cu(t)&&this.matchesComparison(Nu(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return cc()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Xu extends $u{constructor(e,t){super(),this.filters=e,this.op=t,this.ue=null}static create(e,t){return new Xu(e,t)}matches(e){return Ju(this)?void 0===this.filters.find((t=>!t.matches(e))):void 0!==this.filters.find((t=>t.matches(e)))}getFlattenedFilters(){return null!==this.ue||(this.ue=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.ue}getFilters(){return Object.assign([],this.filters)}}function Ju(e){return"and"===e.op}function Zu(e){return eh(e)&&Ju(e)}function eh(e){for(const t of e.filters)if(t instanceof Xu)return!1;return!0}function th(e){if(e instanceof Yu)return e.field.canonicalString()+e.op.toString()+Pu(e.value);if(Zu(e))return e.filters.map((e=>th(e))).join(",");{const t=e.filters.map((e=>th(e))).join(",");return"".concat(e.op,"(").concat(t,")")}}function nh(e,t){return e instanceof Yu?function(e,t){return t instanceof Yu&&e.op===t.op&&e.field.isEqual(t.field)&&xu(e.value,t.value)}(e,t):e instanceof Xu?function(e,t){return t instanceof Xu&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce(((e,n,r)=>e&&nh(n,t.filters[r])),!0)}(e,t):void cc()}function rh(e){return e instanceof Yu?function(e){return"".concat(e.field.canonicalString()," ").concat(e.op," ").concat(Pu(e.value))}(e):e instanceof Xu?function(e){return e.op.toString()+" {"+e.getFilters().map(rh).join(" ,")+"}"}(e):"Filter"}class ih extends Yu{constructor(e,t,n){super(e,t,n),this.key=Ac.fromName(n.referenceValue)}matches(e){const t=Ac.comparator(e.key,this.key);return this.matchesComparison(t)}}class oh extends Yu{constructor(e,t){super(e,"in",t),this.keys=ah("in",t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}}class sh extends Yu{constructor(e,t){super(e,"not-in",t),this.keys=ah("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}}function ah(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map((e=>Ac.fromName(e.referenceValue)))}class lh extends Yu{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Lu(t)&&Iu(t.arrayValue,this.value)}}class ch extends Yu{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&Iu(this.value.arrayValue,t)}}class uh extends Yu{constructor(e,t){super(e,"not-in",t)}matches(e){if(Iu(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&!Iu(this.value.arrayValue,t)}}class hh extends Yu{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Lu(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>Iu(this.value.arrayValue,e)))}}class dh{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=s,this.ce=null}}function fh(e){return new dh(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,arguments.length>6&&void 0!==arguments[6]?arguments[6]:null)}function ph(e){const t=hc(e);if(null===t.ce){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map((e=>th(e))).join(","),e+="|ob:",e+=t.orderBy.map((e=>function(e){return e.field.canonicalString()+e.dir}(e))).join(","),Zc(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((e=>Pu(e))).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((e=>Pu(e))).join(",")),t.ce=e}return t.ce}function mh(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"F",s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=o,this.startAt=s,this.endAt=a,this.le=null,this.he=null,this.Pe=null,this.startAt,this.endAt}}function yh(e,t,n,r,i,o,s,a){return new vh(e,t,n,r,i,o,s,a)}function wh(e){return new vh(e)}function bh(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function Eh(e){return null!==e.collectionGroup}function Sh(e){const t=hc(e);if(null===t.le){t.le=[];const e=new Set;for(const i of t.explicitOrderBy)t.le.push(i),e.add(i.field.canonicalString());const n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",r=function(e){let t=new hu(Rc.comparator);return e.filters.forEach((e=>{e.getFlattenedFilters().forEach((e=>{e.isInequality()&&(t=t.add(e.field))}))})),t}(t);r.forEach((r=>{e.has(r.canonicalString())||r.isKeyField()||t.le.push(new Ku(r,n))})),e.has(Rc.keyField().canonicalString())||t.le.push(new Ku(Rc.keyField(),n))}return t.le}function _h(e){const t=hc(e);return t.he||(t.he=kh(t,Sh(e))),t.he}function kh(e,t){if("F"===e.limitType)return fh(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map((e=>{const t="desc"===e.dir?"asc":"desc";return new Ku(e.field,t)}));const n=e.endAt?new qu(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new qu(e.startAt.position,e.startAt.inclusive):null;return fh(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}function Th(e,t){const n=e.filters.concat([t]);return new vh(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function Ch(e,t,n){return new vh(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function xh(e,t){return mh(_h(e),_h(t))&&e.limitType===t.limitType}function Ih(e){return"".concat(ph(_h(e)),"|lt:").concat(e.limitType)}function Nh(e){return"Query(target=".concat(function(e){let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=", filters: [".concat(e.filters.map((e=>rh(e))).join(", "),"]")),Zc(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=", orderBy: [".concat(e.orderBy.map((e=>function(e){return"".concat(e.field.canonicalString()," (").concat(e.dir,")")}(e))).join(", "),"]")),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((e=>Pu(e))).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((e=>Pu(e))).join(",")),"Target(".concat(t,")")}(_h(e)),"; limitType=").concat(e.limitType,")")}function Oh(e,t){return t.isFoundDocument()&&function(e,t){const n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):Ac.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of Sh(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(const n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){const r=Wu(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,Sh(e),t))&&!(e.endAt&&!function(e,t,n){const r=Wu(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,Sh(e),t))}(e,t)}function Ph(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function Rh(e){return(t,n)=>{let r=!1;for(const i of Sh(e)){const e=Ah(i,t,n);if(0!==e)return e;r=r||i.field.isKeyField()}return 0}}function Ah(e,t,n){const r=e.field.isKeyField()?Ac.comparator(t.key,n.key):function(e,t,n){const r=t.data.field(e),i=n.data.field(e);return null!==r&&null!==i?Nu(r,i):cc()}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return cc()}}class Dh{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n)for(const[r,i]of n)if(this.equalsFn(r,e))return i}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(let i=0;i{for(const[r,i]of n)e(r,i)}))}isEmpty(){return au(this.inner)}size(){return this.innerSize}}const Lh=new lu(Ac.comparator);function Mh(){return Lh}const jh=new lu(Ac.comparator);function Fh(){let e=jh;for(var t=arguments.length,n=new Array(t),r=0;rt=t.insert(e,n.overlayedDocument))),t}function Vh(){return zh()}function Bh(){return zh()}function zh(){return new Dh((e=>e.toString()),((e,t)=>e.isEqual(t)))}const Hh=new lu(Ac.comparator),qh=new hu(Ac.comparator);function Wh(){let e=qh;for(var t=arguments.length,n=new Array(t),r=0;rxu(e,r)))||n.push(r);return{arrayValue:{values:n}}}class id extends Xh{constructor(e){super(),this.elements=e}}function od(e,t){let n=ld(t);for(const r of e.elements)n=n.filter((e=>!xu(e,r)));return{arrayValue:{values:n}}}class sd extends Xh{constructor(e,t){super(),this.serializer=e,this.Ie=t}}function ad(e){return yu(e.integerValue||e.doubleValue)}function ld(e){return Lu(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class cd{constructor(e,t){this.field=e,this.transform=t}}class ud{constructor(e,t){this.version=e,this.transformResults=t}}class hd{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new hd}static exists(e){return new hd(void 0,e)}static updateTime(e){return new hd(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function dd(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class fd{}function pd(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new kd(e.key,hd.none()):new wd(e.key,e.data,hd.none());{const n=e.data,r=Bu.empty();let i=new hu(Rc.comparator);for(let e of t.fields)if(!i.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?r.delete(e):r.set(e,t),i=i.add(e)}return new bd(e.key,r,new fu(i.toArray()),hd.none())}}function md(e,t,n){e instanceof wd?function(e,t,n){const r=e.value.clone(),i=Sd(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof bd?function(e,t,n){if(!dd(e.precondition,t))return void t.convertToUnknownDocument(n.version);const r=Sd(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(Ed(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function gd(e,t,n,r){return e instanceof wd?function(e,t,n,r){if(!dd(e.precondition,t))return n;const i=e.value.clone(),o=_d(e.fieldTransforms,r,t);return i.setAll(o),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof bd?function(e,t,n,r){if(!dd(e.precondition,t))return n;const i=_d(e.fieldTransforms,r,t),o=t.data;return o.setAll(Ed(e)),o.setAll(i),t.convertToFoundDocument(t.version,o).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,r):function(e,t,n){return dd(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function vd(e,t){let n=null;for(const r of e.fieldTransforms){const e=t.data.field(r.field),i=ed(r.transform,e||null);null!=i&&(null===n&&(n=Bu.empty()),n.set(r.field,i))}return n||null}function yd(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Cc(e,t,((e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof nd&&t instanceof nd||e instanceof id&&t instanceof id?Cc(e.elements,t.elements,xu):e instanceof sd&&t instanceof sd?xu(e.Ie,t.Ie):e instanceof td&&t instanceof td}(e.transform,t.transform)}(e,t)))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class wd extends fd{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class bd extends fd{constructor(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function Ed(e){const t=new Map;return e.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=e.data.field(n);t.set(n,r)}})),t}function Sd(e,t,n){const r=new Map;uc(e.length===n.length);for(let i=0;i{const i=e.get(r.key),o=i.overlayedDocument;let s=this.applyToLocalView(o,i.mutatedFields);s=t.has(r.key)?null:s;const a=pd(o,s);null!==a&&n.set(r.key,a),o.isValidDocument()||o.convertToNoDocument(Ic.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),Wh())}isEqual(e){return this.batchId===e.batchId&&Cc(this.mutations,e.mutations,((e,t)=>yd(e,t)))&&Cc(this.baseMutations,e.baseMutations,((e,t)=>yd(e,t)))}}class xd{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(e,t,n){uc(e.mutations.length===n.length);let r=Hh;const i=e.mutations;for(let o=0;o=8)throw new Vd("Invalid padding: ".concat(t));if(n<0)throw new Vd("Invalid hash count: ".concat(n));if(e.length>0&&0===this.hashCount)throw new Vd("Invalid hash count: ".concat(n));if(0===e.length&&0!==t)throw new Vd("Invalid padding when bitmap length is 0: ".concat(t));this.Te=8*e.length-t,this.Ee=Zl.fromNumber(this.Te)}de(e,t,n){let r=e.add(t.multiply(Zl.fromNumber(n)));return 1===r.compare(Md)&&(r=new Zl([r.getBits(0),r.getBits(1)],0)),r.modulo(this.Ee).toNumber()}Ae(e){return 0!=(this.bitmap[Math.floor(e/8)]&1<o.insert(e))),o}insert(e){if(0===this.Te)return;const t=jd(e),[n,r]=Fd(t);for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:mu.EMPTY_BYTE_STRING,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}}class Gd{constructor(){this.ge=0,this.pe=$d(),this.ye=mu.EMPTY_BYTE_STRING,this.we=!1,this.Se=!0}get current(){return this.we}get resumeToken(){return this.ye}get be(){return 0!==this.ge}get De(){return this.Se}Ce(e){e.approximateByteSize()>0&&(this.Se=!0,this.ye=e)}ve(){let e=Wh(),t=Wh(),n=Wh();return this.pe.forEach(((r,i)=>{switch(i){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:cc()}})),new zd(this.ye,this.we,e,t,n)}Fe(){this.Se=!1,this.pe=$d()}Me(e,t){this.Se=!0,this.pe=this.pe.insert(e,t)}xe(e){this.Se=!0,this.pe=this.pe.remove(e)}Oe(){this.ge+=1}Ne(){this.ge-=1,uc(this.ge>=0)}Be(){this.Se=!0,this.we=!0}}class Kd{constructor(e){this.Le=e,this.ke=new Map,this.qe=Mh(),this.Qe=Qd(),this.Ke=new lu(Tc)}$e(e){for(const t of e.Ve)e.me&&e.me.isFoundDocument()?this.Ue(t,e.me):this.We(t,e.key,e.me);for(const t of e.removedTargetIds)this.We(t,e.key,e.me)}Ge(e){this.forEachTarget(e,(t=>{const n=this.ze(t);switch(e.state){case 0:this.je(t)&&n.Ce(e.resumeToken);break;case 1:n.Ne(),n.be||n.Fe(),n.Ce(e.resumeToken);break;case 2:n.Ne(),n.be||this.removeTarget(t);break;case 3:this.je(t)&&(n.Be(),n.Ce(e.resumeToken));break;case 4:this.je(t)&&(this.He(t),n.Ce(e.resumeToken));break;default:cc()}}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.ke.forEach(((e,n)=>{this.je(n)&&t(n)}))}Je(e){const t=e.targetId,n=e.fe.count,r=this.Ye(t);if(r){const i=r.target;if(gh(i))if(0===n){const e=new Ac(i.path);this.We(t,e,Hu.newNoDocument(e,Ic.min()))}else uc(1===n);else{const r=this.Ze(t);if(r!==n){const n=this.Xe(e),i=n?this.et(n,e,r):1;if(0!==i){this.He(t);const e=2===i?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ke=this.Ke.insert(t,e)}null==Dd||Dd.tt(function(e,t,n,r,i){var o,s,a,l,c,u;const h={localCacheCount:e,existenceFilterCount:t.count,databaseId:n.database,projectId:n.projectId},d=t.unchangedNames;return d&&(h.bloomFilter={applied:0===i,hashCount:null!==(o=null==d?void 0:d.hashCount)&&void 0!==o?o:0,bitmapLength:null!==(l=null===(a=null===(s=null==d?void 0:d.bits)||void 0===s?void 0:s.bitmap)||void 0===a?void 0:a.length)&&void 0!==l?l:0,padding:null!==(u=null===(c=null==d?void 0:d.bits)||void 0===c?void 0:c.padding)&&void 0!==u?u:0,mightContain:e=>{var t;return null!==(t=null==r?void 0:r.mightContain(e))&&void 0!==t&&t}}),h}(r,e.fe,this.Le.nt(),n,i))}}}}Xe(e){const t=e.fe.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:n="",padding:r=0},hashCount:i=0}=t;let o,s;try{o=wu(n).toUint8Array()}catch(e){if(e instanceof pu)return ac("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{s=new Ud(o,r,i)}catch(e){return ac(e instanceof Vd?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===s.Te?null:s}et(e,t,n){return t.fe.count===n-this.rt(e,t.targetId)?0:2}rt(e,t){const n=this.Le.getRemoteKeysForTarget(t);let r=0;return n.forEach((n=>{const i=this.Le.nt(),o="projects/".concat(i.projectId,"/databases/").concat(i.database,"/documents/").concat(n.path.canonicalString());e.mightContain(o)||(this.We(t,n,null),r++)})),r}it(e){const t=new Map;this.ke.forEach(((n,r)=>{const i=this.Ye(r);if(i){if(n.current&&gh(i.target)){const t=new Ac(i.target.path);null!==this.qe.get(t)||this.st(r,t)||this.We(r,t,Hu.newNoDocument(t,e))}n.De&&(t.set(r,n.ve()),n.Fe())}}));let n=Wh();this.Qe.forEach(((e,t)=>{let r=!0;t.forEachWhile((e=>{const t=this.Ye(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(r=!1,!1)})),r&&(n=n.add(e))})),this.qe.forEach(((t,n)=>n.setReadTime(e)));const r=new Bd(e,t,this.Ke,this.qe,n);return this.qe=Mh(),this.Qe=Qd(),this.Ke=new lu(Tc),r}Ue(e,t){if(!this.je(e))return;const n=this.st(e,t.key)?2:0;this.ze(e).Me(t.key,n),this.qe=this.qe.insert(t.key,t),this.Qe=this.Qe.insert(t.key,this.ot(t.key).add(e))}We(e,t,n){if(!this.je(e))return;const r=this.ze(e);this.st(e,t)?r.Me(t,1):r.xe(t),this.Qe=this.Qe.insert(t,this.ot(t).delete(e)),n&&(this.qe=this.qe.insert(t,n))}removeTarget(e){this.ke.delete(e)}Ze(e){const t=this.ze(e).ve();return this.Le.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Oe(e){this.ze(e).Oe()}ze(e){let t=this.ke.get(e);return t||(t=new Gd,this.ke.set(e,t)),t}ot(e){let t=this.Qe.get(e);return t||(t=new hu(Tc),this.Qe=this.Qe.insert(e,t)),t}je(e){const t=null!==this.Ye(e);return t||oc("WatchChangeAggregator","Detected inactive target",e),t}Ye(e){const t=this.ke.get(e);return t&&t.be?null:this.Le._t(e)}He(e){this.ke.set(e,new Gd),this.Le.getRemoteKeysForTarget(e).forEach((t=>{this.We(e,t,null)}))}st(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}function Qd(){return new lu(Ac.comparator)}function $d(){return new lu(Ac.comparator)}const Yd={asc:"ASCENDING",desc:"DESCENDING"},Xd={"<":"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"},Jd={and:"AND",or:"OR"};class Zd{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function ef(e,t){return e.useProto3Json||Zc(t)?t:{value:t}}function tf(e,t){return e.useProto3Json?"".concat(new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z",""),".").concat(("000000000"+t.nanoseconds).slice(-9),"Z"):{seconds:""+t.seconds,nanos:t.nanoseconds}}function nf(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function rf(e,t){return tf(e,t.toTimestamp())}function of(e){return uc(!!e),Ic.fromTimestamp(function(e){const t=vu(e);return new xc(t.seconds,t.nanos)}(e))}function sf(e,t){return af(e,t).canonicalString()}function af(e,t){const n=function(e){return new Oc(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function lf(e){const t=Oc.fromString(e);return uc(If(t)),t}function cf(e,t){return sf(e.databaseId,t.path)}function uf(e,t){const n=lf(t);if(n.get(1)!==e.databaseId.projectId)throw new fc(dc.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new fc(dc.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new Ac(pf(n))}function hf(e,t){return sf(e.databaseId,t)}function df(e){const t=lf(e);return 4===t.length?Oc.emptyPath():pf(t)}function ff(e){return new Oc(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function pf(e){return uc(e.length>4&&"documents"===e.get(4)),e.popFirst(5)}function mf(e,t,n){return{name:cf(e,t),fields:n.value.mapValue.fields}}function gf(e,t){let n;if(t instanceof wd)n={update:mf(e,t.key,t.value)};else if(t instanceof kd)n={delete:cf(e,t.key)};else if(t instanceof bd)n={update:mf(e,t.key,t.data),updateMask:xf(t.fieldMask)};else{if(!(t instanceof Td))return cc();n={verify:cf(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map((e=>function(e,t){const n=t.transform;if(n instanceof td)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof nd)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof id)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof sd)return{fieldPath:t.field.canonicalString(),increment:n.Ie};throw cc()}(0,e)))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:rf(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:cc()}(e,t.precondition)),n}function vf(e,t){return{documents:[hf(e,t.path)]}}function yf(e,t){const n={structuredQuery:{}},r=t.path;let i;null!==t.collectionGroup?(i=r,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=hf(e,i);const o=function(e){if(0!==e.length)return Cf(Xu.create(e,"and"))}(t.filters);o&&(n.structuredQuery.where=o);const s=function(e){if(0!==e.length)return e.map((e=>function(e){return{field:kf(e.field),direction:Ef(e.dir)}}(e)))}(t.orderBy);s&&(n.structuredQuery.orderBy=s);const a=ef(e,t.limit);return null!==a&&(n.structuredQuery.limit=a),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{ut:n,parent:i}}function wf(e){let t=df(e.parent);const n=e.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){uc(1===r);const e=n.from[0];e.allDescendants?i=e.collectionId:t=t.child(e.collectionId)}let o=[];n.where&&(o=function(e){const t=bf(e);return t instanceof Xu&&Zu(t)?t.getFilters():[t]}(n.where));let s=[];n.orderBy&&(s=function(e){return e.map((e=>function(e){return new Ku(Tf(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e)))}(n.orderBy));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,Zc(t)?null:t}(n.limit));let l=null;n.startAt&&(l=function(e){const t=!!e.before,n=e.values||[];return new qu(n,t)}(n.startAt));let c=null;return n.endAt&&(c=function(e){const t=!e.before,n=e.values||[];return new qu(n,t)}(n.endAt)),yh(t,i,s,o,a,"F",l,c)}function bf(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=Tf(e.unaryFilter.field);return Yu.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=Tf(e.unaryFilter.field);return Yu.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=Tf(e.unaryFilter.field);return Yu.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=Tf(e.unaryFilter.field);return Yu.create(i,"!=",{nullValue:"NULL_VALUE"});default:return cc()}}(e):void 0!==e.fieldFilter?function(e){return Yu.create(Tf(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return cc()}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return Xu.create(e.compositeFilter.filters.map((e=>bf(e))),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return cc()}}(e.compositeFilter.op))}(e):cc()}function Ef(e){return Yd[e]}function Sf(e){return Xd[e]}function _f(e){return Jd[e]}function kf(e){return{fieldPath:e.canonicalString()}}function Tf(e){return Rc.fromServerFormat(e.fieldPath)}function Cf(e){return e instanceof Yu?function(e){if("=="===e.op){if(ju(e.value))return{unaryFilter:{field:kf(e.field),op:"IS_NAN"}};if(Mu(e.value))return{unaryFilter:{field:kf(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(ju(e.value))return{unaryFilter:{field:kf(e.field),op:"IS_NOT_NAN"}};if(Mu(e.value))return{unaryFilter:{field:kf(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:kf(e.field),op:Sf(e.op),value:e.value}}}(e):e instanceof Xu?function(e){const t=e.getFilters().map((e=>Cf(e)));return 1===t.length?t[0]:{compositeFilter:{op:_f(e.op),filters:t}}}(e):cc()}function xf(e){const t=[];return e.fields.forEach((e=>t.push(e.canonicalString()))),{fieldPaths:t}}function If(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}class Nf{constructor(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Ic.min(),o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Ic.min(),s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:mu.EMPTY_BYTE_STRING,a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s,this.expectedCount=a}withSequenceNumber(e){return new Nf(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new Nf(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Nf(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Nf(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class Of{constructor(e){this.ct=e}}function Pf(e){const t=wf({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?Ch(t,t.limit,"L"):t}class Rf{constructor(){}Pt(e,t){this.It(e,t),t.Tt()}It(e,t){if("nullValue"in e)this.Et(t,5);else if("booleanValue"in e)this.Et(t,10),t.dt(e.booleanValue?1:0);else if("integerValue"in e)this.Et(t,15),t.dt(yu(e.integerValue));else if("doubleValue"in e){const n=yu(e.doubleValue);isNaN(n)?this.Et(t,13):(this.Et(t,15),eu(n)?t.dt(0):t.dt(n))}else if("timestampValue"in e){const n=e.timestampValue;this.Et(t,20),"string"==typeof n?t.At(n):(t.At("".concat(n.seconds||"")),t.dt(n.nanos||0))}else if("stringValue"in e)this.Rt(e.stringValue,t),this.Vt(t);else if("bytesValue"in e)this.Et(t,30),t.ft(wu(e.bytesValue)),this.Vt(t);else if("referenceValue"in e)this.gt(e.referenceValue,t);else if("geoPointValue"in e){const n=e.geoPointValue;this.Et(t,45),t.dt(n.latitude||0),t.dt(n.longitude||0)}else"mapValue"in e?Vu(e)?this.Et(t,Number.MAX_SAFE_INTEGER):(this.yt(e.mapValue,t),this.Vt(t)):"arrayValue"in e?(this.wt(e.arrayValue,t),this.Vt(t)):cc()}Rt(e,t){this.Et(t,25),this.St(e,t)}St(e,t){t.At(e)}yt(e,t){const n=e.fields||{};this.Et(t,55);for(const r of Object.keys(n))this.Rt(r,t),this.It(n[r],t)}wt(e,t){const n=e.values||[];this.Et(t,50);for(const r of n)this.It(r,t)}gt(e,t){this.Et(t,37),Ac.fromName(e).path.forEach((e=>{this.Et(t,60),this.St(e,t)}))}Et(e,t){e.dt(t)}Vt(e){e.dt(2)}}Rf.bt=new Rf;class Af{constructor(){this._n=new Df}addToCollectionParentIndex(e,t){return this._n.add(t),zc.resolve()}getCollectionParents(e,t){return zc.resolve(this._n.getEntries(t))}addFieldIndex(e,t){return zc.resolve()}deleteFieldIndex(e,t){return zc.resolve()}deleteAllFieldIndexes(e){return zc.resolve()}createTargetIndexes(e,t){return zc.resolve()}getDocumentsMatchingTarget(e,t){return zc.resolve(null)}getIndexType(e,t){return zc.resolve(0)}getFieldIndexes(e,t){return zc.resolve([])}getNextCollectionGroupToUpdate(e){return zc.resolve(null)}getMinOffset(e,t){return zc.resolve(jc.min())}getMinOffsetFromCollectionGroup(e,t){return zc.resolve(jc.min())}updateCollectionGroup(e,t,n){return zc.resolve()}updateIndexEntries(e,t){return zc.resolve()}}class Df{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new hu(Oc.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}has(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}getEntries(e){return(this.index[e]||new hu(Oc.comparator)).toArray()}}new Uint8Array(0);class Lf{constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}static withCacheSize(e){return new Lf(e,Lf.DEFAULT_COLLECTION_PERCENTILE,Lf.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}Lf.DEFAULT_COLLECTION_PERCENTILE=10,Lf.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Lf.DEFAULT=new Lf(41943040,Lf.DEFAULT_COLLECTION_PERCENTILE,Lf.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Lf.DISABLED=new Lf(-1,0,0);class Mf{constructor(e){this.On=e}next(){return this.On+=2,this.On}static Nn(){return new Mf(0)}static Bn(){return new Mf(-1)}}class jf{constructor(){this.changes=new Dh((e=>e.toString()),((e,t)=>e.isEqual(t))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,Hu.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?zc.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}class Ff{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class Uf{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next((r=>(n=r,this.remoteDocumentCache.getEntry(e,t)))).next((e=>(null!==n&&gd(n.mutation,e,fu.empty(),xc.now()),e)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.getLocalViewOfDocuments(e,t,Wh()).next((()=>t))))}getLocalViewOfDocuments(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Wh();const r=Vh();return this.populateOverlays(e,r,t).next((()=>this.computeViews(e,t,r,n).next((e=>{let t=Fh();return e.forEach(((e,n)=>{t=t.insert(e,n.overlayedDocument)})),t}))))}getOverlayedDocuments(e,t){const n=Vh();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,Wh())))}populateOverlays(e,t,n){const r=[];return n.forEach((e=>{t.has(e)||r.push(e)})),this.documentOverlayCache.getOverlays(e,r).next((e=>{e.forEach(((e,n)=>{t.set(e,n)}))}))}computeViews(e,t,n,r){let i=Mh();const o=zh(),s=zh();return t.forEach(((e,t)=>{const s=n.get(t.key);r.has(t.key)&&(void 0===s||s.mutation instanceof bd)?i=i.insert(t.key,t):void 0!==s?(o.set(t.key,s.mutation.getFieldMask()),gd(s.mutation,t,s.mutation.getFieldMask(),xc.now())):o.set(t.key,fu.empty())})),this.recalculateAndSaveOverlays(e,i).next((e=>(e.forEach(((e,t)=>o.set(e,t))),t.forEach(((e,t)=>{var n;return s.set(e,new Ff(t,null!==(n=o.get(e))&&void 0!==n?n:null))})),s)))}recalculateAndSaveOverlays(e,t){const n=zh();let r=new lu(((e,t)=>e-t)),i=Wh();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((e=>{for(const i of e)i.keys().forEach((e=>{const o=t.get(e);if(null===o)return;let s=n.get(e)||fu.empty();s=i.applyToLocalView(o,s),n.set(e,s);const a=(r.get(i.batchId)||Wh()).add(e);r=r.insert(i.batchId,a)}))})).next((()=>{const o=[],s=r.getReverseIterator();for(;s.hasNext();){const r=s.getNext(),a=r.key,l=r.value,c=Bh();l.forEach((e=>{if(!i.has(e)){const r=pd(t.get(e),n.get(e));null!==r&&c.set(e,r),i=i.add(e)}})),o.push(this.documentOverlayCache.saveOverlays(e,a,c))}return zc.waitFor(o)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.recalculateAndSaveOverlays(e,t)))}getDocumentsMatchingQuery(e,t,n,r){return function(e){return Ac.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Eh(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next((i=>{const o=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-i.size):zc.resolve(Vh());let s=-1,a=i;return o.next((t=>zc.forEach(t,((t,n)=>(s{a=a.insert(t,e)}))))).next((()=>this.populateOverlays(e,t,i))).next((()=>this.computeViews(e,a,t,Wh()))).next((e=>({batchId:s,changes:Uh(e)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new Ac(t)).next((e=>{let t=Fh();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){const i=t.collectionGroup;let o=Fh();return this.indexManager.getCollectionParents(e,i).next((s=>zc.forEach(s,(s=>{const a=function(e,t){return new vh(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,s.child(i));return this.getDocumentsMatchingCollectionQuery(e,a,n,r).next((e=>{e.forEach(((e,t)=>{o=o.insert(e,t)}))}))})).next((()=>o))))}getDocumentsMatchingCollectionQuery(e,t,n,r){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r)))).next((e=>{i.forEach(((t,n)=>{const r=n.getKey();null===e.get(r)&&(e=e.insert(r,Hu.newInvalidDocument(r)))}));let n=Fh();return e.forEach(((e,r)=>{const o=i.get(e);void 0!==o&&gd(o.mutation,r,fu.empty(),xc.now()),Oh(t,r)&&(n=n.insert(e,r))})),n}))}}class Vf{constructor(e){this.serializer=e,this.cr=new Map,this.lr=new Map}getBundleMetadata(e,t){return zc.resolve(this.cr.get(t))}saveBundleMetadata(e,t){return this.cr.set(t.id,function(e){return{id:e.id,version:e.version,createTime:of(e.createTime)}}(t)),zc.resolve()}getNamedQuery(e,t){return zc.resolve(this.lr.get(t))}saveNamedQuery(e,t){return this.lr.set(t.name,function(e){return{name:e.name,query:Pf(e.bundledQuery),readTime:of(e.readTime)}}(t)),zc.resolve()}}class Bf{constructor(){this.overlays=new lu(Ac.comparator),this.hr=new Map}getOverlay(e,t){return zc.resolve(this.overlays.get(t))}getOverlays(e,t){const n=Vh();return zc.forEach(t,(t=>this.getOverlay(e,t).next((e=>{null!==e&&n.set(t,e)})))).next((()=>n))}saveOverlays(e,t,n){return n.forEach(((n,r)=>{this.ht(e,t,r)})),zc.resolve()}removeOverlaysForBatchId(e,t,n){const r=this.hr.get(n);return void 0!==r&&(r.forEach((e=>this.overlays=this.overlays.remove(e))),this.hr.delete(n)),zc.resolve()}getOverlaysForCollection(e,t,n){const r=Vh(),i=t.length+1,o=new Ac(t.child("")),s=this.overlays.getIteratorFrom(o);for(;s.hasNext();){const e=s.getNext().value,o=e.getKey();if(!t.isPrefixOf(o.path))break;o.path.length===i&&e.largestBatchId>n&&r.set(e.getKey(),e)}return zc.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let i=new lu(((e,t)=>e-t));const o=this.overlays.getIterator();for(;o.hasNext();){const e=o.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=i.get(e.largestBatchId);null===t&&(t=Vh(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const s=Vh(),a=i.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((e,t)=>s.set(e,t))),!(s.size()>=r)););return zc.resolve(s)}ht(e,t,n){const r=this.overlays.get(n.key);if(null!==r){const e=this.hr.get(r.largestBatchId).delete(n.key);this.hr.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new Id(t,n));let i=this.hr.get(t);void 0===i&&(i=Wh(),this.hr.set(t,i)),this.hr.set(t,i.add(n.key))}}class zf{constructor(){this.Pr=new hu(Hf.Ir),this.Tr=new hu(Hf.Er)}isEmpty(){return this.Pr.isEmpty()}addReference(e,t){const n=new Hf(e,t);this.Pr=this.Pr.add(n),this.Tr=this.Tr.add(n)}dr(e,t){e.forEach((e=>this.addReference(e,t)))}removeReference(e,t){this.Ar(new Hf(e,t))}Rr(e,t){e.forEach((e=>this.removeReference(e,t)))}Vr(e){const t=new Ac(new Oc([])),n=new Hf(t,e),r=new Hf(t,e+1),i=[];return this.Tr.forEachInRange([n,r],(e=>{this.Ar(e),i.push(e.key)})),i}mr(){this.Pr.forEach((e=>this.Ar(e)))}Ar(e){this.Pr=this.Pr.delete(e),this.Tr=this.Tr.delete(e)}gr(e){const t=new Ac(new Oc([])),n=new Hf(t,e),r=new Hf(t,e+1);let i=Wh();return this.Tr.forEachInRange([n,r],(e=>{i=i.add(e.key)})),i}containsKey(e){const t=new Hf(e,0),n=this.Pr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class Hf{constructor(e,t){this.key=e,this.pr=t}static Ir(e,t){return Ac.comparator(e.key,t.key)||Tc(e.pr,t.pr)}static Er(e,t){return Tc(e.pr,t.pr)||Ac.comparator(e.key,t.key)}}class qf{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.yr=1,this.wr=new hu(Hf.Ir)}checkEmpty(e){return zc.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,r){const i=this.yr;this.yr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new Cd(i,t,n,r);this.mutationQueue.push(o);for(const s of r)this.wr=this.wr.add(new Hf(s.key,i)),this.indexManager.addToCollectionParentIndex(e,s.key.path.popLast());return zc.resolve(o)}lookupMutationBatch(e,t){return zc.resolve(this.Sr(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,r=this.br(n),i=r<0?0:r;return zc.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return zc.resolve(0===this.mutationQueue.length?-1:this.yr-1)}getAllMutationBatches(e){return zc.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new Hf(t,0),r=new Hf(t,Number.POSITIVE_INFINITY),i=[];return this.wr.forEachInRange([n,r],(e=>{const t=this.Sr(e.pr);i.push(t)})),zc.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new hu(Tc);return t.forEach((e=>{const t=new Hf(e,0),r=new Hf(e,Number.POSITIVE_INFINITY);this.wr.forEachInRange([t,r],(e=>{n=n.add(e.pr)}))})),zc.resolve(this.Dr(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,r=n.length+1;let i=n;Ac.isDocumentKey(i)||(i=i.child(""));const o=new Hf(new Ac(i),0);let s=new hu(Tc);return this.wr.forEachWhile((e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(s=s.add(e.pr)),!0)}),o),zc.resolve(this.Dr(s))}Dr(e){const t=[];return e.forEach((e=>{const n=this.Sr(e);null!==n&&t.push(n)})),t}removeMutationBatch(e,t){uc(0===this.Cr(t.batchId,"removed")),this.mutationQueue.shift();let n=this.wr;return zc.forEach(t.mutations,(r=>{const i=new Hf(r.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)})).next((()=>{this.wr=n}))}Mn(e){}containsKey(e,t){const n=new Hf(t,0),r=this.wr.firstAfterOrEqual(n);return zc.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,zc.resolve()}Cr(e,t){return this.br(e)}br(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Sr(e){const t=this.br(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class Wf{constructor(e){this.vr=e,this.docs=new lu(Ac.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,r=this.docs.get(n),i=r?r.size:0,o=this.vr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:o}),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return zc.resolve(n?n.document.mutableCopy():Hu.newInvalidDocument(t))}getEntries(e,t){let n=Mh();return t.forEach((e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():Hu.newInvalidDocument(e))})),zc.resolve(n)}getDocumentsMatchingQuery(e,t,n,r){let i=Mh();const o=t.path,s=new Ac(o.child("")),a=this.docs.getIteratorFrom(s);for(;a.hasNext();){const{key:e,value:{document:s}}=a.getNext();if(!o.isPrefixOf(e.path))break;e.path.length>o.length+1||Fc(Mc(s),n)<=0||(r.has(s.key)||Oh(t,s))&&(i=i.insert(s.key,s.mutableCopy()))}return zc.resolve(i)}getAllFromCollectionGroup(e,t,n,r){cc()}Fr(e,t){return zc.forEach(this.docs,(e=>t(e)))}newChangeBuffer(e){return new Gf(this)}getSize(e){return zc.resolve(this.size)}}class Gf extends jf{constructor(e){super(),this.ar=e}applyChanges(e){const t=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?t.push(this.ar.addEntry(e,r)):this.ar.removeEntry(n)})),zc.waitFor(t)}getFromCache(e,t){return this.ar.getEntry(e,t)}getAllFromCache(e,t){return this.ar.getEntries(e,t)}}class Kf{constructor(e){this.persistence=e,this.Mr=new Dh((e=>ph(e)),mh),this.lastRemoteSnapshotVersion=Ic.min(),this.highestTargetId=0,this.Or=0,this.Nr=new zf,this.targetCount=0,this.Br=Mf.Nn()}forEachTarget(e,t){return this.Mr.forEach(((e,n)=>t(n))),zc.resolve()}getLastRemoteSnapshotVersion(e){return zc.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return zc.resolve(this.Or)}allocateTargetId(e){return this.highestTargetId=this.Br.next(),zc.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Or&&(this.Or=t),zc.resolve()}qn(e){this.Mr.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.Br=new Mf(t),this.highestTargetId=t),e.sequenceNumber>this.Or&&(this.Or=e.sequenceNumber)}addTargetData(e,t){return this.qn(t),this.targetCount+=1,zc.resolve()}updateTargetData(e,t){return this.qn(t),zc.resolve()}removeTargetData(e,t){return this.Mr.delete(t.target),this.Nr.Vr(t.targetId),this.targetCount-=1,zc.resolve()}removeTargets(e,t,n){let r=0;const i=[];return this.Mr.forEach(((o,s)=>{s.sequenceNumber<=t&&null===n.get(s.targetId)&&(this.Mr.delete(o),i.push(this.removeMatchingKeysForTargetId(e,s.targetId)),r++)})),zc.waitFor(i).next((()=>r))}getTargetCount(e){return zc.resolve(this.targetCount)}getTargetData(e,t){const n=this.Mr.get(t)||null;return zc.resolve(n)}addMatchingKeys(e,t,n){return this.Nr.dr(t,n),zc.resolve()}removeMatchingKeys(e,t,n){this.Nr.Rr(t,n);const r=this.persistence.referenceDelegate,i=[];return r&&t.forEach((t=>{i.push(r.markPotentiallyOrphaned(e,t))})),zc.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.Nr.Vr(t),zc.resolve()}getMatchingKeysForTargetId(e,t){const n=this.Nr.gr(t);return zc.resolve(n)}containsKey(e,t){return zc.resolve(this.Nr.containsKey(t))}}class Qf{constructor(e,t){this.Lr={},this.overlays={},this.kr=new Jc(0),this.qr=!1,this.qr=!0,this.referenceDelegate=e(this),this.Qr=new Kf(this),this.indexManager=new Af,this.remoteDocumentCache=function(e){return new Wf(e)}((e=>this.referenceDelegate.Kr(e))),this.serializer=new Of(t),this.$r=new Vf(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.qr=!1,Promise.resolve()}get started(){return this.qr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Bf,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.Lr[e.toKey()];return n||(n=new qf(t,this.referenceDelegate),this.Lr[e.toKey()]=n),n}getTargetCache(){return this.Qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.$r}runTransaction(e,t,n){oc("MemoryPersistence","Starting transaction:",e);const r=new $f(this.kr.next());return this.referenceDelegate.Ur(),n(r).next((e=>this.referenceDelegate.Wr(r).next((()=>e)))).toPromise().then((e=>(r.raiseOnCommittedEvent(),e)))}Gr(e,t){return zc.or(Object.values(this.Lr).map((n=>()=>n.containsKey(e,t))))}}class $f extends Vc{constructor(e){super(),this.currentSequenceNumber=e}}class Yf{constructor(e){this.persistence=e,this.zr=new zf,this.jr=null}static Hr(e){return new Yf(e)}get Jr(){if(this.jr)return this.jr;throw cc()}addReference(e,t,n){return this.zr.addReference(n,t),this.Jr.delete(n.toString()),zc.resolve()}removeReference(e,t,n){return this.zr.removeReference(n,t),this.Jr.add(n.toString()),zc.resolve()}markPotentiallyOrphaned(e,t){return this.Jr.add(t.toString()),zc.resolve()}removeTarget(e,t){this.zr.Vr(t.targetId).forEach((e=>this.Jr.add(e.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((e=>{e.forEach((e=>this.Jr.add(e.toString())))})).next((()=>n.removeTargetData(e,t)))}Ur(){this.jr=new Set}Wr(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return zc.forEach(this.Jr,(n=>{const r=Ac.fromPath(n);return this.Yr(e,r).next((e=>{e||t.removeEntry(r,Ic.min())}))})).next((()=>(this.jr=null,t.apply(e))))}updateLimboDocument(e,t){return this.Yr(e,t).next((e=>{e?this.Jr.delete(t.toString()):this.Jr.add(t.toString())}))}Kr(e){return 0}Yr(e,t){return zc.or([()=>zc.resolve(this.zr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Gr(e,t)])}}class Xf{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.qi=n,this.Qi=r}static Ki(e,t){let n=Wh(),r=Wh();for(const i of t.docChanges)switch(i.type){case 0:n=n.add(i.doc.key);break;case 1:r=r.add(i.doc.key)}return new Xf(e,t.fromCache,n,r)}}class Jf{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class Zf{constructor(){this.$i=!1,this.Ui=!1,this.Wi=100,this.Gi=j()?8:qc.v(M())>0?6:4}initialize(e,t){this.zi=e,this.indexManager=t,this.$i=!0}getDocumentsMatchingQuery(e,t,n,r){const i={result:null};return this.ji(e,t).next((e=>{i.result=e})).next((()=>{if(!i.result)return this.Hi(e,t,r,n).next((e=>{i.result=e}))})).next((()=>{if(i.result)return;const n=new Jf;return this.Ji(e,t,n).next((r=>{if(i.result=r,this.Ui)return this.Yi(e,t,n,r.size)}))})).next((()=>i.result))}Yi(e,t,n,r){return n.documentReadCountthis.Gi*r?(ic()<=te.DEBUG&&oc("QueryEngine","The SDK decides to create cache indexes for query:",Nh(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,_h(t))):zc.resolve())}ji(e,t){if(bh(t))return zc.resolve(null);let n=_h(t);return this.indexManager.getIndexType(e,n).next((r=>0===r?null:(null!==t.limit&&1===r&&(t=Ch(t,null,"F"),n=_h(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next((r=>{const i=Wh(...r);return this.zi.getDocuments(e,i).next((r=>this.indexManager.getMinOffset(e,n).next((n=>{const o=this.Zi(t,r);return this.Xi(t,o,i,n.readTime)?this.ji(e,Ch(t,null,"F")):this.es(e,o,t,n)}))))})))))}Hi(e,t,n,r){return bh(t)||r.isEqual(Ic.min())?zc.resolve(null):this.zi.getDocuments(e,n).next((i=>{const o=this.Zi(t,i);return this.Xi(t,o,n,r)?zc.resolve(null):(ic()<=te.DEBUG&&oc("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Nh(t)),this.es(e,o,t,Lc(r,-1)).next((e=>e)))}))}Zi(e,t){let n=new hu(Rh(e));return t.forEach(((t,r)=>{Oh(e,r)&&(n=n.add(r))})),n}Xi(e,t,n,r){if(null===e.limit)return!1;if(n.size!==t.size)return!0;const i="F"===e.limitType?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}Ji(e,t,n){return ic()<=te.DEBUG&&oc("QueryEngine","Using full collection scan to execute query:",Nh(t)),this.zi.getDocumentsMatchingQuery(e,t,jc.min(),n)}es(e,t,n,r){return this.zi.getDocumentsMatchingQuery(e,n,r).next((e=>(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}}class ep{constructor(e,t,n,r){this.persistence=e,this.ts=t,this.serializer=r,this.ns=new lu(Tc),this.rs=new Dh((e=>ph(e)),mh),this.ss=new Map,this.os=e.getRemoteDocumentCache(),this.Qr=e.getTargetCache(),this.$r=e.getBundleCache(),this._s(n)}_s(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Uf(this.os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.os.setIndexManager(this.indexManager),this.ts.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(t=>e.collect(t,this.ns)))}}function tp(e,t,n,r){return new ep(e,t,n,r)}async function np(e,t){const n=hc(e);return await n.persistence.runTransaction("Handle user change","readonly",(e=>{let r;return n.mutationQueue.getAllMutationBatches(e).next((i=>(r=i,n._s(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{const i=[],o=[];let s=Wh();for(const e of r){i.push(e.batchId);for(const t of e.mutations)s=s.add(t.key)}for(const e of t){o.push(e.batchId);for(const t of e.mutations)s=s.add(t.key)}return n.localDocuments.getDocuments(e,s).next((e=>({us:e,removedBatchIds:i,addedBatchIds:o})))}))}))}function rp(e){const t=hc(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",(e=>t.Qr.getLastRemoteSnapshotVersion(e)))}function ip(e,t,n){let r=Wh(),i=Wh();return n.forEach((e=>r=r.add(e))),t.getEntries(e,r).next((e=>{let r=Mh();return n.forEach(((n,o)=>{const s=e.get(n);o.isFoundDocument()!==s.isFoundDocument()&&(i=i.add(n)),o.isNoDocument()&&o.version.isEqual(Ic.min())?(t.removeEntry(n,o.readTime),r=r.insert(n,o)):!s.isValidDocument()||o.version.compareTo(s.version)>0||0===o.version.compareTo(s.version)&&s.hasPendingWrites?(t.addEntry(o),r=r.insert(n,o)):oc("LocalStore","Ignoring outdated watch update for ",n,". Current version:",s.version," Watch version:",o.version)})),{cs:r,ls:i}}))}function op(e,t){const n=hc(e);return n.persistence.runTransaction("Get next mutation batch","readonly",(e=>(void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t))))}function sp(e,t){const n=hc(e);return n.persistence.runTransaction("Allocate target","readwrite",(e=>{let r;return n.Qr.getTargetData(e,t).next((i=>i?(r=i,zc.resolve(r)):n.Qr.allocateTargetId(e).next((i=>(r=new Nf(t,i,"TargetPurposeListen",e.currentSequenceNumber),n.Qr.addTargetData(e,r).next((()=>r)))))))})).then((e=>{const r=n.ns.get(e.targetId);return(null===r||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.ns=n.ns.insert(e.targetId,e),n.rs.set(t,e.targetId)),e}))}async function ap(e,t,n){const r=hc(e),i=r.ns.get(t),o=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",o,(e=>r.persistence.referenceDelegate.removeTarget(e,i)))}catch(e){if(!Kc(e))throw e;oc("LocalStore","Failed to update sequence numbers for target ".concat(t,": ").concat(e))}r.ns=r.ns.remove(t),r.rs.delete(i.target)}function lp(e,t,n){const r=hc(e);let i=Ic.min(),o=Wh();return r.persistence.runTransaction("Execute query","readwrite",(e=>function(e,t,n){const r=hc(e),i=r.rs.get(n);return void 0!==i?zc.resolve(r.ns.get(i)):r.Qr.getTargetData(t,n)}(r,e,_h(t)).next((t=>{if(t)return i=t.lastLimboFreeSnapshotVersion,r.Qr.getMatchingKeysForTargetId(e,t.targetId).next((e=>{o=e}))})).next((()=>r.ts.getDocumentsMatchingQuery(e,t,n?i:Ic.min(),n?o:Wh()))).next((e=>(cp(r,Ph(t),e),{documents:e,hs:o})))))}function cp(e,t,n){let r=e.ss.get(t)||Ic.min();n.forEach(((e,t)=>{t.readTime.compareTo(r)>0&&(r=t.readTime)})),e.ss.set(t,r)}class up{constructor(){this.activeTargetIds=Kh()}As(e){this.activeTargetIds=this.activeTargetIds.add(e)}Rs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ds(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class hp{constructor(){this.no=new up,this.ro={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e){return this.no.As(e),this.ro[e]||"not-current"}updateQueryState(e,t,n){this.ro[e]=t}removeLocalQueryTarget(e){this.no.Rs(e)}isLocalQueryTarget(e){return this.no.activeTargetIds.has(e)}clearQueryState(e){delete this.ro[e]}getAllActiveQueryTargets(){return this.no.activeTargetIds}isActiveQueryTarget(e){return this.no.activeTargetIds.has(e)}start(){return this.no=new up,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class dp{io(e){}shutdown(){}}class fp{constructor(){this.so=()=>this.oo(),this._o=()=>this.ao(),this.uo=[],this.co()}io(e){this.uo.push(e)}shutdown(){window.removeEventListener("online",this.so),window.removeEventListener("offline",this._o)}co(){window.addEventListener("online",this.so),window.addEventListener("offline",this._o)}oo(){oc("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.uo)e(0)}ao(){oc("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.uo)e(1)}static D(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let pp=null;function mp(){return null===pp?pp=268435456+Math.round(2147483648*Math.random()):pp++,"0x"+pp.toString(16)}const gp={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class vp{constructor(e){this.lo=e.lo,this.ho=e.ho}Po(e){this.Io=e}To(e){this.Eo=e}onMessage(e){this.Ao=e}close(){this.ho()}send(e){this.lo(e)}Ro(){this.Io()}Vo(e){this.Eo(e)}mo(e){this.Ao(e)}}const yp="WebChannelConnection";class wp extends class{constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.fo=t+"://"+e.host,this.po="projects/".concat(n,"/databases/").concat(r),this.yo="(default)"===this.databaseId.database?"project_id=".concat(n):"project_id=".concat(n,"&database_id=").concat(r)}get wo(){return!1}So(e,t,n,r,i){const o=mp(),s=this.bo(e,t.toUriEncodedString());oc("RestConnection","Sending RPC '".concat(e,"' ").concat(o,":"),s,n);const a={"google-cloud-resource-prefix":this.po,"x-goog-request-params":this.yo};return this.Do(a,r,i),this.Co(e,s,a,n).then((t=>(oc("RestConnection","Received RPC '".concat(e,"' ").concat(o,": "),t),t)),(t=>{throw ac("RestConnection","RPC '".concat(e,"' ").concat(o," failed with error: "),t,"url: ",s,"request:",n),t}))}vo(e,t,n,r,i,o){return this.So(e,t,n,r,i)}Do(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+nc,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach(((t,n)=>e[n]=t)),n&&n.headers.forEach(((t,n)=>e[n]=t))}bo(e,t){const n=gp[e];return"".concat(this.fo,"/v1/").concat(t,":").concat(n)}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Co(e,t,n,r){const i=mp();return new Promise(((o,s)=>{const a=new Xl;a.setWithCredentials(!0),a.listenOnce(Kl.COMPLETE,(()=>{try{switch(a.getLastErrorCode()){case Gl.NO_ERROR:const t=a.getResponseJson();oc(yp,"XHR for RPC '".concat(e,"' ").concat(i," received:"),JSON.stringify(t)),o(t);break;case Gl.TIMEOUT:oc(yp,"RPC '".concat(e,"' ").concat(i," timed out")),s(new fc(dc.DEADLINE_EXCEEDED,"Request time out"));break;case Gl.HTTP_ERROR:const n=a.getStatus();if(oc(yp,"RPC '".concat(e,"' ").concat(i," failed with status:"),n,"response text:",a.getResponseText()),n>0){let e=a.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=null==e?void 0:e.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(dc).indexOf(t)>=0?t:dc.UNKNOWN}(t.status);s(new fc(e,t.message))}else s(new fc(dc.UNKNOWN,"Server responded with status "+a.getStatus()))}else s(new fc(dc.UNAVAILABLE,"Connection failed."));break;default:cc()}}finally{oc(yp,"RPC '".concat(e,"' ").concat(i," completed."))}}));const l=JSON.stringify(r);oc(yp,"RPC '".concat(e,"' ").concat(i," sending request:"),r),a.send(t,"POST",l,n,15)}))}Fo(e,t,n){const r=mp(),i=[this.fo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=ql(),s=Wl(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/".concat(this.databaseId.projectId,"/databases/").concat(this.databaseId.database)},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},l=this.longPollingOptions.timeoutSeconds;void 0!==l&&(a.longPollingTimeout=Math.round(1e3*l)),this.useFetchStreams&&(a.useFetchStreams=!0),this.Do(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const c=i.join("");oc(yp,"Creating RPC '".concat(e,"' stream ").concat(r,": ").concat(c),a);const u=o.createWebChannel(c,a);let h=!1,d=!1;const f=new vp({lo:t=>{d?oc(yp,"Not sending because RPC '".concat(e,"' stream ").concat(r," is closed:"),t):(h||(oc(yp,"Opening RPC '".concat(e,"' stream ").concat(r," transport.")),u.open(),h=!0),oc(yp,"RPC '".concat(e,"' stream ").concat(r," sending:"),t),u.send(t))},ho:()=>u.close()}),p=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(e){setTimeout((()=>{throw e}),0)}}))};return p(u,Yl.EventType.OPEN,(()=>{d||oc(yp,"RPC '".concat(e,"' stream ").concat(r," transport opened."))})),p(u,Yl.EventType.CLOSE,(()=>{d||(d=!0,oc(yp,"RPC '".concat(e,"' stream ").concat(r," transport closed")),f.Vo())})),p(u,Yl.EventType.ERROR,(t=>{d||(d=!0,ac(yp,"RPC '".concat(e,"' stream ").concat(r," transport errored:"),t),f.Vo(new fc(dc.UNAVAILABLE,"The operation could not be completed")))})),p(u,Yl.EventType.MESSAGE,(t=>{var n;if(!d){const i=t.data[0];uc(!!i);const o=i,s=o.error||(null===(n=o[0])||void 0===n?void 0:n.error);if(s){oc(yp,"RPC '".concat(e,"' stream ").concat(r," received error:"),s);const t=s.status;let n=function(e){const t=Od[e];if(void 0!==t)return Ad(t)}(t),i=s.message;void 0===n&&(n=dc.INTERNAL,i="Unknown error status: "+t+" with message "+s.message),d=!0,f.Vo(new fc(n,i)),u.close()}else oc(yp,"RPC '".concat(e,"' stream ").concat(r," received:"),i),f.mo(i)}})),p(s,Ql.STAT_EVENT,(t=>{t.stat===$l.PROXY?oc(yp,"RPC '".concat(e,"' stream ").concat(r," detected buffering proxy")):t.stat===$l.NOPROXY&&oc(yp,"RPC '".concat(e,"' stream ").concat(r," detected no buffering proxy"))})),setTimeout((()=>{f.Ro()}),0),f}}function bp(){return"undefined"!=typeof document?document:null}function Ep(e){return new Zd(e,!0)}class Sp{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.5,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:6e4;this.oi=e,this.timerId=t,this.Mo=n,this.xo=r,this.Oo=i,this.No=0,this.Bo=null,this.Lo=Date.now(),this.reset()}reset(){this.No=0}ko(){this.No=this.Oo}qo(e){this.cancel();const t=Math.floor(this.No+this.Qo()),n=Math.max(0,Date.now()-this.Lo),r=Math.max(0,t-n);r>0&&oc("ExponentialBackoff","Backing off for ".concat(r," ms (base delay: ").concat(this.No," ms, delay with jitter: ").concat(t," ms, last attempt: ").concat(n," ms ago)")),this.Bo=this.oi.enqueueAfterDelay(this.timerId,r,(()=>(this.Lo=Date.now(),e()))),this.No*=this.xo,this.Nothis.Oo&&(this.No=this.Oo)}Ko(){null!==this.Bo&&(this.Bo.skipDelay(),this.Bo=null)}cancel(){null!==this.Bo&&(this.Bo.cancel(),this.Bo=null)}Qo(){return(Math.random()-.5)*this.No}}class _p{constructor(e,t,n,r,i,o,s,a){this.oi=e,this.$o=n,this.Uo=r,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=s,this.listener=a,this.state=0,this.Wo=0,this.Go=null,this.zo=null,this.stream=null,this.jo=new Sp(e,t)}Ho(){return 1===this.state||5===this.state||this.Jo()}Jo(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Yo()}async stop(){this.Ho()&&await this.close(0)}Zo(){this.state=0,this.jo.reset()}Xo(){this.Jo()&&null===this.Go&&(this.Go=this.oi.enqueueAfterDelay(this.$o,6e4,(()=>this.e_())))}t_(e){this.n_(),this.stream.send(e)}async e_(){if(this.Jo())return this.close(0)}n_(){this.Go&&(this.Go.cancel(),this.Go=null)}r_(){this.zo&&(this.zo.cancel(),this.zo=null)}async close(e,t){this.n_(),this.r_(),this.jo.cancel(),this.Wo++,4!==e?this.jo.reset():t&&t.code===dc.RESOURCE_EXHAUSTED?(sc(t.toString()),sc("Using maximum backoff delay to prevent overloading the backend."),this.jo.ko()):t&&t.code===dc.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.i_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.To(t)}i_(){}auth(){this.state=1;const e=this.s_(this.Wo),t=this.Wo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((e=>{let[n,r]=e;this.Wo===t&&this.o_(n,r)}),(t=>{e((()=>{const e=new fc(dc.UNKNOWN,"Fetching auth token failed: "+t.message);return this.__(e)}))}))}o_(e,t){const n=this.s_(this.Wo);this.stream=this.a_(e,t),this.stream.Po((()=>{n((()=>(this.state=2,this.zo=this.oi.enqueueAfterDelay(this.Uo,1e4,(()=>(this.Jo()&&(this.state=3),Promise.resolve()))),this.listener.Po())))})),this.stream.To((e=>{n((()=>this.__(e)))})),this.stream.onMessage((e=>{n((()=>this.onMessage(e)))}))}Yo(){this.state=5,this.jo.qo((async()=>{this.state=0,this.start()}))}__(e){return oc("PersistentStream","close with error: ".concat(e)),this.stream=null,this.close(4,e)}s_(e){return t=>{this.oi.enqueueAndForget((()=>this.Wo===e?t():(oc("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class kp extends _p{constructor(e,t,n,r,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,r,o),this.serializer=i}a_(e,t){return this.connection.Fo("Listen",e,t)}onMessage(e){this.jo.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const r=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:cc()}(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],o=function(e,t){return e.useProto3Json?(uc(void 0===t||"string"==typeof t),mu.fromBase64String(t||"")):(uc(void 0===t||t instanceof Uint8Array),mu.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),s=t.targetChange.cause,a=s&&function(e){const t=void 0===e.code?dc.UNKNOWN:Ad(e.code);return new fc(t,e.message||"")}(s);n=new Wd(r,i,o,a||null)}else if("documentChange"in t){t.documentChange;const r=t.documentChange;r.document,r.document.name,r.document.updateTime;const i=uf(e,r.document.name),o=of(r.document.updateTime),s=r.document.createTime?of(r.document.createTime):Ic.min(),a=new Bu({mapValue:{fields:r.document.fields}}),l=Hu.newFoundDocument(i,o,s,a),c=r.targetIds||[],u=r.removedTargetIds||[];n=new Hd(c,u,l.key,l)}else if("documentDelete"in t){t.documentDelete;const r=t.documentDelete;r.document;const i=uf(e,r.document),o=r.readTime?of(r.readTime):Ic.min(),s=Hu.newNoDocument(i,o),a=r.removedTargetIds||[];n=new Hd([],a,s.key,s)}else if("documentRemove"in t){t.documentRemove;const r=t.documentRemove;r.document;const i=uf(e,r.document),o=r.removedTargetIds||[];n=new Hd([],o,i,null)}else{if(!("filter"in t))return cc();{t.filter;const e=t.filter;e.targetId;const{count:r=0,unchangedNames:i}=e,o=new Nd(r,i),s=e.targetId;n=new qd(s,o)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return Ic.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?Ic.min():t.readTime?of(t.readTime):Ic.min()}(e);return this.listener.u_(t,n)}c_(e){const t={};t.database=ff(this.serializer),t.addTarget=function(e,t){let n;const r=t.target;if(n=gh(r)?{documents:vf(e,r)}:{query:yf(e,r).ut},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=nf(e,t.resumeToken);const r=ef(e,t.expectedCount);null!==r&&(n.expectedCount=r)}else if(t.snapshotVersion.compareTo(Ic.min())>0){n.readTime=tf(e,t.snapshotVersion.toTimestamp());const r=ef(e,t.expectedCount);null!==r&&(n.expectedCount=r)}return n}(this.serializer,e);const n=function(e,t){const n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return cc()}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.t_(t)}l_(e){const t={};t.database=ff(this.serializer),t.removeTarget=e,this.t_(t)}}class Tp extends _p{constructor(e,t,n,r,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,r,o),this.serializer=i,this.h_=!1}get P_(){return this.h_}start(){this.h_=!1,this.lastStreamToken=void 0,super.start()}i_(){this.h_&&this.I_([])}a_(e,t){return this.connection.Fo("Write",e,t)}onMessage(e){if(uc(!!e.streamToken),this.lastStreamToken=e.streamToken,this.h_){this.jo.reset();const t=function(e,t){return e&&e.length>0?(uc(void 0!==t),e.map((e=>function(e,t){let n=e.updateTime?of(e.updateTime):of(t);return n.isEqual(Ic.min())&&(n=of(t)),new ud(n,e.transformResults||[])}(e,t)))):[]}(e.writeResults,e.commitTime),n=of(e.commitTime);return this.listener.T_(n,t)}return uc(!e.writeResults||0===e.writeResults.length),this.h_=!0,this.listener.E_()}d_(){const e={};e.database=ff(this.serializer),this.t_(e)}I_(e){const t={streamToken:this.lastStreamToken,writes:e.map((e=>gf(this.serializer,e)))};this.t_(t)}}class Cp extends class{}{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.A_=!1}R_(){if(this.A_)throw new fc(dc.FAILED_PRECONDITION,"The client has already been terminated.")}So(e,t,n,r){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((i=>{let[o,s]=i;return this.connection.So(e,af(t,n),r,o,s)})).catch((e=>{throw"FirebaseError"===e.name?(e.code===dc.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new fc(dc.UNKNOWN,e.toString())}))}vo(e,t,n,r,i){return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((o=>{let[s,a]=o;return this.connection.vo(e,af(t,n),r,s,a,i)})).catch((e=>{throw"FirebaseError"===e.name?(e.code===dc.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new fc(dc.UNKNOWN,e.toString())}))}terminate(){this.A_=!0,this.connection.terminate()}}class xp{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.m_=0,this.f_=null,this.g_=!0}p_(){0===this.m_&&(this.y_("Unknown"),this.f_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.f_=null,this.w_("Backend didn't respond within 10 seconds."),this.y_("Offline"),Promise.resolve()))))}S_(e){"Online"===this.state?this.y_("Unknown"):(this.m_++,this.m_>=1&&(this.b_(),this.w_("Connection failed 1 times. Most recent error: ".concat(e.toString())),this.y_("Offline")))}set(e){this.b_(),this.m_=0,"Online"===e&&(this.g_=!1),this.y_(e)}y_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}w_(e){const t="Could not reach Cloud Firestore backend. ".concat(e,"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.");this.g_?(sc(t),this.g_=!1):oc("OnlineStateTracker",t)}b_(){null!==this.f_&&(this.f_.cancel(),this.f_=null)}}class Ip{constructor(e,t,n,r,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.D_=[],this.C_=new Map,this.v_=new Set,this.F_=[],this.M_=i,this.M_.io((e=>{n.enqueueAndForget((async()=>{jp(this)&&(oc("RemoteStore","Restarting streams for network reachability change."),await async function(e){const t=hc(e);t.v_.add(4),await Op(t),t.x_.set("Unknown"),t.v_.delete(4),await Np(t)}(this))}))})),this.x_=new xp(n,r)}}async function Np(e){if(jp(e))for(const t of e.F_)await t(!0)}async function Op(e){for(const t of e.F_)await t(!1)}function Pp(e,t){const n=hc(e);n.C_.has(t.targetId)||(n.C_.set(t.targetId,t),Mp(n)?Lp(n):tm(n).Jo()&&Ap(n,t))}function Rp(e,t){const n=hc(e),r=tm(n);n.C_.delete(t),r.Jo()&&Dp(n,t),0===n.C_.size&&(r.Jo()?r.Xo():jp(n)&&n.x_.set("Unknown"))}function Ap(e,t){if(e.O_.Oe(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(Ic.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}tm(e).c_(t)}function Dp(e,t){e.O_.Oe(t),tm(e).l_(t)}function Lp(e){e.O_=new Kd({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),_t:t=>e.C_.get(t)||null,nt:()=>e.datastore.serializer.databaseId}),tm(e).start(),e.x_.p_()}function Mp(e){return jp(e)&&!tm(e).Ho()&&e.C_.size>0}function jp(e){return 0===hc(e).v_.size}function Fp(e){e.O_=void 0}async function Up(e){e.C_.forEach(((t,n)=>{Ap(e,t)}))}async function Vp(e,t){Fp(e),Mp(e)?(e.x_.S_(t),Lp(e)):e.x_.set("Unknown")}async function Bp(e,t,n){if(e.x_.set("Online"),t instanceof Wd&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const r of t.targetIds)e.C_.has(r)&&(await e.remoteSyncer.rejectListen(r,n),e.C_.delete(r),e.O_.removeTarget(r))}(e,t)}catch(n){oc("RemoteStore","Failed to remove targets %s: %s ",t.targetIds.join(","),n),await zp(e,n)}else if(t instanceof Hd?e.O_.$e(t):t instanceof qd?e.O_.Je(t):e.O_.Ge(t),!n.isEqual(Ic.min()))try{const t=await rp(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.O_.it(t);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const i=e.C_.get(r);i&&e.C_.set(r,i.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach(((t,n)=>{const r=e.C_.get(t);if(!r)return;e.C_.set(t,r.withResumeToken(mu.EMPTY_BYTE_STRING,r.snapshotVersion)),Dp(e,t);const i=new Nf(r.target,t,n,r.sequenceNumber);Ap(e,i)})),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){oc("RemoteStore","Failed to raise snapshot:",t),await zp(e,t)}}async function zp(e,t,n){if(!Kc(t))throw t;e.v_.add(1),await Op(e),e.x_.set("Offline"),n||(n=()=>rp(e.localStore)),e.asyncQueue.enqueueRetryable((async()=>{oc("RemoteStore","Retrying IndexedDB access"),await n(),e.v_.delete(1),await Np(e)}))}function Hp(e,t){return t().catch((n=>zp(e,n,t)))}async function qp(e){const t=hc(e),n=nm(t);let r=t.D_.length>0?t.D_[t.D_.length-1].batchId:-1;for(;Wp(t);)try{const e=await op(t.localStore,r);if(null===e){0===t.D_.length&&n.Xo();break}r=e.batchId,Gp(t,e)}catch(e){await zp(t,e)}Kp(t)&&Qp(t)}function Wp(e){return jp(e)&&e.D_.length<10}function Gp(e,t){e.D_.push(t);const n=nm(e);n.Jo()&&n.P_&&n.I_(t.mutations)}function Kp(e){return jp(e)&&!nm(e).Ho()&&e.D_.length>0}function Qp(e){nm(e).start()}async function $p(e){nm(e).d_()}async function Yp(e){const t=nm(e);for(const n of e.D_)t.I_(n.mutations)}async function Xp(e,t,n){const r=e.D_.shift(),i=xd.from(r,t,n);await Hp(e,(()=>e.remoteSyncer.applySuccessfulWrite(i))),await qp(e)}async function Jp(e,t){t&&nm(e).P_&&await async function(e,t){if(function(e){return Rd(e)&&e!==dc.ABORTED}(t.code)){const n=e.D_.shift();nm(e).Zo(),await Hp(e,(()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t))),await qp(e)}}(e,t),Kp(e)&&Qp(e)}async function Zp(e,t){const n=hc(e);n.asyncQueue.verifyOperationInProgress(),oc("RemoteStore","RemoteStore received new credentials");const r=jp(n);n.v_.add(3),await Op(n),r&&n.x_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.v_.delete(3),await Np(n)}async function em(e,t){const n=hc(e);t?(n.v_.delete(2),await Np(n)):t||(n.v_.add(2),await Op(n),n.x_.set("Unknown"))}function tm(e){return e.N_||(e.N_=function(e,t,n){const r=hc(e);return r.R_(),new kp(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Po:Up.bind(null,e),To:Vp.bind(null,e),u_:Bp.bind(null,e)}),e.F_.push((async t=>{t?(e.N_.Zo(),Mp(e)?Lp(e):e.x_.set("Unknown")):(await e.N_.stop(),Fp(e))}))),e.N_}function nm(e){return e.B_||(e.B_=function(e,t,n){const r=hc(e);return r.R_(),new Tp(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Po:$p.bind(null,e),To:Jp.bind(null,e),E_:Yp.bind(null,e),T_:Xp.bind(null,e)}),e.F_.push((async t=>{t?(e.B_.Zo(),await qp(e)):(await e.B_.stop(),e.D_.length>0&&(oc("RemoteStore","Stopping write stream with ".concat(e.D_.length," pending writes")),e.D_=[]))}))),e.B_}class rm{constructor(e,t,n,r,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new pc,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,r,i){const o=Date.now()+n,s=new rm(e,t,o,r,i);return s.start(n),s}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new fc(dc.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function im(e,t){if(sc("AsyncQueue","".concat(t,": ").concat(e)),Kc(e))return new fc(dc.UNAVAILABLE,"".concat(t,": ").concat(e));throw e}class om{constructor(e){this.comparator=e?(t,n)=>e(t,n)||Ac.comparator(t.key,n.key):(e,t)=>Ac.comparator(e.key,t.key),this.keyedMap=Fh(),this.sortedSet=new lu(this.comparator)}static emptySet(e){return new om(e.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((t,n)=>(e(t),!1)))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof om))return!1;if(this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(!e.isEqual(r))return!1}return!0}toString(){const e=[];return this.forEach((t=>{e.push(t.toString())})),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){const n=new om;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}class sm{constructor(){this.L_=new lu(Ac.comparator)}track(e){const t=e.doc.key,n=this.L_.get(t);n?0!==e.type&&3===n.type?this.L_=this.L_.insert(t,e):3===e.type&&1!==n.type?this.L_=this.L_.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.L_=this.L_.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.L_=this.L_.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.L_=this.L_.remove(t):1===e.type&&2===n.type?this.L_=this.L_.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.L_=this.L_.insert(t,{type:2,doc:e.doc}):cc():this.L_=this.L_.insert(t,e)}k_(){const e=[];return this.L_.inorderTraversal(((t,n)=>{e.push(n)})),e}}class am{constructor(e,t,n,r,i,o,s,a,l){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=s,this.excludesMetadataChanges=a,this.hasCachedResults=l}static fromInitialDocuments(e,t,n,r,i){const o=[];return t.forEach((e=>{o.push({type:0,doc:e})})),new am(e,t,om.emptySet(t),o,n,r,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&xh(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let r=0;rIh(e)),xh),this.onlineState="Unknown",this.K_=new Set}}async function um(e,t){const n=hc(e),r=t.query;let i=!1,o=n.queries.get(r);if(o||(i=!0,o=new lm),i)try{o.q_=await n.onListen(r)}catch(e){const n=im(e,"Initialization of query '".concat(Nh(t.query),"' failed"));return void t.onError(n)}n.queries.set(r,o),o.Q_.push(t),t.U_(n.onlineState),o.q_&&t.W_(o.q_)&&pm(n)}async function hm(e,t){const n=hc(e),r=t.query;let i=!1;const o=n.queries.get(r);if(o){const e=o.Q_.indexOf(t);e>=0&&(o.Q_.splice(e,1),i=0===o.Q_.length)}if(i)return n.queries.delete(r),n.onUnlisten(r)}function dm(e,t){const n=hc(e);let r=!1;for(const i of t){const e=i.query,t=n.queries.get(e);if(t){for(const e of t.Q_)e.W_(i)&&(r=!0);t.q_=i}}r&&pm(n)}function fm(e,t,n){const r=hc(e),i=r.queries.get(t);if(i)for(const o of i.Q_)o.onError(n);r.queries.delete(t)}function pm(e){e.K_.forEach((e=>{e.next()}))}class mm{constructor(e,t,n){this.query=e,this.G_=t,this.z_=!1,this.j_=null,this.onlineState="Unknown",this.options=n||{}}W_(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new am(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.z_?this.H_(e)&&(this.G_.next(e),t=!0):this.J_(e,this.onlineState)&&(this.Y_(e),t=!0),this.j_=e,t}onError(e){this.G_.error(e)}U_(e){this.onlineState=e;let t=!1;return this.j_&&!this.z_&&this.J_(this.j_,e)&&(this.Y_(this.j_),t=!0),t}J_(e,t){if(!e.fromCache)return!0;const n="Offline"!==t;return(!this.options.Z_||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}H_(e){if(e.docChanges.length>0)return!0;const t=this.j_&&this.j_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}Y_(e){e=am.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.z_=!0,this.G_.next(e)}}class gm{constructor(e){this.key=e}}class vm{constructor(e){this.key=e}}class ym{constructor(e,t){this.query=e,this.oa=t,this._a=null,this.hasCachedResults=!1,this.current=!1,this.aa=Wh(),this.mutatedKeys=Wh(),this.ua=Rh(e),this.ca=new om(this.ua)}get la(){return this.oa}ha(e,t){const n=t?t.Pa:new sm,r=t?t.ca:this.ca;let i=t?t.mutatedKeys:this.mutatedKeys,o=r,s=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,l="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(e.inorderTraversal(((e,t)=>{const c=r.get(e),u=Oh(this.query,t)?t:null,h=!!c&&this.mutatedKeys.has(c.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations);let f=!1;c&&u?c.data.isEqual(u.data)?h!==d&&(n.track({type:3,doc:u}),f=!0):this.Ia(c,u)||(n.track({type:2,doc:u}),f=!0,(a&&this.ua(u,a)>0||l&&this.ua(u,l)<0)&&(s=!0)):!c&&u?(n.track({type:0,doc:u}),f=!0):c&&!u&&(n.track({type:1,doc:c}),f=!0,(a||l)&&(s=!0)),f&&(u?(o=o.add(u),i=d?i.add(e):i.delete(e)):(o=o.delete(e),i=i.delete(e)))})),null!==this.query.limit)for(;o.size>this.query.limit;){const e="F"===this.query.limitType?o.last():o.first();o=o.delete(e.key),i=i.delete(e.key),n.track({type:1,doc:e})}return{ca:o,Pa:n,Xi:s,mutatedKeys:i}}Ia(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,r){const i=this.ca;this.ca=e.ca,this.mutatedKeys=e.mutatedKeys;const o=e.Pa.k_();o.sort(((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return cc()}};return n(e)-n(t)}(e.type,t.type)||this.ua(e.doc,t.doc))),this.Ta(n),r=null!=r&&r;const s=t&&!r?this.Ea():[],a=0===this.aa.size&&this.current&&!r?1:0,l=a!==this._a;return this._a=a,0!==o.length||l?{snapshot:new am(this.query,e.ca,i,o,e.mutatedKeys,0===a,l,!1,!!n&&n.resumeToken.approximateByteSize()>0),da:s}:{da:s}}U_(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({ca:this.ca,Pa:new sm,mutatedKeys:this.mutatedKeys,Xi:!1},!1)):{da:[]}}Aa(e){return!this.oa.has(e)&&!!this.ca.has(e)&&!this.ca.get(e).hasLocalMutations}Ta(e){e&&(e.addedDocuments.forEach((e=>this.oa=this.oa.add(e))),e.modifiedDocuments.forEach((e=>{})),e.removedDocuments.forEach((e=>this.oa=this.oa.delete(e))),this.current=e.current)}Ea(){if(!this.current)return[];const e=this.aa;this.aa=Wh(),this.ca.forEach((e=>{this.Aa(e.key)&&(this.aa=this.aa.add(e.key))}));const t=[];return e.forEach((e=>{this.aa.has(e)||t.push(new vm(e))})),this.aa.forEach((n=>{e.has(n)||t.push(new gm(n))})),t}Ra(e){this.oa=e.hs,this.aa=Wh();const t=this.ha(e.documents);return this.applyChanges(t,!0)}Va(){return am.fromInitialDocuments(this.query,this.ca,this.mutatedKeys,0===this._a,this.hasCachedResults)}}class wm{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class bm{constructor(e){this.key=e,this.ma=!1}}class Em{constructor(e,t,n,r,i,o){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.fa={},this.ga=new Dh((e=>Ih(e)),xh),this.pa=new Map,this.ya=new Set,this.wa=new lu(Ac.comparator),this.Sa=new Map,this.ba=new zf,this.Da={},this.Ca=new Map,this.va=Mf.Bn(),this.onlineState="Unknown",this.Fa=void 0}get isPrimaryClient(){return!0===this.Fa}}async function Sm(e,t){const n=Vm(e);let r,i;const o=n.ga.get(t);if(o)r=o.targetId,n.sharedClientState.addLocalQueryTarget(r),i=o.view.Va();else{const e=await sp(n.localStore,_h(t)),o=n.sharedClientState.addLocalQueryTarget(e.targetId);r=e.targetId,i=await _m(n,t,r,"current"===o,e.resumeToken),n.isPrimaryClient&&Pp(n.remoteStore,e)}return i}async function _m(e,t,n,r,i){e.Ma=(t,n,r)=>async function(e,t,n,r){let i=t.view.ha(n);i.Xi&&(i=await lp(e.localStore,t.query,!1).then((e=>{let{documents:n}=e;return t.view.ha(n,i)})));const o=r&&r.targetChanges.get(t.targetId),s=r&&null!=r.targetMismatches.get(t.targetId),a=t.view.applyChanges(i,e.isPrimaryClient,o,s);return Dm(e,t.targetId,a.da),a.snapshot}(e,t,n,r);const o=await lp(e.localStore,t,!0),s=new ym(t,o.hs),a=s.ha(o.documents),l=zd.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==e.onlineState,i),c=s.applyChanges(a,e.isPrimaryClient,l);Dm(e,n,c.da);const u=new wm(t,n,s);return e.ga.set(t,u),e.pa.has(n)?e.pa.get(n).push(t):e.pa.set(n,[t]),c.snapshot}async function km(e,t){const n=hc(e),r=n.ga.get(t),i=n.pa.get(r.targetId);if(i.length>1)return n.pa.set(r.targetId,i.filter((e=>!xh(e,t)))),void n.ga.delete(t);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await ap(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),Rp(n.remoteStore,r.targetId),Rm(n,r.targetId)})).catch(Bc)):(Rm(n,r.targetId),await ap(n.localStore,r.targetId,!0))}async function Tm(e,t){const n=hc(e);try{const e=await function(e,t){const n=hc(e),r=t.snapshotVersion;let i=n.ns;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(e=>{const o=n.os.newChangeBuffer({trackRemovals:!0});i=n.ns;const s=[];t.targetChanges.forEach(((o,a)=>{const l=i.get(a);if(!l)return;s.push(n.Qr.removeMatchingKeys(e,o.removedDocuments,a).next((()=>n.Qr.addMatchingKeys(e,o.addedDocuments,a))));let c=l.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?c=c.withResumeToken(mu.EMPTY_BYTE_STRING,Ic.min()).withLastLimboFreeSnapshotVersion(Ic.min()):o.resumeToken.approximateByteSize()>0&&(c=c.withResumeToken(o.resumeToken,r)),i=i.insert(a,c),function(e,t,n){return 0===e.resumeToken.approximateByteSize()||t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(l,c,o)&&s.push(n.Qr.updateTargetData(e,c))}));let a=Mh(),l=Wh();if(t.documentUpdates.forEach((r=>{t.resolvedLimboDocuments.has(r)&&s.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))})),s.push(ip(e,o,t.documentUpdates).next((e=>{a=e.cs,l=e.ls}))),!r.isEqual(Ic.min())){const t=n.Qr.getLastRemoteSnapshotVersion(e).next((t=>n.Qr.setTargetsMetadata(e,e.currentSequenceNumber,r)));s.push(t)}return zc.waitFor(s).next((()=>o.apply(e))).next((()=>n.localDocuments.getLocalViewOfDocuments(e,a,l))).next((()=>a))})).then((e=>(n.ns=i,e)))}(n.localStore,t);t.targetChanges.forEach(((e,t)=>{const r=n.Sa.get(t);r&&(uc(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1),e.addedDocuments.size>0?r.ma=!0:e.modifiedDocuments.size>0?uc(r.ma):e.removedDocuments.size>0&&(uc(r.ma),r.ma=!1))})),await jm(n,e,t)}catch(e){await Bc(e)}}function Cm(e,t,n){const r=hc(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const e=[];r.ga.forEach(((n,r)=>{const i=r.view.U_(t);i.snapshot&&e.push(i.snapshot)})),function(e,t){const n=hc(e);n.onlineState=t;let r=!1;n.queries.forEach(((e,n)=>{for(const i of n.Q_)i.U_(t)&&(r=!0)})),r&&pm(n)}(r.eventManager,t),e.length&&r.fa.u_(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function xm(e,t,n){const r=hc(e);r.sharedClientState.updateQueryState(t,"rejected",n);const i=r.Sa.get(t),o=i&&i.key;if(o){let e=new lu(Ac.comparator);e=e.insert(o,Hu.newNoDocument(o,Ic.min()));const n=Wh().add(o),i=new Bd(Ic.min(),new Map,new lu(Tc),e,n);await Tm(r,i),r.wa=r.wa.remove(o),r.Sa.delete(t),Mm(r)}else await ap(r.localStore,t,!1).then((()=>Rm(r,t,n))).catch(Bc)}async function Im(e,t){const n=hc(e),r=t.batch.batchId;try{const e=await function(e,t){const n=hc(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(e=>{const r=t.batch.keys(),i=n.os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){const i=n.batch,o=i.keys();let s=zc.resolve();return o.forEach((e=>{s=s.next((()=>r.getEntry(t,e))).next((t=>{const o=n.docVersions.get(e);uc(null!==o),t.version.compareTo(o)<0&&(i.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))}))})),s.next((()=>e.mutationQueue.removeMutationBatch(t,i)))}(n,e,t,i).next((()=>i.apply(e))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=Wh();for(let n=0;n0&&(t=t.add(e.batch.mutations[n].key));return t}(t)))).next((()=>n.localDocuments.getDocuments(e,r)))}))}(n.localStore,t);Pm(n,r,null),Om(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await jm(n,e)}catch(e){await Bc(e)}}async function Nm(e,t,n){const r=hc(e);try{const e=await function(e,t){const n=hc(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",(e=>{let r;return n.mutationQueue.lookupMutationBatch(e,t).next((t=>(uc(null!==t),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t)))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r))).next((()=>n.localDocuments.getDocuments(e,r)))}))}(r.localStore,t);Pm(r,t,n),Om(r,t),r.sharedClientState.updateMutationState(t,"rejected",n),await jm(r,e)}catch(n){await Bc(n)}}function Om(e,t){(e.Ca.get(t)||[]).forEach((e=>{e.resolve()})),e.Ca.delete(t)}function Pm(e,t,n){const r=hc(e);let i=r.Da[r.currentUser.toKey()];if(i){const e=i.get(t);e&&(n?e.reject(n):e.resolve(),i=i.remove(t)),r.Da[r.currentUser.toKey()]=i}}function Rm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.sharedClientState.removeLocalQueryTarget(t);for(const r of e.pa.get(t))e.ga.delete(r),n&&e.fa.xa(r,n);e.pa.delete(t),e.isPrimaryClient&&e.ba.Vr(t).forEach((t=>{e.ba.containsKey(t)||Am(e,t)}))}function Am(e,t){e.ya.delete(t.path.canonicalString());const n=e.wa.get(t);null!==n&&(Rp(e.remoteStore,n),e.wa=e.wa.remove(t),e.Sa.delete(n),Mm(e))}function Dm(e,t,n){for(const r of n)r instanceof gm?(e.ba.addReference(r.key,t),Lm(e,r)):r instanceof vm?(oc("SyncEngine","Document no longer in limbo: "+r.key),e.ba.removeReference(r.key,t),e.ba.containsKey(r.key)||Am(e,r.key)):cc()}function Lm(e,t){const n=t.key,r=n.path.canonicalString();e.wa.get(n)||e.ya.has(r)||(oc("SyncEngine","New document in limbo: "+n),e.ya.add(r),Mm(e))}function Mm(e){for(;e.ya.size>0&&e.wa.size{s.push(r.Ma(a,t,n).then((e=>{if((e||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==e?void 0:e.fromCache)?"not-current":"current"),e){i.push(e);const t=Xf.Ki(a.targetId,e);o.push(t)}})))})),await Promise.all(s),r.fa.u_(i),await async function(e,t){const n=hc(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(e=>zc.forEach(t,(t=>zc.forEach(t.qi,(r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r))).next((()=>zc.forEach(t.Qi,(r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))))))}catch(e){if(!Kc(e))throw e;oc("LocalStore","Failed to update sequence numbers: "+e)}for(const r of t){const e=r.targetId;if(!r.fromCache){const t=n.ns.get(e),r=t.snapshotVersion,i=t.withLastLimboFreeSnapshotVersion(r);n.ns=n.ns.insert(e,i)}}}(r.localStore,o))}async function Fm(e,t){const n=hc(e);if(!n.currentUser.isEqual(t)){oc("SyncEngine","User change. New user:",t.toKey());const e=await np(n.localStore,t);n.currentUser=t,function(e,t){e.Ca.forEach((e=>{e.forEach((e=>{e.reject(new fc(dc.CANCELLED,t))}))})),e.Ca.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await jm(n,e.us)}}function Um(e,t){const n=hc(e),r=n.Sa.get(t);if(r&&r.ma)return Wh().add(r.key);{let e=Wh();const r=n.pa.get(t);if(!r)return e;for(const t of r){const r=n.ga.get(t);e=e.unionWith(r.view.la)}return e}}function Vm(e){const t=hc(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=Tm.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Um.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=xm.bind(null,t),t.fa.u_=dm.bind(null,t.eventManager),t.fa.xa=fm.bind(null,t.eventManager),t}function Bm(e){const t=hc(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=Im.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=Nm.bind(null,t),t}class zm{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=Ep(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){return tp(this.persistence,new Zf,e.initialUser,this.serializer)}createPersistence(e){return new Qf(Yf.Hr,this.serializer)}createSharedClientState(e){return new hp}async terminate(){var e,t;null===(e=this.gcScheduler)||void 0===e||e.stop(),null===(t=this.indexBackfillerScheduler)||void 0===t||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Hm{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>Cm(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Fm.bind(null,this.syncEngine),await em(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new cm}createDatastore(e){const t=Ep(e.databaseInfo.databaseId),n=function(e){return new wp(e)}(e.databaseInfo);return function(e,t,n,r){return new Cp(e,t,n,r)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,r,i){return new Ip(e,t,n,r,i)}(this.localStore,this.datastore,e.asyncQueue,(e=>Cm(this.syncEngine,e,0)),fp.D()?new fp:new dp)}createSyncEngine(e,t){return function(e,t,n,r,i,o,s){const a=new Em(e,t,n,r,i,o);return s&&(a.Fa=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e;await async function(e){const t=hc(e);oc("RemoteStore","RemoteStore shutting down."),t.v_.add(5),await Op(t),t.M_.shutdown(),t.x_.set("Unknown")}(this.remoteStore),null===(e=this.datastore)||void 0===e||e.terminate()}}class qm{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Ba(this.observer.next,e)}error(e){this.observer.error?this.Ba(this.observer.error,e):sc("Uncaught Error in snapshot listener:",e.toString())}La(){this.muted=!0}Ba(e,t){this.muted||setTimeout((()=>{this.muted||e(t)}),0)}}class Wm{constructor(e,t,n,r){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=r,this.user=tc.UNAUTHENTICATED,this.clientId=kc.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async e=>{oc("FirestoreClient","Received user=",e.uid),await this.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(oc("FirestoreClient","Received new app check token=",e),this.appCheckCredentialListener(e,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new fc(dc.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new pc;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(vv){const n=im(vv,"Failed to shutdown persistence");e.reject(n)}})),e.promise}}async function Gm(e,t){e.asyncQueue.verifyOperationInProgress(),oc("FirestoreClient","Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener((async e=>{r.isEqual(e)||(await np(t.localStore,e),r=e)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e._offlineComponents=t}async function Km(e,t){e.asyncQueue.verifyOperationInProgress();const n=await $m(e);oc("FirestoreClient","Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener((e=>Zp(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>Zp(t.remoteStore,n))),e._onlineComponents=t}function Qm(e){return"FirebaseError"===e.name?e.code===dc.FAILED_PRECONDITION||e.code===dc.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}async function $m(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){oc("FirestoreClient","Using user provided OfflineComponentProvider");try{await Gm(e,e._uninitializedComponentsProvider._offline)}catch(vv){const n=vv;if(!Qm(n))throw n;ac("Error using user provided cache. Falling back to memory cache: "+n),await Gm(e,new zm)}}else oc("FirestoreClient","Using default OfflineComponentProvider"),await Gm(e,new zm);return e._offlineComponents}async function Ym(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(oc("FirestoreClient","Using user provided OnlineComponentProvider"),await Km(e,e._uninitializedComponentsProvider._online)):(oc("FirestoreClient","Using default OnlineComponentProvider"),await Km(e,new Hm))),e._onlineComponents}function Xm(e){return Ym(e).then((e=>e.syncEngine))}async function Jm(e){const t=await Ym(e),n=t.eventManager;return n.onListen=Sm.bind(null,t.syncEngine),n.onUnlisten=km.bind(null,t.syncEngine),n}function Zm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new pc;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,r,i){const o=new qm({next:n=>{t.enqueueAndForget((()=>hm(e,s))),n.fromCache&&"server"===r.source?i.reject(new fc(dc.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):i.resolve(n)},error:e=>i.reject(e)}),s=new mm(n,o,{includeMetadataChanges:!0,Z_:!0});return um(e,s)}(await Jm(e),e.asyncQueue,t,n,r))),r.promise}function eg(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}const tg=new Map;function ng(e,t,n){if(!n)throw new fc(dc.INVALID_ARGUMENT,"Function ".concat(e,"() cannot be called with an empty ").concat(t,"."))}function rg(e){if(!Ac.isDocumentKey(e))throw new fc(dc.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but ".concat(e," has ").concat(e.length,"."))}function ig(e){if(Ac.isDocumentKey(e))throw new fc(dc.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but ".concat(e," has ").concat(e.length,"."))}function og(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e="".concat(e.substring(0,20),"...")),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?"a custom ".concat(t," object"):"an object"}}return"function"==typeof e?"a function":cc()}function sg(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new fc(dc.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=og(e);throw new fc(dc.INVALID_ARGUMENT,"Expected type '".concat(t.name,"', but it was: ").concat(n))}}return e}function ag(e,t){if(t<=0)throw new fc(dc.INVALID_ARGUMENT,"Function ".concat(e,"() requires a positive number, but it was: ").concat(t,"."))}class lg{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new fc(dc.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=null===(t=e.ssl)||void 0===t||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new fc(dc.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,r){if(!0===t&&!0===r)throw new fc(dc.INVALID_ARGUMENT,"".concat(e," and ").concat(n," cannot be used together."))})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=eg(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new fc(dc.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (must not be NaN)"));if(e.timeoutSeconds<5)throw new fc(dc.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (minimum allowed value is 5)"));if(e.timeoutSeconds>30)throw new fc(dc.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (maximum allowed value is 30)"))}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class cg{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new lg({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new fc(dc.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new fc(dc.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new lg(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new gc;switch(e.type){case"firstParty":return new bc(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new fc(dc.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=tg.get(e);t&&(oc("ComponentProvider","Removing Datastore"),tg.delete(e),t.terminate())}(this),Promise.resolve()}}function ug(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};var i;const o=(e=sg(e,cg))._getSettings(),s="".concat(t,":").concat(n);if("firestore.googleapis.com"!==o.host&&o.host!==s&&ac("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),e._setSettings(Object.assign(Object.assign({},o),{host:s,ssl:!1})),r.mockUserToken){let t,n;if("string"==typeof r.mockUserToken)t=r.mockUserToken,n=tc.MOCK_USER;else{t=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",r=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:"https://securetoken.google.com/".concat(n),aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e);return[x(JSON.stringify({alg:"none",type:"JWT"})),x(JSON.stringify(o)),""].join(".")}(r.mockUserToken,null===(i=e._app)||void 0===i?void 0:i.options.projectId);const o=r.mockUserToken.sub||r.mockUserToken.user_id;if(!o)throw new fc(dc.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new tc(o)}e._authCredentials=new vc(new mc(t,n))}}class hg{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new hg(this.firestore,e,this._query)}}class dg{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new fg(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new dg(this.firestore,e,this._key)}}class fg extends hg{constructor(e,t,n){super(e,t,wh(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new dg(this.firestore,null,new Ac(e))}withConverter(e){return new fg(this.firestore,e,this._path)}}function pg(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i{const e=bp();e&&oc("AsyncQueue","Visibility state changed to "+e.visibilityState),this.jo.Ko()};const e=bp();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this._u)}get isShuttingDown(){return this.tu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.au(),this.uu(e)}enterRestrictedMode(e){if(!this.tu){this.tu=!0,this.su=e||!1;const t=bp();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this._u)}}enqueue(e){if(this.au(),this.tu)return new Promise((()=>{}));const t=new pc;return this.uu((()=>this.tu&&this.su?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.eu.push(e),this.cu())))}async cu(){if(0!==this.eu.length){try{await this.eu[0](),this.eu.shift(),this.jo.reset()}catch(e){if(!Kc(e))throw e;oc("AsyncQueue","Operation failed with retryable error: "+e)}this.eu.length>0&&this.jo.qo((()=>this.cu()))}}uu(e){const t=this.Xa.then((()=>(this.iu=!0,e().catch((e=>{this.ru=e,this.iu=!1;const t=function(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}(e);throw sc("INTERNAL UNHANDLED ERROR: ",t),e})).then((e=>(this.iu=!1,e))))));return this.Xa=t,t}enqueueAfterDelay(e,t,n){this.au(),this.ou.indexOf(e)>-1&&(t=0);const r=rm.createAndSchedule(this,e,t,n,(e=>this.lu(e)));return this.nu.push(r),r}au(){this.ru&&cc()}verifyOperationInProgress(){}async hu(){let e;do{e=this.Xa,await e}while(e!==this.Xa)}Pu(e){for(const t of this.nu)if(t.timerId===e)return!0;return!1}Iu(e){return this.hu().then((()=>{this.nu.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(const t of this.nu)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.hu()}))}Tu(e){this.ou.push(e)}lu(e){const t=this.nu.indexOf(e);this.nu.splice(t,1)}}function gg(e){return function(e,t){if("object"!=typeof e||null===e)return!1;const n=e;for(const r of t)if(r in n&&"function"==typeof n[r])return!0;return!1}(e,["next","error","complete"])}class vg extends cg{constructor(e,t,n,r){super(e,t,n,r),this.type="firestore",this._queue=new mg,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||wg(this),this._firestoreClient.terminate()}}function yg(e){return e._firestoreClient||wg(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function wg(e){var t,n,r;const i=e._freezeSettings(),o=function(e,t,n,r){return new _u(e,t,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,eg(r.experimentalLongPollingOptions),r.useFetchStreams)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,i);e._firestoreClient=new Wm(e._authCredentials,e._appCheckCredentials,e._queue,o),(null===(n=i.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(r=i.localCache)||void 0===r?void 0:r._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.localCache.kind,_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider})}class bg{constructor(e){this._byteString=e}static fromBase64String(e){try{return new bg(mu.fromBase64String(e))}catch(e){throw new fc(dc.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new bg(mu.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}class Eg{constructor(){for(var e=arguments.length,t=new Array(e),n=0;n90)throw new fc(dc.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new fc(dc.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return Tc(this._lat,e._lat)||Tc(this._long,e._long)}}const kg=/^__.*__$/;class Tg{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new bd(e,this.data,this.fieldMask,t,this.fieldTransforms):new wd(e,this.data,t,this.fieldTransforms)}}function Cg(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw cc()}}class xg{constructor(e,t,n,r,i,o){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this.Eu(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get du(){return this.settings.du}Au(e){return new xg(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Ru(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.Au({path:n,Vu:!1});return r.mu(e),r}fu(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.Au({path:n,Vu:!1});return r.Eu(),r}gu(e){return this.Au({path:void 0,Vu:!0})}pu(e){return Vg(e,this.settings.methodName,this.settings.yu||!1,this.path,this.settings.wu)}contains(e){return void 0!==this.fieldMask.find((t=>e.isPrefixOf(t)))||void 0!==this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))}Eu(){if(this.path)for(let e=0;e