PageSourceSearch

https://screen-dashboard-prod.herokuapp.com/screen_dashboard/_next/static/chunks/191g09g3qheg-.js

js screen-dashboard-prod.herokuapp.com collected 2026-10-03 14:51:56 UTC 344,885 bytes, 395 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,65777,(e,t,n)=>{t.exports=e.r(79466)},47300,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){console.warn("[react-gtm]",e)}},56003,(e,t,n)=>{"use strict";var i,r=(i=e.r(47300))&&i.__esModule?i:{default:i};t.exports={tags:function(e){var t=e.id,n=e.events,i=e.dataLayer,s=e.dataLayerName,o=e.preview,a="&gtm_auth="+e.auth,l="&gtm_preview="+o;t||(0,r.default)("GTM Id is required");var h="\n      (function(w,d,s,l,i){w[l]=w[l]||[];\n        w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js', "+JSON.stringify(n).slice(1,-1)+"});\n        var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';\n        j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl+'"+a+l+"&gtm_cookies_win=x';\n        f.parentNode.insertBefore(j,f);\n      })(window,document,'script','"+s+"','"+t+"');";return{iframe:'\n      <iframe src="https://www.googletagmanager.com/ns.html?id='+t+a+l+'&gtm_cookies_win=x"\n        height="0" width="0" style="display:none;visibility:hidden" id="tag-manager"></iframe>',script:h,dataLayerVar:this.dataLayer(i,s)}},dataLayer:function(e,t){return"\n      window."+t+" = window."+t+" || [];\n      window."+t+".push("+JSON.stringify(e)+")"}}},21663,(e,t,n)=>{"use strict";var i,r=(i=e.r(56003))&&i.__esModule?i:{default:i};t.exports={dataScript:function(e){var t=document.createElement("script");return t.innerHTML=e,t},gtm:function(e){var t=r.default.tags(e);return{noScript:function(){var e=document.createElement("noscript");return e.innerHTML=t.iframe,e},script:function(){var e=document.createElement("script");return e.innerHTML=t.script,e},dataScript:this.dataScript(t.dataLayerVar)}},initialize:function(e){var t=e.gtmId,n=e.events,i=e.dataLayer,r=e.dataLayerName,s=e.auth,o=e.preview,a=this.gtm({id:t,events:void 0===n?{}:n,dataLayer:i||void 0,dataLayerName:void 0===r?"dataLayer":r,auth:void 0===s?"":s,preview:void 0===o?"":o});i&&document.head.appendChild(a.dataScript),document.head.insertBefore(a.script(),document.head.childNodes[0]),document.body.insertBefore(a.noScript(),document.body.childNodes[0])},dataLayer:function(e){var t=e.dataLayer,n=e.dataLayerName,i=void 0===n?"dataLayer":n;if(window[i])return window[i].push(t);var s=r.default.dataLayer(t,i),o=this.dataScript(s);document.head.insertBefore(o,document.head.childNodes[0])}}},30746,(e,t,n)=>{"use strict";var i;t.exports=((i=e.r(21663))&&i.__esModule?i:{default:i}).default},22319,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.regionAPIs=void 0,n.regionAPIs=new Map([["us","https://api-iam.intercom.io"],["eu","https://api-iam.eu.intercom.io"],["ap","https://api-iam.au.intercom.io"]])},58522,(e,t,n)=>{"use strict";var i=e.e&&e.e.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(n,"__esModule",{value:!0}),n.ref=n.init=void 0;let r="_intercom_npm_loader",s=function(){s.loaderQueue(arguments)};s.q=[],s.loaderQueue=function(e){s.q.push(e)};let o=function(){var e,t,n=document;if(!n.getElementById(r)){var i=n.createElement("script");i.type="text/javascript",i.async=!0,i.id=r,i.src="https://widget.intercom.io/widget/"+(null==(e=window.intercomSettings)?void 0:e.app_id);var s=n.getElementsByTagName("script")[0];null==(t=s.parentNode)||t.insertBefore(i,s)}},a=()=>"complete"===document.readyState||"interactive"===document.readyState;n.init=()=>i(void 0,void 0,void 0,function*(){var e=window,t=e.Intercom;e.intercomSettings&&(e.intercomSettings.installation_type="npm-package"),"function"==typeof t?(t("reattach_activator"),t("update",e.intercomSettings)):(e.Intercom=s,a()?o():(document.addEventListener("readystatechange",function(){a()&&o()}),e.attachEvent?e.attachEvent("onload",o):e.addEventListener("load",o,!1)))}),n.ref=void 0},8515,(e,t,n)=>{"use strict";var i=e.e&&e.e.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)0>t.indexOf(i[r])&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]]);return n};Object.defineProperty(n,"__esModule",{value:!0}),n.onUserEmailSupplied=n.showConversation=n.showTicket=n.startChecklist=n.startSurvey=n.showNews=n.showArticle=n.startTour=n.getVisitorId=n.trackEvent=n.onUnreadCountChange=n.onShow=n.onHide=n.showNewMessage=n.showMessages=n.showSpace=n.show=n.hide=n.update=n.shutdown=n.boot=n.Intercom=void 0;let r=e.r(22319),s=e.r(58522),o=(e,...t)=>{window.Intercom?window.Intercom(e,...t):console.warn("Please ensure Intercom is setup and running on client-side!")};n.Intercom=e=>{if("object"!=typeof e)return void console.warn("Intercom initialiser called with invali
1d parameters.");let{region:t="us"}=e,n=i(e,["region"]);"u">typeof window&&!s.ref&&(window.intercomSettings=Object.assign(Object.assign({},n),{api_base:r.regionAPIs.get(t)}),(0,s.init)())},n.default=n.Intercom,n.boot=e=>o("boot",e),n.shutdown=()=>o("shutdown"),n.update=e=>o("update",e),n.hide=()=>o("hide"),n.show=()=>o("show"),n.showSpace=e=>o("showSpace",e),n.showMessages=()=>o("showMessages"),n.showNewMessage=e=>o("showNewMessage",e),n.onHide=e=>o("onHide",e),n.onShow=e=>o("onShow",e),n.onUnreadCountChange=e=>o("onUnreadCountChange",e),n.trackEvent=(...e)=>o("trackEvent",...e),n.getVisitorId=()=>o("getVisitorId"),n.startTour=e=>o("startTour",e),n.showArticle=e=>o("showArticle",e),n.showNews=e=>o("showNews",e),n.startSurvey=e=>o("startSurvey",e),n.startChecklist=e=>o("startChecklist",e),n.showTicket=e=>o("showTicket",e),n.showConversation=e=>o("showConversation",e),n.onUserEmailSupplied=e=>o("onUserEmailSupplied",e)},83291,(e,t,n)=>{"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(){}e.i(50461),n.__esModule=!0,n.default=function(e){var t="".concat(e,"Storage");return!function(e){if(("u"<typeof self?"undefined":i(self))!=="object"||!(e in self))return!1;try{var t=self[e],n="redux-persist ".concat(e," test");t.setItem(n,"test"),t.getItem(n),t.removeItem(n)}catch(e){return!1}return!0}(t)?s:self[t]};var s={getItem:r,setItem:r,removeItem:r}},7037,(e,t,n)=>{"use strict";n.__esModule=!0,n.default=function(e){var t=(0,r.default)(e);return{getItem:function(e){return new Promise(function(n,i){n(t.getItem(e))})},setItem:function(e,n){return new Promise(function(i,r){i(t.setItem(e,n))})},removeItem:function(e){return new Promise(function(n,i){n(t.removeItem(e))})}}};var i,r=(i=e.r(83291))&&i.__esModule?i:{default:i}},88126,(e,t,n)=>{"use strict";var i;n.__esModule=!0,n.default=void 0,n.default=(0,((i=e.r(7037))&&i.__esModule?i:{default:i}).default)("session")},3115,e=>{"use strict";let t,n,i,r,s,o,a,l,h,u,c,d,f,p;var g,m,y,_,v,w,b,C,E,T,S,I,x,k,N,A,P,D,R,O,M,L,F,j,V,U,B,q,$=e.i(50461),H=e.i(91398),z=e.i(91788);let W=["light","dark"],K="(prefers-color-scheme: dark)",G="u"<typeof window,Q=(0,z.createContext)(void 0),Y={setTheme:e=>{},themes:[]},X=e=>(0,z.useContext)(Q)?z.default.createElement(z.Fragment,null,e.children):z.default.createElement(Z,e),J=["light","dark"],Z=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:i=!0,storageKey:r="theme",themes:s=J,defaultTheme:o=n?"system":"light",attribute:a="data-theme",value:l,children:h,nonce:u})=>{let[c,d]=(0,z.useState)(()=>et(r,o)),[f,p]=(0,z.useState)(()=>et(r)),g=l?Object.values(l):s,m=(0,z.useCallback)(e=>{let r=e;if(!r)return;"system"===e&&n&&(r=ei());let s=l?l[r]:r,h=t?en():null,u=document.documentElement;if("class"===a?(u.classList.remove(...g),s&&u.classList.add(s)):s?u.setAttribute(a,s):u.removeAttribute(a),i){let e=W.includes(o)?o:null,t=W.includes(r)?r:e;u.style.colorScheme=t}null==h||h()},[]),y=(0,z.useCallback)(e=>{d(e);try{localStorage.setItem(r,e)}catch(e){}},[e]),_=(0,z.useCallback)(t=>{p(ei(t)),"system"===c&&n&&!e&&m("system")},[c,e]);(0,z.useEffect)(()=>{let e=window.matchMedia(K);return e.addListener(_),_(e),()=>e.removeListener(_)},[_]),(0,z.useEffect)(()=>{let e=e=>{e.key===r&&y(e.newValue||o)};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[y]),(0,z.useEffect)(()=>{m(null!=e?e:c)},[e,c]);let v=(0,z.useMemo)(()=>({theme:c,setTheme:y,forcedTheme:e,resolvedTheme:"system"===c?f:c,themes:n?[...s,"system"]:s,systemTheme:n?f:void 0}),[c,y,e,f,n,s]);return z.default.createElement(Q.Provider,{value:v},z.default.createElement(ee,{forcedTheme:e,disableTransitionOnChange:t,enableSystem:n,enableColorScheme:i,storageKey:r,themes:s,defaultTheme:o,attribute:a,value:l,children:h,attrs:g,nonce:u}),h)},ee=(0,z.memo)(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:i,enableColorScheme:r,defaultTheme:s,value:o,attrs:a,nonce:l})=>{let h="system"===s,u="class"===n?`var d=document.documentElement,c=d.classList;c.remove(${a.map(e=>`'${e}'`).join(",")});`:`var d=document.documentElement,n='${n}',s='setAttribute';`,c=r?W.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",d=(e,t=!1,i=!0)=>{let s=o?o[e]:e,a=t?e+"|| ''":`'${s}'`,l="";return r&&i&&!t&&W.includes(e)&&(l+=`d.style.colorScheme = '${e}';`),"class"===n?l+=t||s?`c.add(${a})`:"null":s&&(l+=`d[s](n,${a})`),l},f=e?`!function(){${u}${d(e)}}()`:i?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${h})){var t='${K}',m=window.matchMedia(t);if(m.media!==t||m.matches){${d("dark")}}else{${d("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${d(o?"x[e]":"e",!0)}}
1${h?"":"else{"+d(s,!1,!1)+"}"}${c}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${d(o?"x[e]":"e",!0)}}else{${d(s,!1,!1)};}${c}}catch(t){}}();`;return z.default.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:f}})},()=>!0),et=(e,t)=>{let n;if(!G){try{n=localStorage.getItem(e)||void 0}catch(e){}return n||t}},en=()=>{let e=document.createElement("style");return e.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}},ei=e=>(e||(e=window.matchMedia(K)),e.matches?"dark":"light");var er=e.i(36872),es=e.i(53861);e.i(60778);var eo=e.i(97637),ea=e.i(35765);e.i(20945);var el=e.i(33823),eh=e.i(49488),eu=e.i(3828);e.i(54491);var ec=e.i(69644),ed=e.i(17261),ef=e.i(97993);e.i(8005);var ep=e.i(63973),eg=e.i(1075);let em=eg.default.h2`
2  max-w-[307px] 
3  mt-10 
4
5  text-black
6  text-2xl 
7  font-bold 
8  text-center 
9  leading-[30px]
10`;eg.default.p`
11  mt-6 
12
13  text-sm 
14  text-center
15  text-turnBlue
16
17  ${({$isTextCopied:e})=>!e&&"underline cursor-pointer hover:no-underline "}
18`;let ey=eg.default.p`
19  max-w-[400px]
20  mt-8
21
22  text-sm 
23  text-center 
24  text-grayscaleLight-250
25`,e_=eg.default.a`
26  text-ctaSlateBlue
27  underline
28
29  hover:no-underline
30`;e.i(91505);var ev=e.i(82010);e.i(13869);var ew=e.i(84264),eb=e.i(3102);let eC=()=>{let{push:e}=(0,eu.useRouter)(),t=(0,el.useDispatch)(),{isUnauthorizedModalOpen:n,unauthorizedRedirectTo:i}=(0,eh.useSelector)(e=>e.partnerData),r=()=>{t((0,eb.setIsUnauthorizedModalOpen)(!1)),e(i)};return(0,H.jsx)(ef.DefaultModal,{enableCloseOnWindowClick:!0,isOpen:n,onCloseModal:r,styles:{panel:"w-[509px]"},children:(0,H.jsxs)("div",{id:"unauthorizedModal",className:"flex flex-col items-center py-5 px-6",children:[(0,H.jsx)(ew.UnidentifiedUserSVG,{width:134,height:134,stroke:"#7364DB"}),(0,H.jsx)(em,{id:"unauthorizedModalTitle",children:"Access Denied"}),(0,H.jsx)(ey,{children:"Your current role does not have the necessary permissions to complete this action. Please contact your administrator if you require additional access."}),(0,H.jsxs)(ey,{children:["If you need assistance, please contact us at"," ",(0,H.jsx)(e_,{href:`mailto:${ev.turnEmails.support}`,children:ev.turnEmails.support})]}
30),(0,H.jsx)(ep.ModalButtons,{renderLeftButton:!1,rightButtonLabel:"Close",rightButtonType:"button",onRightClicked:r})]})})};var eE=e.i(41158),eT=e.i(41075);let eS=`
31  text-grayscaleLight-250 
32  stroke-grayscaleLight-250  
33  
34  dark:text-turnBlueDark-300 
35  dark:stroke-turnBlueDark-300
36`,eI=`
37  text-white 
38  bg-ctaSlateBlue
39  stroke-white
40
41  dark:stroke-white
42`,ex=eg.default.a`
43  relative
44
45  flex
46  flex-row
47  flex-nowrap
48  items-center
49    
50  w-full
51  h-[3.75rem]
52  min-h-[3.75rem]
53
54  text-base
55  font-medium
56  leading-[1.1]
57
58  rounded-lg
59  overflow-hidden
60  cursor-pointer
61
62  hover:bg-ctaSlateBlue
63  hover:text-white
64  hover:stroke-white
65  hover:dark:text-white
66  hover:dark:stroke-white
67
68  transition-all
69  ease-in-out
70  duration-300
71
72  ${({$isSelected:e})=>e?eI:eS}
73`,ek=eg.default.div`
74  absolute
75  left-[1.125rem]
76  
77  flex
78  justify-center
79  items-center
80  
81  w-10
82  h-10
83  
84  rounded-lg
85`,eN=(0,eg.default)(eT.FontAwesomeIcon)`
86  text-[1.1rem]
87  text-current
88`,eA=eg.default.div`
89  flex-1
90
91  ml-[4.2rem]
92
93  text-current
94`,eP=({id:e,item:t})=>{let{pathname:n}=(0,eu.useRouter)(),{href:i,onClick:r}=t,s=(0,z.useMemo)(()=>(0,ev.isTabCurrent)(n,t),[t,n]);return(0,H.jsx)(eE.default,{shallow:!0,href:i,onClick:()=>(r?.(),!0),children:(0,H.jsxs)(ex,{id:e,$isSelected:s,children:[(0,H.jsx)(ek,{$isSelected:s,children:t.IconSvg?z.default.cloneElement(t.IconSvg,{className:"w-[22px] h-[22px] fill-transparent"}):t?.icon?(0,H.jsx)(eN,{$isSelected:s,icon:t?.icon,"aria-hidden":"true"}):null}),(0,H.jsx)(eA,{children:t.name})]})})},eD=eg.default.div`
95  flex
96  flex-row
97  flex-nowrap
98  justify-center
99  grow
100  
101  w-full
102  h-full
103  
104  overflow-x-hidden
105  overflow-y-auto
106`,eR=eg.default.div`
107  h-full
108  max-w-[18rem]
109  py-5
110  px-2
111  
112  bg-white
113  border-gray-200
114  border-r-[1.5px]
115  
116  overflow-x-hidden
117  overflow-y-auto
118  grow
119  
120  dark:bg-turnBlueDark-800
121  dark:border-turnBlueDark-350
122`,eO=eg.default.div`
123  flex
124  flex-row
125  flex-nowrap
126  justify-center
127  grow
128  
129  h-full
130  px-4
131  
132  overflow-x-hidden
133  overflow-y-auto
134  
135  md:px-9
136`,eM=eg.default.div`
137  max-w-[900px]
138  px-1
139  
140  grow
141`;var eL=e.i(66731),eL=eL,eF=e.i(84575),eF=eF,ej=e.i(68880),ej=ej,eV=e.i(95249),eV=eV,eU=e.i(11906),eU=eU;let eB=(0,er.withAuthenticationRequired)(({children:e})=>{let{meData:t}=(0,eh.useSelector)(e=>e.partnerData),{team_member:n}=t||{},{role_permissions:i}=n||{},r=(0,z.useMemo)(()=>(e=>{let{show_company_settings:t,show_integrations:n,show_my_profile:i,show_settings_payments:r,show_user_management:s}=e||{};return[{name:"My Profile",href:ev.appLinks.settingsProfile,IconSvg:(0,H.jsx)(eV.default,{}),accessTo:i},{name:"Company Settings",href:ev.appLinks.settingsCompany,IconSvg:(0,H.jsx)(ej.default,{}),accessTo:t},{name:"User Management",href:ev.appLinks.settingsUserManagement,IconSvg:(0,H.jsx)(eU.default,{}),accessTo:s},{name:"Integrations",href:ev.appLinks.settingsIntegrations,IconSvg:(0,H.jsx)(eL.default,{}),accessTo:n},{name:"Packages and Payments",href:ev.appLinks.settingsPackagesAndPayments,IconSvg:(0,H.jsx)(eF.default,{}),accessTo:r}]})(i),[i]);return(0,H.jsxs)(eD,{children:[(0,H.jsx)(eR,{children:r.map(e=>{let n=`${e.name.replace(/ /g,"").toLowerCase()}`;return!!t&&e?.accessTo&&(0,H.jsx)("div",{className:"py-1",children:(0,H.jsx)(eP,{id:n,item:e})},e.name)})}),(0,H.jsx)(eO,{children:(0,H.jsx)(eM,{children:(0,H.jsx)("div",{className:"py-10",children:e})})})]})});var eq=e.i(19365);let e$=(0,eq.createSlice)({name:"darkMode",initialState:{enabled:!1},reducers:{setEnabledState:(e,t)=>{e.enabled=t.payload}}}),{setEnabledState:eH}=e$.actions,ez=e$.reducer,eW=(0,eq.createSlice)({name:"helpDesk",initialState:{isHelpDeskOpen:!1},reducers:{setIsHelpDeskOpen:(e,t)=>{e.isHelpDeskOpen=t.payload}}}),{setIsHelpDeskOpen:eK}=eW.actions,eG=eW.reducer;e.i(29977);var eQ=e.i(32722),eY=e.i(82665),eX=e.i(74220),eJ=e.i(25422),eZ=e.i(83574);let e0=e.i(24473).faCircleQuestion,e1=[{icon:e0,question:"What does Consider status mean?"},{icon:e0,question:"What's the Turnaround Time for an MVR check?"},{icon:e0,question:"Can my applicant provide an ITIN instead of an SSN for the basic check?"}],e2=[ev.appLinks.upgrade,ev.appLinks.home];var e5=e.i(77988);let e3=eg.default.div`
142  w-full
143  h-[70px]
144  min-h-[70px]
145  bg-white
146  
147  flex
148  flex-row
149  justify-between
150  items-center
151  gap-9
152  px-4
153  md:px-16
154  relative
155  z-[29]
156
157  border-b
158  border-[#F0F0F0]
159
160  dark:bg-turnBlueDark-800
161  dark:shadow-none
162  dark:border-turnBlueDark-350
163  dark:text-white
164`,e4=eg.default.span`
165  text-sm
166  md:text-base
167  font-semibold
168  ${e=>e.$inactive?"opacity-50 dark:hover:opacity-70":""}
169
170  transition-all
171`;eg.default.div`
172  text-base
173`;var e6=e.i(40767),e8=e.i(95485);let e7=function(e,t){if(!e)throw e9(t)},e9=function(e){return Error("Firebase Database (${JSCORE_VERSION}) INTERNAL ASSERT FAILED: "+e)},te=function(e){let t=[],n=0;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:((64512&r)==55296&&i+1<e.length&&(64512&e.charCodeAt(i+1))==56320?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++i)),t[
173n++]=r>>18|240,t[n++]=r>>12&63|128):t[n++]=r>>12|224,t[n++]=r>>6&63|128),t[n++]=63&r|128)}return t},tt=function(e){let t=[],n=0,i=0;for(;n<e.length;){let r=e[n++];if(r<128)t[i++]=String.fromCharCode(r);else if(r>191&&r<224){let s=e[n++];t[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){let s=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[i++]=String.fromCharCode(55296+(s>>10)),t[i++]=String.fromCharCode(56320+(1023&s))}else{let s=e[n++],o=e[n++];t[i++]=String.fromCharCode((15&r)<<12|(63&s)<<6|63&o)}}return t.join("")},tn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let t=0;t<e.length;t+=3){let r=e[t],s=t+1<e.length,o=s?e[t+1]:0,a=t+2<e.length,l=a?e[t+2]:0,h=r>>2,u=(3&r)<<4|o>>4,c=(15&o)<<2|l>>6,d=63&l;!a&&(d=64,s||(c=64)),i.push(n[h],n[u],n[c],n[d])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(te(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):tt(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();let n=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let t=0;t<e.length;){let r=n[e.charAt(t++)],s=t<e.length?n[e.charAt(t)]:0,o=++t<e.length?n[e.charAt(t)]:64,a=++t<e.length?n[e.charAt(t)]:64;if(++t,null==r||null==s||null==o||null==a)throw new ti;let l=r<<2|s>>4;if(i.push(l),64!==o){let e=s<<4&240|o>>2;if(i.push(e),64!==a){let e=o<<6&192|a;i.push(e)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class ti extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let tr=function(e){let t=te(e);return tn.encodeByteArray(t,!0)},ts=function(e){return tr(e).replace(/\./g,"")},to=function(e){try{return tn.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null},ta=()=>{try{return("u">typeof self?self:"u">typeof window?window:e.g).__FIREBASE_DEFAULTS__||(()=>{if(void 0===$.default||void 0===$.default.env)return;let e=$.default.env.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)})()||(()=>{let e;if("u"<typeof document)return;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}let t=e&&to(e[1]);return t&&JSON.parse(t)})()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},tl=e=>{var t,n;let i=null==(n=null==(t=ta())?void 0:t.emulatorHosts)?void 0:n[e];if(!i)return;let r=i.lastIndexOf(":");if(r<=0||r+1===i.length)throw Error(`Invalid host ${i} with no separate hostname and port!`);let s=parseInt(i.substring(r+1),10);return"["===i[0]?[i.substring(1,r-1),s]:[i.substring(0,r),s]},th=()=>{var e;return null==(e=ta())?void 0:e.config};class tu{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 tc(e,t){if(e.uid)throw Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let n=t||"demo-project",i=e.iat||0,r=e.sub||e.user_id;if(!r)throw Error("mockUserToken must contain 'sub' or 'user_id' field!");let s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:i,exp:i+3600,auth_time:i,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},e);return[ts(JSON.stringify({alg:"none",type:"JWT"})),ts(JSON.stringify(s)),""].join(".")}function td(){return"u">typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function tf(){return"u">typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(td())}function tp(){return false}
173class tg extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,tg.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,tm.prototype.create)}}class tm{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){var n,i;let r=t[0]||{},s=`${this.service}/${e}`,o=this.errors[e],a=o?(n=o,i=r,n.replace(ty,(e,t)=>{let n=i[t];return null!=n?String(n):`<${t}?>`})):"Error",l=`${this.serviceName}: ${a} (${s}).`;return new tg(s,l,r)}}let ty=/\{\$([^}]+)}/g;function t_(e){return JSON.parse(e)}function tv(e){return JSON.stringify(e)}let tw=function(e){let t={},n={},i={},r="";try{let s=e.split(".");t=t_(to(s[0])||""),n=t_(to(s[1])||""),r=s[2],i=n.d||{},delete n.d}catch(e){}return{header:t,claims:n,data:i,signature:r}},tb=function(e){let t=tw(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")},tC=function(e){let t=tw(e).claims;return"object"==typeof t&&!0===t.admin};function tE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tT(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function tS(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function tI(e,t,n){let i={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=t.call(n,e[r],r,e));return i}function tx(e,t){if(e===t)return!0;let n=Object.keys(e),i=Object.keys(t);for(let r of n){if(!i.includes(r))return!1;let n=e[r],s=t[r];if(tk(n)&&tk(s)){if(!tx(n,s))return!1}else if(n!==s)return!1}for(let e of i)if(!n.includes(e))return!1;return!0}function tk(e){return null!==e&&"object"==typeof e}class tN{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=0x67452301,this.chain_[1]=0xefcdab89,this.chain_[2]=0x98badcfe,this.chain_[3]=0x10325476,this.chain_[4]=0xc3d2e1f0,this.inbuf_=0,this.total_=0}compress_(e,t){let n,i;t||(t=0);let r=this.W_;if("string"==typeof e)for(let n=0;n<16;n++)r[n]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let n=0;n<16;n++)r[n]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let e=16;e<80;e++){let t=r[e-3]^r[e-8]^r[e-14]^r[e-16];r[e]=(t<<1|t>>>31)&0xffffffff}let s=this.chain_[0],o=this.chain_[1],a=this.chain_[2],l=this.chain_[3],h=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(n=l^o&(a^l),i=0x5a827999):(n=o^a^l,i=0x6ed9eba1):e<60?(n=o&a|l&(o|a),i=0x8f1bbcdc):(n=o^a^l,i=0xca62c1d6);let t=(s<<5|s>>>27)+n+h+i+r[e]|0;h=l,l=a,a=(o<<30|o>>>2)&0xffffffff,o=s,s=t}this.chain_[0]=this.chain_[0]+s|0,this.chain_[1]=this.chain_[1]+o|0,this.chain_[2]=this.chain_[2]+a|0,this.chain_[3]=this.chain_[3]+l|0,this.chain_[4]=this.chain_[4]+h|0}update(e,t){if(null==e)return;void 0===t&&(t=e.length);let n=t-this.blockSize,i=0,r=this.buf_,s=this.inbuf_;for(;i<t;){if(0===s)for(;i<=n;)this.compress_(e,i),i+=this.blockSize;if("string"==typeof e){for(;i<t;)if(r[s]=e.charCodeAt(i),++s,++i,s===this.blockSize){this.compress_(r),s=0;break}}else for(;i<t;)if(r[s]=e[i],++s,++i,s===this.blockSize){this.compress_(r),s=0;break}}this.inbuf_=s,this.total_+=t}digest(){let e=[],t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let e=this.blockSize-1;e>=56;e--)this.buf_[e]=255&t,t/=256;this.compress_(this.buf_);let n=0;for(let t=0;t<5;t++)for(let i=24;i>=0;i-=8)e[n]=this.chain_[t]>>i&255,++n;return e}}function tA(e,t){return`${e} failed: ${t} argument `}let tP=function(e){let t=[],n=0;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);if(r>=55296&&r<=56319){let t=r-55296;e7(++i<e.length,"Surrogate pair missing trail surrogate."),r=65536+(t<<10)+(e.charCodeAt(i)-56320)}r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:(r<65536?t[n++]=r>>12|224:(t[n++]=r>>18|240,t[n++]=r>>12&63|128),t[n++]=r>>6&63|128),t[n++]=63&r|128)}return t},tD=function(e){let t=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t++:i<2048?t+=2:i>=55296&&i<=56319?(t+=4,n++):t+=3}return t};function tR(e){return e&&e._delegate?e._delegate:e}class tO{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}}let tM="[DEFAULT]";class tL{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let e=new tu;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;let n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),i=null!=(t=null==e?void 0:e.optional)&&t;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(i)return null;throw e}if(i)return null;throw Error(`Service ${this.name} is not available`)}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:tM})}catch(e){}for(let[e,t]of this.instancesDeferred.entries()){let n=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=tM){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=tM){return this.instances.has(e)}getOptions(e=tM){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:n,options:t});for(let[e,t]of this.instancesDeferred.entries())n===this.normalizeInstanceIdentifier(e)&&t.resolve(i);return i}onInit(e,t){var n;let i=this.normalizeInstanceIdentifier(t),r=null!=(n=this.onInitCallbacks.get(i))?n:new Set;r.add(e),this.onInitCallbacks.set(i,r);let s=this.instances.get(i);return s&&e(s,i),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){let n=this.onInitCallbacks.get(t);if(n)for(let i of n)try{i(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){var n;let i=this.instances.get(e);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e)===tM?void 0:n,options:t}),this.instances.set(e,i),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(i,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,i)}catch(e){}return i||null}normalizeInstanceIdentifier(e=tM){return this.component?this.component.multipleInstances?e:tM:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class tF{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new tL(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}let tj=[];(g=I||(I={}))[g.DEBUG=0]="DEBUG",g[g.VERBOSE=1]="VERBOSE",g[g.INFO=2]="INFO",g[g.WARN=3]="WARN",g[g.ERROR=4]="ERROR",g[g.SILENT=5]="SILENT";let tV={debug:I.DEBUG,verbose:I.VERBOSE,info:I.INFO,warn:I.WARN,error:I.ERROR,silent:I.SILENT},tU=I.INFO,tB={[I.DEBUG]:"log",[I.VERBOSE]:"log",[I.INFO]:"info",[I.WARN]:"warn",[I.ERROR]:"error"},tq=(e,t,...n)=>{if(t<e.logLevel)return;let i=new Date().toISOString(),r=tB[t];if(r)console[r](`[${i}]  ${e.name}:`,...n);
173else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class t${constructor(e){this.name=e,this._logLevel=tU,this._logHandler=tq,this._userLogHandler=null,tj.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in I))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?tV[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,I.DEBUG,...e),this._logHandler(this,I.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,I.VERBOSE,...e),this._logHandler(this,I.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,I.INFO,...e),this._logHandler(this,I.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,I.WARN,...e),this._logHandler(this,I.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,I.ERROR,...e),this._logHandler(this,I.ERROR,...e)}}let tH=new WeakMap,tz=new WeakMap,tW=new WeakMap,tK=new WeakMap,tG=new WeakMap,tQ={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return tz.get(e);if("objectStoreNames"===t)return e.objectStoreNames||tW.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return tY(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function tY(e){if(e instanceof IDBRequest){let t;return(t=new Promise((t,n)=>{let i=()=>{e.removeEventListener("success",r),e.removeEventListener("error",s)},r=()=>{t(tY(e.result)),i()},s=()=>{n(e.error),i()};e.addEventListener("success",r),e.addEventListener("error",s)})).then(t=>{t instanceof IDBCursor&&tH.set(t,e)}).catch(()=>{}),tG.set(t,e),t}if(tK.has(e))return tK.get(e);let i=function(e){if("function"==typeof e)return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(n||(n=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(tX(this),t),tY(tH.get(this))}:function(...t){return tY(e.apply(tX(this),t))}:function(t,...n){let i=e.call(tX(this),t,...n);return tW.set(i,t.sort?t.sort():[t]),tY(i)};return e instanceof IDBTransaction&&function(e){if(tz.has(e))return;let t=new Promise((t,n)=>{let i=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",s),e.removeEventListener("abort",s)},r=()=>{t(),i()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",r),e.addEventListener("error",s),e.addEventListener("abort",s)});tz.set(e,t)}(e),(t||(t=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(e,tQ):e}(e);return i!==e&&(tK.set(e,i),tG.set(i,e)),i}let tX=e=>tG.get(e),tJ=["get","getKey","getAll","getAllKeys","count"],tZ=["put","add","delete","clear"],t0=new Map;function t1(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(t0.get(t))return t0.get(t);let n=t.replace(/FromIndex$/,""),i=t!==n,r=tZ.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!(r||tJ.includes(n)))return;let s=async function(e,...t){let s=this.transaction(e,r?"readwrite":"readonly"),o=s.store;return i&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),r&&s.done]))[0]};return t0.set(t,s),s}tQ={...p=tQ,get:(e,t,n)=>t1(e,t)||p.get(e,t,n),has:(e,t)=>!!t1(e,t)||p.has(e,t)};class t2{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{let t;if((null==(t=e.getComponent())?void 0:t.type)!=="VERSION")return null;{let t=e.getImmediate();return`${t.library}/${t.version}`}}).filter(e=>e).join(" ")}}let t5="@firebase/app",t3="0.11.2",t4=new t$("@firebase/app"),t6="[DEFAULT]",t8={[t5]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/data-connect":"fire-data-connect","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","@firebase/vertexai":"fire-vertex","fire-js":"fire-js",firebase:"fire-js-all"},t7=new Map,t9=new Map,ne=new Map;function nt(e,t){try{e.container.addComponent(t)}catch(n){t4.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function nn(e){let t=e.name;if(ne.has(t))return t4.debug(`There were multiple attempts to register component ${t}.`),!1;
173for(let n of(ne.set(t,e),t7.values()))nt(n,e);for(let t of t9.values())nt(t,e);return!0}function ni(e,t){let n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function nr(e){return null!=e&&void 0!==e.settings}let ns=new tm("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class no{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 tO("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 ns.create("app-deleted",{appName:this._name})}}let na="11.4.0";function nl(e,t={}){let n=e;"object"!=typeof t&&(t={name:t});let i=Object.assign({name:t6,automaticDataCollectionEnabled:!1},t),r=i.name;if("string"!=typeof r||!r)throw ns.create("bad-app-name",{appName:String(r)});if(n||(n=th()),!n)throw ns.create("no-options");let s=t7.get(r);if(s)if(tx(n,s.options)&&tx(i,s.config))return s;else throw ns.create("duplicate-app",{appName:r});let o=new tF(r);for(let e of ne.values())o.addComponent(e);let a=new no(n,i,o);return t7.set(r,a),a}function nh(e=t6){let t=t7.get(e);if(!t&&e===t6&&th())return nl();if(!t)throw ns.create("no-app",{appName:e});return t}function nu(e,t,n){var i;let r=null!=(i=t8[e])?i:e;n&&(r+=`-${n}`);let s=r.match(/\s|\//),o=t.match(/\s|\//);if(s||o){let e=[`Unable to register library "${r}" with version "${t}":`];s&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),t4.warn(e.join(" "));return}nn(new tO(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}let nc="firebase-heartbeat-store",nd=null;function nf(){return nd||(nd=(function(e,{blocked:t,upgrade:n,blocking:i,terminated:r}={}){let s=indexedDB.open(e,1),o=tY(s);return n&&s.addEventListener("upgradeneeded",e=>{n(tY(s.result),e.oldVersion,e.newVersion,tY(s.transaction),e)}),t&&s.addEventListener("blocked",e=>t(e.oldVersion,e.newVersion,e)),o.then(e=>{r&&e.addEventListener("close",()=>r()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o})("firebase-heartbeat-database",{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(nc)}catch(e){console.warn(e)}}}).catch(e=>{throw ns.create("idb-open",{originalErrorMessage:e.message})})),nd}async function np(e){try{let t=(await nf()).transaction(nc),n=await t.objectStore(nc).get(nm(e));return await t.done,n}catch(e){if(e instanceof tg)t4.warn(e.message);else{let t=ns.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});t4.warn(t.message)}}}async function ng(e,t){try{let n=(await nf()).transaction(nc,"readwrite"),i=n.objectStore(nc);await i.put(t,nm(e)),await n.done}catch(e){if(e instanceof tg)t4.warn(e.message);else{let t=ns.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});t4.warn(t.message)}}}function nm(e){return`${e.name}!${e.options.appId}`}class ny{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new nv(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{let n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=n_();if((null==(e=this._heartbeatsCache)?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,(null==(t=this._heartbeatsCache)?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(e=>e.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:n}),this._heartbeatsCache.heartbeats.length>30){let e=function(e){if(0===e.length)return -1;let t=0,n=e[0].date;for(let i=1;i<e.length;i++)e[i].date<n&&(n=e[i].date,t=i);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){t4.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,(null==(e=this._heartbeatsCache)?void 0:e.heartbeats)==null||0===this._heartbeatsCache.heartbeats.length)return"";let t=n_(),{heartbeatsToSend:n,unsentEntries:i}=function(e,t=1024){let n=[],i=e.slice();for(let r of e){let e=n.find(e=>e.agent===r.agent);if(e){if(e.dates.push(r.date),nw(n)>t){e.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),nw(n)>t){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),r=ts(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}catch(e){return t4.warn(e),""}}}function n_(){return new Date().toISOString().substring(0,10)}class nv{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&new Promise((e,t)=>
173{try{let n=!0,i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var e;t((null==(e=r.error)?void 0:e.message)||"")}}catch(e){t(e)}}).then(()=>!0).catch(()=>!1)}async read(){if(!await this._canUseIndexedDBPromise)return{heartbeats:[]};{let e=await np(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){let n=await this.read();return ng(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){let n=await this.read();return ng(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function nw(e){return ts(JSON.stringify({version:2,heartbeats:e})).length}nn(new tO("platform-logger",e=>new t2(e),"PRIVATE")),nn(new tO("heartbeat",e=>new ny(e),"PRIVATE")),nu(t5,t3,""),nu(t5,t3,"esm2017"),nu("fire-js",""),nu("firebase","11.4.0","app");let nb="@firebase/database",nC="1.0.13",nE="";class nT{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,t){null==t?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),tv(t))}get(e){let t=this.domStorage_.getItem(this.prefixedName_(e));return null==t?null:t_(t)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}}class nS{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,t){null==t?delete this.cache_[e]:this.cache_[e]=t}get(e){return tE(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}}let nI=function(e){try{if("u">typeof window&&void 0!==window[e]){let t=window[e];return t.setItem("firebase:sentinel","cache"),t.removeItem("firebase:sentinel"),new nT(t)}}catch(e){}return new nS},nx=nI("localStorage"),nk=nI("sessionStorage"),nN=new t$("@firebase/database"),nA=(f=1,function(){return f++}),nP=function(e){let t=tP(e),n=new tN;n.update(t);let i=n.digest();return tn.encodeByteArray(i)},nD=function(...e){let t="";for(let n=0;n<e.length;n++){let i=e[n];Array.isArray(i)||i&&"object"==typeof i&&"number"==typeof i.length?t+=nD.apply(null,i):"object"==typeof i?t+=tv(i):t+=i,t+=" "}return t},nR=null,nO=!0,nM=function(e,t){e7(!t||!0===e||!1===e,"Can't turn on custom loggers persistently."),!0===e?(nN.logLevel=I.VERBOSE,nR=nN.log.bind(nN),t&&nk.set("logging_enabled",!0)):"function"==typeof e?nR=e:(nR=null,nk.remove("logging_enabled"))},nL=function(...e){if(!0===nO&&(nO=!1,null===nR&&!0===nk.get("logging_enabled")&&nM(!0)),nR){let t=nD.apply(null,e);nR(t)}},nF=function(e){return function(...t){nL(e,...t)}},nj=function(...e){let t="FIREBASE INTERNAL ERROR: "+nD(...e);nN.error(t)},nV=function(...e){let t=`FIREBASE FATAL ERROR: ${nD(...e)}`;throw nN.error(t),Error(t)},nU=function(...e){let t="FIREBASE WARNING: "+nD(...e);nN.warn(t)},nB=function(){"u">typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&nU("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},nq=function(e){return"number"==typeof e&&(e!=e||e===1/0||e===-1/0)},n$=function(e){if(tp()||"complete"===document.readyState)e();else{let t=!1,n=function(){document.body?t||(t=!0,e()):setTimeout(n,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{"complete"===document.readyState&&n()}),window.attachEvent("onload",n))}},nH="[MIN_NAME]",nz="[MAX_NAME]",nW=function(e,t){if(e===t)return 0;{if(e===nH||t===nz)return -1;if(t===nH||e===nz)return 1;let n=n0(e),i=n0(t);if(null!==n)if(null!==i)return n-i==0?e.length-t.length:n-i;else return -1;return null!==i?1:e<t?-1:1}},nK=function(e,t){return e===t?0:e<t?-1:1},nG=function(e,t){if(t&&e in t)return t[e];throw Error("Missing required key ("+e+") in object: "+tv(t))},nQ=function(e){if("object"!=typeof e||null===e)return tv(e);let t=[];for(let n in e)t.push(n);
173t.sort();let n="{";for(let i=0;i<t.length;i++)0!==i&&(n+=","),n+=tv(t[i]),n+=":",n+=nQ(e[t[i]]);return n+"}"},nY=function(e,t){let n=e.length;if(n<=t)return[e];let i=[];for(let r=0;r<n;r+=t)r+t>n?i.push(e.substring(r,n)):i.push(e.substring(r,r+t));return i};function nX(e,t){for(let n in e)e.hasOwnProperty(n)&&t(n,e[n])}let nJ=function(e){let t,n,i,r,s;e7(!nq(e),"Invalid JSON number");0===e?(n=0,i=0,t=+(1/e==-1/0)):(t=e<0,(e=Math.abs(e))>=22250738585072014e-324?(n=(r=Math.min(Math.floor(Math.log(e)/Math.LN2),1023))+1023,i=Math.round(e*Math.pow(2,52-r)-0x10000000000000)):(n=0,i=Math.round(e/5e-324)));let o=[];for(s=52;s;s-=1)o.push(i%2?1:0),i=Math.floor(i/2);for(s=11;s;s-=1)o.push(n%2?1:0),n=Math.floor(n/2);o.push(+!!t),o.reverse();let a=o.join(""),l="";for(s=0;s<64;s+=8){let e=parseInt(a.substr(s,8),2).toString(16);1===e.length&&(e="0"+e),l+=e}return l.toLowerCase()},nZ=RegExp("^-?(0*)\\d{1,10}$"),n0=function(e){if(nZ.test(e)){let t=Number(e);if(t>=-0x80000000&&t<=0x7fffffff)return t}return null},n1=function(e){try{e()}catch(e){setTimeout(()=>{throw nU("Exception was thrown by user callback.",e.stack||""),e},Math.floor(0))}},n2=function(e,t){let n=setTimeout(e,t);return"number"==typeof n&&"u">typeof Deno&&Deno.unrefTimer?Deno.unrefTimer(n):"object"==typeof n&&n.unref&&n.unref(),n};class n5{constructor(e,t){this.appCheckProvider=t,this.appName=e.name,nr(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=null==t?void 0:t.getImmediate({optional:!0}),this.appCheck||null==t||t.get().then(e=>this.appCheck=e)}getToken(e){if(this.serverAppAppCheckToken){if(e)throw Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(e):new Promise((t,n)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(t,n):t(null)},0)})}addTokenChangeListener(e){var t;null==(t=this.appCheckProvider)||t.get().then(t=>t.addTokenListener(e))}notifyForInvalidToken(){nU(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}}class n3{constructor(e,t,n){this.appName_=e,this.firebaseOptions_=t,this.authProvider_=n,this.auth_=null,this.auth_=n.getImmediate({optional:!0}),this.auth_||n.onInit(e=>this.auth_=e)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(e=>e&&"auth/token-not-initialized"===e.code?(nL("Got auth/token-not-initialized error.  Treating as null token."),null):Promise.reject(e)):new Promise((t,n)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(t,n):t(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(t=>t.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(t=>t.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',nU(e)}}class n4{constructor(e){this.accessToken=e}getToken(e){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(e){e(this.accessToken)}removeTokenChangeListener(e){}notifyForInvalidToken(){}}n4.OWNER="owner";let n6=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,n8="websocket",n7="long_polling";class n9{constructor(e,t,n,i,r=!1,s="",o=!1,a=!1,l=null){this.secure=t,this.namespace=n,this.webSocketOnly=i,this.nodeAdmin=r,this.persistenceKey=s,this.includeNamespaceInQueryParams=o,this.isUsingEmulator=a,this.emulatorOptions=l,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=nx.get("host:"+e)||this._host}isCacheableHost(){return"s-"===this.internalHost.substr(0,2)}isCustomHost(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&nx.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){let e=this.secure?"https://":"http://",t=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${t}`}}function ie(e,t,n){let i;if(e7("string"==typeof t,"typeof type must == string"),e7("object"==typeof n,"typeof params must == object"),t===n8)i=(e.secure?"wss://":"ws://")+e.internalHost+"/.ws?";else if(t===n7)i=(e.secure?"https://":"http://")+e.internalHost+"/.lp?";else throw Error("Unknown connection type: "+t);(e.host!==e.internalHost||e.isCustomHost()||e.includeNamespaceInQueryParams)&&
173(n.ns=e.namespace);let r=[];return nX(n,(e,t)=>{r.push(e+"="+t)}),i+r.join("&")}class it{constructor(){this.counters_={}}incrementCounter(e,t=1){tE(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=t}get(){return function e(t,n){if(!(n instanceof Object))return n;switch(n.constructor){case Date:return new Date(n.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return n}for(let i in n)n.hasOwnProperty(i)&&"__proto__"!==i&&(t[i]=e(t[i],n[i]));return t}(void 0,this.counters_)}}let ii={},ir={};function is(e){let t=e.toString();return ii[t]||(ii[t]=new it),ii[t]}class io{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,t){this.closeAfterResponse=e,this.onClose=t,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,t){for(this.pendingResponses[e]=t;this.pendingResponses[this.currentResponseNum];){let e=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let t=0;t<e.length;++t)e[t]&&n1(()=>{this.onMessage_(e[t])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}let ia="start";class il{constructor(e,t,n,i,r,s,o){this.connId=e,this.repoInfo=t,this.applicationId=n,this.appCheckToken=i,this.authToken=r,this.transportSessionId=s,this.lastSessionId=o,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=nF(e),this.stats_=is(t),this.urlFn=e=>(this.appCheckToken&&(e.ac=this.appCheckToken),ie(t,n7,e))}open(e,t){this.curSegmentNum=0,this.onDisconnect_=t,this.myPacketOrderer=new io(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(3e4)),n$(()=>{if(this.isClosed_)return;this.scriptTagHolder=new ih((...e)=>{let[t,n,i,r,s]=e;if(this.incrementIncomingBytes_(e),this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,t===ia)this.id=n,this.password=i;else if("close"===t)n?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(n,()=>{this.onClosed_()})):this.onClosed_();else throw Error("Unrecognized command received: "+t)},(...e)=>{let[t,n]=e;this.incrementIncomingBytes_(e),this.myPacketOrderer.handleResponse(t,n)},()=>{this.onClosed_()},this.urlFn);let e={};e[ia]="t",e.ser=Math.floor(1e8*Math.random()),this.scriptTagHolder.uniqueCallbackIdentifier&&(e.cb=this.scriptTagHolder.uniqueCallbackIdentifier),e.v="5",this.transportSessionId&&(e.s=this.transportSessionId),this.lastSessionId&&(e.ls=this.lastSessionId),this.applicationId&&(e.p=this.applicationId),this.appCheckToken&&(e.ac=this.appCheckToken),"u">typeof location&&location.hostname&&n6.test(location.hostname)&&(e.r="f");let t=this.urlFn(e);this.log_("Connecting via long-poll to "+t),this.scriptTagHolder.addTag(t,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){il.forceAllow_=!0}static forceDisallow(){il.forceDisallow_=!0}static isAvailable(){return!tp()&&(!!il.forceAllow_||!il.forceDisallow_&&"u">typeof document&&null!=document.createElement&&!("object"==typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))&&("object"!=typeof Windows||"object"!=typeof Windows.UI))}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){!this.isClosed_&&(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){let t=tv(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);let n=nY(tr(t),1840);for(let e=0;e<n.length;e++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,n.length,n[e]),this.curSegmentNum++}addDisconnectPingFrame(e,t){if(tp())return;this.myDisconnFrame=document.createElement("iframe");let n={};n.dframe="t",n.id=e,n.pw=t,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){let t=tv(e).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)}}class ih{constructor(e,t,n,i){if(this.onDisconnect=n,this.urlFn=i,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0,tp())this.commandCB=e,this.onMessageCB=t;else{this.uniqueCallbackIdentifier=nA(),window["pLPCommand"+this.uniqueCallbackIdentifier]=e,window["pRTLPCB"+this.uniqueCallbackIdentifier]=t,this.myIFrame=ih.createIFrame_();let n="";this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,11)&&(n='<script>document.domain="'+document.domain+'";</script>');const i="<html><body>"+n+"</body></html>";
173try{this.myIFrame.doc.open(),this.myIFrame.doc.write(i),this.myIFrame.doc.close()}catch(e){nL("frame writing exception"),e.stack&&nL(e.stack),nL(e)}}}static createIFrame_(){let e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||nL("No IE domain setting required")}catch(t){e.src="javascript:void((function(){document.open();document.domain='"+document.domain+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{null!==this.myIFrame&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));let e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,t){for(this.myID=e,this.myPW=t,this.alive=!0;this.newRequest_(););}newRequest_(){if(!this.alive||!this.sendNewPolls||!(this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)))return!1;{this.currentSerial++;let e={};e.id=this.myID,e.pw=this.myPW,e.ser=this.currentSerial;let t=this.urlFn(e),n="",i=0;for(;this.pendingSegs.length>0;)if(this.pendingSegs[0].d.length+30+n.length<=1870){let e=this.pendingSegs.shift();n=n+"&seg"+i+"="+e.seg+"&ts"+i+"="+e.ts+"&d"+i+"="+e.d,i++}else break;return t+=n,this.addLongPollTag_(t,this.currentSerial),!0}}enqueueSegment(e,t,n){this.pendingSegs.push({seg:e,ts:t,d:n}),this.alive&&this.newRequest_()}addLongPollTag_(e,t){this.outstandingRequests.add(t);let n=()=>{this.outstandingRequests.delete(t),this.newRequest_()},i=setTimeout(n,Math.floor(25e3));this.addTag(e,()=>{clearTimeout(i),n()})}addTag(e,t){tp()?this.doNodeLongPoll(e,t):setTimeout(()=>{try{if(!this.sendNewPolls)return;let n=this.myIFrame.doc.createElement("script");n.type="text/javascript",n.async=!0,n.src=e,n.onload=n.onreadystatechange=function(){let e=n.readyState;e&&"loaded"!==e&&"complete"!==e||(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),t())},n.onerror=()=>{nL("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(n)}catch(e){}},Math.floor(1))}}let iu=null;"u">typeof MozWebSocket?iu=MozWebSocket:"u">typeof WebSocket&&(iu=WebSocket);class ic{constructor(e,t,n,i,r,s,o){this.connId=e,this.applicationId=n,this.appCheckToken=i,this.authToken=r,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=nF(this.connId),this.stats_=is(t),this.connURL=ic.connectionURL_(t,s,o,i,n),this.nodeAdmin=t.nodeAdmin}static connectionURL_(e,t,n,i,r){let s={};return s.v="5",!tp()&&"u">typeof location&&location.hostname&&n6.test(location.hostname)&&(s.r="f"),t&&(s.s=t),n&&(s.ls=n),i&&(s.ac=i),r&&(s.p=r),ie(e,n8,s)}open(e,t){this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,nx.set("previous_websocket_failure",!0);try{let e;if(tp()){let t=this.nodeAdmin?"AdminNode":"Node";e={headers:{"User-Agent":`Firebase/5/${nE}/${$.default.platform}/${t}`,"X-Firebase-GMPID":this.applicationId||""}},this.authToken&&(e.headers.Authorization=`Bearer ${this.authToken}`),this.appCheckToken&&(e.headers["X-Firebase-AppCheck"]=this.appCheckToken);let n=$.default.env,i=0===this.connURL.indexOf("wss://")?n.HTTPS_PROXY||n.https_proxy:n.HTTP_PROXY||n.http_proxy;i&&(e.proxy={origin:i})}this.mySock=new iu(this.connURL,[],e)}catch(t){this.log_("Error instantiating WebSocket.");let e=t.message||t.data;e&&this.log_(e),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=e=>{this.handleIncomingFrame(e)},this.mySock.onerror=e=>{this.log_("WebSocket error.  Closing connection.");let t=e.message||e.data;t&&this.log_(t),this.onClosed_()}}start(){}static forceDisallow(){ic.forceDisallow_=!0}static isAvailable(){let e=!1;if("u">typeof navigator&&navigator.userAgent){let t=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);t&&t.length>1&&4.4>parseFloat(t[1])&&(e=!0)}return!e&&null!==iu&&!ic.forceDisallow_}static previouslyFailed(){return nx.isInMemoryStorage||!0===nx.get("previous_websocket_failure")}markConnectionHealthy(){nx.remove("previous_websocket_failure")}appendFrame_(e){if(this.frames.push(e),this.frames.length===this.totalFrames){let e=this.frames.join("");this.frames=null;let t=t_(e);this.onMessage(t)}}handleNewFrameCount_(e){this.totalFrames=e,this.frames=[]}extractFrameCount_(e){if(e7(null===this.frames,"We already have a frame buffer"),e.length<=6){let t=Number(e);if(!isNaN(t))return this.handleNewFrameCount_(t),null}return this.handleNewFrameCount_(1),e}handleIncomingFrame(e){if(null===this.mySock)return;let t=e.data;if(this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(t);else{let e=this.extractFrameCount_(t);null!==e&&this.appendFrame_(e)}}send(e){this.resetKeepAlive();let t=tv(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);let n=nY(t,16384);n.length>1&&this.sendString_(String(n.length));for(let e=0;e<n.length;e++)this.sendString_(n[e])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){!this.isClosed_&&(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(45e3))}sendString_(e){try{this.mySock.send(e)}catch(e){this.log_("Exception thrown from WebSocket.send():",e.message||e.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}ic.responsesRequiredToBeHealthy=2,ic.healthyTimeout=3e4;class id{static get ALL_TRANSPORTS(){return[il,ic]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(e){this.initTransports_(e)}initTransports_(e){let t=ic&&ic.isAvailable(),n=t&&!ic.previouslyFailed();if(e.webSocketOnly&&(t||nU("wss:// URL used, but browser isn't known to support websockets.  Trying anyway."),n=!0),n)this.transports_=[ic];else{let e=this.transports_=[];for(let t of id.ALL_TRANSPORTS)t&&t.isAvailable()&&e.push(t);id.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}id.globalTransportInitialized_=!1;class ip{constructor(e,t,n,i,r,s,o,a,l,h){this.id=e,this.repoInfo_=t,this.applicationId_=n,this.appCheckToken_=i,this.authToken_=r,this.onMessage_=s,this.onReady_=o,this.onDisconnect_=a,this.onKill_=l,this.lastSessionId=h,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=nF("c:"+this.id+":"),this.transportManager_=new id(t),this.log_("Connection created"),this.start_()}start_(){let e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let t=this.connReceiver_(this.conn_),n=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(t,n)},Math.floor(0));let i=e.healthyTimeout||0;i>0&&(this.healthyTimeout_=n2(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>102400?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes.  Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>10240?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes.  Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(i)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return t=>{e===this.conn_?this.onConnectionLost_(t):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return t=>{2!==this.state_&&(e===this.rx_?this.onPrimaryMessageReceived_(t):e===this.secondaryConn_?this.onSecondaryMessageReceived_(t):this.log_("message on old connection"))}}sendRequest(e){this.sendData_({t:"d",d:e})}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if("t"in e){let t=e.t;"a"===t?this.upgradeIfSecondaryHealthy_():"r"===t?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):"o"===t&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){let t=nG("t",e),n=nG("d",e);if("c"===t)this.onSecondaryControl_(n);else if("d"===t)this.pendingDataMessages.push(n);else throw Error("Unknown protocol layer: "+t)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t
173:"c",d:{t:"p",d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){let t=nG("t",e),n=nG("d",e);"c"===t?this.onControl_(n):"d"===t&&this.onDataMessage_(n)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){!this.isHealthy_&&(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){let t=nG("t",e);if("d"in e){let n=e.d;if("h"===t){let e=Object.assign({},n);this.repoInfo_.isUsingEmulator&&(e.h=this.repoInfo_.host),this.onHandshake_(e)}else if("n"===t){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let e=0;e<this.pendingDataMessages.length;++e)this.onDataMessage_(this.pendingDataMessages[e]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===t?this.onConnectionShutdown_(n):"r"===t?this.onReset_(n):"e"===t?nj("Server Error: "+n):"o"===t?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):nj("Unknown control packet command: "+t)}}onHandshake_(e){let t=e.ts,n=e.v,i=e.h;this.sessionId=e.s,this.repoInfo_.host=i,0===this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,t),"5"!==n&&nU("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){let e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let t=this.connReceiver_(this.secondaryConn_),n=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(t,n),n2(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(6e4))}onReset_(e){this.log_("Reset packet received.  New host: "+e),this.repoInfo_.host=e,1===this.state_?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,t){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(t,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):n2(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))}sendPingOnPrimaryIfNecessary_(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))}onSecondaryConnectionLost_(){let e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,e||0!==this.state_?1===this.state_&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(nx.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(e)}close(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}class ig{put(e,t,n,i){}merge(e,t,n,i){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,t,n){}onDisconnectMerge(e,t,n){}onDisconnectCancel(e,t){}reportStats(e){}}class im{constructor(e){this.allowedEvents_=e,this.listeners_={},e7(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...t){if(Array.isArray(this.listeners_[e])){let n=[...this.listeners_[e]];for(let e=0;e<n.length;e++)n[e].callback.apply(n[e].context,t)}}on(e,t,n){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:t,context:n});let i=this.getInitialEvent(e);i&&t.apply(n,i)}off(e,t,n){this.validateEventType_(e);let i=this.listeners_[e]||[];for(let e=0;e<i.length;e++)if(i[e].callback===t&&(!n||n===i[e].context))return void i.splice(e,1)}validateEventType_(e){e7(this.allowedEvents_.find(t=>t===e),"Unknown event: "+e)}}class iy extends im{static getInstance(){return new iy}constructor(){super(["online"]),this.online_=!0,"u">typeof window&&void 0!==window.addEventListener&&!tf()&&(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}getInitialEvent(e){return e7("online"===e,"Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}}class i_{constructor(e,t){if(void 0===t){this.pieces_=e.split("/");let t=0;for(let e=0;e<this.pieces_.length;e++)this.pieces_[e].length>0&&(this.pieces_[t]=this.pieces_[e],t++);this.pieces_.length=t,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=t}toString(){let e="";for(let t=this.pieceNum_;t<this.pieces_.length;t++)""!==this.pieces_[t]&&(e+="/"+this.pieces_[t]);return e||"/"}}function iv(){return new i_("")}function iw(e){return e.pieceNum_>=e.pieces_.length?null:e.pieces_[e.pieceNum_]}function ib(e){return e.pieces_.length-e.pieceNum_}function iC(e){let t=e.pieceNum_;return t<e.pieces_.length&&t++,new i_(e.pieces_,t)}function iE(e){return e.pieceNum_<e.pieces_.length?e.pieces_[e.pieces_.length-1]:null}function iT(e,t=0){return e.pieces_.slice(e.pieceNum_+t)}function iS(e){if(e.pieceNum_>=e.pieces_.length)return null;let t=[];for(let n=e.pieceNum_;n<e.pieces_.length-1;n++)t.push(e.pieces_[n]);return new i_(t,0)}function iI(e,t){let n=[];for(let t=e.pieceNum_;t<e.pieces_.length;t++)n.push(e.pieces_[t]);if(t instanceof i_)for(let e=t.pieceNum_;e<t.pieces_.length;e++)n.push(t.pieces_[e]);else{let e=t.split("/");for(let t=0;t<e.length;t++)e[t].length>0&&n.push(e[t])}return new i_(n,0)}function ix(e){return e.pieceNum_>=e.pieces_.length}function ik(e,t){let n=iw(e),i=iw(t);if(null===n)return t;if(n===i)return ik(iC(e),iC(t));
173throw Error("INTERNAL ERROR: innerPath ("+t+") is not within outerPath ("+e+")")}function iN(e,t){let n=iT(e,0),i=iT(t,0);for(let e=0;e<n.length&&e<i.length;e++){let t=nW(n[e],i[e]);if(0!==t)return t}return n.length===i.length?0:n.length<i.length?-1:1}function iA(e,t){if(ib(e)!==ib(t))return!1;for(let n=e.pieceNum_,i=t.pieceNum_;n<=e.pieces_.length;n++,i++)if(e.pieces_[n]!==t.pieces_[i])return!1;return!0}function iP(e,t){let n=e.pieceNum_,i=t.pieceNum_;if(ib(e)>ib(t))return!1;for(;n<e.pieces_.length;){if(e.pieces_[n]!==t.pieces_[i])return!1;++n,++i}return!0}class iD{constructor(e,t){this.errorPrefix_=t,this.parts_=iT(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let e=0;e<this.parts_.length;e++)this.byteLength_+=tD(this.parts_[e]);iR(this)}}function iR(e){if(e.byteLength_>768)throw Error(e.errorPrefix_+"has a key path longer than 768 bytes ("+e.byteLength_+").");if(e.parts_.length>32)throw Error(e.errorPrefix_+"path specified exceeds the maximum depth that can be written (32) or object contains a cycle "+iO(e))}function iO(e){return 0===e.parts_.length?"":"in property '"+e.parts_.join(".")+"'"}class iM extends im{static getInstance(){return new iM}constructor(){let e,t;super(["visible"]),"u">typeof document&&void 0!==document.addEventListener&&(void 0!==document.hidden?(t="visibilitychange",e="hidden"):void 0!==document.mozHidden?(t="mozvisibilitychange",e="mozHidden"):void 0!==document.msHidden?(t="msvisibilitychange",e="msHidden"):void 0!==document.webkitHidden&&(t="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,t&&document.addEventListener(t,()=>{let t=!document[e];t!==this.visible_&&(this.visible_=t,this.trigger("visible",t))},!1)}getInitialEvent(e){return e7("visible"===e,"Unknown event type: "+e),[this.visible_]}}class iL extends ig{constructor(e,t,n,i,r,s,o,a){if(super(),this.repoInfo_=e,this.applicationId_=t,this.onDataUpdate_=n,this.onConnectStatus_=i,this.onServerInfoUpdate_=r,this.authTokenProvider_=s,this.appCheckTokenProvider_=o,this.authOverride_=a,this.id=iL.nextPersistentConnectionId_++,this.log_=nF("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=1e3,this.maxReconnectDelay_=3e5,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,a&&!tp())throw Error("Auth override specified in options, but not supported on non Node.js platforms");iM.getInstance().on("visible",this.onVisible_,this),-1===e.host.indexOf("fblocal")&&iy.getInstance().on("online",this.onOnline_,this)}sendRequest(e,t,n){let i=++this.requestNumber_,r={r:i,a:e,b:t};this.log_(tv(r)),e7(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(r),n&&(this.requestCBHash_[i]=n)}get(e){this.initConnection_();let t=new tu,n={p:e._path.toString(),q:e._queryObject};this.outstandingGets_.push({action:"g",request:n,onComplete:e=>{let n=e.d;"ok"===e.s?t.resolve(n):t.reject(n)}}),this.outstandingGetCount_++;let i=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(i),t.promise}listen(e,t,n,i){this.initConnection_();let r=e._queryIdentifier,s=e._path.toString();this.log_("Listen called for "+s+" "+r),this.listens.has(s)||this.listens.set(s,new Map),e7(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"listen() called for non-default but complete query"),e7(!this.listens.get(s).has(r),"listen() called twice for same path/queryId.");let o={onComplete:i,hashFn:t,query:e,tag:n};this.listens.get(s).set(r,o),this.connected_&&this.sendListen_(o)}sendGet_(e){let t=this.outstandingGets_[e];this.sendRequest("g",t.request,n=>{delete this.outstandingGets_[e],this.outstandingGetCount_--,0===this.outstandingGetCount_&&(this.outstandingGets_=[]),t.onComplete&&t.onComplete(n)})}sendListen_(e){let t=e.query,n=t._path.toString(),i=t._queryIdentifier;this.log_("Listen on "+n+" for "+i);let r={p:n};e.tag&&(r.q=t._queryObject,r.t=e.tag),r.h=e.hashFn(),this.sendRequest("q",r,r=>{let s=r.d,o=r.s;iL.warnOnListenWarnings_(s,t),(this.listens.get(n)&&this.listens.get(n).get(i))===e&&(this.log_("listen response",r),"ok"!==o&&this.removeListen_(n,i),e.onComplete&&e.onComplete(o,s))})}static warnOnListenWarnings_(e,t){if(e&&"object"==typeof e&&tE(e,"w")){let n=tT(e,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){let e='".indexOn": "'+t._queryParams.getIndex().toString()+'"',n=t._path.toString();nU(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${e} at ${n} to your security rules for better performance.`)}}}refreshAuthToken(e){this.authToken_=e,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(e)}reduceReconnectDelayIfAdminCredential_(e){(e&&40===e.length||tC(e))&&(this.log_("Admin auth credential detected.  Reducing max reconnect time."),this.maxReconnectDelay_=3e4)}refreshAppCheckToken(e){this.appCheckToken_=e,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){let e=this.authToken_,t=tb(e)?"auth":"gauth",n={cred:e};null===this.authOverride_?n.noauth=!0:"object"==typeof this.authOverride_&&(n.authvar=this.authOverride_),this.sendRequest(t,n,t=>{let n=t.s,i=t.d||"error";this.authToken_===e&&("ok"===n?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(n,i))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},e=>{let t=e.s,n=e.d||"error";"ok"===t?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(t,n)})}unlisten(e,t){let n=e._path.toString(),i=e._queryIdentifier;this.log_("Unlisten called for "+n+" "+i),e7(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,i)&&this.connected_&&this.sendUnlisten_(n,i,e._queryObject,t)}sendUnlisten_(e,t,n,i){this.log_("Unlisten on "+e+" for "+t);let r={p:e};i&&(r.q=n,r.t=i),this.sendRequest("n",r)}onDisconnectPut(e,t,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",e,t,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"o",data:t,onComplete:n})}onDisconnectMerge(e,t,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",e,t,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"om",data:t,onComplete:n})}onDisconnectCancel(e,t){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",e,null,t):this.onDisconnectRequestQueue_.push({pathString:e,action:"oc",data:null,onComplete:t})}sendOnDisconnect_(e,t,n,i){let r={p:t,d:n};this.log_("onDisconnect "+e,r),this.sendRequest(e,r,e=>
173{i&&setTimeout(()=>{i(e.s,e.d)},Math.floor(0))})}put(e,t,n,i){this.putInternal("p",e,t,n,i)}merge(e,t,n,i){this.putInternal("m",e,t,n,i)}putInternal(e,t,n,i,r){this.initConnection_();let s={p:t,d:n};void 0!==r&&(s.h=r),this.outstandingPuts_.push({action:e,request:s,onComplete:i}),this.outstandingPutCount_++;let o=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(o):this.log_("Buffering put: "+t)}sendPut_(e){let t=this.outstandingPuts_[e].action,n=this.outstandingPuts_[e].request,i=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(t,n,n=>{this.log_(t+" response",n),delete this.outstandingPuts_[e],this.outstandingPutCount_--,0===this.outstandingPutCount_&&(this.outstandingPuts_=[]),i&&i(n.s,n.d)})}reportStats(e){if(this.connected_){let t={c:e};this.log_("reportStats",t),this.sendRequest("s",t,e=>{if("ok"!==e.s){let t=e.d;this.log_("reportStats","Error sending stats: "+t)}})}}onDataMessage_(e){if("r"in e){this.log_("from server: "+tv(e));let t=e.r,n=this.requestCBHash_[t];n&&(delete this.requestCBHash_[t],n(e.b))}else if("error"in e)throw"A server-side error has occurred: "+e.error;else"a"in e&&this.onDataPush_(e.a,e.b)}onDataPush_(e,t){this.log_("handleServerMessage",e,t),"d"===e?this.onDataUpdate_(t.p,t.d,!1,t.t):"m"===e?this.onDataUpdate_(t.p,t.d,!0,t.t):"c"===e?this.onListenRevoked_(t.p,t.q):"ac"===e?this.onAuthRevoked_(t.s,t.d):"apc"===e?this.onAppCheckRevoked_(t.s,t.d):"sd"===e?this.onSecurityDebugPacket_(t):nj("Unrecognized action received from server: "+tv(e)+"\nAre you using the latest client?")}onReady_(e,t){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(e),this.lastSessionId=t,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(e){e7(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(e))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(e){e&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible.  Reducing delay."),this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0)),this.visible_=e}onOnline_(e){e?(this.log_("Browser went online."),this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline.  Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>3e4&&(this.reconnectDelay_=1e3),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible.  Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());let e=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_),t=Math.max(0,this.reconnectDelay_-e);t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;let e=this.onDataMessage_.bind(this),t=this.onReady_.bind(this),n=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+iL.nextConnectionId_++,r=this.lastSessionId,s=!1,o=null,a=function(){o?o.close():(s=!0,n())};this.realtime_={close:a,sendRequest:function(e){e7(o,"sendRequest call when we're not connected not allowed."),o.send
173Request(e)}};let l=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{let[a,h]=await Promise.all([this.authTokenProvider_.getToken(l),this.appCheckTokenProvider_.getToken(l)]);s?nL("getToken() completed but was canceled"):(nL("getToken() completed. Creating connection."),this.authToken_=a&&a.accessToken,this.appCheckToken_=h&&h.token,o=new ip(i,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,e,t,n,e=>{nU(e+" ("+this.repoInfo_.toString()+")"),this.interrupt("server_kill")},r))}catch(e){this.log_("Failed to get token: "+e),s||(this.repoInfo_.nodeAdmin&&nU(e),a())}}}interrupt(e){nL("Interrupting connection for reason: "+e),this.interruptReasons_[e]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(e){nL("Resuming connection for reason: "+e),delete this.interruptReasons_[e],tS(this.interruptReasons_)&&(this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(e){let t=e-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:t})}cancelSentTransactions_(){for(let e=0;e<this.outstandingPuts_.length;e++){let t=this.outstandingPuts_[e];t&&"h"in t.request&&t.queued&&(t.onComplete&&t.onComplete("disconnect"),delete this.outstandingPuts_[e],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])}onListenRevoked_(e,t){let n;n=t?t.map(e=>nQ(e)).join("$"):"default";let i=this.removeListen_(e,n);i&&i.onComplete&&i.onComplete("permission_denied")}removeListen_(e,t){let n,i=new i_(e).toString();if(this.listens.has(i)){let e=this.listens.get(i);n=e.get(t),e.delete(t),0===e.size&&this.listens.delete(i)}else n=void 0;return n}onAuthRevoked_(e,t){nL("Auth token revoked: "+e+"/"+t),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),("invalid_token"===e||"permission_denied"===e)&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(e,t){nL("App check token revoked: "+e+"/"+t),this.appCheckToken_=null,this.forceTokenRefresh_=!0,("invalid_token"===e||"permission_denied"===e)&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=3&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(e){this.securityDebugCallback_?this.securityDebugCallback_(e):"msg"in e&&console.log("FIREBASE: "+e.msg.replace("\n","\nFIREBASE: "))}restoreState_(){for(let e of(this.tryAuth(),this.tryAppCheck(),this.listens.values()))for(let t of e.values())this.sendListen_(t);for(let e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){let e=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(e.action,e.pathString,e.data,e.onComplete)}for(let e=0;e<this.outstandingGets_.length;e++)this.outstandingGets_[e]&&this.sendGet_(e)}sendConnectStats_(){let e={},t="js";tp()&&(t=this.repoInfo_.nodeAdmin?"admin_node":"node"),e["sdk."+t+"."+nE.replace(/\./g,"-")]=1,tf()?e["framework.cordova"]=1:"object"==typeof navigator&&"ReactNative"===navigator.product&&(e["framework.reactnative"]=1),this.reportStats(e)}shouldReconnect_(){let e=iy.getInstance().currentlyOnline();return tS(this.interruptReasons_)&&e}}iL.nextPersistentConnectionId_=0,iL.nextConnectionId_=0;class iF{constructor(e,t){this.name=e,this.node=t}static Wrap(e,t){return new iF(e,t)}}class ij{getCompare(){return this.compare.bind(this)}indexedValueChanged(e,t){let n=new iF(nH,e),i=new iF(nH,t);return 0!==this.compare(n,i)}minPost(){return iF.MIN}}class iV extends ij{static get __EMPTY_NODE(){return i}static set __EMPTY_NODE(e){i=e}compare(e,t){return nW(e.name,t.name)}isDefinedOn(e){throw e9("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,t){return!1}minPost(){return iF.MIN}maxPost(){return new iF(nz,i)}makePost(e,t){return e7("string"==typeof e,"KeyIndex indexValue must always be a string."),new iF(e,i)}toString(){return".key"}}let iU=new iV;class iB{constructor(e,t,n,i,r=null){this.isReverse_=i,this.resultGenerator_=r,this.nodeStack_=[];let s=1;for(;!e.isEmpty();)if(s=t?n(e.key,t):1,i&&(s*=-1),s<0)e=this.isReverse_?e.left:e.right;else if(0===s){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),e=this.isReverse_?e.right:e.left}getNext(){let e;if(0===this.nodeStack_.length)return null;let t=this.nodeStack_.pop();if(e=this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value},this.isReverse_)for(t=t.left;!t.isEmpty();)this.nodeStack_.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack_.push(t),t=t.left;return e}hasNext(){return this.nodeStack_.length>0}peek(){if(0===this.nodeStack_.length)return null;let e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}}class iq{constructor(e,t,n,i,r){this.key=e,this.value=t,this.color=null!=n?n:iq.RED,this.left=null!=i?i:i$.EMPTY_NODE,this.right=null!=r?r:i$.EMPTY_NODE}copy(e,t,n,i,r){return new iq(null!=e?e:this.key,null!=t?t:this.value,
173null!=n?n:this.color,null!=i?i:this.left,null!=r?r:this.right)}count(){return this.left.count()+1+this.right.count()}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 i=this,r=n(e,i.key);return(i=r<0?i.copy(null,null,null,i.left.insert(e,t,n),null):0===r?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,n))).fixUp_()}removeMin_(){if(this.left.isEmpty())return i$.EMPTY_NODE;let e=this;return e.left.isRed_()||e.left.left.isRed_()||(e=e.moveRedLeft_()),(e=e.copy(null,null,null,e.left.removeMin_(),null)).fixUp_()}remove(e,t){let n,i;if(n=this,0>t(e,n.key))n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(e,t),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===t(e,n.key))if(n.right.isEmpty())return i$.EMPTY_NODE;else i=n.right.min_(),n=n.copy(i.key,i.value,null,null,n.right.removeMin_());n=n.copy(null,null,null,null,n.right.remove(e,t))}return n.fixUp_()}isRed_(){return this.color}fixUp_(){let e=this;return e.right.isRed_()&&!e.left.isRed_()&&(e=e.rotateLeft_()),e.left.isRed_()&&e.left.left.isRed_()&&(e=e.rotateRight_()),e.left.isRed_()&&e.right.isRed_()&&(e=e.colorFlip_()),e}moveRedLeft_(){let e=this.colorFlip_();return e.right.left.isRed_()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight_())).rotateLeft_()).colorFlip_()),e}moveRedRight_(){let e=this.colorFlip_();return e.left.left.isRed_()&&(e=(e=e.rotateRight_()).colorFlip_()),e}rotateLeft_(){let e=this.copy(null,null,iq.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight_(){let e=this.copy(null,null,iq.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip_(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth_(){return Math.pow(2,this.check_())<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw Error("Red node has red child("+this.key+","+this.value+")");
173if(this.right.isRed_())throw Error("Right child of ("+this.key+","+this.value+") is red");let e=this.left.check_();if(e===this.right.check_())return e+ +!this.isRed_();throw Error("Black depths differ")}}iq.RED=!0,iq.BLACK=!1;class i${constructor(e,t=i$.EMPTY_NODE){this.comparator_=e,this.root_=t}insert(e,t){return new i$(this.comparator_,this.root_.insert(e,t,this.comparator_).copy(null,null,iq.BLACK,null,null))}remove(e){return new i$(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,iq.BLACK,null,null))}get(e){let t,n=this.root_;for(;!n.isEmpty();){if(0===(t=this.comparator_(e,n.key)))return n.value;t<0?n=n.left:t>0&&(n=n.right)}return null}getPredecessorKey(e){let t,n=this.root_,i=null;for(;!n.isEmpty();){if(0===(t=this.comparator_(e,n.key)))if(n.left.isEmpty())if(i)return i.key;else return null;else{for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}t<0?n=n.left:t>0&&(i=n,n=n.right)}throw Error("Attempted to find predecessor key for a nonexistent key.  What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new iB(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,t){return new iB(this.root_,e,this.comparator_,!1,t)}getReverseIteratorFrom(e,t){return new iB(this.root_,e,this.comparator_,!0,t)}getReverseIterator(e){return new iB(this.root_,null,this.comparator_,!0,e)}}function iH(e,t){return nW(e.name,t.name)}function iz(e,t){return nW(e,t)}i$.EMPTY_NODE=new class{copy(e,t,n,i,r){return this}insert(e,t,n){return new iq(e,t,null)}remove(e,t){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}};let iW=function(e){return"number"==typeof e?"number:"+nJ(e):"string:"+e},iK=function(e){if(e.isLeafNode()){let t=e.val();e7("string"==typeof t||"number"==typeof t||"object"==typeof t&&tE(t,".sv"),"Priority must be a string or number.")}else e7(e===r||e.isEmpty(),"priority of unexpected type.");e7(e===r||e.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};class iG{static set __childrenNodeConstructor(e){s=e}static get __childrenNodeConstructor(){return s}constructor(e,t=iG.__childrenNodeConstructor.EMPTY_NODE){this.value_=e,this.priorityNode_=t,this.lazyHash_=null,e7(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),iK(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(e){return new iG(this.value_,e)}getImmediateChild(e){return".priority"===e?this.priorityNode_:iG.__childrenNodeConstructor.EMPTY_NODE}getChild(e){return ix(e)?this:".priority"===iw(e)?this.priorityNode_:iG.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(e,t){return null}updateImmediateChild(e,t){return".priority"===e?this.updatePriority(t):t.isEmpty()&&".priority"!==e?this:iG.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,t).updatePriority(this.priorityNode_)}updateChild(e,t){let n=iw(e);return null===n?t:t.isEmpty()&&".priority"!==n?this:(e7(".priority"!==n||1===ib(e),".priority must be the last token in a path"),this.updateImmediateChild(n,iG.__childrenNodeConstructor.EMPTY_NODE.updateChild(iC(e),t)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(e,t){return!1}val(e){return e&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(null===this.lazyHash_){let e="";this.priorityNode_.isEmpty()||(e+="priority:"+iW(this.priorityNode_.val())+":");let t=typeof this.value_;e+=t+":","number"===t?e+=nJ(this.value_):e+=this.value_,this.lazyHash_=nP(e)}return this.lazyHash_}getValue(){return this.value_}compareTo(e){return e===iG.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof iG.__childrenNodeConstructor?-1:(e7(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))}compareToLeafNode_(e){let t=typeof e.value_,n=typeof this.value_,i=iG.VALUE_TYPE_ORDER.indexOf(t),r=iG.VALUE_TYPE_ORDER.indexOf(n);return(e7(i>=0,"Unknown leaf type: "+t),e7(r>=0,"Unknown leaf type: "+n),i!==r)?r-i:"object"===n?0:this.value_<e.value_?-1:1*(this.value_!==e.value_)}withIndex(){return this}isIndexed(){return!0}equals(e){return e===this||!!e.isLeafNode()&&this.value_===e.value_&&this.priorityNode_.equals(e.priorityNode_)}}iG.VALUE_TYPE_ORDER=["object","boolean","number","string"];let iQ=new class extends ij{compare(e,t){let n=e.node.getPriority(),i=t.node.getPriority(),r=n.compareTo(i);return 0===r?nW(e.name,t.name):r}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,t){return!e.getPriority().equals(t.getPriority())}
173minPost(){return iF.MIN}maxPost(){return new iF(nz,new iG("[PRIORITY-POST]",a))}makePost(e,t){return new iF(t,new iG("[PRIORITY-POST]",o(e)))}toString(){return".priority"}},iY=Math.log(2);class iX{constructor(e){this.count=(e=>parseInt(Math.log(e)/iY,10))(e+1),this.current_=this.count-1;const t=(e=>parseInt(Array(e+1).join("1"),2))(this.count);this.bits_=e+1&t}nextBitIsOne(){let e=!(this.bits_&1<<this.current_);return this.current_--,e}}let iJ=function(e,t,n,i){e.sort(t);let r=function(t,i){let s,o=i-t;if(0===o)return null;if(1===o)return s=e[t],new iq(n?n(s):s,s.node,iq.BLACK,null,null);{let a=parseInt(o/2,10)+t,l=r(t,a),h=r(a+1,i);return s=e[a],new iq(n?n(s):s,s.node,iq.BLACK,l,h)}};return new i$(i||t,function(t){let i=null,s=null,o=e.length,a=function(t,i){let s=o-t,a=o;o-=t;let h=r(s+1,a),u=e[s];l(new iq(n?n(u):u,u.node,i,null,h))},l=function(e){i?i.left=e:s=e,i=e};for(let e=0;e<t.count;++e){let n=t.nextBitIsOne(),i=Math.pow(2,t.count-(e+1));n?a(i,iq.BLACK):(a(i,iq.BLACK),a(i,iq.RED))}return s}(new iX(e.length)))},iZ={};class i0{static get Default(){return e7(iZ&&iQ,"ChildrenNode.ts has not been loaded"),l=l||new i0({".priority":iZ},{".priority":iQ})}constructor(e,t){this.indexes_=e,this.indexSet_=t}get(e){let t=tT(this.indexes_,e);if(!t)throw Error("No index defined for "+e);return t instanceof i$?t:null}hasIndex(e){return tE(this.indexSet_,e.toString())}addIndex(e,t){let n;e7(e!==iU,"KeyIndex always exists and isn't meant to be added to the IndexMap.");let i=[],r=!1,s=t.getIterator(iF.Wrap),o=s.getNext();for(;o;)r=r||e.isDefinedOn(o.node),i.push(o),o=s.getNext();n=r?iJ(i,e.getCompare()):iZ;let a=e.toString(),l=Object.assign({},this.indexSet_);l[a]=e;let h=Object.assign({},this.indexes_);return h[a]=n,new i0(h,l)}addToIndexes(e,t){return new i0(tI(this.indexes_,(n,i)=>{let r=tT(this.indexSet_,i);if(e7(r,"Missing index implementation for "+i),n===iZ)if(!r.isDefinedOn(e.node))return iZ;else{let n=[],i=t.getIterator(iF.Wrap),s=i.getNext();for(;s;)s.name!==e.name&&n.push(s),s=i.getNext();return n.push(e),iJ(n,r.getCompare())}{let i=t.get(e.name),r=n;return i&&(r=r.remove(new iF(e.name,i))),r.insert(e,e.node)}}),this.indexSet_)}removeFromIndexes(e,t){return new i0(tI(this.indexes_,n=>{if(n===iZ)return n;{let i=t.get(e.name);return i?n.remove(new iF(e.name,i)):n}}),this.indexSet_)}}class i1{static get EMPTY_NODE(){return h||(h=new i1(new i$(iz),null,i0.Default))}constructor(e,t,n){this.children_=e,this.priorityNode_=t,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&iK(this.priorityNode_),this.children_.isEmpty()&&e7(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||h}updatePriority(e){return this.children_.isEmpty()?this:new i1(this.children_,e,this.indexMap_)}getImmediateChild(e){if(".priority"===e)return this.getPriority();{let t=this.children_.get(e);return null===t?h:t}}getChild(e){let t=iw(e);return null===t?this:this.getImmediateChild(t).getChild(iC(e))}hasChild(e){return null!==this.children_.get(e)}updateImmediateChild(e,t){if(e7(t,"We should always be passing snapshot nodes"),".priority"===e)return this.updatePriority(t);{let n,i,r=new iF(e,t);t.isEmpty()?(n=this.children_.remove(e),i=this.indexMap_.removeFromIndexes(r,this.children_)):(n=this.children_.insert(e,t),i=this.indexMap_.addToIndexes(r,this.children_));let s=n.isEmpty()?h:this.priorityNode_;return new i1(n,s,i)}}updateChild(e,t){let n=iw(e);if(null===n)return t;{e7(".priority"!==iw(e)||1===ib(e),".priority must be the last token in a path");let i=this.getImmediateChild(n).updateChild(iC(e),t);return this.updateImmediateChild(n,i)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(e){if(this.isEmpty())return null;let t={},n=0,i=0,r=!0;if(this.forEachChild(iQ,(s,o)=>{t[s]=o.val(e),n++,r&&i1.INTEGER_REGEXP_.test(s)?i=Math.max(i,Number(s)):r=!1}),e||!r||!(i<2*n))return e&&!this.getPriority().isEmpty()&&(t[".priority"]=this.getPriority().val()),t;{let e=[];for(let n in t)e[n]=t[n];return e}}hash(){if(null===this.lazyHash_){let e="";
173this.getPriority().isEmpty()||(e+="priority:"+iW(this.getPriority().val())+":"),this.forEachChild(iQ,(t,n)=>{let i=n.hash();""!==i&&(e+=":"+t+":"+i)}),this.lazyHash_=""===e?"":nP(e)}return this.lazyHash_}getPredecessorChildName(e,t,n){let i=this.resolveIndex_(n);if(!i)return this.children_.getPredecessorKey(e);{let n=i.getPredecessorKey(new iF(e,t));return n?n.name:null}}getFirstChildName(e){let t=this.resolveIndex_(e);if(!t)return this.children_.minKey();{let e=t.minKey();return e&&e.name}}getFirstChild(e){let t=this.getFirstChildName(e);return t?new iF(t,this.children_.get(t)):null}getLastChildName(e){let t=this.resolveIndex_(e);if(!t)return this.children_.maxKey();{let e=t.maxKey();return e&&e.name}}getLastChild(e){let t=this.getLastChildName(e);return t?new iF(t,this.children_.get(t)):null}forEachChild(e,t){let n=this.resolveIndex_(e);return n?n.inorderTraversal(e=>t(e.name,e.node)):this.children_.inorderTraversal(t)}getIterator(e){return this.getIteratorFrom(e.minPost(),e)}getIteratorFrom(e,t){let n=this.resolveIndex_(t);if(n)return n.getIteratorFrom(e,e=>e);{let n=this.children_.getIteratorFrom(e.name,iF.Wrap),i=n.peek();for(;null!=i&&0>t.compare(i,e);)n.getNext(),i=n.peek();return n}}getReverseIterator(e){return this.getReverseIteratorFrom(e.maxPost(),e)}getReverseIteratorFrom(e,t){let n=this.resolveIndex_(t);if(n)return n.getReverseIteratorFrom(e,e=>e);{let n=this.children_.getReverseIteratorFrom(e.name,iF.Wrap),i=n.peek();for(;null!=i&&t.compare(i,e)>0;)n.getNext(),i=n.peek();return n}}compareTo(e){if(this.isEmpty())if(e.isEmpty())return 0;else return -1;return e.isLeafNode()||e.isEmpty()?1:e===i2?-1:0}withIndex(e){if(e===iU||this.indexMap_.hasIndex(e))return this;{let t=this.indexMap_.addIndex(e,this.children_);return new i1(this.children_,this.priorityNode_,t)}}isIndexed(e){return e===iU||this.indexMap_.hasIndex(e)}equals(e){if(e===this)return!0;if(e.isLeafNode()||!this.getPriority().equals(e.getPriority()))return!1;if(this.children_.count()!==e.children_.count())return!1;{let t=this.getIterator(iQ),n=e.getIterator(iQ),i=t.getNext(),r=n.getNext();for(;i&&r;){if(i.name!==r.name||!i.node.equals(r.node))return!1;i=t.getNext(),r=n.getNext()}return null===i&&null===r}}resolveIndex_(e){return e===iU?null:this.indexMap_.get(e.toString())}}i1.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;let i2=new class extends i1{constructor(){super(new i$(iz),i1.EMPTY_NODE,i0.Default)}compareTo(e){return+(e!==this)}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return i1.EMPTY_NODE}isEmpty(){return!1}};function i5(e,t=null){if(null===e)return i1.EMPTY_NODE;if("object"==typeof e&&".priority"in e&&(t=e[".priority"]),e7(null===t||"string"==typeof t||"number"==typeof t||"object"==typeof t&&".sv"in t,"Invalid priority type found: "+typeof t),"object"==typeof e&&".value"in e&&null!==e[".value"]&&(e=e[".value"]),"object"!=typeof e||".sv"in e)return new iG(e,i5(t));if(e instanceof Array){let n=i1.EMPTY_NODE;return nX(e,(t,i)=>{if(tE(e,t)&&"."!==t.substring(0,1)){let e=i5(i);(e.isLeafNode()||!e.isEmpty())&&(n=n.updateImmediateChild(t,e))}}),n.updatePriority(i5(t))}{let n=[],i=!1;if(nX(e,(e,t)=>{if("."!==e.substring(0,1)){let r=i5(t);r.isEmpty()||(i=i||!r.getPriority().isEmpty(),n.push(new iF(e,r)))}}),0===n.length)return i1.EMPTY_NODE;let r=iJ(n,iH,e=>e.name,iz);if(!i)return new i1(r,i5(t),i0.Default);{let e=iJ(n,iQ.getCompare());return new i1(r,i5(t),new i0({".priority":e},{".priority":iQ}))}}}Object.defineProperties(iF,{MIN:{value:new iF(nH,i1.EMPTY_NODE)},MAX:{value:new iF(nz,i2)}}),iV.__EMPTY_NODE=i1.EMPTY_NODE,iG.__childrenNodeConstructor=i1,r=i2,a=i2,o=i5;class i3 extends ij{constructor(e){super(),this.indexPath_=e,e7(!ix(e)&&".priority"!==iw(e),"Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,t){let n=this.extractChild(e.node),i=this.extractChild(t.node),r=n.compareTo(i);return 0===r?nW(e.name,t.name):r}makePost(e,t){let n=i5(e);return new iF(t,i1.EMPTY_NODE.updateChild(this.indexPath_,n))}maxPost(){return new iF(nz,i1.EMPTY_NODE.updateChild(this.indexPath_,i2))}toString(){return iT(this.indexPath_,0).join("/")}}let i4=new class extends ij{compare(e,t){let n=e.node.compareTo(t.node);return 0===n?nW(e.name,t.name):n}isDefinedOn(e){return!0}indexedValueChanged(e,t){return!e.equals(t)}
173minPost(){return iF.MIN}maxPost(){return iF.MAX}makePost(e,t){return new iF(t,i5(e))}toString(){return".value"}};function i6(e){return{type:"value",snapshotNode:e}}function i8(e,t){return{type:"child_added",snapshotNode:t,childName:e}}function i7(e,t){return{type:"child_removed",snapshotNode:t,childName:e}}function i9(e,t,n){return{type:"child_changed",snapshotNode:t,childName:e,oldSnap:n}}class re{constructor(e){this.index_=e}updateChild(e,t,n,i,r,s){e7(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");let o=e.getImmediateChild(t);return o.getChild(i).equals(n.getChild(i))&&o.isEmpty()===n.isEmpty()||(null!=s&&(n.isEmpty()?e.hasChild(t)?s.trackChildChange(i7(t,o)):e7(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):o.isEmpty()?s.trackChildChange(i8(t,n)):s.trackChildChange(i9(t,n,o))),e.isLeafNode()&&n.isEmpty())?e:e.updateImmediateChild(t,n).withIndex(this.index_)}updateFullNode(e,t,n){return null!=n&&(e.isLeafNode()||e.forEachChild(iQ,(e,i)=>{t.hasChild(e)||n.trackChildChange(i7(e,i))}),t.isLeafNode()||t.forEachChild(iQ,(t,i)=>{if(e.hasChild(t)){let r=e.getImmediateChild(t);r.equals(i)||n.trackChildChange(i9(t,i,r))}else n.trackChildChange(i8(t,i))})),t.withIndex(this.index_)}updatePriority(e,t){return e.isEmpty()?i1.EMPTY_NODE:e.updatePriority(t)}filtersNodes(){return!1}getIndexedFilter(){return this}getIndex(){return this.index_}}class rt{constructor(e){this.indexedFilter_=new re(e.getIndex()),this.index_=e.getIndex(),this.startPost_=rt.getStartPost_(e),this.endPost_=rt.getEndPost_(e),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}getStartPost(){return this.startPost_}getEndPost(){return this.endPost_}matches(e){let t=this.startIsInclusive_?0>=this.index_.compare(this.getStartPost(),e):0>this.index_.compare(this.getStartPost(),e),n=this.endIsInclusive_?0>=this.index_.compare(e,this.getEndPost()):0>this.index_.compare(e,this.getEndPost());return t&&n}updateChild(e,t,n,i,r,s){return this.matches(new iF(t,n))||(n=i1.EMPTY_NODE),this.indexedFilter_.updateChild(e,t,n,i,r,s)}updateFullNode(e,t,n){t.isLeafNode()&&(t=i1.EMPTY_NODE);let i=t.withIndex(this.index_);i=i.updatePriority(i1.EMPTY_NODE);let r=this;return t.forEachChild(iQ,(e,t)=>{r.matches(new iF(e,t))||(i=i.updateImmediateChild(e,i1.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(e,i,n)}updatePriority(e,t){return e}filtersNodes(){return!0}getIndexedFilter(){return this.indexedFilter_}getIndex(){return this.index_}static getStartPost_(e){if(!e.hasStart())return e.getIndex().minPost();{let t=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),t)}}static getEndPost_(e){if(!e.hasEnd())return e.getIndex().maxPost();{let t=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),t)}}}class rn{constructor(e){this.withinDirectionalStart=e=>this.reverse_?this.withinEndPost(e):this.withinStartPost(e),this.withinDirectionalEnd=e=>this.reverse_?this.withinStartPost(e):this.withinEndPost(e),this.withinStartPost=e=>{let t=this.index_.compare(this.rangedFilter_.getStartPost(),e);return this.startIsInclusive_?t<=0:t<0},this.withinEndPost=e=>{let t=this.index_.compare(e,this.rangedFilter_.getEndPost());return this.endIsInclusive_?t<=0:t<0},this.rangedFilter_=new rt(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft(),this.startIsInclusive_=!e.startAfterSet_,this.endIsInclusive_=!e.endBeforeSet_}updateChild(e,t,n,i,r,s){return(this.rangedFilter_.matches(new iF(t,n))||(n=i1.EMPTY_NODE),e.getImmediateChild(t).equals(n))?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,t,n,i,r,s):this.fullLimitUpdateChild_(e,t,n,r,s)}updateFullNode(e,t,n){let i;if(t.isLeafNode()||t.isEmpty())i=i1.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<t.numChildren()&&t.isIndexed(this.index_)){let e;i=i1.EMPTY_NODE.withIndex(this.index_),e=this.reverse_?t.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):t.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);let n=0;for(;e.hasNext()&&n<this.limit_;){let t=e.getNext();if(this.withinDirectionalStart(t))if(this.withinDirectionalEnd(t))i=i.updateImmediateChild(t.name,t.node),n++;else break}}else{let e;i=(i=t.withIndex(this.index_)).updatePriority(i1.EMPTY_NODE),e=this.reverse_?i.getReverseIterator(this.index_):i.getIterator(this.index_);let n=0;for(;e.hasNext();){let t=e.getNext();n<this.limit_&&this.withinDirectionalStart(t)&&this.withinDirectionalEnd(t)?n++:i=i.updateImmediateChild(t.name,i1.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(e,i,n)}updatePriority(e,t){return e}filtersNodes(){return!0}getIndexedFilter(){return this.rangedFilter_.getIndexedFilter()}getIndex(){return this.index_}
173fullLimitUpdateChild_(e,t,n,i,r){let s;if(this.reverse_){let e=this.index_.getCompare();s=(t,n)=>e(n,t)}else s=this.index_.getCompare();e7(e.numChildren()===this.limit_,"");let o=new iF(t,n),a=this.reverse_?e.getFirstChild(this.index_):e.getLastChild(this.index_),l=this.rangedFilter_.matches(o);if(e.hasChild(t)){let h=e.getImmediateChild(t),u=i.getChildAfterChild(this.index_,a,this.reverse_);for(;null!=u&&(u.name===t||e.hasChild(u.name));)u=i.getChildAfterChild(this.index_,u,this.reverse_);let c=null==u?1:s(u,o);if(l&&!n.isEmpty()&&c>=0)return null!=r&&r.trackChildChange(i9(t,n,h)),e.updateImmediateChild(t,n);{null!=r&&r.trackChildChange(i7(t,h));let n=e.updateImmediateChild(t,i1.EMPTY_NODE);return null!=u&&this.rangedFilter_.matches(u)?(null!=r&&r.trackChildChange(i8(u.name,u.node)),n.updateImmediateChild(u.name,u.node)):n}}return n.isEmpty()?e:l?s(a,o)>=0?(null!=r&&(r.trackChildChange(i7(a.name,a.node)),r.trackChildChange(i8(t,n))),e.updateImmediateChild(t,n).updateImmediateChild(a.name,i1.EMPTY_NODE)):e:e}}class ri{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=iQ}hasStart(){return this.startSet_}isViewFromLeft(){return""===this.viewFrom_?this.startSet_:"l"===this.viewFrom_}getIndexStartValue(){return e7(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return(e7(this.startSet_,"Only valid if start has been set"),this.startNameSet_)?this.indexStartName_:nH}hasEnd(){return this.endSet_}getIndexEndValue(){return e7(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return(e7(this.endSet_,"Only valid if end has been set"),this.endNameSet_)?this.indexEndName_:nz}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&""!==this.viewFrom_}getLimit(){return e7(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===iQ}copy(){let e=new ri;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}}function rr(e){let t,n={};if(e.isDefault())return n;if(e.index_===iQ?t="$priority":e.index_===i4?t="$value":e.index_===iU?t="$key":(e7(e.index_ instanceof i3,"Unrecognized index type!"),t=e.index_.toString()),n.orderBy=tv(t),e.startSet_){let t=e.startAfterSet_?"startAfter":"startAt";n[t]=tv(e.indexStartValue_),e.startNameSet_&&(n[t]+=","+tv(e.indexStartName_))}if(e.endSet_){let t=e.endBeforeSet_?"endBefore":"endAt";n[t]=tv(e.indexEndValue_),e.endNameSet_&&(n[t]+=","+tv(e.indexEndName_))}return e.limitSet_&&(e.isViewFromLeft()?n.limitToFirst=e.limit_:n.limitToLast=e.limit_),n}function rs(e){let t={};if(e.startSet_&&(t.sp=e.indexStartValue_,e.startNameSet_&&(t.sn=e.indexStartName_),t.sin=!e.startAfterSet_),e.endSet_&&(t.ep=e.indexEndValue_,e.endNameSet_&&(t.en=e.indexEndName_),t.ein=!e.endBeforeSet_),e.limitSet_){t.l=e.limit_;let n=e.viewFrom_;""===n&&(n=e.isViewFromLeft()?"l":"r"),t.vf=n}return e.index_!==iQ&&(t.i=e.index_.toString()),t}class ro extends ig{reportStats(e){throw Error("Method not implemented.")}static getListenId_(e,t){return void 0!==t?"tag$"+t:(e7(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}constructor(e,t,n,i){super(),this.repoInfo_=e,this.onDataUpdate_=t,this.authTokenProvider_=n,this.appCheckTokenProvider_=i,this.log_=nF("p:rest:"),this.listens_={}}listen(e,t,n,i){let r=e._path.toString();this.log_("Listen called for "+r+" "+e._queryIdentifier);let s=ro.getListenId_(e,n),o={};this.listens_[s]=o;let a=rr(e._queryParams);this.restRequest_(r+".json",a,(e,t)=>{let a=t;(404===e&&(a=null,e=null),null===e&&this.onDataUpdate_(r,a,!1,n),tT(this.listens_,s)===o)&&i(e?401===e?"permission_denied":"rest_error:"+e:"ok",null)})}unlisten(e,t){let n=ro.getListenId_(e,t);delete this.listens_[n]}get(e){let t=rr(e._queryParams),n=e._path.toString(),i=new tu;return this.restRequest_(n+".json",t,(e,t)=>{let r=t;404===e&&(r=null,e=null),null===e?(this.onDataUpdate_(n,r,!1,null),i.resolve(r)):i.reject(Error(r))}),i.promise}refreshAuthToken(e){}restRequest_(e,t={},n){return t.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([i,r])=>{i&&i.accessToken&&(t.auth=i.accessToken),r&&r.token&&(t.ac=r.token);let s=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+function(e){let t=[];
173for(let[n,i]of Object.entries(e))Array.isArray(i)?i.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(i));return t.length?"&"+t.join("&"):""}(t);this.log_("Sending REST request for "+s);let o=new XMLHttpRequest;o.onreadystatechange=()=>{if(n&&4===o.readyState){this.log_("REST Response for "+s+" received. status:",o.status,"response:",o.responseText);let e=null;if(o.status>=200&&o.status<300){try{e=t_(o.responseText)}catch(e){nU("Failed to parse JSON response for "+s+": "+o.responseText)}n(null,e)}else 401!==o.status&&404!==o.status&&nU("Got unsuccessful REST response for "+s+" Status: "+o.status),n(o.status);n=null}},o.open("GET",s,!0),o.send()})}}class ra{constructor(){this.rootNode_=i1.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,t){this.rootNode_=this.rootNode_.updateChild(e,t)}}function rl(){return{value:null,children:new Map}}function rh(e,t,n){var i,r;null!==e.value?n(t,e.value):(i=e,r=(e,i)=>{rh(i,new i_(t.toString()+"/"+e),n)},i.children.forEach((e,t)=>{r(t,e)}))}class ru{constructor(e){this.collection_=e,this.last_=null}get(){let e=this.collection_.get(),t=Object.assign({},e);return this.last_&&nX(this.last_,(e,n)=>{t[e]=t[e]-n}),this.last_=e,t}}class rc{constructor(e,t){this.server_=t,this.statsToReport_={},this.statsListener_=new ru(e);const n=1e4+2e4*Math.random();n2(this.reportStats_.bind(this),Math.floor(n))}reportStats_(){let e=this.statsListener_.get(),t={},n=!1;nX(e,(e,i)=>{i>0&&tE(this.statsToReport_,e)&&(t[e]=i,n=!0)}),n&&this.server_.reportStats(t),n2(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))}}function rd(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function rf(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function rp(e){return{fromUser:!1,fromServer:!0,queryId:e,tagged:!0}}(m=x||(x={}))[m.OVERWRITE=0]="OVERWRITE",m[m.MERGE=1]="MERGE",m[m.ACK_USER_WRITE=2]="ACK_USER_WRITE",m[m.LISTEN_COMPLETE=3]="LISTEN_COMPLETE";class rg{constructor(e,t,n){this.path=e,this.affectedTree=t,this.revert=n,this.type=x.ACK_USER_WRITE,this.source=rd()}operationForChild(e){if(!ix(this.path))return e7(iw(this.path)===e,"operationForChild called for unrelated child."),new rg(iC(this.path),this.affectedTree,this.revert);if(null!=this.affectedTree.value)return e7(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{let t=this.affectedTree.subtree(new i_(e));return new rg(iv(),t,this.revert)}}}class rm{constructor(e,t){this.source=e,this.path=t,this.type=x.LISTEN_COMPLETE}operationForChild(e){return ix(this.path)?new rm(this.source,iv()):new rm(this.source,iC(this.path))}}class ry{constructor(e,t,n){this.source=e,this.path=t,this.snap=n,this.type=x.OVERWRITE}operationForChild(e){return ix(this.path)?new ry(this.source,iv(),this.snap.getImmediateChild(e)):new ry(this.source,iC(this.path),this.snap)}}class r_{constructor(e,t,n){this.source=e,this.path=t,this.children=n,this.type=x.MERGE}operationForChild(e){if(!ix(this.path))return e7(iw(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new r_(this.source,iC(this.path),this.children);{let t=this.children.subtree(new i_(e));return t.isEmpty()?null:t.value?new ry(this.source,iv(),t.value):new r_(this.source,iv(),t)}}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}class rv{constructor(e,t,n){this.node_=e,this.fullyInitialized_=t,this.filtered_=n}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(ix(e))return this.isFullyInitialized()&&!this.filtered_;let t=iw(e);return this.isCompleteForChild(t)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}}class rw{constructor(e){this.query_=e,this.index_=this.query_._queryParams.getIndex()}}function rb(e,t,n,i,r,s){let o=i.filter(e=>e.type===n);o.sort((t,n)=>(function(e,t,n){if(null==t.childName||null==n.childName)throw e9("Should only compare child_ events.");let i=new iF(t.childName,t.snapshotNode),r=new iF(n.childName,n.snapshotNode);return e.index_.compare(i,r)})(e,t,n)),o.forEach(n=>{var i,o,a;let l=(i=e,o=n,a=s,"value"===o.type||"child_removed"===o.type||(o.prevName=a.getPredecessorChildName(o.childName,o.snapshotNode,i.index_)),o);r.forEach(i=>
173{i.respondsTo(n.type)&&t.push(i.createEvent(l,e.query_))})})}function rC(e,t){return{eventCache:e,serverCache:t}}function rE(e,t,n,i){return rC(new rv(t,n,i),e.serverCache)}function rT(e,t,n,i){return rC(e.eventCache,new rv(t,n,i))}function rS(e){return e.eventCache.isFullyInitialized()?e.eventCache.getNode():null}function rI(e){return e.serverCache.isFullyInitialized()?e.serverCache.getNode():null}class rx{static fromObject(e){let t=new rx(null);return nX(e,(e,n)=>{t=t.set(new i_(e),n)}),t}constructor(e,t=(!u&&(u=new i$(nK)),u)){this.value=e,this.children=t}isEmpty(){return null===this.value&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,t){if(null!=this.value&&t(this.value))return{path:iv(),value:this.value};{if(ix(e))return null;let n=iw(e),i=this.children.get(n);if(null===i)return null;{let r=i.findRootMostMatchingPathAndValue(iC(e),t);return null!=r?{path:iI(new i_(n),r.path),value:r.value}:null}}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(ix(e))return this;{let t=iw(e),n=this.children.get(t);return null!==n?n.subtree(iC(e)):new rx(null)}}set(e,t){if(ix(e))return new rx(t,this.children);{let n=iw(e),i=(this.children.get(n)||new rx(null)).set(iC(e),t),r=this.children.insert(n,i);return new rx(this.value,r)}}remove(e){if(ix(e))if(this.children.isEmpty())return new rx(null);else return new rx(null,this.children);{let t=iw(e),n=this.children.get(t);if(!n)return this;{let i,r=n.remove(iC(e));return(i=r.isEmpty()?this.children.remove(t):this.children.insert(t,r),null===this.value&&i.isEmpty())?new rx(null):new rx(this.value,i)}}}get(e){if(ix(e))return this.value;{let t=iw(e),n=this.children.get(t);return n?n.get(iC(e)):null}}setTree(e,t){if(ix(e))return t;{let n,i=iw(e),r=(this.children.get(i)||new rx(null)).setTree(iC(e),t);return n=r.isEmpty()?this.children.remove(i):this.children.insert(i,r),new rx(this.value,n)}}fold(e){return this.fold_(iv(),e)}fold_(e,t){let n={};return this.children.inorderTraversal((i,r)=>{n[i]=r.fold_(iI(e,i),t)}),t(e,this.value,n)}findOnPath(e,t){return this.findOnPath_(e,iv(),t)}findOnPath_(e,t,n){let i=!!this.value&&n(t,this.value);if(i)return i;{if(ix(e))return null;let i=iw(e),r=this.children.get(i);return r?r.findOnPath_(iC(e),iI(t,i),n):null}}foreachOnPath(e,t){return this.foreachOnPath_(e,iv(),t)}foreachOnPath_(e,t,n){if(ix(e))return this;{this.value&&n(t,this.value);let i=iw(e),r=this.children.get(i);return r?r.foreachOnPath_(iC(e),iI(t,i),n):new rx(null)}}foreach(e){this.foreach_(iv(),e)}foreach_(e,t){this.children.inorderTraversal((n,i)=>{i.foreach_(iI(e,n),t)}),this.value&&t(e,this.value)}foreachChild(e){this.children.inorderTraversal((t,n)=>{n.value&&e(t,n.value)})}}class rk{constructor(e){this.writeTree_=e}static empty(){return new rk(new rx(null))}}function rN(e,t,n){if(ix(t))return new rk(new rx(n));{let i=e.writeTree_.findRootMostValueAndPath(t);if(null!=i){let r=i.path,s=i.value,o=ik(r,t);return s=s.updateChild(o,n),new rk(e.writeTree_.set(r,s))}{let i=new rx(n);return new rk(e.writeTree_.setTree(t,i))}}}function rA(e,t,n){let i=e;return nX(n,(e,n)=>{i=rN(i,iI(t,e),n)}),i}function rP(e,t){return ix(t)?rk.empty():new rk(e.writeTree_.setTree(t,new rx(null)))}function rD(e,t){return null!=rR(e,t)}function rR(e,t){let n=e.writeTree_.findRootMostValueAndPath(t);return null!=n?e.writeTree_.get(n.path).getChild(ik(n.path,t)):null}function rO(e){let t=[],n=e.writeTree_.value;return null!=n?n.isLeafNode()||n.forEachChild(iQ,(e,n)=>{t.push(new iF(e,n))}):e.writeTree_.children.inorderTraversal((e,n)=>{null!=n.value&&t.push(new iF(e,n.value))}),t}function rM(e,t){if(ix(t))return e;{let n=rR(e,t);return new rk(null!=n?new rx(n):e.writeTree_.subtree(t))}}function rL(e){return e.writeTree_.isEmpty()}function rF(e,t){return function e(t,n,i){if(null!=n.value)return i.updateChild(t,n.value);{let r=null;return n.children.inorderTraversal((n,s)=>{".priority"===n?(e7(null!==s.value,"Priority writes must always be leaf nodes"),r=s.value):i=e(iI(t,n),s,i)}),i.getChild(t).isEmpty()||null===r||(i=i.updateChild(iI(t,".priority"),r)),i}}(iv(),e.writeTree_,t)}function rj(e){return e.visible}
173function rV(e,t,n){let i=rk.empty();for(let r=0;r<e.length;++r){let s=e[r];if(t(s)){let e,t=s.path;if(s.snap)iP(n,t)?i=rN(i,e=ik(n,t),s.snap):iP(t,n)&&(e=ik(t,n),i=rN(i,iv(),s.snap.getChild(e)));else if(s.children){if(iP(n,t))i=rA(i,e=ik(n,t),s.children);else if(iP(t,n))if(ix(e=ik(t,n)))i=rA(i,iv(),s.children);else{let t=tT(s.children,iw(e));if(t){let n=t.getChild(iC(e));i=rN(i,iv(),n)}}}else throw e9("WriteRecord should have .snap or .children")}}return i}function rU(e,t,n,i,r){if(i||r){let s=rM(e.visibleWrites,t);return!r&&rL(s)?n:r||null!=n||rD(s,iv())?rF(rV(e.allWrites,function(e){return(e.visible||r)&&(!i||!~i.indexOf(e.writeId))&&(iP(e.path,t)||iP(t,e.path))},t),n||i1.EMPTY_NODE):null}{let i=rR(e.visibleWrites,t);if(null!=i)return i;{let i=rM(e.visibleWrites,t);return rL(i)?n:null!=n||rD(i,iv())?rF(i,n||i1.EMPTY_NODE):null}}}function rB(e,t,n,i){return rU(e.writeTree,e.treePath,t,n,i)}function rq(e,t){return function(e,t,n){let i=i1.EMPTY_NODE,r=rR(e.visibleWrites,t);if(r)return r.isLeafNode()||r.forEachChild(iQ,(e,t)=>{i=i.updateImmediateChild(e,t)}),i;
173if(!n)return rO(rM(e.visibleWrites,t)).forEach(e=>{i=i.updateImmediateChild(e.name,e.node)}),i;{let r=rM(e.visibleWrites,t);return n.forEachChild(iQ,(e,t)=>{let n=rF(rM(r,new i_(e)),t);i=i.updateImmediateChild(e,n)}),rO(r).forEach(e=>{i=i.updateImmediateChild(e.name,e.node)}),i}}(e.writeTree,e.treePath,t)}function r$(e,t,n,i){return function(e,t,n,i,r){e7(i||r,"Either existingEventSnap or existingServerSnap must exist");let s=iI(t,n);if(rD(e.visibleWrites,s))return null;{let t=rM(e.visibleWrites,s);return rL(t)?r.getChild(n):rF(t,r.getChild(n))}}(e.writeTree,e.treePath,t,n,i)}function rH(e,t){var n,i;return n=e.writeTree,i=iI(e.treePath,t),rR(n.visibleWrites,i)}function rz(e,t,n){var i,r;let s,o;return i=e.writeTree,r=e.treePath,s=iI(r,t),null!=(o=rR(i.visibleWrites,s))?o:n.isCompleteForChild(t)?rF(rM(i.visibleWrites,s),n.getNode().getImmediateChild(t)):null}function rW(e,t){return rK(iI(e.treePath,t),e.writeTree)}function rK(e,t){return{treePath:e,writeTree:t}}class rG{constructor(){this.changeMap=new Map}trackChildChange(e){let t=e.type,n=e.childName;e7("child_added"===t||"child_changed"===t||"child_removed"===t,"Only child changes supported for tracking"),e7(".priority"!==n,"Only non-priority child changes can be tracked.");let i=this.changeMap.get(n);if(i){let r=i.type;if("child_added"===t&&"child_removed"===r)this.changeMap.set(n,i9(n,e.snapshotNode,i.snapshotNode));else if("child_removed"===t&&"child_added"===r)this.changeMap.delete(n);else if("child_removed"===t&&"child_changed"===r)this.changeMap.set(n,i7(n,i.oldSnap));else if("child_changed"===t&&"child_added"===r)this.changeMap.set(n,i8(n,e.snapshotNode));else if("child_changed"===t&&"child_changed"===r)this.changeMap.set(n,i9(n,e.snapshotNode,i.oldSnap));else throw e9("Illegal combination of changes: "+e+" occurred after "+i)}else this.changeMap.set(n,e)}getChanges(){return Array.from(this.changeMap.values())}}let rQ=new class{getCompleteChild(e){return null}getChildAfterChild(e,t,n){return null}};class rY{constructor(e,t,n=null){this.writes_=e,this.viewCache_=t,this.optCompleteServerCache_=n}getCompleteChild(e){let t=this.viewCache_.eventCache;if(t.isCompleteForChild(e))return t.getNode().getImmediateChild(e);{let t=null!=this.optCompleteServerCache_?new rv(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return rz(this.writes_,e,t)}}getChildAfterChild(e,t,n){var i;let r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:rI(this.viewCache_),s=(i=this.writes_,function(e,t,n,i,r,s){let o,a=rM(e.visibleWrites,t),l=rR(a,iv());if(null!=l)o=l;else{if(null==n)return[];o=rF(a,n)}if((o=o.withIndex(s)).isEmpty()||o.isLeafNode())return[];{let e=[],t=s.getCompare(),n=r?o.getReverseIteratorFrom(i,s):o.getIteratorFrom(i,s),a=n.getNext();for(;a&&e.length<1;)0!==t(a,i)&&e.push(a),a=n.getNext();return e}}(i.writeTree,i.treePath,r,t,n,e));return 0===s.length?null:s[0]}}function rX(e,t,n,i,r,s){let o=t.eventCache;if(null!=rH(i,n))return t;{let a,l;if(ix(n))if(e7(t.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),t.serverCache.isFiltered()){let n=rI(t),r=rq(i,n instanceof i1?n:i1.EMPTY_NODE);a=e.filter.updateFullNode(t.eventCache.getNode(),r,s)}else{let n=rB(i,rI(t));a=e.filter.updateFullNode(t.eventCache.getNode(),n,s)}else{let h=iw(n);if(".priority"===h){e7(1===ib(n),"Can't have a priority with additional path components");let r=o.getNode(),s=r$(i,n,r,l=t.serverCache.getNode());a=null!=s?e.filter.updatePriority(r,s):o.getNode()}else{let u,c=iC(n);if(o.isCompleteForChild(h)){l=t.serverCache.getNode();let e=r$(i,n,o.getNode(),l);u=null!=e?o.getNode().getImmediateChild(h).updateChild(c,e):o.getNode().getImmediateChild(h)}else u=rz(i,h,t.serverCache);a=null!=u?e.filter.updateChild(o.getNode(),h,u,c,r,s):o.getNode()}}return rE(t,a,o.isFullyInitialized()||ix(n),e.filter.filtersNodes())}}function rJ(e,t,n,i,r,s,o,a){let l,h=t.serverCache,u=o?e.filter:e.filter.getIndexedFilter();if(ix(n))l=u.updateFullNode(h.getNode(),i,null);else if(u.filtersNodes()&&!h.isFiltered()){let e=h.getNode().updateChild(n,i);l=u.updateFullNode(h.getNode(),e,null)}else{let e=iw(n);if(!h.isCompleteForPath(n)&&ib(n)>1)return t;let r=iC(n),s=h.getNode().getImmediateChild(e).updateChild(r,i);l=".priority"===e?u.updatePriority(h.getNode(),s):u.updateChild(h.getNode(),e,s,r,rQ,null)}let c=rT(t,l,h.isFullyInitialized()||ix(n),u.filtersNodes()),d=new rY(r,c,s);return rX(e,c,n,r,d,a)}function rZ(e,t,n,i,r,s,o){let a,l,h=t.eventCache,u=new rY(r,t,s);if(ix(n))l=e.filter.updateFullNode(t.eventCache.getNode(),i,o),a=rE(t,l,!0,e.filter.filtersNodes());else{let r=iw(n);if(".priority"===r)l=e.filter.updatePriority(t.eventCache.getNode(),i),a=rE(t,l,h.isFullyInitialized(),h.isFiltered());else{let s,l=iC(n),c=h.getNode().getImmediateChild(r);if(ix(l))s=i;else{let e=u.getCompleteChild(r);s=null!=e?".priority"===iE(l)&&e.getChild(iS(l)).isEmpty()?e:e.updateChild(l,i):i1.EMPTY_NODE}a=c.equals(s)?t:rE(t,e.filter.updateChild(h.getNode(),r,s,l,u,o),h.isFullyInitialized(),e.filter.filtersNodes())}}return a}function r0(e,t){return e.eventCache.isCompleteForChild(t)}
173function r1(e,t,n){return n.foreach((e,n)=>{t=t.updateChild(e,n)}),t}function r2(e,t,n,i,r,s,o,a){let l;if(t.serverCache.getNode().isEmpty()&&!t.serverCache.isFullyInitialized())return t;let h=t;l=ix(n)?i:new rx(null).setTree(n,i);let u=t.serverCache.getNode();return l.children.inorderTraversal((n,i)=>{if(u.hasChild(n)){let l=r1(e,t.serverCache.getNode().getImmediateChild(n),i);h=rJ(e,h,new i_(n),l,r,s,o,a)}}),l.children.inorderTraversal((n,i)=>{let l=!t.serverCache.isCompleteForChild(n)&&null===i.value;if(!u.hasChild(n)&&!l){let l=r1(e,t.serverCache.getNode().getImmediateChild(n),i);h=rJ(e,h,new i_(n),l,r,s,o,a)}}),h}class r5{constructor(e,t){this.query_=e,this.eventRegistrations_=[];const n=this.query_._queryParams,i=new re(n.getIndex()),r=function(e){return e.loadsAllData()?new re(e.getIndex()):e.hasLimit()?new rn(e):new rt(e)}(n);this.processor_=function(e){return{filter:e}}(r);const s=t.serverCache,o=t.eventCache,a=i.updateFullNode(i1.EMPTY_NODE,s.getNode(),null),l=r.updateFullNode(i1.EMPTY_NODE,o.getNode(),null),h=new rv(a,s.isFullyInitialized(),i.filtersNodes()),u=new rv(l,o.isFullyInitialized(),r.filtersNodes());this.viewCache_=rC(u,h),this.eventGenerator_=new rw(this.query_)}get query(){return this.query_}}function r3(e){return 0===e.eventRegistrations_.length}function r4(e,t,n){let i=[];if(n){e7(null==t,"A cancel should cancel all event registrations.");let r=e.query._path;e.eventRegistrations_.forEach(e=>{let t=e.createCancelEvent(n,r);t&&i.push(t)})}if(t){let n=[];for(let i=0;i<e.eventRegistrations_.length;++i){let r=e.eventRegistrations_[i];if(r.matches(t)){if(t.hasAnyCallback()){n=n.concat(e.eventRegistrations_.slice(i+1));break}}else n.push(r)}e.eventRegistrations_=n}else e.eventRegistrations_=[];return i}function r6(e,t,n,i){var r,s;t.type===x.MERGE&&null!==t.source.queryId&&(e7(rI(e.viewCache_),"We should always have a full cache before handling merges"),e7(rS(e.viewCache_),"Missing event cache, even though we have a server cache"));let o=e.viewCache_,a=function(e,t,n,i,r){var s,o,a,l,h,u,c,d,f,p,g,m;let y,_,v=new rG;if(n.type===x.OVERWRITE)n.source.fromUser?y=rZ(e,t,n.path,n.snap,i,r,v):(e7(n.source.fromServer,"Unknown source."),_=n.source.tagged||t.serverCache.isFiltered()&&!ix(n.path),y=rJ(e,t,n.path,n.snap,i,r,_,v));else if(n.type===x.MERGE){let d;n.source.fromUser?(s=e,o=t,a=n.path,l=n.children,h=i,u=r,c=v,d=o,l.foreach((e,t)=>{let n=iI(a,e);r0(o,iw(n))&&(d=rZ(s,d,n,t,h,u,c))}),l.foreach((e,t)=>{let n=iI(a,e);r0(o,iw(n))||(d=rZ(s,d,n,t,h,u,c))}),y=d):(e7(n.source.fromServer,"Unknown source."),_=n.source.tagged||t.serverCache.isFiltered(),y=r2(e,t,n.path,n.children,i,r,_,v))}else if(n.type===x.ACK_USER_WRITE)y=n.revert?function(e,t,n,i,r,s){let o;if(null!=rH(i,n))return t;{let a,l=new rY(i,t,r),h=t.eventCache.getNode();if(ix(n)||".priority"===iw(n)){let n;if(t.serverCache.isFullyInitialized())n=rB(i,rI(t));else{let e=t.serverCache.getNode();e7(e instanceof i1,"serverChildren would be complete if leaf node"),n=rq(i,e)}a=e.filter.updateFullNode(h,n,s)}else{let r=iw(n),u=rz(i,r,t.serverCache);null==u&&t.serverCache.isCompleteForChild(r)&&(u=h.getImmediateChild(r)),(a=null!=u?e.filter.updateChild(h,r,u,iC(n),l,s):t.eventCache.getNode().hasChild(r)?e.filter.updateChild(h,r,i1.EMPTY_NODE,iC(n),l,s):h).isEmpty()&&t.serverCache.isFullyInitialized()&&(o=rB(i,rI(t))).isLeafNode()&&(a=e.filter.updateFullNode(a,o,s))}return o=t.serverCache.isFullyInitialized()||null!=rH(i,iv()),rE(t,a,o,e.filter.filtersNodes())}}(e,t,n.path,i,r,v):function(e,t,n,i,r,s,o){if(null!=rH(r,n))return t;let a=t.serverCache.isFiltered(),l=t.serverCache;if(null!=i.value)if(ix(n)&&l.isFullyInitialized()||l.isCompleteForPath(n))return rJ(e,t,n,l.getNode().getChild(n),r,s,a,o);else{if(!ix(n))return t;let i=new rx(null);return l.getNode().forEachChild(iU,(e,t)=>{i=i.set(new i_(e),t)}),r2(e,t,n,i,r,s,a,o)}{let h=new rx(null);return i.foreach((e,t)=>{let i=iI(n,e);l.isCompleteForPath(i)&&(h=h.set(e,l.getNode().getChild(i)))}),r2(e,t,n,h,r,s,a,o)}}(e,t,n.path,n.affectedTree,i,r,v);else if(n.type===x.LISTEN_COMPLETE){let r;d=e,f=t,p=n.path,g=i,m=v,r=f.serverCache,y=rX(d,rT(f,r.getNode(),r.isFullyInitialized()||ix(p),r.isFiltered()),p,g,rQ,m)}else throw e9("Unknown operation type: "+n.type);let w=v.getChanges();return function(e,t,n){let i=t.eventCache;if(i.isFullyInitialized()){let r=i.getNode().isLeafNode()||i.getNode().isEmpty(),s=rS(e);!(n.length>0)&&e.eventCache.isFullyInitialized()&&(!r||i.getNode().equals(s))&&i.getNode().getPriority().equals(s.getPri
173ority())||n.push(i6(rS(t)))}}(t,y,w),{viewCache:y,changes:w}}(e.processor_,o,t,n,i);return r=e.processor_,e7((s=a.viewCache).eventCache.getNode().isIndexed(r.filter.getIndex()),"Event snap not indexed"),e7(s.serverCache.getNode().isIndexed(r.filter.getIndex()),"Server snap not indexed"),e7(a.viewCache.serverCache.isFullyInitialized()||!o.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),e.viewCache_=a.viewCache,r8(e,a.changes,a.viewCache.eventCache.getNode(),null)}function r8(e,t,n,i){var r;let s,o,a=i?[i]:e.eventRegistrations_;return r=e.eventGenerator_,s=[],o=[],t.forEach(e=>{var t;"child_changed"===e.type&&r.index_.indexedValueChanged(e.oldSnap,e.snapshotNode)&&o.push((t=e.childName,{type:"child_moved",snapshotNode:e.snapshotNode,childName:t}))}),rb(r,s,"child_removed",t,a,n),rb(r,s,"child_added",t,a,n),rb(r,s,"child_moved",o,a,n),rb(r,s,"child_changed",t,a,n),rb(r,s,"value",t,a,n),s}class r7{constructor(){this.views=new Map}}function r9(e,t,n,i){let r=t.source.queryId;if(null!==r){let s=e.views.get(r);return e7(null!=s,"SyncTree gave us an op for an invalid query."),r6(s,t,n,i)}{let r=[];for(let s of e.views.values())r=r.concat(r6(s,t,n,i));return r}}function se(e,t,n,i,r){let s=t._queryIdentifier,o=e.views.get(s);if(!o){let e=rB(n,r?i:null),s=!1;return e?s=!0:(e=i instanceof i1?rq(n,i):i1.EMPTY_NODE,s=!1),new r5(t,rC(new rv(e,s,!1),new rv(i,r,!1)))}return o}function st(e){let t=[];for(let n of e.views.values())n.query._queryParams.loadsAllData()||t.push(n);return t}function sn(e,t){let n=null;for(let i of e.views.values())n=n||function(e,t){let n=rI(e.viewCache_);return n&&(e.query._queryParams.loadsAllData()||!ix(t)&&!n.getImmediateChild(iw(t)).isEmpty())?n.getChild(t):null}(i,t);return n}function si(e,t){if(t._queryParams.loadsAllData())return ss(e);{let n=t._queryIdentifier;return e.views.get(n)}}function sr(e){return null!=ss(e)}function ss(e){for(let t of e.views.values())if(t.query._queryParams.loadsAllData())return t;return null}let so=1;class sa{constructor(e){this.listenProvider_=e,this.syncPointTree_=new rx(null),this.pendingWriteTree_={visibleWrites:rk.empty(),allWrites:[],lastWriteId:-1},this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function sl(e,t,n,i,r){var s,o;return(s=e.pendingWriteTree_,o=r,e7(i>s.lastWriteId,"Stacking an older write on top of newer ones"),void 0===o&&(o=!0),s.allWrites.push({path:t,snap:n,writeId:i,visible:o}),o&&(s.visibleWrites=rN(s.visibleWrites,t,n)),s.lastWriteId=i,r)?sp(e,new ry(rd(),t,n)):[]}function sh(e,t,n=!1){let i=function(e,t){for(let n=0;n<e.allWrites.length;n++){let i=e.allWrites[n];if(i.writeId===t)return i}return null}(e.pendingWriteTree_,t);if(!function(e,t){var n;let i=e.allWrites.findIndex(e=>e.writeId===t);e7(i>=0,"removeWrite called with nonexistent writeId.");let r=e.allWrites[i];e.allWrites.splice(i,1);let s=r.visible,o=!1,a=e.allWrites.length-1;for(;s&&a>=0;){let t=e.allWrites[a];t.visible&&(a>=i&&function(e,t){if(e.snap)return iP(e.path,t);for(let n in e.children)if(e.children.hasOwnProperty(n)&&iP(iI(e.path,n),t))return!0;return!1}(t,r.path)?s=!1:iP(r.path,t.path)&&(o=!0)),a--}return!!s&&(o?((n=e).visibleWrites=rV(n.allWrites,rj,iv()),n.allWrites.length>0?n.lastWriteId=n.allWrites[n.allWrites.length-1].writeId:n.lastWriteId=-1):r.snap?e.visibleWrites=rP(e.visibleWrites,r.path):nX(r.children,t=>{e.visibleWrites=rP(e.visibleWrites,iI(r.path,t))}),!0)}(e.pendingWriteTree_,t))return[];{let t=new rx(null);return null!=i.snap?t=t.set(iv(),!0):nX(i.children,e=>{t=t.set(new i_(e),!0)}),sp(e,new rg(i.path,t,n))}}function su(e,t,n){return sp(e,new ry(rf(),t,n))}function sc(e,t,n,i,r=!1){let s=t._path,o=e.syncPointTree_.get(s),a=[];if(o&&("default"===t._queryIdentifier||null!=si(o,t))){let u=function(e,t,n,i){let r=t._queryIdentifier,s=[],o=[],a=sr(e);
173if("default"===r)for(let[t,r]of e.views.entries())o=o.concat(r4(r,n,i)),r3(r)&&(e.views.delete(t),r.query._queryParams.loadsAllData()||s.push(r.query));else{let t=e.views.get(r);t&&(o=o.concat(r4(t,n,i)),r3(t)&&(e.views.delete(r),t.query._queryParams.loadsAllData()||s.push(t.query)))}return a&&!sr(e)&&s.push(new(e7(c,"Reference.ts has not been loaded"),c)(t._repo,t._path)),{removed:s,events:o}}(o,t,n,i);0===o.views.size&&(e.syncPointTree_=e.syncPointTree_.remove(s));let d=u.removed;if(a=u.events,!r){let n=-1!==d.findIndex(e=>e._queryParams.loadsAllData()),r=e.syncPointTree_.findOnPath(s,(e,t)=>sr(t));if(n&&!r){let t=e.syncPointTree_.subtree(s);if(!t.isEmpty()){let n=t.fold((e,t,n)=>{if(t&&sr(t))return[ss(t)];{let e=[];return t&&(e=st(t)),nX(n,(t,n)=>{e=e.concat(n)}),e}});for(let t=0;t<n.length;++t){let i=n[t],r=i.query,s=sg(e,i);e.listenProvider_.startListening(sb(r),sm(e,r),s.hashFn,s.onComplete)}}}r||!(d.length>0)||i||(n?e.listenProvider_.stopListening(sb(t),null):d.forEach(t=>{let n=e.queryToTagMap.get(sy(t));e.listenProvider_.stopListening(sb(t),n)}))}var l=e,h=d;for(let e=0;e<h.length;++e){let t=h[e];if(!t._queryParams.loadsAllData()){let e=sy(t),n=l.queryToTagMap.get(e);l.queryToTagMap.delete(e),l.tagToQueryMap.delete(n)}}}return a}function sd(e,t,n,i){let r=s_(e,i);if(null==r)return[];{let i=sv(r),s=i.path,o=i.queryId,a=ik(s,t);return sw(e,s,new ry(rp(o),a,n))}}function sf(e,t,n){let i=e.pendingWriteTree_,r=e.syncPointTree_.findOnPath(t,(e,n)=>{let i=sn(n,ik(e,t));if(i)return i});return rU(i,t,r,n,!0)}function sp(e,t){var n;return function e(t,n,i,r){if(ix(t.path))return function e(t,n,i,r){let s=n.get(iv());null==i&&null!=s&&(i=sn(s,iv()));let o=[];return n.children.inorderTraversal((n,s)=>{let a=i?i.getImmediateChild(n):null,l=rW(r,n),h=t.operationForChild(n);h&&(o=o.concat(e(h,s,a,l)))}),s&&(o=o.concat(r9(s,t,r,i))),o}(t,n,i,r);{let s=n.get(iv());null==i&&null!=s&&(i=sn(s,iv()));let o=[],a=iw(t.path),l=t.operationForChild(a),h=n.children.get(a);if(h&&l){let t=i?i.getImmediateChild(a):null,n=rW(r,a);o=o.concat(e(l,h,t,n))}return s&&(o=o.concat(r9(s,t,r,i))),o}}(t,e.syncPointTree_,null,(n=e.pendingWriteTree_,rK(iv(),n)))}function sg(e,t){let n=t.query,i=sm(e,n);return{hashFn:()=>(t.viewCache_.serverCache.getNode()||i1.EMPTY_NODE).hash(),onComplete:t=>{var r;if("ok"===t)if(i)return function(e,t,n){let i=s_(e,n);if(!i)return[];{let n=sv(i),r=n.path,s=n.queryId,o=ik(r,t);return sw(e,r,new rm(rp(s),o))}}(e,n._path,i);else return r=n._path,sp(e,new rm(rf(),r));{let i,r,s=(i="Unknown Error","too_big"===t?i="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"===t?i="Client doesn't have permission to access the desired data.":"unavailable"===t&&(i="The service is unavailable"),(r=Error(t+" at "+n._path.toString()+": "+i)).code=t.toUpperCase(),r);return sc(e,n,null,s)}}}}function sm(e,t){let n=sy(t);return e.queryToTagMap.get(n)}function sy(e){return e._path.toString()+"$"+e._queryIdentifier}function s_(e,t){return e.tagToQueryMap.get(t)}function sv(e){let t=e.indexOf("$");return e7(-1!==t&&t<e.length-1,"Bad queryKey."),{queryId:e.substr(t+1),path:new i_(e.substr(0,t))}}function sw(e,t,n){let i=e.syncPointTree_.get(t);return e7(i,"Missing sync point for query tag that we're tracking"),r9(i,n,rK(t,e.pendingWriteTree_),null)}
173function sb(e){return e._queryParams.loadsAllData()&&!e._queryParams.isDefault()?new(e7(d,"Reference.ts has not been loaded"),d)(e._repo,e._path):e}class sC{constructor(e){this.node_=e}getImmediateChild(e){return new sC(this.node_.getImmediateChild(e))}node(){return this.node_}}class sE{constructor(e,t){this.syncTree_=e,this.path_=t}getImmediateChild(e){let t=iI(this.path_,e);return new sE(this.syncTree_,t)}node(){return sf(this.syncTree_,this.path_)}}let sT=function(e,t,n){return e&&"object"==typeof e?(e7(".sv"in e,"Unexpected leaf node or priority contents"),"string"==typeof e[".sv"])?sS(e[".sv"],t,n):"object"==typeof e[".sv"]?sI(e[".sv"],t):void e7(!1,"Unexpected server value: "+JSON.stringify(e,null,2)):e},sS=function(e,t,n){if("timestamp"===e)return n.timestamp;e7(!1,"Unexpected server value: "+e)},sI=function(e,t,n){e.hasOwnProperty("increment")||e7(!1,"Unexpected server value: "+JSON.stringify(e,null,2));let i=e.increment;"number"!=typeof i&&e7(!1,"Unexpected increment value: "+i);let r=t.node();if(e7(null!=r,"Expected ChildrenNode.EMPTY_NODE for nulls"),!r.isLeafNode())return i;let s=r.getValue();return"number"!=typeof s?i:s+i},sx=function(e,t,n,i){return sN(t,new sE(n,e),i)},sk=function(e,t,n){return sN(e,new sC(t),n)};function sN(e,t,n){let i,r=sT(e.getPriority().val(),t.getImmediateChild(".priority"),n);if(!e.isLeafNode())return i=e,r!==e.getPriority().val()&&(i=i.updatePriority(new iG(r))),e.forEachChild(iQ,(e,r)=>{let s=sN(r,t.getImmediateChild(e),n);s!==r&&(i=i.updateImmediateChild(e,s))}),i;{let i=sT(e.getValue(),t,n);return i!==e.getValue()||r!==e.getPriority().val()?new iG(i,i5(r)):e}}class sA{constructor(e="",t=null,n={children:{},childCount:0}){this.name=e,this.parent=t,this.node=n}}function sP(e,t){let n=t instanceof i_?t:new i_(t),i=e,r=iw(n);for(;null!==r;){let e=tT(i.node.children,r)||{children:{},childCount:0};i=new sA(r,i,e),r=iw(n=iC(n))}return i}function sD(e){return e.node.value}function sR(e,t){e.node.value=t,function e(t){null!==t.parent&&function(t,n,i){let r=void 0===sD(i)&&!sO(i),s=tE(t.node.children,n);r&&s?(delete t.node.children[n],t.node.childCount--,e(t)):r||s||(t.node.children[n]=i.node,t.node.childCount++,e(t))}(t.parent,t.name,t)}(e)}function sO(e){return e.node.childCount>0}function sM(e,t){nX(e.node.children,(n,i)=>{t(new sA(n,e,i))})}function sL(e){return new i_(null===e.parent?e.name:sL(e.parent)+"/"+e.name)}let sF=/[\[\].#$\/\u0000-\u001F\u007F]/,sj=/[\[\].#$\u0000-\u001F\u007F]/,sV=function(e){return"string"==typeof e&&0!==e.length&&!sF.test(e)},sU=function(e){return"string"==typeof e&&0!==e.length&&!sj.test(e)},sB=function(e,t,n,i){i&&void 0===t||sq(tA(e,"value"),t,n)},sq=function(e,t,n){let i=n instanceof i_?new iD(n,e):n;if(void 0===t)throw Error(e+"contains undefined "+iO(i));if("function"==typeof t)throw Error(e+"contains a function "+iO(i)+" with contents = "+t.toString());if(nq(t))throw Error(e+"contains "+t.toString()+" "+iO(i));if("string"==typeof t&&t.length>3495253.3333333335&&tD(t)>0xa00000)throw Error(e+"contains a string greater than 10485760 utf8 bytes "+iO(i)+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){let n=!1,r=!1;if(nX(t,(t,s)=>{let o;if(".value"===t)n=!0;else if(".priority"!==t&&".sv"!==t&&(r=!0,!sV(t)))throw Error(e+" contains an invalid key ("+t+") "+iO(i)+'.  Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');i.parts_.length>0&&(i.byteLength_+=1),i.parts_.push(t),i.byteLength_+=tD(t),iR(i),sq(e,s,i),o=i.parts_.pop(),i.byteLength_-=tD(o),i.parts_.length>0&&(i.byteLength_-=1)}),n&&r)throw Error(e+' contains ".value" child '+iO(i)+" in addition to actual children.")}},s$=function(e,t){let n,i;for(n=0;n<t.length;n++){let r=iT(i=t[n]);for(let t=0;t<r.length;t++)if(".priority"===r[t]&&t===r.length-1);else if(!sV(r[t]))throw Error(e+"contains an invalid key ("+r[t]+") in path "+i.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"')}t.sort(iN);let r=null;for(n=0;n<t.length;n++){if(i=t[n],null!==r&&iP(r,i))throw Error(e+"contains a path "+r.toString()+" that is ancestor of another path "+i.toString());r=i}},sH=function(e,t,n,i){if(i&&void 0===t)return;let r=tA(e,"values");if(!(t&&"object"==typeof t)||Array.isArray(t))throw Error(r+" must be an object c
173ontaining the children to replace.");let s=[];nX(t,(e,t)=>{let i=new i_(e);if(sq(r,t,iI(n,i)),".priority"===iE(i)&&!(null===t||"string"==typeof t||"number"==typeof t&&!nq(t)||t&&"object"==typeof t&&tE(t,".sv")))throw Error(r+"contains an invalid value for '"+i.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");s.push(i)}),s$(r,s)},sz=function(e,t,n,i){if((!i||void 0!==n)&&!sU(n))throw Error(tA(e,t)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},sW=function(e,t,n,i){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),sz(e,t,n,i)},sK=function(e,t){if(".info"===iw(t))throw Error(e+" failed = Can't modify data under /.info/")},sG=function(e,t){var n;let i=t.path.toString();if("string"!=typeof t.repoInfo.host||0===t.repoInfo.host.length||!sV(t.repoInfo.namespace)&&"localhost"!==t.repoInfo.host.split(":")[0]||0!==i.length&&((n=i)&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),!sU(n)))throw Error(tA(e,"url")+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')};class sQ{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function sY(e,t){let n=null;for(let i=0;i<t.length;i++){let r=t[i],s=r.getPath();null===n||iA(s,n.path)||(e.eventLists_.push(n),n=null),null===n&&(n={events:[],path:s}),n.events.push(r)}n&&e.eventLists_.push(n)}function sX(e,t,n){sY(e,n),function(e,t){e.recursionDepth_++;let n=!0;for(let i=0;i<e.eventLists_.length;i++){let r=e.eventLists_[i];r&&(t(r.path)?(function(e){for(let t=0;t<e.events.length;t++){let n=e.events[t];if(null!==n){e.events[t]=null;let i=n.getEventRunner();nR&&nL("event: "+n.toString()),n1(i)}}}(e.eventLists_[i]),e.eventLists_[i]=null):n=!1)}n&&(e.eventLists_=[]),e.recursionDepth_--}(e,e=>iP(e,t)||iP(t,e))}class sJ{constructor(e,t,n,i){this.repoInfo_=e,this.forceRestClient_=t,this.authTokenProvider_=n,this.appCheckProvider_=i,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new sQ,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=rl(),this.transactionQueueTree_=new sA,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function sZ(e){var t;let n;return(t=t={timestamp:(n=e.infoData_.getNode(new i_(".info/serverTimeOffset")).val()||0,new Date().getTime()+n)}).timestamp=t.timestamp||new Date().getTime(),t}function s0(e,t,n,i,r){e.dataUpdateCount++;let s=new i_(t);n=e.interceptServerDataCallback_?e.interceptServerDataCallback_(t,n):n;let o=[];if(r)if(i){let t=tI(n,e=>i5(e));o=function(e,t,n,i){let r=s_(e,i);if(!r)return[];{let i=sv(r),s=i.path,o=i.queryId,a=ik(s,t),l=rx.fromObject(n);return sw(e,s,new r_(rp(o),a,l))}}(e.serverSyncTree_,s,t,r)}else{let t=i5(n);o=sd(e.serverSyncTree_,s,t,r)}else if(i){var a;let t,i=tI(n,e=>i5(e));a=e.serverSyncTree_,t=rx.fromObject(i),o=sp(a,new r_(rf(),s,t))}else{let t=i5(n);o=su(e.serverSyncTree_,s,t)}let l=s;o.length>0&&(l=s8(e,s)),sX(e.eventQueue_,l,o)}function s1(e,t){var n;let i,r,s;s2(e,"connected",t),!1===t&&(s3(n=e,"onDisconnectEvents"),i=sZ(n),r=rl(),rh(n.onDisconnect_,iv(),(e,t)=>{let s=sx(e,t,n.serverSyncTree_,i);!function e(t,n,i){if(ix(n))t.value=i,t.children.clear();else if(null!==t.value)t.value=t.value.updateChild(n,i);else{let r=iw(n);t.children.has(r)||t.children.set(r,rl()),e(t.children.get(r),n=iC(n),i)}}(r,e,s)}),s=[],rh(r,iv(),(e,t)=>{s=s.concat(su(n.serverSyncTree_,e,t));let i=ot(n,e);s8(n,i)}),n.onDisconnect_=rl(),sX(n.eventQueue_,iv(),s))}function s2(e,t,n){let i=new i_("/.info/"+t),r=i5(n);e.infoData_.updateSnapshot(i,r);let s=su(e.infoSyncTree_,i,r);sX(e.eventQueue_,i,s)}function s5(e){return e.nextWriteId_++}function s3(e,...t){let n="";e.persistentConnection_&&(n=e.persistentConnection_.id+":"),nL(n,...t)}function s4(e,t,n,i){t&&n1(()=>{if("ok"===n)t(null);else{let e=(n||"error").toUpperCase(),r=e;i&&(r+=": "+i);let s=Error(r);s.code=e,t(s)}})}function s6(e,t,n){return sf(e.serverSyncTree_,t,n)||i1.EMPTY_NODE}function s8(e,t){let n=s7(e,t),i=sL(n),r=s9(e,n);return function(e,t,n){if(0===t.length)return;let i=[],r=[],s=t.filter(e=>0===e.status).map(e=>e.currentWriteId);for(let o=0;o<t.length;o++){let a=t[o],l=ik(n,a.path),h=!1,u;if(e7(null!==l,"rerunTransactionsUnderNode_: relativePath should not be null."),4===a.status)h=!0,u=a.abortReason,r=r.concat(sh(e.serverSyncTree_,a.currentWriteId,!0));else if(0===a.status)if(a.retryCount>=25)h=!0,u="maxretry",r=r.concat(sh(e.serverSyncTree_,a.currentWriteId,!0));else{let n=s6(e,a.path,s);a.currentInputSnapshot=n;let i=t[o].update(n.val());if(void 0!==i){sq("transaction failed: Data returned ",i,a.path);let t=i5(i);"object"==typeof i&&null!=i&&tE(i,".priority")||(t=t.updatePriority(n.getPri
173ority()));let o=a.currentWriteId,l=sk(t,n,sZ(e));a.currentOutputSnapshotRaw=t,a.currentOutputSnapshotResolved=l,a.currentWriteId=s5(e),s.splice(s.indexOf(o),1),r=(r=r.concat(sl(e.serverSyncTree_,a.path,l,a.currentWriteId,a.applyLocally))).concat(sh(e.serverSyncTree_,o,!0))}else h=!0,u="nodata",r=r.concat(sh(e.serverSyncTree_,a.currentWriteId,!0))}sX(e.eventQueue_,n,r),r=[],h&&(t[o].status=2,setTimeout(t[o].unwatcher,Math.floor(0)),t[o].onComplete&&("nodata"===u?i.push(()=>t[o].onComplete(null,!1,t[o].currentInputSnapshot)):i.push(()=>t[o].onComplete(Error(u),!1,null))))}oe(e,e.transactionQueueTree_);for(let e=0;e<i.length;e++)n1(i[e]);!function e(t,n=t.transactionQueueTree_){if(n||oe(t,n),sD(n)){let i=s9(t,n);e7(i.length>0,"Sending zero length transaction queue"),i.every(e=>0===e.status)&&function(t,n,i){let r=s6(t,n,i.map(e=>e.currentWriteId)),s=r,o=r.hash();for(let e=0;e<i.length;e++){let t=i[e];e7(0===t.status,"tryToSendTransactionQueue_: items in queue should all be run."),t.status=1,t.retryCount++;let r=ik(n,t.path);s=s.updateChild(r,t.currentOutputSnapshotRaw)}let a=s.val(!0);t.server_.put(n.toString(),a,r=>{s3(t,"transaction put response",{path:n.toString(),status:r});let s=[];if("ok"===r){let r=[];for(let e=0;e<i.length;e++)i[e].status=2,s=s.concat(sh(t.serverSyncTree_,i[e].currentWriteId)),i[e].onComplete&&r.push(()=>i[e].onComplete(null,!0,i[e].currentOutputSnapshotResolved)),i[e].unwatcher();oe(t,sP(t.transactionQueueTree_,n)),e(t,t.transactionQueueTree_),sX(t.eventQueue_,n,s);for(let e=0;e<r.length;e++)n1(r[e])}else{if("datastale"===r)for(let e=0;e<i.length;e++)3===i[e].status?i[e].status=4:i[e].status=0;else{nU("transaction at "+n.toString()+" failed: "+r);for(let e=0;e<i.length;e++)i[e].status=4,i[e].abortReason=r}s8(t,n)}},o)}(t,sL(n),i)}else sO(n)&&sM(n,n=>{e(t,n)})}(e,e.transactionQueueTree_)}(e,r,i),i}function s7(e,t){let n,i=e.transactionQueueTree_;for(n=iw(t);null!==n&&void 0===sD(i);)i=sP(i,n),n=iw(t=iC(t));return i}function s9(e,t){let n=[];return function e(t,n,i){let r=sD(n);if(r)for(let e=0;e<r.length;e++)i.push(r[e]);sM(n,n=>{e(t,n,i)})}(e,t,n),n.sort((e,t)=>e.order-t.order),n}function oe(e,t){let n=sD(t);if(n){let e=0;for(let t=0;t<n.length;t++)2!==n[t].status&&(n[e]=n[t],e++);n.length=e,sR(t,n.length>0?n:void 0)}sM(t,t=>{oe(e,t)})}function ot(e,t){let n=sL(s7(e,t)),i=sP(e.transactionQueueTree_,t);return!function(e,t){let n=e.parent;for(;null!==n;){if(t(n))return!0;n=n.parent}}(i,t=>{on(e,t)}),on(e,i),!function e(t,n,i,r){i&&!r&&n(t),sM(t,t=>{e(t,n,!0,r)}),i&&r&&n(t)}(i,t=>{on(e,t)}),n}function on(e,t){let n=sD(t);if(n){let i=[],r=[],s=-1;for(let t=0;t<n.length;t++)3===n[t].status||(1===n[t].status?(e7(s===t-1,"All SENT items should be at beginning of queue."),s=t,n[t].status=3,n[t].abortReason="set"):(e7(0===n[t].status,"Unexpected transaction status in abort"),n[t].unwatcher(),r=r.concat(sh(e.serverSyncTree_,n[t].currentWriteId,!0)),n[t].onComplete&&i.push(n[t].onComplete.bind(null,Error("set"),!1,null))));-1===s?sR(t,void 0):n.length=s+1,sX(e.eventQueue_,sL(t),r);for(let e=0;e<i.length;e++)n1(i[e])}}let oi=function(e,t){let n=or(e),i=n.namespace;"firebase.com"===n.domain&&nV(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),i&&"undefined"!==i||"localhost"===n.domain||nV("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||nB();let r="ws"===n.scheme||"wss"===n.scheme;return{repoInfo:new n9(n.host,n.secure,i,r,t,"",i!==n.subdomain),path:new i_(n.pathString)}},or=function(e){let t="",n="",i="",r="",s="",o=!0,a="https",l=443;if("string"==typeof e){let h=e.indexOf("//");h>=0&&(a=e.substring(0,h-1),e=e.substring(h+2));let u=e.indexOf("/");-1===u&&(u=e.length);let c=e.indexOf("?");-1===c&&(c=e.length),t=e.substring(0,Math.min(u,c)),u<c&&(r=function(e){let t="",n=e.split("/");for(let e=0;e<n.length;e++)if(n[e].length>0){let i=n[e];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(e){}t+="/"+i}return t}(e.substring(u,c)));let d=function(e){let t={};for(let n of("?"===e.charAt(0)&&(e=e.substring(1)),e.split("&"))){if(0===n.length)continue;let i=n.split("=");
1732===i.length?t[decodeURIComponent(i[0])]=decodeURIComponent(i[1]):nU(`Invalid query segment '${n}' in query '${e}'`)}return t}(e.substring(Math.min(e.length,c)));(h=t.indexOf(":"))>=0?(o="https"===a||"wss"===a,l=parseInt(t.substring(h+1),10)):h=t.length;let f=t.slice(0,h);if("localhost"===f.toLowerCase())n="localhost";else if(f.split(".").length<=2)n=f;else{let e=t.indexOf(".");i=t.substring(0,e).toLowerCase(),n=t.substring(e+1),s=i}"ns"in d&&(s=d.ns)}return{host:t,port:l,domain:n,subdomain:i,secure:o,scheme:a,pathString:r,namespace:s}};class os{constructor(e,t,n,i){this.eventType=e,this.eventRegistration=t,this.snapshot=n,this.prevName=i}getPath(){let e=this.snapshot.ref;return"value"===this.eventType?e._path:e.parent._path}getEventType(){return this.eventType}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.getPath().toString()+":"+this.eventType+":"+tv(this.snapshot.exportVal())}}class oo{constructor(e,t,n){this.eventRegistration=e,this.error=t,this.path=n}getPath(){return this.path}getEventType(){return"cancel"}getEventRunner(){return this.eventRegistration.getEventRunner(this)}toString(){return this.path.toString()+":cancel"}}class oa{constructor(e,t){this.snapshotCallback=e,this.cancelCallback=t}onValue(e,t){this.snapshotCallback.call(null,e,t)}onCancel(e){return e7(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,e)}get hasCancelCallback(){return!!this.cancelCallback}matches(e){return this.snapshotCallback===e.snapshotCallback||void 0!==this.snapshotCallback.userCallback&&this.snapshotCallback.userCallback===e.snapshotCallback.userCallback&&this.snapshotCallback.context===e.snapshotCallback.context}}class ol{constructor(e,t,n,i){this._repo=e,this._path=t,this._queryParams=n,this._orderByCalled=i}get key(){return ix(this._path)?null:iE(this._path)}get ref(){return new oh(this._repo,this._path)}get _queryIdentifier(){let e=nQ(rs(this._queryParams));return"{}"===e?"default":e}get _queryObject(){return rs(this._queryParams)}isEqual(e){if(!((e=tR(e))instanceof ol))return!1;let t=this._repo===e._repo,n=iA(this._path,e._path),i=this._queryIdentifier===e._queryIdentifier;return t&&n&&i}toJSON(){return this.toString()}toString(){return this._repo.toString()+function(e){let t="";for(let n=e.pieceNum_;n<e.pieces_.length;n++)""!==e.pieces_[n]&&(t+="/"+encodeURIComponent(String(e.pieces_[n])));return t||"/"}(this._path)}}class oh extends ol{constructor(e,t){super(e,t,new ri,!1)}get parent(){let e=iS(this._path);return null===e?null:new oh(this._repo,e)}get root(){let e=this;for(;null!==e.parent;)e=e.parent;return e}}class ou{constructor(e,t,n){this._node=e,this.ref=t,this._index=n}get priority(){return this._node.getPriority().val()}get key(){return this.ref.key}get size(){return this._node.numChildren()}child(e){let t=new i_(e),n=od(this.ref,e);return new ou(this._node.getChild(t),n,iQ)}exists(){return!this._node.isEmpty()}exportVal(){return this._node.val(!0)}forEach(e){return!this._node.isLeafNode()&&!!this._node.forEachChild(this._index,(t,n)=>e(new ou(n,od(this.ref,t),iQ)))}hasChild(e){let t=new i_(e);return!this._node.getChild(t).isEmpty()}hasChildren(){return!this._node.isLeafNode()&&!this._node.isEmpty()}toJSON(){return this.exportVal()}val(){return this._node.val()}}function oc(e,t){return(e=tR(e))._checkNotDeleted("ref"),void 0!==t?od(e._root,t):e._root}function od(e,t){return null===iw((e=tR(e))._path)?sW("child","path",t,!1):sz("child","path",t,!1),new oh(e._repo,iI(e._path,t))}function of(e){var t,n,i,r,s;let o,a,l,h,u,c,d;e=tR(e);let f=new op(new oa(()=>{}));return(t=e._repo,n=e,i=t.serverSyncTree_,a=(r=n)._path,l=null,i.syncPointTree_.foreachOnPath(a,(e,t)=>{let n=ik(e,a);l=l||sn(t,n)}),(h=i.syncPointTree_.get(a))?l=l||sn(h,iv()):(h=new r7,i.syncPointTree_=i.syncPointTree_.set(a,h)),c=(u=null!=l)?new rv(l,!0,!1):null,d=(s=i.pendingWriteTree_,rK(r._path,s)),null!=(o=rS(se(h,r,d,u?c.getNode():i1.EMPTY_NODE,u).viewCache_))?Promise.resolve(o):t.server_.get(n).then(e=>{let i,r=i5(e).withIndex(n._queryParams.getIndex());if(!function(e,t,n,i=!1){var r;let s,o,a,l,h=t._path,u=null,c=!1;e.syncPointTree_.foreachOnPath(h,(e,t)=>{let n=ik(e,h);u=u||sn(t,n),c=c||sr(t)});let d=e.syncPointTree_.get(h);d?(c=c||sr(d),u=u||sn(d,iv())):(d=new r7,e.syncPointTree_=e.syncPointTree_.set(h,d)),null!=u?s=!0:(s=!1,u=i1.EMPTY_NODE,e.syncPointTree_.subtree(h).foreachChild((e,t)=>{let n=sn(t,iv());n&&(u=u.updateImmediateChild(e,n))}));let f=null!=si(d,t);
173if(!f&&!t._queryParams.loadsAllData()){let n=sy(t);e7(!e.queryToTagMap.has(n),"View does not exist, but we have a tag");let i=so++;e.queryToTagMap.set(n,i),e.tagToQueryMap.set(i,n)}let p=rK(h,e.pendingWriteTree_),g=(o=se(r=d,t,p,u,s),r.views.has(t._queryIdentifier)||r.views.set(t._queryIdentifier,o),o.eventRegistrations_.push(n),a=o.viewCache_.eventCache,l=[],a.getNode().isLeafNode()||a.getNode().forEachChild(iQ,(e,t)=>{l.push(i8(e,t))}),a.isFullyInitialized()&&l.push(i6(a.getNode())),r8(o,l,a.getNode(),n));if(!f&&!c&&!i){let n=si(d,t);g=g.concat(function(e,t,n){let i=t._path,r=sm(e,t),s=sg(e,n),o=e.listenProvider_.startListening(sb(t),r,s.hashFn,s.onComplete),a=e.syncPointTree_.subtree(i);if(r)e7(!sr(a.value),"If we're adding a query, it shouldn't be shadowed");else{let t=a.fold((e,t,n)=>{if(!ix(e)&&t&&sr(t))return[ss(t).query];{let e=[];return t&&(e=e.concat(st(t).map(e=>e.query))),nX(n,(t,n)=>{e=e.concat(n)}),e}});for(let n=0;n<t.length;++n){let i=t[n];e.listenProvider_.stopListening(sb(i),sm(e,i))}}return o}(e,t,n))}}(t.serverSyncTree_,n,f,!0),n._queryParams.loadsAllData())i=su(t.serverSyncTree_,n._path,r);else{let e=sm(t.serverSyncTree_,n);i=sd(t.serverSyncTree_,n._path,r,e)}return sX(t.eventQueue_,n._path,i),sc(t.serverSyncTree_,n,f,null,!0),r},e=>(s3(t,"get for query "+tv(n)+" failed: "+e),Promise.reject(Error(e))))).then(t=>new ou(t,new oh(e._repo,e._path),e._queryParams.getIndex()))}class op{constructor(e){this.callbackContext=e}respondsTo(e){return"value"===e}createEvent(e,t){let n=t._queryParams.getIndex();return new os("value",this,new ou(e.snapshotNode,new oh(t._repo,t._path),n))}getEventRunner(e){return"cancel"===e.getEventType()?()=>this.callbackContext.onCancel(e.error):()=>this.callbackContext.onValue(e.snapshot,null)}createCancelEvent(e,t){return this.callbackContext.hasCancelCallback?new oo(this,e,t):null}matches(e){return e instanceof op&&(!e.callbackContext||!this.callbackContext||e.callbackContext.matches(this.callbackContext))}hasAnyCallback(){return null!==this.callbackContext}}e7(!c,"__referenceConstructor has already been defined"),c=oh,e7(!d,"__referenceConstructor has already been defined"),d=oh;let og={};class om{constructor(e,t){this._repoInternal=e,this.app=t,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(!function(e,t,n){var i;let r;if(e.stats_=is(e.repoInfo_),e.forceRestClient_||("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0)e.server_=new ro(e.repoInfo_,(t,n,i,r)=>{s0(e,t,n,i,r)},e.authTokenProvider_,e.appCheckProvider_),setTimeout(()=>s1(e,!0),0);else{if(null!=n){if("object"!=typeof n)throw Error("Only objects are supported for option databaseAuthVariableOverride");try{tv(n)}catch(e){throw Error("Invalid authOverride provided: "+e)}}e.persistentConnection_=new iL(e.repoInfo_,t,(t,n,i,r)=>{s0(e,t,n,i,r)},t=>{s1(e,t)},t=>{var n;n=e,nX(t,(e,t)=>{s2(n,e,t)})},e.authTokenProvider_,e.appCheckProvider_,n),e.server_=e.persistentConnection_}e.authTokenProvider_.addTokenChangeListener(t=>{e.server_.refreshAuthToken(t)}),e.appCheckProvider_.addTokenChangeListener(t=>{e.server_.refreshAppCheckToken(t.token)}),i=e.repoInfo_,ir[r=i.toString()]||(ir[r]=(()=>new rc(e.stats_,e.server_))()),e.statsReporter_=ir[r],e.infoData_=new ra,e.infoSyncTree_=new sa({startListening:(t,n,i,r)=>{let s=[],o=e.infoData_.getNode(t._path);return o.isEmpty()||(s=su(e.infoSyncTree_,t._path,o),setTimeout(()=>{r("ok")},0)),s},stopListening:()=>{}}),s2(e,"connected",!1),e.serverSyncTree_=new sa({startListening:(t,n,i,r)=>(e.server_.listen(t,i,n,(n,i)=>{let s=r(n,i);sX(e.eventQueue_,t._path,s)}),[]),stopListening:(t,n)=>{e.server_.unlisten(t,n)}})}(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new oh(this._repo,iv())),this._rootInternal}_delete(){if(null!==this._rootInternal){var e,t;let n;e=this._repo,(n=og[t=this.app.name])&&n[e.key]===e||nV(`Database ${t}(${e.repoInfo_}) has already been deleted.`),e.persistentConnection_&&e.persistentConnection_.interrupt("repo_interrupt"),delete n[e.key],this._repoInternal=null,this._rootInternal=null}return Promise.resolve()}_checkNotDeleted(e){null===this._rootInternal&&nV("Cannot call "+e+" on a deleted database.")}}iL.prototype.simpleListen=function(e,t){this.sendRequest("q",{p:e},t)},iL.prototype.echo=function(e,t){this.sendRequest("echo",{d:e},t)},nE=na,nn(new tO("database",(e,{instanceIdentifier:t})=>{var n,i,r,s;let o,a,l,h,u,c,d,f=e.getProvider("app").getImmediate(),p=e.getProvider("auth-internal"),g=e.getProvider("app-check-internal");return void 0===(l=t||f.options.databaseURL)&&(f.options.projectId||nV("Can't determine Firebase Database URL. Be sure to include  a Project ID when calling firebase.initializeApp()."),nL("Using default host for project ",f.options.projectId),l=`${f.options.projectId}-default-rtdb.firebaseio.com`),u=(h=oi(l,void 0)).repoInfo,void 0!==$.default&&$.default.env&&(c=$.default.env.FIREBASE_DATABASE_EMULATOR_HOST),c?u=(h=oi(l=`http://${c}?ns=${u.namespace}`,void 0)).repoInfo:!h.repoInfo.secure,d=new n3(f.name,f.options,p),sG("Invalid Firebase Database URL",h),ix(h.path)||nV("Database URL must point to the root of a Firebase Database (not including a child path)."),new om((n=u,i=f,r=d,s=new n5(f,g),(o=og[i.name])||(o={},og[i.name]=o),(a=o[n.toURLString()])&&nV("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),a=new sJ(n,!1,r,s),o[n.toURLString()]=a,a),f)}
173,"PUBLIC").setMultipleInstances(!0)),nu(nb,nC,void 0),nu(nb,nC,"esm2017");var oy="u">typeof globalThis?globalThis:"u">typeof window?window:e.g,o_={};(function(){function e(){this.blockSize=-1,this.blockSize=64,this.g=[,,,,],this.B=Array(this.blockSize),this.o=this.h=0,this.s()}var t=function(){this.blockSize=-1};function n(){}function i(e,t,n){n||(n=0);var i=Array(16);if("string"==typeof t)for(var r=0;16>r;++r)i[r]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(r=0;16>r;++r)i[r]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],r=e.g[2];var s=e.g[3],o=t+(s^n&(r^s))+i[0]+0xd76aa478|0;o=s+(r^(t=n+(o<<7|o>>>25))&(n^r))+i[1]+0xe8c7b756|0,o=r+(n^(s=t+(o<<12|o>>>20))&(t^n))+i[2]+0x242070db|0,o=n+(t^(r=s+(o<<17|o>>>15))&(s^t))+i[3]+0xc1bdceee|0,o=t+(s^(n=r+(o<<22|o>>>10))&(r^s))+i[4]+0xf57c0faf|0,o=s+(r^(t=n+(o<<7|o>>>25))&(n^r))+i[5]+0x4787c62a|0,o=r+(n^(s=t+(o<<12|o>>>20))&(t^n))+i[6]+0xa8304613|0,o=n+(t^(r=s+(o<<17|o>>>15))&(s^t))+i[7]+0xfd469501|0,o=t+(s^(n=r+(o<<22|o>>>10))&(r^s))+i[8]+0x698098d8|0,o=s+(r^(t=n+(o<<7|o>>>25))&(n^r))+i[9]+0x8b44f7af|0,o=r+(n^(s=t+(o<<12|o>>>20))&(t^n))+i[10]+0xffff5bb1|0,o=n+(t^(r=s+(o<<17|o>>>15))&(s^t))+i[11]+0x895cd7be|0,o=t+(s^(n=r+(o<<22|o>>>10))&(r^s))+i[12]+0x6b901122|0,o=s+(r^(t=n+(o<<7|o>>>25))&(n^r))+i[13]+0xfd987193|0,o=r+(n^(s=t+(o<<12|o>>>20))&(t^n))+i[14]+0xa679438e|0,o=n+(t^(r=s+(o<<17|o>>>15))&(s^t))+i[15]+0x49b40821|0,n=r+(o<<22|o>>>10),o=t+(r^s&(n^r))+i[1]+0xf61e2562|0,t=n+(o<<5|o>>>27),o=s+(n^r&(t^n))+i[6]+0xc040b340|0,s=t+(o<<9|o>>>23),o=r+(t^n&(s^t))+i[11]+0x265e5a51|0,r=s+(o<<14|o>>>18),o=n+(s^t&(r^s))+i[0]+0xe9b6c7aa|0,n=r+(o<<20|o>>>12),o=t+(r^s&(n^r))+i[5]+0xd62f105d|0,t=n+(o<<5|o>>>27),o=s+(n^r&(t^n))+i[10]+0x2441453|0,s=t+(o<<9|o>>>23),o=r+(t^n&(s^t))+i[15]+0xd8a1e681|0,r=s+(o<<14|o>>>18),o=n+(s^t&(r^s))+i[4]+0xe7d3fbc8|0,n=r+(o<<20|o>>>12),o=t+(r^s&(n^r))+i[9]+0x21e1cde6|0,t=n+(o<<5|o>>>27),o=s+(n^r&(t^n))+i[14]+0xc33707d6|0,s=t+(o<<9|o>>>23),o=r+(t^n&(s^t))+i[3]+0xf4d50d87|0,r=s+(o<<14|o>>>18),o=n+(s^t&(r^s))+i[8]+0x455a14ed|0,n=r+(o<<20|o>>>12),o=t+(r^s&(n^r))+i[13]+0xa9e3e905|0,t=n+(o<<5|o>>>27),o=s+(n^r&(t^n))+i[2]+0xfcefa3f8|0,s=t+(o<<9|o>>>23),o=r+(t^n&(s^t))+i[7]+0x676f02d9|0,r=s+(o<<14|o>>>18),o=n+(s^t&(r^s))+i[12]+0x8d2a4c8a|0,o=t+((n=r+(o<<20|o>>>12))^r^s)+i[5]+0xfffa3942|0,o=s+((t=n+(o<<4|o>>>28))^n^r)+i[8]+0x8771f681|0,o=r+((s=t+(o<<11|o>>>21))^t^n)+i[11]+0x6d9d6122|0,o=n+((r=s+(o<<16|o>>>16))^s^t)+i[14]+0xfde5380c|0,o=t+((n=r+(o<<23|o>>>9))^r^s)+i[1]+0xa4beea44|0,o=s+((t=n+(o<<4|o>>>28))^n^r)+i[4]+0x4bdecfa9|0,o=r+((s=t+(o<<11|o>>>21))^t^n)+i[7]+0xf6bb4b60|0,o=n+((r=s+(o<<16|o>>>16))^s^t)+i[10]+0xbebfbc70|0,o=t+((n=r+(o<<23|o>>>9))^r^s)+i[13]+0x289b7ec6|0,o=s+((t=n+(o<<4|o>>>28))^n^r)+i[0]+0xeaa127fa|0,o=r+((s=t+(o<<11|o>>>21))^t^n)+i[3]+0xd4ef3085|0,o=n+((r=s+(o<<16|o>>>16))^s^t)+i[6]+0x4881d05|0,o=t+((n=r+(o<<23|o>>>9))^r^s)+i[9]+0xd9d4d039|0,o=s+((t=n+(o<<4|o>>>28))^n^r)+i[12]+0xe6db99e5|0,o=r+((s=t+(o<<11|o>>>21))^t^n)+i[15]+0x1fa27cf8|0,o=n+((r=s+(o<<16|o>>>16))^s^t)+i[2]+0xc4ac5665|0,n=r+(o<<23|o>>>9),o=t+(r^(n|~s))+i[0]+0xf4292244|0,t=n+(o<<6|o>>>26),o=s+(n^(t|~r))+i[7]+0x432aff97|0,s=t+(o<<10|o>>>22),o=r+(t^(s|~n))+i[14]+0xab9423a7|0,r=s+(o<<15|o>>>17),o=n+(s^(r|~t))+i[5]+0xfc93a039|0,n=r+(o<<21|o>>>11),o=t+(r^(n|~s))+i[12]+0x655b59c3|0,t=n+(o<<6|o>>>26),o=s+(n^(t|~r))+i[3]+0x8f0ccc92|0,s=t+(o<<10|o>>>22),o=r+(t^(s|~n))+i[10]+0xffeff47d|0,r=s+(o<<15|o>>>17),o=n+(s^(r|~t))+i[1]+0x85845dd1|0,n=r+(o<<21|o>>>11),o=t+(r^(n|~s))+i[8]+0x6fa87e4f|0,t=n+(o<<6|o>>>26),o=s+(n^(t|~r))+i[15]+0xfe2ce6e0|0,s=t+(o<<10|o>>>22),o=r+(t^(s|~n))+i[6]+0xa3014314|0,r=s+(o<<15|o>>>17),o=n+(s^(r|~t))+i[13]+0x4e0811a1|0,n=r+(o<<21|o>>>11),o=t+(r^(n|~s))+i[4]+0xf7537e82|0,t=n+(o<<6|o>>>26),o=s+(n^(t|~r))+i[11]+0xbd3af235|0,s=t+(o<<10|o>>>22),o=r+(t^(s|~n))+i[2]+0x2ad7d2bb|0,r=s+(o<<15|o>>>17),o=n+(s^(r|~t))+i[9]+0xeb86d391|0,e.g[0]=e.g[0]+t|0,e.g[1]=e.g[1]+(r+(o<<21|o>>>11))|0,e.g[2]=e.g[2]+r|0,e.g[3]=e.g[3]+s|0}function r(e,t){this.h=t;for(var n=[],i=!0,r=e.length-1;0<=r;r--){var s=0|e[r];i&&s==t||(n[r]=s,i=!1)}this.g=n}n.prototype=t.prototype,e.D=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.C=function(e,n,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return t.prototype[n].apply(e,r)},e.prototype.s=function(){this.g[0]=0x67452301,this.g[1]=0xefcdab89,this.g[2]=0x98badcfe,this.g[3]=0x10325476,this.o=this.h=0},e.prototype.u=function(e,t){void 0===t&&(t=e.length);for(var n=t-this.blockSize,r=this.B,s=this.h,o=0;o<t;){if(0==s)for(;o<=n;)i(this,e,o),o+=this.blockSize;if("string"==typeof e){for(;o<t;)if(r[s++]=e.charCodeAt(o++),s==this.blockSize){i(this,r),s=0;break}}else for(;o<t;)if(r[s++]=e[o++],s==this.blockSize){i(this,r),s=0;break}}this.h=s,this.o+=t},e.prototype.v=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.o;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.u(e),e=Array(16),t=n=0;4>t;++t)for(var i=0;32>i;i+=8)e[n++]=this.g[t]>>>i&255;return e};var s,o={};function a(e){var t;return -128<=e&&128>e?(t=function(e){return new r([0|e],0>e?-1:0)},Object.prototype.hasOwnProperty.call(o,e)?o[e]:o[e]=t(e)):new r([0|e],0>e?-1:0)}function l(e){if(isNaN(e)||!isFinite(e))return h;if(0>e)return p(l(-e));for(var t=[],n=1,i=0;e>=n;i++)t[i]=e/n|0,n*=0x100000000;return new r(t,0)}var h=a(0),u=a(1),c=a(0x1000000);function d(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function f(e){return -1==e.h}function p(e){for(var t=e.g.length,n=[],i=0;i<t;i++)n[i]=~e.g[i];return new r(n,~e.h).add(u)}function g(e,t){return e.add(p(t))}function m(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function y(e,t){this.g=e,this.h=t}function _(e,t){if(d(t))throw Error("division by zero");if(d(e))return new y(h,h);if(f(e))return t=_(p(e),t),new y(p(t.g),p(t.h));if(f(t))return t=_(e,p(t)),new y(p(t.g),t.h);if(30<e.g.length){if(f(e)||f(t))throw Error("slowDivide_ only works with positive integers.");for(var n=u,i=t;0>=i.l(e);)n=v(n),i=v(i);var r=w(n,1),s=w(i,1);for(i=w(i,2),n=w(n,2);!d(i);){var o=s.add(i);0>=o.l(e)&&(r=r.add(n),s=o),i=w(i,1),n=w(n,1)}return t=g(e,r.j(t)),new y(r,t)}for(r=h;0<=e.l(t);){for(i=48>=(i=Math.ceil(Math.log(n=Math.max(1,Math.floor(e.m()/t.m())))/Math.LN2))?1:Math.pow(2,i-48),o=(s=l(n)).j(t);f(o)||0<o.l(e);)n-=i,o=(s=l(n)).j(t);d(s)&&(s=u),r=r.add(s),e=g(e,o)}return new y(r,e)}function v(e){for(var t=e.g.length+1,n=[],i=0;i<t;i++)n[i]=e.i(i)<<1|e.i(i-1)>>>31;return new r(n,e.h)}function w(e,t){var n=t>>5;t%=32;for(var i=e.g.length-n,s=[],o=0;o<i;o++)s[o]=0<t?e.i(o+n)>>>t|e.i(o+n+1)<<32-t:e.i(o+n);return new r(s,e.h)}(s=r.prototype).m=function(){if(f(this))return-p(this).m();for(var e=0,t=1,n=0;n<this.g.length;n++){var i=this.i(n);e+=(0<=i?i:0x100000000+i)*t,t*=0x100000000}return e},s.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(d(this))return"0";
173if(f(this))return"-"+p(this).toString(e);for(var t=l(Math.pow(e,6)),n=this,i="";;){var r=_(n,t).g,s=((0<(n=g(n,r.j(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(d(n=r))return s+i;for(;6>s.length;)s="0"+s;i=s+i}},s.i=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},s.l=function(e){return f(e=g(this,e))?-1:+!d(e)},s.abs=function(){return f(this)?p(this):this},s.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0,s=0;s<=t;s++){var o=i+(65535&this.i(s))+(65535&e.i(s)),a=(o>>>16)+(this.i(s)>>>16)+(e.i(s)>>>16);i=a>>>16,o&=65535,a&=65535,n[s]=a<<16|o}return new r(n,-0x80000000&n[n.length-1]?-1:0)},s.j=function(e){if(d(this)||d(e))return h;if(f(this))return f(e)?p(this).j(p(e)):p(p(this).j(e));if(f(e))return p(this.j(p(e)));if(0>this.l(c)&&0>e.l(c))return l(this.m()*e.m());for(var t=this.g.length+e.g.length,n=[],i=0;i<2*t;i++)n[i]=0;for(i=0;i<this.g.length;i++)for(var s=0;s<e.g.length;s++){var o=this.i(i)>>>16,a=65535&this.i(i),u=e.i(s)>>>16,g=65535&e.i(s);n[2*i+2*s]+=a*g,m(n,2*i+2*s),n[2*i+2*s+1]+=o*g,m(n,2*i+2*s+1),n[2*i+2*s+1]+=a*u,m(n,2*i+2*s+1),n[2*i+2*s+2]+=o*u,m(n,2*i+2*s+2)}for(i=0;i<t;i++)n[i]=n[2*i+1]<<16|n[2*i];for(i=t;i<2*t;i++)n[i]=0;return new r(n,0)},s.A=function(e){return _(this,e).h},s.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)&e.i(i);return new r(n,this.h&e.h)},s.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)|e.i(i);return new r(n,this.h|e.h)},s.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],i=0;i<t;i++)n[i]=this.i(i)^e.i(i);return new r(n,this.h^e.h)},e.prototype.digest=e.prototype.v,e.prototype.reset=e.prototype.s,e.prototype.update=e.prototype.u,o_.Md5=e,r.prototype.add=r.prototype.add,r.prototype.multiply=r.prototype.j,r.prototype.modulo=r.prototype.A,r.prototype.compare=r.prototype.l,r.prototype.toNumber=r.prototype.m,r.prototype.toString=r.prototype.toString,r.prototype.getBits=r.prototype.i,r.fromNumber=l,r.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return p(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var i=l(Math.pow(n,8)),r=h,s=0;s<t.length;s+=8){var o=Math.min(8,t.length-s),a=parseInt(t.substring(s,s+o),n);8>o?(o=l(Math.pow(n,o)),r=r.j(o).add(l(a))):r=(r=r.j(i)).add(l(a))}return r},k=o_.Integer=r}).apply(void 0!==oy?oy:"u">typeof self?self:"u">typeof window?window:{});var ov="u">typeof globalThis?globalThis:"u">typeof window?window:e.g,ow={};(function(){var e,t,n,i="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e},r=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof ov&&ov];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);!function(e,t){if(t)e:{var n=r;e=e.split(".");for(var s=0;s<e.length-1;s++){var o=e[s];if(!(o in n))break e;n=n[o]}(t=t(s=n[e=e[e.length-1]]))!=s&&null!=t&&i(n,e,{configurable:!0,writable:!0,value:t})}}("Array.prototype.values",function(e){return e||function(){var e,t,n,i,r;return e=this,t=function(e,t){return t},e instanceof String&&(e+=""),n=0,i=!1,(r={next:function(){if(!i&&n<e.length){var r=n++;return{value:t(r,e[r]),done:!1}}return i=!0,{done:!0,value:void 0}}})[Symbol.iterator]=function(){return r},r}});var s=s||{},o=this||self;function a(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function l(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function h(e,t,n){return e.call.apply(e.bind,arguments)}function u(e,t,n){if(!e)throw Error();if(2<arguments.length){var i=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,i),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}
173function c(e,t,n){return(c=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?h:u).apply(null,arguments)}function d(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function f(e,t){function n(){}n.prototype=t.prototype,e.aa=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Qb=function(e,n,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return t.prototype[n].apply(e,r)}}function p(e){let t=e.length;if(0<t){let n=Array(t);for(let i=0;i<t;i++)n[i]=e[i];return n}return[]}function g(e,t){for(let t=1;t<arguments.length;t++){let n=arguments[t];if(a(n)){let t=e.length||0,i=n.length||0;e.length=t+i;for(let r=0;r<i;r++)e[t+r]=n[r]}else e.push(n)}}function m(e){return/^[\s\xa0]*$/.test(e)}function y(){var e=o.navigator;return e&&(e=e.userAgent)?e:""}function _(e){return _[" "](e),e}_[" "]=function(){};var v=-1!=y().indexOf("Gecko")&&(-1==y().toLowerCase().indexOf("webkit")||-1!=y().indexOf("Edge"))&&-1==y().indexOf("Trident")&&-1==y().indexOf("MSIE")&&-1==y().indexOf("Edge");function w(e,t,n){for(let i in e)t.call(n,e[i],i,e)}function b(e){let t={};for(let n in e)t[n]=e[n];return t}let C="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function E(e,t){let n,i;for(let t=1;t<arguments.length;t++){for(n in i=arguments[t])e[n]=i[n];for(let t=0;t<C.length;t++)n=C[t],Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}}var T=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new S,e=>e.reset());class S{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let I,x=!1,k=new class{constructor(){this.h=this.g=null}add(e,t){let n=T.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},F=()=>{let e=o.Promise.resolve(void 0);I=()=>{e.then(j)}};var j=()=>{let e;for(var t;e=null,k.g&&(e=k.g,k.g=k.g.next,k.g||(k.h=null),e.next=null),t=e;){try{t.h.call(t.g)}catch(e){!function(e){o.setTimeout(()=>{throw e},0)}(e)}T.j(t),100>T.h&&(T.h++,t.next=T.g,T.g=t)}x=!1};function V(){this.s=this.s,this.C=this.C}function U(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}V.prototype.s=!1,V.prototype.ma=function(){this.s||(this.s=!0,this.N())},V.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},U.prototype.h=function(){this.defaultPrevented=!0};var B=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{let e=()=>{};o.addEventListener("test",e,t),o.removeEventListener("test",e,t)}catch(e){}return e}();function q(e,t){if(U.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,i=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(v){e:{try{_(t.nodeName);var r=!0;break e}catch(e){}r=!1}r||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,i?(this.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:$[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&q.aa.h.call(this)}}f(q,U);var $={2:"touch",3:"pen",4:"mouse"};q.prototype.h=function(){q.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var H="closure_listenable_"+(1e6*Math.random()|0),z=0;function W(e,t,n,i,r){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!i,this.ha=r,this.key=++z,this.da=this.fa=!1}function K(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function G(e){this.src=e,this.g={},this.h=0}function Q(e,t){var n=t.type;if(n in e.g){var i,r=e.g[n],s=Array.prototype.indexOf.call(r,t,void 0);(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(K(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function Y(e,t,n,i){for(var r=0;r<e.length;++r){var s=e[r];if(!s.da&&s.listener==t&&!!n==s.capture&&s.ha==i)return r}return -1}G.prototype.add=function(e,t,n,i,r){var s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);var o=Y(e,t,i,r);return -1<o?(t=e[o],n||(t.fa=!1)):((t=new W(t,this.src,s,!!i,r)).fa=n,e.push(t)),t};var X="closure_lm_"+(1e6*Math.random()|0),J={};function Z(e,t,n,i,r,s){if(!t)throw Error("Invalid event type");var o=l(r)?!!r.capture:!!r,a=ei(e);if(a||(e[X]=a=new G(e)),(n=a.add(t,n,i,o,s)).proxy)return n;if(i=function e(t){return en.call(e.src,e.listener,t)},n.proxy=i,i.src=e,i.listener=n,e.addEventListener)B||(r=o),void 0===r&&(r=!1),e.addEventListener(t.toString(),i,r);else if(e.attachEvent)e.attachEvent(et(t.toString()),i);else if(e.addListener&&e.removeListener)e.addListener(i);else throw Error("addEventListener and attachEvent are unavailable.");return n}function ee(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[H])Q(t.i,e);else{var n=e.type,i=e.proxy;t.removeEventListener?t.removeEventListener(n,i,e.capture):t.detachEvent?t.detachEvent(et(n),i):t.addListener&&t.removeListener&&t.removeListener(i),(n=ei(t))?(Q(n,e),0==n.h&&(n.src=null,t[X]=null)):K(e)}}}function et(e){return e in J?J[e]:J[e]="on"+e}function en(e,t){if(e.da)e=!0;else{t=new q(t,this);var n=e.listener,i=e.ha||e.src;e.fa&&ee(e),e=n.call(i,t)}return e}function ei(e){return(e=e[X])instanceof G?e:null}var er="__closure_events_fn_"+(1e9*Math.random()>>>0);function es(e){return"function"==typeof e?e:(e[er]||(e[er]=function(t){return e.handleEvent(t)}),e[er])}function eo(){V.call(this),this.i=new G(this),this.M=this,this.F=null}function ea(e,t){var n,i=e.F;if(i)for(n=[];i;i=i.F)n.push(i);if(e=e.M,i=t.type||t,"string"==typeof t)t=new U(t,e);else if(t instanceof U)t.target=t.target||e;else{var r=t;E(t=new U(i,e),r)}if(r=!0,n)for(var s=n.length-1;0<=s;s--){var o=t.g=n[s];r=el(o,i,!0,t)&&r}if(r=el(o=t.g=e,i,!0,t)&&r,r=el(o,i,!1,t)&&r,n)for(s=0;s<n.length;s++)r=el(o=t.g=n[s],i,!1,t)&&r}function el(e,t,n,i){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var r=!0,s=0;s<t.length;++s){var o=t[s];if(o&&!o.da&&o.capture==n){var a=o.listener,l=o.ha||o.src;o.fa&&Q(e.i,o),r=!1!==a.call(l,i)&&r}}return r&&!i.defaultPrevented}function eh(e,t,n){if("function"==typeof e)n&&(e=c(e,n));else if(e&&"function"==typeof e.handleEvent)e=c(e.handleEvent,e);else throw Error("Invalid listener argument");return 0x7fffffff<Number(t)?-1:o.setTimeout(e,t||0)}f(eo,V),eo.prototype[H]=!0,eo.prototype.removeEventListener=function(e,t,n,i){!function e(t,n,i,r,s){if(Array.isArray(n))for(var o=0;o<n.length;o++)e(t,n[o],i,r,s);else(r=l(r)?!!r.capture:!!r,i=es(i),t&&t[H])?(t=t.i,(n=String(n).toString())in t.g&&-1<(i=Y(o=t.g[n],i,r,s))&&
173(K(o[i]),Array.prototype.splice.call(o,i,1),0==o.length&&(delete t.g[n],t.h--))):t&&(t=ei(t))&&(n=t.g[n.toString()],t=-1,n&&(t=Y(n,i,r,s)),(i=-1<t?n[t]:null)&&ee(i))}(this,e,t,n,i)},eo.prototype.N=function(){if(eo.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],i=0;i<n.length;i++)K(n[i]);delete t.g[e],t.h--}}this.F=null},eo.prototype.K=function(e,t,n,i){return this.i.add(String(e),t,!1,n,i)},eo.prototype.L=function(e,t,n,i){return this.i.add(String(e),t,!0,n,i)};class eu extends V{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:function e(t){t.g=eh(()=>{t.g=null,t.i&&(t.i=!1,e(t))},t.l);let n=t.h;t.h=null,t.m.apply(null,n)}(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ec(e){V.call(this),this.h=e,this.g={}}f(ec,V);var ed=[];function ef(e){w(e.g,function(e,t){this.g.hasOwnProperty(t)&&ee(e)},e),e.g={}}ec.prototype.N=function(){ec.aa.N.call(this),ef(this)},ec.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ep=o.JSON.stringify,eg=o.JSON.parse,em=class{stringify(e){return o.JSON.stringify(e,void 0)}parse(e){return o.JSON.parse(e,void 0)}};function ey(){}function e_(e){return e.h||(e.h=e.i())}function ev(){}ey.prototype.h=null;var ew={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function eb(){U.call(this,"d")}function eC(){U.call(this,"c")}f(eb,U),f(eC,U);var eE={},eT=null;function eS(){return eT=eT||new eo}function eI(e){U.call(this,eE.La,e)}function ex(e){let t=eS();ea(t,new eI(t))}function ek(e,t){U.call(this,eE.STAT_EVENT,e),this.stat=t}function eN(e){let t=eS();ea(t,new ek(t,e))}function eA(e,t){U.call(this,eE.Ma,e),this.size=t}function eP(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){e()},t)}function eD(){this.g=!0}function eR(e,t,n,i){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n){for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var i=n[e];if(!(2>i.length)){var r=i[1];if(Array.isArray(r)&&!(1>r.length)){var s=r[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<r.length;o++)r[o]=""}}}}return ep(n)}catch(e){return t}}(e,n)+(i?" "+i:"")})}eE.La="serverreachability",f(eI,U),eE.STAT_EVENT="statevent",f(ek,U),eE.Ma="timingevent",f(eA,U),eD.prototype.xa=function(){this.g=!1},eD.prototype.info=function(){};var eO={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},eM={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function eL(){}function eF(e,t,n,i){this.j=e,this.i=t,this.l=n,this.R=i||1,this.U=new ec(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new ej}function ej(){this.i=null,this.g="",this.h=!1}f(eL,ey),eL.prototype.g=function(){return new XMLHttpRequest},eL.prototype.i=function(){return{}},t=new eL;var eV={},eU={};function eB(e,t,n){e.L=1,e.v=tn(e8(t)),e.m=n,e.P=!0,eq(e,null)}function eq(e,t){e.F=Date.now(),eH(e),e.A=e8(e.v);var n,i,r,s,o,a,h=e.A,u=e.R;Array.isArray(u)||(u=[String(u)]),tg(h.i,"t",u),e.C=0,h=e.j.J,e.h=new ej,e.g=t1(e.j,h?t:null,!e.m),0<e.O&&(e.M=new eu(c(e.Y,e,e.g),e.O)),t=e.U,h=e.g,u=e.ca;var d="readystatechange";Array.isArray(d)||(d&&(ed[0]=d.toString()),d=ed);for(var f=0;f<d.length;f++){var p=function e(t,n,i,r,s){if(r&&r.once)return function e(t,n,i,r,s){if(Array.isArray(n)){for(var o=0;o<n.length;o++)e(t,n[o],i,r,s);return null}return i=es(i),t&&t[H]?t.L(n,i,l(r)?!!r.capture:!!r,s):Z(t,n,i,!0,r,s)}(t,n,i,r,s);if(Array.isArray(n)){for(var o=0;o<n.length;o++)e(t,n[o],i,r,s);return null}return i=es(i),t&&t[H]?t.K(n,i,l(r)?!!r.capture:!!r,s):Z(t,n,i,!1,r,s)}(h,d[f],u||t.handleEvent,!1,t.h||t);if(!p)break;t.g[p.key]=p}t=e.H?b(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),ex(),n=e.i,i=e.u,r=e.A,s=e.l,o=e.R,a=e.m,n.info(function(){if(n.g)if(a)for(var e="",t=a.split("&"),l=0;l<t.length;l++){var h=t[l].split("=");if(1<h.length){var u=h[0];h=h[1];var c=u.split("_");e=2<=c.length&&"type"==c[1]?e+(u+"=")+h+"&":e+(u+"=redacted&")}}else e=null;else e=a;return"XMLHTTP REQ ("+s+") [attempt "+o+"]: "+i+"\n"+r+"\n"+e})}function e$(e){return!!e.g&&"GET"==e.u&&2!=e.L&&e.j.Ca}function eH(e){e.S=Date.now()+e.I,ez(e,e.I)}function ez(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=eP(c(e.ba,e),t)}function eW(e){e.B&&(o.clearTimeout(e.B),e.B=null)}function eK(e){0==e.j.G||e.J||tY(e.j,e)}function eG(e){eW(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,ef(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function eQ(e,t){try{var n=e.j;if(0!=n.G&&(n.g==e||e0(n.h,e))){if(!e.K&&e0(n.h,e)&&3==n.G){try{var i=n.Da.g.parse(t)}catch(e){i=null}if(Array.isArray(i)&&3==i.length){var r=i;if(0==r[0]){e:if(!n.u){if(n.g)if(n.g.F+3e3<e.F)tQ(n),tV(n);else break e;tW(n),eN(18)}}else n.za=r[1],0<n.za-n.T&&37500>r[2]&&n.F&&0==n.v&&!n.C&&(n.C=eP(c(n.Za,n),6e3));if(1>=eZ(n.h)&&n.ca){try{n.ca()}catch(e){}n.ca=void 0}}else tJ(n,11)}else if((e.K||n.g==e)&&tQ(n),!m(t))for(r=n.Da.g.parse(t),t=0;t<r.length;t++){let a=r[t];if(n.T=a[0],a=a[1],2==n.G)if("c"==a[0]){n.K=a[1],n.ia=a[2];let t=a[3];null!=t&&(n.la=t,n.j.info("VER="+n.la));let r=a[4];null!=r&&(n.Aa=r,n.j.info("SVER="+n.Aa));let l=a[5];null!=l&&"number"==typeof l&&0<l&&(n.L=i=1.5*l,n.j.info("backChannelRequestTimeoutMs_="+i)),i=n;let h=e.g;if(h){let e=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=i.h;s.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(s.j=s.l,s.g=new Set,s.h&&(e1(s,s.h),s.h=null))}if(i.D){let e=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(i.ya=e,tt(i.I,i.D,e))}}if(n.G=3,n.l&&n.l.ua(),n.ba&&(n.R=Date.now()-e.F,n.j.info("Handshake RTT: "+n.R+"ms")),(i=n).qa=t0(i,i.J?i.ia:null,i.W),e.K){e2(i.h,e);var o=i.L;o&&(e.I=o),e.B&&(eW(e),eH(e)),i.g=e}else tz(i);0<n.i.length&&tB(n)}else"stop"!=a[0]&&"close"!=a[0]||tJ(n,7);else 3==n.G&&("stop"==a[0]||"close"==a[0]?"stop"==a[0]?tJ(n,7):tj(n):"noop"!=a[0]&&n.l&&n.l.ta(a),n.v=0)}}ex(4)}catch(e){}}eF.prototype.ca=function(e){e=e.target;let t=this.M;t&&3==tO(e)?t.j():this.Y(e)},eF.prototype.Y=function(e){try{if(e==this.g)e:{let v=tO(this.g);var t=this.g.Ba();let w=this.g.Z();if(!(3>v)&&(3!=v||this.g&&(this.h.h||this.g.oa()||tM(this.g)))){this.J||4!=v||7==t||(8==t||0>=w?ex(3):ex(2)),eW(this);var n=this.g.Z();this.X=n;t:if(e$(this)){var i=tM(this.g);e="";var r=i.length,s=4==tO(this.g);if(!this.h.i){if("u"<typeof TextDecoder){eG(this),eK(this);var a="";break t}this.h.i=new o.TextDecoder}for(t=0;t<r;t++)this.h.h=!0,e+=this.h.i.decode(i[t],{stream:!(s&&t==r-1)});i.length=0,this.h.g+=e,this.C=0,a=this.h.g}else a=this.g.oa();if(this.o=200==n,l=this.i,h=this.u,u=this.A,c=this.l,d=this.R,f=n,l.info(function(){return"XMLHTTP RESP ("+c+") [ attempt "+d+"]: "+h+"\n"+u+"\n"+v+" "+f}),this.o){if(this.T&&!this.K){t:{if(this.g){var l,h,u,c,d,f,p,g=this.g;if((p=g.g?g.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!m(p)){var y=p;break t}}y=null}if(n=y)eR(this.i,this.l,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,eQ(this,n);else{this.o=!1,this.s=3,eN(12),eG(this),eK(this);break e}}if(this.P){let e;for(n=!0;!this.J&&this.C<a.length;)if((e=function(e,t){var n=e.C,i=t.indexOf("\n",n);return -1==i?eU:isNaN(n=Number(t.substring(n,i)))?eV:(i+=1)+n>t.length?eU:(t=t.slice(i,i+n),e.C=i+n,t)}(this,a))==eU){4==v&&(this.s=4,eN(14),n=!1),eR(this.i,this.l,null,"[Incomplete Response]");break}else if(e==eV){this.s=4,eN(15),eR(this.i,this.l,a,"[Invalid Chunk]"),n=!1;break}else eR(this.i,this.l,e,null),eQ(this,e);if(e$(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=v||0!=a.length||this.h.h||(this.s=1,eN(16),n=!1),this.o=this.o&&n,n){if(0<a.length&&!this.W){this.W=!0;var _=this.j;_.g==this&&_.ba&&!_.M&&(_.j.info("Great, no buffering proxy detected. Bytes received: "+a.length),tK(_),_.M=!0,eN(11))}}else eR(this.i,this.l,a,"[Invalid Chunked Response]"),eG(this),eK(this)}else eR(this.i,this.l,a,null),eQ(this,a);4==v&&eG(this),this.o&&!this.J&&(4==v?tY(this.j,this):(this.o=!1,eH(this)))}else(function(e){let t={};e=(e.g&&2<=tO(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let i=0;i<e.length;i++){if(m(e[i]))continue;var n=function(e){var t=1;e=e.split(":");let n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}(e[i]);let r=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();let s=t[r]||[];t[r]=s,s.push(n)}var i=function(e){return e.join(", ")};for(let e in t)i.call(void 0,t[e],e,t)})(this.g),400==n&&0<a.indexOf("Unknown SID")?(this.s=3,eN(12)):(this.s=0,eN(13)),eG(this),eK(this)}}}catch(e){}finally{}},eF.prototype.cancel=function(){this.J=!0,eG(this)},eF.prototype.ba=function(){var e,t;this.B=null;let n=Date.now();0<=n-this.S?(e=this.i,t=this.A,e.info(function(){return"TIMEOUT: "+t}),2!=this.L&&(ex(),eN(17)),eG(this),this.s=2,eK(this)):ez(this,this.S-n)};var eY=class{constructor(e,t){this.g=e,this.map=t}};function eX(e){this.l=e||10,e=o.PerformanceNavigationTiming?0<(e=o.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function eJ(e){return!!e.h||!!e.g&&e.g.size>=e.j}function eZ(e){return e.h?1:e.g?e.g.size:0}function e0(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function e1(e,t){e.g?e.g.add(t):e.h=t}function e2(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function e5(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){let t=e.i;for(let n of e.g.values())t=t.concat(n.D);return t}return p(e.i)}function e3(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(a(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("u">typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("u">typeof Set&&e instanceof Set)){if(a(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}for(let i in t=[],n=0,e)t[n++]=i;return t}}}(e),i=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("u">typeof Map&&e instanceof Map||"u">typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");
173if(a(e)){for(var t=[],n=e.length,i=0;i<n;i++)t.push(e[i]);return t}for(i in t=[],n=0,e)t[n++]=e[i];return t}(e),r=i.length,s=0;s<r;s++)t.call(void 0,i[s],n&&n[s],e)}eX.prototype.cancel=function(){if(this.i=e5(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(let e of this.g.values())e.cancel();this.g.clear()}};var e4=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function e6(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof e6){this.h=e.h,e7(this,e.j),this.o=e.o,this.g=e.g,e9(this,e.s),this.l=e.l;var t=e.i,n=new tc;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),te(this,n),this.m=e.m}else e&&(t=String(e).match(e4))?(this.h=!1,e7(this,t[1]||"",!0),this.o=ti(t[2]||""),this.g=ti(t[3]||"",!0),e9(this,t[4]),this.l=ti(t[5]||"",!0),te(this,t[6]||"",!0),this.m=ti(t[7]||"")):(this.h=!1,this.i=new tc(null,this.h))}function e8(e){return new e6(e)}function e7(e,t,n){e.j=n?ti(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function e9(e,t){if(t){if(isNaN(t=Number(t))||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function te(e,t,n){var i,r;t instanceof tc?(e.i=t,i=e.i,(r=e.h)&&!i.j&&(td(i),i.i=null,i.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&(tf(this,t),tg(this,n,e))},i)),i.j=r):(n||(t=tr(t,th)),e.i=new tc(t,e.h))}function tt(e,t,n){e.i.set(t,n)}function tn(e){return tt(e,"zx",Math.floor(0x80000000*Math.random()).toString(36)+Math.abs(Math.floor(0x80000000*Math.random())^Date.now()).toString(36)),e}function ti(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function tr(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,ts),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function ts(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}e6.prototype.toString=function(){var e=[],t=this.j;t&&e.push(tr(t,to,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(tr(t,to,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.s)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(tr(n,"/"==n.charAt(0)?tl:ta,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",tr(n,tu)),e.join("")};var to=/[#\/\?@]/g,ta=/[#\?:]/g,tl=/[#\?]/g,th=/[#\?@]/g,tu=/#/g;function tc(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function td(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var i=e[n].indexOf("="),r=null;if(0<=i){var s=e[n].substring(0,i);r=e[n].substring(i+1)}else s=e[n];t(s,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function tf(e,t){td(e),t=tm(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function tp(e,t){return td(e),t=tm(e,t),e.g.has(t)}function tg(e,t,n){tf(e,t),0<n.length&&(e.i=null,e.g.set(tm(e,t),p(n)),e.h+=n.length)}function tm(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function ty(e,t,n,i,r){try{r&&(r.onload=null,r.onerror=null,r.onabort=null,r.ontimeout=null),i(n)}catch(e){}}function t_(){this.g=new em}function tv(e){this.l=e.Ub||null,this.j=e.eb||!1}function tw(e,t){eo.call(this),this.D=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}function tb(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function tC(e){e.readyState=4,e.l=null,e.j=null,e.v=null,tE(e)}function tE(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function tT(e){let t="";return w(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function tS(e,t,n){e:{for(i in n){var i=!1;break e}i=!0}i||(n=tT(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):tt(e,t,n))}function tI(e){eo.call(this),this.headers=new Map,this.o=e||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}(n=tc.prototype).add=function(e,t){td(this),this.i=null,e=tm(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this}
173,n.forEach=function(e,t){td(this),this.g.forEach(function(n,i){n.forEach(function(n){e.call(t,n,i,this)},this)},this)},n.na=function(){td(this);let e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let i=0;i<t.length;i++){let r=e[i];for(let e=0;e<r.length;e++)n.push(t[i])}return n},n.V=function(e){td(this);let t=[];if("string"==typeof e)tp(this,e)&&(t=t.concat(this.g.get(tm(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},n.set=function(e,t){return td(this),this.i=null,tp(this,e=tm(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},n.get=function(e,t){return e&&0<(e=this.V(e)).length?String(e[0]):t},n.toString=function(){if(this.i)return this.i;if(!this.g)return"";let e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var i=t[n];let s=encodeURIComponent(String(i)),o=this.V(i);for(i=0;i<o.length;i++){var r=s;""!==o[i]&&(r+="="+encodeURIComponent(String(o[i]))),e.push(r)}}return this.i=e.join("&")},f(tv,ey),tv.prototype.g=function(){return new tw(this.l,this.j)},tv.prototype.i=(e={},function(){return e}),f(tw,eo),(n=tw.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,tE(this)},n.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;let t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||o).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,tC(this)),this.readyState=0},n.Sa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,tE(this)),this.g&&(this.readyState=3,tE(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(void 0!==o.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;tb(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},n.Pa=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?tC(this):tE(this),3==this.readyState&&tb(this)}},n.Ra=function(e){this.g&&(this.response=this.responseText=e,tC(this))},n.Qa=function(e){this.g&&(this.response=e,tC(this))},n.ga=function(){this.g&&tC(this)},n.setRequestHeader=function(e,t){this.u.append(e,t)},n.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";let e=[],t=this.h.entries();for(var n=t.next();!n.done;)e.push((n=n.value)[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(tw.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),f(tI,eo);var tx=/^https?$/i,tk=["POST","PUT"];function tN(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,tA(e),tD(e)}function tA(e){e.A||(e.A=!0,ea(e,"complete"),ea(e,"error"))}function tP(e){if(e.h&&void 0!==s&&(!e.v[1]||4!=tO(e)||2!=e.Z())){if(e.u&&4==tO(e))eh(e.Ea,0,e);else if(ea(e,"readystatechange"),4==tO(e)){e.h=!1;try{let s=e.Z();switch(s){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t,n,i=!0;break;default:i=!1}if(!(t=i)){if(n=0===s){var r=String(e.D).match(e4)[1]||null;!r&&o.self&&o.self.location&&(r=o.self.location.protocol.slice(0,-1)),n=!tx.test(r?r.toLowerCase():"")}t=n}if(t)ea(e,"complete"),ea(e,"success");else{e.m=6;try{var a=2<tO(e)?e.g.statusText:""}catch(e){a=""}e.l=a+" ["+e.Z()+"]",tA(e)}}finally{tD(e)}}}}function tD(e,t){if(e.g){tR(e);let n=e.g,i=e.v[0]?()=>{}:null;e.g=null,e.v=null,t||ea(e,"ready");try{n.onreadystatechange=i}catch(e){}}}function tR(e){e.I&&(o.clearTimeout(e.I),e.I=null)}function tO(e){return e.g?e.g.readyState:0}function tM(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}
173function tL(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function tF(e){this.Aa=0,this.i=[],this.j=new eD,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=tL("failFast",!1,e),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=tL("baseRetryDelayMs",5e3,e),this.cb=tL("retryDelaySeedMs",1e4,e),this.Wa=tL("forwardChannelMaxRetries",2,e),this.wa=tL("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new eX(e&&e.concurrentRequestLimit),this.Da=new t_,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function tj(e){if(tU(e),3==e.G){var t=e.U++,n=e8(e.I);if(tt(n,"SID",e.K),tt(n,"RID",t),tt(n,"TYPE","terminate"),t$(e,n),(t=new eF(e,e.j,t)).L=2,t.v=tn(e8(n)),n=!1,o.navigator&&o.navigator.sendBeacon)try{n=o.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&o.Image&&((new Image).src=t.v,n=!0),n||(t.g=t1(t.j,null),t.g.ea(t.v)),t.F=Date.now(),eH(t)}tZ(e)}function tV(e){e.g&&(tK(e),e.g.cancel(),e.g=null)}function tU(e){tV(e),e.u&&(o.clearTimeout(e.u),e.u=null),tQ(e),e.h.cancel(),e.s&&("number"==typeof e.s&&o.clearTimeout(e.s),e.s=null)}function tB(e){if(!eJ(e.h)&&!e.s){e.s=!0;var t=e.Ga;I||F(),x||(I(),x=!0),k.add(t,e),e.B=0}}function tq(e,t){var n;n=t?t.l:e.U++;let i=e8(e.I);tt(i,"SID",e.K),tt(i,"RID",n),tt(i,"AID",e.T),t$(e,i),e.m&&e.o&&tS(i,e.m,e.o),n=new eF(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=tH(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),e1(e.h,n),eB(n,i,t)}function t$(e,t){e.H&&w(e.H,function(e,n){tt(t,n,e)}),e.l&&e3({},function(e,n){tt(t,n,e)})}function tH(e,t,n){n=Math.min(e.i.length,n);var i=e.l?c(e.l.Na,e.l,e):null;e:{var r=e.i;let t=-1;for(;;){let e=["count="+n];-1==t?0<n?(t=r[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let s=!0;for(let o=0;o<n;o++){let n=r[o].g,a=r[o].map;if(0>(n-=t))t=Math.max(0,r[o].g-100),s=!1;else try{!function(e,t,n){let i=n||"";try{e3(e,function(e,n){let r=e;l(e)&&(r=ep(e)),t.push(i+n+"="+encodeURIComponent(r))})}catch(e){throw t.push(i+"type="+encodeURIComponent("_badmap")),e}}(a,e,"req"+n+"_")}catch(e){i&&i(a)}}if(s){i=e.join("&");break e}}}return t.D=e=e.i.splice(0,n),i}function tz(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;I||F(),x||(I(),x=!0),k.add(t,e),e.v=0}}function tW(e){return!e.g&&!e.u&&!(3<=e.v)&&(e.Y++,e.u=eP(c(e.Fa,e),tX(e,e.v)),e.v++,!0)}function tK(e){null!=e.A&&(o.clearTimeout(e.A),e.A=null)}function tG(e){e.g=new eF(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=e8(e.qa);tt(t,"RID","rpc"),tt(t,"SID",e.K),tt(t,"AID",e.T),tt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&tt(t,"TO",e.ja),tt(t,"TYPE","xmlhttp"),t$(e,t),e.m&&e.o&&tS(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=tn(e8(t)),n.m=null,n.P=!0,eq(n,e)}function tQ(e){null!=e.C&&(o.clearTimeout(e.C),e.C=null)}function tY(e,t){var n,i=null;if(e.g==t){tQ(e),tK(e),e.g=null;var r=2}else{if(!e0(e.h,t))return;i=t.D,e2(e.h,t),r=1}if(0!=e.G){if(t.o)if(1==r){i=t.m?t.m.length:0,t=Date.now()-t.F;var s=e.B;ea(r=eS(),new eA(r,i)),tB(e)}else tz(e);else if(3==(s=t.s)||0==s&&0<t.X||!(1==r&&(n=t,!(eZ(e.h)>=e.h.j-!!e.s)&&(e.s?(e.i=n.D.concat(e.i),!0):1!=e.G&&2!=e.G&&!(e.B>=(e.Va?0:e.Wa))&&(e.s=eP(c(e.Ga,e,n),tX(e,e.B)),e.B++,!0)))||2==r&&tW(e)))switch(i&&0<i.length&&((t=e.h).i=t.i.concat(i)),s){case 1:tJ(e,5);break;case 4:tJ(e,10);break;case 3:tJ(e,6);break;default:tJ(e,2)}}}function tX(e,t){let n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function tJ(e,t){if(e.j.info("Error code "+t),2==t){let t,s,a;var n,i=c(e.fb,e),r=e.Xa;let l=!r;r=new e6(r||"//www.google.com/images/cleardot.gif"),o.location&&"http"==o.location.protocol||e7(r,"https"),tn(r),l?function(e,t){let n=new eD;if(o.Image){let i=new Image;i.onload=d(ty,n,"TestLoadImage: loaded",!0,t,i),i.onerror=d(ty,n,"TestLoadImage: error",!1,t,i),i.onabort=d(ty,n,"TestLoadImage: abort",!1,t,i),i.ontimeout=d(ty,n,"TestLoadImage: timeout",!1,t,i),o.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=e}else t(!1)}(r.toString(),i):(n=r.toString(),t=new eD,s=new AbortController,a=setTimeout(()=>{s.abort(),ty(t,"TestPingServer: timeout",!1,i)},1e4),fetch(n,{signal:s.signal}).then(e=>{clearTimeout(a),e.ok?ty(t,"TestPingServer: ok",!0,i):ty(t,"TestPingServer: server error",!1,i)}).catch(()=>{clearTimeout(a),ty(t,"TestPingServer: error",!1,i)}))}else eN(2);e.G=0,e.l&&e.l.sa(t),tZ(e),tU(e)}function tZ(e){if(e.G=0,e.ka=[],e.l){let t=e5(e.h);(0!=t.length||0!=e.i.length)&&(g(e.ka,t),g(e.ka,e.i),e.h.i.length=0,p(e.i),e.i.length=0),e.l.ra()}}
173function t0(e,t,n){var i=n instanceof e6?e8(n):new e6(n);if(""!=i.g)t&&(i.g=t+"."+i.g),e9(i,i.s);else{var r=o.location;i=r.protocol,t=t?t+"."+r.hostname:r.hostname,r=+r.port;var s=new e6(null);i&&e7(s,i),t&&(s.g=t),r&&e9(s,r),n&&(s.l=n),i=s}return n=e.D,t=e.ya,n&&t&&tt(i,n,t),tt(i,"VER",e.la),t$(e,i),i}function t1(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=new tI(e.Ca&&!e.pa?new tv({eb:n}):e.pa)).Ha(e.J),t}function t2(){}function t5(){}function t3(e,t){eo.call(this),this.g=new tF(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!m(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!m(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&t in(e=this.h)&&delete e[t]),this.j=new t8(this)}function t4(e){eb.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(let n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function t6(){eC.call(this),this.status=1}function t8(e){this.g=e}(n=tI.prototype).Ha=function(e){this.J=e},n.ea=function(e,n,i,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);n=n?n.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():t.g(),this.v=this.o?e_(this.o):e_(t),this.g.onreadystatechange=c(this.Ea,this);try{this.B=!0,this.g.open(n,String(e),!0),this.B=!1}catch(e){tN(this,e);return}if(e=i||"",i=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var s in r)i.set(s,r[s]);else if("function"==typeof r.keys&&"function"==typeof r.get)for(let e of r.keys())i.set(e,r.get(e));else throw Error("Unknown input type for opt_headers: "+String(r));for(let[t,a]of(r=Array.from(i.keys()).find(e=>"content-type"==e.toLowerCase()),s=o.FormData&&e instanceof o.FormData,!(0<=Array.prototype.indexOf.call(tk,n,void 0))||r||s||i.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),i))this.g.setRequestHeader(t,a);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{tR(this),this.u=!0,this.g.send(e),this.u=!1}catch(e){tN(this,e)}},n.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,ea(this,"complete"),ea(this,"abort"),tD(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),tD(this,!0)),tI.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?tP(this):this.bb())},n.bb=function(){tP(this)},n.isActive=function(){return!!this.g},n.Z=function(){try{return 2<tO(this)?this.g.status:-1}catch(e){return -1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},n.Oa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),eg(t)}},n.Ba=function(){return this.m},n.Ka=function(){return"string"==typeof this.l?this.l:String(this.l)},(n=tF.prototype).la=8,n.G=1,n.connect=function(e,t,n,i){eN(0),this.W=e,this.H=t||{},n&&void 0!==i&&(this.H.OSID=n,this.H.OAID=i),this.F=this.X,this.I=t0(this,null,this.W),tB(this)},n.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;let r=new eF(this,this.j,e),s=this.o;if(this.S&&(s?E(s=b(s),this.S):s=this.S),null!==this.m||this.O||(r.H=s,s=null),this.P)e:{for(var t=0,n=0;n<this.i.length;n++){t:{var i=this.i[n];if("__data__"in i.map&&"string"==typeof(i=i.map.__data__)){i=i.length;break t}i=void 0}if(void 0===i)break;if(4096<(t+=i)){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;
173t=tH(this,r,t),tt(n=e8(this.I),"RID",e),tt(n,"CVER",22),this.D&&tt(n,"X-HTTP-Session-Id",this.D),t$(this,n),s&&(this.O?t="headers="+encodeURIComponent(String(tT(s)))+"&"+t:this.m&&tS(n,this.m,s)),e1(this.h,r),this.Ua&&tt(n,"TYPE","init"),this.P?(tt(n,"$req",t),tt(n,"SID","null"),r.T=!0,eB(r,n,null)):eB(r,n,t),this.G=2}}else 3==this.G&&(e?tq(this,e):0==this.i.length||eJ(this.h)||tq(this))},n.Fa=function(){if(this.u=null,tG(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=eP(c(this.ab,this),e)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,eN(10),tV(this),tG(this))},n.Za=function(){null!=this.C&&(this.C=null,tV(this),tW(this),eN(19))},n.fb=function(e){e?(this.j.info("Successfully pinged google.com"),eN(2)):(this.j.info("Failed to ping google.com"),eN(1))},n.isActive=function(){return!!this.l&&this.l.isActive(this)},(n=t2.prototype).ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){},t5.prototype.g=function(e,t){return new t3(e,t)},f(t3,eo),t3.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},t3.prototype.close=function(){tj(this.g)},t3.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=ep(e),e=n);t.i.push(new eY(t.Ya++,e)),3==t.G&&tB(t)},t3.prototype.N=function(){this.g.l=null,delete this.j,tj(this.g),delete this.g,t3.aa.N.call(this)},f(t4,eb),f(t6,eC),f(t8,t2),t8.prototype.ua=function(){ea(this.g,"a")},t8.prototype.ta=function(e){ea(this.g,new t4(e))},t8.prototype.sa=function(e){ea(this.g,new t6)},t8.prototype.ra=function(){ea(this.g,"b")},t5.prototype.createWebChannel=t5.prototype.g,t3.prototype.send=t3.prototype.o,t3.prototype.open=t3.prototype.m,t3.prototype.close=t3.prototype.close,L=ow.createWebChannelTransport=function(){return new t5},M=ow.getStatEventTarget=function(){return eS()},O=ow.Event=eE,R=ow.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},eO.NO_ERROR=0,eO.TIMEOUT=8,eO.HTTP_ERROR=6,D=ow.ErrorCode=eO,eM.COMPLETE="complete",P=ow.EventType=eM,ev.EventType=ew,ew.OPEN="a",ew.CLOSE="b",ew.ERROR="c",ew.MESSAGE="d",eo.prototype.listen=eo.prototype.K,A=ow.WebChannel=ev,ow.FetchXmlHttpFactory=tv,tI.prototype.listenOnce=tI.prototype.L,tI.prototype.getLastError=tI.prototype.Ka,tI.prototype.getLastErrorCode=tI.prototype.Ba,tI.prototype.getStatus=tI.prototype.Z,tI.prototype.getResponseJson=tI.prototype.Oa,tI.prototype.getResponseText=tI.prototype.oa,tI.prototype.send=tI.prototype.ea,tI.prototype.setWithCredentials=tI.prototype.Ha,N=ow.XhrIo=tI}).apply(void 0!==ov?ov:"u">typeof self?self:"u">typeof window?window:{});let ob="@firebase/firestore",oC="4.7.9";class oE{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}}oE.UNAUTHENTICATED=new oE(null),oE.GOOGLE_CREDENTIALS=new oE("google-credentials-uid"),oE.FIRST_PARTY=new oE("first-party-uid"),oE.MOCK_USER=new oE("mock-user");let oT="11.4.0",oS=new t$("@firebase/firestore");function oI(){return oS.logLevel}function ox(e,...t){if(oS.logLevel<=I.DEBUG){let n=t.map(oA);oS.debug(`Firestore (${oT}): ${e}`,...n)}}function ok(e,...t){if(oS.logLevel<=I.ERROR){let n=t.map(oA);oS.error(`Firestore (${oT}): ${e}`,...n)}}function oN(e,...t){if(oS.logLevel<=I.WARN){let n=t.map(oA);oS.warn(`Firestore (${oT}): ${e}`,...n)}}function oA(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function oP(e="Unexpected state"){let t=`FIRESTORE (${oT}) INTERNAL ASSERTION FAILED: `+e;throw ok(t),Error(t)}let oD={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENT
173ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class oR extends tg{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class oO{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class oM{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class oL{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(oE.UNAUTHENTICATED))}shutdown(){}}class oF{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 oj{constructor(e){this.t=e,this.currentUser=oE.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){void 0===this.o||oP();let n=this.i,i=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve(),r=new oO;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new oO,e.enqueueRetryable(()=>i(this.currentUser))};let s=()=>{let t=r;e.enqueueRetryable(async()=>{await t.promise,await i(this.currentUser)})},o=e=>{ox("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(e=>o(e)),setTimeout(()=>{if(!this.auth){let e=this.t.getImmediate({optional:!0});e?o(e):(ox("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new oO)}},0),s()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(ox("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?("string"==typeof t.accessToken||oP(),new oM(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){let e=this.auth&&this.auth.getUid();return null===e||"string"==typeof e||oP(),new oE(e)}}class oV{constructor(e,t,n){this.l=e,this.h=t,this.P=n,this.type="FirstParty",this.user=oE.FIRST_PARTY,this.T=new Map}I(){return this.P?this.P():null}get headers(){this.T.set("X-Goog-AuthUser",this.l);let e=this.I();return e&&this.T.set("Authorization",e),this.h&&this.T.set("X-Goog-Iam-Authorization-Token",this.h),this.T}}class oU{constructor(e,t,n){this.l=e,this.h=t,this.P=n}getToken(){return Promise.resolve(new oV(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(oE.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class oB{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 oq{constructor(e,t){this.A=t,this.forceRefresh=!1,this.appCheck=null,this.R=null,this.V=null,nr(e)&&e.settings.appCheckToken&&(this.V=e.settings.appCheckToken)}start(e,t){void 0===this.o||oP();let n=e=>{null!=e.error&&ox("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);let n=e.token!==this.R;return this.R=e.token,ox("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>n(t))};let i=e=>{ox("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.A.onInit(e=>i(e)),setTimeout(()=>{if(!this.appCheck){let e=this.A.getImmediate({optional:!0});e?i(e):ox("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.V)return Promise.resolve(new oB(this.V));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?("string"==typeof e.token||oP(),this.R=e.token,new oB(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}function o$(e,t){return e<t?-1:+(e>t)}function oH(e,t,n){return e.length===t.length&&e.every((e,i)=>n(e,t[i]))}class oz{static now(){return oz.fromMillis(Date.now())}static fromDate(e){return oz.fromMillis(e.getTime())}static fromMillis(e){let t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*1e6);return new oz(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0||t>=1e9)throw new oR(oD.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-0xe7791f700||e>=0x3afff44180)throw new oR(oD.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?o$(this.nanoseconds,e.nanoseconds):o$(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){return String(this.seconds- -0xe7791f700).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}
173}class oW{static fromTimestamp(e){return new oW(e)}static min(){return new oW(new oz(0,0))}static max(){return new oW(new oz(0x3afff4417f,0x3b9ac9ff))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}let oK="__name__";class oG{constructor(e,t,n){void 0===t?t=0:t>e.length&&oP(),void 0===n?n=e.length-t:n>e.length-t&&oP(),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===oG.comparator(this,e)}child(e){let t=this.segments.slice(this.offset,this.limit());return e instanceof oG?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){let n=Math.min(e.length,t.length);for(let i=0;i<n;i++){let n=oG.compareSegments(e.get(i),t.get(i));if(0!==n)return n}return Math.sign(e.length-t.length)}static compareSegments(e,t){let n=oG.isNumericId(e),i=oG.isNumericId(t);return n&&!i?-1:!n&&i?1:n&&i?oG.extractNumericId(e).compare(oG.extractNumericId(t)):e<t?-1:+(e>t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return k.fromString(e.substring(4,e.length-2))}}class oQ extends oG{construct(e,t,n){return new oQ(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let t=[];for(let n of e){if(n.indexOf("//")>=0)throw new oR(oD.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new oQ(t)}static emptyPath(){return new oQ([])}}let oY=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class oX extends oG{construct(e,t,n){return new oX(e,t,n)}static isValidIdentifier(e){return oY.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),oX.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===oK}static keyField(){return new oX([oK])}static fromServerFormat(e){let t=[],n="",i=0,r=()=>{if(0===n.length)throw new oR(oD.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""},s=!1;for(;i<e.length;){let t=e[i];if("\\"===t){if(i+1===e.length)throw new oR(oD.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let t=e[i+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new oR(oD.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,i+=2}else"`"===t?s=!s:"."!==t||s?n+=t:r(),i++}if(r(),s)throw new oR(oD.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new oX(t)}static emptyPath(){return new oX([])}}class oJ{constructor(e){this.path=e}static fromPath(e){return new oJ(oQ.fromString(e))}static fromName(e){return new oJ(oQ.fromString(e).popFirst(5))}static empty(){return new oJ(oQ.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===oQ.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return oQ.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new oJ(new oQ(e.slice()))}}class oZ{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new oZ(oW.min(),oJ.empty(),-1)}static max(){return new oZ(oW.max(),oJ.empty(),-1)}}class o0{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}
173raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}class o1{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&&oP(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new o1((n,i)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,i)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,i)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{let t=e();return t instanceof o1?t:o1.resolve(t)}catch(e){return o1.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):o1.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):o1.reject(t)}static resolve(e){return new o1((t,n)=>{t(e)})}static reject(e){return new o1((t,n)=>{n(e)})}static waitFor(e){return new o1((t,n)=>{let i=0,r=0,s=!1;e.forEach(e=>{++i,e.next(()=>{++r,s&&r===i&&t()},e=>n(e))}),s=!0,r===i&&t()})}static or(e){let t=o1.resolve(!1);for(let n of e)t=t.next(e=>e?o1.resolve(e):n());return t}static forEach(e,t){let n=[];return e.forEach((e,i)=>{n.push(t.call(this,e,i))}),this.waitFor(n)}static mapArray(e,t){return new o1((n,i)=>{let r=e.length,s=Array(r),o=0;for(let a=0;a<r;a++){let l=a;t(e[l]).next(e=>{s[l]=e,++o===r&&n(s)},e=>i(e))}})}static doWhile(e,t){return new o1((n,i)=>{let r=()=>{!0===e()?t().next(()=>{r()},i):n()};r()})}}function o2(e){return"IndexedDbTransactionError"===e.name}class o5{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.oe(e),this._e=e=>t.writeSequenceNumber(e))}oe(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this._e&&this._e(e),e}}o5.ae=-1;function o3(e){return 0===e&&1/e==-1/0}function o4(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function o6(e,t){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}class o8{constructor(e,t){this.comparator=e,this.root=t||o9.EMPTY}insert(e,t){return new o8(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,o9.BLACK,null,null))}remove(e){return new o8(this.comparator,this.root.remove(e,this.comparator).copy(null,null,o9.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){let 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();){let i=this.comparator(e,n.key);if(0===i)return t+n.left.size;i<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(){let e=[];return this.inorderTraversal((t,n)=>(e.push(`${t}:${n}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new o7(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new o7(this.root,e,this.comparator,!1)}getReverseIterator(){return new o7(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new o7(this.root,e,this.comparator,!0)}}class o7{constructor(e,t,n,i){this.isReverse=i,this.nodeStack=[];let r=1;for(;!e.isEmpty();)if(r=t?n(e.key,t):1,t&&i&&(r*=-1),r<0)e=this.isReverse?e.left:e.right;else{if(0===r){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class o9{constructor(e,t,n,i,r){this.key=e,this.value=t,this.color=null!=n?n:o9.RED,this.left=null!=i?i:o9.EMPTY,this.right=null!=r?r:o9.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,i,r){return new o9(null!=e?e:this.key,null!=t?t:this.value,
173null!=n?n:this.color,null!=i?i:this.left,null!=r?r: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 i=this,r=n(e,i.key);return(i=r<0?i.copy(null,null,null,i.left.insert(e,t,n),null):0===r?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,n))).fixUp()}removeMin(){if(this.left.isEmpty())return o9.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),(e=e.copy(null,null,null,e.left.removeMin(),null)).fixUp()}remove(e,t){let n,i=this;if(0>t(e,i.key))i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===t(e,i.key)){if(i.right.isEmpty())return o9.EMPTY;n=i.right.min(),i=i.copy(n.key,n.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=(e=e.rotateRight()).colorFlip()),e}rotateLeft(){let e=this.copy(null,null,o9.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,o9.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){return Math.pow(2,this.check())<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw oP();let e=this.left.check();if(e!==this.right.check())throw oP();return e+ +!this.isRed()}}o9.EMPTY=null,o9.RED=!0,o9.BLACK=!1,o9.EMPTY=new class{constructor(){this.size=0}get key(){throw oP()}get value(){throw oP()}get color(){throw oP()}get left(){throw oP()}get right(){throw oP()}copy(e,t,n,i,r){return this}insert(e,t,n){return new o9(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 ae{constructor(e){this.comparator=e,this.data=new o8(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){let n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){let i=n.getNext();if(this.comparator(i.key,e[1])>=0)return;t(i.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){let t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new at(this.data.getIterator())}getIteratorFrom(e){return new at(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof ae)||this.size!==e.size)return!1;let t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){let e=t.getNext().key,i=n.getNext().key;if(0!==this.comparator(e,i))return!1}return!0}toArray(){let e=[];return this.forEach(t=>{e.push(t)}),e}toString(){let e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){let t=new ae(this.comparator);return t.data=e,t}}
173class at{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class an{constructor(e){this.fields=e,e.sort(oX.comparator)}static empty(){return new an([])}unionWith(e){let t=new ae(oX.comparator);for(let e of this.fields)t=t.add(e);for(let n of e)t=t.add(n);return new an(t.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return oH(this.fields,e.fields,(e,t)=>e.isEqual(t))}}class ai extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class ar{constructor(e){this.binaryString=e}static fromBase64String(e){return new ar(function(e){try{return atob(e)}catch(e){throw"u">typeof DOMException&&e instanceof DOMException?new ai("Invalid base64 string: "+e):e}}(e))}static fromUint8Array(e){return new ar(function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e))}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return btoa(this.binaryString)}toUint8Array(){var e=this.binaryString;let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return o$(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}ar.EMPTY_BYTE_STRING=new ar("");let as=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function ao(e){if(e||oP(),"string"==typeof e){let t=0,n=as.exec(e);if(n||oP(),n[1]){let e=n[1];t=Number(e=(e+"000000000").substr(0,9))}return{seconds:Math.floor(new Date(e).getTime()/1e3),nanos:t}}return{seconds:aa(e.seconds),nanos:aa(e.nanos)}}function aa(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function al(e){return"string"==typeof e?ar.fromBase64String(e):ar.fromUint8Array(e)}let ah="server_timestamp",au="__type__",ac="__previous_value__",ad="__local_write_time__";function af(e){var t,n;return(null==(n=((null==(t=null==e?void 0:e.mapValue)?void 0:t.fields)||{})[au])?void 0:n.stringValue)===ah}function ap(e){let t=ao(e.mapValue.fields[ad].timestampValue);return new oz(t.seconds,t.nanos)}let ag="(default)";class am{constructor(e,t){this.projectId=e,this.database=t||ag}static empty(){return new am("","")}get isDefaultDatabase(){return this.database===ag}isEqual(e){return e instanceof am&&e.projectId===this.projectId&&e.database===this.database}}let ay="__max__",a_={fields:{__type__:{stringValue:ay}}},av="value";function aw(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?af(e)?4:aD(e)?0x1fffffffffffff:aA(e)?10:11:oP()}function ab(e,t){if(e===t)return!0;let n=aw(e);if(n!==aw(t))return!1;switch(n){case 0:case 0x1fffffffffffff:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return ap(e).isEqual(ap(t));case 3:if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;let i=ao(e.timestampValue),r=ao(t.timestampValue);return i.seconds===r.seconds&&i.nanos===r.nanos;case 5:return e.stringValue===t.stringValue;case 6:return al(e.bytesValue).isEqual(al(t.bytesValue));case 7:return e.referenceValue===t.referenceValue;case 8:return aa(e.geoPointValue.latitude)===aa(t.geoPointValue.latitude)&&aa(e.geoPointValue.longitude)===aa(t.geoPointValue.longitude);case 2:if("integerValue"in e&&"integerValue"in t)return aa(e.integerValue)===aa(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){let n=aa(e.doubleValue),i=aa(t.doubleValue);return n===i?o3(n)===o3(i):isNaN(n)&&isNaN(i)}return!1;case 9:return oH(e.arrayValue.values||[],t.arrayValue.values||[],ab);case 10:case 11:let s=e.mapValue.fields||{},o=t.mapValue.fields||{};if(o4(s)!==o4(o))return!1;for(let e in s)if(s.hasOwnProperty(e)&&(void 0===o[e]||!ab(s[e],o[e])))return!1;return!0;default:return oP()}}function aC(e,t){return void 0!==(e.values||[]).find(e=>ab(e,t))}function aE(e,t){var n,i,r,s,o,a,l,h,u,c;if(e===t)return 0;let d=aw(e),f=aw(t);
173if(d!==f)return o$(d,f);switch(d){case 0:case 0x1fffffffffffff:return 0;case 1:return o$(e.booleanValue,t.booleanValue);case 2:let p,g;return p=aa(e.integerValue||e.doubleValue),p<(g=aa(t.integerValue||t.doubleValue))?-1:p>g?1:p===g?0:isNaN(p)?isNaN(g)?0:-1:1;case 3:return aT(e.timestampValue,t.timestampValue);case 4:return aT(ap(e),ap(t));case 5:return o$(e.stringValue,t.stringValue);case 6:let m,y;return n=e.bytesValue,i=t.bytesValue,m=al(n),y=al(i),m.compareTo(y);case 7:return function(e,t){let n=e.split("/"),i=t.split("/");for(let e=0;e<n.length&&e<i.length;e++){let t=o$(n[e],i[e]);if(0!==t)return t}return o$(n.length,i.length)}(e.referenceValue,t.referenceValue);case 8:let _;return r=e.geoPointValue,s=t.geoPointValue,0!==(_=o$(aa(r.latitude),aa(s.latitude)))?_:o$(aa(r.longitude),aa(s.longitude));case 9:return aS(e.arrayValue,t.arrayValue);case 10:let v,w,b,C,E;return o=e.mapValue,a=t.mapValue,v=o.fields||{},w=a.fields||{},b=null==(l=v[av])?void 0:l.arrayValue,C=null==(h=w[av])?void 0:h.arrayValue,0!==(E=o$((null==(u=null==b?void 0:b.values)?void 0:u.length)||0,(null==(c=null==C?void 0:C.values)?void 0:c.length)||0))?E:aS(b,C);case 11:return function(e,t){if(e===a_&&t===a_)return 0;if(e===a_)return 1;if(t===a_)return -1;let n=e.fields||{},i=Object.keys(n),r=t.fields||{},s=Object.keys(r);i.sort(),s.sort();for(let e=0;e<i.length&&e<s.length;++e){let t=o$(i[e],s[e]);if(0!==t)return t;let o=aE(n[i[e]],r[s[e]]);if(0!==o)return o}return o$(i.length,s.length)}(e.mapValue,t.mapValue);default:throw oP()}}function aT(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return o$(e,t);let n=ao(e),i=ao(t),r=o$(n.seconds,i.seconds);return 0!==r?r:o$(n.nanos,i.nanos)}function aS(e,t){let n=e.values||[],i=t.values||[];for(let e=0;e<n.length&&e<i.length;++e){let t=aE(n[e],i[e]);if(t)return t}return o$(n.length,i.length)}function aI(e){var t,n;let i;return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?(i=ao(e.timestampValue),`time(${i.seconds},${i.nanos})`):"stringValue"in e?e.stringValue:"bytesValue"in e?al(e.bytesValue).toBase64():"referenceValue"in e?(t=e.referenceValue,oJ.fromName(t).toString()):"geoPointValue"in e?(n=e.geoPointValue,`geo(${n.latitude},${n.longitude})`):"arrayValue"in e?function(e){let t="[",n=!0;for(let i of e.values||[])n?n=!1:t+=",",t+=aI(i);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){let t=Object.keys(e.fields||{}).sort(),n="{",i=!0;for(let r of t)i?i=!1:n+=",",n+=`${r}:${aI(e.fields[r])}`;return n+"}"}(e.mapValue):oP()}function ax(e){return!!e&&"integerValue"in e}function ak(e){return!!e&&"arrayValue"in e}function aN(e){return!!e&&"mapValue"in e}function aA(e){var t,n;return(null==(n=((null==(t=null==e?void 0:e.mapValue)?void 0:t.fields)||{}).__type__)?void 0:n.stringValue)==="__vector__"}function aP(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){let t={mapValue:{fields:{}}};return o6(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=aP(n)),t}if(e.arrayValue){let t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=aP(e.arrayValue.values[n]);return t}return Object.assign({},e)}function aD(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===ay}class aR{constructor(e){this.value=e}static empty(){return new aR({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(!aN(t=(t.mapValue.fields||{})[e.get(n)]))return null;return(t=(t.mapValue.fields||{})[e.lastSegment()])||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=aP(t)}setAll(e){let t=oX.emptyPath(),n={},i=[];e.forEach((e,r)=>{if(!t.isImmediateParentOf(r)){let e=this.getFieldsMap(t);this.applyChanges(e,n,i),n={},i=[],t=r.popLast()}e?n[r.lastSegment()]=aP(e):i.push(r.lastSegment())});let r=this.getFieldsMap(t);this.applyChanges(r,n,i)}delete(e){let t=this.field(e.popLast());aN(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return ab(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let i=t.mapValue.fields[e.get(n)];aN(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=i),t=i}return t.mapValue.fields}
173applyChanges(e,t,n){for(let i of(o6(t,(t,n)=>e[t]=n),n))delete e[i]}clone(){return new aR(aP(this.value))}}class aO{constructor(e,t,n,i,r,s,o){this.key=e,this.documentType=t,this.version=n,this.readTime=i,this.createTime=r,this.data=s,this.documentState=o}static newInvalidDocument(e){return new aO(e,0,oW.min(),oW.min(),oW.min(),aR.empty(),0)}static newFoundDocument(e,t,n,i){return new aO(e,1,t,oW.min(),n,i,0)}static newNoDocument(e,t){return new aO(e,2,t,oW.min(),oW.min(),aR.empty(),0)}static newUnknownDocument(e,t){return new aO(e,3,t,oW.min(),oW.min(),aR.empty(),2)}convertToFoundDocument(e,t){return this.createTime.isEqual(oW.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=aR.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=aR.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=oW.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 aO&&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 aO(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}class aM{constructor(e,t){this.position=e,this.inclusive=t}}function aL(e,t,n){let i=0;for(let r=0;r<e.position.length;r++){let s=t[r],o=e.position[r];if(i=s.field.isKeyField()?oJ.comparator(oJ.fromName(o.referenceValue),n.key):aE(o,n.data.field(s.field)),"desc"===s.dir&&(i*=-1),0!==i)break}return i}function aF(e,t){if(null===e)return null===t;if(null===t||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!ab(e.position[n],t.position[n]))return!1;return!0}class aj{constructor(e,t="asc"){this.field=e,this.dir=t}}class aV{}class aU extends aV{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 aH(e,t,n):"array-contains"===t?new aG(e,n):"in"===t?new aQ(e,n):"not-in"===t?new aY(e,n):"array-contains-any"===t?new aX(e,n):new aU(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new az(e,n):new aW(e,n)}matches(e){let t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(aE(t,this.value)):null!==t&&aw(this.value)===aw(t)&&this.matchesComparison(aE(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 oP()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class aB extends aV{constructor(e,t){super(),this.filters=e,this.op=t,this.ce=null}static create(e,t){return new aB(e,t)}matches(e){return aq(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.ce||(this.ce=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ce}getFilters(){return Object.assign([],this.filters)}}function aq(e){return"and"===e.op}function a$(e){for(let t of e.filters)if(t instanceof aB)return!1;return!0}class aH extends aU{constructor(e,t,n){super(e,t,n),this.key=oJ.fromName(n.referenceValue)}matches(e){let t=oJ.comparator(e.key,this.key);return this.matchesComparison(t)}}class az extends aU{constructor(e,t){super(e,"in",t),this.keys=aK("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class aW extends aU{constructor(e,t){super(e,"not-in",t),this.keys=aK("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function aK(e,t){var n;return((null==(n=t.arrayValue)?void 0:n.values)||[]).map(e=>oJ.fromName(e.referenceValue))}class aG extends aU{constructor(e,t){super(e,"array-contains",t)}matches(e){let t=e.data.field(this.field);return ak(t)&&aC(t.arrayValue,this.value)}}class aQ extends aU{constructor(e,t){super(e,"in",t)}matches(e){let t=e.data.field(this.field);return null!==t&&aC(this.value.arrayValue,t)}}class aY extends aU{constructor(e,t){super(e,"not-in",t)}matches(e){if(aC(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let t=e.data.field(this.field);return null!==t&&!aC(this.value.arrayValue,t)}}class aX extends aU{constructor(e,t){super(e,"array-contains-any",t)}matches(e){let t=e.data.field(this.field);return!(!ak(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>aC(this.value.arrayValue,e))}}class aJ{constructor(e,t=null,n=[],i=[],r=null,s=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=i,this.limit=r,this.startAt=s,this.endAt=o,this.le=null}}function aZ(e,t=null,n=[],i=[],r=null,s=null,o=null){return new aJ(e,t,n,i,r,s,o)}function a0(e){if(null===e.le){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(e=>(function e(t){if(t instanceof aU)return t.field.canonicalString()+t.op.toString()+aI(t.value);if(a$(t)&&aq(t))return t.filters.map(t=>e(t)).join(",");{let n=t.filters.map(t=>e(t)).join(",");return`${t.op}(${n})`}})(e)).join(","),t+="|ob:",t+=e.orderBy.map(e=>e.field.canonicalString()+e.dir).join(","),null==e.limit||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(e=>aI(e)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>aI(e)).join(",")),e.le=t}return e.le}function a1(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let r=0;r<e.orderBy.length;r++){var n,i;if(n=e.orderBy[r],i=t.orderBy[r],!(n.dir===i.dir&&n.field.isEqual(i.field)))return!1}if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!function e(t,n){return t instanceof aU?n instanceof aU&&t.op===n.op&&t.field.isEqual(n.field)&&ab(t.value,n.value):t instanceof aB?n instanceof aB&&t.op===n.op&&t.filters.length===n.filters.length&&t.filters.reduce((t,i,r)=>t&&e(i,n.filters[r]),!0):void oP()}(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!aF(e.startAt,t.startAt)&&aF(e.endAt,t.endAt)}class a2{constructor(e,t=null,n=[],i=[],r=null,s="F",o=null,a=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=i,this.limit=r,this.limitType=s,this.startAt=o,this.endAt=a,this.he=null,this.Pe=null,this.Te=null,this.startAt,this.endAt}}function a5(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 a3(e){if(null===e.he){let t;e.he=[];let n=new Set;for(let t of e.explicitOrderBy)e.he.push(t),n.add(t.field.canonicalString());let i=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";
173(t=new ae(oX.comparator),e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t).forEach(t=>{n.has(t.canonicalString())||t.isKeyField()||e.he.push(new aj(t,i))}),n.has(oX.keyField().canonicalString())||e.he.push(new aj(oX.keyField(),i))}return e.he}function a4(e){return e.Pe||(e.Pe=function(e,t){if("F"===e.limitType)return aZ(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(e=>{let t="desc"===e.dir?"asc":"desc";return new aj(e.field,t)});let n=e.endAt?new aM(e.endAt.position,e.endAt.inclusive):null,i=e.startAt?new aM(e.startAt.position,e.startAt.inclusive):null;return aZ(e.path,e.collectionGroup,t,e.filters,e.limit,n,i)}}(e,a3(e))),e.Pe}function a6(e,t,n){return new a2(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function a8(e,t){return a1(a4(e),a4(t))&&e.limitType===t.limitType}function a7(e){return`${a0(a4(e))}|lt:${e.limitType}`}function a9(e){var t;let n;return`Query(target=${n=(t=a4(e)).path.canonicalString(),null!==t.collectionGroup&&(n+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(n+=`, filters: [${t.filters.map(e=>(function e(t){return t instanceof aU?`${t.field.canonicalString()} ${t.op} ${aI(t.value)}`:t instanceof aB?t.op.toString()+" {"+t.getFilters().map(e).join(" ,")+"}":"Filter"})(e)).join(", ")}]`),null==t.limit||(n+=", limit: "+t.limit),t.orderBy.length>0&&(n+=`, orderBy: [${t.orderBy.map(e=>`${e.field.canonicalString()} (${e.dir})`).join(", ")}]`),t.startAt&&(n+=", startAt: ",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map(e=>aI(e)).join(",")),t.endAt&&(n+=", endAt: ",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map(e=>aI(e)).join(",")),`Target(${n})`}; limitType=${e.limitType})`}function le(e,t){var n,i,r,s;let o,a,l;return t.isFoundDocument()&&(o=t.key.path,null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(o):oJ.isDocumentKey(e.path)?e.path.isEqual(o):e.path.isImmediateParentOf(o))&&function(e,t){for(let n of a3(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(let n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&(n=e,i=t,(!n.startAt||(r=n.startAt,a=aL(r,a3(n),i),r.inclusive?!!(a<=0):!!(a<0)))&&(!n.endAt||(s=n.endAt,l=aL(s,a3(n),i),s.inclusive?!!(l>=0):!!(l>0))))}class lt{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n){for(let[t,i]of n)if(this.equalsFn(t,e))return i}}has(e){return void 0!==this.get(e)}set(e,t){let n=this.mapKeyFn(e),i=this.inner[n];if(void 0===i)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<i.length;n++)if(this.equalsFn(i[n][0],e))return void(i[n]=[e,t]);i.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],e))return 1===n.length?delete this.inner[t]:n.splice(i,1),this.innerSize--,!0;return!1}forEach(e){o6(this.inner,(t,n)=>{for(let[t,i]of n)e(t,i)})}isEmpty(){var e=this.inner;for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}size(){return this.innerSize}}let ln=new o8(oJ.comparator),li=new o8(oJ.comparator);function lr(...e){let t=li;for(let n of e)t=t.insert(n.key,n);return t}function ls(){return new lt(e=>e.toString(),(e,t)=>e.isEqual(t))}new o8(oJ.comparator);let lo=new ae(oJ.comparator);function la(...e){let t=lo;for(let n of e)t=t.add(n);return t}let ll=new ae(o$);class lh{constructor(){this._=void 0}}class lu extends lh{}class lc extends lh{constructor(e){super(),this.elements=e}}function ld(e,t){let n=ly(t);for(let t of e.elements)n.some(e=>ab(e,t))||n.push(t);return{arrayValue:{values:n}}}class lf extends lh{constructor(e){super(),this.elements=e}}function lp(e,t){let n=ly(t);for(let t of e.elements)n=n.filter(e=>!ab(e,t));return{arrayValue:{values:n}}}class lg extends lh{constructor(e,t){super(),this.serializer=e,this.Ie=t}}function lm(e){return aa(e.integerValue||e.doubleValue)}function ly(e){return ak(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class l_{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new l_}static exists(e){return new l_(void 0,e)}static updateTime(e){return new l_(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 lv(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class lw{}function lb(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new lN(e.key,l_.none()):new lT(e.key,e.data,l_.none());{let n=e.data,i=aR.empty(),r=new ae(oX.comparator);for(let e of t.fields)if(!r.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?i.delete(e):i.set(e,t),r=r.add(e)}return new lS(e.key,i,new an(r.toArray()),l_.none())}}function lC(e,t,n,i){return e instanceof lT?function(e,t,n,i){if(!lv(e.precondition,t))return n;let r=e.value.clone(),s=lk(e.fieldTransforms,i,t);return r.setAll(s),t.convertToFoundDocument(t.version,r).setHasLocalMutations(),null}(e,t,n,i):e instanceof lS?function(e,t,n,i){if(!lv(e.precondition,t))return n;let r=lk(e.fieldTransforms,i,t),s=t.data;return(s.setAll(lI(e)),s.setAll(r),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null===n)?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,i):lv(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}function lE(e,t){var n,i;return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&(n=e.fieldTransforms,i=t.fieldTransforms,!!(void 0===n&&void 0===i||!(!n||!i)&&oH(n,i,(e,t)=>{var n,i;return e.field.isEqual(t.field)&&(n=e.transform,i=t.transform,n instanceof lc&&i instanceof lc||n instanceof lf&&i instanceof lf?oH(n.elements,i.elements,ab):n instanceof lg&&i instanceof lg?ab(n.Ie,i.Ie):n instanceof lu&&i instanceof lu)})))&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class lT extends lw{constructor(e,t,n,i=[]){super(),this.key=e,this.value=t,this.prec
173ondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class lS extends lw{constructor(e,t,n,i,r=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=i,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function lI(e){let t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){let i=e.data.field(n);t.set(n,i)}}),t}function lx(e,t,n){let i=new Map;e.length===n.length||oP();for(let s=0;s<n.length;s++){var r;let o=e[s],a=o.transform,l=t.data.field(o.field);i.set(o.field,(r=n[s],a instanceof lc?ld(a,l):a instanceof lf?lp(a,l):r))}return i}function lk(e,t,n){let i=new Map;for(let r of e){let e=r.transform,s=n.data.field(r.field);i.set(r.field,function(e,t,n){var i;let r,s,o;return e instanceof lu?(i=t,r={fields:{[au]:{stringValue:ah},[ad]:{timestampValue:{seconds:n.seconds,nanos:n.nanoseconds}}}},i&&af(i)&&(i=function e(t){let n=t.mapValue.fields[ac];return af(n)?e(n):n}(i)),i&&(r.fields[ac]=i),{mapValue:r}):e instanceof lc?ld(e,t):e instanceof lf?lp(e,t):(o=lm(s=function(e,t){return e instanceof lg?ax(t)||t&&"doubleValue"in t?t:{integerValue:0}:null}(e,t))+lm(e.Ie),ax(s)&&ax(e.Ie)?{integerValue:""+o}:function(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:o3(t)?"-0":t}}(e.serializer,o))}(e,s,t))}return i}class lN extends lw{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class lA{constructor(e,t,n,i){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=i}applyToRemoteDocument(e,t){let n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){let i=this.mutations[t];i.key.isEqual(e.key)&&function(e,t,n){let i,r;e instanceof lT?(i=e.value.clone(),r=lx(e.fieldTransforms,t,n.transformResults),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()):e instanceof lS?function(e,t,n){if(!lv(e.precondition,t))return t.convertToUnknownDocument(n.version);let i=lx(e.fieldTransforms,t,n.transformResults),r=t.data;r.setAll(lI(e)),r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):t.convertToNoDocument(n.version).setHasCommittedMutations()}(i,e,n[t])}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=lC(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=lC(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=ls();return this.mutations.forEach(i=>{let r=e.get(i.key),s=r.overlayedDocument,o=this.applyToLocalView(s,r.mutatedFields),a=lb(s,o=t.has(i.key)?null:o);null!==a&&n.set(i.key,a),s.isValidDocument()||s.convertToNoDocument(oW.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),la())}isEqual(e){return this.batchId===e.batchId&&oH(this.mutations,e.mutations,(e,t)=>lE(e,t))&&oH(this.baseMutations,e.baseMutations,(e,t)=>lE(e,t))}}class lP{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{
174      largestBatchId: ${this.largestBatchId},
175      mutation: ${this.mutation.toString()}
176    }`}}(j=F||(F={}))[j.OK=0]="OK",j[j.CANCELLED=1]="CANCELLED",j[j.UNKNOWN=2]="UNKNOWN",j[j.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",j[j.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",j[j.NOT_FOUND=5]="NOT_FOUND",j[j.ALREADY_EXISTS=6]="ALREADY_EXISTS",j[j.PERMISSION_DENIED=7]="PERMISSION_DENIED",j[j.UNAUTHENTICATED=16]="UNAUTHENTICATED",j[j.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",j[j.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",j[j.ABORTED=10]="ABORTED",j[j.OUT_OF_RANGE=11]="OUT_OF_RANGE",j[j.UNIMPLEMENTED=12]="UNIMPLEMENTED",j[j.INTERNAL=13]="INTERNAL",j[j.UNAVAILABLE=14]="UNAVAILABLE",j[j.DATA_LOSS=15]="DATA_LOSS",new k([0xffffffff,0xffffffff],0);class lD{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function lR(e){let t;return e||oP(),oW.fromTimestamp(new oz((t=ao(e)).seconds,t.nanos))}function lO(e,t){let n=new oQ(["projects",e.projectId,"databases",e.database]).child("documents");return void 0===t?n:n.child(t)}function lM(e){return oX.fromServerFormat(e.fieldPath)}class lL{constructor(e){this.Tt=e}}class lF{At(e,t){this.Rt(e,t),t.Vt()}Rt(e,t){if("nullValue"in e)this.ft(t,5);else if("booleanValue"in e)this.ft(t,10),t.gt(+!!e.booleanValue);else if("integerValue"in e)this.ft(t,15),t.gt(aa(e.integerValue));else if("doubleValue"in e){let n=aa(e.doubleValue);isNaN(n)?this.ft(t,13):(this.ft(t,15),o3(n)?t.gt(0):t.gt(n))}else if("timestampValue"in e){let n=e.timestampValue;this.ft(t,20),"string"==typeof n&&(n=ao(n)),t.yt(`${n.seconds||""}`),t.gt(n.nanos||0)}else if("stringValue"in e)this.wt(e.stringValue,t),this.bt(t);else if("bytesValue"in e)this.ft(t,30),t.St(al(e.bytesValue)),this.bt(t);else if("referenceValue"in e)this.Dt(e.referenceValue,t);else if("geoPointValue"in e){let n=e.geoPointValue;this.ft(t,45),t.gt(n.latitude||0),t.gt(n.longitude||0)}else"mapValue"in e?aD(e)?this.ft(t,Number.MAX_SAFE_INTEGER):aA(e)?this.vt(e.mapValue,t):(this.Ct(e.mapValue,t),this.bt(t)):"arrayValue"in e?(this.Ft(e.arrayValue,t),this.bt(t)):oP()}wt(e,t){this.ft(t,25),this.Mt(e,t)}Mt(e,t){t.yt(e)}Ct(e,t){let n=e.fields||{};
176for(let e of(this.ft(t,55),Object.keys(n)))this.wt(e,t),this.Rt(n[e],t)}vt(e,t){var n,i;let r=e.fields||{};this.ft(t,53);let s=(null==(i=null==(n=r[av].arrayValue)?void 0:n.values)?void 0:i.length)||0;this.ft(t,15),t.gt(aa(s)),this.wt(av,t),this.Rt(r[av],t)}Ft(e,t){let n=e.values||[];for(let e of(this.ft(t,50),n))this.Rt(e,t)}Dt(e,t){this.ft(t,37),oJ.fromName(e).path.forEach(e=>{this.ft(t,60),this.Mt(e,t)})}ft(e,t){e.gt(t)}bt(e){e.gt(2)}}lF.xt=new lF;class lj{constructor(){this.Tn=new lV}addToCollectionParentIndex(e,t){return this.Tn.add(t),o1.resolve()}getCollectionParents(e,t){return o1.resolve(this.Tn.getEntries(t))}addFieldIndex(e,t){return o1.resolve()}deleteFieldIndex(e,t){return o1.resolve()}deleteAllFieldIndexes(e){return o1.resolve()}createTargetIndexes(e,t){return o1.resolve()}getDocumentsMatchingTarget(e,t){return o1.resolve(null)}getIndexType(e,t){return o1.resolve(0)}getFieldIndexes(e,t){return o1.resolve([])}getNextCollectionGroupToUpdate(e){return o1.resolve(null)}getMinOffset(e,t){return o1.resolve(oZ.min())}getMinOffsetFromCollectionGroup(e,t){return o1.resolve(oZ.min())}updateCollectionGroup(e,t,n){return o1.resolve()}updateIndexEntries(e,t){return o1.resolve()}}class lV{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),i=this.index[t]||new ae(oQ.comparator),r=!i.has(n);return this.index[t]=i.add(n),r}has(e){let t=e.lastSegment(),n=e.popLast(),i=this.index[t];return i&&i.has(n)}getEntries(e){return(this.index[e]||new ae(oQ.comparator)).toArray()}}new Uint8Array(0);class lU{static withCacheSize(e){return new lU(e,lU.DEFAULT_COLLECTION_PERCENTILE,lU.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}}lU.DEFAULT_COLLECTION_PERCENTILE=10,lU.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,lU.DEFAULT=new lU(0x2800000,lU.DEFAULT_COLLECTION_PERCENTILE,lU.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),lU.DISABLED=new lU(-1,0,0);class lB{constructor(e){this.$n=e}next(){return this.$n+=2,this.$n}static Kn(){return new lB(0)}static Un(){return new lB(-1)}}class lq{constructor(){this.changes=new lt(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,aO.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return void 0!==n?o1.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 l${constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class lH{constructor(e,t,n,i){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=i}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(i=>(n=i,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==n&&lC(n.mutation,e,an.empty(),oz.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,la()).next(()=>t))}getLocalViewOfDocuments(e,t,n=la()){let i=ls();return this.populateOverlays(e,i,t).next(()=>this.computeViews(e,t,i,n).next(e=>{let t=lr();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){let n=ls();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,la()))}populateOverlays(e,t,n){let i=[];return n.forEach(e=>{t.has(e)||i.push(e)}),this.documentOverlayCache.getOverlays(e,i).next(e=>{e.forEach((e,n)=>{t.set(e,n)})})}computeViews(e,t,n,i){let r=ln,s=ls(),o=ls();return t.forEach((e,t)=>{let o=n.get(t.key);i.has(t.key)&&(void 0===o||o.mutation instanceof lS)?r=r.insert(t.key,t):void 0!==o?(s.set(t.key,o.mutation.getFieldMask()),lC(o.mutation,t,o.mutation.getFieldMask(),oz.now())):s.set(t.key,an.empty())}),this.recalculateAndSaveOverlays(e,r).next(e=>(e.forEach((e,t)=>s.set(e,t)),t.forEach((e,t)=>{var n;return o.set(e,new l$(t,null!=(n=s.get(e))?n:null))}),o))}recalculateAndSaveOverlays(e,t){let n=ls(),i=new o8((e,t)=>
176e-t),r=la();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(let r of e)r.keys().forEach(e=>{let s=t.get(e);if(null===s)return;let o=n.get(e)||an.empty();o=r.applyToLocalView(s,o),n.set(e,o);let a=(i.get(r.batchId)||la()).add(e);i=i.insert(r.batchId,a)})}).next(()=>{let s=[],o=i.getReverseIterator();for(;o.hasNext();){let i=o.getNext(),a=i.key,l=i.value,h=ls();l.forEach(e=>{if(!r.has(e)){let i=lb(t.get(e),n.get(e));null!==i&&h.set(e,i),r=r.add(e)}}),s.push(this.documentOverlayCache.saveOverlays(e,a,h))}return o1.waitFor(s)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n,i){return oJ.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length?this.getDocumentsMatchingDocumentQuery(e,t.path):null!==t.collectionGroup?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,i):this.getDocumentsMatchingCollectionQuery(e,t,n,i)}getNextDocuments(e,t,n,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,i).next(r=>{let s=i-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,i-r.size):o1.resolve(ls()),o=-1,a=r;return s.next(t=>o1.forEach(t,(t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),r.get(t)?o1.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{a=a.insert(t,e)}))).next(()=>this.populateOverlays(e,t,r)).next(()=>this.computeViews(e,a,t,la())).next(e=>{let t;return{batchId:o,changes:(t=li,e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t)}}))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new oJ(t)).next(e=>{let t=lr();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n,i){let r=t.collectionGroup,s=lr();return this.indexManager.getCollectionParents(e,r).next(o=>o1.forEach(o,o=>{let a=new a2(o.child(r),null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt);return this.getDocumentsMatchingCollectionQuery(e,a,n,i).next(e=>{e.forEach((e,t)=>{s=s.insert(e,t)})})}).next(()=>s))}getDocumentsMatchingCollectionQuery(e,t,n,i){let r;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(s=>(r=s,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,r,i))).next(e=>{r.forEach((t,n)=>{let i=n.getKey();null===e.get(i)&&(e=e.insert(i,aO.newInvalidDocument(i)))});let n=lr();return e.forEach((e,i)=>{let s=r.get(e);void 0!==s&&lC(s.mutation,i,an.empty(),oz.now()),le(t,i)&&(n=n.insert(e,i))}),n})}}class lz{constructor(e){this.serializer=e,this.dr=new Map,this.Ar=new Map}getBundleMetadata(e,t){return o1.resolve(this.dr.get(t))}saveBundleMetadata(e,t){return this.dr.set(t.id,{id:t.id,version:t.version,createTime:lR(t.createTime)}),o1.resolve()}getNamedQuery(e,t){return o1.resolve(this.Ar.get(t))}saveNamedQuery(e,t){var n;let i;return this.Ar.set(t.name,{name:t.name,query:(i=function(e){var t,n,i,r,s,o,a;let l,h,u,c,d,f,p=(s=e.parent,(o=l=oQ.fromString(s)).length>=4&&"projects"===o.get(0)&&"databases"===o.get(2)||oP(),4===(h=l).length?oQ.emptyPath():((a=h).length>4&&"documents"===a.get(4)||oP(),a.popFirst(5))),g=e.structuredQuery,m=g.from?g.from.length:0,y=null;if(m>0){1===m||oP();let e=g.from[0];e.allDescendants?y=e.collectionId:p=p.child(e.collectionId)}let _=[];g.where&&(_=(u=function e(t){return void 0!==t.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":let t=lM(e.unaryFilter.field);return aU.create(t,"==",{doubleValue:NaN});case"IS_NULL":let n=lM(e.unaryFilter.field);return aU.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let i=lM(e.unaryFilter.field);return aU.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let r=lM(e.unaryFilter.field);return aU.create(r,"!=",{nullValue:"NULL_VALUE"});default:return oP()}}(t):void 0!==t.fieldFilter?aU.create(lM(t.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return oP()}}(t.fieldFilter.op),t.fieldFilter.value):void 0!==t.compositeFilter?aB.create(t.compositeFilter.filters.map(t=>e(t)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return oP()}}(t.compositeFilter.op)):oP()}(g.where))instanceof aB&&a$(t=u)&&aq(t)?u.getFilters():[u]);let v=[];g.orderBy&&(v=g.orderBy.map(e=>new aj(lM(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))));let w=null;g.limit&&(w=null==(c="object"==typeof(n=g.limit)?n.value:n)?null:c);let b=null;g.startAt&&(d=!!(i=g.startAt).before,b=new aM(i.values||[],d));let C=null;return g.endAt&&(f=!(r=g.endAt).before,C=new aM(r.values||[],f)),new a2(p,y,v,_,w,"F",b,C)}({parent:(n=t.bundledQuery).parent,structuredQuery:n.structuredQuery}
176),"LAST"===n.limitType?a6(i,i.limit,"L"):i),readTime:lR(t.readTime)}),o1.resolve()}}class lW{constructor(){this.overlays=new o8(oJ.comparator),this.Rr=new Map}getOverlay(e,t){return o1.resolve(this.overlays.get(t))}getOverlays(e,t){let n=ls();return o1.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,i)=>{this.Et(e,t,i)}),o1.resolve()}removeOverlaysForBatchId(e,t,n){let i=this.Rr.get(n);return void 0!==i&&(i.forEach(e=>this.overlays=this.overlays.remove(e)),this.Rr.delete(n)),o1.resolve()}getOverlaysForCollection(e,t,n){let i=ls(),r=t.length+1,s=new oJ(t.child("")),o=this.overlays.getIteratorFrom(s);for(;o.hasNext();){let e=o.getNext().value,s=e.getKey();if(!t.isPrefixOf(s.path))break;s.path.length===r&&e.largestBatchId>n&&i.set(e.getKey(),e)}return o1.resolve(i)}getOverlaysForCollectionGroup(e,t,n,i){let r=new o8((e,t)=>e-t),s=this.overlays.getIterator();for(;s.hasNext();){let e=s.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=r.get(e.largestBatchId);null===t&&(t=ls(),r=r.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}let o=ls(),a=r.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach((e,t)=>o.set(e,t)),!(o.size()>=i)););return o1.resolve(o)}Et(e,t,n){let i=this.overlays.get(n.key);if(null!==i){let e=this.Rr.get(i.largestBatchId).delete(n.key);this.Rr.set(i.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new lP(t,n));let r=this.Rr.get(t);void 0===r&&(r=la(),this.Rr.set(t,r)),this.Rr.set(t,r.add(n.key))}}class lK{constructor(){this.sessionToken=ar.EMPTY_BYTE_STRING}getSessionToken(e){return o1.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,o1.resolve()}}class lG{constructor(){this.Vr=new ae(lQ.mr),this.gr=new ae(lQ.pr)}isEmpty(){return this.Vr.isEmpty()}addReference(e,t){let n=new lQ(e,t);this.Vr=this.Vr.add(n),this.gr=this.gr.add(n)}yr(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.wr(new lQ(e,t))}br(e,t){e.forEach(e=>this.removeReference(e,t))}Sr(e){let t=new oJ(new oQ([])),n=new lQ(t,e),i=new lQ(t,e+1),r=[];return this.gr.forEachInRange([n,i],e=>{this.wr(e),r.push(e.key)}),r}Dr(){this.Vr.forEach(e=>this.wr(e))}wr(e){this.Vr=this.Vr.delete(e),this.gr=this.gr.delete(e)}vr(e){let t=new oJ(new oQ([])),n=new lQ(t,e),i=new lQ(t,e+1),r=la();return this.gr.forEachInRange([n,i],e=>{r=r.add(e.key)}),r}containsKey(e){let t=new lQ(e,0),n=this.Vr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class lQ{constructor(e,t){this.key=e,this.Cr=t}static mr(e,t){return oJ.comparator(e.key,t.key)||o$(e.Cr,t.Cr)}static pr(e,t){return o$(e.Cr,t.Cr)||oJ.comparator(e.key,t.key)}}class lY{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Fr=1,this.Mr=new ae(lQ.mr)}checkEmpty(e){return o1.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,i){let r=this.Fr;this.Fr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let s=new lA(r,t,n,i);for(let t of(this.mutationQueue.push(s),i))this.Mr=this.Mr.add(new lQ(t.key,r)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return o1.resolve(s)}lookupMutationBatch(e,t){return o1.resolve(this.Or(t))}getNextMutationBatchAfterBatchId(e,t){let n=this.Nr(t+1),i=n<0?0:n;return o1.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return o1.resolve(0===this.mutationQueue.length?-1:this.Fr-1)}getAllMutationBatches(e){return o1.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new lQ(t,0),i=new lQ(t,1/0),r=[];return this.Mr.forEachInRange([n,i],e=>{let t=this.Or(e.Cr);r.push(t)}),o1.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new ae(o$);return t.forEach(e=>{let t=new lQ(e,0),i=new lQ(e,1/0);this.Mr.forEachInRange([t,i],e=>{n=n.add(e.Cr)})}),o1.resolve(this.Br(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,i=n.length+1,r=n;oJ.isDocumentKey(r)||(r=r.child(""));let s=new lQ(new oJ(r),0),o=new ae(o$);return this.Mr.forEachWhile(e=>{let t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===i&&(o=o.add(e.Cr)),!0)},s),o1.resolve(this.Br(o))}Br(e){let t=[];
176return e.forEach(e=>{let n=this.Or(e);null!==n&&t.push(n)}),t}removeMutationBatch(e,t){0===this.Lr(t.batchId,"removed")||oP(),this.mutationQueue.shift();let n=this.Mr;return o1.forEach(t.mutations,i=>{let r=new lQ(i.key,t.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Mr=n})}qn(e){}containsKey(e,t){let n=new lQ(t,0),i=this.Mr.firstAfterOrEqual(n);return o1.resolve(t.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,o1.resolve()}Lr(e,t){return this.Nr(e)}Nr(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Or(e){let t=this.Nr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class lX{constructor(e){this.kr=e,this.docs=new o8(oJ.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let n=t.key,i=this.docs.get(n),r=i?i.size:0,s=this.kr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:s}),this.size+=s-r,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){let t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){let n=this.docs.get(t);return o1.resolve(n?n.document.mutableCopy():aO.newInvalidDocument(t))}getEntries(e,t){let n=ln;return t.forEach(e=>{let t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():aO.newInvalidDocument(e))}),o1.resolve(n)}getDocumentsMatchingQuery(e,t,n,i){let r=ln,s=t.path,o=new oJ(s.child("__id-9223372036854775808__")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){let{key:e,value:{document:o}}=a.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||0>=function(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n||0!==(n=oJ.comparator(e.documentKey,t.documentKey))?n:o$(e.largestBatchId,t.largestBatchId)}
176(new oZ(o.readTime,o.key,-1),n)||(i.has(o.key)||le(t,o))&&(r=r.insert(o.key,o.mutableCopy()))}return o1.resolve(r)}getAllFromCollectionGroup(e,t,n,i){oP()}qr(e,t){return o1.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new lJ(this)}getSize(e){return o1.resolve(this.size)}}class lJ extends lq{constructor(e){super(),this.Ir=e}applyChanges(e){let t=[];return this.changes.forEach((n,i)=>{i.isValidDocument()?t.push(this.Ir.addEntry(e,i)):this.Ir.removeEntry(n)}),o1.waitFor(t)}getFromCache(e,t){return this.Ir.getEntry(e,t)}getAllFromCache(e,t){return this.Ir.getEntries(e,t)}}class lZ{constructor(e){this.persistence=e,this.Qr=new lt(e=>a0(e),a1),this.lastRemoteSnapshotVersion=oW.min(),this.highestTargetId=0,this.$r=0,this.Kr=new lG,this.targetCount=0,this.Ur=lB.Kn()}forEachTarget(e,t){return this.Qr.forEach((e,n)=>t(n)),o1.resolve()}getLastRemoteSnapshotVersion(e){return o1.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return o1.resolve(this.$r)}allocateTargetId(e){return this.highestTargetId=this.Ur.next(),o1.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.$r&&(this.$r=t),o1.resolve()}zn(e){this.Qr.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.Ur=new lB(t),this.highestTargetId=t),e.sequenceNumber>this.$r&&(this.$r=e.sequenceNumber)}addTargetData(e,t){return this.zn(t),this.targetCount+=1,o1.resolve()}updateTargetData(e,t){return this.zn(t),o1.resolve()}removeTargetData(e,t){return this.Qr.delete(t.target),this.Kr.Sr(t.targetId),this.targetCount-=1,o1.resolve()}removeTargets(e,t,n){let i=0,r=[];return this.Qr.forEach((s,o)=>{o.sequenceNumber<=t&&null===n.get(o.targetId)&&(this.Qr.delete(s),r.push(this.removeMatchingKeysForTargetId(e,o.targetId)),i++)}),o1.waitFor(r).next(()=>i)}getTargetCount(e){return o1.resolve(this.targetCount)}getTargetData(e,t){let n=this.Qr.get(t)||null;return o1.resolve(n)}addMatchingKeys(e,t,n){return this.Kr.yr(t,n),o1.resolve()}removeMatchingKeys(e,t,n){this.Kr.br(t,n);let i=this.persistence.referenceDelegate,r=[];return i&&t.forEach(t=>{r.push(i.markPotentiallyOrphaned(e,t))}),o1.waitFor(r)}removeMatchingKeysForTargetId(e,t){return this.Kr.Sr(t),o1.resolve()}getMatchingKeysForTargetId(e,t){let n=this.Kr.vr(t);return o1.resolve(n)}containsKey(e,t){return o1.resolve(this.Kr.containsKey(t))}}class l0{constructor(e,t){this.Wr={},this.overlays={},this.Gr=new o5(0),this.zr=!1,this.zr=!0,this.jr=new lK,this.referenceDelegate=e(this),this.Hr=new lZ(this),this.indexManager=new lj,this.remoteDocumentCache=function(e){return new lX(e)}(e=>this.referenceDelegate.Jr(e)),this.serializer=new lL(t),this.Yr=new lz(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.zr=!1,Promise.resolve()}get started(){return this.zr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new lW,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.Wr[e.toKey()];return n||(n=new lY(t,this.referenceDelegate),this.Wr[e.toKey()]=n),n}getGlobalsCache(){return this.jr}getTargetCache(){return this.Hr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Yr}runTransaction(e,t,n){ox("MemoryPersistence","Starting transaction:",e);let i=new l1(this.Gr.next());return this.referenceDelegate.Zr(),n(i).next(e=>this.referenceDelegate.Xr(i).next(()=>e)).toPromise().then(e=>(i.raiseOnCommittedEvent(),e))}ei(e,t){return o1.or(Object.values(this.Wr).map(n=>()=>n.containsKey(e,t)))}}class l1 extends o0{constructor(e){super(),this.currentSequenceNumber=e}}class l2{constructor(e){this.persistence=e,this.ti=new lG,this.ni=null}static ri(e){return new l2(e)}get ii(){if(this.ni)return this.ni;throw oP()}addReference(e,t,n){return this.ti.addReference(n,t),this.ii.delete(n.toString()),o1.resolve()}removeReference(e,t,n){return this.ti.removeReference(n,t),this.ii.add(n.toString()),o1.resolve()}markPotentiallyOrphaned(e,t){return this.ii.add(t.toString()),o1.resolve()}
176removeTarget(e,t){this.ti.Sr(t.targetId).forEach(e=>this.ii.add(e.toString()));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.ii.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}Zr(){this.ni=new Set}Xr(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return o1.forEach(this.ii,n=>{let i=oJ.fromPath(n);return this.si(e,i).next(e=>{e||t.removeEntry(i,oW.min())})}).next(()=>(this.ni=null,t.apply(e)))}updateLimboDocument(e,t){return this.si(e,t).next(e=>{e?this.ii.delete(t.toString()):this.ii.add(t.toString())})}Jr(e){return 0}si(e,t){return o1.or([()=>o1.resolve(this.ti.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.ei(e,t)])}}class l5{constructor(e,t,n,i){this.targetId=e,this.fromCache=t,this.Hi=n,this.Ji=i}static Yi(e,t){let n=la(),i=la();for(let e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:i=i.add(e.doc.key)}return new l5(e,t.fromCache,n,i)}}class l3{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class l4{constructor(){this.Zi=!1,this.Xi=!1,this.es=100,this.ts=function(){let t;return!function(){var t;let n=null==(t=ta())?void 0:t.forceEnvironment;if("node"===n)return!0;if("browser"===n)return!1;try{return"[object process]"===Object.prototype.toString.call(e.g.process)}catch(e){return!1}}()&&navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")?8:Number((t=td().match(/Android ([\d.]+)/i))?t[1].split(".").slice(0,2).join("."):"-1")>0?6:4}()}initialize(e,t){this.ns=e,this.indexManager=t,this.Zi=!0}getDocumentsMatchingQuery(e,t,n,i){let r={result:null};return this.rs(e,t).next(e=>{r.result=e}).next(()=>{if(!r.result)return this.ss(e,t,i,n).next(e=>{r.result=e})}).next(()=>{if(r.result)return;let n=new l3;return this._s(e,t,n).next(i=>{if(r.result=i,this.Xi)return this.us(e,t,n,i.size)})}).next(()=>r.result)}us(e,t,n,i){return n.documentReadCount<this.es?(oI()<=I.DEBUG&&ox("QueryEngine","SDK will not create cache indexes for query:",a9(t),"since it only creates cache indexes for collection contains","more than or equal to",this.es,"documents"),o1.resolve()):(oI()<=I.DEBUG&&ox("QueryEngine","Query:",a9(t),"scans",n.documentReadCount,"local documents and returns",i,"documents as results."),n.documentReadCount>this.ts*i?(oI()<=I.DEBUG&&ox("QueryEngine","The SDK decides to create cache indexes for query:",a9(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,a4(t))):o1.resolve())}rs(e,t){if(a5(t))return o1.resolve(null);let n=a4(t);return this.indexManager.getIndexType(e,n).next(i=>0===i?null:(null!==t.limit&&1===i&&(n=a4(t=a6(t,null,"F"))),this.indexManager.getDocumentsMatchingTarget(e,n).next(i=>{let r=la(...i);return this.ns.getDocuments(e,r).next(i=>this.indexManager.getMinOffset(e,n).next(n=>{let s=this.cs(t,i);return this.ls(t,s,r,n.readTime)?this.rs(e,a6(t,null,"F")):this.hs(e,s,t,n)}))})))}ss(e,t,n,i){return a5(t)||i.isEqual(oW.min())?o1.resolve(null):this.ns.getDocuments(e,n).next(r=>{let s,o,a=this.cs(t,r);return this.ls(t,a,n,i)?o1.resolve(null):(oI()<=I.DEBUG&&ox("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),a9(t)),this.hs(e,a,t,(s=i.toTimestamp().seconds,o=i.toTimestamp().nanoseconds+1,new oZ(oW.fromTimestamp(1e9===o?new oz(s+1,0):new oz(s,o)),oJ.empty(),-1))).next(e=>e))})}cs(e,t){let n=new ae((t,n)=>{let i=!1;for(let r of a3(e)){let e=function(e,t,n){var i;let r,s,o=e.field.isKeyField()?oJ.comparator(t.key,n.key):(i=e.field,r=t.data.field(i),s=n.data.field(i),null!==r&&null!==s?aE(r,s):oP());switch(e.dir){case"asc":return o;case"desc":return -1*o;default:return oP()}}(r,t,n);if(0!==e)return e;i=i||r.field.isKeyField()}return 0});return t.forEach((t,i)=>{le(e,i)&&(n=n.add(i))}),n}ls(e,t,n,i){if(null===e.limit)return!1;if(n.size!==t.size)return!0;let r="F"===e.limitType?t.last():t.first();return!!r&&(r.hasPendingWrites||r.version.compareTo(i)>0)}_s(e,t,n){return oI()<=I.DEBUG&&ox("QueryEngine","Using full collection scan to execute query:",a9(t)),this.ns.getDocumentsMatchingQuery(e,t,oZ.min(),n)}hs(e,t,n,i){return this.ns.getDocumentsMatchingQuery(e,n,i).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}class l6{constructor(e,t,n,i){this.persistence=e,this.Ps=t,this.serializer
176=i,this.Ts=new o8(o$),this.Is=new lt(e=>a0(e),a1),this.Es=new Map,this.ds=e.getRemoteDocumentCache(),this.Hr=e.getTargetCache(),this.Yr=e.getBundleCache(),this.As(n)}As(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new lH(this.ds,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ds.setIndexManager(this.indexManager),this.Ps.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Ts))}}async function l8(e,t){return await e.persistence.runTransaction("Handle user change","readonly",n=>{let i;return e.mutationQueue.getAllMutationBatches(n).next(r=>(i=r,e.As(t),e.mutationQueue.getAllMutationBatches(n))).next(t=>{let r=[],s=[],o=la();for(let e of i)for(let t of(r.push(e.batchId),e.mutations))o=o.add(t.key);for(let e of t)for(let t of(s.push(e.batchId),e.mutations))o=o.add(t.key);return e.localDocuments.getDocuments(n,o).next(e=>({Rs:e,removedBatchIds:r,addedBatchIds:s}))})})}class l7{constructor(){this.activeTargetIds=ll}Ds(e){this.activeTargetIds=this.activeTargetIds.add(e)}vs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ss(){return JSON.stringify({activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()})}}class l9{constructor(){this.ho=new l7,this.Po={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.ho.Ds(e),this.Po[e]||"not-current"}updateQueryState(e,t,n){this.Po[e]=t}removeLocalQueryTarget(e){this.ho.vs(e)}isLocalQueryTarget(e){return this.ho.activeTargetIds.has(e)}clearQueryState(e){delete this.Po[e]}getAllActiveQueryTargets(){return this.ho.activeTargetIds}isActiveQueryTarget(e){return this.ho.activeTargetIds.has(e)}start(){return this.ho=new l7,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class he{To(e){}shutdown(){}}let ht="ConnectivityMonitor";class hn{constructor(){this.Io=()=>this.Eo(),this.Ao=()=>this.Ro(),this.Vo=[],this.mo()}To(e){this.Vo.push(e)}shutdown(){window.removeEventListener("online",this.Io),window.removeEventListener("offline",this.Ao)}mo(){window.addEventListener("online",this.Io),window.addEventListener("offline",this.Ao)}Eo(){for(let e of(ox(ht,"Network connectivity changed: AVAILABLE"),this.Vo))e(0)}Ro(){for(let e of(ox(ht,"Network connectivity changed: UNAVAILABLE"),this.Vo))e(1)}static D(){return"u">typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let hi=null;function hr(){return null===hi?hi=0x10000000+Math.round(0x80000000*Math.random()):hi++,"0x"+hi.toString(16)}let hs="RestConnection",ho={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class ha{get fo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.po=t+"://"+e.host,this.yo=`projects/${n}/databases/${i}`,this.wo=this.databaseId.database===ag?`project_id=${n}`:`project_id=${n}&database_id=${i}`}bo(e,t,n,i,r){let s=hr(),o=this.So(e,t.toUriEncodedString());ox(hs,`Sending RPC '${e}' ${s}:`,o,n);let a={"google-cloud-resource-prefix":this.yo,"x-goog-request-params":this.wo};return this.Do(a,i,r),this.vo(e,o,a,n).then(t=>(ox(hs,`Received RPC '${e}' ${s}: `,t),t),t=>{throw oN(hs,`RPC '${e}' ${s} failed with error: `,t,"url: ",o,"request:",n),t})}Co(e,t,n,i,r,s){return this.bo(e,t,n,i,r)}Do(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+oT,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)}So(e,t){let n=ho[e];return`${this.po}/v1/${t}:${n}`}terminate(){}}class hl{constructor(e){this.Fo=e.Fo,this.Mo=e.Mo}xo(e){this.Oo=e}No(e){this.Bo=e}Lo(e){this.ko=e}onMessage(e){this.qo=e}close(){this.Mo()}send(e){this.Fo(e)}Qo(){this.Oo()}$o(){this.Bo()}Ko(e){this.ko(e)}Uo(e){this.qo(e)}}let hh="WebChannelConnection";class hu extends ha{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}vo(e,t,n,i){let r=hr();return new Promise((s,o)=>{let a=new N;a.setWithCredentials(!0),a.listenOnce(P.COMPLETE,()=>{try{switch(a.getLastErrorCode()){case D.NO_ERROR:let t=a.getResponseJson();ox(hh,`XHR for RPC '${e}' ${r} received:`,JSON.stringify(t)),s(t);break;case D.TIMEOUT:ox(hh,`RPC '${e}' ${r} timed out`),o(new oR(oD.DEADLINE_EXCEEDED,"Request time out"));break;case D.HTTP_ERROR:let n=a.getStatus();if(ox(hh,`RPC '${e}' ${r} failed with status:`,n,"response text:",a.getResponseText()),n>0){let e=a.getResponseJson();Array.isArray(e)&&(e=e[0]);let t=null==e?void 0:e.error;if(t&&t.status&&t.message){let e,n=(e=t.status.toLowerCase().replace(/_/g,"-"),Object.values(oD).indexOf(e)>=0?e:oD.UNKNOWN);o(new oR(n,t.message))}else o(new oR(oD.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new oR(oD.UNAVAILABLE,"Connection failed."));break;default:oP()}}finally{ox(hh,`RPC '${e}' ${r} completed.`)}});let l=JSON.stringify(i);ox(hh,`RPC '${e}' ${r} sending request:`,i),a.send(t,"POST",l,n,15)})}Wo(e,t,n){let i=hr(),r=[this.po,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=L(),o=M(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`}
176,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;let h=r.join("");ox(hh,`Creating RPC '${e}' stream ${i}: ${h}`,a);let u=s.createWebChannel(h,a),c=!1,d=!1,f=new hl({Fo:t=>{d?ox(hh,`Not sending because RPC '${e}' stream ${i} is closed:`,t):(c||(ox(hh,`Opening RPC '${e}' stream ${i} transport.`),u.open(),c=!0),ox(hh,`RPC '${e}' stream ${i} sending:`,t),u.send(t))},Mo:()=>u.close()}),p=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};return p(u,A.EventType.OPEN,()=>{d||(ox(hh,`RPC '${e}' stream ${i} transport opened.`),f.Qo())}),p(u,A.EventType.CLOSE,()=>{d||(d=!0,ox(hh,`RPC '${e}' stream ${i} transport closed`),f.Ko())}),p(u,A.EventType.ERROR,t=>{d||(d=!0,oN(hh,`RPC '${e}' stream ${i} transport errored:`,t),f.Ko(new oR(oD.UNAVAILABLE,"The operation could not be completed")))}),p(u,A.EventType.MESSAGE,t=>{var n;if(!d){let r=t.data[0];r||oP();let s=(null==r?void 0:r.error)||(null==(n=r[0])?void 0:n.error);if(s){ox(hh,`RPC '${e}' stream ${i} received error:`,s);let t=s.status,n=function(e){let t=F[e];if(void 0!==t){if(void 0===t)return ok("GRPC error has no .code"),oD.UNKNOWN;switch(t){case F.OK:return oD.OK;case F.CANCELLED:return oD.CANCELLED;case F.UNKNOWN:return oD.UNKNOWN;case F.DEADLINE_EXCEEDED:return oD.DEADLINE_EXCEEDED;case F.RESOURCE_EXHAUSTED:return oD.RESOURCE_EXHAUSTED;case F.INTERNAL:return oD.INTERNAL;case F.UNAVAILABLE:return oD.UNAVAILABLE;case F.UNAUTHENTICATED:return oD.UNAUTHENTICATED;case F.INVALID_ARGUMENT:return oD.INVALID_ARGUMENT;case F.NOT_FOUND:return oD.NOT_FOUND;case F.ALREADY_EXISTS:return oD.ALREADY_EXISTS;case F.PERMISSION_DENIED:return oD.PERMISSION_DENIED;case F.FAILED_PRECONDITION:return oD.FAILED_PRECONDITION;case F.ABORTED:return oD.ABORTED;case F.OUT_OF_RANGE:return oD.OUT_OF_RANGE;case F.UNIMPLEMENTED:return oD.UNIMPLEMENTED;case F.DATA_LOSS:return oD.DATA_LOSS;default:return oP()}}}(t),r=s.message;void 0===n&&(n=oD.INTERNAL,r="Unknown error status: "+t+" with message "+s.message),d=!0,f.Ko(new oR(n,r)),u.close()}else ox(hh,`RPC '${e}' stream ${i} received:`,r),f.Uo(r)}}),p(o,O.STAT_EVENT,t=>{t.stat===R.PROXY?ox(hh,`RPC '${e}' stream ${i} detected buffering proxy`):t.stat===R.NOPROXY&&ox(hh,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{f.$o()},0),f}}function hc(){return"u">typeof document?document:null}class hd{constructor(e,t,n=1e3,i=1.5,r=6e4){this.Ti=e,this.timerId=t,this.Go=n,this.zo=i,this.jo=r,this.Ho=0,this.Jo=null,this.Yo=Date.now(),this.reset()}reset(){this.Ho=0}Zo(){this.Ho=this.jo}Xo(e){this.cancel();let t=Math.floor(this.Ho+this.e_()),n=Math.max(0,Date.now()-this.Yo),i=Math.max(0,t-n);i>0&&ox("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.Ho} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Jo=this.Ti.enqueueAfterDelay(this.timerId,i,()=>(this.Yo=Date.now(),e())),this.Ho*=this.zo,this.Ho<this.Go&&(this.Ho=this.Go),this.Ho>this.jo&&(this.Ho=this.jo)}t_(){null!==this.Jo&&(this.Jo.skipDelay(),this.Jo=null)}cancel(){null!==this.Jo&&(this.Jo.cancel(),this.Jo=null)}e_(){return(Math.random()-.5)*this.Ho}}class hf{}class hp extends hf{constructor(e,t,n,i){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=i,this.F_=!1}M_(){if(this.F_)throw new oR(oD.FAILED_PRECONDITION,"The client has already been terminated.")}bo(e,t,n,i){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([r,s])=>this.connection.bo(e,lO(t,n),i,r,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===oD.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new oR(oD.UNKNOWN,e.toString())})}Co(e,t,n,i,r){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Co(e,lO(t,n),i,s,o,r)).catch(e=>{throw"FirebaseError"===e.name?(e.code===oD.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new oR(oD.UNKNOWN,e.toString())})}terminate(){this.F_=!0,this.connection.terminate()}}class hg{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.x_=0,this.O_=null,this.N_=!0}B_(){0===this.x_&&(this.L_("Unknown"),this.O_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.O_=null,this.k_("Backend didn't respond within 10 seconds."),this.L_("Offline"),Promise.resolve())))}q_(e){"Online"===this.state?this.L_("Unknown"):(this.x_++,this.x_>=1&&(this.Q_(),this.k_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.L_("Offline")))}set(e){this.Q_(),this.x_=0,"Online"===e&&(this.N_=!1),this.L_(e)}L_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}k_(e){let t=`Could not reach Cloud Firestore backend. ${e}
177This 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.N_?(ok(t),this.N_=!1):ox("OnlineStateTracker",t)}Q_(){null!==this.O_&&(this.O_.cancel(),this.O_=null)}}let hm="RemoteStore";class hy{constructor(e,t,n,i,r){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.K_=[],this.U_=new Map,this.W_=new Set,this.G_=[],this.z_=r,this.z_.To(e=>{n.enqueueAndForget(async()=>
177{hw(this)&&(ox(hm,"Restarting streams for network reachability change."),await async function(e){e.W_.add(4),await hv(e),e.j_.set("Unknown"),e.W_.delete(4),await h_(e)}(this))})}),this.j_=new hg(n,i)}}async function h_(e){if(hw(e))for(let t of e.G_)await t(!0)}async function hv(e){for(let t of e.G_)await t(!1)}function hw(e){return 0===e.W_.size}async function hb(e,t){t?(e.W_.delete(2),await h_(e)):t||(e.W_.add(2),await hv(e),e.j_.set("Unknown"))}class hC{constructor(e,t,n,i,r){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=i,this.removalCallback=r,this.deferred=new oO,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,i,r){let s=new hC(e,t,Date.now()+n,i,r);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 oR(oD.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)}}class hE{constructor(){this.queries=hT(),this.onlineState="Unknown",this.ia=new Set}terminate(){var e;let t;e=new oR(oD.ABORTED,"Firestore shutting down"),t=this.queries,this.queries=hT(),t.forEach((t,n)=>{for(let t of n.ta)t.onError(e)})}}function hT(){return new lt(e=>a7(e),a8)}(U=V||(V={}))._a="default",U.Cache="cache";class hS{constructor(e,t,n,i,r,s){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=i,this.currentUser=r,this.maxConcurrentLimboResolutions=s,this.La={},this.ka=new lt(e=>a7(e),a8),this.qa=new Map,this.Qa=new Set,this.$a=new o8(oJ.comparator),this.Ka=new Map,this.Ua=new lG,this.Wa={},this.Ga=new Map,this.za=lB.Un(),this.onlineState="Unknown",this.ja=void 0}get isPrimaryClient(){return!0===this.ja}}function hI(e,t,n){if(e.isPrimaryClient&&0===n||!e.isPrimaryClient&&1===n){var i;let n,r=[];e.ka.forEach((e,n)=>{let i=n.view.sa(t);i.snapshot&&r.push(i.snapshot)}),(i=e.eventManager).onlineState=t,n=!1,i.queries.forEach((e,i)=>
177{for(let e of i.ta)e.sa(t)&&(n=!0)}),n&&i.ia.forEach(e=>{e.next()}),r.length&&e.La.p_(r),e.onlineState=t,e.isPrimaryClient&&e.sharedClientState.setOnlineState(t)}}async function hx(e,t,n){let i=[],r=[],s=[];e.ka.isEmpty()||(e.ka.forEach((o,a)=>{s.push(e.Ha(a,t,n).then(t=>{var s;if((t||n)&&e.isPrimaryClient){let i=t?!t.fromCache:null==(s=null==n?void 0:n.targetChanges.get(a.targetId))?void 0:s.current;e.sharedClientState.updateQueryState(a.targetId,i?"current":"not-current")}if(t){i.push(t);let e=l5.Yi(a.targetId,t);r.push(e)}}))}),await Promise.all(s),e.La.p_(i),await async function(e,t){try{await e.persistence.runTransaction("notifyLocalViewChanges","readwrite",n=>o1.forEach(t,t=>o1.forEach(t.Hi,i=>e.persistence.referenceDelegate.addReference(n,t.targetId,i)).next(()=>o1.forEach(t.Ji,i=>e.persistence.referenceDelegate.removeReference(n,t.targetId,i)))))}catch(e){if(!o2(e))throw e;ox("LocalStore","Failed to update sequence numbers: "+e)}for(let n of t){let t=n.targetId;if(!n.fromCache){let n=e.Ts.get(t),i=n.snapshotVersion,r=n.withLastLimboFreeSnapshotVersion(i);e.Ts=e.Ts.insert(t,r)}}}(e.localStore,r))}async function hk(e,t){if(!e.currentUser.isEqual(t)){ox("SyncEngine","User change. New user:",t.toKey());let n=await l8(e.localStore,t);e.currentUser=t,e.Ga.forEach(e=>{e.forEach(e=>{e.reject(new oR(oD.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.Ga.clear(),e.sharedClientState.handleUserChange(t,n.removedBatchIds,n.addedBatchIds),await hx(e,n.Rs)}}class hN{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=new lD(e.databaseInfo.databaseId,!0),this.sharedClientState=this.Za(e),this.persistence=this.Xa(e),await this.persistence.start(),this.localStore=this.eu(e),this.gcScheduler=this.tu(e,this.localStore),this.indexBackfillerScheduler=this.nu(e,this.localStore)}tu(e,t){return null}nu(e,t){return null}eu(e){var t,n;return t=this.persistence,n=new l4,new l6(t,n,e.initialUser,this.serializer)}Xa(e){return new l0(l2.ri,this.serializer)}Za(e){return new l9}async terminate(){var e,t;null==(e=this.gcScheduler)||e.stop(),null==(t=this.indexBackfillerScheduler)||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}hN.provider={build:()=>new hN};class hA{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=>hI(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=hk.bind(null,this.syncEngine),await hb(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new hE}createDatastore(e){var t;let n=new lD(e.databaseInfo.databaseId,!0),i=new hu(e.databaseInfo);return t=e.authCredentials,new hp(t,e.appCheckCredentials,i,n)}createRemoteStore(e){var t,n;return t=this.localStore,n=this.datastore,new hy(t,n,e.asyncQueue,e=>hI(this.syncEngine,e,0),hn.D()?new hn:new he)}createSyncEngine(e,t){var n,i,r,s,o,a;let l;return n=this.localStore,i=this.remoteStore,r=this.eventManager,s=this.sharedClientState,o=e.initialUser,a=e.maxConcurrentLimboResolutions,l=new hS(n,i,r,s,o,a),t&&(l.ja=!0),l}async terminate(){var e,t;await async function(e){ox(hm,"RemoteStore shutting down."),e.W_.add(5),await hv(e),e.z_.shutdown(),e.j_.set("Unknown")}(this.remoteStore),null==(e=this.datastore)||e.terminate(),null==(t=this.eventManager)||t.terminate()}}hA.provider={build:()=>new hA};let hP=new Map,hD="firestore.googleapis.com";class hR{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new oR(oD.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=hD,this.ssl=!0}else this.host=e.host,this.ssl=null==(t=e.ssl)||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=0x2800000;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new oR(oD.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,i){if(!0===t&&!0===i)throw new oR(oD.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=function(e){let t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}(null!=(n=e.experimentalLongPollingOptions)?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new oR(oD.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new oR(oD.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new oR(oD.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){var t,n;return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(t=this.experimentalLongPollingOptions,n=e.experimentalLongPollingOptions,t.timeoutSeconds===n.timeoutSeconds)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class hO{constructor(e,t,n,i){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new hR({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new oR(oD.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new oR(oD.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 hR(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new oL;switch(e.type){case"firstParty":return new oU(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new oR(oD.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invali
177d credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){let e;return(e=hP.get(this))&&(ox("ComponentProvider","Removing Datastore"),hP.delete(this),e.terminate()),Promise.resolve()}}let hM="AsyncQueue";class hL{constructor(e=Promise.resolve()){this.Vu=[],this.mu=!1,this.fu=[],this.gu=null,this.pu=!1,this.yu=!1,this.wu=[],this.a_=new hd(this,"async_queue_retry"),this.bu=()=>{let e=hc();e&&ox(hM,"Visibility state changed to "+e.visibilityState),this.a_.t_()},this.Su=e;const t=hc();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.bu)}get isShuttingDown(){return this.mu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Du(),this.vu(e)}enterRestrictedMode(e){if(!this.mu){this.mu=!0,this.yu=e||!1;let t=hc();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.bu)}}enqueue(e){if(this.Du(),this.mu)return new Promise(()=>{});let t=new oO;return this.vu(()=>this.mu&&this.yu?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Vu.push(e),this.Cu()))}async Cu(){if(0!==this.Vu.length){try{await this.Vu[0](),this.Vu.shift(),this.a_.reset()}catch(e){if(!o2(e))throw e;ox(hM,"Operation failed with retryable error: "+e)}this.Vu.length>0&&this.a_.Xo(()=>this.Cu())}}vu(e){let t=this.Su.then(()=>(this.pu=!0,e().catch(e=>{let t;throw this.gu=e,this.pu=!1,ok("INTERNAL UNHANDLED ERROR: ",(t=e.message||"",e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t)),e}).then(e=>(this.pu=!1,e))));return this.Su=t,t}enqueueAfterDelay(e,t,n){this.Du(),this.wu.indexOf(e)>-1&&(t=0);let i=hC.createAndSchedule(this,e,t,n,e=>this.Fu(e));return this.fu.push(i),i}Du(){this.gu&&oP()}verifyOperationInProgress(){}async Mu(){let e;do e=this.Su,await e;while(e!==this.Su)}xu(e){for(let t of this.fu)if(t.timerId===e)return!0;return!1}Ou(e){return this.Mu().then(()=>{for(let t of(this.fu.sort((e,t)=>e.targetTimeMs-t.targetTimeMs),this.fu))if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.Mu()})}Nu(e){this.wu.push(e)}Fu(e){let t=this.fu.indexOf(e);this.fu.splice(t,1)}}class hF extends hO{constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=new hL,this._persistenceKey=(null==i?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new hL(e),this._firestoreClient=void 0,await e}}}RegExp("[~\\*/\\[\\]]"),new WeakMap,function(e=!0){oT=na,nn(new tO("firestore",(t,{instanceIdentifier:n,options:i})=>{let r=t.getProvider("app").getImmediate(),s=new hF(new oj(t.getProvider("auth-internal")),new oq(r,t.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new oR(oD.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new am(e.options.projectId,t)}(r,n),r);return i=Object.assign({useFetchStreams:e},i),s._setSettings(i),s},"PUBLIC").setMultipleInstances(!0)),nu(ob,oC,void 0),nu(ob,oC,"esm2017")}(),nl({apiKey:"AIzaSyBrCDN9nH5wWhloCcSbU8actQHsMYyeGAU",authDomain:"turn-152415.firebaseapp.com",projectId:"turn-152415",databaseURL:"https://turn-152415.firebaseio.com",storageBucket:"turn-152415.appspot.com",messagingSenderId:"52705077122"}),function(){let e=ni(nh(),"firestore").getImmediate({identifier:ag});if(!e._initialized){let t=tl("firestore");t&&function(e,t,n,i={}){var r;let s=(e=function(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new oR(oD.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let n=function(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{var t;let n=(t=e).constructor?t.constructor.name:null;return n?`a custom ${n} object`:"an object"}}return"function"==typeof e?"a function":oP()}(e);throw new oR(oD.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}(e,hO))._getSettings(),o=Object.assign(Object.assign({},s),{emulatorOptions:e._getEmulatorOptions()}),a=`${t}:${n}`;s.host!==hD&&s.host!==a&&oN("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");let l=Object.assign(Object.assign({},s),{host:a,ssl:!1,emulatorOptions:i});if(!tx(l,o)&&(e._setSettings(l),i.mockUserToken)){let t,n;if("string"==typeof i.mockUserToken)t=i.mockUserToken,n=oE.MOCK_USER;else{t=tc(i.mockUserToken,null==(r=e._app)?void 0:r.options.projectId);let s=i.mockUserToken.sub||i.mockUserToken.user_id;if(!s)throw new oR(oD.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new oE(s)}e._authCredentials=new oF(new oM(t,n))}}(e,...t)}}();let hj=function(e=nh()){let t=ni(e,"database").getImmediate({identifier:void 0});if(!t._instanceStarted){let e=tl("database");e&&function(e,t,n,i={}){var r;let s;(e=tR(e))._checkNotDeleted("useEmulator");let o=`${t}:${n}`,a=e._repoInternal;if(e._instanceStarted){if(o===e._repoInternal.repoInfo_.host&&tx(i,a.repoInfo_.emulatorOptions))return;nV("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}a.repoInfo_.nodeAdmin?(i.mockUserToken&&nV('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),s=new n4(n4.OWNER)):i.mockUserToken&&(s=new n4("string"==typeof i.mockUserToken?i.mockUserToken:tc(i.mockUserToken,e.app.options.projectId))),r=s,a.repoInfo_=new n9(o,!1,a.repoInfo_.namespace,a.repoInfo_.webSocketOnly,a.repoInfo_.nodeAdmin,a.repoInfo_.persistenceKey,a.repoInfo_.includeNamespaceInQueryParams,!0,i),r&&(a.authTokenProvider_=r)}(t,...e)}return t}(),hV=async()=>{try{let e=await of(od(oc(hj),"features/"));if(e.exists())return e.val();return null}catch(e){return e}},hU=async e=>{try{let t=await of(od(oc(hj),`users2/${e}`));if(t.exists())return t.val();return null}catch(e){return e}};var hB=e.i(43103),hq=e.i(62750),h$=e.i(94867),h$=h$,hH=e.i(68871),hH=hH,hz=e.i(85195),hW=e.i(55261),hK=e.i(54302);let hG=eg.default.div`
178  absolute 
179  top-0 
180  right-0 
181
182  h-2 
183  w-2 
184
185  bg-red-400 
186  
187  rounded-full
188`,hQ=eg.default.div`
189  pt-5 
190  pb-3 
191  px-5 
192
193  text-lg 
194  font-bold 
195  
196  border-b 
197  
198  dark:border-turnBlueDark-350
199`,hY=eg.default.div`
200  flex 
201  flex-row
202
203  h-fit
204  py-5
205  px-2 
206  mx-5 
207
208  border-b
209
210  dark:border-turnBlueDark-350
211`,hX=eg.default.div`
212  flex 
213  flex-col 
214
215  items-center 
216  text-gray-500 
217  font-bold
218  
219  dark:text-gray-400 
220`,hJ=eg.default.p`
221  text-base
222  leading-4
223`,hZ=eg.default.p`
224  pb-2.5 
225
226  text-xs 
227
228  border-b-2 
229  border-ctaSlateBlue
230`,h0=eg.default.div`
231  pl-5
232  text-xs 
233`,h1=eg.default.h4`
234  font-bold
235`,h2=eg.default.p`
236  mt-2
237
238  text-gray-500 
239  
240  dark:text-gray-400 
241`,h5=eg.default.h3`
242  mt-4
243
244  text-base
245  font-semibold
246`,h3=eg.default.p`
247  mt-2
248  max-w-[250px]
249
250  text-sm
251  text-center
252`,h4=`
253  flex 
254  flex-col 
255  left-0 
256
257  mt-3
258  pb-5
259  min-w-fit 
260  h-[657px]
261  w-[358px]
262
263  text-sm
264  text-black
265  bg-white
266  
267  dark:border 
268  dark:border-turnBlueDark-350 
269  
270  dark:shadow-2xl
271  dark:bg-turnBlueDark-800
272  dark:text-darkModeWhite-100
273  
274  overflow-y-auto
275  rounded-md
276  shadow
277  focus:outline-none
278  ring-1
279  ring-black/5
280`,h6=({isNewNotifications:e,notifications:t,onClick:n})=>{let[i,r]=(0,z.useState)(null),[s,o]=(0,z.useState)(null),{styles:a,attributes:l}=(0,hK.usePopper)(i,s,{placement:"bottom-end"});return(0,H.jsxs)(hz.Popover,{className:"h-7",children:[(0,H.jsx)(hz.Popover.Button,{name:"notiticationButton",tabIndex:0,ref:r,className:"focus-visible:outline-none",children:(0,H.jsxs)("div",{className:"relative",onClick:()=>n?.(),children:[(0,H.jsx)(h$.default,{height:"28",width:"28",className:"stroke-[#7E7E8F] dark:stroke-white"}),e&&(0,H.jsx)(hG,{})]})}),(0,H.jsx)(hq.Portal,{children:(0,H.jsx)("div",{id:"notificationPortal",ref:o,style:a.popper,className:"max-w-[380px] z-10",...l.popper,children:(0,H.jsx)(hz.Popover.Transition,{children:(0,H.jsxs)(hz.Popover.Panel,{className:h4,children:[(0,H.jsx)(hQ,{children:(0,H.jsxs)("h3",{children:["What","'","s New"]})}),t?.length>0?t?.map(e=>{let t=new Date(e?.dateTime);return(0,H.jsxs)(hY,{id:"notificationItem",children:[(0,H.jsxs)(hX,{id:"notificationDate",children:[(0,H.jsx)(hJ,{children:(0,hW.format)(t,"dd")}
280),(0,H.jsx)(hZ,{children:(0,hW.format)(t,"MMM")})]}),(0,H.jsxs)(h0,{children:[(0,H.jsx)(h1,{id:"notificationTitle",children:e?.title}),(0,H.jsx)(h2,{id:"notificationDesc",children:e?.description}),e?.image&&(0,H.jsx)("img",{className:"mt-4",src:e.image,alt:""}),e?.video&&(0,H.jsx)("div",{className:"mt-4",children:e.video.includes("youtube")?(0,H.jsx)("iframe",{src:e.video,allow:"accelerometer; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}):(0,H.jsxs)("video",{controls:!0,children:[(0,H.jsx)("source",{src:e.video,type:"video/mp4"}),(0,H.jsx)("source",{src:e.video,type:"video/ogg"}),"Your browser does not support the video tag."]})})]})]},e?.dateTime)}):(0,H.jsxs)("div",{className:"flex flex-col justify-center items-center h-full w-full",children:[(0,H.jsx)(hH.default,{height:94,width:75}),(0,H.jsxs)(h5,{children:["There","'"," nothing here yet"]}),(0,H.jsx)(h3,{children:"We have something exciting coming your way soon."})]})]})})})})]})};var h8=e.i(93589),h7=e.i(82484);let h9=`
281  max-w-xs 
282  min-w-[32px] 
283  flex 
284  items-center 
285
286  text-sm 
287  text-black
288
289  p-1 
290
291  rounded-full 
292
293  focus:outline-none 
294  focus:ring-2 
295  focus:ring-offset-2 
296  focus:ring-transparent
297    
298  dark:text-white
299  dark:focus:ring-offset-0
300  dark:focus:ring-transparent
301`,ue=(0,h8.default)(e6.MenuItems)`
302  origin-top-right
303  absolute
304
305  right-0
306
307  mt-2
308  w-48
309  py-1
310
311  text-sm
312  text-black
313  bg-white
314  
315  overflow-hidden
316
317  rounded-xl
318  shadow-lg
319  ring-1
320  ring-black/5
321  focus:outline-none
322
323  dark:shadow-2xl
324  dark:border
325  dark:bg-turnBlueDark-800
326  dark:border-turnBlueDark-350
327
328`,ut=(0,h8.default)(e6.MenuItem)`
329  block
330  px-4
331  py-2
332  text-sm
333  cursor-pointer
334  relative
335  select-none
336  hover:bg-gray-100
337  text-gray-900
338
339  dark:text-white
340  dark:hover:bg-turnBlueDark-400
341`,un=h8.default.div`
342  flex
343  h-full
344  flex-row
345  gap-4
346  justify-center
347  items-center
348`,ui=(0,h8.default)(h7.ActionButton)`
349  h-10
350  bg-white
351  border
352  border-grayscaleLight-250
353  text-grayscaleLight-250
354  font-semibold
355  text-xs
356  overflow-hidden
357  px-2
358
359  first:hidden
360  md:text-sm
361  md:first:block
362  md:px-6
363
364  dark:bg-turnBlueDark-800
365  dark:border-turnBlueDark-300
366  dark:text-turnBlueDark-300
367
368  cursor-pointer
369  shadow-none
370  
371  hover:shadow-none
372  hover:scale-95
373  hover:bg-white
374  hover:active:bg-transparent
375`,ur=[{name:"Settings",href:ev.appLinks.settings},{name:"Sign out",href:ev.logoutHref}],us=()=>{let{push:e}=(0,eu.useRouter)(),{user:t}=(0,er.useAuth0)(),{handleLogout:n}=(0,eo.useAuthContext)(),{meData:i}=(0,eh.useSelector)(e=>e.partnerData),{isNewNotifications:r,filteredNotifications:s,updateVisitDates:o}=(()=>{let{meData:e}=(0,eh.useSelector)(e=>e.partnerData),[t,n]=(0,z.useState)(null),[i,r]=(0,z.useState)(null),[s,o]=(0,z.useState)(!1),a=async()=>{var t;let i,r,s=await hV();t=hB.default.toArray(s),i=t?.filter(e=>{let t,n;return e.dateTime>=(t=Number("12"),(n=new Date).setMonth(n.getMonth()-t))}),r=i?.filter(t=>!t.availableForPartners||t.availableForPartners.includes(e?.uuid)),n(r?.reverse())},l=async()=>{var t,n,i,s,o;let a,l,h,u,c,d,f,p,g=await hU(e?.member_id);if(g)return r(g);r((t=e?.member_id,a={penultimateVisitToFeatures:null,lastVisitToFeatures:0},n=oc(hj,`users2/${t}`),sK("set",(n=tR(n))._path),sB("set",a,n._path,!1),l=new tu,i=n._repo,s=n._path,o=l.wrapCallback(()=>{}),s3(i,"set",{path:s.toString(),value:a,priority:null}),h=sZ(i),c=sk(u=i5(a,null),sf(i.serverSyncTree_,s),h),d=s5(i),f=sl(i.serverSyncTree_,s,c,d,!0),sY(i.eventQueue_,f),i.server_.put(s.toString(),u.val(!0),(e,t)=>{let n="ok"===e;n||nU("set at "+s+" failed: "+e);let r=sh(i.serverSyncTree_,d,!n);sX(i.eventQueue_,s,r),s4(i,o,e,t)}),p=ot(i,s),s8(i,p),sX(i.eventQueue_,p,[]),l.promise,a))};return(0,z.useEffect)(()=>{i&&o(t?.some(e=>e?.dateTime>i?.lastVisitToFeatures))},[i]),(0,z.useEffect)(()=>{e&&(a(),l())},[e]),{isNewNotifications:s,filteredNotifications:t,updateVisitDates:()=>{var t,n;let r,s;t=e?.member_id,r={penultimateVisitToFeatures:i?.lastVisitToFeatures,lastVisitToFeatures:new Date().getTime()},sH("update",r,(n=oc(hj,`users2/${t}`))._path,!1),s=new tu,function(e,t,n,i){s3(e,"update",{path:t.toString(),value:n});let r=!0,s=sZ(e),o={};if(nX(n,(n,i)=>{r=!1,o[n]=sx(iI(t,n),i5(i),e.serverSyncTree_,s)}),r)nL("update() called with empty data.  Don't do anything."),s4(e,i,"ok",void 0);else{var a,l;let r,s=s5(e),h=(a=e.serverSyncTree_,l=a.pendingWriteTree_,e7(s>l.lastWriteId,"Stacking an older merge on top of newer ones"),l.allWrites.push({path:t,children:o,writeId:s,visible:!0}),l.visibleWrites=rA(l.visibleWrites,t,o),l.lastWriteId=s,r=rx.fromObject(o),sp(a,new r_(rd(),t,r)));sY(e.eventQueue_,h),e.server_.merge(t.toString(),n,(n,r)=>{let o="ok"===n;o||nU("update at "+t+" failed: "+n);let a=sh(e.serverSyncTree_,s,!o),l=a.length>0?s8(e,t):t;sX(e.eventQueue_,l,a),s4(e,i,n,r)}),nX(n,n=>{let i=ot(e,iI(t,n));s8(e,i)}),sX(e.eventQueue_,t,[])}}(n._repo,n._path,r,s.wrapCallback(()=>{})),s.promise,o(!1)},user:i}})(),{first_name:a,profile_picture:l}=i?.team_member||{};return(0,H.jsxs)(e6.Menu,{as:"div",className:"relative",children:[(0,H.jsxs)("div",{className:"flex flex-row items-center gap-4",children:[(0,H.jsx)(un,{children:(0,H.jsx)(ui,{id:"upgradeNowButton",onClick:()=>e("https://turn.ai/pricing"),children:"Upgrade now"})}),(0,H.jsx)(h6,{isNewNotifications:r,notifications:s,onClick:o}),(0,H.jsxs)(e6.MenuButton,{className:h9,children:[(0,H.jsx)("span",{className:"sr-only",children:"Open user menu"}),(0,H.jsx)("img",{className:"rounded-full",src:l||t?.picture,alt:"My photo",width:32,height:32}),(0,H.jsxs)("div",{className:"ml-3 text-sm",children:["Hello, ",(0,H.jsx)("span",{className:"font-semibold",children:a||t?.given_name})]})]})]}),(0,H.jsx)(e8.Transition,{as:z.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,H.jsx)(ue,{className:"bg-white",children:ur.map(t=>t.href===ev.logoutHref?(0,H.jsx)(ut,{onClick:n,children:(0,H.jsx)("p",{className:"dark:text-white",children:t.name})},t.name):(0,H.jsx)(ut,{onClick:()=>e(t.href),children:(0,H.jsx)("p",{children:t.name})},t.name))})})]})},uo=()=>{let{pathname:e,asPath:t,query:n}=(0,eu.useRouter)(),{title:i,titleHref:r=e,subTitle:s}=(0,z.useMemo)(()=>(0,e5.getTitle)(t,n),[t,n]);return(0,H.jsxs)(e3,{children:[(0,H.jsx)("div",{className:"flex items-center gap-4",children:(0,H.jsx)(eE.default,{href:r,children:(0,H.jsx)(e4,{$inactive:!!s,children:`${i||""}`})})}),(0,H.jsx)("div",{className:"grow"}),(0,H.jsx)(us,{})]})},ua=eg.default.div`
376  absolute
377  inset-0
378  
379  bg-slate-50
380  box-border
381  
382  overflow-hidden
383  
384  dark:bg-turnBlueDark-950
385
386  md:pl-[80px]
387`,ul=eg.default.div`
388  relative
389 
390  w-full
391  h-full
392  
393  overflow-x-hidden
394  overflow-y-auto
395`,uh=({children:e,hideHeader:t})=>{var n;let{asPath:i,pathname:r,push:s}=(0,eu.useRouter)(),o=(0,el.useDispatch)(),{authToken:a,handleLogout:l}=(0,eo.useAuthContext)(),{theme:h,setTheme:u}=null!=(n=(0,z.useContext)(Q))?n:Y,[c,d]=(0,z.useState)(""),[f,p]=(0,z.useState)(""),{enabled:g}=(0,eh.useSelector)(e=>e.darkMode),{meData:m,showAIAssistantNewBadge:y}
395=(0,eh.useSelector)(e=>e.partnerData),_=(0,z.useMemo)(()=>r.startsWith(ev.settingsLink),[r]),v=(0,z.useMemo)(()=>r.startsWith(ev.appLinks.home),[r]),w=(0,z.useMemo)(()=>{let e;return(e=$.default.env.NEXT_PUBLIC_AI_WIDGET_SUGGESTED_PROMPTS)?JSON.parse(e):e1},[]),b=(0,z.useMemo)(()=>m?.ai_enabled&&(v||_),[v,_,m?.ai_enabled]);return(0,z.useEffect)(()=>{d(i.includes("settings")?ev.appLinks.settings:e2.map(e=>i.includes(e)).some(e=>e)||"/"===i?ev.appLinks.home:i.includes("/candidates/")?ev.appLinks.screen:i),p(i)},[i]),(0,z.useEffect)(()=>{o(eH("dark"===h))},[o,h]),(0,H.jsx)(ea.SkeletonTheme,{baseColor:g?"#3d405e":"#f2f5f7",highlightColor:g?"#575a80":"#f9fbfb",height:16,children:(0,H.jsxs)(ua,{children:[(0,H.jsx)(ed.default,{data:(e=>{let{can_trigger_support:t,show_worker_list:n,show_home:i}=e||{},r=(e=>{let{show_company_settings:t,show_integrations:n,show_my_profile:i,show_settings_payments:r,show_user_management:s}=e||{};return[t,n,i,r,s].some(e=>!!e)})(e),s=[],o={logout:{name:"Logout",icon:(0,H.jsx)(eY.LogoutIcon,{})},darkMode:{leftLabel:"Light",rightLabel:"Dark",styles:{controlsContainer:"",buttonThumb:""}},openSidebarButton:{styles:{container:""}}};return r&&s.unshift({name:"Settings",href:ev.settingsLink,icon:(0,H.jsx)(eJ.SettingsIcon,{})}),n&&s.unshift({name:"Screen",href:ev.appLinks.screen,icon:(0,H.jsx)(eX.SearchZoomInIcon,{})}),i&&s.unshift({name:"Home",href:ev.appLinks.home,icon:(0,H.jsx)(eQ.HomeIcon,{})}),t&&(o.support={name:"Support",icon:(0,H.jsx)(eZ.SupportIcon,{})}),{navLinks:s,actions:o,logo:{href:ev.appLinks.home,target:""}}})(m?.team_member?.role_permissions),current:c,subCurrent:f,onDarkMode:()=>u(g?"light":"dark"),darkModeState:"dark"===h,onLogout:l,displaySupport:!0,onClickSupport:()=>{window.Intercom&&(o(eK(!0)),window.Intercom("show"))},onNavigate:s}),(0,H.jsxs)(ul,{id:"layout-content",children:[!t&&(0,H.jsx)(uo,{}),_?(0,H.jsx)(eB,{children:e}):e]}),(0,H.jsx)(eC,{}),b&&(0,H.jsx)(ec.AIAssistantWidget,{apiUrl:"https://checks-service-prod-213f19a2b4c9.herokuapp.com",token:a,mode:"assistant",features:{chatLogFeatures:{showSendFeedback:!0},headerFeatures:{showFullScreen:!0}},onWidgetLauncher:()=>o((0,eb.setShowAIAssistantNewBadge)(!1)),showNewBadge:y,styles:{popover:"fixed bottom-3 right-4 md:!fixed md:bottom-3 md:right-4",widget_wrapper:"md:bottom-12"},suggestedPrompts:w,threadId:m?.team_member?.last_thread_id})]})})};var uu=e.i(65777);e.i(19830);var uc=e.i(96195),ud=e.i(22329),uf=e.i(95585),up=e.i(84936),ug=e.i(89280);e.i(68681);var um=e.i(5578),uy=e.i(21805),u_=function(e){var t=e.client,n=e.children,i=(0,uy.getApolloContext)(),r=z.useContext(i),s=z.useMemo(function(){return(0,ug.__assign)((0,ug.__assign)({},r),{client:t||r.client})},[r,t]);return(0,um.invariant)(s.client,46),z.createElement(i.Provider,{value:s},n)},uv=e.i(7982);e.i(87076);var uw=e.i(40362),ub="persist:",uC="persist/FLUSH",uE="persist/REHYDRATE",uT="persist/PAUSE",uS="persist/PERSIST",uI="persist/PURGE",ux="persist/REGISTER";function uk(e){return(uk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function uN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function uA(e,t,n,i){i.debug;var r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uN(n,!0).forEach(function(t){var i,r,s;i=e,r=t,s=n[t],r in i?Object.defineProperty(i,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):i[r]=s}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uN(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},n);return e&&"object"===uk(e)&&Object.keys(e).forEach(function(i){"_persist"!==i&&t[i]===n[i]&&(r[i]=e[i])}),r}function uP(e){return JSON.stringify(e)}function uD(e){var t,n=e.transforms||[],i="".concat(void 0!==e.ke
395yPrefix?e.keyPrefix:ub).concat(e.key),r=e.storage;return e.debug,t=!1===e.deserialize?function(e){return e}:"function"==typeof e.deserialize?e.deserialize:uR,r.getItem(i).then(function(e){if(e)try{var i={},r=t(e);return Object.keys(r).forEach(function(e){i[e]=n.reduceRight(function(t,n){return n.out(t,e,r)},t(r[e]))}),i}catch(e){throw e}})}function uR(e){return JSON.parse(e)}function uO(e){}function uM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function uL(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uM(n,!0).forEach(function(t){var i,r,s;i=e,r=t,s=n[t],r in i?Object.defineProperty(i,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):i[r]=s}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uM(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function uF(e,t){var n=void 0!==e.version?e.version:-1;e.debug;var i=void 0===e.stateReconciler?uA:e.stateReconciler,r=e.getStoredState||uD,s=void 0!==e.timeout?e.timeout:5e3,o=null,a=!1,l=!0,h=function(e){return e._persist.rehydrated&&o&&!l&&o.update(e),e};return function(u,c){var d,f,p=u||{},g=p._persist,m=function(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},s=Object.keys(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(p,["_persist"]);if(c.type===uS){var y=!1,_=function(t,n){y||(c.rehydrate(e.key,t,n),y=!0)};if(s&&setTimeout(function(){y||_(void 0,Error('redux-persist: persist timed out for persist key "'.concat(e.key,'"')))},s),l=!1,o||(o=function(e){var t,n=e.blacklist||null,i=e.whitelist||null,r=e.transforms||[],s=e.throttle||0,o="".concat(void 0!==e.ke
395yPrefix?e.keyPrefix:ub).concat(e.key),a=e.storage;t=!1===e.serialize?function(e){return e}:"function"==typeof e.serialize?e.serialize:uP;var l=e.writeFailHandler||null,h={},u={},c=[],d=null,f=null;function p(){if(0===c.length){d&&clearInterval(d),d=null;return}var e=c.shift(),n=r.reduce(function(t,n){return n.in(t,e,h)},h[e]);if(void 0!==n)try{u[e]=t(n)}catch(e){console.error("redux-persist/createPersistoid: error serializing state",e)}else delete u[e];0===c.length&&(Object.keys(u).forEach(function(e){void 0===h[e]&&delete u[e]}),f=a.setItem(o,t(u)).catch(m))}function g(e){return(!i||-1!==i.indexOf(e)||"_persist"===e)&&(!n||-1===n.indexOf(e))}function m(e){l&&l(e)}return{update:function(e){Object.keys(e).forEach(function(t){g(t)&&h[t]!==e[t]&&-1===c.indexOf(t)&&c.push(t)}),Object.keys(h).forEach(function(t){void 0===e[t]&&g(t)&&-1===c.indexOf(t)&&void 0!==h[t]&&c.push(t)}),null===d&&(d=setInterval(p,s)),h=e},flush:function(){for(;0!==c.length;)p();return f||Promise.resolve()}}}(e)),g)return uL({},t(m,c),{_persist:g});if("function"!=typeof c.rehydrate||"function"!=typeof c.register)throw Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return c.register(e.key),r(e).then(function(t){(e.migrate||function(e,t){return Promise.resolve(e)})(t,n).then(function(e){_(e)},function(e){_(void 0,e)})},function(e){_(void 0,e)}),uL({},t(m,c),{_persist:{version:n,rehydrated:!1}})}if(c.type===uI)return a=!0,c.result((d=e.storage,f="".concat(void 0!==e.ke
395yPrefix?e.keyPrefix:ub).concat(e.key),d.removeItem(f,uO))),uL({},t(m,c),{_persist:g});if(c.type===uC)return c.result(o&&o.flush()),uL({},t(m,c),{_persist:g});if(c.type===uT)l=!0;else if(c.type===uE){if(a)return uL({},m,{_persist:uL({},g,{rehydrated:!0})});if(c.key===e.key){var v=t(m,c),w=c.payload;return h(uL({},!1!==i&&void 0!==w?i(w,u,v,e):v,{_persist:uL({},g,{rehydrated:!0})}))}}if(!g)return t(u,c);var b=t(m,c);return b===m?u:h(uL({},b,{_persist:g}))}}function uj(e){return function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance")}()}function uV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function uU(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?uV(n,!0).forEach(function(t){var i,r,s;i=e,r=t,s=n[t],r in i?Object.defineProperty(i,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):i[r]=s}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uV(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var uB={registry:[],bootstrapped:!1},uq=e.i(10705),uq=uq,u$=(e.i(75448),e.i(73829),function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){var l=[s,a];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&l[0]?i.return:l[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,l[1])).done)return r;switch(i=0,r&&(l=[2&l[0],r.value]),l[0]){case 0:case 1:r=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,i=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(r=(r=o.trys).length>0&&r[r.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!r||l[1]>r[0]&&l[1]<r[3])){o.label=l[1];break}if(6===l[0]&&o.label<r[1]){o.label=r[1],r=l;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(l);break}r[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],i=0}finally{n=r=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}),uH=Object.defineProperty,uz=Object.defineProperties,uW=Object.getOwnPropertyDescriptors,uK=Object.getOwnPropertySymbols,uG=Object.prototype.hasOwnProperty,uQ=Object.prototype.propertyIsEnumerable;(y=B||(B={})).uninitialized="uninitialized",y.pending="pending",y.fulfilled="fulfilled",y.rejected="rejected",eq.isPlainObject;var uY=(0,eq.createAction)("__rtkq/focused"),uX=(0,eq.createAction)("__rtkq/unfocused"),uJ=(0,eq.createAction)("__rtkq/online"),uZ=(0,eq.createAction)("__rtkq/offline"),u0=!1;(_=q||(q={})).query="query",_.mutation="mutation";var u1={status:B.uninitialized},u2=Error("Promise never resolved before cacheEntryRemoved."),u5=e.i(88126),u3=e.i(57753),u4=e.i(90343),u6=e.i(78540),u8=e.i(62154),u7=e.i(67882),u9=e.i(59868);let ce={key:"root",storage:u5.default,blacklist:["addCandidates","candidateDetailsData","candidatesTableData","floatingNotification","globalDateRange","helpDesk","partnerData","reportDateRange"]},ct={key:"candidatesTableData",storage:u5.default,blacklist:["isAssentModalOpen","isLoadingTotals","initiatedByOnly"]},cn={key:"globalDateRange",storage:u5.default,blacklist:["isDateRangeModalOpen"]},ci={key:"partnerData",storage:u5.default,blacklist:["isAllTimeEnabled","isCMMvrBlacklisted","isUnauthorizedModalOpen","meData","unauthorizedRedirectTo"]},cr={key:"reportDateRange",storage:u5.default,blacklist:["isModalOpen"]},cs=(0,uw.combineReducers)({addCandidates:u3.default,candidateDetailsData:u9.default,candidatesTableData:uF(ct,u4.default),darkMode:ez,floatingNotification:u6.default,globalDateRange:uF(cn,u8.default),helpDesk:eG,partnerData:uF(ci,eb.default),reportDateRange:uF(cr,u7.default)}),co=uF(ce,cs),ca=(0,eq.configureStore)({reducer:co,middleware:e=>e({serializableCheck:{ignoredActions:[uC,uE,uT,uS,uI,ux]}})});v=ca.dispatch,w=function(){return v(uY())},!u0&&"u">typeof window&&window.addEventListener&&(window.addEventListener("visibilitychange",function(){"visible"===window.document.visibilityState?w():v(uX())},!1),window.addEventListener("focus",w,!1),window.addEventListener("online",function(){return v(uJ())},!1),window.addEventListener("offline",function(){return v(uZ())},!1),u0=!0);var cl=e.i(74428),cl=cl;function ch(e){return(ch="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}
395function cu(e){return(cu=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function cc(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cd(e,t){return(cd=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function cf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var cp=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");for(var t,i,r=arguments.length,s=Array(r),o=0;o<r;o++)s[o]=arguments[o];return i=(e=(t=cu(n)).call.apply(t,[this].concat(s)))&&("object"===ch(e)||"function"==typeof e)?e:cc(this),cf(cc(i),"state",{bootstrapped:!1}),cf(cc(i),"_unsubscribe",void 0),cf(cc(i),"handlePersistorState",function(){i.props.persistor.getState().bootstrapped&&(i.props.onBeforeLift?Promise.resolve(i.props.onBeforeLift()).finally(function(){return i.setState({bootstrapped:!0})}):i.setState({bootstrapped:!0}),i._unsubscribe&&i._unsubscribe())}),i}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&cd(n,e),t=[{key:"componentDidMount",value:function(){this._unsubscribe=this.props.persistor.subscribe(this.handlePersistorState),this.handlePersistorState()}},{key:"componentWillUnmount",value:function(){this._unsubscribe&&this._unsubscribe()}},{key:"render",value:function(){return"function"==typeof this.props.children?this.props.children(this.state.bootstrapped):this.state.bootstrapped?this.props.children:this.props.loading}}],function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(n.prototype,t),n}(z.PureComponent);cf(cp,"defaultProps",{children:null,loading:null});var cg=e.i(30746),cm=e.i(8515);let cy=()=>{let e=(0,el.useDispatch)(),{meData:t}=(0,eh.useSelector)(e=>e.partnerData);return(0,z.useEffect)(()=>{if(!t?.team_member)return;let{id:n,first_name:i,last_name:r,email:s}=t.team_member;(0,cm.default)({app_id:"bgfbdoji",user_id:String(n),name:`${i} ${r}`,email:s,hide_default_launcher:!0}),window.Intercom("onHide",()=>e(eK(!1)))},[t,e]),null};e.i(34055);var c_=e.i(26482),c_=c_;let cv=()=>{let e=(0,el.useDispatch)(),{isError:t,notificationData:n,showNotification:i}=(0,eh.useSelector)(e=>e.floatingNotification);return(0,H.jsx)(c_.default,{data:n.data,display:i,onAction:{OPEN_CANDIDATES_MODAL:()=>e((0,u3.setIsModalOpen)(!0)),OPEN_DATE_RANGE_MODAL:()=>e((0,u7.setIsModalOpen)(!0))}[n.onAction],onCloseButton:()=>e((0,u6.setShowNotification)(!1)),success:!t})},cw={position:"bottom-right",toastOptions:{style:{width:"300px"},duration:4e3}};es.config.autoAddCss=!1;let cb=e=>eu.default.replace(e?.returnTo||"/"),cC=new uf.ApolloClient({uri:"https://ready-analysis-api-stage.herokuapp.com/graphql",cache:new up.InMemoryCache,headers:{"Accept-Encoding":"gzip"}});cg.default.initialize({gtmId:"GTM-N55SR2M"});let cE=new uc.QueryClient,cT=(b=!1,C=(0,uw.createStore)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:uB,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case ux:return uU({},e,{registry:[].concat(uj(e.registry),[t.key])});case uE:var n=e.registry.indexOf(t.key),i=uj(e.registry);return i.splice(n,1),uU({},e,{registry:i,bootstrapped:0===i.length});default:return e}},uB,void 0),E=function(e){C.dispatch({type:ux,key:e})},T=function(e,t,n){var i={type:uE,payload:t,err:n,key:e};ca.dispatch(i),C.dispatch(i),b&&S.getState().bootstrapped&&(b(),b=!1)},(S=uU({},C,{purge:function(){var e=[];return ca.dispatch({type:uI,result:function(t){e.push(t)}}),Promise.all(e)},flush:function(){var e=[];return ca.dispatch({type:uC,result:function(t){e.push(t)}}),Promise.all(e)},pause:function(){ca.dispatch({type:uT})},persist:function(){ca.dispatch({type:uS,register:E,rehydrate:T})}})).persist(),S),cS=({Component:e,pageProps:t,router:n})=>n.pathname.toLowerCase().includes("embed")?(0,H.jsx)(e,{}):(0,H.jsx)(X,{attribute:"class",enableSystem:!1,disableTransitionOnChange:!0,themes:["light","dark"],children:(0,H.jsx)(cl.default,{store:ca,children:(0,H.jsxs)(cp,{persistor:cT,children:[(0,H.jsx)(cy,{}),(0,H.jsx)(uv.Toaster,{...cw}),(0,H.jsx)(cv,{}),(0,H.jsx)(u_,{client:cC,children:(0,H.jsx)(er.Auth0Provider,{audience:"https://turning.
395io/partner-dashboard",cacheLocation:"localstorage",clientId:"SsyUp6zbRDJ61aTCv4edRAdaUH05HBvL",cookieDomain:".herokuapp.com",domain:"https://turn.auth0.com",onRedirectCallback:cb,redirectUri:`${window.location.origin}/callback`,scope:"openid profile email",skipRedirectCallback:window.location.pathname.includes("/settings/oauth"),children:(0,H.jsx)(eo.AuthHOC,{children:(0,H.jsx)(ud.QueryClientProvider,{client:cE,children:(0,H.jsx)(ea.SkeletonTheme,{baseColor:"#f2f5f7",highlightColor:"#f9fbfb",children:(0,H.jsx)(uh,{children:(0,H.jsx)(e,{...t})})})})})})})]})})});cS.getInitialProps=async e=>({...await uu.default.getInitialProps(e)}),e.s(["default",0,cS],3115)},68146,(e,t,n)=>{let i="/_app";(window.__NEXT_P=window.__NEXT_P||[]).push([i,()=>e.r(3115)]),t.hot&&t.hot.dispose(function(){window.__NEXT_P.push([i])})}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.