File "main.234a12a2.js"
Full path: E:/sites/Single15/tinmung2007/webroot/THDC-Hai- Ngoai/CauNguyen/static/js/main.234a12a2.js
File size: 809.01 KiB (828424 bytes)
MIME-type:
Charset: utf-8
/*! For license information please see main.234a12a2.js.LICENSE.txt */
!function(){"use strict";var e={725:function(e){var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(e,i){for(var a,o,u=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),s=1;s<arguments.length;s++){for(var c in a=Object(arguments[s]))n.call(a,c)&&(u[c]=a[c]);if(t){o=t(a);for(var l=0;l<o.length;l++)r.call(a,o[l])&&(u[o[l]]=a[o[l]])}}return u}},463:function(e,t,n){var r=n(791),i=n(725),a=n(296);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!r)throw Error(o(227));function u(e,t,n,r,i,a,o,u,s){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(l){this.onError(l)}}var s=!1,c=null,l=!1,f=null,h={onError:function(e){s=!0,c=e}};function d(e,t,n,r,i,a,o,l,f){s=!1,c=null,u.apply(h,arguments)}var p=null,v=null,m=null;function y(e,t,n){var r=e.type||"unknown-event";e.currentTarget=m(n),function(e,t,n,r,i,a,u,h,p){if(d.apply(this,arguments),s){if(!s)throw Error(o(198));var v=c;s=!1,c=null,l||(l=!0,f=v)}}(r,t,void 0,e),e.currentTarget=null}var g=null,k={};function w(){if(g)for(var e in k){var t=k[e],n=g.indexOf(e);if(!(-1<n))throw Error(o(96,e));if(!_[n]){if(!t.extractEvents)throw Error(o(97,e));for(var r in _[n]=t,n=t.eventTypes){var i=void 0,a=n[r],u=t,s=r;if(x.hasOwnProperty(s))throw Error(o(99,s));x[s]=a;var c=a.phasedRegistrationNames;if(c){for(i in c)c.hasOwnProperty(i)&&b(c[i],u,s);i=!0}else a.registrationName?(b(a.registrationName,u,s),i=!0):i=!1;if(!i)throw Error(o(98,r,e))}}}}function b(e,t,n){if(T[e])throw Error(o(100,e));T[e]=t,I[e]=t.eventTypes[n].dependencies}var _=[],x={},T={},I={};function E(e){var t,n=!1;for(t in e)if(e.hasOwnProperty(t)){var r=e[t];if(!k.hasOwnProperty(t)||k[t]!==r){if(k[t])throw Error(o(102,t));k[t]=r,n=!0}}n&&w()}var S=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),C=null,A=null,N=null;function P(e){if(e=v(e)){if("function"!==typeof C)throw Error(o(280));var t=e.stateNode;t&&(t=p(t),C(e.stateNode,e.type,t))}}function D(e){A?N?N.push(e):N=[e]:A=e}function R(){if(A){var e=A,t=N;if(N=A=null,P(e),t)for(e=0;e<t.length;e++)P(t[e])}}function O(e,t){return e(t)}function L(e,t,n,r,i){return e(t,n,r,i)}function M(){}var F=O,V=!1,U=!1;function j(){null===A&&null===N||(M(),R())}function z(e,t,n){if(U)return e(t,n);U=!0;try{return F(e,t,n)}finally{U=!1,j()}}var B=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,q=Object.prototype.hasOwnProperty,K={},G={};function H(e,t,n,r,i,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a}var W={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){W[e]=new H(e,0,!1,e,null,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];W[t]=new H(t,1,!1,e[1],null,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){W[e]=new H(e,2,!1,e.toLowerCase(),null,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){W[e]=new H(e,2,!1,e,null,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){W[e]=new H(e,3,!1,e.toLowerCase(),null,!1)})),["checked","multiple","muted","selected"].forEach((function(e){W[e]=new H(e,3,!0,e,null,!1)})),["capture","download"].forEach((function(e){W[e]=new H(e,4,!1,e,null,!1)})),["cols","rows","size","span"].forEach((function(e){W[e]=new H(e,6,!1,e,null,!1)})),["rowSpan","start"].forEach((function(e){W[e]=new H(e,5,!1,e.toLowerCase(),null,!1)}));var Q=/[\-:]([a-z])/g;function Y(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(Q,Y);W[t]=new H(t,1,!1,e,null,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(Q,Y);W[t]=new H(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(Q,Y);W[t]=new H(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)})),["tabIndex","crossOrigin"].forEach((function(e){W[e]=new H(e,1,!1,e.toLowerCase(),null,!1)})),W.xlinkHref=new H("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0),["src","href","action","formAction"].forEach((function(e){W[e]=new H(e,1,!1,e.toLowerCase(),null,!0)}));var J=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function X(e,t,n,r){var i=W.hasOwnProperty(t)?W[t]:null;(null!==i?0===i.type:!r&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,n,r){if(null===t||"undefined"===typeof t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,i,r)&&(n=null),r||null===i?function(e){return!!q.call(G,e)||!q.call(K,e)&&(B.test(e)?G[e]=!0:(K[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=null===n?3!==i.type&&"":n:(t=i.attributeName,r=i.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}J.hasOwnProperty("ReactCurrentDispatcher")||(J.ReactCurrentDispatcher={current:null}),J.hasOwnProperty("ReactCurrentBatchConfig")||(J.ReactCurrentBatchConfig={suspense:null});var $=/^(.*)[\\\/]/,Z="function"===typeof Symbol&&Symbol.for,ee=Z?Symbol.for("react.element"):60103,te=Z?Symbol.for("react.portal"):60106,ne=Z?Symbol.for("react.fragment"):60107,re=Z?Symbol.for("react.strict_mode"):60108,ie=Z?Symbol.for("react.profiler"):60114,ae=Z?Symbol.for("react.provider"):60109,oe=Z?Symbol.for("react.context"):60110,ue=Z?Symbol.for("react.concurrent_mode"):60111,se=Z?Symbol.for("react.forward_ref"):60112,ce=Z?Symbol.for("react.suspense"):60113,le=Z?Symbol.for("react.suspense_list"):60120,fe=Z?Symbol.for("react.memo"):60115,he=Z?Symbol.for("react.lazy"):60116,de=Z?Symbol.for("react.block"):60121,pe="function"===typeof Symbol&&Symbol.iterator;function ve(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=pe&&e[pe]||e["@@iterator"])?e:null}function me(e){if(null==e)return null;if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case ne:return"Fragment";case te:return"Portal";case ie:return"Profiler";case re:return"StrictMode";case ce:return"Suspense";case le:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case oe:return"Context.Consumer";case ae:return"Context.Provider";case se:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case fe:return me(e.type);case de:return me(e.render);case he:if(e=1===e._status?e._result:null)return me(e)}return null}function ye(e){var t="";do{e:switch(e.tag){case 3:case 4:case 6:case 7:case 10:case 9:var n="";break e;default:var r=e._debugOwner,i=e._debugSource,a=me(e.type);n=null,r&&(n=me(r.type)),r=a,a="",i?a=" (at "+i.fileName.replace($,"")+":"+i.lineNumber+")":n&&(a=" (created by "+n+")"),n="\n in "+(r||"Unknown")+a}t+=n,e=e.return}while(e);return t}function ge(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function ke(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function we(e){e._valueTracker||(e._valueTracker=function(e){var t=ke(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function be(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ke(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function _e(e,t){var n=t.checked;return i({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function xe(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=ge(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Te(e,t){null!=(t=t.checked)&&X(e,"checked",t,!1)}function Ie(e,t){Te(e,t);var n=ge(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?Se(e,t.type,n):t.hasOwnProperty("defaultValue")&&Se(e,t.type,ge(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Ee(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function Se(e,t,n){"number"===t&&e.ownerDocument.activeElement===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}function Ce(e,t){return e=i({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function Ae(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ge(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function Ne(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(o(91));return i({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Pe(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(o(92));if(Array.isArray(n)){if(!(1>=n.length))throw Error(o(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:ge(n)}}function De(e,t){var n=ge(t.value),r=ge(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function Re(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var Oe="http://www.w3.org/1999/xhtml",Le="http://www.w3.org/2000/svg";function Me(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Fe(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Me(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var Ve,Ue,je=(Ue=function(e,t){if(e.namespaceURI!==Le||"innerHTML"in e)e.innerHTML=t;else{for((Ve=Ve||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ve.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return Ue(e,t)}))}:Ue);function ze(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}function Be(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var qe={animationend:Be("Animation","AnimationEnd"),animationiteration:Be("Animation","AnimationIteration"),animationstart:Be("Animation","AnimationStart"),transitionend:Be("Transition","TransitionEnd")},Ke={},Ge={};function He(e){if(Ke[e])return Ke[e];if(!qe[e])return e;var t,n=qe[e];for(t in n)if(n.hasOwnProperty(t)&&t in Ge)return Ke[e]=n[t];return e}S&&(Ge=document.createElement("div").style,"AnimationEvent"in window||(delete qe.animationend.animation,delete qe.animationiteration.animation,delete qe.animationstart.animation),"TransitionEvent"in window||delete qe.transitionend.transition);var We=He("animationend"),Qe=He("animationiteration"),Ye=He("animationstart"),Je=He("transitionend"),Xe="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),$e=new("function"===typeof WeakMap?WeakMap:Map);function Ze(e){var t=$e.get(e);return void 0===t&&(t=new Map,$e.set(e,t)),t}function et(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!==(1026&(t=e).effectTag)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function tt(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function nt(e){if(et(e)!==e)throw Error(o(188))}function rt(e){if(e=function(e){var t=e.alternate;if(!t){if(null===(t=et(e)))throw Error(o(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var a=i.alternate;if(null===a){if(null!==(r=i.return)){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return nt(i),e;if(a===r)return nt(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var u=!1,s=i.child;s;){if(s===n){u=!0,n=i,r=a;break}if(s===r){u=!0,r=i,n=a;break}s=s.sibling}if(!u){for(s=a.child;s;){if(s===n){u=!0,n=a,r=i;break}if(s===r){u=!0,r=a,n=i;break}s=s.sibling}if(!u)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(3!==n.tag)throw Error(o(188));return n.stateNode.current===n?e:t}(e),!e)return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function it(e,t){if(null==t)throw Error(o(30));return null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function at(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}var ot=null;function ut(e){if(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(var r=0;r<t.length&&!e.isPropagationStopped();r++)y(e,t[r],n[r]);else t&&y(e,t,n);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function st(e){if(null!==e&&(ot=it(ot,e)),e=ot,ot=null,e){if(at(e,ut),ot)throw Error(o(95));if(l)throw e=f,l=!1,f=null,e}}function ct(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}function lt(e){if(!S)return!1;var t=(e="on"+e)in document;return t||((t=document.createElement("div")).setAttribute(e,"return;"),t="function"===typeof t[e]),t}var ft=[];function ht(e){e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>ft.length&&ft.push(e)}function dt(e,t,n,r){if(ft.length){var i=ft.pop();return i.topLevelType=e,i.eventSystemFlags=r,i.nativeEvent=t,i.targetInst=n,i}return{topLevelType:e,eventSystemFlags:r,nativeEvent:t,targetInst:n,ancestors:[]}}function pt(e){var t=e.targetInst,n=t;do{if(!n){e.ancestors.push(n);break}var r=n;if(3===r.tag)r=r.stateNode.containerInfo;else{for(;r.return;)r=r.return;r=3!==r.tag?null:r.stateNode.containerInfo}if(!r)break;5!==(t=n.tag)&&6!==t||e.ancestors.push(n),n=Rn(r)}while(n);for(n=0;n<e.ancestors.length;n++){t=e.ancestors[n];var i=ct(e.nativeEvent);r=e.topLevelType;var a=e.nativeEvent,o=e.eventSystemFlags;0===n&&(o|=64);for(var u=null,s=0;s<_.length;s++){var c=_[s];c&&(c=c.extractEvents(r,t,a,i,o))&&(u=it(u,c))}st(u)}}function vt(e,t,n){if(!n.has(e)){switch(e){case"scroll":Yt(t,"scroll",!0);break;case"focus":case"blur":Yt(t,"focus",!0),Yt(t,"blur",!0),n.set("blur",null),n.set("focus",null);break;case"cancel":case"close":lt(e)&&Yt(t,e,!0);break;case"invalid":case"submit":case"reset":break;default:-1===Xe.indexOf(e)&&Qt(e,t)}n.set(e,null)}}var mt,yt,gt,kt=!1,wt=[],bt=null,_t=null,xt=null,Tt=new Map,It=new Map,Et=[],St="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput close cancel copy cut paste click change contextmenu reset submit".split(" "),Ct="focus blur dragenter dragleave mouseover mouseout pointerover pointerout gotpointercapture lostpointercapture".split(" ");function At(e,t,n,r,i){return{blockedOn:e,topLevelType:t,eventSystemFlags:32|n,nativeEvent:i,container:r}}function Nt(e,t){switch(e){case"focus":case"blur":bt=null;break;case"dragenter":case"dragleave":_t=null;break;case"mouseover":case"mouseout":xt=null;break;case"pointerover":case"pointerout":Tt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":It.delete(t.pointerId)}}function Pt(e,t,n,r,i,a){return null===e||e.nativeEvent!==a?(e=At(t,n,r,i,a),null!==t&&(null!==(t=On(t))&&yt(t)),e):(e.eventSystemFlags|=r,e)}function Dt(e){var t=Rn(e.target);if(null!==t){var n=et(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=tt(n)))return e.blockedOn=t,void a.unstable_runWithPriority(e.priority,(function(){gt(n)}))}else if(3===t&&n.stateNode.hydrate)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Rt(e){if(null!==e.blockedOn)return!1;var t=Zt(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);if(null!==t){var n=On(t);return null!==n&&yt(n),e.blockedOn=t,!1}return!0}function Ot(e,t,n){Rt(e)&&n.delete(t)}function Lt(){for(kt=!1;0<wt.length;){var e=wt[0];if(null!==e.blockedOn){null!==(e=On(e.blockedOn))&&mt(e);break}var t=Zt(e.topLevelType,e.eventSystemFlags,e.container,e.nativeEvent);null!==t?e.blockedOn=t:wt.shift()}null!==bt&&Rt(bt)&&(bt=null),null!==_t&&Rt(_t)&&(_t=null),null!==xt&&Rt(xt)&&(xt=null),Tt.forEach(Ot),It.forEach(Ot)}function Mt(e,t){e.blockedOn===t&&(e.blockedOn=null,kt||(kt=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Lt)))}function Ft(e){function t(t){return Mt(t,e)}if(0<wt.length){Mt(wt[0],e);for(var n=1;n<wt.length;n++){var r=wt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==bt&&Mt(bt,e),null!==_t&&Mt(_t,e),null!==xt&&Mt(xt,e),Tt.forEach(t),It.forEach(t),n=0;n<Et.length;n++)(r=Et[n]).blockedOn===e&&(r.blockedOn=null);for(;0<Et.length&&null===(n=Et[0]).blockedOn;)Dt(n),null===n.blockedOn&&Et.shift()}var Vt={},Ut=new Map,jt=new Map,zt=["abort","abort",We,"animationEnd",Qe,"animationIteration",Ye,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Je,"transitionEnd","waiting","waiting"];function Bt(e,t){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1],a="on"+(i[0].toUpperCase()+i.slice(1));a={phasedRegistrationNames:{bubbled:a,captured:a+"Capture"},dependencies:[r],eventPriority:t},jt.set(r,t),Ut.set(r,a),Vt[i]=a}}Bt("blur blur cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focus focus input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),Bt("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),Bt(zt,2);for(var qt="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),Kt=0;Kt<qt.length;Kt++)jt.set(qt[Kt],0);var Gt=a.unstable_UserBlockingPriority,Ht=a.unstable_runWithPriority,Wt=!0;function Qt(e,t){Yt(t,e,!1)}function Yt(e,t,n){var r=jt.get(t);switch(void 0===r?2:r){case 0:r=Jt.bind(null,t,1,e);break;case 1:r=Xt.bind(null,t,1,e);break;default:r=$t.bind(null,t,1,e)}n?e.addEventListener(t,r,!0):e.addEventListener(t,r,!1)}function Jt(e,t,n,r){V||M();var i=$t,a=V;V=!0;try{L(i,e,t,n,r)}finally{(V=a)||j()}}function Xt(e,t,n,r){Ht(Gt,$t.bind(null,e,t,n,r))}function $t(e,t,n,r){if(Wt)if(0<wt.length&&-1<St.indexOf(e))e=At(null,e,t,n,r),wt.push(e);else{var i=Zt(e,t,n,r);if(null===i)Nt(e,r);else if(-1<St.indexOf(e))e=At(i,e,t,n,r),wt.push(e);else if(!function(e,t,n,r,i){switch(t){case"focus":return bt=Pt(bt,e,t,n,r,i),!0;case"dragenter":return _t=Pt(_t,e,t,n,r,i),!0;case"mouseover":return xt=Pt(xt,e,t,n,r,i),!0;case"pointerover":var a=i.pointerId;return Tt.set(a,Pt(Tt.get(a)||null,e,t,n,r,i)),!0;case"gotpointercapture":return a=i.pointerId,It.set(a,Pt(It.get(a)||null,e,t,n,r,i)),!0}return!1}(i,e,t,n,r)){Nt(e,r),e=dt(e,r,null,t);try{z(pt,e)}finally{ht(e)}}}}function Zt(e,t,n,r){if(null!==(n=Rn(n=ct(r)))){var i=et(n);if(null===i)n=null;else{var a=i.tag;if(13===a){if(null!==(n=tt(i)))return n;n=null}else if(3===a){if(i.stateNode.hydrate)return 3===i.tag?i.stateNode.containerInfo:null;n=null}else i!==n&&(n=null)}}e=dt(e,r,n,t);try{z(pt,e)}finally{ht(e)}return null}var en={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tn=["Webkit","ms","Moz","O"];function nn(e,t,n){return null==t||"boolean"===typeof t||""===t?"":n||"number"!==typeof t||0===t||en.hasOwnProperty(e)&&en[e]?(""+t).trim():t+"px"}function rn(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=nn(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(en).forEach((function(e){tn.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),en[t]=en[e]}))}));var an=i({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function on(e,t){if(t){if(an[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(o(137,e,""));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(o(60));if("object"!==typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(null!=t.style&&"object"!==typeof t.style)throw Error(o(62,""))}}function un(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var sn=Oe;function cn(e,t){var n=Ze(e=9===e.nodeType||11===e.nodeType?e:e.ownerDocument);t=I[t];for(var r=0;r<t.length;r++)vt(t[r],e,n)}function ln(){}function fn(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function hn(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dn(e,t){var n,r=hn(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=hn(r)}}function pn(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?pn(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function vn(){for(var e=window,t=fn();t instanceof e.HTMLIFrameElement;){try{var n="string"===typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=fn((e=t.contentWindow).document)}return t}function mn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var yn="$",gn="/$",kn="$?",wn="$!",bn=null,_n=null;function xn(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Tn(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"===typeof t.children||"number"===typeof t.children||"object"===typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var In="function"===typeof setTimeout?setTimeout:void 0,En="function"===typeof clearTimeout?clearTimeout:void 0;function Sn(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function Cn(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if(n===yn||n===wn||n===kn){if(0===t)return e;t--}else n===gn&&t++}e=e.previousSibling}return null}var An=Math.random().toString(36).slice(2),Nn="__reactInternalInstance$"+An,Pn="__reactEventHandlers$"+An,Dn="__reactContainere$"+An;function Rn(e){var t=e[Nn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Dn]||n[Nn]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Cn(e);null!==e;){if(n=e[Nn])return n;e=Cn(e)}return t}n=(e=n).parentNode}return null}function On(e){return!(e=e[Nn]||e[Dn])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function Ln(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(o(33))}function Mn(e){return e[Pn]||null}function Fn(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function Vn(e,t){var n=e.stateNode;if(!n)return null;var r=p(n);if(!r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!==typeof n)throw Error(o(231,t,typeof n));return n}function Un(e,t,n){(t=Vn(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=it(n._dispatchListeners,t),n._dispatchInstances=it(n._dispatchInstances,e))}function jn(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,n=[];t;)n.push(t),t=Fn(t);for(t=n.length;0<t--;)Un(n[t],"captured",e);for(t=0;t<n.length;t++)Un(n[t],"bubbled",e)}}function zn(e,t,n){e&&n&&n.dispatchConfig.registrationName&&(t=Vn(e,n.dispatchConfig.registrationName))&&(n._dispatchListeners=it(n._dispatchListeners,t),n._dispatchInstances=it(n._dispatchInstances,e))}function Bn(e){e&&e.dispatchConfig.registrationName&&zn(e._targetInst,null,e)}function qn(e){at(e,jn)}var Kn=null,Gn=null,Hn=null;function Wn(){if(Hn)return Hn;var e,t,n=Gn,r=n.length,i="value"in Kn?Kn.value:Kn.textContent,a=i.length;for(e=0;e<r&&n[e]===i[e];e++);var o=r-e;for(t=1;t<=o&&n[r-t]===i[a-t];t++);return Hn=i.slice(e,1<t?1-t:void 0)}function Qn(){return!0}function Yn(){return!1}function Jn(e,t,n,r){for(var i in this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n,e=this.constructor.Interface)e.hasOwnProperty(i)&&((t=e[i])?this[i]=t(n):"target"===i?this.target=r:this[i]=n[i]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?Qn:Yn,this.isPropagationStopped=Yn,this}function Xn(e,t,n,r){if(this.eventPool.length){var i=this.eventPool.pop();return this.call(i,e,t,n,r),i}return new this(e,t,n,r)}function $n(e){if(!(e instanceof this))throw Error(o(279));e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function Zn(e){e.eventPool=[],e.getPooled=Xn,e.release=$n}i(Jn.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!==typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=Qn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Qn)},persist:function(){this.isPersistent=Qn},isPersistent:Yn,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=Yn,this._dispatchInstances=this._dispatchListeners=null}}),Jn.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},Jn.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var a=new t;return i(a,n.prototype),n.prototype=a,n.prototype.constructor=n,n.Interface=i({},r.Interface,e),n.extend=r.extend,Zn(n),n},Zn(Jn);var er=Jn.extend({data:null}),tr=Jn.extend({data:null}),nr=[9,13,27,32],rr=S&&"CompositionEvent"in window,ir=null;S&&"documentMode"in document&&(ir=document.documentMode);var ar=S&&"TextEvent"in window&&!ir,or=S&&(!rr||ir&&8<ir&&11>=ir),ur=String.fromCharCode(32),sr={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},cr=!1;function lr(e,t){switch(e){case"keyup":return-1!==nr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function fr(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var hr=!1;var dr={eventTypes:sr,extractEvents:function(e,t,n,r){var i;if(rr)e:{switch(e){case"compositionstart":var a=sr.compositionStart;break e;case"compositionend":a=sr.compositionEnd;break e;case"compositionupdate":a=sr.compositionUpdate;break e}a=void 0}else hr?lr(e,n)&&(a=sr.compositionEnd):"keydown"===e&&229===n.keyCode&&(a=sr.compositionStart);return a?(or&&"ko"!==n.locale&&(hr||a!==sr.compositionStart?a===sr.compositionEnd&&hr&&(i=Wn()):(Gn="value"in(Kn=r)?Kn.value:Kn.textContent,hr=!0)),a=er.getPooled(a,t,n,r),i?a.data=i:null!==(i=fr(n))&&(a.data=i),qn(a),i=a):i=null,(e=ar?function(e,t){switch(e){case"compositionend":return fr(t);case"keypress":return 32!==t.which?null:(cr=!0,ur);case"textInput":return(e=t.data)===ur&&cr?null:e;default:return null}}(e,n):function(e,t){if(hr)return"compositionend"===e||!rr&&lr(e,t)?(e=Wn(),Hn=Gn=Kn=null,hr=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return or&&"ko"!==t.locale?null:t.data}}(e,n))?((t=tr.getPooled(sr.beforeInput,t,n,r)).data=e,qn(t)):t=null,null===i?t:null===t?i:[i,t]}},pr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function vr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!pr[e.type]:"textarea"===t}var mr={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function yr(e,t,n){return(e=Jn.getPooled(mr.change,e,t,n)).type="change",D(n),qn(e),e}var gr=null,kr=null;function wr(e){st(e)}function br(e){if(be(Ln(e)))return e}function _r(e,t){if("change"===e)return t}var xr=!1;function Tr(){gr&&(gr.detachEvent("onpropertychange",Ir),kr=gr=null)}function Ir(e){if("value"===e.propertyName&&br(kr))if(e=yr(kr,e,ct(e)),V)st(e);else{V=!0;try{O(wr,e)}finally{V=!1,j()}}}function Er(e,t,n){"focus"===e?(Tr(),kr=n,(gr=t).attachEvent("onpropertychange",Ir)):"blur"===e&&Tr()}function Sr(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return br(kr)}function Cr(e,t){if("click"===e)return br(t)}function Ar(e,t){if("input"===e||"change"===e)return br(t)}S&&(xr=lt("input")&&(!document.documentMode||9<document.documentMode));var Nr={eventTypes:mr,_isInputEventSupported:xr,extractEvents:function(e,t,n,r){var i=t?Ln(t):window,a=i.nodeName&&i.nodeName.toLowerCase();if("select"===a||"input"===a&&"file"===i.type)var o=_r;else if(vr(i))if(xr)o=Ar;else{o=Sr;var u=Er}else(a=i.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===i.type||"radio"===i.type)&&(o=Cr);if(o&&(o=o(e,t)))return yr(o,n,r);u&&u(e,i,t),"blur"===e&&(e=i._wrapperState)&&e.controlled&&"number"===i.type&&Se(i,"number",i.value)}},Pr=Jn.extend({view:null,detail:null}),Dr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Rr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Dr[e])&&!!t[e]}function Or(){return Rr}var Lr=0,Mr=0,Fr=!1,Vr=!1,Ur=Pr.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Or,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},movementX:function(e){if("movementX"in e)return e.movementX;var t=Lr;return Lr=e.screenX,Fr?"mousemove"===e.type?e.screenX-t:0:(Fr=!0,0)},movementY:function(e){if("movementY"in e)return e.movementY;var t=Mr;return Mr=e.screenY,Vr?"mousemove"===e.type?e.screenY-t:0:(Vr=!0,0)}}),jr=Ur.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),zr={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},Br={eventTypes:zr,extractEvents:function(e,t,n,r,i){var a="mouseover"===e||"pointerover"===e,o="mouseout"===e||"pointerout"===e;if(a&&0===(32&i)&&(n.relatedTarget||n.fromElement)||!o&&!a)return null;(a=r.window===r?r:(a=r.ownerDocument)?a.defaultView||a.parentWindow:window,o)?(o=t,null!==(t=(t=n.relatedTarget||n.toElement)?Rn(t):null)&&(t!==et(t)||5!==t.tag&&6!==t.tag)&&(t=null)):o=null;if(o===t)return null;if("mouseout"===e||"mouseover"===e)var u=Ur,s=zr.mouseLeave,c=zr.mouseEnter,l="mouse";else"pointerout"!==e&&"pointerover"!==e||(u=jr,s=zr.pointerLeave,c=zr.pointerEnter,l="pointer");if(e=null==o?a:Ln(o),a=null==t?a:Ln(t),(s=u.getPooled(s,o,n,r)).type=l+"leave",s.target=e,s.relatedTarget=a,(n=u.getPooled(c,t,n,r)).type=l+"enter",n.target=a,n.relatedTarget=e,l=t,(r=o)&&l)e:{for(c=l,o=0,e=u=r;e;e=Fn(e))o++;for(e=0,t=c;t;t=Fn(t))e++;for(;0<o-e;)u=Fn(u),o--;for(;0<e-o;)c=Fn(c),e--;for(;o--;){if(u===c||u===c.alternate)break e;u=Fn(u),c=Fn(c)}u=null}else u=null;for(c=u,u=[];r&&r!==c&&(null===(o=r.alternate)||o!==c);)u.push(r),r=Fn(r);for(r=[];l&&l!==c&&(null===(o=l.alternate)||o!==c);)r.push(l),l=Fn(l);for(l=0;l<u.length;l++)zn(u[l],"bubbled",s);for(l=r.length;0<l--;)zn(r[l],"captured",n);return 0===(64&i)?[s]:[s,n]}};var qr="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},Kr=Object.prototype.hasOwnProperty;function Gr(e,t){if(qr(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!Kr.call(t,n[r])||!qr(e[n[r]],t[n[r]]))return!1;return!0}var Hr=S&&"documentMode"in document&&11>=document.documentMode,Wr={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Qr=null,Yr=null,Jr=null,Xr=!1;function $r(e,t){var n=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;return Xr||null==Qr||Qr!==fn(n)?null:("selectionStart"in(n=Qr)&&mn(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},Jr&&Gr(Jr,n)?null:(Jr=n,(e=Jn.getPooled(Wr.select,Yr,e,t)).type="select",e.target=Qr,qn(e),e))}var Zr={eventTypes:Wr,extractEvents:function(e,t,n,r,i,a){if(!(a=!(i=a||(r.window===r?r.document:9===r.nodeType?r:r.ownerDocument)))){e:{i=Ze(i),a=I.onSelect;for(var o=0;o<a.length;o++)if(!i.has(a[o])){i=!1;break e}i=!0}a=!i}if(a)return null;switch(i=t?Ln(t):window,e){case"focus":(vr(i)||"true"===i.contentEditable)&&(Qr=i,Yr=t,Jr=null);break;case"blur":Jr=Yr=Qr=null;break;case"mousedown":Xr=!0;break;case"contextmenu":case"mouseup":case"dragend":return Xr=!1,$r(n,r);case"selectionchange":if(Hr)break;case"keydown":case"keyup":return $r(n,r)}return null}},ei=Jn.extend({animationName:null,elapsedTime:null,pseudoElement:null}),ti=Jn.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ni=Pr.extend({relatedTarget:null});function ri(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}var ii={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ai={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},oi=Pr.extend({key:function(e){if(e.key){var t=ii[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=ri(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?ai[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Or,charCode:function(e){return"keypress"===e.type?ri(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?ri(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),ui=Ur.extend({dataTransfer:null}),si=Pr.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Or}),ci=Jn.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),li=Ur.extend({deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),fi={eventTypes:Vt,extractEvents:function(e,t,n,r){var i=Ut.get(e);if(!i)return null;switch(e){case"keypress":if(0===ri(n))return null;case"keydown":case"keyup":e=oi;break;case"blur":case"focus":e=ni;break;case"click":if(2===n.button)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":e=Ur;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":e=ui;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":e=si;break;case We:case Qe:case Ye:e=ei;break;case Je:e=ci;break;case"scroll":e=Pr;break;case"wheel":e=li;break;case"copy":case"cut":case"paste":e=ti;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":e=jr;break;default:e=Jn}return qn(t=e.getPooled(i,t,n,r)),t}};if(g)throw Error(o(101));g=Array.prototype.slice.call("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),w(),p=Mn,v=On,m=Ln,E({SimpleEventPlugin:fi,EnterLeaveEventPlugin:Br,ChangeEventPlugin:Nr,SelectEventPlugin:Zr,BeforeInputEventPlugin:dr});var hi=[],di=-1;function pi(e){0>di||(e.current=hi[di],hi[di]=null,di--)}function vi(e,t){di++,hi[di]=e.current,e.current=t}var mi={},yi={current:mi},gi={current:!1},ki=mi;function wi(e,t){var n=e.type.contextTypes;if(!n)return mi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,a={};for(i in n)a[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function bi(e){return null!==(e=e.childContextTypes)&&void 0!==e}function _i(){pi(gi),pi(yi)}function xi(e,t,n){if(yi.current!==mi)throw Error(o(168));vi(yi,t),vi(gi,n)}function Ti(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!==typeof r.getChildContext)return n;for(var a in r=r.getChildContext())if(!(a in e))throw Error(o(108,me(t)||"Unknown",a));return i({},n,{},r)}function Ii(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mi,ki=yi.current,vi(yi,e),vi(gi,gi.current),!0}function Ei(e,t,n){var r=e.stateNode;if(!r)throw Error(o(169));n?(e=Ti(e,t,ki),r.__reactInternalMemoizedMergedChildContext=e,pi(gi),pi(yi),vi(yi,e)):pi(gi),vi(gi,n)}var Si=a.unstable_runWithPriority,Ci=a.unstable_scheduleCallback,Ai=a.unstable_cancelCallback,Ni=a.unstable_requestPaint,Pi=a.unstable_now,Di=a.unstable_getCurrentPriorityLevel,Ri=a.unstable_ImmediatePriority,Oi=a.unstable_UserBlockingPriority,Li=a.unstable_NormalPriority,Mi=a.unstable_LowPriority,Fi=a.unstable_IdlePriority,Vi={},Ui=a.unstable_shouldYield,ji=void 0!==Ni?Ni:function(){},zi=null,Bi=null,qi=!1,Ki=Pi(),Gi=1e4>Ki?Pi:function(){return Pi()-Ki};function Hi(){switch(Di()){case Ri:return 99;case Oi:return 98;case Li:return 97;case Mi:return 96;case Fi:return 95;default:throw Error(o(332))}}function Wi(e){switch(e){case 99:return Ri;case 98:return Oi;case 97:return Li;case 96:return Mi;case 95:return Fi;default:throw Error(o(332))}}function Qi(e,t){return e=Wi(e),Si(e,t)}function Yi(e,t,n){return e=Wi(e),Ci(e,t,n)}function Ji(e){return null===zi?(zi=[e],Bi=Ci(Ri,$i)):zi.push(e),Vi}function Xi(){if(null!==Bi){var e=Bi;Bi=null,Ai(e)}$i()}function $i(){if(!qi&&null!==zi){qi=!0;var e=0;try{var t=zi;Qi(99,(function(){for(;e<t.length;e++){var n=t[e];do{n=n(!0)}while(null!==n)}})),zi=null}catch(n){throw null!==zi&&(zi=zi.slice(e+1)),Ci(Ri,Xi),n}finally{qi=!1}}}function Zi(e,t,n){return 1073741821-(1+((1073741821-e+t/10)/(n/=10)|0))*n}function ea(e,t){if(e&&e.defaultProps)for(var n in t=i({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}var ta={current:null},na=null,ra=null,ia=null;function aa(){ia=ra=na=null}function oa(e){var t=ta.current;pi(ta),e.type._context._currentValue=t}function ua(e,t){for(;null!==e;){var n=e.alternate;if(e.childExpirationTime<t)e.childExpirationTime=t,null!==n&&n.childExpirationTime<t&&(n.childExpirationTime=t);else{if(!(null!==n&&n.childExpirationTime<t))break;n.childExpirationTime=t}e=e.return}}function sa(e,t){na=e,ia=ra=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(e.expirationTime>=t&&(Mo=!0),e.firstContext=null)}function ca(e,t){if(ia!==e&&!1!==t&&0!==t)if("number"===typeof t&&1073741823!==t||(ia=e,t=1073741823),t={context:e,observedBits:t,next:null},null===ra){if(null===na)throw Error(o(308));ra=t,na.dependencies={expirationTime:0,firstContext:t,responders:null}}else ra=ra.next=t;return e._currentValue}var la=!1;function fa(e){e.updateQueue={baseState:e.memoizedState,baseQueue:null,shared:{pending:null},effects:null}}function ha(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,baseQueue:e.baseQueue,shared:e.shared,effects:e.effects})}function da(e,t){return(e={expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null}).next=e}function pa(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function va(e,t){var n=e.alternate;null!==n&&ha(n,e),null===(n=(e=e.updateQueue).baseQueue)?(e.baseQueue=t.next=t,t.next=t):(t.next=n.next,n.next=t)}function ma(e,t,n,r){var a=e.updateQueue;la=!1;var o=a.baseQueue,u=a.shared.pending;if(null!==u){if(null!==o){var s=o.next;o.next=u.next,u.next=s}o=u,a.shared.pending=null,null!==(s=e.alternate)&&(null!==(s=s.updateQueue)&&(s.baseQueue=u))}if(null!==o){s=o.next;var c=a.baseState,l=0,f=null,h=null,d=null;if(null!==s)for(var p=s;;){if((u=p.expirationTime)<r){var v={expirationTime:p.expirationTime,suspenseConfig:p.suspenseConfig,tag:p.tag,payload:p.payload,callback:p.callback,next:null};null===d?(h=d=v,f=c):d=d.next=v,u>l&&(l=u)}else{null!==d&&(d=d.next={expirationTime:1073741823,suspenseConfig:p.suspenseConfig,tag:p.tag,payload:p.payload,callback:p.callback,next:null}),_s(u,p.suspenseConfig);e:{var m=e,y=p;switch(u=t,v=n,y.tag){case 1:if("function"===typeof(m=y.payload)){c=m.call(v,c,u);break e}c=m;break e;case 3:m.effectTag=-4097&m.effectTag|64;case 0:if(null===(u="function"===typeof(m=y.payload)?m.call(v,c,u):m)||void 0===u)break e;c=i({},c,u);break e;case 2:la=!0}}null!==p.callback&&(e.effectTag|=32,null===(u=a.effects)?a.effects=[p]:u.push(p))}if(null===(p=p.next)||p===s){if(null===(u=a.shared.pending))break;p=o.next=u.next,u.next=s,a.baseQueue=o=u,a.shared.pending=null}}null===d?f=c:d.next=h,a.baseState=f,a.baseQueue=d,xs(l),e.expirationTime=l,e.memoizedState=c}}function ya(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(null!==i){if(r.callback=null,r=i,i=n,"function"!==typeof r)throw Error(o(191,r));r.call(i)}}}var ga=J.ReactCurrentBatchConfig,ka=(new r.Component).refs;function wa(e,t,n,r){n=null===(n=n(r,t=e.memoizedState))||void 0===n?t:i({},t,n),e.memoizedState=n,0===e.expirationTime&&(e.updateQueue.baseState=n)}var ba={isMounted:function(e){return!!(e=e._reactInternalFiber)&&et(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternalFiber;var r=cs(),i=ga.suspense;(i=da(r=ls(r,e,i),i)).payload=t,void 0!==n&&null!==n&&(i.callback=n),pa(e,i),fs(e,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternalFiber;var r=cs(),i=ga.suspense;(i=da(r=ls(r,e,i),i)).tag=1,i.payload=t,void 0!==n&&null!==n&&(i.callback=n),pa(e,i),fs(e,r)},enqueueForceUpdate:function(e,t){e=e._reactInternalFiber;var n=cs(),r=ga.suspense;(r=da(n=ls(n,e,r),r)).tag=2,void 0!==t&&null!==t&&(r.callback=t),pa(e,r),fs(e,n)}};function _a(e,t,n,r,i,a,o){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,a,o):!t.prototype||!t.prototype.isPureReactComponent||(!Gr(n,r)||!Gr(i,a))}function xa(e,t,n){var r=!1,i=mi,a=t.contextType;return"object"===typeof a&&null!==a?a=ca(a):(i=bi(t)?ki:yi.current,a=(r=null!==(r=t.contextTypes)&&void 0!==r)?wi(e,i):mi),t=new t(n,a),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=ba,e.stateNode=t,t._reactInternalFiber=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Ta(e,t,n,r){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ba.enqueueReplaceState(t,t.state,null)}function Ia(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs=ka,fa(e);var a=t.contextType;"object"===typeof a&&null!==a?i.context=ca(a):(a=bi(t)?ki:yi.current,i.context=wi(e,a)),ma(e,n,i,r),i.state=e.memoizedState,"function"===typeof(a=t.getDerivedStateFromProps)&&(wa(e,t,a,n),i.state=e.memoizedState),"function"===typeof t.getDerivedStateFromProps||"function"===typeof i.getSnapshotBeforeUpdate||"function"!==typeof i.UNSAFE_componentWillMount&&"function"!==typeof i.componentWillMount||(t=i.state,"function"===typeof i.componentWillMount&&i.componentWillMount(),"function"===typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&ba.enqueueReplaceState(i,i.state,null),ma(e,n,i,r),i.state=e.memoizedState),"function"===typeof i.componentDidMount&&(e.effectTag|=4)}var Ea=Array.isArray;function Sa(e,t,n){if(null!==(e=n.ref)&&"function"!==typeof e&&"object"!==typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(o(309));var r=n.stateNode}if(!r)throw Error(o(147,e));var i=""+e;return null!==t&&null!==t.ref&&"function"===typeof t.ref&&t.ref._stringRef===i?t.ref:(t=function(e){var t=r.refs;t===ka&&(t=r.refs={}),null===e?delete t[i]:t[i]=e},t._stringRef=i,t)}if("string"!==typeof e)throw Error(o(284));if(!n._owner)throw Error(o(290,e))}return e}function Ca(e,t){if("textarea"!==e.type)throw Error(o(31,"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t,""))}function Aa(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=qs(e,t)).index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.effectTag=2,n):r:(t.effectTag=2,n):n}function u(t){return e&&null===t.alternate&&(t.effectTag=2),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Hs(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function c(e,t,n,r){return null!==t&&t.elementType===n.type?((r=i(t,n.props)).ref=Sa(e,t,n),r.return=e,r):((r=Ks(n.type,n.key,n.props,null,e.mode,r)).ref=Sa(e,t,n),r.return=e,r)}function l(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Ws(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function f(e,t,n,r,a){return null===t||7!==t.tag?((t=Gs(n,e.mode,r,a)).return=e,t):((t=i(t,n)).return=e,t)}function h(e,t,n){if("string"===typeof t||"number"===typeof t)return(t=Hs(""+t,e.mode,n)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case ee:return(n=Ks(t.type,t.key,t.props,null,e.mode,n)).ref=Sa(e,null,t),n.return=e,n;case te:return(t=Ws(t,e.mode,n)).return=e,t}if(Ea(t)||ve(t))return(t=Gs(t,e.mode,n,null)).return=e,t;Ca(e,t)}return null}function d(e,t,n,r){var i=null!==t?t.key:null;if("string"===typeof n||"number"===typeof n)return null!==i?null:s(e,t,""+n,r);if("object"===typeof n&&null!==n){switch(n.$$typeof){case ee:return n.key===i?n.type===ne?f(e,t,n.props.children,r,i):c(e,t,n,r):null;case te:return n.key===i?l(e,t,n,r):null}if(Ea(n)||ve(n))return null!==i?null:f(e,t,n,r,null);Ca(e,n)}return null}function p(e,t,n,r,i){if("string"===typeof r||"number"===typeof r)return s(t,e=e.get(n)||null,""+r,i);if("object"===typeof r&&null!==r){switch(r.$$typeof){case ee:return e=e.get(null===r.key?n:r.key)||null,r.type===ne?f(t,e,r.props.children,i,r.key):c(t,e,r,i);case te:return l(t,e=e.get(null===r.key?n:r.key)||null,r,i)}if(Ea(r)||ve(r))return f(t,e=e.get(n)||null,r,i,null);Ca(t,r)}return null}function v(i,o,u,s){for(var c=null,l=null,f=o,v=o=0,m=null;null!==f&&v<u.length;v++){f.index>v?(m=f,f=null):m=f.sibling;var y=d(i,f,u[v],s);if(null===y){null===f&&(f=m);break}e&&f&&null===y.alternate&&t(i,f),o=a(y,o,v),null===l?c=y:l.sibling=y,l=y,f=m}if(v===u.length)return n(i,f),c;if(null===f){for(;v<u.length;v++)null!==(f=h(i,u[v],s))&&(o=a(f,o,v),null===l?c=f:l.sibling=f,l=f);return c}for(f=r(i,f);v<u.length;v++)null!==(m=p(f,i,v,u[v],s))&&(e&&null!==m.alternate&&f.delete(null===m.key?v:m.key),o=a(m,o,v),null===l?c=m:l.sibling=m,l=m);return e&&f.forEach((function(e){return t(i,e)})),c}function m(i,u,s,c){var l=ve(s);if("function"!==typeof l)throw Error(o(150));if(null==(s=l.call(s)))throw Error(o(151));for(var f=l=null,v=u,m=u=0,y=null,g=s.next();null!==v&&!g.done;m++,g=s.next()){v.index>m?(y=v,v=null):y=v.sibling;var k=d(i,v,g.value,c);if(null===k){null===v&&(v=y);break}e&&v&&null===k.alternate&&t(i,v),u=a(k,u,m),null===f?l=k:f.sibling=k,f=k,v=y}if(g.done)return n(i,v),l;if(null===v){for(;!g.done;m++,g=s.next())null!==(g=h(i,g.value,c))&&(u=a(g,u,m),null===f?l=g:f.sibling=g,f=g);return l}for(v=r(i,v);!g.done;m++,g=s.next())null!==(g=p(v,i,m,g.value,c))&&(e&&null!==g.alternate&&v.delete(null===g.key?m:g.key),u=a(g,u,m),null===f?l=g:f.sibling=g,f=g);return e&&v.forEach((function(e){return t(i,e)})),l}return function(e,r,a,s){var c="object"===typeof a&&null!==a&&a.type===ne&&null===a.key;c&&(a=a.props.children);var l="object"===typeof a&&null!==a;if(l)switch(a.$$typeof){case ee:e:{for(l=a.key,c=r;null!==c;){if(c.key===l){if(7===c.tag){if(a.type===ne){n(e,c.sibling),(r=i(c,a.props.children)).return=e,e=r;break e}}else if(c.elementType===a.type){n(e,c.sibling),(r=i(c,a.props)).ref=Sa(e,c,a),r.return=e,e=r;break e}n(e,c);break}t(e,c),c=c.sibling}a.type===ne?((r=Gs(a.props.children,e.mode,s,a.key)).return=e,e=r):((s=Ks(a.type,a.key,a.props,null,e.mode,s)).ref=Sa(e,r,a),s.return=e,e=s)}return u(e);case te:e:{for(c=a.key;null!==r;){if(r.key===c){if(4===r.tag&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),(r=i(r,a.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Ws(a,e.mode,s)).return=e,e=r}return u(e)}if("string"===typeof a||"number"===typeof a)return a=""+a,null!==r&&6===r.tag?(n(e,r.sibling),(r=i(r,a)).return=e,e=r):(n(e,r),(r=Hs(a,e.mode,s)).return=e,e=r),u(e);if(Ea(a))return v(e,r,a,s);if(ve(a))return m(e,r,a,s);if(l&&Ca(e,a),"undefined"===typeof a&&!c)switch(e.tag){case 1:case 0:throw e=e.type,Error(o(152,e.displayName||e.name||"Component"))}return n(e,r)}}var Na=Aa(!0),Pa=Aa(!1),Da={},Ra={current:Da},Oa={current:Da},La={current:Da};function Ma(e){if(e===Da)throw Error(o(174));return e}function Fa(e,t){switch(vi(La,t),vi(Oa,e),vi(Ra,Da),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Fe(null,"");break;default:t=Fe(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}pi(Ra),vi(Ra,t)}function Va(){pi(Ra),pi(Oa),pi(La)}function Ua(e){Ma(La.current);var t=Ma(Ra.current),n=Fe(t,e.type);t!==n&&(vi(Oa,e),vi(Ra,n))}function ja(e){Oa.current===e&&(pi(Ra),pi(Oa))}var za={current:0};function Ba(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||n.data===kn||n.data===wn))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(64&t.effectTag))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function qa(e,t){return{responder:e,props:t}}var Ka=J.ReactCurrentDispatcher,Ga=J.ReactCurrentBatchConfig,Ha=0,Wa=null,Qa=null,Ya=null,Ja=!1;function Xa(){throw Error(o(321))}function $a(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!qr(e[n],t[n]))return!1;return!0}function Za(e,t,n,r,i,a){if(Ha=a,Wa=t,t.memoizedState=null,t.updateQueue=null,t.expirationTime=0,Ka.current=null===e||null===e.memoizedState?xo:To,e=n(r,i),t.expirationTime===Ha){a=0;do{if(t.expirationTime=0,!(25>a))throw Error(o(301));a+=1,Ya=Qa=null,t.updateQueue=null,Ka.current=Io,e=n(r,i)}while(t.expirationTime===Ha)}if(Ka.current=_o,t=null!==Qa&&null!==Qa.next,Ha=0,Ya=Qa=Wa=null,Ja=!1,t)throw Error(o(300));return e}function eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Ya?Wa.memoizedState=Ya=e:Ya=Ya.next=e,Ya}function to(){if(null===Qa){var e=Wa.alternate;e=null!==e?e.memoizedState:null}else e=Qa.next;var t=null===Ya?Wa.memoizedState:Ya.next;if(null!==t)Ya=t,Qa=e;else{if(null===e)throw Error(o(310));e={memoizedState:(Qa=e).memoizedState,baseState:Qa.baseState,baseQueue:Qa.baseQueue,queue:Qa.queue,next:null},null===Ya?Wa.memoizedState=Ya=e:Ya=Ya.next=e}return Ya}function no(e,t){return"function"===typeof t?t(e):t}function ro(e){var t=to(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=Qa,i=r.baseQueue,a=n.pending;if(null!==a){if(null!==i){var u=i.next;i.next=a.next,a.next=u}r.baseQueue=i=a,n.pending=null}if(null!==i){i=i.next,r=r.baseState;var s=u=a=null,c=i;do{var l=c.expirationTime;if(l<Ha){var f={expirationTime:c.expirationTime,suspenseConfig:c.suspenseConfig,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null};null===s?(u=s=f,a=r):s=s.next=f,l>Wa.expirationTime&&(Wa.expirationTime=l,xs(l))}else null!==s&&(s=s.next={expirationTime:1073741823,suspenseConfig:c.suspenseConfig,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null}),_s(l,c.suspenseConfig),r=c.eagerReducer===e?c.eagerState:e(r,c.action);c=c.next}while(null!==c&&c!==i);null===s?a=r:s.next=u,qr(r,t.memoizedState)||(Mo=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=s,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function io(e){var t=to(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(null!==i){n.pending=null;var u=i=i.next;do{a=e(a,u.action),u=u.next}while(u!==i);qr(a,t.memoizedState)||(Mo=!0),t.memoizedState=a,null===t.baseQueue&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function ao(e){var t=eo();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:no,lastRenderedState:e}).dispatch=bo.bind(null,Wa,e),[t.memoizedState,e]}function oo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=Wa.updateQueue)?(t={lastEffect:null},Wa.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function uo(){return to().memoizedState}function so(e,t,n,r){var i=eo();Wa.effectTag|=e,i.memoizedState=oo(1|t,n,void 0,void 0===r?null:r)}function co(e,t,n,r){var i=to();r=void 0===r?null:r;var a=void 0;if(null!==Qa){var o=Qa.memoizedState;if(a=o.destroy,null!==r&&$a(r,o.deps))return void oo(t,n,a,r)}Wa.effectTag|=e,i.memoizedState=oo(1|t,n,a,r)}function lo(e,t){return so(516,4,e,t)}function fo(e,t){return co(516,4,e,t)}function ho(e,t){return co(4,2,e,t)}function po(e,t){return"function"===typeof t?(e=e(),t(e),function(){t(null)}):null!==t&&void 0!==t?(e=e(),t.current=e,function(){t.current=null}):void 0}function vo(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,co(4,2,po.bind(null,t,e),n)}function mo(){}function yo(e,t){return eo().memoizedState=[e,void 0===t?null:t],e}function go(e,t){var n=to();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&$a(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ko(e,t){var n=to();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&$a(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function wo(e,t,n){var r=Hi();Qi(98>r?98:r,(function(){e(!0)})),Qi(97<r?97:r,(function(){var r=Ga.suspense;Ga.suspense=void 0===t?null:t;try{e(!1),n()}finally{Ga.suspense=r}}))}function bo(e,t,n){var r=cs(),i=ga.suspense;i={expirationTime:r=ls(r,e,i),suspenseConfig:i,action:n,eagerReducer:null,eagerState:null,next:null};var a=t.pending;if(null===a?i.next=i:(i.next=a.next,a.next=i),t.pending=i,a=e.alternate,e===Wa||null!==a&&a===Wa)Ja=!0,i.expirationTime=Ha,Wa.expirationTime=Ha;else{if(0===e.expirationTime&&(null===a||0===a.expirationTime)&&null!==(a=t.lastRenderedReducer))try{var o=t.lastRenderedState,u=a(o,n);if(i.eagerReducer=a,i.eagerState=u,qr(u,o))return}catch(s){}fs(e,r)}}var _o={readContext:ca,useCallback:Xa,useContext:Xa,useEffect:Xa,useImperativeHandle:Xa,useLayoutEffect:Xa,useMemo:Xa,useReducer:Xa,useRef:Xa,useState:Xa,useDebugValue:Xa,useResponder:Xa,useDeferredValue:Xa,useTransition:Xa},xo={readContext:ca,useCallback:yo,useContext:ca,useEffect:lo,useImperativeHandle:function(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,so(4,2,po.bind(null,t,e),n)},useLayoutEffect:function(e,t){return so(4,2,e,t)},useMemo:function(e,t){var n=eo();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=eo();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=bo.bind(null,Wa,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},eo().memoizedState=e},useState:ao,useDebugValue:mo,useResponder:qa,useDeferredValue:function(e,t){var n=ao(e),r=n[0],i=n[1];return lo((function(){var n=Ga.suspense;Ga.suspense=void 0===t?null:t;try{i(e)}finally{Ga.suspense=n}}),[e,t]),r},useTransition:function(e){var t=ao(!1),n=t[0];return t=t[1],[yo(wo.bind(null,t,e),[t,e]),n]}},To={readContext:ca,useCallback:go,useContext:ca,useEffect:fo,useImperativeHandle:vo,useLayoutEffect:ho,useMemo:ko,useReducer:ro,useRef:uo,useState:function(){return ro(no)},useDebugValue:mo,useResponder:qa,useDeferredValue:function(e,t){var n=ro(no),r=n[0],i=n[1];return fo((function(){var n=Ga.suspense;Ga.suspense=void 0===t?null:t;try{i(e)}finally{Ga.suspense=n}}),[e,t]),r},useTransition:function(e){var t=ro(no),n=t[0];return t=t[1],[go(wo.bind(null,t,e),[t,e]),n]}},Io={readContext:ca,useCallback:go,useContext:ca,useEffect:fo,useImperativeHandle:vo,useLayoutEffect:ho,useMemo:ko,useReducer:io,useRef:uo,useState:function(){return io(no)},useDebugValue:mo,useResponder:qa,useDeferredValue:function(e,t){var n=io(no),r=n[0],i=n[1];return fo((function(){var n=Ga.suspense;Ga.suspense=void 0===t?null:t;try{i(e)}finally{Ga.suspense=n}}),[e,t]),r},useTransition:function(e){var t=io(no),n=t[0];return t=t[1],[go(wo.bind(null,t,e),[t,e]),n]}},Eo=null,So=null,Co=!1;function Ao(e,t){var n=zs(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.effectTag=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function No(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);default:return!1}}function Po(e){if(Co){var t=So;if(t){var n=t;if(!No(e,t)){if(!(t=Sn(n.nextSibling))||!No(e,t))return e.effectTag=-1025&e.effectTag|2,Co=!1,void(Eo=e);Ao(Eo,n)}Eo=e,So=Sn(t.firstChild)}else e.effectTag=-1025&e.effectTag|2,Co=!1,Eo=e}}function Do(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Eo=e}function Ro(e){if(e!==Eo)return!1;if(!Co)return Do(e),Co=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!Tn(t,e.memoizedProps))for(t=So;t;)Ao(e,t),t=Sn(t.nextSibling);if(Do(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(o(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if(n===gn){if(0===t){So=Sn(e.nextSibling);break e}t--}else n!==yn&&n!==wn&&n!==kn||t++}e=e.nextSibling}So=null}}else So=Eo?Sn(e.stateNode.nextSibling):null;return!0}function Oo(){So=Eo=null,Co=!1}var Lo=J.ReactCurrentOwner,Mo=!1;function Fo(e,t,n,r){t.child=null===e?Pa(t,null,n,r):Na(t,e.child,n,r)}function Vo(e,t,n,r,i){n=n.render;var a=t.ref;return sa(t,i),r=Za(e,t,n,r,a,i),null===e||Mo?(t.effectTag|=1,Fo(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=i&&(e.expirationTime=0),tu(e,t,i))}function Uo(e,t,n,r,i,a){if(null===e){var o=n.type;return"function"!==typeof o||Bs(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Ks(n.type,null,r,null,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,jo(e,t,o,r,i,a))}return o=e.child,i<a&&(i=o.memoizedProps,(n=null!==(n=n.compare)?n:Gr)(i,r)&&e.ref===t.ref)?tu(e,t,a):(t.effectTag|=1,(e=qs(o,r)).ref=t.ref,e.return=t,t.child=e)}function jo(e,t,n,r,i,a){return null!==e&&Gr(e.memoizedProps,r)&&e.ref===t.ref&&(Mo=!1,i<a)?(t.expirationTime=e.expirationTime,tu(e,t,a)):Bo(e,t,n,r,a)}function zo(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.effectTag|=128)}function Bo(e,t,n,r,i){var a=bi(n)?ki:yi.current;return a=wi(t,a),sa(t,i),n=Za(e,t,n,r,a,i),null===e||Mo?(t.effectTag|=1,Fo(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=i&&(e.expirationTime=0),tu(e,t,i))}function qo(e,t,n,r,i){if(bi(n)){var a=!0;Ii(t)}else a=!1;if(sa(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),xa(t,n,r),Ia(t,n,r,i),r=!0;else if(null===e){var o=t.stateNode,u=t.memoizedProps;o.props=u;var s=o.context,c=n.contextType;"object"===typeof c&&null!==c?c=ca(c):c=wi(t,c=bi(n)?ki:yi.current);var l=n.getDerivedStateFromProps,f="function"===typeof l||"function"===typeof o.getSnapshotBeforeUpdate;f||"function"!==typeof o.UNSAFE_componentWillReceiveProps&&"function"!==typeof o.componentWillReceiveProps||(u!==r||s!==c)&&Ta(t,o,r,c),la=!1;var h=t.memoizedState;o.state=h,ma(t,r,o,i),s=t.memoizedState,u!==r||h!==s||gi.current||la?("function"===typeof l&&(wa(t,n,l,r),s=t.memoizedState),(u=la||_a(t,n,u,r,h,s,c))?(f||"function"!==typeof o.UNSAFE_componentWillMount&&"function"!==typeof o.componentWillMount||("function"===typeof o.componentWillMount&&o.componentWillMount(),"function"===typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"===typeof o.componentDidMount&&(t.effectTag|=4)):("function"===typeof o.componentDidMount&&(t.effectTag|=4),t.memoizedProps=r,t.memoizedState=s),o.props=r,o.state=s,o.context=c,r=u):("function"===typeof o.componentDidMount&&(t.effectTag|=4),r=!1)}else o=t.stateNode,ha(e,t),u=t.memoizedProps,o.props=t.type===t.elementType?u:ea(t.type,u),s=o.context,"object"===typeof(c=n.contextType)&&null!==c?c=ca(c):c=wi(t,c=bi(n)?ki:yi.current),(f="function"===typeof(l=n.getDerivedStateFromProps)||"function"===typeof o.getSnapshotBeforeUpdate)||"function"!==typeof o.UNSAFE_componentWillReceiveProps&&"function"!==typeof o.componentWillReceiveProps||(u!==r||s!==c)&&Ta(t,o,r,c),la=!1,s=t.memoizedState,o.state=s,ma(t,r,o,i),h=t.memoizedState,u!==r||s!==h||gi.current||la?("function"===typeof l&&(wa(t,n,l,r),h=t.memoizedState),(l=la||_a(t,n,u,r,s,h,c))?(f||"function"!==typeof o.UNSAFE_componentWillUpdate&&"function"!==typeof o.componentWillUpdate||("function"===typeof o.componentWillUpdate&&o.componentWillUpdate(r,h,c),"function"===typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(r,h,c)),"function"===typeof o.componentDidUpdate&&(t.effectTag|=4),"function"===typeof o.getSnapshotBeforeUpdate&&(t.effectTag|=256)):("function"!==typeof o.componentDidUpdate||u===e.memoizedProps&&s===e.memoizedState||(t.effectTag|=4),"function"!==typeof o.getSnapshotBeforeUpdate||u===e.memoizedProps&&s===e.memoizedState||(t.effectTag|=256),t.memoizedProps=r,t.memoizedState=h),o.props=r,o.state=h,o.context=c,r=l):("function"!==typeof o.componentDidUpdate||u===e.memoizedProps&&s===e.memoizedState||(t.effectTag|=4),"function"!==typeof o.getSnapshotBeforeUpdate||u===e.memoizedProps&&s===e.memoizedState||(t.effectTag|=256),r=!1);return Ko(e,t,n,r,a,i)}function Ko(e,t,n,r,i,a){zo(e,t);var o=0!==(64&t.effectTag);if(!r&&!o)return i&&Ei(t,n,!1),tu(e,t,a);r=t.stateNode,Lo.current=t;var u=o&&"function"!==typeof n.getDerivedStateFromError?null:r.render();return t.effectTag|=1,null!==e&&o?(t.child=Na(t,e.child,null,a),t.child=Na(t,null,u,a)):Fo(e,t,u,a),t.memoizedState=r.state,i&&Ei(t,n,!0),t.child}function Go(e){var t=e.stateNode;t.pendingContext?xi(0,t.pendingContext,t.pendingContext!==t.context):t.context&&xi(0,t.context,!1),Fa(e,t.containerInfo)}var Ho,Wo,Qo,Yo,Jo={dehydrated:null,retryTime:0};function Xo(e,t,n){var r,i=t.mode,a=t.pendingProps,o=za.current,u=!1;if((r=0!==(64&t.effectTag))||(r=0!==(2&o)&&(null===e||null!==e.memoizedState)),r?(u=!0,t.effectTag&=-65):null!==e&&null===e.memoizedState||void 0===a.fallback||!0===a.unstable_avoidThisFallback||(o|=1),vi(za,1&o),null===e){if(void 0!==a.fallback&&Po(t),u){if(u=a.fallback,(a=Gs(null,i,0,null)).return=t,0===(2&t.mode))for(e=null!==t.memoizedState?t.child.child:t.child,a.child=e;null!==e;)e.return=a,e=e.sibling;return(n=Gs(u,i,n,null)).return=t,a.sibling=n,t.memoizedState=Jo,t.child=a,n}return i=a.children,t.memoizedState=null,t.child=Pa(t,null,i,n)}if(null!==e.memoizedState){if(i=(e=e.child).sibling,u){if(a=a.fallback,(n=qs(e,e.pendingProps)).return=t,0===(2&t.mode)&&(u=null!==t.memoizedState?t.child.child:t.child)!==e.child)for(n.child=u;null!==u;)u.return=n,u=u.sibling;return(i=qs(i,a)).return=t,n.sibling=i,n.childExpirationTime=0,t.memoizedState=Jo,t.child=n,i}return n=Na(t,e.child,a.children,n),t.memoizedState=null,t.child=n}if(e=e.child,u){if(u=a.fallback,(a=Gs(null,i,0,null)).return=t,a.child=e,null!==e&&(e.return=a),0===(2&t.mode))for(e=null!==t.memoizedState?t.child.child:t.child,a.child=e;null!==e;)e.return=a,e=e.sibling;return(n=Gs(u,i,n,null)).return=t,a.sibling=n,n.effectTag|=2,a.childExpirationTime=0,t.memoizedState=Jo,t.child=a,n}return t.memoizedState=null,t.child=Na(t,e,a.children,n)}function $o(e,t){e.expirationTime<t&&(e.expirationTime=t);var n=e.alternate;null!==n&&n.expirationTime<t&&(n.expirationTime=t),ua(e.return,t)}function Zo(e,t,n,r,i,a){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailExpiration:0,tailMode:i,lastEffect:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailExpiration=0,o.tailMode=i,o.lastEffect=a)}function eu(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Fo(e,t,r.children,n),0!==(2&(r=za.current)))r=1&r|2,t.effectTag|=64;else{if(null!==e&&0!==(64&e.effectTag))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&$o(e,n);else if(19===e.tag)$o(e,n);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(vi(za,r),0===(2&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===Ba(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Zo(t,!1,i,n,a,t.lastEffect);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===Ba(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Zo(t,!0,n,null,a,t.lastEffect);break;case"together":Zo(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function tu(e,t,n){null!==e&&(t.dependencies=e.dependencies);var r=t.expirationTime;if(0!==r&&xs(r),t.childExpirationTime<n)return null;if(null!==e&&t.child!==e.child)throw Error(o(153));if(null!==t.child){for(n=qs(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=qs(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function nu(e,t){switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ru(e,t,n){var r=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:case 17:return bi(t.type)&&_i(),null;case 3:return Va(),pi(gi),pi(yi),(n=t.stateNode).pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||!Ro(t)||(t.effectTag|=4),Wo(t),null;case 5:ja(t),n=Ma(La.current);var a=t.type;if(null!==e&&null!=t.stateNode)Qo(e,t,a,r,n),e.ref!==t.ref&&(t.effectTag|=128);else{if(!r){if(null===t.stateNode)throw Error(o(166));return null}if(e=Ma(Ra.current),Ro(t)){r=t.stateNode,a=t.type;var u=t.memoizedProps;switch(r[Nn]=t,r[Pn]=u,a){case"iframe":case"object":case"embed":Qt("load",r);break;case"video":case"audio":for(e=0;e<Xe.length;e++)Qt(Xe[e],r);break;case"source":Qt("error",r);break;case"img":case"image":case"link":Qt("error",r),Qt("load",r);break;case"form":Qt("reset",r),Qt("submit",r);break;case"details":Qt("toggle",r);break;case"input":xe(r,u),Qt("invalid",r),cn(n,"onChange");break;case"select":r._wrapperState={wasMultiple:!!u.multiple},Qt("invalid",r),cn(n,"onChange");break;case"textarea":Pe(r,u),Qt("invalid",r),cn(n,"onChange")}for(var s in on(a,u),e=null,u)if(u.hasOwnProperty(s)){var c=u[s];"children"===s?"string"===typeof c?r.textContent!==c&&(e=["children",c]):"number"===typeof c&&r.textContent!==""+c&&(e=["children",""+c]):T.hasOwnProperty(s)&&null!=c&&cn(n,s)}switch(a){case"input":we(r),Ee(r,u,!0);break;case"textarea":we(r),Re(r);break;case"select":case"option":break;default:"function"===typeof u.onClick&&(r.onclick=ln)}n=e,t.updateQueue=n,null!==n&&(t.effectTag|=4)}else{switch(s=9===n.nodeType?n:n.ownerDocument,e===sn&&(e=Me(a)),e===sn?"script"===a?((e=s.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"===typeof r.is?e=s.createElement(a,{is:r.is}):(e=s.createElement(a),"select"===a&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,a),e[Nn]=t,e[Pn]=r,Ho(e,t,!1,!1),t.stateNode=e,s=un(a,r),a){case"iframe":case"object":case"embed":Qt("load",e),c=r;break;case"video":case"audio":for(c=0;c<Xe.length;c++)Qt(Xe[c],e);c=r;break;case"source":Qt("error",e),c=r;break;case"img":case"image":case"link":Qt("error",e),Qt("load",e),c=r;break;case"form":Qt("reset",e),Qt("submit",e),c=r;break;case"details":Qt("toggle",e),c=r;break;case"input":xe(e,r),c=_e(e,r),Qt("invalid",e),cn(n,"onChange");break;case"option":c=Ce(e,r);break;case"select":e._wrapperState={wasMultiple:!!r.multiple},c=i({},r,{value:void 0}),Qt("invalid",e),cn(n,"onChange");break;case"textarea":Pe(e,r),c=Ne(e,r),Qt("invalid",e),cn(n,"onChange");break;default:c=r}on(a,c);var l=c;for(u in l)if(l.hasOwnProperty(u)){var f=l[u];"style"===u?rn(e,f):"dangerouslySetInnerHTML"===u?null!=(f=f?f.__html:void 0)&&je(e,f):"children"===u?"string"===typeof f?("textarea"!==a||""!==f)&&ze(e,f):"number"===typeof f&&ze(e,""+f):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(T.hasOwnProperty(u)?null!=f&&cn(n,u):null!=f&&X(e,u,f,s))}switch(a){case"input":we(e),Ee(e,r,!1);break;case"textarea":we(e),Re(e);break;case"option":null!=r.value&&e.setAttribute("value",""+ge(r.value));break;case"select":e.multiple=!!r.multiple,null!=(n=r.value)?Ae(e,!!r.multiple,n,!1):null!=r.defaultValue&&Ae(e,!!r.multiple,r.defaultValue,!0);break;default:"function"===typeof c.onClick&&(e.onclick=ln)}xn(a,r)&&(t.effectTag|=4)}null!==t.ref&&(t.effectTag|=128)}return null;case 6:if(e&&null!=t.stateNode)Yo(e,t,e.memoizedProps,r);else{if("string"!==typeof r&&null===t.stateNode)throw Error(o(166));n=Ma(La.current),Ma(Ra.current),Ro(t)?(n=t.stateNode,r=t.memoizedProps,n[Nn]=t,n.nodeValue!==r&&(t.effectTag|=4)):((n=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[Nn]=t,t.stateNode=n)}return null;case 13:return pi(za),r=t.memoizedState,0!==(64&t.effectTag)?(t.expirationTime=n,t):(n=null!==r,r=!1,null===e?void 0!==t.memoizedProps.fallback&&Ro(t):(r=null!==(a=e.memoizedState),n||null===a||null!==(a=e.child.sibling)&&(null!==(u=t.firstEffect)?(t.firstEffect=a,a.nextEffect=u):(t.firstEffect=t.lastEffect=a,a.nextEffect=null),a.effectTag=8)),n&&!r&&0!==(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!==(1&za.current)?qu===Ru&&(qu=Mu):(qu!==Ru&&qu!==Mu||(qu=Fu),0!==Qu&&null!==ju&&(Js(ju,Bu),Xs(ju,Qu)))),(n||r)&&(t.effectTag|=4),null);case 4:return Va(),Wo(t),null;case 10:return oa(t),null;case 19:if(pi(za),null===(r=t.memoizedState))return null;if(a=0!==(64&t.effectTag),null===(u=r.rendering)){if(a)nu(r,!1);else if(qu!==Ru||null!==e&&0!==(64&e.effectTag))for(u=t.child;null!==u;){if(null!==(e=Ba(u))){for(t.effectTag|=64,nu(r,!1),null!==(a=e.updateQueue)&&(t.updateQueue=a,t.effectTag|=4),null===r.lastEffect&&(t.firstEffect=null),t.lastEffect=r.lastEffect,r=t.child;null!==r;)u=n,(a=r).effectTag&=2,a.nextEffect=null,a.firstEffect=null,a.lastEffect=null,null===(e=a.alternate)?(a.childExpirationTime=0,a.expirationTime=u,a.child=null,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null):(a.childExpirationTime=e.childExpirationTime,a.expirationTime=e.expirationTime,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,u=e.dependencies,a.dependencies=null===u?null:{expirationTime:u.expirationTime,firstContext:u.firstContext,responders:u.responders}),r=r.sibling;return vi(za,1&za.current|2),t.child}u=u.sibling}}else{if(!a)if(null!==(e=Ba(u))){if(t.effectTag|=64,a=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.effectTag|=4),nu(r,!0),null===r.tail&&"hidden"===r.tailMode&&!u.alternate)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*Gi()-r.renderingStartTime>r.tailExpiration&&1<n&&(t.effectTag|=64,a=!0,nu(r,!1),t.expirationTime=t.childExpirationTime=n-1);r.isBackwards?(u.sibling=t.child,t.child=u):(null!==(n=r.last)?n.sibling=u:t.child=u,r.last=u)}return null!==r.tail?(0===r.tailExpiration&&(r.tailExpiration=Gi()+500),n=r.tail,r.rendering=n,r.tail=n.sibling,r.lastEffect=t.lastEffect,r.renderingStartTime=Gi(),n.sibling=null,t=za.current,vi(za,a?1&t|2:1&t),n):null}throw Error(o(156,t.tag))}function iu(e){switch(e.tag){case 1:bi(e.type)&&_i();var t=e.effectTag;return 4096&t?(e.effectTag=-4097&t|64,e):null;case 3:if(Va(),pi(gi),pi(yi),0!==(64&(t=e.effectTag)))throw Error(o(285));return e.effectTag=-4097&t|64,e;case 5:return ja(e),null;case 13:return pi(za),4096&(t=e.effectTag)?(e.effectTag=-4097&t|64,e):null;case 19:return pi(za),null;case 4:return Va(),null;case 10:return oa(e),null;default:return null}}function au(e,t){return{value:e,source:t,stack:ye(t)}}Ho=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Wo=function(){},Qo=function(e,t,n,r,a){var o=e.memoizedProps;if(o!==r){var u,s,c=t.stateNode;switch(Ma(Ra.current),e=null,n){case"input":o=_e(c,o),r=_e(c,r),e=[];break;case"option":o=Ce(c,o),r=Ce(c,r),e=[];break;case"select":o=i({},o,{value:void 0}),r=i({},r,{value:void 0}),e=[];break;case"textarea":o=Ne(c,o),r=Ne(c,r),e=[];break;default:"function"!==typeof o.onClick&&"function"===typeof r.onClick&&(c.onclick=ln)}for(u in on(n,r),n=null,o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&null!=o[u])if("style"===u)for(s in c=o[u])c.hasOwnProperty(s)&&(n||(n={}),n[s]="");else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(T.hasOwnProperty(u)?e||(e=[]):(e=e||[]).push(u,null));for(u in r){var l=r[u];if(c=null!=o?o[u]:void 0,r.hasOwnProperty(u)&&l!==c&&(null!=l||null!=c))if("style"===u)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(e||(e=[]),e.push(u,n)),n=l;else"dangerouslySetInnerHTML"===u?(l=l?l.__html:void 0,c=c?c.__html:void 0,null!=l&&c!==l&&(e=e||[]).push(u,l)):"children"===u?c===l||"string"!==typeof l&&"number"!==typeof l||(e=e||[]).push(u,""+l):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(T.hasOwnProperty(u)?(null!=l&&cn(a,u),e||c===l||(e=[])):(e=e||[]).push(u,l))}n&&(e=e||[]).push("style",n),a=e,(t.updateQueue=a)&&(t.effectTag|=4)}},Yo=function(e,t,n,r){n!==r&&(t.effectTag|=4)};var ou="function"===typeof WeakSet?WeakSet:Set;function uu(e,t){var n=t.source,r=t.stack;null===r&&null!==n&&(r=ye(n)),null!==n&&me(n.type),t=t.value,null!==e&&1===e.tag&&me(e.type);try{console.error(t)}catch(i){setTimeout((function(){throw i}))}}function su(e){var t=e.ref;if(null!==t)if("function"===typeof t)try{t(null)}catch(n){Ls(e,n)}else t.current=null}function cu(e,t){switch(t.tag){case 0:case 11:case 15:case 22:case 3:case 5:case 6:case 4:case 17:return;case 1:if(256&t.effectTag&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:ea(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}return}throw Error(o(163))}function lu(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.destroy;n.destroy=void 0,void 0!==r&&r()}n=n.next}while(n!==t)}}function fu(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function hu(e,t,n){switch(n.tag){case 0:case 11:case 15:case 22:return void fu(3,n);case 1:if(e=n.stateNode,4&n.effectTag)if(null===t)e.componentDidMount();else{var r=n.elementType===n.type?t.memoizedProps:ea(n.type,t.memoizedProps);e.componentDidUpdate(r,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate)}return void(null!==(t=n.updateQueue)&&ya(n,t,e));case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:case 1:e=n.child.stateNode}ya(n,t,e)}return;case 5:return e=n.stateNode,void(null===t&&4&n.effectTag&&xn(n.type,n.memoizedProps)&&e.focus());case 6:case 4:case 12:case 19:case 17:case 20:case 21:return;case 13:return void(null===n.memoizedState&&(n=n.alternate,null!==n&&(n=n.memoizedState,null!==n&&(n=n.dehydrated,null!==n&&Ft(n)))))}throw Error(o(163))}function du(e,t,n){switch("function"===typeof Us&&Us(t),t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var r=e.next;Qi(97<n?97:n,(function(){var e=r;do{var n=e.destroy;if(void 0!==n){var i=t;try{n()}catch(a){Ls(i,a)}}e=e.next}while(e!==r)}))}break;case 1:su(t),"function"===typeof(n=t.stateNode).componentWillUnmount&&function(e,t){try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(n){Ls(e,n)}}(t,n);break;case 5:su(t);break;case 4:ku(e,t,n)}}function pu(e){var t=e.alternate;e.return=null,e.child=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.alternate=null,e.firstEffect=null,e.lastEffect=null,e.pendingProps=null,e.memoizedProps=null,e.stateNode=null,null!==t&&pu(t)}function vu(e){return 5===e.tag||3===e.tag||4===e.tag}function mu(e){e:{for(var t=e.return;null!==t;){if(vu(t)){var n=t;break e}t=t.return}throw Error(o(160))}switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw Error(o(161))}16&n.effectTag&&(ze(t,""),n.effectTag&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||vu(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.effectTag)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break e}}r?yu(e,n,t):gu(e,n,t)}function yu(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!==(n=n._reactRootContainer)&&void 0!==n||null!==t.onclick||(t.onclick=ln));else if(4!==r&&null!==(e=e.child))for(yu(e,t,n),e=e.sibling;null!==e;)yu(e,t,n),e=e.sibling}function gu(e,t,n){var r=e.tag,i=5===r||6===r;if(i)e=i?e.stateNode:e.stateNode.instance,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(gu(e,t,n),e=e.sibling;null!==e;)gu(e,t,n),e=e.sibling}function ku(e,t,n){for(var r,i,a=t,u=!1;;){if(!u){u=a.return;e:for(;;){if(null===u)throw Error(o(160));switch(r=u.stateNode,u.tag){case 5:i=!1;break e;case 3:case 4:r=r.containerInfo,i=!0;break e}u=u.return}u=!0}if(5===a.tag||6===a.tag){e:for(var s=e,c=a,l=n,f=c;;)if(du(s,f,l),null!==f.child&&4!==f.tag)f.child.return=f,f=f.child;else{if(f===c)break e;for(;null===f.sibling;){if(null===f.return||f.return===c)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}i?(s=r,c=a.stateNode,8===s.nodeType?s.parentNode.removeChild(c):s.removeChild(c)):r.removeChild(a.stateNode)}else if(4===a.tag){if(null!==a.child){r=a.stateNode.containerInfo,i=!0,a.child.return=a,a=a.child;continue}}else if(du(e,a,n),null!==a.child){a.child.return=a,a=a.child;continue}if(a===t)break;for(;null===a.sibling;){if(null===a.return||a.return===t)return;4===(a=a.return).tag&&(u=!1)}a.sibling.return=a.return,a=a.sibling}}function wu(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:return void lu(3,t);case 1:case 12:case 17:return;case 5:var n=t.stateNode;if(null!=n){var r=t.memoizedProps,i=null!==e?e.memoizedProps:r;e=t.type;var a=t.updateQueue;if(t.updateQueue=null,null!==a){for(n[Pn]=r,"input"===e&&"radio"===r.type&&null!=r.name&&Te(n,r),un(e,i),t=un(e,r),i=0;i<a.length;i+=2){var u=a[i],s=a[i+1];"style"===u?rn(n,s):"dangerouslySetInnerHTML"===u?je(n,s):"children"===u?ze(n,s):X(n,u,s,t)}switch(e){case"input":Ie(n,r);break;case"textarea":De(n,r);break;case"select":t=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,null!=(e=r.value)?Ae(n,!!r.multiple,e,!1):t!==!!r.multiple&&(null!=r.defaultValue?Ae(n,!!r.multiple,r.defaultValue,!0):Ae(n,!!r.multiple,r.multiple?[]:"",!1))}}}return;case 6:if(null===t.stateNode)throw Error(o(162));return void(t.stateNode.nodeValue=t.memoizedProps);case 3:return void((t=t.stateNode).hydrate&&(t.hydrate=!1,Ft(t.containerInfo)));case 13:if(n=t,null===t.memoizedState?r=!1:(r=!0,n=t.child,Ju=Gi()),null!==n)e:for(e=n;;){if(5===e.tag)a=e.stateNode,r?"function"===typeof(a=a.style).setProperty?a.setProperty("display","none","important"):a.display="none":(a=e.stateNode,i=void 0!==(i=e.memoizedProps.style)&&null!==i&&i.hasOwnProperty("display")?i.display:null,a.style.display=nn("display",i));else if(6===e.tag)e.stateNode.nodeValue=r?"":e.memoizedProps;else{if(13===e.tag&&null!==e.memoizedState&&null===e.memoizedState.dehydrated){(a=e.child.sibling).return=e,e=a;continue}if(null!==e.child){e.child.return=e,e=e.child;continue}}if(e===n)break;for(;null===e.sibling;){if(null===e.return||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}return void bu(t);case 19:return void bu(t)}throw Error(o(163))}function bu(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new ou),t.forEach((function(t){var r=Fs.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}var _u="function"===typeof WeakMap?WeakMap:Map;function xu(e,t,n){(n=da(n,null)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Zu||(Zu=!0,es=r),uu(e,t)},n}function Tu(e,t,n){(n=da(n,null)).tag=3;var r=e.type.getDerivedStateFromError;if("function"===typeof r){var i=t.value;n.payload=function(){return uu(e,t),r(i)}}var a=e.stateNode;return null!==a&&"function"===typeof a.componentDidCatch&&(n.callback=function(){"function"!==typeof r&&(null===ts?ts=new Set([this]):ts.add(this),uu(e,t));var n=t.stack;this.componentDidCatch(t.value,{componentStack:null!==n?n:""})}),n}var Iu,Eu=Math.ceil,Su=J.ReactCurrentDispatcher,Cu=J.ReactCurrentOwner,Au=0,Nu=8,Pu=16,Du=32,Ru=0,Ou=1,Lu=2,Mu=3,Fu=4,Vu=5,Uu=Au,ju=null,zu=null,Bu=0,qu=Ru,Ku=null,Gu=1073741823,Hu=1073741823,Wu=null,Qu=0,Yu=!1,Ju=0,Xu=500,$u=null,Zu=!1,es=null,ts=null,ns=!1,rs=null,is=90,as=null,os=0,us=null,ss=0;function cs(){return(Uu&(Pu|Du))!==Au?1073741821-(Gi()/10|0):0!==ss?ss:ss=1073741821-(Gi()/10|0)}function ls(e,t,n){if(0===(2&(t=t.mode)))return 1073741823;var r=Hi();if(0===(4&t))return 99===r?1073741823:1073741822;if((Uu&Pu)!==Au)return Bu;if(null!==n)e=Zi(e,0|n.timeoutMs||5e3,250);else switch(r){case 99:e=1073741823;break;case 98:e=Zi(e,150,100);break;case 97:case 96:e=Zi(e,5e3,250);break;case 95:e=2;break;default:throw Error(o(326))}return null!==ju&&e===Bu&&--e,e}function fs(e,t){if(50<os)throw os=0,us=null,Error(o(185));if(null!==(e=hs(e,t))){var n=Hi();1073741823===t?(Uu&Nu)!==Au&&(Uu&(Pu|Du))===Au?ms(e):(ps(e),Uu===Au&&Xi()):ps(e),(4&Uu)===Au||98!==n&&99!==n||(null===as?as=new Map([[e,t]]):(void 0===(n=as.get(e))||n>t)&&as.set(e,t))}}function hs(e,t){e.expirationTime<t&&(e.expirationTime=t);var n=e.alternate;null!==n&&n.expirationTime<t&&(n.expirationTime=t);var r=e.return,i=null;if(null===r&&3===e.tag)i=e.stateNode;else for(;null!==r;){if(n=r.alternate,r.childExpirationTime<t&&(r.childExpirationTime=t),null!==n&&n.childExpirationTime<t&&(n.childExpirationTime=t),null===r.return&&3===r.tag){i=r.stateNode;break}r=r.return}return null!==i&&(ju===i&&(xs(t),qu===Fu&&Js(i,Bu)),Xs(i,t)),i}function ds(e){var t=e.lastExpiredTime;if(0!==t)return t;if(!Ys(e,t=e.firstPendingTime))return t;var n=e.lastPingedTime;return 2>=(e=n>(e=e.nextKnownPendingLevel)?n:e)&&t!==e?0:e}function ps(e){if(0!==e.lastExpiredTime)e.callbackExpirationTime=1073741823,e.callbackPriority=99,e.callbackNode=Ji(ms.bind(null,e));else{var t=ds(e),n=e.callbackNode;if(0===t)null!==n&&(e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90);else{var r=cs();if(1073741823===t?r=99:1===t||2===t?r=95:r=0>=(r=10*(1073741821-t)-10*(1073741821-r))?99:250>=r?98:5250>=r?97:95,null!==n){var i=e.callbackPriority;if(e.callbackExpirationTime===t&&i>=r)return;n!==Vi&&Ai(n)}e.callbackExpirationTime=t,e.callbackPriority=r,t=1073741823===t?Ji(ms.bind(null,e)):Yi(r,vs.bind(null,e),{timeout:10*(1073741821-t)-Gi()}),e.callbackNode=t}}}function vs(e,t){if(ss=0,t)return $s(e,t=cs()),ps(e),null;var n=ds(e);if(0!==n){if(t=e.callbackNode,(Uu&(Pu|Du))!==Au)throw Error(o(327));if(Ds(),e===ju&&n===Bu||ks(e,n),null!==zu){var r=Uu;Uu|=Pu;for(var i=bs();;)try{Is();break}catch(s){ws(e,s)}if(aa(),Uu=r,Su.current=i,qu===Ou)throw t=Ku,ks(e,n),Js(e,n),ps(e),t;if(null===zu)switch(i=e.finishedWork=e.current.alternate,e.finishedExpirationTime=n,r=qu,ju=null,r){case Ru:case Ou:throw Error(o(345));case Lu:$s(e,2<n?2:n);break;case Mu:if(Js(e,n),n===(r=e.lastSuspendedTime)&&(e.nextKnownPendingLevel=Cs(i)),1073741823===Gu&&10<(i=Ju+Xu-Gi())){if(Yu){var a=e.lastPingedTime;if(0===a||a>=n){e.lastPingedTime=n,ks(e,n);break}}if(0!==(a=ds(e))&&a!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}e.timeoutHandle=In(As.bind(null,e),i);break}As(e);break;case Fu:if(Js(e,n),n===(r=e.lastSuspendedTime)&&(e.nextKnownPendingLevel=Cs(i)),Yu&&(0===(i=e.lastPingedTime)||i>=n)){e.lastPingedTime=n,ks(e,n);break}if(0!==(i=ds(e))&&i!==n)break;if(0!==r&&r!==n){e.lastPingedTime=r;break}if(1073741823!==Hu?r=10*(1073741821-Hu)-Gi():1073741823===Gu?r=0:(r=10*(1073741821-Gu)-5e3,0>(r=(i=Gi())-r)&&(r=0),(n=10*(1073741821-n)-i)<(r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Eu(r/1960))-r)&&(r=n)),10<r){e.timeoutHandle=In(As.bind(null,e),r);break}As(e);break;case Vu:if(1073741823!==Gu&&null!==Wu){a=Gu;var u=Wu;if(0>=(r=0|u.busyMinDurationMs)?r=0:(i=0|u.busyDelayMs,r=(a=Gi()-(10*(1073741821-a)-(0|u.timeoutMs||5e3)))<=i?0:i+r-a),10<r){Js(e,n),e.timeoutHandle=In(As.bind(null,e),r);break}}As(e);break;default:throw Error(o(329))}if(ps(e),e.callbackNode===t)return vs.bind(null,e)}}return null}function ms(e){var t=e.lastExpiredTime;if(t=0!==t?t:1073741823,(Uu&(Pu|Du))!==Au)throw Error(o(327));if(Ds(),e===ju&&t===Bu||ks(e,t),null!==zu){var n=Uu;Uu|=Pu;for(var r=bs();;)try{Ts();break}catch(i){ws(e,i)}if(aa(),Uu=n,Su.current=r,qu===Ou)throw n=Ku,ks(e,t),Js(e,t),ps(e),n;if(null!==zu)throw Error(o(261));e.finishedWork=e.current.alternate,e.finishedExpirationTime=t,ju=null,As(e),ps(e)}return null}function ys(e,t){var n=Uu;Uu|=1;try{return e(t)}finally{(Uu=n)===Au&&Xi()}}function gs(e,t){var n=Uu;Uu&=-2,Uu|=Nu;try{return e(t)}finally{(Uu=n)===Au&&Xi()}}function ks(e,t){e.finishedWork=null,e.finishedExpirationTime=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,En(n)),null!==zu)for(n=zu.return;null!==n;){var r=n;switch(r.tag){case 1:null!==(r=r.type.childContextTypes)&&void 0!==r&&_i();break;case 3:Va(),pi(gi),pi(yi);break;case 5:ja(r);break;case 4:Va();break;case 13:case 19:pi(za);break;case 10:oa(r)}n=n.return}ju=e,zu=qs(e.current,null),Bu=t,qu=Ru,Ku=null,Hu=Gu=1073741823,Wu=null,Qu=0,Yu=!1}function ws(e,t){for(;;){try{if(aa(),Ka.current=_o,Ja)for(var n=Wa.memoizedState;null!==n;){var r=n.queue;null!==r&&(r.pending=null),n=n.next}if(Ha=0,Ya=Qa=Wa=null,Ja=!1,null===zu||null===zu.return)return qu=Ou,Ku=t,zu=null;e:{var i=e,a=zu.return,o=zu,u=t;if(t=Bu,o.effectTag|=2048,o.firstEffect=o.lastEffect=null,null!==u&&"object"===typeof u&&"function"===typeof u.then){var s=u;if(0===(2&o.mode)){var c=o.alternate;c?(o.updateQueue=c.updateQueue,o.memoizedState=c.memoizedState,o.expirationTime=c.expirationTime):(o.updateQueue=null,o.memoizedState=null)}var l=0!==(1&za.current),f=a;do{var h;if(h=13===f.tag){var d=f.memoizedState;if(null!==d)h=null!==d.dehydrated;else{var p=f.memoizedProps;h=void 0!==p.fallback&&(!0!==p.unstable_avoidThisFallback||!l)}}if(h){var v=f.updateQueue;if(null===v){var m=new Set;m.add(s),f.updateQueue=m}else v.add(s);if(0===(2&f.mode)){if(f.effectTag|=64,o.effectTag&=-2981,1===o.tag)if(null===o.alternate)o.tag=17;else{var y=da(1073741823,null);y.tag=2,pa(o,y)}o.expirationTime=1073741823;break e}u=void 0,o=t;var g=i.pingCache;if(null===g?(g=i.pingCache=new _u,u=new Set,g.set(s,u)):void 0===(u=g.get(s))&&(u=new Set,g.set(s,u)),!u.has(o)){u.add(o);var k=Ms.bind(null,i,s,o);s.then(k,k)}f.effectTag|=4096,f.expirationTime=t;break e}f=f.return}while(null!==f);u=Error((me(o.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."+ye(o))}qu!==Vu&&(qu=Lu),u=au(u,o),f=a;do{switch(f.tag){case 3:s=u,f.effectTag|=4096,f.expirationTime=t,va(f,xu(f,s,t));break e;case 1:s=u;var w=f.type,b=f.stateNode;if(0===(64&f.effectTag)&&("function"===typeof w.getDerivedStateFromError||null!==b&&"function"===typeof b.componentDidCatch&&(null===ts||!ts.has(b)))){f.effectTag|=4096,f.expirationTime=t,va(f,Tu(f,s,t));break e}}f=f.return}while(null!==f)}zu=Ss(zu)}catch(_){t=_;continue}break}}function bs(){var e=Su.current;return Su.current=_o,null===e?_o:e}function _s(e,t){e<Gu&&2<e&&(Gu=e),null!==t&&e<Hu&&2<e&&(Hu=e,Wu=t)}function xs(e){e>Qu&&(Qu=e)}function Ts(){for(;null!==zu;)zu=Es(zu)}function Is(){for(;null!==zu&&!Ui();)zu=Es(zu)}function Es(e){var t=Iu(e.alternate,e,Bu);return e.memoizedProps=e.pendingProps,null===t&&(t=Ss(e)),Cu.current=null,t}function Ss(e){zu=e;do{var t=zu.alternate;if(e=zu.return,0===(2048&zu.effectTag)){if(t=ru(t,zu,Bu),1===Bu||1!==zu.childExpirationTime){for(var n=0,r=zu.child;null!==r;){var i=r.expirationTime,a=r.childExpirationTime;i>n&&(n=i),a>n&&(n=a),r=r.sibling}zu.childExpirationTime=n}if(null!==t)return t;null!==e&&0===(2048&e.effectTag)&&(null===e.firstEffect&&(e.firstEffect=zu.firstEffect),null!==zu.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=zu.firstEffect),e.lastEffect=zu.lastEffect),1<zu.effectTag&&(null!==e.lastEffect?e.lastEffect.nextEffect=zu:e.firstEffect=zu,e.lastEffect=zu))}else{if(null!==(t=iu(zu)))return t.effectTag&=2047,t;null!==e&&(e.firstEffect=e.lastEffect=null,e.effectTag|=2048)}if(null!==(t=zu.sibling))return t;zu=e}while(null!==zu);return qu===Ru&&(qu=Vu),null}function Cs(e){var t=e.expirationTime;return t>(e=e.childExpirationTime)?t:e}function As(e){var t=Hi();return Qi(99,Ns.bind(null,e,t)),null}function Ns(e,t){do{Ds()}while(null!==rs);if((Uu&(Pu|Du))!==Au)throw Error(o(327));var n=e.finishedWork,r=e.finishedExpirationTime;if(null===n)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,n===e.current)throw Error(o(177));e.callbackNode=null,e.callbackExpirationTime=0,e.callbackPriority=90,e.nextKnownPendingLevel=0;var i=Cs(n);if(e.firstPendingTime=i,r<=e.lastSuspendedTime?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:r<=e.firstSuspendedTime&&(e.firstSuspendedTime=r-1),r<=e.lastPingedTime&&(e.lastPingedTime=0),r<=e.lastExpiredTime&&(e.lastExpiredTime=0),e===ju&&(zu=ju=null,Bu=0),1<n.effectTag?null!==n.lastEffect?(n.lastEffect.nextEffect=n,i=n.firstEffect):i=n:i=n.firstEffect,null!==i){var a=Uu;Uu|=Du,Cu.current=null,bn=Wt;var u=vn();if(mn(u)){if("selectionStart"in u)var s={start:u.selectionStart,end:u.selectionEnd};else e:{var c=(s=(s=u.ownerDocument)&&s.defaultView||window).getSelection&&s.getSelection();if(c&&0!==c.rangeCount){s=c.anchorNode;var l=c.anchorOffset,f=c.focusNode;c=c.focusOffset;try{s.nodeType,f.nodeType}catch(E){s=null;break e}var h=0,d=-1,p=-1,v=0,m=0,y=u,g=null;t:for(;;){for(var k;y!==s||0!==l&&3!==y.nodeType||(d=h+l),y!==f||0!==c&&3!==y.nodeType||(p=h+c),3===y.nodeType&&(h+=y.nodeValue.length),null!==(k=y.firstChild);)g=y,y=k;for(;;){if(y===u)break t;if(g===s&&++v===l&&(d=h),g===f&&++m===c&&(p=h),null!==(k=y.nextSibling))break;g=(y=g).parentNode}y=k}s=-1===d||-1===p?null:{start:d,end:p}}else s=null}s=s||{start:0,end:0}}else s=null;_n={activeElementDetached:null,focusedElem:u,selectionRange:s},Wt=!1,$u=i;do{try{Ps()}catch(E){if(null===$u)throw Error(o(330));Ls($u,E),$u=$u.nextEffect}}while(null!==$u);$u=i;do{try{for(u=e,s=t;null!==$u;){var w=$u.effectTag;if(16&w&&ze($u.stateNode,""),128&w){var b=$u.alternate;if(null!==b){var _=b.ref;null!==_&&("function"===typeof _?_(null):_.current=null)}}switch(1038&w){case 2:mu($u),$u.effectTag&=-3;break;case 6:mu($u),$u.effectTag&=-3,wu($u.alternate,$u);break;case 1024:$u.effectTag&=-1025;break;case 1028:$u.effectTag&=-1025,wu($u.alternate,$u);break;case 4:wu($u.alternate,$u);break;case 8:ku(u,l=$u,s),pu(l)}$u=$u.nextEffect}}catch(E){if(null===$u)throw Error(o(330));Ls($u,E),$u=$u.nextEffect}}while(null!==$u);if(_=_n,b=vn(),w=_.focusedElem,s=_.selectionRange,b!==w&&w&&w.ownerDocument&&pn(w.ownerDocument.documentElement,w)){null!==s&&mn(w)&&(b=s.start,void 0===(_=s.end)&&(_=b),"selectionStart"in w?(w.selectionStart=b,w.selectionEnd=Math.min(_,w.value.length)):(_=(b=w.ownerDocument||document)&&b.defaultView||window).getSelection&&(_=_.getSelection(),l=w.textContent.length,u=Math.min(s.start,l),s=void 0===s.end?u:Math.min(s.end,l),!_.extend&&u>s&&(l=s,s=u,u=l),l=dn(w,u),f=dn(w,s),l&&f&&(1!==_.rangeCount||_.anchorNode!==l.node||_.anchorOffset!==l.offset||_.focusNode!==f.node||_.focusOffset!==f.offset)&&((b=b.createRange()).setStart(l.node,l.offset),_.removeAllRanges(),u>s?(_.addRange(b),_.extend(f.node,f.offset)):(b.setEnd(f.node,f.offset),_.addRange(b))))),b=[];for(_=w;_=_.parentNode;)1===_.nodeType&&b.push({element:_,left:_.scrollLeft,top:_.scrollTop});for("function"===typeof w.focus&&w.focus(),w=0;w<b.length;w++)(_=b[w]).element.scrollLeft=_.left,_.element.scrollTop=_.top}Wt=!!bn,_n=bn=null,e.current=n,$u=i;do{try{for(w=e;null!==$u;){var x=$u.effectTag;if(36&x&&hu(w,$u.alternate,$u),128&x){b=void 0;var T=$u.ref;if(null!==T){var I=$u.stateNode;$u.tag,b=I,"function"===typeof T?T(b):T.current=b}}$u=$u.nextEffect}}catch(E){if(null===$u)throw Error(o(330));Ls($u,E),$u=$u.nextEffect}}while(null!==$u);$u=null,ji(),Uu=a}else e.current=n;if(ns)ns=!1,rs=e,is=t;else for($u=i;null!==$u;)t=$u.nextEffect,$u.nextEffect=null,$u=t;if(0===(t=e.firstPendingTime)&&(ts=null),1073741823===t?e===us?os++:(os=0,us=e):os=0,"function"===typeof Vs&&Vs(n.stateNode,r),ps(e),Zu)throw Zu=!1,e=es,es=null,e;return(Uu&Nu)!==Au||Xi(),null}function Ps(){for(;null!==$u;){var e=$u.effectTag;0!==(256&e)&&cu($u.alternate,$u),0===(512&e)||ns||(ns=!0,Yi(97,(function(){return Ds(),null}))),$u=$u.nextEffect}}function Ds(){if(90!==is){var e=97<is?97:is;return is=90,Qi(e,Rs)}}function Rs(){if(null===rs)return!1;var e=rs;if(rs=null,(Uu&(Pu|Du))!==Au)throw Error(o(331));var t=Uu;for(Uu|=Du,e=e.current.firstEffect;null!==e;){try{var n=e;if(0!==(512&n.effectTag))switch(n.tag){case 0:case 11:case 15:case 22:lu(5,n),fu(5,n)}}catch(r){if(null===e)throw Error(o(330));Ls(e,r)}n=e.nextEffect,e.nextEffect=null,e=n}return Uu=t,Xi(),!0}function Os(e,t,n){pa(e,t=xu(e,t=au(n,t),1073741823)),null!==(e=hs(e,1073741823))&&ps(e)}function Ls(e,t){if(3===e.tag)Os(e,e,t);else for(var n=e.return;null!==n;){if(3===n.tag){Os(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"===typeof n.type.getDerivedStateFromError||"function"===typeof r.componentDidCatch&&(null===ts||!ts.has(r))){pa(n,e=Tu(n,e=au(t,e),1073741823)),null!==(n=hs(n,1073741823))&&ps(n);break}}n=n.return}}function Ms(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),ju===e&&Bu===n?qu===Fu||qu===Mu&&1073741823===Gu&&Gi()-Ju<Xu?ks(e,Bu):Yu=!0:Ys(e,n)&&(0!==(t=e.lastPingedTime)&&t<n||(e.lastPingedTime=n,ps(e)))}function Fs(e,t){var n=e.stateNode;null!==n&&n.delete(t),0===(t=0)&&(t=ls(t=cs(),e,null)),null!==(e=hs(e,t))&&ps(e)}Iu=function(e,t,n){var r=t.expirationTime;if(null!==e){var i=t.pendingProps;if(e.memoizedProps!==i||gi.current)Mo=!0;else{if(r<n){switch(Mo=!1,t.tag){case 3:Go(t),Oo();break;case 5:if(Ua(t),4&t.mode&&1!==n&&i.hidden)return t.expirationTime=t.childExpirationTime=1,null;break;case 1:bi(t.type)&&Ii(t);break;case 4:Fa(t,t.stateNode.containerInfo);break;case 10:r=t.memoizedProps.value,i=t.type._context,vi(ta,i._currentValue),i._currentValue=r;break;case 13:if(null!==t.memoizedState)return 0!==(r=t.child.childExpirationTime)&&r>=n?Xo(e,t,n):(vi(za,1&za.current),null!==(t=tu(e,t,n))?t.sibling:null);vi(za,1&za.current);break;case 19:if(r=t.childExpirationTime>=n,0!==(64&e.effectTag)){if(r)return eu(e,t,n);t.effectTag|=64}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null),vi(za,za.current),!r)return null}return tu(e,t,n)}Mo=!1}}else Mo=!1;switch(t.expirationTime=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,i=wi(t,yi.current),sa(t,n),i=Za(null,t,r,e,i,n),t.effectTag|=1,"object"===typeof i&&null!==i&&"function"===typeof i.render&&void 0===i.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,bi(r)){var a=!0;Ii(t)}else a=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,fa(t);var u=r.getDerivedStateFromProps;"function"===typeof u&&wa(t,r,u,e),i.updater=ba,t.stateNode=i,i._reactInternalFiber=t,Ia(t,r,e,n),t=Ko(null,t,r,!0,a,n)}else t.tag=0,Fo(null,t,i,n),t=t.child;return t;case 16:e:{if(i=t.elementType,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,function(e){if(-1===e._status){e._status=0;var t=e._ctor;t=t(),e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}}(i),1!==i._status)throw i._result;switch(i=i._result,t.type=i,a=t.tag=function(e){if("function"===typeof e)return Bs(e)?1:0;if(void 0!==e&&null!==e){if((e=e.$$typeof)===se)return 11;if(e===fe)return 14}return 2}(i),e=ea(i,e),a){case 0:t=Bo(null,t,i,e,n);break e;case 1:t=qo(null,t,i,e,n);break e;case 11:t=Vo(null,t,i,e,n);break e;case 14:t=Uo(null,t,i,ea(i.type,e),r,n);break e}throw Error(o(306,i,""))}return t;case 0:return r=t.type,i=t.pendingProps,Bo(e,t,r,i=t.elementType===r?i:ea(r,i),n);case 1:return r=t.type,i=t.pendingProps,qo(e,t,r,i=t.elementType===r?i:ea(r,i),n);case 3:if(Go(t),r=t.updateQueue,null===e||null===r)throw Error(o(282));if(r=t.pendingProps,i=null!==(i=t.memoizedState)?i.element:null,ha(e,t),ma(t,r,null,n),(r=t.memoizedState.element)===i)Oo(),t=tu(e,t,n);else{if((i=t.stateNode.hydrate)&&(So=Sn(t.stateNode.containerInfo.firstChild),Eo=t,i=Co=!0),i)for(n=Pa(t,null,r,n),t.child=n;n;)n.effectTag=-3&n.effectTag|1024,n=n.sibling;else Fo(e,t,r,n),Oo();t=t.child}return t;case 5:return Ua(t),null===e&&Po(t),r=t.type,i=t.pendingProps,a=null!==e?e.memoizedProps:null,u=i.children,Tn(r,i)?u=null:null!==a&&Tn(r,a)&&(t.effectTag|=16),zo(e,t),4&t.mode&&1!==n&&i.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(Fo(e,t,u,n),t=t.child),t;case 6:return null===e&&Po(t),null;case 13:return Xo(e,t,n);case 4:return Fa(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Na(t,null,r,n):Fo(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,Vo(e,t,r,i=t.elementType===r?i:ea(r,i),n);case 7:return Fo(e,t,t.pendingProps,n),t.child;case 8:case 12:return Fo(e,t,t.pendingProps.children,n),t.child;case 10:e:{r=t.type._context,i=t.pendingProps,u=t.memoizedProps,a=i.value;var s=t.type._context;if(vi(ta,s._currentValue),s._currentValue=a,null!==u)if(s=u.value,0===(a=qr(s,a)?0:0|("function"===typeof r._calculateChangedBits?r._calculateChangedBits(s,a):1073741823))){if(u.children===i.children&&!gi.current){t=tu(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var c=s.dependencies;if(null!==c){u=s.child;for(var l=c.firstContext;null!==l;){if(l.context===r&&0!==(l.observedBits&a)){1===s.tag&&((l=da(n,null)).tag=2,pa(s,l)),s.expirationTime<n&&(s.expirationTime=n),null!==(l=s.alternate)&&l.expirationTime<n&&(l.expirationTime=n),ua(s.return,n),c.expirationTime<n&&(c.expirationTime=n);break}l=l.next}}else u=10===s.tag&&s.type===t.type?null:s.child;if(null!==u)u.return=s;else for(u=s;null!==u;){if(u===t){u=null;break}if(null!==(s=u.sibling)){s.return=u.return,u=s;break}u=u.return}s=u}Fo(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=(a=t.pendingProps).children,sa(t,n),r=r(i=ca(i,a.unstable_observedBits)),t.effectTag|=1,Fo(e,t,r,n),t.child;case 14:return a=ea(i=t.type,t.pendingProps),Uo(e,t,i,a=ea(i.type,a),r,n);case 15:return jo(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ea(r,i),null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),t.tag=1,bi(r)?(e=!0,Ii(t)):e=!1,sa(t,n),xa(t,r,i),Ia(t,r,i,n),Ko(null,t,r,!0,e,n);case 19:return eu(e,t,n)}throw Error(o(156,t.tag))};var Vs=null,Us=null;function js(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function zs(e,t,n,r){return new js(e,t,n,r)}function Bs(e){return!(!(e=e.prototype)||!e.isReactComponent)}function qs(e,t){var n=e.alternate;return null===n?((n=zs(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.effectTag=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childExpirationTime=e.childExpirationTime,n.expirationTime=e.expirationTime,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{expirationTime:t.expirationTime,firstContext:t.firstContext,responders:t.responders},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ks(e,t,n,r,i,a){var u=2;if(r=e,"function"===typeof e)Bs(e)&&(u=1);else if("string"===typeof e)u=5;else e:switch(e){case ne:return Gs(n.children,i,a,t);case ue:u=8,i|=7;break;case re:u=8,i|=1;break;case ie:return(e=zs(12,n,t,8|i)).elementType=ie,e.type=ie,e.expirationTime=a,e;case ce:return(e=zs(13,n,t,i)).type=ce,e.elementType=ce,e.expirationTime=a,e;case le:return(e=zs(19,n,t,i)).elementType=le,e.expirationTime=a,e;default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case ae:u=10;break e;case oe:u=9;break e;case se:u=11;break e;case fe:u=14;break e;case he:u=16,r=null;break e;case de:u=22;break e}throw Error(o(130,null==e?e:typeof e,""))}return(t=zs(u,n,t,i)).elementType=e,t.type=r,t.expirationTime=a,t}function Gs(e,t,n,r){return(e=zs(7,e,r,t)).expirationTime=n,e}function Hs(e,t,n){return(e=zs(6,e,null,t)).expirationTime=n,e}function Ws(e,t,n){return(t=zs(4,null!==e.children?e.children:[],e.key,t)).expirationTime=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Qs(e,t,n){this.tag=t,this.current=null,this.containerInfo=e,this.pingCache=this.pendingChildren=null,this.finishedExpirationTime=0,this.finishedWork=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=90,this.lastExpiredTime=this.lastPingedTime=this.nextKnownPendingLevel=this.lastSuspendedTime=this.firstSuspendedTime=this.firstPendingTime=0}function Ys(e,t){var n=e.firstSuspendedTime;return e=e.lastSuspendedTime,0!==n&&n>=t&&e<=t}function Js(e,t){var n=e.firstSuspendedTime,r=e.lastSuspendedTime;n<t&&(e.firstSuspendedTime=t),(r>t||0===n)&&(e.lastSuspendedTime=t),t<=e.lastPingedTime&&(e.lastPingedTime=0),t<=e.lastExpiredTime&&(e.lastExpiredTime=0)}function Xs(e,t){t>e.firstPendingTime&&(e.firstPendingTime=t);var n=e.firstSuspendedTime;0!==n&&(t>=n?e.firstSuspendedTime=e.lastSuspendedTime=e.nextKnownPendingLevel=0:t>=e.lastSuspendedTime&&(e.lastSuspendedTime=t+1),t>e.nextKnownPendingLevel&&(e.nextKnownPendingLevel=t))}function $s(e,t){var n=e.lastExpiredTime;(0===n||n>t)&&(e.lastExpiredTime=t)}function Zs(e,t,n,r){var i=t.current,a=cs(),u=ga.suspense;a=ls(a,i,u);e:if(n){t:{if(et(n=n._reactInternalFiber)!==n||1!==n.tag)throw Error(o(170));var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break t;case 1:if(bi(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break t}}s=s.return}while(null!==s);throw Error(o(171))}if(1===n.tag){var c=n.type;if(bi(c)){n=Ti(n,c,s);break e}}n=s}else n=mi;return null===t.context?t.context=n:t.pendingContext=n,(t=da(a,u)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),pa(i,t),fs(i,a),a}function ec(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function tc(e,t){null!==(e=e.memoizedState)&&null!==e.dehydrated&&e.retryTime<t&&(e.retryTime=t)}function nc(e,t){tc(e,t),(e=e.alternate)&&tc(e,t)}function rc(e,t,n){var r=new Qs(e,t,n=null!=n&&!0===n.hydrate),i=zs(3,null,null,2===t?7:1===t?3:0);r.current=i,i.stateNode=r,fa(i),e[Dn]=r.current,n&&0!==t&&function(e,t){var n=Ze(t);St.forEach((function(e){vt(e,t,n)})),Ct.forEach((function(e){vt(e,t,n)}))}(0,9===e.nodeType?e:e.ownerDocument),this._internalRoot=r}function ic(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function ac(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a._internalRoot;if("function"===typeof i){var u=i;i=function(){var e=ec(o);u.call(e)}}Zs(t,o,e,i)}else{if(a=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new rc(e,0,t?{hydrate:!0}:void 0)}(n,r),o=a._internalRoot,"function"===typeof i){var s=i;i=function(){var e=ec(o);s.call(e)}}gs((function(){Zs(t,o,e,i)}))}return ec(o)}function oc(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!ic(t))throw Error(o(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:te,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)}rc.prototype.render=function(e){Zs(e,this._internalRoot,null,null)},rc.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;Zs(null,e,null,(function(){t[Dn]=null}))},mt=function(e){if(13===e.tag){var t=Zi(cs(),150,100);fs(e,t),nc(e,t)}},yt=function(e){13===e.tag&&(fs(e,3),nc(e,3))},gt=function(e){if(13===e.tag){var t=cs();fs(e,t=ls(t,e,null)),nc(e,t)}},C=function(e,t,n){switch(t){case"input":if(Ie(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=Mn(r);if(!i)throw Error(o(90));be(r),Ie(r,i)}}}break;case"textarea":De(e,n);break;case"select":null!=(t=n.value)&&Ae(e,!!n.multiple,t,!1)}},O=ys,L=function(e,t,n,r,i){var a=Uu;Uu|=4;try{return Qi(98,e.bind(null,t,n,r,i))}finally{(Uu=a)===Au&&Xi()}},M=function(){(Uu&(1|Pu|Du))===Au&&(function(){if(null!==as){var e=as;as=null,e.forEach((function(e,t){$s(t,e),ps(t)})),Xi()}}(),Ds())},F=function(e,t){var n=Uu;Uu|=2;try{return e(t)}finally{(Uu=n)===Au&&Xi()}};var uc={Events:[On,Ln,Mn,E,x,qn,function(e){at(e,Bn)},D,R,$t,st,Ds,{current:!1}]};!function(e){var t=e.findFiberByHostInstance;(function(e){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var n=t.inject(e);Vs=function(e){try{t.onCommitFiberRoot(n,e,void 0,64===(64&e.current.effectTag))}catch(r){}},Us=function(e){try{t.onCommitFiberUnmount(n,e)}catch(r){}}}catch(r){}})(i({},e,{overrideHookState:null,overrideProps:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:J.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=rt(e))?null:e.stateNode},findFiberByHostInstance:function(e){return t?t(e):null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null}))}({findFiberByHostInstance:Rn,bundleType:0,version:"16.13.1",rendererPackageName:"react-dom"}),t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=uc,t.createPortal=oc,t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternalFiber;if(void 0===t){if("function"===typeof e.render)throw Error(o(188));throw Error(o(268,Object.keys(e)))}return e=null===(e=rt(t))?null:e.stateNode},t.flushSync=function(e,t){if((Uu&(Pu|Du))!==Au)throw Error(o(187));var n=Uu;Uu|=1;try{return Qi(99,e.bind(null,t))}finally{Uu=n,Xi()}},t.hydrate=function(e,t,n){if(!ic(t))throw Error(o(200));return ac(null,e,t,!0,n)},t.render=function(e,t,n){if(!ic(t))throw Error(o(200));return ac(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!ic(e))throw Error(o(40));return!!e._reactRootContainer&&(gs((function(){ac(null,null,e,!1,(function(){e._reactRootContainer=null,e[Dn]=null}))})),!0)},t.unstable_batchedUpdates=ys,t.unstable_createPortal=function(e,t){return oc(e,t,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)},t.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ic(n))throw Error(o(200));if(null==e||void 0===e._reactInternalFiber)throw Error(o(38));return ac(e,t,n,!1,r)},t.version="16.13.1"},164:function(e,t,n){!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(463)},117:function(e,t,n){var r=n(725),i="function"===typeof Symbol&&Symbol.for,a=i?Symbol.for("react.element"):60103,o=i?Symbol.for("react.portal"):60106,u=i?Symbol.for("react.fragment"):60107,s=i?Symbol.for("react.strict_mode"):60108,c=i?Symbol.for("react.profiler"):60114,l=i?Symbol.for("react.provider"):60109,f=i?Symbol.for("react.context"):60110,h=i?Symbol.for("react.forward_ref"):60112,d=i?Symbol.for("react.suspense"):60113,p=i?Symbol.for("react.memo"):60115,v=i?Symbol.for("react.lazy"):60116,m="function"===typeof Symbol&&Symbol.iterator;function y(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k={};function w(e,t,n){this.props=e,this.context=t,this.refs=k,this.updater=n||g}function b(){}function _(e,t,n){this.props=e,this.context=t,this.refs=k,this.updater=n||g}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error(y(85));this.updater.enqueueSetState(this,e,t,"setState")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=w.prototype;var x=_.prototype=new b;x.constructor=_,r(x,w.prototype),x.isPureReactComponent=!0;var T={current:null},I=Object.prototype.hasOwnProperty,E={key:!0,ref:!0,__self:!0,__source:!0};function S(e,t,n){var r,i={},o=null,u=null;if(null!=t)for(r in void 0!==t.ref&&(u=t.ref),void 0!==t.key&&(o=""+t.key),t)I.call(t,r)&&!E.hasOwnProperty(r)&&(i[r]=t[r]);var s=arguments.length-2;if(1===s)i.children=n;else if(1<s){for(var c=Array(s),l=0;l<s;l++)c[l]=arguments[l+2];i.children=c}if(e&&e.defaultProps)for(r in s=e.defaultProps)void 0===i[r]&&(i[r]=s[r]);return{$$typeof:a,type:e,key:o,ref:u,props:i,_owner:T.current}}function C(e){return"object"===typeof e&&null!==e&&e.$$typeof===a}var A=/\/+/g,N=[];function P(e,t,n,r){if(N.length){var i=N.pop();return i.result=e,i.keyPrefix=t,i.func=n,i.context=r,i.count=0,i}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function D(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>N.length&&N.push(e)}function R(e,t,n,r){var i=typeof e;"undefined"!==i&&"boolean"!==i||(e=null);var u=!1;if(null===e)u=!0;else switch(i){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case a:case o:u=!0}}if(u)return n(r,e,""===t?"."+L(e,0):t),1;if(u=0,t=""===t?".":t+":",Array.isArray(e))for(var s=0;s<e.length;s++){var c=t+L(i=e[s],s);u+=R(i,c,n,r)}else if(null===e||"object"!==typeof e?c=null:c="function"===typeof(c=m&&e[m]||e["@@iterator"])?c:null,"function"===typeof c)for(e=c.call(e),s=0;!(i=e.next()).done;)u+=R(i=i.value,c=t+L(i,s++),n,r);else if("object"===i)throw n=""+e,Error(y(31,"[object Object]"===n?"object with keys {"+Object.keys(e).join(", ")+"}":n,""));return u}function O(e,t,n){return null==e?0:R(e,"",t,n)}function L(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,(function(e){return t[e]}))}(e.key):t.toString(36)}function M(e,t){e.func.call(e.context,t,e.count++)}function F(e,t,n){var r=e.result,i=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?V(e,r,n,(function(e){return e})):null!=e&&(C(e)&&(e=function(e,t){return{$$typeof:a,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,i+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(A,"$&/")+"/")+n)),r.push(e))}function V(e,t,n,r,i){var a="";null!=n&&(a=(""+n).replace(A,"$&/")+"/"),O(e,F,t=P(t,a,r,i)),D(t)}var U={current:null};function j(){var e=U.current;if(null===e)throw Error(y(321));return e}var z={ReactCurrentDispatcher:U,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:T,IsSomeRendererActing:{current:!1},assign:r};t.Children={map:function(e,t,n){if(null==e)return e;var r=[];return V(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;O(e,M,t=P(null,null,t,n)),D(t)},count:function(e){return O(e,(function(){return null}),null)},toArray:function(e){var t=[];return V(e,t,null,(function(e){return e})),t},only:function(e){if(!C(e))throw Error(y(143));return e}},t.Component=w,t.Fragment=u,t.Profiler=c,t.PureComponent=_,t.StrictMode=s,t.Suspense=d,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=z,t.cloneElement=function(e,t,n){if(null===e||void 0===e)throw Error(y(267,e));var i=r({},e.props),o=e.key,u=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(u=t.ref,s=T.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in t)I.call(t,l)&&!E.hasOwnProperty(l)&&(i[l]=void 0===t[l]&&void 0!==c?c[l]:t[l])}var l=arguments.length-2;if(1===l)i.children=n;else if(1<l){c=Array(l);for(var f=0;f<l;f++)c[f]=arguments[f+2];i.children=c}return{$$typeof:a,type:e.type,key:o,ref:u,props:i,_owner:s}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:f,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:l,_context:e},e.Consumer=e},t.createElement=S,t.createFactory=function(e){var t=S.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:h,render:e}},t.isValidElement=C,t.lazy=function(e){return{$$typeof:v,_ctor:e,_status:-1,_result:null}},t.memo=function(e,t){return{$$typeof:p,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return j().useCallback(e,t)},t.useContext=function(e,t){return j().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return j().useEffect(e,t)},t.useImperativeHandle=function(e,t,n){return j().useImperativeHandle(e,t,n)},t.useLayoutEffect=function(e,t){return j().useLayoutEffect(e,t)},t.useMemo=function(e,t){return j().useMemo(e,t)},t.useReducer=function(e,t,n){return j().useReducer(e,t,n)},t.useRef=function(e){return j().useRef(e)},t.useState=function(e){return j().useState(e)},t.version="16.13.1"},791:function(e,t,n){e.exports=n(117)},813:function(e,t){var n,r,i,a,o;if("undefined"===typeof window||"function"!==typeof MessageChannel){var u=null,s=null,c=function e(){if(null!==u)try{var n=t.unstable_now();u(!0,n),u=null}catch(r){throw setTimeout(e,0),r}},l=Date.now();t.unstable_now=function(){return Date.now()-l},n=function(e){null!==u?setTimeout(n,0,e):(u=e,setTimeout(c,0))},r=function(e,t){s=setTimeout(e,t)},i=function(){clearTimeout(s)},a=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var f=window.performance,h=window.Date,d=window.setTimeout,p=window.clearTimeout;if("undefined"!==typeof console){var v=window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!==typeof v&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"===typeof f&&"function"===typeof f.now)t.unstable_now=function(){return f.now()};else{var m=h.now();t.unstable_now=function(){return h.now()-m}}var y=!1,g=null,k=-1,w=5,b=0;a=function(){return t.unstable_now()>=b},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):w=0<e?Math.floor(1e3/e):5};var _=new MessageChannel,x=_.port2;_.port1.onmessage=function(){if(null!==g){var e=t.unstable_now();b=e+w;try{g(!0,e)?x.postMessage(null):(y=!1,g=null)}catch(n){throw x.postMessage(null),n}}else y=!1},n=function(e){g=e,y||(y=!0,x.postMessage(null))},r=function(e,n){k=d((function(){e(t.unstable_now())}),n)},i=function(){p(k),k=-1}}function T(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,i=e[r];if(!(void 0!==i&&0<S(i,t)))break e;e[r]=t,e[n]=i,n=r}}function I(e){return void 0===(e=e[0])?null:e}function E(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length;r<i;){var a=2*(r+1)-1,o=e[a],u=a+1,s=e[u];if(void 0!==o&&0>S(o,n))void 0!==s&&0>S(s,o)?(e[r]=s,e[u]=n,r=u):(e[r]=o,e[a]=n,r=a);else{if(!(void 0!==s&&0>S(s,n)))break e;e[r]=s,e[u]=n,r=u}}}return t}return null}function S(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var C=[],A=[],N=1,P=null,D=3,R=!1,O=!1,L=!1;function M(e){for(var t=I(A);null!==t;){if(null===t.callback)E(A);else{if(!(t.startTime<=e))break;E(A),t.sortIndex=t.expirationTime,T(C,t)}t=I(A)}}function F(e){if(L=!1,M(e),!O)if(null!==I(C))O=!0,n(V);else{var t=I(A);null!==t&&r(F,t.startTime-e)}}function V(e,n){O=!1,L&&(L=!1,i()),R=!0;var o=D;try{for(M(n),P=I(C);null!==P&&(!(P.expirationTime>n)||e&&!a());){var u=P.callback;if(null!==u){P.callback=null,D=P.priorityLevel;var s=u(P.expirationTime<=n);n=t.unstable_now(),"function"===typeof s?P.callback=s:P===I(C)&&E(C),M(n)}else E(C);P=I(C)}if(null!==P)var c=!0;else{var l=I(A);null!==l&&r(F,l.startTime-n),c=!1}return c}finally{P=null,D=o,R=!1}}function U(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var j=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){O||R||(O=!0,n(V))},t.unstable_getCurrentPriorityLevel=function(){return D},t.unstable_getFirstCallbackNode=function(){return I(C)},t.unstable_next=function(e){switch(D){case 1:case 2:case 3:var t=3;break;default:t=D}var n=D;D=t;try{return e()}finally{D=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=j,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=D;D=e;try{return t()}finally{D=n}},t.unstable_scheduleCallback=function(e,a,o){var u=t.unstable_now();if("object"===typeof o&&null!==o){var s=o.delay;s="number"===typeof s&&0<s?u+s:u,o="number"===typeof o.timeout?o.timeout:U(e)}else o=U(e),s=u;return e={id:N++,callback:a,priorityLevel:e,startTime:s,expirationTime:o=s+o,sortIndex:-1},s>u?(e.sortIndex=s,T(A,e),null===I(C)&&e===I(A)&&(L?i():L=!0,r(F,s-u))):(e.sortIndex=o,T(C,e),O||R||(O=!0,n(V))),e},t.unstable_shouldYield=function(){var e=t.unstable_now();M(e);var n=I(C);return n!==P&&null!==P&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTime<P.expirationTime||a()},t.unstable_wrapCallback=function(e){var t=D;return function(){var n=D;D=t;try{return e.apply(this,arguments)}finally{D=n}}}},296:function(e,t,n){e.exports=n(813)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.p="./",function(){var e={};n.r(e),n.d(e,{FirebaseError:function(){return G},SDK_VERSION:function(){return tt},_DEFAULT_ENTRY_NAME:function(){return Be},_addComponent:function(){return He},_addOrOverwriteComponent:function(){return We},_apps:function(){return Ke},_clearComponents:function(){return Xe},_components:function(){return Ge},_getProvider:function(){return Ye},_registerComponent:function(){return Qe},_removeServiceInstance:function(){return Je},deleteApp:function(){return at},getApp:function(){return rt},getApps:function(){return it},initializeApp:function(){return nt},onLog:function(){return st},registerVersion:function(){return ut},setLogLevel:function(){return ct}});var t=n(791),r=n(164);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},i(e)}function a(){a=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},u="function"==typeof Symbol?Symbol:{},s=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",l=u.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,n){return e[t]=n}}function h(e,t,n,r){var i=t&&t.prototype instanceof k?t:k,a=Object.create(i.prototype),u=new D(r||[]);return o(a,"_invoke",{value:C(e,n,u)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var p="suspendedStart",v="suspendedYield",m="executing",y="completed",g={};function k(){}function w(){}function b(){}var _={};f(_,s,(function(){return this}));var x=Object.getPrototypeOf,T=x&&x(x(R([])));T&&T!==n&&r.call(T,s)&&(_=T);var I=b.prototype=k.prototype=Object.create(_);function E(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(a,o,u,s){var c=d(e[a],e,o);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==i(f)&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,u,s)}),(function(e){n("throw",e,u,s)})):t.resolve(f).then((function(e){l.value=e,u(l)}),(function(e){return n("throw",e,u,s)}))}s(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return a=a?a.then(i,i):i()}})}function C(t,n,r){var i=p;return function(a,o){if(i===m)throw new Error("Generator is already running");if(i===y){if("throw"===a)throw o;return{value:e,done:!0}}for(r.method=a,r.arg=o;;){var u=r.delegate;if(u){var s=A(u,r);if(s){if(s===g)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=m;var c=d(t,n,r);if("normal"===c.type){if(i=r.done?y:v,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=y,r.method="throw",r.arg=c.arg)}}}function A(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,A(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=d(i,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var o=a.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function R(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(i(t)+" is not iterable")}return w.prototype=b,o(I,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=f(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,f(e,l,"GeneratorFunction")),e.prototype=Object.create(I),e},t.awrap=function(e){return{__await:e}},E(S.prototype),f(S.prototype,c,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new S(h(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},E(I),f(I,l,"Generator"),f(I,s,(function(){return this})),f(I,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=R,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return u.type="throw",u.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],u=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;P(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function o(e,t,n,r,i,a,o){try{var u=e[a](o),s=u.value}catch(c){return void n(c)}u.done?t(s):Promise.resolve(s).then(r,i)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function u(e){o(a,r,i,u,s,"next",e)}function s(e){o(a,r,i,u,s,"throw",e)}u(void 0)}))}}function s(e){var t=function(e,t){if("object"!==i(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===i(t)?t:String(t)}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function h(e){if(Array.isArray(e))return e}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t){if(e){if("string"===typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function v(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e,t){return h(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,u=[],s=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(u.push(r.value),u.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return u}}(e,t)||p(e,t)||v()}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}function k(e,t,n){return t&&g(e.prototype,t),n&&g(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function w(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=p(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(u)throw a}}}}function b(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(e,t){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_(e,t)}function x(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_(e,t)}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}function I(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function E(e){var t=I();return function(){var n,r=T(e);if(t){var a=T(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===i(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return b(e)}(this,n)}}function S(e,t,n){return S=I()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&_(i,n.prototype),i},S.apply(null,arguments)}function C(e){var t="function"===typeof Map?new Map:void 0;return C=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"===typeof e}}(e))return e;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return S(e,arguments,T(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_(n,e)},C(e)}var A=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296===(64512&i)&&r+1<e.length&&56320===(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},N={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"===typeof atob,encodeByteArray:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<e.length;i+=3){var a=e[i],o=i+1<e.length,u=o?e[i+1]:0,s=i+2<e.length,c=s?e[i+2]:0,l=a>>2,f=(3&a)<<4|u>>4,h=(15&u)<<2|c>>6,d=63&c;s||(d=64,o||(h=64)),r.push(n[l],n[f],n[h],n[d])}return r.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(A(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],n=0,r=0;n<e.length;){var i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){var a=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&a)}else if(i>239&&i<365){var o=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(o>>10)),t[r++]=String.fromCharCode(56320+(1023&o))}else{var u=e[n++],s=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&u)<<6|63&s)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<e.length;){var a=n[e.charAt(i++)],o=i<e.length?n[e.charAt(i)]:0,u=++i<e.length?n[e.charAt(i)]:64,s=++i<e.length?n[e.charAt(i)]:64;if(++i,null==a||null==o||null==u||null==s)throw new P;var c=a<<2|o>>4;if(r.push(c),64!==u){var l=o<<4&240|u>>2;if(r.push(l),64!==s){var f=u<<6&192|s;r.push(f)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var 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)}}},P=function(e){x(n,e);var t=E(n);function n(){var e;return y(this,n),(e=t.apply(this,arguments)).name="DecodeBase64StringError",e}return k(n)}(C(Error)),D=function(e){return function(e){var t=A(e);return N.encodeByteArray(t,!0)}(e).replace(/\./g,"")},R=function(e){try{return N.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};function O(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var n in t)t.hasOwnProperty(n)&&"__proto__"!==n&&(e[n]=O(e[n],t[n]));return e}var L=function(){return function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof n.g)return n.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__},M=function(){try{return L()||function(){if("undefined"!==typeof process){var e={NODE_ENV:"production",PUBLIC_URL:".",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0}}()||function(){if("undefined"!==typeof document){var e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(n){return}var t=e&&R(e[1]);return t&&JSON.parse(t)}}()}catch(e){return void console.info("Unable to get __FIREBASE_DEFAULTS__ due to: ".concat(e))}},F=function(){var e;return null===(e=M())||void 0===e?void 0:e.config},V=function(){function e(){var t=this;y(this,e),this.reject=function(){},this.resolve=function(){},this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))}return k(e,[{key:"wrapCallback",value:function(e){var t=this;return function(n,r){n?t.reject(n):t.resolve(r),"function"===typeof e&&(t.promise.catch((function(){})),1===e.length?e(n):e(n,r))}}}]),e}();function U(){return"undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:""}function j(){var e,t=null===(e=M())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(n.g.process)}catch(r){return!1}}function z(){var e="object"===typeof chrome?chrome.runtime:"object"===typeof browser?browser.runtime:void 0;return"object"===typeof e&&void 0!==e.id}function B(){return"object"===typeof navigator&&"ReactNative"===navigator.product}function q(){var e=U();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function K(){try{return"object"===typeof indexedDB}catch(e){return!1}}var G=function(e){x(n,e);var t=E(n);function n(e,r,i){var a;return y(this,n),(a=t.call(this,r)).code=e,a.customData=i,a.name="FirebaseError",Object.setPrototypeOf(b(a),n.prototype),Error.captureStackTrace&&Error.captureStackTrace(b(a),H.prototype.create),a}return k(n)}(C(Error)),H=function(){function e(t,n,r){y(this,e),this.service=t,this.serviceName=n,this.errors=r}return k(e,[{key:"create",value:function(e){var t=(arguments.length<=1?void 0:arguments[1])||{},n="".concat(this.service,"/").concat(e),r=this.errors[e],i=r?function(e,t){return e.replace(W,(function(e,n){var r=t[n];return null!=r?String(r):"<".concat(n,"?>")}))}(r,t):"Error",a="".concat(this.serviceName,": ").concat(i," (").concat(n,").");return new G(n,a,t)}}]),e}();var W=/\{\$([^}]+)}/g;function Q(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Y(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function J(e,t){if(e===t)return!0;for(var n=Object.keys(e),r=Object.keys(t),i=0,a=n;i<a.length;i++){var o=a[i];if(!r.includes(o))return!1;var u=e[o],s=t[o];if(X(u)&&X(s)){if(!J(u,s))return!1}else if(u!==s)return!1}for(var c=0,l=r;c<l.length;c++){var f=l[c];if(!n.includes(f))return!1}return!0}function X(e){return null!==e&&"object"===typeof e}function $(e){for(var t=[],n=function(){var e=m(i[r],2),n=e[0],a=e[1];Array.isArray(a)?a.forEach((function(e){t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))})):t.push(encodeURIComponent(n)+"="+encodeURIComponent(a))},r=0,i=Object.entries(e);r<i.length;r++)n();return t.length?"&"+t.join("&"):""}function Z(e){var t={};return e.replace(/^\?/,"").split("&").forEach((function(e){if(e){var n=m(e.split("="),2),r=n[0],i=n[1];t[decodeURIComponent(r)]=decodeURIComponent(i)}})),t}function ee(e){var t=e.indexOf("?");if(!t)return"";var n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}function te(e,t){var n=new ne(e,t);return n.subscribe.bind(n)}var ne=function(){function e(t,n){var r=this;y(this,e),this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then((function(){t(r)})).catch((function(e){r.error(e)}))}return k(e,[{key:"next",value:function(e){this.forEachObserver((function(t){t.next(e)}))}},{key:"error",value:function(e){this.forEachObserver((function(t){t.error(e)})),this.close(e)}},{key:"complete",value:function(){this.forEachObserver((function(e){e.complete()})),this.close()}},{key:"subscribe",value:function(e,t,n){var r,i=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(e,t){if("object"!==typeof e||null===e)return!1;var n,r=w(t);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i in e&&"function"===typeof e[i])return!0}}catch(a){r.e(a)}finally{r.f()}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n}).next&&(r.next=re),void 0===r.error&&(r.error=re),void 0===r.complete&&(r.complete=re);var a=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(e){}})),this.observers.push(r),a}},{key:"unsubscribeOne",value:function(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}},{key:"forEachObserver",value:function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)}},{key:"sendOne",value:function(e,t){var n=this;this.task.then((function(){if(void 0!==n.observers&&void 0!==n.observers[e])try{t(n.observers[e])}catch(r){"undefined"!==typeof console&&console.error&&console.error(r)}}))}},{key:"close",value:function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then((function(){t.observers=void 0,t.onNoObservers=void 0})))}}]),e}();function re(){}function ie(e){return e&&e._delegate?e._delegate:e}function ae(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function oe(e){return function(e){if(Array.isArray(e))return d(e)}(e)||ae(e)||p(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ue=function(){function e(t,n,r){y(this,e),this.name=t,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}return k(e,[{key:"setInstantiationMode",value:function(e){return this.instantiationMode=e,this}},{key:"setMultipleInstances",value:function(e){return this.multipleInstances=e,this}},{key:"setServiceProps",value:function(e){return this.serviceProps=e,this}},{key:"setInstanceCreatedCallback",value:function(e){return this.onInstanceCreated=e,this}}]),e}(),se="[DEFAULT]",ce=function(){function e(t,n){y(this,e),this.name=t,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}return k(e,[{key:"get",value:function(e){var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){var n=new V;if(this.instancesDeferred.set(t,n),this.isInitialized(t)||this.shouldAutoInitialize())try{var r=this.getOrInitializeService({instanceIdentifier:t});r&&n.resolve(r)}catch(i){}}return this.instancesDeferred.get(t).promise}},{key:"getImmediate",value:function(e){var t,n=this.normalizeInstanceIdentifier(null===e||void 0===e?void 0:e.identifier),r=null!==(t=null===e||void 0===e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error("Service ".concat(this.name," is not available"))}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}}},{key:"getComponent",value:function(){return this.component}},{key:"setComponent",value:function(e){if(e.name!==this.name)throw Error("Mismatching Component ".concat(e.name," for Provider ").concat(this.name,"."));if(this.component)throw Error("Component for ".concat(this.name," has already been provided"));if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:se})}catch(s){}var t,n=w(this.instancesDeferred.entries());try{for(n.s();!(t=n.n()).done;){var r=m(t.value,2),i=r[0],a=r[1],o=this.normalizeInstanceIdentifier(i);try{var u=this.getOrInitializeService({instanceIdentifier:o});a.resolve(u)}catch(s){}}}catch(c){n.e(c)}finally{n.f()}}}},{key:"clearInstance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se;this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}},{key:"delete",value:function(){var e=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Array.from(this.instances.values()),e.next=3,Promise.all([].concat(oe(t.filter((function(e){return"INTERNAL"in e})).map((function(e){return e.INTERNAL.delete()}))),oe(t.filter((function(e){return"_delete"in e})).map((function(e){return e._delete()})))));case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"isComponentSet",value:function(){return null!=this.component}},{key:"isInitialized",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se;return this.instances.has(e)}},{key:"getOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se;return this.instancesOptions.get(e)||{}}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.options,n=void 0===t?{}:t,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error("".concat(this.name,"(").concat(r,") has already been initialized"));if(!this.isComponentSet())throw Error("Component ".concat(this.name," has not been registered yet"));var i,a=this.getOrInitializeService({instanceIdentifier:r,options:n}),o=w(this.instancesDeferred.entries());try{for(o.s();!(i=o.n()).done;){var u=m(i.value,2),s=u[0],c=u[1];r===this.normalizeInstanceIdentifier(s)&&c.resolve(a)}}catch(l){o.e(l)}finally{o.f()}return a}},{key:"onInit",value:function(e,t){var n,r=this.normalizeInstanceIdentifier(t),i=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;i.add(e),this.onInitCallbacks.set(r,i);var a=this.instances.get(r);return a&&e(a,r),function(){i.delete(e)}}},{key:"invokeOnInitCallbacks",value:function(e,t){var n=this.onInitCallbacks.get(t);if(n){var r,i=w(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;try{a(e,t)}catch(o){}}}catch(u){i.e(u)}finally{i.f()}}}},{key:"getOrInitializeService",value:function(e){var t,n=e.instanceIdentifier,r=e.options,i=void 0===r?{}:r,a=this.instances.get(n);if(!a&&this.component&&(a=this.component.instanceFactory(this.container,{instanceIdentifier:(t=n,t===se?void 0:t),options:i}),this.instances.set(n,a),this.instancesOptions.set(n,i),this.invokeOnInitCallbacks(a,n),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,n,a)}catch(o){}return a||null}},{key:"normalizeInstanceIdentifier",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:se;return this.component?this.component.multipleInstances?e:se:e}},{key:"shouldAutoInitialize",value:function(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}]),e}();var le,fe,he=function(){function e(t){y(this,e),this.name=t,this.providers=new Map}return k(e,[{key:"addComponent",value:function(e){var t=this.getProvider(e.name);if(t.isComponentSet())throw new Error("Component ".concat(e.name," has already been registered with ").concat(this.name));t.setComponent(e)}},{key:"addOrOverwriteComponent",value:function(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}},{key:"getProvider",value:function(e){if(this.providers.has(e))return this.providers.get(e);var t=new ce(e,this);return this.providers.set(e,t),t}},{key:"getProviders",value:function(){return Array.from(this.providers.values())}}]),e}(),de=[];!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(fe||(fe={}));var pe={debug:fe.DEBUG,verbose:fe.VERBOSE,info:fe.INFO,warn:fe.WARN,error:fe.ERROR,silent:fe.SILENT},ve=fe.INFO,me=(c(le={},fe.DEBUG,"log"),c(le,fe.VERBOSE,"log"),c(le,fe.INFO,"info"),c(le,fe.WARN,"warn"),c(le,fe.ERROR,"error"),le),ye=function(e,t){if(!(t<e.logLevel)){var n=(new Date).toISOString(),r=me[t];if(!r)throw new Error("Attempted to log a message with an invalid logType (value: ".concat(t,")"));for(var i,a=arguments.length,o=new Array(a>2?a-2:0),u=2;u<a;u++)o[u-2]=arguments[u];(i=console)[r].apply(i,["[".concat(n,"] ").concat(e.name,":")].concat(o))}},ge=function(){function e(t){y(this,e),this.name=t,this._logLevel=ve,this._logHandler=ye,this._userLogHandler=null,de.push(this)}return k(e,[{key:"logLevel",get:function(){return this._logLevel},set:function(e){if(!(e in fe))throw new TypeError('Invalid value "'.concat(e,'" assigned to `logLevel`'));this._logLevel=e}},{key:"setLogLevel",value:function(e){this._logLevel="string"===typeof e?pe[e]:e}},{key:"logHandler",get:function(){return this._logHandler},set:function(e){if("function"!==typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}},{key:"userLogHandler",get:function(){return this._userLogHandler},set:function(e){this._userLogHandler=e}},{key:"debug",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,fe.DEBUG].concat(t)),this._logHandler.apply(this,[this,fe.DEBUG].concat(t))}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,fe.VERBOSE].concat(t)),this._logHandler.apply(this,[this,fe.VERBOSE].concat(t))}},{key:"info",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,fe.INFO].concat(t)),this._logHandler.apply(this,[this,fe.INFO].concat(t))}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,fe.WARN].concat(t)),this._logHandler.apply(this,[this,fe.WARN].concat(t))}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._userLogHandler&&this._userLogHandler.apply(this,[this,fe.ERROR].concat(t)),this._logHandler.apply(this,[this,fe.ERROR].concat(t))}}]),e}();var ke,we,be=function(e,t){return t.some((function(t){return e instanceof t}))};var _e=new WeakMap,xe=new WeakMap,Te=new WeakMap,Ie=new WeakMap,Ee=new WeakMap;var Se={get:function(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return xe.get(e);if("objectStoreNames"===t)return e.objectStoreNames||Te.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ne(e[t])},set:function(e,t,n){return e[t]=n,!0},has:function(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function Ce(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(we||(we=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(Pe(this),n),Ne(_e.get(this))}:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ne(e.apply(Pe(this),n))}:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var a=e.call.apply(e,[Pe(this),t].concat(r));return Te.set(a,t.sort?t.sort():[t]),Ne(a)}}function Ae(e){return"function"===typeof e?Ce(e):(e instanceof IDBTransaction&&function(e){if(!xe.has(e)){var t=new Promise((function(t,n){var r=function(){e.removeEventListener("complete",i),e.removeEventListener("error",a),e.removeEventListener("abort",a)},i=function(){t(),r()},a=function(){n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",a),e.addEventListener("abort",a)}));xe.set(e,t)}}(e),be(e,ke||(ke=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,Se):e)}function Ne(e){if(e instanceof IDBRequest)return function(e){var t=new Promise((function(t,n){var r=function(){e.removeEventListener("success",i),e.removeEventListener("error",a)},i=function(){t(Ne(e.result)),r()},a=function(){n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",a)}));return t.then((function(t){t instanceof IDBCursor&&_e.set(t,e)})).catch((function(){})),Ee.set(t,e),t}(e);if(Ie.has(e))return Ie.get(e);var t=Ae(e);return t!==e&&(Ie.set(e,t),Ee.set(t,e)),t}var Pe=function(e){return Ee.get(e)};var De,Re,Oe=["get","getKey","getAll","getAllKeys","count"],Le=["put","add","delete","clear"],Me=new Map;function Fe(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"===typeof t){if(Me.get(t))return Me.get(t);var n=t.replace(/FromIndex$/,""),r=t!==n,i=Le.includes(n);if(n in(r?IDBIndex:IDBObjectStore).prototype&&(i||Oe.includes(n))){var o=function(){var e=u(a().mark((function e(t){var o,u,s,c,l,f,h=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(u=this.transaction(t,i?"readwrite":"readonly"),s=u.store,c=h.length,l=new Array(c>1?c-1:0),f=1;f<c;f++)l[f-1]=h[f];return r&&(s=s.index(l.shift())),e.next=6,Promise.all([(o=s)[n].apply(o,l),i&&u.done]);case 6:return e.abrupt("return",e.sent[0]);case 7:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}();return Me.set(t,o),o}}}Se=function(e){return f(f({},e),{},{get:function(t,n,r){return Fe(t,n)||e.get(t,n,r)},has:function(t,n){return!!Fe(t,n)||e.has(t,n)}})}(Se);var Ve=function(){function e(t){y(this,e),this.container=t}return k(e,[{key:"getPlatformInfoString",value:function(){return this.container.getProviders().map((function(e){if(function(e){var t=e.getComponent();return"VERSION"===(null===t||void 0===t?void 0:t.type)}(e)){var t=e.getImmediate();return"".concat(t.library,"/").concat(t.version)}return null})).filter((function(e){return e})).join(" ")}}]),e}();var Ue="@firebase/app",je="0.9.20",ze=new ge("@firebase/app"),Be="[DEFAULT]",qe=(c(De={},Ue,"fire-core"),c(De,"@firebase/app-compat","fire-core-compat"),c(De,"@firebase/analytics","fire-analytics"),c(De,"@firebase/analytics-compat","fire-analytics-compat"),c(De,"@firebase/app-check","fire-app-check"),c(De,"@firebase/app-check-compat","fire-app-check-compat"),c(De,"@firebase/auth","fire-auth"),c(De,"@firebase/auth-compat","fire-auth-compat"),c(De,"@firebase/database","fire-rtdb"),c(De,"@firebase/database-compat","fire-rtdb-compat"),c(De,"@firebase/functions","fire-fn"),c(De,"@firebase/functions-compat","fire-fn-compat"),c(De,"@firebase/installations","fire-iid"),c(De,"@firebase/installations-compat","fire-iid-compat"),c(De,"@firebase/messaging","fire-fcm"),c(De,"@firebase/messaging-compat","fire-fcm-compat"),c(De,"@firebase/performance","fire-perf"),c(De,"@firebase/performance-compat","fire-perf-compat"),c(De,"@firebase/remote-config","fire-rc"),c(De,"@firebase/remote-config-compat","fire-rc-compat"),c(De,"@firebase/storage","fire-gcs"),c(De,"@firebase/storage-compat","fire-gcs-compat"),c(De,"@firebase/firestore","fire-fst"),c(De,"@firebase/firestore-compat","fire-fst-compat"),c(De,"fire-js","fire-js"),c(De,"firebase","fire-js-all"),De),Ke=new Map,Ge=new Map;function He(e,t){try{e.container.addComponent(t)}catch(n){ze.debug("Component ".concat(t.name," failed to register with FirebaseApp ").concat(e.name),n)}}function We(e,t){e.container.addOrOverwriteComponent(t)}function Qe(e){var t=e.name;if(Ge.has(t))return ze.debug("There were multiple attempts to register component ".concat(t,".")),!1;Ge.set(t,e);var n,r=w(Ke.values());try{for(r.s();!(n=r.n()).done;){He(n.value,e)}}catch(i){r.e(i)}finally{r.f()}return!0}function Ye(e,t){var n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function Je(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Be;Ye(e,t).clearInstance(n)}function Xe(){Ge.clear()}var $e=(c(Re={},"no-app","No Firebase App '{$appName}' has been created - call initializeApp() first"),c(Re,"bad-app-name","Illegal App name: '{$appName}"),c(Re,"duplicate-app","Firebase App named '{$appName}' already exists with different options or config"),c(Re,"app-deleted","Firebase App named '{$appName}' already deleted"),c(Re,"no-options","Need to provide options, when not being deployed to hosting via source."),c(Re,"invalid-app-argument","firebase.{$appName}() takes either no argument or a Firebase App instance."),c(Re,"invalid-log-argument","First argument to `onLog` must be null or a function."),c(Re,"idb-open","Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}."),c(Re,"idb-get","Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}."),c(Re,"idb-set","Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}."),c(Re,"idb-delete","Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."),Re),Ze=new H("app","Firebase",$e),et=function(){function e(t,n,r){var i=this;y(this,e),this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new ue("app",(function(){return i}),"PUBLIC"))}return k(e,[{key:"automaticDataCollectionEnabled",get:function(){return this.checkDestroyed(),this._automaticDataCollectionEnabled},set:function(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}},{key:"name",get:function(){return this.checkDestroyed(),this._name}},{key:"options",get:function(){return this.checkDestroyed(),this._options}},{key:"config",get:function(){return this.checkDestroyed(),this._config}},{key:"container",get:function(){return this._container}},{key:"isDeleted",get:function(){return this._isDeleted},set:function(e){this._isDeleted=e}},{key:"checkDestroyed",value:function(){if(this.isDeleted)throw Ze.create("app-deleted",{appName:this._name})}}]),e}(),tt="10.5.0";function nt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;"object"!==typeof t&&(t={name:t});var r=Object.assign({name:Be,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!==typeof i||!i)throw Ze.create("bad-app-name",{appName:String(i)});if(n||(n=F()),!n)throw Ze.create("no-options");var a=Ke.get(i);if(a){if(J(n,a.options)&&J(r,a.config))return a;throw Ze.create("duplicate-app",{appName:i})}var o,u=new he(i),s=w(Ge.values());try{for(s.s();!(o=s.n()).done;){var c=o.value;u.addComponent(c)}}catch(f){s.e(f)}finally{s.f()}var l=new et(n,r,u);return Ke.set(i,l),l}function rt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Be,t=Ke.get(e);if(!t&&e===Be&&F())return nt();if(!t)throw Ze.create("no-app",{appName:e});return t}function it(){return Array.from(Ke.values())}function at(e){return ot.apply(this,arguments)}function ot(){return(ot=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.name,!Ke.has(n)){e.next=6;break}return Ke.delete(n),e.next=5,Promise.all(t.container.getProviders().map((function(e){return e.delete()})));case 5:t.isDeleted=!0;case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ut(e,t,n){var r,i=null!==(r=qe[e])&&void 0!==r?r:e;n&&(i+="-".concat(n));var a=i.match(/\s|\//),o=t.match(/\s|\//);if(a||o){var u=['Unable to register library "'.concat(i,'" with version "').concat(t,'":')];return a&&u.push('library name "'.concat(i,'" contains illegal characters (whitespace or "/")')),a&&o&&u.push("and"),o&&u.push('version name "'.concat(t,'" contains illegal characters (whitespace or "/")')),void ze.warn(u.join(" "))}Qe(new ue("".concat(i,"-version"),(function(){return{library:i,version:t}}),"VERSION"))}function st(e,t){if(null!==e&&"function"!==typeof e)throw Ze.create("invalid-log-argument");!function(e,t){var n,r=w(de);try{var i=function(){var r=n.value,i=null;t&&t.level&&(i=pe[t.level]),r.userLogHandler=null===e?null:function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),o=2;o<r;o++)a[o-2]=arguments[o];var u=a.map((function(e){if(null==e)return null;if("string"===typeof e)return e;if("number"===typeof e||"boolean"===typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(t){return null}})).filter((function(e){return e})).join(" ");n>=(null!==i&&void 0!==i?i:t.logLevel)&&e({level:fe[n].toLowerCase(),message:u,args:a,type:t.name})}};for(r.s();!(n=r.n()).done;)i()}catch(a){r.e(a)}finally{r.f()}}(e,t)}function ct(e){var t;t=e,de.forEach((function(e){e.setLogLevel(t)}))}var lt="firebase-heartbeat-database",ft=1,ht="firebase-heartbeat-store",dt=null;function pt(){return dt||(dt=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.blocked,i=n.upgrade,a=n.blocking,o=n.terminated,u=indexedDB.open(e,t),s=Ne(u);return i&&u.addEventListener("upgradeneeded",(function(e){i(Ne(u.result),e.oldVersion,e.newVersion,Ne(u.transaction),e)})),r&&u.addEventListener("blocked",(function(e){return r(e.oldVersion,e.newVersion,e)})),s.then((function(e){o&&e.addEventListener("close",(function(){return o()})),a&&e.addEventListener("versionchange",(function(e){return a(e.oldVersion,e.newVersion,e)}))})).catch((function(){})),s}(lt,ft,{upgrade:function(e,t){if(0===t)e.createObjectStore(ht)}}).catch((function(e){throw Ze.create("idb-open",{originalErrorMessage:e.message})}))),dt}function vt(e){return mt.apply(this,arguments)}function mt(){return mt=u(a().mark((function e(t){var n,r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,pt();case 3:return n=e.sent,e.next=6,n.transaction(ht).objectStore(ht).get(kt(t));case 6:return r=e.sent,e.abrupt("return",r);case 10:e.prev=10,e.t0=e.catch(0),e.t0 instanceof G?ze.warn(e.t0.message):(i=Ze.create("idb-get",{originalErrorMessage:null===e.t0||void 0===e.t0?void 0:e.t0.message}),ze.warn(i.message));case 13:case"end":return e.stop()}}),e,null,[[0,10]])}))),mt.apply(this,arguments)}function yt(e,t){return gt.apply(this,arguments)}function gt(){return gt=u(a().mark((function e(t,n){var r,i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,pt();case 3:return r=e.sent,i=r.transaction(ht,"readwrite"),o=i.objectStore(ht),e.next=8,o.put(n,kt(t));case 8:return e.next=10,i.done;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),e.t0 instanceof G?ze.warn(e.t0.message):(u=Ze.create("idb-set",{originalErrorMessage:null===e.t0||void 0===e.t0?void 0:e.t0.message}),ze.warn(u.message));case 15:case"end":return e.stop()}}),e,null,[[0,12]])}))),gt.apply(this,arguments)}function kt(e){return"".concat(e.name,"!").concat(e.options.appId)}var wt=function(){function e(t){var n=this;y(this,e),this.container=t,this._heartbeatsCache=null;var r=this.container.getProvider("app").getImmediate();this._storage=new It(r),this._heartbeatsCachePromise=this._storage.read().then((function(e){return n._heartbeatsCache=e,e}))}return k(e,[{key:"triggerHeartbeat",value:function(){var e=u(a().mark((function e(){var t,n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.container.getProvider("platform-logger").getImmediate(),n=t.getPlatformInfoString(),r=bt(),null!==this._heartbeatsCache){e.next=7;break}return e.next=6,this._heartbeatsCachePromise;case 6:this._heartbeatsCache=e.sent;case 7:if(this._heartbeatsCache.lastSentHeartbeatDate!==r&&!this._heartbeatsCache.heartbeats.some((function(e){return e.date===r}))){e.next=11;break}return e.abrupt("return");case 11:this._heartbeatsCache.heartbeats.push({date:r,agent:n});case 12:return this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((function(e){var t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),e.abrupt("return",this._storage.overwrite(this._heartbeatsCache));case 14:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getHeartbeatsHeader",value:function(){var e=u(a().mark((function e(){var t,n,r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==this._heartbeatsCache){e.next=3;break}return e.next=3,this._heartbeatsCachePromise;case 3:if(null!==this._heartbeatsCache&&0!==this._heartbeatsCache.heartbeats.length){e.next=5;break}return e.abrupt("return","");case 5:if(t=bt(),n=_t(this._heartbeatsCache.heartbeats),r=n.heartbeatsToSend,i=n.unsentEntries,o=D(JSON.stringify({version:2,heartbeats:r})),this._heartbeatsCache.lastSentHeartbeatDate=t,!(i.length>0)){e.next=15;break}return this._heartbeatsCache.heartbeats=i,e.next=13,this._storage.overwrite(this._heartbeatsCache);case 13:e.next=17;break;case 15:this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache);case 17:return e.abrupt("return",o);case 18:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()}]),e}();function bt(){return(new Date).toISOString().substring(0,10)}function _t(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024,r=[],i=e.slice(),a=w(e);try{var o=function(){var e=t.value,a=r.find((function(t){return t.agent===e.agent}));if(a){if(a.dates.push(e.date),Et(r)>n)return a.dates.pop(),0}else if(r.push({agent:e.agent,dates:[e.date]}),Et(r)>n)return r.pop(),0;i=i.slice(1)};for(a.s();!(t=a.n()).done&&0!==o(););}catch(u){a.e(u)}finally{a.f()}return{heartbeatsToSend:r,unsentEntries:i}}var xt,Tt,It=function(){function e(t){y(this,e),this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}return k(e,[{key:"runIndexedDBEnvironmentCheck",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(K()){e.next=4;break}return e.abrupt("return",!1);case 4:return e.abrupt("return",new Promise((function(e,t){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=function(){i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=function(){n=!1},i.onerror=function(){var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(a){t(a)}})).then((function(){return!0})).catch((function(){return!1})));case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"read",value:function(){var e=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return",{heartbeats:[]});case 7:return e.next=9,vt(this.app);case 9:return t=e.sent,e.abrupt("return",t||{heartbeats:[]});case 11:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"overwrite",value:function(){var e=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this.read();case 9:return r=e.sent,e.abrupt("return",yt(this.app,{lastSentHeartbeatDate:null!==(n=t.lastSentHeartbeatDate)&&void 0!==n?n:r.lastSentHeartbeatDate,heartbeats:t.heartbeats}));case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"add",value:function(){var e=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._canUseIndexedDBPromise;case 2:if(e.sent){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this.read();case 9:return r=e.sent,e.abrupt("return",yt(this.app,{lastSentHeartbeatDate:null!==(n=t.lastSentHeartbeatDate)&&void 0!==n?n:r.lastSentHeartbeatDate,heartbeats:[].concat(oe(r.heartbeats),oe(t.heartbeats))}));case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),e}();function Et(e){return D(JSON.stringify({version:2,heartbeats:e})).length}xt="",Qe(new ue("platform-logger",(function(e){return new Ve(e)}),"PRIVATE")),Qe(new ue("heartbeat",(function(e){return new wt(e)}),"PRIVATE")),ut(Ue,je,xt),ut(Ue,je,"esm2017"),ut("fire-js","");var St=function(){function e(t,n){var r=this;y(this,e),this._delegate=t,this.firebase=n,He(t,new ue("app-compat",(function(){return r}),"PUBLIC")),this.container=t.container}return k(e,[{key:"automaticDataCollectionEnabled",get:function(){return this._delegate.automaticDataCollectionEnabled},set:function(e){this._delegate.automaticDataCollectionEnabled=e}},{key:"name",get:function(){return this._delegate.name}},{key:"options",get:function(){return this._delegate.options}},{key:"delete",value:function(){var e=this;return new Promise((function(t){e._delegate.checkDestroyed(),t()})).then((function(){return e.firebase.INTERNAL.removeApp(e.name),at(e._delegate)}))}},{key:"_getService",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Be;this._delegate.checkDestroyed();var r=this._delegate.container.getProvider(e);return r.isInitialized()||"EXPLICIT"!==(null===(t=r.getComponent())||void 0===t?void 0:t.instantiationMode)||r.initialize(),r.getImmediate({identifier:n})}},{key:"_removeServiceInstance",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Be;this._delegate.container.getProvider(e).clearInstance(t)}},{key:"_addComponent",value:function(e){He(this._delegate,e)}},{key:"_addOrOverwriteComponent",value:function(e){We(this._delegate,e)}},{key:"toJSON",value:function(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}}}]),e}(),Ct=(c(Tt={},"no-app","No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()"),c(Tt,"invalid-app-argument","firebase.{$appName}() takes either no argument or a Firebase App instance."),Tt),At=new H("app-compat","Firebase",Ct);var Nt=function t(){var n=function(t){var n={},r={__esModule:!0,initializeApp:function(e){var i=nt(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});if(Q(n,i.name))return n[i.name];var a=new t(i,r);return n[i.name]=a,a},app:i,registerVersion:ut,setLogLevel:ct,onLog:st,apps:null,SDK_VERSION:tt,INTERNAL:{registerComponent:function(e){var n=e.name,a=n.replace("-compat","");if(Qe(e)&&"PUBLIC"===e.type){var o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i();if("function"!==typeof e[a])throw At.create("invalid-app-argument",{appName:n});return e[a]()};void 0!==e.serviceProps&&O(o,e.serviceProps),r[a]=o,t.prototype[a]=function(){for(var t=this._getService.bind(this,n),r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return t.apply(this,e.multipleInstances?i:[])}}return"PUBLIC"===e.type?r[a]:null},removeApp:function(e){delete n[e]},useAsService:function(e,t){return"serverAuth"===t?null:t},modularAPIs:e}};function i(e){if(!Q(n,e=e||Be))throw At.create("no-app",{appName:e});return n[e]}return r.default=r,Object.defineProperty(r,"apps",{get:function(){return Object.keys(n).map((function(e){return n[e]}))}}),i.App=t,r}(St);return n.INTERNAL=Object.assign(Object.assign({},n.INTERNAL),{createFirebaseNamespace:t,extendNamespace:function(e){O(n,e)},createSubscribe:te,ErrorFactory:H,deepExtend:O}),n}(),Pt=new ge("@firebase/app-compat");if("object"===typeof self&&self.self===self&&void 0!==self.firebase){Pt.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n ");var Dt=self.firebase.SDK_VERSION;Dt&&Dt.indexOf("LITE")>=0&&Pt.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n ")}var Rt=Nt;!function(e){ut("@firebase/app-compat","0.2.20",e)}();function Ot(){return Ot="undefined"!==typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=T(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ot.apply(this,arguments)}Rt.registerVersion("firebase","10.5.0","app-compat");function Lt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}Object.create;Object.create;"function"===typeof SuppressedError&&SuppressedError;var Mt,Ft={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},Vt="EMAIL_SIGNIN",Ut="PASSWORD_RESET",jt="RECOVER_EMAIL",zt="REVERT_SECOND_FACTOR_ADDITION",Bt="VERIFY_AND_CHANGE_EMAIL",qt="VERIFY_EMAIL";function Kt(e){return void 0!==e&&void 0!==e.getResponse}function Gt(e){return void 0!==e&&void 0!==e.enterprise}var Ht=k((function e(t){if(y(this,e),this.siteKey="",this.emailPasswordEnabled=!1,void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.emailPasswordEnabled=t.recaptchaEnforcementState.some((function(e){return"EMAIL_PASSWORD_PROVIDER"===e.provider&&"OFF"!==e.enforcementState}))}));function Wt(){return c({},"dependent-sdk-initialized-before-auth","Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK.")}var Qt=function(){var e;return c(e={},"admin-restricted-operation","This operation is restricted to administrators only."),c(e,"argument-error",""),c(e,"app-not-authorized","This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console."),c(e,"app-not-installed","The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device."),c(e,"captcha-check-failed","The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains."),c(e,"code-expired","The SMS code has expired. Please re-send the verification code to try again."),c(e,"cordova-not-ready","Cordova framework is not ready."),c(e,"cors-unsupported","This browser is not supported."),c(e,"credential-already-in-use","This credential is already associated with a different user account."),c(e,"custom-token-mismatch","The custom token corresponds to a different audience."),c(e,"requires-recent-login","This operation is sensitive and requires recent authentication. Log in again before retrying this request."),c(e,"dependent-sdk-initialized-before-auth","Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."),c(e,"dynamic-link-not-activated","Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions."),c(e,"email-change-needs-verification","Multi-factor users must always have a verified email."),c(e,"email-already-in-use","The email address is already in use by another account."),c(e,"emulator-config-failed",'Auth instance has already been used to make a network call. Auth can no longer be configured to use the emulator. Try calling "connectAuthEmulator()" sooner.'),c(e,"expired-action-code","The action code has expired."),c(e,"cancelled-popup-request","This operation has been cancelled due to another conflicting popup being opened."),c(e,"internal-error","An internal AuthError has occurred."),c(e,"invalid-app-credential","The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired."),c(e,"invalid-app-id","The mobile app identifier is not registed for the current project."),c(e,"invalid-user-token","This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key."),c(e,"invalid-auth-event","An internal AuthError has occurred."),c(e,"invalid-verification-code","The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user."),c(e,"invalid-continue-uri","The continue URL provided in the request is invalid."),c(e,"invalid-cordova-configuration","The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme."),c(e,"invalid-custom-token","The custom token format is incorrect. Please check the documentation."),c(e,"invalid-dynamic-link-domain","The provided dynamic link domain is not configured or authorized for the current project."),c(e,"invalid-email","The email address is badly formatted."),c(e,"invalid-emulator-scheme","Emulator URL must start with a valid scheme (http:// or https://)."),c(e,"invalid-api-key","Your API key is invalid, please check you have copied it correctly."),c(e,"invalid-cert-hash","The SHA-1 certificate hash provided is invalid."),c(e,"invalid-credential","The supplied auth credential is malformed or has expired."),c(e,"invalid-message-payload","The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console."),c(e,"invalid-multi-factor-session","The request does not contain a valid proof of first factor successful sign-in."),c(e,"invalid-oauth-provider","EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers."),c(e,"invalid-oauth-client-id","The OAuth client ID provided is either invalid or does not match the specified API key."),c(e,"unauthorized-domain","This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console."),c(e,"invalid-action-code","The action code is invalid. This can happen if the code is malformed, expired, or has already been used."),c(e,"wrong-password","The password is invalid or the user does not have a password."),c(e,"invalid-persistence-type","The specified persistence type is invalid. It can only be local, session or none."),c(e,"invalid-phone-number","The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code]."),c(e,"invalid-provider-id","The specified provider ID is invalid."),c(e,"invalid-recipient-email","The email corresponding to this action failed to send as the provided recipient email address is invalid."),c(e,"invalid-sender","The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console."),c(e,"invalid-verification-id","The verification ID used to create the phone auth credential is invalid."),c(e,"invalid-tenant-id","The Auth instance's tenant ID is invalid."),c(e,"login-blocked","Login blocked by user-provided method: {$originalMessage}"),c(e,"missing-android-pkg-name","An Android Package Name must be provided if the Android App is required to be installed."),c(e,"auth-domain-config-required","Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console."),c(e,"missing-app-credential","The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided."),c(e,"missing-verification-code","The phone auth credential was created with an empty SMS verification code."),c(e,"missing-continue-uri","A continue URL must be provided in the request."),c(e,"missing-iframe-start","An internal AuthError has occurred."),c(e,"missing-ios-bundle-id","An iOS Bundle ID must be provided if an App Store ID is provided."),c(e,"missing-or-invalid-nonce","The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload."),c(e,"missing-password","A non-empty password must be provided"),c(e,"missing-multi-factor-info","No second factor identifier is provided."),c(e,"missing-multi-factor-session","The request is missing proof of first factor successful sign-in."),c(e,"missing-phone-number","To send verification codes, provide a phone number for the recipient."),c(e,"missing-verification-id","The phone auth credential was created with an empty verification ID."),c(e,"app-deleted","This instance of FirebaseApp has been deleted."),c(e,"multi-factor-info-not-found","The user does not have a second factor matching the identifier provided."),c(e,"multi-factor-auth-required","Proof of ownership of a second factor is required to complete sign-in."),c(e,"account-exists-with-different-credential","An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address."),c(e,"network-request-failed","A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred."),c(e,"no-auth-event","An internal AuthError has occurred."),c(e,"no-such-provider","User was not linked to an account with the given provider."),c(e,"null-user","A null user object was provided as the argument for an operation which requires a non-null user object."),c(e,"operation-not-allowed","The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section."),c(e,"operation-not-supported-in-this-environment",'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.'),c(e,"popup-blocked","Unable to establish a connection with the popup. It may have been blocked by the browser."),c(e,"popup-closed-by-user","The popup has been closed by the user before finalizing the operation."),c(e,"provider-already-linked","User can only be linked to one identity for the given provider."),c(e,"quota-exceeded","The project's quota for this operation has been exceeded."),c(e,"redirect-cancelled-by-user","The redirect operation has been cancelled by the user before finalizing."),c(e,"redirect-operation-pending","A redirect sign-in operation is already pending."),c(e,"rejected-credential","The request contains malformed or mismatching credentials."),c(e,"second-factor-already-in-use","The second factor is already enrolled on this account."),c(e,"maximum-second-factor-count-exceeded","The maximum allowed number of second factors on a user has been exceeded."),c(e,"tenant-id-mismatch","The provided tenant ID does not match the Auth instance's tenant ID"),c(e,"timeout","The operation has timed out."),c(e,"user-token-expired","The user's credential is no longer valid. The user must sign in again."),c(e,"too-many-requests","We have blocked all requests from this device due to unusual activity. Try again later."),c(e,"unauthorized-continue-uri","The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console."),c(e,"unsupported-first-factor","Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor."),c(e,"unsupported-persistence-type","The current environment does not support the specified persistence type."),c(e,"unsupported-tenant-operation","This operation is not supported in a multi-tenant context."),c(e,"unverified-email","The operation requires a verified email."),c(e,"user-cancelled","The user did not grant your application the permissions it requested."),c(e,"user-not-found","There is no user record corresponding to this identifier. The user may have been deleted."),c(e,"user-disabled","The user account has been disabled by an administrator."),c(e,"user-mismatch","The supplied credentials do not correspond to the previously signed in user."),c(e,"user-signed-out",""),c(e,"weak-password","The password must be 6 characters long or more."),c(e,"web-storage-unsupported","This browser is not supported or 3rd party cookies and data may be disabled."),c(e,"already-initialized","initializeAuth() has already been called with different options. To avoid this error, call initializeAuth() with the same options as when it was originally called, or call getAuth() to return the already initialized instance."),c(e,"missing-recaptcha-token","The reCAPTCHA token is missing when sending request to the backend."),c(e,"invalid-recaptcha-token","The reCAPTCHA token is invalid when sending request to the backend."),c(e,"invalid-recaptcha-action","The reCAPTCHA action is invalid when sending request to the backend."),c(e,"recaptcha-not-enabled","reCAPTCHA Enterprise integration is not enabled for this project."),c(e,"missing-client-type","The reCAPTCHA client type is missing when sending request to the backend."),c(e,"missing-recaptcha-version","The reCAPTCHA version is missing when sending request to the backend."),c(e,"invalid-req-type","Invalid request parameters."),c(e,"invalid-recaptcha-version","The reCAPTCHA version is invalid when sending request to the backend."),c(e,"unsupported-password-policy-schema-version","The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK."),c(e,"password-does-not-meet-requirements","The password does not meet the requirements."),e},Yt=Wt,Jt=new H("auth","Firebase",Wt()),Xt=new ge("@firebase/auth");function $t(e){if(Xt.logLevel<=fe.WARN){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];Xt.warn.apply(Xt,["Auth (".concat(tt,"): ").concat(e)].concat(n))}}function Zt(e){if(Xt.logLevel<=fe.ERROR){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];Xt.error.apply(Xt,["Auth (".concat(tt,"): ").concat(e)].concat(n))}}function en(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw an.apply(void 0,[e].concat(n))}function tn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return an.apply(void 0,[e].concat(n))}function nn(e,t,n){var r=Object.assign(Object.assign({},Yt()),c({},t,n));return new H("auth","Firebase",r).create(t,{appName:e.name})}function rn(e,t,n){if(!(t instanceof n))throw n.name!==t.constructor.name&&en(e,"argument-error"),nn(e,"argument-error","Type of ".concat(t.constructor.name," does not match expected instance.")+"Did you pass a reference from a different Auth SDK?")}function an(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if("string"!==typeof e){var i,a=n[0],o=oe(n.slice(1));return o[0]&&(o[0].appName=e.name),(i=e._errorFactory).create.apply(i,[a].concat(oe(o)))}return Jt.create.apply(Jt,[e].concat(n))}function on(e,t){if(!e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];throw an.apply(void 0,[t].concat(r))}}function un(e){var t="INTERNAL ASSERTION FAILED: "+e;throw Zt(t),new Error(t)}function sn(e,t){e||un(t)}function cn(){var e;return"undefined"!==typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function ln(){return"http:"===fn()||"https:"===fn()}function fn(){var e;return"undefined"!==typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}var hn=function(){function e(t,n){y(this,e),this.shortDelay=t,this.longDelay=n,sn(n>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(U())||B()}return k(e,[{key:"get",value:function(){return"undefined"!==typeof navigator&&navigator&&"onLine"in navigator&&"boolean"===typeof navigator.onLine&&(ln()||z()||"connection"in navigator)&&!navigator.onLine?Math.min(5e3,this.shortDelay):this.isMobile?this.longDelay:this.shortDelay}}]),e}();function dn(e,t){sn(e.emulator,"Emulator should always be set here");var n=e.emulator.url;return t?"".concat(n).concat(t.startsWith("/")?t.slice(1):t):n}var pn=function(){function e(){y(this,e)}return k(e,null,[{key:"initialize",value:function(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}},{key:"fetch",value:function(){return this.fetchImpl?this.fetchImpl:"undefined"!==typeof self&&"fetch"in self?self.fetch:void un("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}},{key:"headers",value:function(){return this.headersImpl?this.headersImpl:"undefined"!==typeof self&&"Headers"in self?self.Headers:void un("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}},{key:"response",value:function(){return this.responseImpl?this.responseImpl:"undefined"!==typeof self&&"Response"in self?self.Response:void un("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}]),e}(),vn=(c(Mt={},"CREDENTIAL_MISMATCH","custom-token-mismatch"),c(Mt,"MISSING_CUSTOM_TOKEN","internal-error"),c(Mt,"INVALID_IDENTIFIER","invalid-email"),c(Mt,"MISSING_CONTINUE_URI","internal-error"),c(Mt,"INVALID_PASSWORD","wrong-password"),c(Mt,"MISSING_PASSWORD","missing-password"),c(Mt,"EMAIL_EXISTS","email-already-in-use"),c(Mt,"PASSWORD_LOGIN_DISABLED","operation-not-allowed"),c(Mt,"INVALID_IDP_RESPONSE","invalid-credential"),c(Mt,"INVALID_PENDING_TOKEN","invalid-credential"),c(Mt,"FEDERATED_USER_ID_ALREADY_LINKED","credential-already-in-use"),c(Mt,"MISSING_REQ_TYPE","internal-error"),c(Mt,"EMAIL_NOT_FOUND","user-not-found"),c(Mt,"RESET_PASSWORD_EXCEED_LIMIT","too-many-requests"),c(Mt,"EXPIRED_OOB_CODE","expired-action-code"),c(Mt,"INVALID_OOB_CODE","invalid-action-code"),c(Mt,"MISSING_OOB_CODE","internal-error"),c(Mt,"CREDENTIAL_TOO_OLD_LOGIN_AGAIN","requires-recent-login"),c(Mt,"INVALID_ID_TOKEN","invalid-user-token"),c(Mt,"TOKEN_EXPIRED","user-token-expired"),c(Mt,"USER_NOT_FOUND","user-token-expired"),c(Mt,"TOO_MANY_ATTEMPTS_TRY_LATER","too-many-requests"),c(Mt,"PASSWORD_DOES_NOT_MEET_REQUIREMENTS","password-does-not-meet-requirements"),c(Mt,"INVALID_CODE","invalid-verification-code"),c(Mt,"INVALID_SESSION_INFO","invalid-verification-id"),c(Mt,"INVALID_TEMPORARY_PROOF","invalid-credential"),c(Mt,"MISSING_SESSION_INFO","missing-verification-id"),c(Mt,"SESSION_EXPIRED","code-expired"),c(Mt,"MISSING_ANDROID_PACKAGE_NAME","missing-android-pkg-name"),c(Mt,"UNAUTHORIZED_DOMAIN","unauthorized-continue-uri"),c(Mt,"INVALID_OAUTH_CLIENT_ID","invalid-oauth-client-id"),c(Mt,"ADMIN_ONLY_OPERATION","admin-restricted-operation"),c(Mt,"INVALID_MFA_PENDING_CREDENTIAL","invalid-multi-factor-session"),c(Mt,"MFA_ENROLLMENT_NOT_FOUND","multi-factor-info-not-found"),c(Mt,"MISSING_MFA_ENROLLMENT_ID","missing-multi-factor-info"),c(Mt,"MISSING_MFA_PENDING_CREDENTIAL","missing-multi-factor-session"),c(Mt,"SECOND_FACTOR_EXISTS","second-factor-already-in-use"),c(Mt,"SECOND_FACTOR_LIMIT_EXCEEDED","maximum-second-factor-count-exceeded"),c(Mt,"BLOCKING_FUNCTION_ERROR_RESPONSE","internal-error"),c(Mt,"RECAPTCHA_NOT_ENABLED","recaptcha-not-enabled"),c(Mt,"MISSING_RECAPTCHA_TOKEN","missing-recaptcha-token"),c(Mt,"INVALID_RECAPTCHA_TOKEN","invalid-recaptcha-token"),c(Mt,"INVALID_RECAPTCHA_ACTION","invalid-recaptcha-action"),c(Mt,"MISSING_CLIENT_TYPE","missing-client-type"),c(Mt,"MISSING_RECAPTCHA_VERSION","missing-recaptcha-version"),c(Mt,"INVALID_RECAPTCHA_VERSION","invalid-recaptcha-version"),c(Mt,"INVALID_REQ_TYPE","invalid-req-type"),Mt),mn=new hn(3e4,6e4);function yn(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}function gn(e,t,n,r){return kn.apply(this,arguments)}function kn(){return kn=u(a().mark((function e(t,n,r,i){var o,s=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=s.length>4&&void 0!==s[4]?s[4]:{},e.abrupt("return",wn(t,o,u(a().mark((function e(){var o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o={},u={},i&&("GET"===n?u=i:o={body:JSON.stringify(i)}),s=$(Object.assign({key:t.config.apiKey},u)).slice(1),e.next=6,t._getAdditionalHeaders();case 6:return(c=e.sent)["Content-Type"]="application/json",t.languageCode&&(c["X-Firebase-Locale"]=t.languageCode),e.abrupt("return",pn.fetch()(Tn(t,t.config.apiHost,r,s),Object.assign({method:n,headers:c,referrerPolicy:"no-referrer"},o)));case 10:case"end":return e.stop()}}),e)})))));case 2:case"end":return e.stop()}}),e)}))),kn.apply(this,arguments)}function wn(e,t,n){return bn.apply(this,arguments)}function bn(){return(bn=u(a().mark((function e(t,n,r){var i,o,u,s,c,l,f,h,d,p;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t._canInitEmulator=!1,i=Object.assign(Object.assign({},vn),n),e.prev=2,o=new In(t),e.next=6,Promise.race([r(),o.promise]);case 6:return u=e.sent,o.clearNetworkTimeout(),e.next=10,u.json();case 10:if(!("needConfirmation"in(s=e.sent))){e.next=13;break}throw En(t,"account-exists-with-different-credential",s);case 13:if(!u.ok||"errorMessage"in s){e.next=17;break}return e.abrupt("return",s);case 17:if(c=u.ok?s.errorMessage:s.error.message,l=c.split(" : "),f=m(l,2),h=f[0],d=f[1],"FEDERATED_USER_ID_ALREADY_LINKED"!==h){e.next=23;break}throw En(t,"credential-already-in-use",s);case 23:if("EMAIL_EXISTS"!==h){e.next=27;break}throw En(t,"email-already-in-use",s);case 27:if("USER_DISABLED"!==h){e.next=29;break}throw En(t,"user-disabled",s);case 29:if(p=i[h]||h.toLowerCase().replace(/[_\s]+/g,"-"),!d){e.next=34;break}throw nn(t,p,d);case 34:en(t,p);case 35:e.next=42;break;case 37:if(e.prev=37,e.t0=e.catch(2),!(e.t0 instanceof G)){e.next=41;break}throw e.t0;case 41:en(t,"network-request-failed",{message:String(e.t0)});case 42:case"end":return e.stop()}}),e,null,[[2,37]])})))).apply(this,arguments)}function _n(e,t,n,r){return xn.apply(this,arguments)}function xn(){return xn=u(a().mark((function e(t,n,r,i){var o,u,s=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=s.length>4&&void 0!==s[4]?s[4]:{},e.next=3,gn(t,n,r,i,o);case 3:return"mfaPendingCredential"in(u=e.sent)&&en(t,"multi-factor-auth-required",{_serverResponse:u}),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e)}))),xn.apply(this,arguments)}function Tn(e,t,n,r){var i="".concat(t).concat(n,"?").concat(r);return e.config.emulator?dn(e.config,i):"".concat(e.config.apiScheme,"://").concat(i)}var In=function(){function e(t){var n=this;y(this,e),this.auth=t,this.timer=null,this.promise=new Promise((function(e,t){n.timer=setTimeout((function(){return t(tn(n.auth,"network-request-failed"))}),mn.get())}))}return k(e,[{key:"clearNetworkTimeout",value:function(){clearTimeout(this.timer)}}]),e}();function En(e,t,n){var r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);var i=tn(e,t,r);return i.customData._tokenResponse=n,i}function Sn(e){return Cn.apply(this,arguments)}function Cn(){return(Cn=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,gn(t,"GET","/v1/recaptchaParams");case 2:if(e.t0=e.sent.recaptchaSiteKey,e.t0){e.next=5;break}e.t0="";case 5:return e.abrupt("return",e.t0);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function An(e,t){return Nn.apply(this,arguments)}function Nn(){return(Nn=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gn(t,"GET","/v2/recaptchaConfig",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pn(e,t){return Dn.apply(this,arguments)}function Dn(){return(Dn=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gn(t,"POST","/v1/accounts:delete",n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rn(e,t){return On.apply(this,arguments)}function On(){return(On=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gn(t,"POST","/v1/accounts:update",n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ln(e,t){return Mn.apply(this,arguments)}function Mn(){return(Mn=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gn(t,"POST","/v1/accounts:lookup",n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fn(e){if(e)try{var t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(n){}}function Vn(){return Vn=u(a().mark((function e(t){var n,r,i,o,u,s,c=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>1&&void 0!==c[1]&&c[1],r=ie(t),e.next=4,r.getIdToken(n);case 4:return i=e.sent,on((o=jn(i))&&o.exp&&o.auth_time&&o.iat,r.auth,"internal-error"),u="object"===typeof o.firebase?o.firebase:void 0,s=null===u||void 0===u?void 0:u.sign_in_provider,e.abrupt("return",{claims:o,token:i,authTime:Fn(Un(o.auth_time)),issuedAtTime:Fn(Un(o.iat)),expirationTime:Fn(Un(o.exp)),signInProvider:s||null,signInSecondFactor:(null===u||void 0===u?void 0:u.sign_in_second_factor)||null});case 10:case"end":return e.stop()}}),e)}))),Vn.apply(this,arguments)}function Un(e){return 1e3*Number(e)}function jn(e){var t=m(e.split("."),3),n=t[0],r=t[1],i=t[2];if(void 0===n||void 0===r||void 0===i)return Zt("JWT malformed, contained fewer than 3 sections"),null;try{var a=R(r);return a?JSON.parse(a):(Zt("Failed to decode base64 JWT payload"),null)}catch(o){return Zt("Caught error parsing JWT payload as JSON",null===o||void 0===o?void 0:o.toString()),null}}function zn(e,t){return Bn.apply(this,arguments)}function Bn(){return Bn=u(a().mark((function e(t,n){var r=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r.length>2&&void 0!==r[2]&&r[2])){e.next=3;break}return e.abrupt("return",n);case 3:return e.prev=3,e.next=6,n;case 6:return e.abrupt("return",e.sent);case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof G&&qn(e.t0))){e.next=15;break}if(t.auth.currentUser!==t){e.next=15;break}return e.next=15,t.auth.signOut();case 15:throw e.t0;case 16:case"end":return e.stop()}}),e,null,[[3,9]])}))),Bn.apply(this,arguments)}function qn(e){var t=e.code;return t==="auth/".concat("user-disabled")||t==="auth/".concat("user-token-expired")}var Kn=function(){function e(t){y(this,e),this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}return k(e,[{key:"_start",value:function(){this.isRunning||(this.isRunning=!0,this.schedule())}},{key:"_stop",value:function(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}},{key:"getInterval",value:function(e){var t;if(e){var n=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),n}this.errorBackoff=3e4;var r=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,r)}},{key:"schedule",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isRunning){var n=this.getInterval(t);this.timerId=setTimeout(u(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.iteration();case 2:case"end":return t.stop()}}),t)}))),n)}}},{key:"iteration",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.user.getIdToken(!0);case 3:e.next=9;break;case 5:return e.prev=5,e.t0=e.catch(0),(null===e.t0||void 0===e.t0?void 0:e.t0.code)==="auth/".concat("network-request-failed")&&this.schedule(!0),e.abrupt("return");case 9:this.schedule();case 10:case"end":return e.stop()}}),e,this,[[0,5]])})));return function(){return e.apply(this,arguments)}}()}]),e}(),Gn=function(){function e(t,n){y(this,e),this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}return k(e,[{key:"_initializeTime",value:function(){this.lastSignInTime=Fn(this.lastLoginAt),this.creationTime=Fn(this.createdAt)}},{key:"_copy",value:function(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}},{key:"toJSON",value:function(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}]),e}();function Hn(e){return Wn.apply(this,arguments)}function Wn(){return(Wn=u(a().mark((function e(t){var n,r,i,o,u,s,c,l,f,h,d;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.auth,e.next=3,t.getIdToken();case 3:return i=e.sent,e.next=6,zn(t,Ln(r,{idToken:i}));case 6:on(null===(o=e.sent)||void 0===o?void 0:o.users.length,r,"internal-error"),u=o.users[0],t._notifyReloadListener(u),s=(null===(n=u.providerUserInfo)||void 0===n?void 0:n.length)?u.providerUserInfo.map((function(e){var t=e.providerId,n=Lt(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[],c=Yn(t.providerData,s),l=t.isAnonymous,f=!(t.email&&u.passwordHash)&&!(null===c||void 0===c?void 0:c.length),h=!!l&&f,d={uid:u.localId,displayName:u.displayName||null,photoURL:u.photoUrl||null,email:u.email||null,emailVerified:u.emailVerified||!1,phoneNumber:u.phoneNumber||null,tenantId:u.tenantId||null,providerData:c,metadata:new Gn(u.createdAt,u.lastLoginAt),isAnonymous:h},Object.assign(t,d);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qn(){return(Qn=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=ie(t),e.next=3,Hn(n);case 3:return e.next=5,n.auth._persistUserIfCurrent(n);case 5:n.auth._notifyListenersIfCurrent(n);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Yn(e,t){var n=e.filter((function(e){return!t.some((function(t){return t.providerId===e.providerId}))}));return[].concat(oe(n),oe(t))}function Jn(e,t){return Xn.apply(this,arguments)}function Xn(){return(Xn=u(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,wn(t,{},u(a().mark((function e(){var r,i,o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=$({grant_type:"refresh_token",refresh_token:n}).slice(1),i=t.config,o=i.tokenApiHost,u=i.apiKey,s=Tn(t,o,"/v1/token","key=".concat(u)),e.next=5,t._getAdditionalHeaders();case 5:return(c=e.sent)["Content-Type"]="application/x-www-form-urlencoded",e.abrupt("return",pn.fetch()(s,{method:"POST",headers:c,body:r}));case 8:case"end":return e.stop()}}),e)}))));case 2:return r=e.sent,e.abrupt("return",{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var $n=function(){function e(){y(this,e),this.refreshToken=null,this.accessToken=null,this.expirationTime=null}return k(e,[{key:"isExpired",get:function(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}},{key:"updateFromServerResponse",value:function(e){on(e.idToken,"internal-error"),on("undefined"!==typeof e.idToken,"internal-error"),on("undefined"!==typeof e.refreshToken,"internal-error");var t="expiresIn"in e&&"undefined"!==typeof e.expiresIn?Number(e.expiresIn):function(e){var t=jn(e);return on(t,"internal-error"),on("undefined"!==typeof t.exp,"internal-error"),on("undefined"!==typeof t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}},{key:"getToken",value:function(){var e=u(a().mark((function e(t){var n,r=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.length>1&&void 0!==r[1]&&r[1],on(!this.accessToken||this.refreshToken,t,"user-token-expired"),n||!this.accessToken||this.isExpired){e.next=4;break}return e.abrupt("return",this.accessToken);case 4:if(!this.refreshToken){e.next=8;break}return e.next=7,this.refresh(t,this.refreshToken);case 7:return e.abrupt("return",this.accessToken);case 8:return e.abrupt("return",null);case 9:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"clearRefreshToken",value:function(){this.refreshToken=null}},{key:"refresh",value:function(){var e=u(a().mark((function e(t,n){var r,i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Jn(t,n);case 2:r=e.sent,i=r.accessToken,o=r.refreshToken,u=r.expiresIn,this.updateTokensAndExpiration(i,o,Number(u));case 7:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"updateTokensAndExpiration",value:function(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}},{key:"toJSON",value:function(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}},{key:"_assign",value:function(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}},{key:"_clone",value:function(){return Object.assign(new e,this.toJSON())}},{key:"_performRefresh",value:function(){return un("not implemented")}}],[{key:"fromJSON",value:function(t,n){var r=n.refreshToken,i=n.accessToken,a=n.expirationTime,o=new e;return r&&(on("string"===typeof r,"internal-error",{appName:t}),o.refreshToken=r),i&&(on("string"===typeof i,"internal-error",{appName:t}),o.accessToken=i),a&&(on("number"===typeof a,"internal-error",{appName:t}),o.expirationTime=a),o}}]),e}();function Zn(e,t){on("string"===typeof e||"undefined"===typeof e,"internal-error",{appName:t})}var er=function(){function e(t){y(this,e);var n=t.uid,r=t.auth,i=t.stsTokenManager,a=Lt(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Kn(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=a.displayName||null,this.email=a.email||null,this.emailVerified=a.emailVerified||!1,this.phoneNumber=a.phoneNumber||null,this.photoURL=a.photoURL||null,this.isAnonymous=a.isAnonymous||!1,this.tenantId=a.tenantId||null,this.providerData=a.providerData?oe(a.providerData):[],this.metadata=new Gn(a.createdAt||void 0,a.lastLoginAt||void 0)}return k(e,[{key:"getIdToken",value:function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,zn(this,this.stsTokenManager.getToken(this.auth,t));case 2:if(on(n=e.sent,this.auth,"internal-error"),this.accessToken===n){e.next=9;break}return this.accessToken=n,e.next=8,this.auth._persistUserIfCurrent(this);case 8:this.auth._notifyListenersIfCurrent(this);case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"getIdTokenResult",value:function(e){return function(e){return Vn.apply(this,arguments)}(this,e)}},{key:"reload",value:function(){return function(e){return Qn.apply(this,arguments)}(this)}},{key:"_assign",value:function(e){this!==e&&(on(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map((function(e){return Object.assign({},e)})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}},{key:"_clone",value:function(t){var n=new e(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}},{key:"_onReload",value:function(e){on(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}},{key:"_notifyReloadListener",value:function(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}},{key:"_startProactiveRefresh",value:function(){this.proactiveRefresh._start()}},{key:"_stopProactiveRefresh",value:function(){this.proactiveRefresh._stop()}},{key:"_updateTokensIfNecessary",value:function(){var e=u(a().mark((function e(t){var n,r,i=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>1&&void 0!==i[1]&&i[1],r=!1,t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),r=!0),!n){e.next=6;break}return e.next=6,Hn(this);case 6:return e.next=8,this.auth._persistUserIfCurrent(this);case 8:r&&this.auth._notifyListenersIfCurrent(this);case 9:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"delete",value:function(){var e=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getIdToken();case 2:return t=e.sent,e.next=5,zn(this,Pn(this.auth,{idToken:t}));case 5:return this.stsTokenManager.clearRefreshToken(),e.abrupt("return",this.auth.signOut());case 7:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"toJSON",value:function(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((function(e){return Object.assign({},e)})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}},{key:"refreshToken",get:function(){return this.stsTokenManager.refreshToken||""}}],[{key:"_fromJSON",value:function(t,n){var r,i,a,o,u,s,c,l,f=null!==(r=n.displayName)&&void 0!==r?r:void 0,h=null!==(i=n.email)&&void 0!==i?i:void 0,d=null!==(a=n.phoneNumber)&&void 0!==a?a:void 0,p=null!==(o=n.photoURL)&&void 0!==o?o:void 0,v=null!==(u=n.tenantId)&&void 0!==u?u:void 0,m=null!==(s=n._redirectEventId)&&void 0!==s?s:void 0,y=null!==(c=n.createdAt)&&void 0!==c?c:void 0,g=null!==(l=n.lastLoginAt)&&void 0!==l?l:void 0,k=n.uid,w=n.emailVerified,b=n.isAnonymous,_=n.providerData,x=n.stsTokenManager;on(k&&x,t,"internal-error");var T=$n.fromJSON(this.name,x);on("string"===typeof k,t,"internal-error"),Zn(f,t.name),Zn(h,t.name),on("boolean"===typeof w,t,"internal-error"),on("boolean"===typeof b,t,"internal-error"),Zn(d,t.name),Zn(p,t.name),Zn(v,t.name),Zn(m,t.name),Zn(y,t.name),Zn(g,t.name);var I=new e({uid:k,auth:t,email:h,emailVerified:w,displayName:f,isAnonymous:b,photoURL:p,phoneNumber:d,tenantId:v,stsTokenManager:T,createdAt:y,lastLoginAt:g});return _&&Array.isArray(_)&&(I.providerData=_.map((function(e){return Object.assign({},e)}))),m&&(I._redirectEventId=m),I}},{key:"_fromIdTokenResponse",value:function(){var t=u(a().mark((function t(n,r){var i,o,u,s=arguments;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]&&s[2],(o=new $n).updateFromServerResponse(r),u=new e({uid:r.localId,auth:n,stsTokenManager:o,isAnonymous:i}),t.next=6,Hn(u);case 6:return t.abrupt("return",u);case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()}]),e}(),tr=new Map;function nr(e){sn(e instanceof Function,"Expected a class definition");var t=tr.get(e);return t?(sn(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,tr.set(e,t),t)}var rr=function(){function e(){y(this,e),this.type="NONE",this.storage={}}return k(e,[{key:"_isAvailable",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",!0);case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"_set",value:function(){var e=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.storage[t]=n;case 1:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"_get",value:function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.storage[t],e.abrupt("return",void 0===n?null:n);case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_remove",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete this.storage[t];case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_addListener",value:function(e,t){}},{key:"_removeListener",value:function(e,t){}}]),e}();rr.type="NONE";var ir=rr;function ar(e,t,n){return"firebase".concat(":",e,":").concat(t,":").concat(n)}var or=function(){function e(t,n,r){y(this,e),this.persistence=t,this.auth=n,this.userKey=r;var i=this.auth,a=i.config,o=i.name;this.fullUserKey=ar(this.userKey,a.apiKey,o),this.fullPersistenceKey=ar("persistence",a.apiKey,o),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}return k(e,[{key:"setCurrentUser",value:function(e){return this.persistence._set(this.fullUserKey,e.toJSON())}},{key:"getCurrentUser",value:function(){var e=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.persistence._get(this.fullUserKey);case 2:return t=e.sent,e.abrupt("return",t?er._fromJSON(this.auth,t):null);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"removeCurrentUser",value:function(){return this.persistence._remove(this.fullUserKey)}},{key:"savePersistenceForRedirect",value:function(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}},{key:"setPersistence",value:function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.persistence!==t){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.getCurrentUser();case 4:return n=e.sent,e.next=7,this.removeCurrentUser();case 7:if(this.persistence=t,!n){e.next=10;break}return e.abrupt("return",this.setCurrentUser(n));case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"delete",value:function(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}}],[{key:"create",value:function(){var t=u(a().mark((function t(n,r){var i,o,s,c,l,f,h,d,p,v,m,y=arguments;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=y.length>2&&void 0!==y[2]?y[2]:"authUser",r.length){t.next=3;break}return t.abrupt("return",new e(nr(ir),n,i));case 3:return t.next=5,Promise.all(r.map(function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t._isAvailable();case 2:if(!e.sent){e.next=4;break}return e.abrupt("return",t);case 4:return e.abrupt("return",void 0);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 5:o=t.sent.filter((function(e){return e})),s=o[0]||nr(ir),c=ar(i,n.config.apiKey,n.name),l=null,f=w(r),t.prev=10,f.s();case 12:if((h=f.n()).done){t.next=29;break}return d=h.value,t.prev=14,t.next=17,d._get(c);case 17:if(!(p=t.sent)){t.next=23;break}return v=er._fromJSON(n,p),d!==s&&(l=v),s=d,t.abrupt("break",29);case 23:t.next=27;break;case 25:t.prev=25,t.t0=t.catch(14);case 27:t.next=12;break;case 29:t.next=34;break;case 31:t.prev=31,t.t1=t.catch(10),f.e(t.t1);case 34:return t.prev=34,f.f(),t.finish(34);case 37:if(m=o.filter((function(e){return e._shouldAllowMigration})),s._shouldAllowMigration&&m.length){t.next=40;break}return t.abrupt("return",new e(s,n,i));case 40:if(s=m[0],!l){t.next=44;break}return t.next=44,s._set(c,l.toJSON());case 44:return t.next=46,Promise.all(r.map(function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t===s){e.next=8;break}return e.prev=1,e.next=4,t._remove(c);case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(t){return e.apply(this,arguments)}}()));case 46:return t.abrupt("return",new e(s,n,i));case 47:case"end":return t.stop()}}),t,null,[[10,31,34,37],[14,25]])})));return function(e,n){return t.apply(this,arguments)}}()}]),e}();function ur(e){var t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(fr(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(sr(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(dr(t))return"Blackberry";if(pr(t))return"Webos";if(cr(t))return"Safari";if((t.includes("chrome/")||lr(t))&&!t.includes("edge/"))return"Chrome";if(hr(t))return"Android";var n=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);return 2===(null===n||void 0===n?void 0:n.length)?n[1]:"Other"}function sr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return/firefox\//i.test(e)}function cr(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:U()).toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function lr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return/crios\//i.test(e)}function fr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return/iemobile/i.test(e)}function hr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return/android/i.test(e)}function dr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return/blackberry/i.test(e)}function pr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return/webos/i.test(e)}function vr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function mr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return vr(e)||hr(e)||pr(e)||dr(e)||/windows phone/i.test(e)||fr(e)}function yr(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];switch(e){case"Browser":t=ur(U());break;case"Worker":t="".concat(ur(U()),"-").concat(e);break;default:t=e}var r=n.length?n.join(","):"FirebaseCore-web";return"".concat(t,"/","JsCore","/").concat(tt,"/").concat(r)}var gr=function(){function e(t){y(this,e),this.auth=t,this.queue=[]}return k(e,[{key:"pushCallback",value:function(e,t){var n=this,r=function(t){return new Promise((function(n,r){try{n(e(t))}catch(i){r(i)}}))};r.onAbort=t,this.queue.push(r);var i=this.queue.length-1;return function(){n.queue[i]=function(){return Promise.resolve()}}}},{key:"runMiddleware",value:function(){var e=u(a().mark((function e(t){var n,r,i,o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.auth.currentUser!==t){e.next=2;break}return e.abrupt("return");case 2:n=[],e.prev=3,r=w(this.queue),e.prev=5,r.s();case 7:if((i=r.n()).done){e.next=14;break}return o=i.value,e.next=11,o(t);case 11:o.onAbort&&n.push(o.onAbort);case 12:e.next=7;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(5),r.e(e.t0);case 19:return e.prev=19,r.f(),e.finish(19);case 22:e.next=30;break;case 24:e.prev=24,e.t1=e.catch(3),n.reverse(),u=w(n);try{for(u.s();!(s=u.n()).done;){c=s.value;try{c()}catch(a){}}}catch(l){u.e(l)}finally{u.f()}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===e.t1||void 0===e.t1?void 0:e.t1.message});case 30:case"end":return e.stop()}}),e,this,[[3,24],[5,16,19,22]])})));return function(t){return e.apply(this,arguments)}}()}]),e}();function kr(e){return wr.apply(this,arguments)}function wr(){return wr=u(a().mark((function e(t){var n,r=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},e.abrupt("return",gn(t,"GET","/v2/passwordPolicy",yn(t,n)));case 2:case"end":return e.stop()}}),e)}))),wr.apply(this,arguments)}var br=function(){function e(t){var n,r,i,a;y(this,e);var o=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(n=o.minPasswordLength)&&void 0!==n?n:6,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),void 0!==o.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),void 0!==o.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),void 0!==o.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),void 0!==o.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(r=t.allowedNonAlphanumericCharacters)||void 0===r?void 0:r.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(a=t.forceUpgradeOnSignin)&&void 0!==a&&a,this.schemaVersion=t.schemaVersion}return k(e,[{key:"validatePassword",value:function(e){var t,n,r,i,a,o,u={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,u),this.validatePasswordCharacterOptions(e,u),u.isValid&&(u.isValid=null===(t=u.meetsMinPasswordLength)||void 0===t||t),u.isValid&&(u.isValid=null===(n=u.meetsMaxPasswordLength)||void 0===n||n),u.isValid&&(u.isValid=null===(r=u.containsLowercaseLetter)||void 0===r||r),u.isValid&&(u.isValid=null===(i=u.containsUppercaseLetter)||void 0===i||i),u.isValid&&(u.isValid=null===(a=u.containsNumericCharacter)||void 0===a||a),u.isValid&&(u.isValid=null===(o=u.containsNonAlphanumericCharacter)||void 0===o||o),u}},{key:"validatePasswordLengthOptions",value:function(e,t){var n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}},{key:"validatePasswordCharacterOptions",value:function(e,t){var n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(var r=0;r<e.length;r++)n=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}},{key:"updatePasswordCharacterOptionsStatuses",value:function(e,t,n,r,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}]),e}(),_r=function(){function e(t,n,r,i){y(this,e),this.app=t,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Tr(this),this.idTokenSubscription=new Tr(this),this.beforeStateQueue=new gr(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Jt,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=i.sdkClientVersion}return k(e,[{key:"_initializeWithPersistence",value:function(e,t){var n=this;return t&&(this._popupRedirectResolver=nr(t)),this._initializationPromise=this.queue(u(a().mark((function r(){var i,o;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._deleted){r.next=2;break}return r.abrupt("return");case 2:return r.next=4,or.create(n,e);case 4:if(n.persistenceManager=r.sent,!n._deleted){r.next=7;break}return r.abrupt("return");case 7:if(!(null===(i=n._popupRedirectResolver)||void 0===i?void 0:i._shouldInitProactively)){r.next=15;break}return r.prev=8,r.next=11,n._popupRedirectResolver._initialize(n);case 11:r.next=15;break;case 13:r.prev=13,r.t0=r.catch(8);case 15:return r.next=17,n.initializeCurrentUser(t);case 17:if(n.lastNotifiedUid=(null===(o=n.currentUser)||void 0===o?void 0:o.uid)||null,!n._deleted){r.next=20;break}return r.abrupt("return");case 20:n._isInitialized=!0;case 21:case"end":return r.stop()}}),r,null,[[8,13]])})))),this._initializationPromise}},{key:"_onStorageEvent",value:function(){var e=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._deleted){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.assertedPersistence.getCurrentUser();case 4:if(t=e.sent,this.currentUser||t){e.next=7;break}return e.abrupt("return");case 7:if(!this.currentUser||!t||this.currentUser.uid!==t.uid){e.next=12;break}return this._currentUser._assign(t),e.next=11,this.currentUser.getIdToken();case 11:return e.abrupt("return");case 12:return e.next=14,this._updateCurrentUser(t,!0);case 14:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"initializeCurrentUser",value:function(){var e=u(a().mark((function e(t){var n,r,i,o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.assertedPersistence.getCurrentUser();case 2:if(r=e.sent,i=r,o=!1,!t||!this.config.authDomain){e.next=14;break}return e.next=8,this.getOrInitRedirectPersistenceManager();case 8:return u=null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId,s=null===i||void 0===i?void 0:i._redirectEventId,e.next=12,this.tryRedirectSignIn(t);case 12:c=e.sent,u&&u!==s||!(null===c||void 0===c?void 0:c.user)||(i=c.user,o=!0);case 14:if(i){e.next=16;break}return e.abrupt("return",this.directlySetCurrentUser(null));case 16:if(i._redirectEventId){e.next=32;break}if(!o){e.next=27;break}return e.prev=18,e.next=21,this.beforeStateQueue.runMiddleware(i);case 21:e.next=27;break;case 23:e.prev=23,e.t0=e.catch(18),i=r,this._popupRedirectResolver._overrideRedirectResult(this,(function(){return Promise.reject(e.t0)}));case 27:if(!i){e.next=31;break}return e.abrupt("return",this.reloadAndSetCurrentUserOrClear(i));case 31:return e.abrupt("return",this.directlySetCurrentUser(null));case 32:return on(this._popupRedirectResolver,this,"argument-error"),e.next=35,this.getOrInitRedirectPersistenceManager();case 35:if(!this.redirectUser||this.redirectUser._redirectEventId!==i._redirectEventId){e.next=37;break}return e.abrupt("return",this.directlySetCurrentUser(i));case 37:return e.abrupt("return",this.reloadAndSetCurrentUserOrClear(i));case 38:case"end":return e.stop()}}),e,this,[[18,23]])})));return function(t){return e.apply(this,arguments)}}()},{key:"tryRedirectSignIn",value:function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null,e.prev=1,e.next=4,this._popupRedirectResolver._completeRedirectFn(this,t,!0);case 4:n=e.sent,e.next=11;break;case 7:return e.prev=7,e.t0=e.catch(1),e.next=11,this._setRedirectUser(null);case 11:return e.abrupt("return",n);case 12:case"end":return e.stop()}}),e,this,[[1,7]])})));return function(t){return e.apply(this,arguments)}}()},{key:"reloadAndSetCurrentUserOrClear",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Hn(t);case 3:e.next=9;break;case 5:if(e.prev=5,e.t0=e.catch(0),(null===e.t0||void 0===e.t0?void 0:e.t0.code)==="auth/".concat("network-request-failed")){e.next=9;break}return e.abrupt("return",this.directlySetCurrentUser(null));case 9:return e.abrupt("return",this.directlySetCurrentUser(t));case 10:case"end":return e.stop()}}),e,this,[[0,5]])})));return function(t){return e.apply(this,arguments)}}()},{key:"useDeviceLanguage",value:function(){this.languageCode=function(){if("undefined"===typeof navigator)return null;var e=navigator;return e.languages&&e.languages[0]||e.language||null}()}},{key:"_delete",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._deleted=!0;case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"updateCurrentUser",value:function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t?ie(t):null)&&on(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),e.abrupt("return",this._updateCurrentUser(n&&n._clone(this)));case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_updateCurrentUser",value:function(){var e=u(a().mark((function e(t){var n,r=this,i=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>1&&void 0!==i[1]&&i[1],!this._deleted){e.next=3;break}return e.abrupt("return");case 3:if(t&&on(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),n){e.next=7;break}return e.next=7,this.beforeStateQueue.runMiddleware(t);case 7:return e.abrupt("return",this.queue(u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.directlySetCurrentUser(t);case 2:r.notifyAuthListeners();case 3:case"end":return e.stop()}}),e)})))));case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"signOut",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.beforeStateQueue.runMiddleware(null);case 2:if(!this.redirectPersistenceManager&&!this._popupRedirectResolver){e.next=5;break}return e.next=5,this._setRedirectUser(null);case 5:return e.abrupt("return",this._updateCurrentUser(null,!0));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"setPersistence",value:function(e){var t=this;return this.queue(u(a().mark((function n(){return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.assertedPersistence.setPersistence(nr(e));case 2:case"end":return n.stop()}}),n)}))))}},{key:"_getRecaptchaConfig",value:function(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}},{key:"validatePassword",value:function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._getPasswordPolicyInternal()){e.next=3;break}return e.next=3,this._updatePasswordPolicy();case 3:if((n=this._getPasswordPolicyInternal()).schemaVersion===this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION){e.next=6;break}return e.abrupt("return",Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})));case 6:return e.abrupt("return",n.validatePassword(t));case 7:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_getPasswordPolicyInternal",value:function(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}},{key:"_updatePasswordPolicy",value:function(){var e=u(a().mark((function e(){var t,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,kr(this);case 2:t=e.sent,n=new br(t),null===this.tenantId?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n;case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"_getPersistence",value:function(){return this.assertedPersistence.persistence.type}},{key:"_updateErrorMap",value:function(e){this._errorFactory=new H("auth","Firebase",e())}},{key:"onAuthStateChanged",value:function(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}},{key:"beforeAuthStateChanged",value:function(e,t){return this.beforeStateQueue.pushCallback(e,t)}},{key:"onIdTokenChanged",value:function(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}},{key:"authStateReady",value:function(){var e=this;return new Promise((function(t,n){if(e.currentUser)t();else var r=e.onAuthStateChanged((function(){r(),t()}),n)}))}},{key:"toJSON",value:function(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}},{key:"_setRedirectUser",value:function(){var e=u(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getOrInitRedirectPersistenceManager(n);case 2:return r=e.sent,e.abrupt("return",null===t?r.removeCurrentUser():r.setCurrentUser(t));case 4:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"getOrInitRedirectPersistenceManager",value:function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.redirectPersistenceManager){e.next=9;break}return on(n=t&&nr(t)||this._popupRedirectResolver,this,"argument-error"),e.next=5,or.create(this,[nr(n._redirectPersistence)],"redirectUser");case 5:return this.redirectPersistenceManager=e.sent,e.next=8,this.redirectPersistenceManager.getCurrentUser();case 8:this.redirectUser=e.sent;case 9:return e.abrupt("return",this.redirectPersistenceManager);case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_redirectUserForId",value:function(){var e=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isInitialized){e.next=3;break}return e.next=3,this.queue(u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))));case 3:if((null===(n=this._currentUser)||void 0===n?void 0:n._redirectEventId)!==t){e.next=5;break}return e.abrupt("return",this._currentUser);case 5:if((null===(r=this.redirectUser)||void 0===r?void 0:r._redirectEventId)!==t){e.next=7;break}return e.abrupt("return",this.redirectUser);case 7:return e.abrupt("return",null);case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_persistUserIfCurrent",value:function(){var e=u(a().mark((function e(t){var n=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t!==this.currentUser){e.next=2;break}return e.abrupt("return",this.queue(u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.directlySetCurrentUser(t));case 1:case"end":return e.stop()}}),e)})))));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_notifyListenersIfCurrent",value:function(e){e===this.currentUser&&this.notifyAuthListeners()}},{key:"_key",value:function(){return"".concat(this.config.authDomain,":").concat(this.config.apiKey,":").concat(this.name)}},{key:"_startProactiveRefresh",value:function(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}},{key:"_stopProactiveRefresh",value:function(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}},{key:"_currentUser",get:function(){return this.currentUser}},{key:"notifyAuthListeners",value:function(){var e,t;if(this._isInitialized){this.idTokenSubscription.next(this.currentUser);var n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}}},{key:"registerStateListener",value:function(e,t,n,r){var i=this;if(this._deleted)return function(){};var a="function"===typeof t?t:t.next.bind(t),o=!1,u=this._isInitialized?Promise.resolve():this._initializationPromise;if(on(u,this,"internal-error"),u.then((function(){o||a(i.currentUser)})),"function"===typeof t){var s=e.addObserver(t,n,r);return function(){o=!0,s()}}var c=e.addObserver(t);return function(){o=!0,c()}}},{key:"directlySetCurrentUser",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,!t){e.next=8;break}return e.next=6,this.assertedPersistence.setCurrentUser(t);case 6:e.next=10;break;case 8:return e.next=10,this.assertedPersistence.removeCurrentUser();case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"queue",value:function(e){return this.operations=this.operations.then(e,e),this.operations}},{key:"assertedPersistence",get:function(){return on(this.persistenceManager,this,"internal-error"),this.persistenceManager}},{key:"_logFramework",value:function(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=yr(this.config.clientPlatform,this._getFrameworks()))}},{key:"_getFrameworks",value:function(){return this.frameworks}},{key:"_getAdditionalHeaders",value:function(){var e=u(a().mark((function e(){var t,n,r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=c({},"X-Client-Version",this.clientVersion),this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId),e.next=4,null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader();case 4:return(r=e.sent)&&(n["X-Firebase-Client"]=r),e.next=8,this._getAppCheckToken();case 8:return(i=e.sent)&&(n["X-Firebase-AppCheck"]=i),e.abrupt("return",n);case 11:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"_getAppCheckToken",value:function(){var e=u(a().mark((function e(){var t,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken();case 2:return(null===(n=e.sent)||void 0===n?void 0:n.error)&&$t("Error while retrieving App Check token: ".concat(n.error)),e.abrupt("return",null===n||void 0===n?void 0:n.token);case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()}]),e}();function xr(e){return ie(e)}var Tr=function(){function e(t){var n=this;y(this,e),this.auth=t,this.observer=null,this.addObserver=te((function(e){return n.observer=e}))}return k(e,[{key:"next",get:function(){return on(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}]),e}();function Ir(e){return new Promise((function(t,n){var r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=function(e){var t=tn("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",function(){var e,t;return null!==(t=null===(e=document.getElementsByTagName("head"))||void 0===e?void 0:e[0])&&void 0!==t?t:document}().appendChild(r)}))}function Er(e){return"__".concat(e).concat(Math.floor(1e6*Math.random()))}var Sr=function(){function e(t){y(this,e),this.type="recaptcha-enterprise",this.auth=xr(t)}return k(e,[{key:"verify",value:function(){var e=u(a().mark((function e(){var t,n,r,i,o,s=this,c=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(e,n,r){var i=window.grecaptcha;Gt(i)?i.enterprise.ready((function(){i.enterprise.execute(e,{action:t}).then((function(e){n(e)})).catch((function(){n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))},i=function(){return i=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=5;break}if(null!=t.tenantId||null==t._agentRecaptchaConfig){e.next=3;break}return e.abrupt("return",t._agentRecaptchaConfig.siteKey);case 3:if(null==t.tenantId||void 0===t._tenantRecaptchaConfigs[t.tenantId]){e.next=5;break}return e.abrupt("return",t._tenantRecaptchaConfigs[t.tenantId].siteKey);case 5:return e.abrupt("return",new Promise(function(){var e=u(a().mark((function e(n,r){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:An(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((function(e){if(void 0!==e.recaptchaKey){var i=new Ht(e);return null==t.tenantId?t._agentRecaptchaConfig=i:t._tenantRecaptchaConfigs[t.tenantId]=i,n(i.siteKey)}r(new Error("recaptcha Enterprise site key undefined"))})).catch((function(e){r(e)}));case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()));case 6:case"end":return e.stop()}}),e)}))),i.apply(this,arguments)},r=function(e){return i.apply(this,arguments)},t=c.length>0&&void 0!==c[0]?c[0]:"verify",n=c.length>1&&void 0!==c[1]&&c[1],e.abrupt("return",new Promise((function(e,t){r(s.auth).then((function(r){if(!n&&Gt(window.grecaptcha))o(r,e,t);else{if("undefined"===typeof window)return void t(new Error("RecaptchaVerifier is only supported in browser"));Ir("https://www.google.com/recaptcha/enterprise.js?render="+r).then((function(){o(r,e,t)})).catch((function(e){t(e)}))}})).catch((function(e){t(e)}))})));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()}]),e}();function Cr(e,t,n){return Ar.apply(this,arguments)}function Ar(){return Ar=u(a().mark((function e(t,n,r){var i,o,u,s,c=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=c.length>3&&void 0!==c[3]&&c[3],o=new Sr(t),e.prev=2,e.next=5,o.verify(r);case 5:u=e.sent,e.next=13;break;case 8:return e.prev=8,e.t0=e.catch(2),e.next=12,o.verify(r,!0);case 12:u=e.sent;case 13:return s=Object.assign({},n),i?Object.assign(s,{captchaResp:u}):Object.assign(s,{captchaResponse:u}),Object.assign(s,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(s,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),e.abrupt("return",s);case 18:case"end":return e.stop()}}),e,null,[[2,8]])}))),Ar.apply(this,arguments)}function Nr(e,t,n){var r=xr(e);on(r._canInitEmulator,r,"emulator-config-failed"),on(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");var i=!!(null===n||void 0===n?void 0:n.disableWarnings),a=Pr(t),o=function(e){var t=Pr(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};var r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){var a=i[1];return{host:a,port:Dr(r.substr(a.length+1))}}var o=m(r.split(":"),2);return{host:o[0],port:Dr(o[1])}}(t),u=o.host,s=o.port,c=null===s?"":":".concat(s);r.config.emulator={url:"".concat(a,"//").concat(u).concat(c,"/")},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:u,port:s,protocol:a.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||function(){function e(){var e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!==typeof console&&"function"===typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!==typeof window&&"undefined"!==typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function Pr(e){var t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Dr(e){if(!e)return null;var t=Number(e);return isNaN(t)?null:t}var Rr=function(){function e(t,n){y(this,e),this.providerId=t,this.signInMethod=n}return k(e,[{key:"toJSON",value:function(){return un("not implemented")}},{key:"_getIdTokenResponse",value:function(e){return un("not implemented")}},{key:"_linkToIdToken",value:function(e,t){return un("not implemented")}},{key:"_getReauthenticationResolver",value:function(e){return un("not implemented")}}]),e}();function Or(e,t){return Lr.apply(this,arguments)}function Lr(){return(Lr=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gn(t,"POST","/v1/accounts:resetPassword",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Mr(e,t){return Fr.apply(this,arguments)}function Fr(){return(Fr=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gn(t,"POST","/v1/accounts:update",n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Vr(e,t){return Ur.apply(this,arguments)}function Ur(){return(Ur=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gn(t,"POST","/v1/accounts:update",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function jr(e,t){return zr.apply(this,arguments)}function zr(){return(zr=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",_n(t,"POST","/v1/accounts:signInWithPassword",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Br(e,t){return qr.apply(this,arguments)}function qr(){return(qr=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gn(t,"POST","/v1/accounts:sendOobCode",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Kr(e,t){return Gr.apply(this,arguments)}function Gr(){return(Gr=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Br(t,n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Hr(e,t){return Wr.apply(this,arguments)}function Wr(){return(Wr=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Br(t,n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qr(e,t){return Yr.apply(this,arguments)}function Yr(){return(Yr=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Br(t,n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Jr(e,t){return Xr.apply(this,arguments)}function Xr(){return(Xr=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Br(t,n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $r(e,t){return Zr.apply(this,arguments)}function Zr(){return(Zr=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",_n(t,"POST","/v1/accounts:signInWithEmailLink",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ei(e,t){return ti.apply(this,arguments)}function ti(){return(ti=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",_n(t,"POST","/v1/accounts:signInWithEmailLink",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ni=function(e){x(n,e);var t=E(n);function n(e,r,i){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return y(this,n),(a=t.call(this,"password",i))._email=e,a._password=r,a._tenantId=o,a}return k(n,[{key:"toJSON",value:function(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}},{key:"_getIdTokenResponse",value:function(){var e=u(a().mark((function e(t){var n,r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this.signInMethod,e.next="password"===e.t0?3:"emailLink"===e.t0?12:13;break;case 3:if(r={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},!(null===(n=t._getRecaptchaConfig())||void 0===n?void 0:n.emailPasswordEnabled)){e.next=11;break}return e.next=7,Cr(t,r,"signInWithPassword");case 7:return i=e.sent,e.abrupt("return",jr(t,i));case 11:return e.abrupt("return",jr(t,r).catch(function(){var e=u(a().mark((function e(n){var i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.code!=="auth/".concat("missing-recaptcha-token")){e.next=8;break}return console.log("Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow."),e.next=4,Cr(t,r,"signInWithPassword");case 4:return i=e.sent,e.abrupt("return",jr(t,i));case 8:return e.abrupt("return",Promise.reject(n));case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 12:return e.abrupt("return",$r(t,{email:this._email,oobCode:this._password}));case 13:en(t,"internal-error");case 14:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_linkToIdToken",value:function(){var e=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this.signInMethod,e.next="password"===e.t0?3:"emailLink"===e.t0?4:5;break;case 3:return e.abrupt("return",Mr(t,{idToken:n,returnSecureToken:!0,email:this._email,password:this._password}));case 4:return e.abrupt("return",ei(t,{idToken:n,email:this._email,oobCode:this._password}));case 5:en(t,"internal-error");case 6:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"_getReauthenticationResolver",value:function(e){return this._getIdTokenResponse(e)}}],[{key:"_fromEmailAndPassword",value:function(e,t){return new n(e,t,"password")}},{key:"_fromEmailAndCode",value:function(e,t){return new n(e,t,"emailLink",arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}},{key:"fromJSON",value:function(e){var t="string"===typeof e?JSON.parse(e):e;if((null===t||void 0===t?void 0:t.email)&&(null===t||void 0===t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}}]),n}(Rr);function ri(e,t){return ii.apply(this,arguments)}function ii(){return(ii=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",_n(t,"POST","/v1/accounts:signInWithIdp",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ai=function(e){x(n,e);var t=E(n);function n(){var e;return y(this,n),(e=t.apply(this,arguments)).pendingToken=null,e}return k(n,[{key:"toJSON",value:function(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}},{key:"_getIdTokenResponse",value:function(e){return ri(e,this.buildRequest())}},{key:"_linkToIdToken",value:function(e,t){var n=this.buildRequest();return n.idToken=t,ri(e,n)}},{key:"_getReauthenticationResolver",value:function(e){var t=this.buildRequest();return t.autoCreate=!1,ri(e,t)}},{key:"buildRequest",value:function(){var e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{var t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=$(t)}return e}}],[{key:"_fromParams",value:function(e){var t=new n(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):en("argument-error"),t}},{key:"fromJSON",value:function(e){var t="string"===typeof e?JSON.parse(e):e,r=t.providerId,i=t.signInMethod,a=Lt(t,["providerId","signInMethod"]);if(!r||!i)return null;var o=new n(r,i);return o.idToken=a.idToken||void 0,o.accessToken=a.accessToken||void 0,o.secret=a.secret,o.nonce=a.nonce,o.pendingToken=a.pendingToken||null,o}}]),n}(Rr);function oi(e,t){return ui.apply(this,arguments)}function ui(){return(ui=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gn(t,"POST","/v1/accounts:sendVerificationCode",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function si(){return(si=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",_n(t,"POST","/v1/accounts:signInWithPhoneNumber",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ci(){return(ci=u(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_n(t,"POST","/v1/accounts:signInWithPhoneNumber",yn(t,n));case 2:if(!(r=e.sent).temporaryProof){e.next=5;break}throw En(t,"account-exists-with-different-credential",r);case 5:return e.abrupt("return",r);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var li=c({},"USER_NOT_FOUND","user-not-found");function fi(){return(fi=u(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Object.assign(Object.assign({},n),{operation:"REAUTH"}),e.abrupt("return",_n(t,"POST","/v1/accounts:signInWithPhoneNumber",yn(t,r),li));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var hi=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this,"phone","phone")).params=e,r}return k(n,[{key:"_getIdTokenResponse",value:function(e){return function(e,t){return si.apply(this,arguments)}(e,this._makeVerificationRequest())}},{key:"_linkToIdToken",value:function(e,t){return function(e,t){return ci.apply(this,arguments)}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}},{key:"_getReauthenticationResolver",value:function(e){return function(e,t){return fi.apply(this,arguments)}(e,this._makeVerificationRequest())}},{key:"_makeVerificationRequest",value:function(){var e=this.params,t=e.temporaryProof,n=e.phoneNumber,r=e.verificationId,i=e.verificationCode;return t&&n?{temporaryProof:t,phoneNumber:n}:{sessionInfo:r,code:i}}},{key:"toJSON",value:function(){var e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}}],[{key:"_fromVerification",value:function(e,t){return new n({verificationId:e,verificationCode:t})}},{key:"_fromTokenResponse",value:function(e,t){return new n({phoneNumber:e,temporaryProof:t})}},{key:"fromJSON",value:function(e){"string"===typeof e&&(e=JSON.parse(e));var t=e,r=t.verificationId,i=t.verificationCode,a=t.phoneNumber,o=t.temporaryProof;return i||r||a||o?new n({verificationId:r,verificationCode:i,phoneNumber:a,temporaryProof:o}):null}}]),n}(Rr);var di=function(){function e(t){var n,r,i,a,o,u;y(this,e);var s=Z(ee(t)),c=null!==(n=s.apiKey)&&void 0!==n?n:null,l=null!==(r=s.oobCode)&&void 0!==r?r:null,f=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(i=s.mode)&&void 0!==i?i:null);on(c&&l&&f,"argument-error"),this.apiKey=c,this.operation=f,this.code=l,this.continueUrl=null!==(a=s.continueUrl)&&void 0!==a?a:null,this.languageCode=null!==(o=s.languageCode)&&void 0!==o?o:null,this.tenantId=null!==(u=s.tenantId)&&void 0!==u?u:null}return k(e,null,[{key:"parseLink",value:function(t){var n=function(e){var t=Z(ee(e)).link,n=t?Z(ee(t)).deep_link_id:null,r=Z(ee(e)).deep_link_id;return(r?Z(ee(r)).link:null)||r||n||t||e}(t);try{return new e(n)}catch(r){return null}}}]),e}();var pi=function(){function e(){y(this,e),this.providerId=e.PROVIDER_ID}return k(e,null,[{key:"credential",value:function(e,t){return ni._fromEmailAndPassword(e,t)}},{key:"credentialWithLink",value:function(e,t){var n=di.parseLink(t);return on(n,"argument-error"),ni._fromEmailAndCode(e,n.code,n.tenantId)}}]),e}();pi.PROVIDER_ID="password",pi.EMAIL_PASSWORD_SIGN_IN_METHOD="password",pi.EMAIL_LINK_SIGN_IN_METHOD="emailLink";var vi=function(){function e(t){y(this,e),this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}return k(e,[{key:"setDefaultLanguage",value:function(e){this.defaultLanguageCode=e}},{key:"setCustomParameters",value:function(e){return this.customParameters=e,this}},{key:"getCustomParameters",value:function(){return this.customParameters}}]),e}(),mi=function(e){x(n,e);var t=E(n);function n(){var e;return y(this,n),(e=t.apply(this,arguments)).scopes=[],e}return k(n,[{key:"addScope",value:function(e){return this.scopes.includes(e)||this.scopes.push(e),this}},{key:"getScopes",value:function(){return oe(this.scopes)}}]),n}(vi),yi=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.apply(this,arguments)}return k(n,[{key:"credential",value:function(e){return this._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}},{key:"_credential",value:function(e){return on(e.idToken||e.accessToken,"argument-error"),ai._fromParams(Object.assign(Object.assign({},e),{providerId:this.providerId,signInMethod:this.providerId}))}}],[{key:"credentialFromJSON",value:function(e){var t="string"===typeof e?JSON.parse(e):e;return on("providerId"in t&&"signInMethod"in t,"argument-error"),ai._fromParams(t)}},{key:"credentialFromResult",value:function(e){return n.oauthCredentialFromTaggedObject(e)}},{key:"credentialFromError",value:function(e){return n.oauthCredentialFromTaggedObject(e.customData||{})}},{key:"oauthCredentialFromTaggedObject",value:function(e){var t=e._tokenResponse;if(!t)return null;var r=t.oauthIdToken,i=t.oauthAccessToken,a=t.oauthTokenSecret,o=t.pendingToken,u=t.nonce,s=t.providerId;if(!i&&!a&&!r&&!o)return null;if(!s)return null;try{return new n(s)._credential({idToken:r,accessToken:i,nonce:u,pendingToken:o})}catch(c){return null}}}]),n}(mi),gi=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.call(this,"facebook.com")}return k(n,null,[{key:"credential",value:function(e){return ai._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}},{key:"credentialFromResult",value:function(e){return n.credentialFromTaggedObject(e)}},{key:"credentialFromError",value:function(e){return n.credentialFromTaggedObject(e.customData||{})}},{key:"credentialFromTaggedObject",value:function(e){var t=e._tokenResponse;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return n.credential(t.oauthAccessToken)}catch(r){return null}}}]),n}(mi);gi.FACEBOOK_SIGN_IN_METHOD="facebook.com",gi.PROVIDER_ID="facebook.com";var ki=function(e){x(n,e);var t=E(n);function n(){var e;return y(this,n),(e=t.call(this,"google.com")).addScope("profile"),e}return k(n,null,[{key:"credential",value:function(e,t){return ai._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}},{key:"credentialFromResult",value:function(e){return n.credentialFromTaggedObject(e)}},{key:"credentialFromError",value:function(e){return n.credentialFromTaggedObject(e.customData||{})}},{key:"credentialFromTaggedObject",value:function(e){var t=e._tokenResponse;if(!t)return null;var r=t.oauthIdToken,i=t.oauthAccessToken;if(!r&&!i)return null;try{return n.credential(r,i)}catch(a){return null}}}]),n}(mi);ki.GOOGLE_SIGN_IN_METHOD="google.com",ki.PROVIDER_ID="google.com";var wi=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.call(this,"github.com")}return k(n,null,[{key:"credential",value:function(e){return ai._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GITHUB_SIGN_IN_METHOD,accessToken:e})}},{key:"credentialFromResult",value:function(e){return n.credentialFromTaggedObject(e)}},{key:"credentialFromError",value:function(e){return n.credentialFromTaggedObject(e.customData||{})}},{key:"credentialFromTaggedObject",value:function(e){var t=e._tokenResponse;if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return n.credential(t.oauthAccessToken)}catch(r){return null}}}]),n}(mi);wi.GITHUB_SIGN_IN_METHOD="github.com",wi.PROVIDER_ID="github.com";var bi=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this,e,e)).pendingToken=r,i}return k(n,[{key:"_getIdTokenResponse",value:function(e){return ri(e,this.buildRequest())}},{key:"_linkToIdToken",value:function(e,t){var n=this.buildRequest();return n.idToken=t,ri(e,n)}},{key:"_getReauthenticationResolver",value:function(e){var t=this.buildRequest();return t.autoCreate=!1,ri(e,t)}},{key:"toJSON",value:function(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}},{key:"buildRequest",value:function(){return{requestUri:"http://localhost",returnSecureToken:!0,pendingToken:this.pendingToken}}}],[{key:"fromJSON",value:function(e){var t="string"===typeof e?JSON.parse(e):e,r=t.providerId,i=t.signInMethod,a=t.pendingToken;return r&&i&&a&&r===i?new n(r,a):null}},{key:"_create",value:function(e,t){return new n(e,t)}}]),n}(Rr),_i=function(e){x(n,e);var t=E(n);function n(e){return y(this,n),on(e.startsWith("saml."),"argument-error"),t.call(this,e)}return k(n,null,[{key:"credentialFromResult",value:function(e){return n.samlCredentialFromTaggedObject(e)}},{key:"credentialFromError",value:function(e){return n.samlCredentialFromTaggedObject(e.customData||{})}},{key:"credentialFromJSON",value:function(e){var t=bi.fromJSON(e);return on(t,"argument-error"),t}},{key:"samlCredentialFromTaggedObject",value:function(e){var t=e._tokenResponse;if(!t)return null;var n=t.pendingToken,r=t.providerId;if(!n||!r)return null;try{return bi._create(r,n)}catch(i){return null}}}]),n}(vi),xi=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.call(this,"twitter.com")}return k(n,null,[{key:"credential",value:function(e,t){return ai._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}},{key:"credentialFromResult",value:function(e){return n.credentialFromTaggedObject(e)}},{key:"credentialFromError",value:function(e){return n.credentialFromTaggedObject(e.customData||{})}},{key:"credentialFromTaggedObject",value:function(e){var t=e._tokenResponse;if(!t)return null;var r=t.oauthAccessToken,i=t.oauthTokenSecret;if(!r||!i)return null;try{return n.credential(r,i)}catch(a){return null}}}]),n}(mi);function Ti(e,t){return Ii.apply(this,arguments)}function Ii(){return(Ii=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",_n(t,"POST","/v1/accounts:signUp",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}xi.TWITTER_SIGN_IN_METHOD="twitter.com",xi.PROVIDER_ID="twitter.com";var Ei=function(){function e(t){y(this,e),this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}return k(e,null,[{key:"_fromIdTokenResponse",value:function(){var t=u(a().mark((function t(n,r,i){var o,u,s,c,l=arguments;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=l.length>3&&void 0!==l[3]&&l[3],t.next=3,er._fromIdTokenResponse(n,i,o);case 3:return u=t.sent,s=Si(i),c=new e({user:u,providerId:s,_tokenResponse:i,operationType:r}),t.abrupt("return",c);case 7:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},{key:"_forOperation",value:function(){var t=u(a().mark((function t(n,r,i){var o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n._updateTokensIfNecessary(i,!0);case 2:return o=Si(i),t.abrupt("return",new e({user:n,providerId:o,_tokenResponse:i,operationType:r}));case 4:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()}]),e}();function Si(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}function Ci(){return(Ci=u(a().mark((function e(t){var n,r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=xr(t),e.next=3,r._initializationPromise;case 3:if(!(null===(n=r.currentUser)||void 0===n?void 0:n.isAnonymous)){e.next=5;break}return e.abrupt("return",new Ei({user:r.currentUser,providerId:null,operationType:"signIn"}));case 5:return e.next=7,Ti(r,{returnSecureToken:!0});case 7:return i=e.sent,e.next=10,Ei._fromIdTokenResponse(r,"signIn",i,!0);case 10:return o=e.sent,e.next=13,r._updateCurrentUser(o.user);case 13:return e.abrupt("return",o);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ai=function(e){x(n,e);var t=E(n);function n(e,r,i,a){var o,u;return y(this,n),(o=t.call(this,r.code,r.message)).operationType=i,o.user=a,Object.setPrototypeOf(b(o),n.prototype),o.customData={appName:e.name,tenantId:null!==(u=e.tenantId)&&void 0!==u?u:void 0,_serverResponse:r.customData._serverResponse,operationType:i},o}return k(n,null,[{key:"_fromErrorAndOperation",value:function(e,t,r,i){return new n(e,t,r,i)}}]),n}(G);function Ni(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch((function(n){if(n.code==="auth/".concat("multi-factor-auth-required"))throw Ai._fromErrorAndOperation(e,n,t,r);throw n}))}function Pi(e){return new Set(e.map((function(e){return e.providerId})).filter((function(e){return!!e})))}function Di(e,t){return Ri.apply(this,arguments)}function Ri(){return Ri=u(a().mark((function e(t,n){var r,i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=ie(t),e.next=3,Mi(!0,r,n);case 3:return e.t0=Rn,e.t1=r.auth,e.next=7,r.getIdToken();case 7:return e.t2=e.sent,e.t3=[n],e.t4={idToken:e.t2,deleteProvider:e.t3},e.next=12,(0,e.t0)(e.t1,e.t4);case 12:return i=e.sent,o=i.providerUserInfo,u=Pi(o||[]),r.providerData=r.providerData.filter((function(e){return u.has(e.providerId)})),u.has("phone")||(r.phoneNumber=null),e.next=19,r.auth._persistUserIfCurrent(r);case 19:return e.abrupt("return",r);case 20:case"end":return e.stop()}}),e)}))),Ri.apply(this,arguments)}function Oi(e,t){return Li.apply(this,arguments)}function Li(){return Li=u(a().mark((function e(t,n){var r,i,o=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>2&&void 0!==o[2]&&o[2],e.t0=zn,e.t1=t,e.t2=n,e.t3=t.auth,e.next=7,t.getIdToken();case 7:return e.t4=e.sent,e.t5=e.t2._linkToIdToken.call(e.t2,e.t3,e.t4),e.t6=r,e.next=12,(0,e.t0)(e.t1,e.t5,e.t6);case 12:return i=e.sent,e.abrupt("return",Ei._forOperation(t,"link",i));case 14:case"end":return e.stop()}}),e)}))),Li.apply(this,arguments)}function Mi(e,t,n){return Fi.apply(this,arguments)}function Fi(){return(Fi=u(a().mark((function e(t,n,r){var i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Hn(n);case 2:i=Pi(n.providerData),o=!1===t?"provider-already-linked":"no-such-provider",on(i.has(r)===t,n.auth,o);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Vi(e,t){return Ui.apply(this,arguments)}function Ui(){return Ui=u(a().mark((function e(t,n){var r,i,o,u,s,c,l=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=l.length>2&&void 0!==l[2]&&l[2],i=t.auth,o="reauthenticate",e.prev=3,e.next=6,zn(t,Ni(i,o,n,t),r);case 6:return on((u=e.sent).idToken,i,"internal-error"),on(s=jn(u.idToken),i,"internal-error"),c=s.sub,on(t.uid===c,i,"user-mismatch"),e.abrupt("return",Ei._forOperation(t,o,u));case 15:throw e.prev=15,e.t0=e.catch(3),(null===e.t0||void 0===e.t0?void 0:e.t0.code)==="auth/".concat("user-not-found")&&en(i,"user-mismatch"),e.t0;case 19:case"end":return e.stop()}}),e,null,[[3,15]])}))),Ui.apply(this,arguments)}function ji(e,t){return zi.apply(this,arguments)}function zi(){return zi=u(a().mark((function e(t,n){var r,i,o,u,s=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>2&&void 0!==s[2]&&s[2],i="signIn",e.next=4,Ni(t,i,n);case 4:return o=e.sent,e.next=7,Ei._fromIdTokenResponse(t,i,o);case 7:if(u=e.sent,r){e.next=11;break}return e.next=11,t._updateCurrentUser(u.user);case 11:return e.abrupt("return",u);case 12:case"end":return e.stop()}}),e)}))),zi.apply(this,arguments)}function Bi(e,t){return qi.apply(this,arguments)}function qi(){return(qi=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ji(xr(t),n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ki(e,t){return Gi.apply(this,arguments)}function Gi(){return(Gi=u(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=ie(t),e.next=3,Mi(!1,r,n.providerId);case 3:return e.abrupt("return",Oi(r,n));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Hi(e,t){return Wi.apply(this,arguments)}function Wi(){return(Wi=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Vi(ie(t),n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qi(e,t){return Yi.apply(this,arguments)}function Yi(){return(Yi=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",_n(t,"POST","/v1/accounts:signInWithCustomToken",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ji(){return(Ji=u(a().mark((function e(t,n){var r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=xr(t),e.next=3,Qi(r,{token:n,returnSecureToken:!0});case 3:return i=e.sent,e.next=6,Ei._fromIdTokenResponse(r,"signIn",i);case 6:return o=e.sent,e.next=9,r._updateCurrentUser(o.user);case 9:return e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Xi=function(){function e(t,n){y(this,e),this.factorId=t,this.uid=n.mfaEnrollmentId,this.enrollmentTime=new Date(n.enrolledAt).toUTCString(),this.displayName=n.displayName}return k(e,null,[{key:"_fromServerResponse",value:function(e,t){return"phoneInfo"in t?$i._fromServerResponse(e,t):"totpInfo"in t?Zi._fromServerResponse(e,t):en(e,"internal-error")}}]),e}(),$i=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this,"phone",e)).phoneNumber=e.phoneInfo,r}return k(n,null,[{key:"_fromServerResponse",value:function(e,t){return new n(t)}}]),n}(Xi),Zi=function(e){x(n,e);var t=E(n);function n(e){return y(this,n),t.call(this,"totp",e)}return k(n,null,[{key:"_fromServerResponse",value:function(e,t){return new n(t)}}]),n}(Xi);function ea(e,t,n){var r;on((null===(r=n.url)||void 0===r?void 0:r.length)>0,e,"invalid-continue-uri"),on("undefined"===typeof n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(on(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(on(n.android.packageName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackageName=n.android.packageName)}function ta(e){return na.apply(this,arguments)}function na(){return(na=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=xr(t))._getPasswordPolicyInternal()){e.next=4;break}return e.next=4,n._updatePasswordPolicy();case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ra(){return ra=u(a().mark((function e(t,n,r){var i,o,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=xr(t),s={requestType:"PASSWORD_RESET",email:n,clientType:"CLIENT_TYPE_WEB"},!(null===(i=o._getRecaptchaConfig())||void 0===i?void 0:i.emailPasswordEnabled)){e.next=11;break}return e.next=5,Cr(o,s,"getOobCode",!0);case 5:return c=e.sent,r&&ea(o,c,r),e.next=9,Hr(o,c);case 9:e.next=14;break;case 11:return r&&ea(o,s,r),e.next=14,Hr(o,s).catch(function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.code!=="auth/".concat("missing-recaptcha-token")){e.next=10;break}return console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow."),e.next=4,Cr(o,s,"getOobCode",!0);case 4:return n=e.sent,r&&ea(o,n,r),e.next=8,Hr(o,n);case 8:e.next=11;break;case 10:return e.abrupt("return",Promise.reject(t));case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 14:case"end":return e.stop()}}),e)}))),ra.apply(this,arguments)}function ia(){return ia=u(a().mark((function e(t,n,r){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Or(ie(t),{oobCode:n,newPassword:r}).catch(function(){var e=u(a().mark((function e(n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw n.code==="auth/".concat("password-does-not-meet-requirements")&&ta(t),n;case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)}))),ia.apply(this,arguments)}function aa(){return(aa=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Vr(ie(t),{oobCode:n});case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oa(e,t){return ua.apply(this,arguments)}function ua(){return(ua=u(a().mark((function e(t,n){var r,i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=ie(t),e.next=3,Or(r,{oobCode:n});case 3:i=e.sent,on(o=i.requestType,r,"internal-error"),e.t0=o,e.next="EMAIL_SIGNIN"===e.t0?9:"VERIFY_AND_CHANGE_EMAIL"===e.t0?10:"REVERT_SECOND_FACTOR_ADDITION"===e.t0?12:13;break;case 9:return e.abrupt("break",14);case 10:return on(i.newEmail,r,"internal-error"),e.abrupt("break",14);case 12:on(i.mfaInfo,r,"internal-error");case 13:on(i.email,r,"internal-error");case 14:return u=null,i.mfaInfo&&(u=Xi._fromServerResponse(xr(r),i.mfaInfo)),e.abrupt("return",{data:{email:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.newEmail:i.email)||null,previousEmail:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.email:i.newEmail)||null,multiFactorInfo:u},operation:o});case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function sa(){return(sa=u(a().mark((function e(t,n){var r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,oa(ie(t),n);case 2:return r=e.sent,i=r.data,e.abrupt("return",i.email);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ca(e,t,n){return la.apply(this,arguments)}function la(){return la=u(a().mark((function e(t,n,r){var i,o,s,c,l,f,h;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=xr(t),s={returnSecureToken:!0,email:n,password:r,clientType:"CLIENT_TYPE_WEB"},!(null===(i=o._getRecaptchaConfig())||void 0===i?void 0:i.emailPasswordEnabled)){e.next=9;break}return e.next=5,Cr(o,s,"signUpPassword");case 5:l=e.sent,c=Ti(o,l),e.next=10;break;case 9:c=Ti(o,s).catch(function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.code!=="auth/".concat("missing-recaptcha-token")){e.next=6;break}return console.log("Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow."),e.next=4,Cr(o,s,"signUpPassword");case 4:return n=e.sent,e.abrupt("return",Ti(o,n));case 6:throw t;case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 10:return e.next=12,c.catch((function(e){throw e.code==="auth/".concat("password-does-not-meet-requirements")&&ta(t),e}));case 12:return f=e.sent,e.next=15,Ei._fromIdTokenResponse(o,"signIn",f);case 15:return h=e.sent,e.next=18,o._updateCurrentUser(h.user);case 18:return e.abrupt("return",h);case 19:case"end":return e.stop()}}),e)}))),la.apply(this,arguments)}function fa(){return fa=u(a().mark((function e(t,n,r){var i,o,s,c,l;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=function(e,t){on(t.handleCodeInApp,o,"argument-error"),t&&ea(o,e,t)},o=xr(t),s={requestType:"EMAIL_SIGNIN",email:n,clientType:"CLIENT_TYPE_WEB"},!(null===(i=o._getRecaptchaConfig())||void 0===i?void 0:i.emailPasswordEnabled)){e.next=12;break}return e.next=6,Cr(o,s,"getOobCode",!0);case 6:return l=e.sent,c(l,r),e.next=10,Qr(o,l);case 10:e.next=15;break;case 12:return c(s,r),e.next=15,Qr(o,s).catch(function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.code!=="auth/".concat("missing-recaptcha-token")){e.next=10;break}return console.log("Email link sign-in is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow."),e.next=4,Cr(o,s,"getOobCode",!0);case 4:return n=e.sent,c(n,r),e.next=8,Qr(o,n);case 8:e.next=11;break;case 10:return e.abrupt("return",Promise.reject(t));case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 15:case"end":return e.stop()}}),e)}))),fa.apply(this,arguments)}function ha(){return(ha=u(a().mark((function e(t,n,r){var i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=ie(t),on((o=pi.credentialWithLink(n,r||cn()))._tenantId===(i.tenantId||null),i,"tenant-id-mismatch"),e.abrupt("return",Bi(i,o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function da(e,t){return pa.apply(this,arguments)}function pa(){return(pa=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gn(t,"POST","/v1/accounts:createAuthUri",yn(t,n)));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function va(){return(va=u(a().mark((function e(t,n){var r,i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=ln()?cn():"http://localhost",i={identifier:n,continueUri:r},e.next=4,da(ie(t),i);case 4:return o=e.sent,u=o.signinMethods,e.abrupt("return",u||[]);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ma(){return(ma=u(a().mark((function e(t,n){var r,i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=ie(t),e.next=3,t.getIdToken();case 3:return i=e.sent,o={requestType:"VERIFY_EMAIL",idToken:i},n&&ea(r.auth,o,n),e.next=8,Kr(r.auth,o);case 8:if(u=e.sent,u.email===t.email){e.next=13;break}return e.next=13,t.reload();case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ya(){return(ya=u(a().mark((function e(t,n,r){var i,o,u,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=ie(t),e.next=3,t.getIdToken();case 3:return o=e.sent,u={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:o,newEmail:n},r&&ea(i.auth,u,r),e.next=8,Jr(i.auth,u);case 8:if(s=e.sent,s.email===t.email){e.next=13;break}return e.next=13,t.reload();case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ga(e,t){return ka.apply(this,arguments)}function ka(){return(ka=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gn(t,"POST","/v1/accounts:update",n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wa(){return(wa=u(a().mark((function e(t,n){var r,i,o,u,s,c,l;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.displayName,i=n.photoURL,void 0!==r||void 0!==i){e.next=3;break}return e.abrupt("return");case 3:return o=ie(t),e.next=6,o.getIdToken();case 6:return u=e.sent,s={idToken:u,displayName:r,photoUrl:i,returnSecureToken:!0},e.next=10,zn(o,ga(o.auth,s));case 10:return c=e.sent,o.displayName=c.displayName||null,o.photoURL=c.photoUrl||null,(l=o.providerData.find((function(e){return"password"===e.providerId})))&&(l.displayName=o.displayName,l.photoURL=o.photoURL),e.next=17,o._updateTokensIfNecessary(c);case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ba(e,t,n){return _a.apply(this,arguments)}function _a(){return(_a=u(a().mark((function e(t,n,r){var i,o,u,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.auth,e.next=3,t.getIdToken();case 3:return o=e.sent,u={idToken:o,returnSecureToken:!0},n&&(u.email=n),r&&(u.password=r),e.next=9,zn(t,Mr(i,u));case 9:return s=e.sent,e.next=12,t._updateTokensIfNecessary(s,!0);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var xa=k((function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};y(this,e),this.isNewUser=t,this.providerId=n,this.profile=r})),Ta=function(e){x(n,e);var t=E(n);function n(e,r,i,a){var o;return y(this,n),(o=t.call(this,e,r,i)).username=a,o}return k(n)}(xa),Ia=function(e){x(n,e);var t=E(n);function n(e,r){return y(this,n),t.call(this,e,"facebook.com",r)}return k(n)}(xa),Ea=function(e){x(n,e);var t=E(n);function n(e,r){return y(this,n),t.call(this,e,"github.com",r,"string"===typeof(null===r||void 0===r?void 0:r.login)?null===r||void 0===r?void 0:r.login:null)}return k(n)}(Ta),Sa=function(e){x(n,e);var t=E(n);function n(e,r){return y(this,n),t.call(this,e,"google.com",r)}return k(n)}(xa),Ca=function(e){x(n,e);var t=E(n);function n(e,r,i){return y(this,n),t.call(this,e,"twitter.com",r,i)}return k(n)}(Ta);function Aa(e){var t=e.user,n=e._tokenResponse;return t.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:function(e){var t,n;if(!e)return null;var r=e.providerId,i=e.rawUserInfo?JSON.parse(e.rawUserInfo):{},a=e.isNewUser||"identitytoolkit#SignupNewUserResponse"===e.kind;if(!r&&(null===e||void 0===e?void 0:e.idToken)){var o=null===(n=null===(t=jn(e.idToken))||void 0===t?void 0:t.firebase)||void 0===n?void 0:n.sign_in_provider;if(o)return new xa(a,"anonymous"!==o&&"custom"!==o?o:null)}if(!r)return null;switch(r){case"facebook.com":return new Ia(a,i);case"github.com":return new Ea(a,i);case"google.com":return new Sa(a,i);case"twitter.com":return new Ca(a,i,e.screenName||null);case"custom":case"anonymous":return new xa(a,null);default:return new xa(a,r,i)}}(n)}var Na=function(){function e(t,n,r){y(this,e),this.type=t,this.credential=n,this.user=r}return k(e,[{key:"toJSON",value:function(){return{multiFactorSession:c({},"enroll"===this.type?"idToken":"pendingCredential",this.credential)}}}],[{key:"_fromIdtoken",value:function(t,n){return new e("enroll",t,n)}},{key:"_fromMfaPendingCredential",value:function(t){return new e("signin",t)}},{key:"fromJSON",value:function(t){var n,r;if(null===t||void 0===t?void 0:t.multiFactorSession){if(null===(n=t.multiFactorSession)||void 0===n?void 0:n.pendingCredential)return e._fromMfaPendingCredential(t.multiFactorSession.pendingCredential);if(null===(r=t.multiFactorSession)||void 0===r?void 0:r.idToken)return e._fromIdtoken(t.multiFactorSession.idToken)}return null}}]),e}(),Pa=function(){function e(t,n,r){y(this,e),this.session=t,this.hints=n,this.signInResolver=r}return k(e,[{key:"resolveSignIn",value:function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t,e.abrupt("return",this.signInResolver(n));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}],[{key:"_fromError",value:function(t,n){var r=xr(t),i=n.customData._serverResponse,o=(i.mfaInfo||[]).map((function(e){return Xi._fromServerResponse(r,e)}));on(i.mfaPendingCredential,r,"internal-error");var s=Na._fromMfaPendingCredential(i.mfaPendingCredential);return new e(s,o,function(){var e=u(a().mark((function e(t){var o,u,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t._process(r,s);case 2:o=e.sent,delete i.mfaInfo,delete i.mfaPendingCredential,u=Object.assign(Object.assign({},i),{idToken:o.idToken,refreshToken:o.refreshToken}),e.t0=n.operationType,e.next="signIn"===e.t0?9:"reauthenticate"===e.t0?15:17;break;case 9:return e.next=11,Ei._fromIdTokenResponse(r,n.operationType,u);case 11:return c=e.sent,e.next=14,r._updateCurrentUser(c.user);case 14:return e.abrupt("return",c);case 15:return on(n.user,r,"internal-error"),e.abrupt("return",Ei._forOperation(n.user,n.operationType,u));case 17:en(r,"internal-error");case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}}]),e}();function Da(e,t){return gn(e,"POST","/v2/accounts/mfaEnrollment:start",yn(e,t))}function Ra(e,t){return gn(e,"POST","/v2/accounts/mfaEnrollment:finalize",yn(e,t))}var Oa=function(){function e(t){var n=this;y(this,e),this.user=t,this.enrolledFactors=[],t._onReload((function(e){e.mfaInfo&&(n.enrolledFactors=e.mfaInfo.map((function(e){return Xi._fromServerResponse(t.auth,e)})))}))}return k(e,[{key:"getSession",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Na,e.next=3,this.user.getIdToken();case 3:return e.t1=e.sent,e.t2=this.user,e.abrupt("return",e.t0._fromIdtoken.call(e.t0,e.t1,e.t2));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"enroll",value:function(){var e=u(a().mark((function e(t,n){var r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t,e.next=3,this.getSession();case 3:return i=e.sent,e.next=6,zn(this.user,r._process(this.user.auth,i,n));case 6:return o=e.sent,e.next=9,this.user._updateTokensIfNecessary(o);case 9:return e.abrupt("return",this.user.reload());case 10:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"unenroll",value:function(){var e=u(a().mark((function e(t){var n,r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"===typeof t?t:t.uid,e.next=3,this.user.getIdToken();case 3:return r=e.sent,e.prev=4,e.next=7,zn(this.user,gn(a=this.user.auth,"POST","/v2/accounts/mfaEnrollment:withdraw",yn(a,{idToken:r,mfaEnrollmentId:n})));case 7:return i=e.sent,this.enrolledFactors=this.enrolledFactors.filter((function(e){return e.uid!==n})),e.next=11,this.user._updateTokensIfNecessary(i);case 11:return e.next=13,this.user.reload();case 13:e.next=18;break;case 15:throw e.prev=15,e.t0=e.catch(4),e.t0;case 18:case"end":return e.stop()}var a}),e,this,[[4,15]])})));return function(t){return e.apply(this,arguments)}}()}],[{key:"_fromUser",value:function(t){return new e(t)}}]),e}(),La=new WeakMap;var Ma="__sak",Fa=function(){function e(t,n){y(this,e),this.storageRetriever=t,this.type=n}return k(e,[{key:"_isAvailable",value:function(){try{return this.storage?(this.storage.setItem(Ma,"1"),this.storage.removeItem(Ma),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}},{key:"_set",value:function(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}},{key:"_get",value:function(e){var t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}},{key:"_remove",value:function(e){return this.storage.removeItem(e),Promise.resolve()}},{key:"storage",get:function(){return this.storageRetriever()}}]),e}();var Va=function(e){x(n,e);var t=E(n);function n(){var e;return y(this,n),(e=t.call(this,(function(){return window.localStorage}),"LOCAL")).boundEventHandler=function(t,n){return e.onStorageEvent(t,n)},e.listeners={},e.localCache={},e.pollTimer=null,e.safariLocalStorageNotSynced=function(){var e=U();return cr(e)||vr(e)}()&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),e.fallbackToPolling=mr(),e._shouldAllowMigration=!0,e}return k(n,[{key:"forAllChangedKeys",value:function(e){for(var t=0,n=Object.keys(this.listeners);t<n.length;t++){var r=n[t],i=this.storage.getItem(r),a=this.localCache[r];i!==a&&e(r,a,i)}}},{key:"onStorageEvent",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.key){var r=e.key;if(n?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){var i=this.storage.getItem(r);if(e.newValue!==i)null!==e.newValue?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!n)return}var a=function(){var e=t.storage.getItem(r);(n||t.localCache[r]!==e)&&t.notifyListeners(r,e)},o=this.storage.getItem(r);q()&&10===document.documentMode&&o!==e.newValue&&e.newValue!==e.oldValue?setTimeout(a,10):a()}else this.forAllChangedKeys((function(e,n,r){t.notifyListeners(e,r)}))}},{key:"notifyListeners",value:function(e,t){this.localCache[e]=t;var n=this.listeners[e];if(n)for(var r=0,i=Array.from(n);r<i.length;r++){(0,i[r])(t?JSON.parse(t):t)}}},{key:"startPolling",value:function(){var e=this;this.stopPolling(),this.pollTimer=setInterval((function(){e.forAllChangedKeys((function(t,n,r){e.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:n,newValue:r}),!0)}))}),1e3)}},{key:"stopPolling",value:function(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}},{key:"attachListener",value:function(){window.addEventListener("storage",this.boundEventHandler)}},{key:"detachListener",value:function(){window.removeEventListener("storage",this.boundEventHandler)}},{key:"_addListener",value:function(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}},{key:"_removeListener",value:function(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}},{key:"_set",value:function(){var e=u(a().mark((function e(t,r){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ot(T(n.prototype),"_set",this).call(this,t,r);case 2:this.localCache[t]=JSON.stringify(r);case 3:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"_get",value:function(){var e=u(a().mark((function e(t){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ot(T(n.prototype),"_get",this).call(this,t);case 2:return r=e.sent,this.localCache[t]=JSON.stringify(r),e.abrupt("return",r);case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_remove",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ot(T(n.prototype),"_remove",this).call(this,t);case 2:delete this.localCache[t];case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),n}(Fa);Va.type="LOCAL";var Ua=Va,ja=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.call(this,(function(){return window.sessionStorage}),"SESSION")}return k(n,[{key:"_addListener",value:function(e,t){}},{key:"_removeListener",value:function(e,t){}}]),n}(Fa);ja.type="SESSION";var za=ja;function Ba(e){return Promise.all(e.map(function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t;case 3:return n=e.sent,e.abrupt("return",{fulfilled:!0,value:n});case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",{fulfilled:!1,reason:e.t0});case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}()))}var qa=function(){function e(t){y(this,e),this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}return k(e,[{key:"isListeningto",value:function(e){return this.eventTarget===e}},{key:"handleEvent",value:function(){var e=u(a().mark((function e(t){var n,r,i,o,s,c,l,f;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(n=t).data,i=r.eventId,o=r.eventType,s=r.data,null===(c=this.handlersMap[o])||void 0===c?void 0:c.size){e.next=5;break}return e.abrupt("return");case 5:return n.ports[0].postMessage({status:"ack",eventId:i,eventType:o}),l=Array.from(c).map(function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(n.origin,s));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=9,Ba(l);case 9:f=e.sent,n.ports[0].postMessage({status:"done",eventId:i,eventType:o,response:f});case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_subscribe",value:function(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}},{key:"_unsubscribe",value:function(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}],[{key:"_getInstance",value:function(t){var n=this.receivers.find((function(e){return e.isListeningto(t)}));if(n)return n;var r=new e(t);return this.receivers.push(r),r}}]),e}();function Ka(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n="",r=0;r<t;r++)n+=Math.floor(10*Math.random());return e+n}qa.receivers=[];var Ga=function(){function e(t){y(this,e),this.target=t,this.handlers=new Set}return k(e,[{key:"removeMessageHandler",value:function(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}},{key:"_send",value:function(){var e=u(a().mark((function e(t,n){var r,i,o,u,s=this,c=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=c.length>2&&void 0!==c[2]?c[2]:50,i="undefined"!==typeof MessageChannel?new MessageChannel:null){e.next=4;break}throw new Error("connection_unavailable");case 4:return e.abrupt("return",new Promise((function(e,a){var c=Ka("",20);i.port1.start();var l=setTimeout((function(){a(new Error("unsupported_event"))}),r);u={messageChannel:i,onMessage:function(t){var n=t;if(n.data.eventId===c)switch(n.data.status){case"ack":clearTimeout(l),o=setTimeout((function(){a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(o),e(n.data.response);break;default:clearTimeout(l),clearTimeout(o),a(new Error("invalid_response"))}}},s.handlers.add(u),i.port1.addEventListener("message",u.onMessage),s.target.postMessage({eventType:t,eventId:c,data:n},[i.port2])})).finally((function(){u&&s.removeMessageHandler(u)})));case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()}]),e}();function Ha(){return window}function Wa(e){Ha().location.href=e}function Qa(){return"undefined"!==typeof Ha().WorkerGlobalScope&&"function"===typeof Ha().importScripts}function Ya(){return Ja.apply(this,arguments)}function Ja(){return(Ja=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===navigator||void 0===navigator?void 0:navigator.serviceWorker){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,navigator.serviceWorker.ready;case 5:return t=e.sent,e.abrupt("return",t.active);case 9:return e.prev=9,e.t0=e.catch(2),e.abrupt("return",null);case 12:case"end":return e.stop()}}),e,null,[[2,9]])})))).apply(this,arguments)}function Xa(){var e;return(null===(e=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===e?void 0:e.controller)||null}var $a="firebaseLocalStorageDb",Za="firebaseLocalStorage",eo="fbase_key",to=function(){function e(t){y(this,e),this.request=t}return k(e,[{key:"toPromise",value:function(){var e=this;return new Promise((function(t,n){e.request.addEventListener("success",(function(){t(e.request.result)})),e.request.addEventListener("error",(function(){n(e.request.error)}))}))}}]),e}();function no(e,t){return e.transaction([Za],t?"readwrite":"readonly").objectStore(Za)}function ro(){var e=indexedDB.deleteDatabase($a);return new to(e).toPromise()}function io(){var e=indexedDB.open($a,1);return new Promise((function(t,n){e.addEventListener("error",(function(){n(e.error)})),e.addEventListener("upgradeneeded",(function(){var t=e.result;try{t.createObjectStore(Za,{keyPath:eo})}catch(r){n(r)}})),e.addEventListener("success",u(a().mark((function n(){var r;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if((r=e.result).objectStoreNames.contains(Za)){n.next=12;break}return r.close(),n.next=5,ro();case 5:return n.t0=t,n.next=8,io();case 8:n.t1=n.sent,(0,n.t0)(n.t1),n.next=13;break;case 12:t(r);case 13:case"end":return n.stop()}}),n)}))))}))}function ao(e,t,n){return oo.apply(this,arguments)}function oo(){return oo=u(a().mark((function e(t,n,r){var i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=no(t,!0).put((c(i={},eo,n),c(i,"value",r),i)),e.abrupt("return",new to(o).toPromise());case 2:case"end":return e.stop()}}),e)}))),oo.apply(this,arguments)}function uo(e,t){return so.apply(this,arguments)}function so(){return so=u(a().mark((function e(t,n){var r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=no(t,!1).get(n),e.next=3,new to(r).toPromise();case 3:return i=e.sent,e.abrupt("return",void 0===i?null:i.value);case 5:case"end":return e.stop()}}),e)}))),so.apply(this,arguments)}function co(e,t){var n=no(e,!0).delete(t);return new to(n).toPromise()}var lo=function(){function e(){y(this,e),this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((function(){}),(function(){}))}return k(e,[{key:"_openDb",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.db){e.next=2;break}return e.abrupt("return",this.db);case 2:return e.next=4,io();case 4:return this.db=e.sent,e.abrupt("return",this.db);case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"_withRetries",value:function(){var e=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0;case 1:return e.prev=2,e.next=5,this._openDb();case 5:return r=e.sent,e.next=8,t(r);case 8:return e.abrupt("return",e.sent);case 11:if(e.prev=11,e.t0=e.catch(2),!(n++>3)){e.next=15;break}throw e.t0;case 15:this.db&&(this.db.close(),this.db=void 0);case 16:e.next=1;break;case 18:case"end":return e.stop()}}),e,this,[[2,11]])})));return function(t){return e.apply(this,arguments)}}()},{key:"initializeServiceWorkerMessaging",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Qa()?this.initializeReceiver():this.initializeSender());case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"initializeReceiver",value:function(){var e=u(a().mark((function e(){var t=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.receiver=qa._getInstance(Qa()?self:null),this.receiver._subscribe("keyChanged",function(){var e=u(a().mark((function e(n,r){var i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t._poll();case 2:return i=e.sent,e.abrupt("return",{keyProcessed:i.includes(r.key)});case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),this.receiver._subscribe("ping",function(){var e=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",["keyChanged"]);case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"initializeSender",value:function(){var e=u(a().mark((function e(){var t,n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ya();case 2:if(this.activeServiceWorker=e.sent,this.activeServiceWorker){e.next=5;break}return e.abrupt("return");case 5:return this.sender=new Ga(this.activeServiceWorker),e.next=8,this.sender._send("ping",{},800);case 8:if(r=e.sent){e.next=11;break}return e.abrupt("return");case 11:(null===(t=r[0])||void 0===t?void 0:t.fulfilled)&&(null===(n=r[0])||void 0===n?void 0:n.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0);case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"notifyServiceWorker",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.sender&&this.activeServiceWorker&&Xa()===this.activeServiceWorker){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:case"end":return e.stop()}}),e,this,[[2,7]])})));return function(t){return e.apply(this,arguments)}}()},{key:"_isAvailable",value:function(){var e=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,indexedDB){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,io();case 5:return t=e.sent,e.next=8,ao(t,Ma,"1");case 8:return e.next=10,co(t,Ma);case 10:return e.abrupt("return",!0);case 13:e.prev=13,e.t0=e.catch(0);case 15:return e.abrupt("return",!1);case 16:case"end":return e.stop()}}),e,null,[[0,13]])})));return function(){return e.apply(this,arguments)}}()},{key:"_withPendingWrite",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.pendingWrites++,e.prev=1,e.next=4,t();case 4:return e.prev=4,this.pendingWrites--,e.finish(4);case 7:case"end":return e.stop()}}),e,this,[[1,,4,7]])})));return function(t){return e.apply(this,arguments)}}()},{key:"_set",value:function(){var e=u(a().mark((function e(t,n){var r=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._withPendingWrite(u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r._withRetries((function(e){return ao(e,t,n)}));case 2:return r.localCache[t]=n,e.abrupt("return",r.notifyServiceWorker(t));case 4:case"end":return e.stop()}}),e)})))));case 1:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"_get",value:function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._withRetries((function(e){return uo(e,t)}));case 2:return n=e.sent,this.localCache[t]=n,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_remove",value:function(){var e=u(a().mark((function e(t){var n=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._withPendingWrite(u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n._withRetries((function(e){return co(e,t)}));case 2:return delete n.localCache[t],e.abrupt("return",n.notifyServiceWorker(t));case 4:case"end":return e.stop()}}),e)})))));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_poll",value:function(){var e=u(a().mark((function e(){var t,n,r,i,o,u,s,c,l,f,h;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._withRetries((function(e){var t=no(e,!1).getAll();return new to(t).toPromise()}));case 2:if(t=e.sent){e.next=5;break}return e.abrupt("return",[]);case 5:if(0===this.pendingWrites){e.next=7;break}return e.abrupt("return",[]);case 7:n=[],r=new Set,i=w(t);try{for(i.s();!(o=i.n()).done;)u=o.value,s=u.fbase_key,c=u.value,r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(c)&&(this.notifyListeners(s,c),n.push(s))}catch(a){i.e(a)}finally{i.f()}for(l=0,f=Object.keys(this.localCache);l<f.length;l++)h=f[l],this.localCache[h]&&!r.has(h)&&(this.notifyListeners(h,null),n.push(h));return e.abrupt("return",n);case 13:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"notifyListeners",value:function(e,t){this.localCache[e]=t;var n=this.listeners[e];if(n)for(var r=0,i=Array.from(n);r<i.length;r++){(0,i[r])(t)}}},{key:"startPolling",value:function(){var e=this;this.stopPolling(),this.pollTimer=setInterval(u(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e._poll());case 1:case"end":return t.stop()}}),t)}))),800)}},{key:"stopPolling",value:function(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}},{key:"_addListener",value:function(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}},{key:"_removeListener",value:function(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}]),e}();lo.type="LOCAL";var fo=lo;function ho(e,t){return gn(e,"POST","/v2/accounts/mfaSignIn:start",yn(e,t))}function po(e,t){return gn(e,"POST","/v2/accounts/mfaSignIn:finalize",yn(e,t))}var vo=1e12,mo=function(){function e(t){y(this,e),this.auth=t,this.counter=vo,this._widgets=new Map}return k(e,[{key:"render",value:function(e,t){var n=this.counter;return this._widgets.set(n,new yo(e,this.auth.name,t||{})),this.counter++,n}},{key:"reset",value:function(e){var t,n=e||vo;null===(t=this._widgets.get(n))||void 0===t||t.delete(),this._widgets.delete(n)}},{key:"getResponse",value:function(e){var t,n=e||vo;return(null===(t=this._widgets.get(n))||void 0===t?void 0:t.getResponse())||""}},{key:"execute",value:function(){var e=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t||vo,null===(n=this._widgets.get(r))||void 0===n||n.execute(),e.abrupt("return","");case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()}]),e}(),yo=function(){function e(t,n,r){var i=this;y(this,e),this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=function(){i.execute()};var a="string"===typeof t?document.getElementById(t):t;on(a,"argument-error",{appName:n}),this.container=a,this.isVisible="invisible"!==this.params.size,this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}return k(e,[{key:"getResponse",value:function(){return this.checkIfDeleted(),this.responseToken}},{key:"delete",value:function(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}},{key:"execute",value:function(){var e=this;this.checkIfDeleted(),this.timerId||(this.timerId=window.setTimeout((function(){e.responseToken=function(e){for(var t=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",r=0;r<e;r++)t.push(n.charAt(Math.floor(Math.random()*n.length)));return t.join("")}(50);var t=e.params,n=t.callback,r=t["expired-callback"];if(n)try{n(e.responseToken)}catch(i){}e.timerId=window.setTimeout((function(){if(e.timerId=null,e.responseToken=null,r)try{r()}catch(i){}e.isVisible&&e.execute()}),6e4)}),500))}},{key:"checkIfDeleted",value:function(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}]),e}();var go=Er("rcb"),ko=new hn(3e4,6e4),wo=function(){function e(){var t;y(this,e),this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!(null===(t=Ha().grecaptcha)||void 0===t?void 0:t.render)}return k(e,[{key:"load",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return on(function(e){return e.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(e)}(n),e,"argument-error"),this.shouldResolveImmediately(n)&&Kt(Ha().grecaptcha)?Promise.resolve(Ha().grecaptcha):new Promise((function(r,i){var a=Ha().setTimeout((function(){i(tn(e,"network-request-failed"))}),ko.get());Ha()[go]=function(){Ha().clearTimeout(a),delete Ha()[go];var o=Ha().grecaptcha;if(o&&Kt(o)){var u=o.render;o.render=function(e,n){var r=u(e,n);return t.counter++,r},t.hostLanguage=n,r(o)}else i(tn(e,"internal-error"))},Ir("".concat("https://www.google.com/recaptcha/api.js?","?").concat($({onload:go,render:"explicit",hl:n}))).catch((function(){clearTimeout(a),i(tn(e,"internal-error"))}))}))}},{key:"clearedOneInstance",value:function(){this.counter--}},{key:"shouldResolveImmediately",value:function(e){var t;return!!(null===(t=Ha().grecaptcha)||void 0===t?void 0:t.render)&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}}]),e}();var bo=function(){function e(){y(this,e)}return k(e,[{key:"load",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new mo(t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},{key:"clearedOneInstance",value:function(){}}]),e}(),_o="recaptcha",xo={theme:"light",type:"image"},To=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.assign({},xo);y(this,e),this.parameters=r,this.type=_o,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=xr(t),this.isInvisible="invisible"===this.parameters.size,on("undefined"!==typeof document,this.auth,"operation-not-supported-in-this-environment");var i="string"===typeof n?document.getElementById(n):n;on(i,this.auth,"argument-error"),this.container=i,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new bo:new wo,this.validateStartingState()}return k(e,[{key:"verify",value:function(){var e=u(a().mark((function e(){var t,n,r,i=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertNotDestroyed(),e.next=3,this.render();case 3:if(t=e.sent,n=this.getAssertedRecaptcha(),!(r=n.getResponse(t))){e.next=8;break}return e.abrupt("return",r);case 8:return e.abrupt("return",new Promise((function(e){i.tokenChangeListeners.add((function t(n){n&&(i.tokenChangeListeners.delete(t),e(n))})),i.isInvisible&&n.execute(t)})));case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this;try{this.assertNotDestroyed()}catch(t){return Promise.reject(t)}return this.renderPromise||(this.renderPromise=this.makeRenderPromise().catch((function(t){throw e.renderPromise=null,t}))),this.renderPromise}},{key:"_reset",value:function(){this.assertNotDestroyed(),null!==this.widgetId&&this.getAssertedRecaptcha().reset(this.widgetId)}},{key:"clear",value:function(){var e=this;this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach((function(t){e.container.removeChild(t)}))}},{key:"validateStartingState",value:function(){on(!this.parameters.sitekey,this.auth,"argument-error"),on(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),on("undefined"!==typeof document,this.auth,"operation-not-supported-in-this-environment")}},{key:"makeTokenCallback",value:function(e){var t=this;return function(n){if(t.tokenChangeListeners.forEach((function(e){return e(n)})),"function"===typeof e)e(n);else if("string"===typeof e){var r=Ha()[e];"function"===typeof r&&r(n)}}}},{key:"assertNotDestroyed",value:function(){on(!this.destroyed,this.auth,"internal-error")}},{key:"makeRenderPromise",value:function(){var e=u(a().mark((function e(){var t,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.init();case 2:return this.widgetId||(t=this.container,this.isInvisible||(n=document.createElement("div"),t.appendChild(n),t=n),this.widgetId=this.getAssertedRecaptcha().render(t,this.parameters)),e.abrupt("return",this.widgetId);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"init",value:function(){var e=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return on(ln()&&!Qa(),this.auth,"internal-error"),e.next=3,Io();case 3:return e.next=5,this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);case 5:return this.recaptcha=e.sent,e.next=8,Sn(this.auth);case 8:on(t=e.sent,this.auth,"internal-error"),this.parameters.sitekey=t;case 11:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getAssertedRecaptcha",value:function(){return on(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}]),e}();function Io(){var e=null;return new Promise((function(t){"complete"!==document.readyState?(e=function(){return t()},window.addEventListener("load",e)):t()})).catch((function(t){throw e&&window.removeEventListener("load",e),t}))}var Eo=function(){function e(t,n){y(this,e),this.verificationId=t,this.onConfirmation=n}return k(e,[{key:"confirm",value:function(e){var t=hi._fromVerification(this.verificationId,e);return this.onConfirmation(t)}}]),e}();function So(){return(So=u(a().mark((function e(t,n,r){var i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=xr(t),e.next=3,Po(i,n,ie(r));case 3:return o=e.sent,e.abrupt("return",new Eo(o,(function(e){return Bi(i,e)})));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Co(e,t,n){return Ao.apply(this,arguments)}function Ao(){return(Ao=u(a().mark((function e(t,n,r){var i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=ie(t),e.next=3,Mi(!1,i,"phone");case 3:return e.next=5,Po(i.auth,n,ie(r));case 5:return o=e.sent,e.abrupt("return",new Eo(o,(function(e){return Ki(i,e)})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function No(){return(No=u(a().mark((function e(t,n,r){var i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=ie(t),e.next=3,Po(i.auth,n,ie(r));case 3:return o=e.sent,e.abrupt("return",new Eo(o,(function(e){return Hi(i,e)})));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Po(e,t,n){return Do.apply(this,arguments)}function Do(){return(Do=u(a().mark((function e(t,n,r){var i,o,u,s,c,l,f,h,d;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.verify();case 2:if(o=e.sent,e.prev=3,on("string"===typeof o,t,"argument-error"),on(r.type===_o,t,"argument-error"),!("session"in(u="string"===typeof n?{phoneNumber:n}:n))){e.next=26;break}if(s=u.session,!("phoneNumber"in u)){e.next=17;break}return on("enroll"===s.type,t,"internal-error"),e.next=13,Da(t,{idToken:s.credential,phoneEnrollmentInfo:{phoneNumber:u.phoneNumber,recaptchaToken:o}});case 13:return c=e.sent,e.abrupt("return",c.phoneSessionInfo.sessionInfo);case 17:return on("signin"===s.type,t,"internal-error"),on(l=(null===(i=u.multiFactorHint)||void 0===i?void 0:i.uid)||u.multiFactorUid,t,"missing-multi-factor-info"),e.next=22,ho(t,{mfaPendingCredential:s.credential,mfaEnrollmentId:l,phoneSignInInfo:{recaptchaToken:o}});case 22:return f=e.sent,e.abrupt("return",f.phoneResponseInfo.sessionInfo);case 24:e.next=31;break;case 26:return e.next=28,oi(t,{phoneNumber:u.phoneNumber,recaptchaToken:o});case 28:return h=e.sent,d=h.sessionInfo,e.abrupt("return",d);case 31:return e.prev=31,r._reset(),e.finish(31);case 34:case"end":return e.stop()}}),e,null,[[3,,31,34]])})))).apply(this,arguments)}function Ro(){return(Ro=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Oi(ie(t),n);case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Oo=function(){function e(t){y(this,e),this.providerId=e.PROVIDER_ID,this.auth=xr(t)}return k(e,[{key:"verifyPhoneNumber",value:function(e,t){return Po(this.auth,e,ie(t))}}],[{key:"credential",value:function(e,t){return hi._fromVerification(e,t)}},{key:"credentialFromResult",value:function(t){var n=t;return e.credentialFromTaggedObject(n)}},{key:"credentialFromError",value:function(t){return e.credentialFromTaggedObject(t.customData||{})}},{key:"credentialFromTaggedObject",value:function(e){var t=e._tokenResponse;if(!t)return null;var n=t.phoneNumber,r=t.temporaryProof;return n&&r?hi._fromTokenResponse(n,r):null}}]),e}();function Lo(e,t){return t?nr(t):(on(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}Oo.PROVIDER_ID="phone",Oo.PHONE_SIGN_IN_METHOD="phone";var Mo=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this,"custom","custom")).params=e,r}return k(n,[{key:"_getIdTokenResponse",value:function(e){return ri(e,this._buildIdpRequest())}},{key:"_linkToIdToken",value:function(e,t){return ri(e,this._buildIdpRequest(t))}},{key:"_getReauthenticationResolver",value:function(e){return ri(e,this._buildIdpRequest())}},{key:"_buildIdpRequest",value:function(e){var t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}]),n}(Rr);function Fo(e){return ji(e.auth,new Mo(e),e.bypassAuthState)}function Vo(e){var t=e.auth,n=e.user;return on(n,t,"internal-error"),Vi(n,new Mo(e),e.bypassAuthState)}function Uo(e){return jo.apply(this,arguments)}function jo(){return(jo=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.auth,on(r=t.user,n,"internal-error"),e.abrupt("return",Oi(r,new Mo(t),t.bypassAuthState));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var zo=function(){function e(t,n,r,i){var a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];y(this,e),this.auth=t,this.resolver=r,this.user=i,this.bypassAuthState=a,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}return k(e,[{key:"execute",value:function(){var e=this;return new Promise(function(){var t=u(a().mark((function t(n,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.pendingPromise={resolve:n,reject:r},t.prev=1,t.next=4,e.resolver._initialize(e.auth);case 4:return e.eventManager=t.sent,t.next=7,e.onExecution();case 7:e.eventManager.registerConsumer(e),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(1),e.reject(t.t0);case 13:case"end":return t.stop()}}),t,null,[[1,10]])})));return function(e,n){return t.apply(this,arguments)}}())}},{key:"onAuthEvent",value:function(){var e=u(a().mark((function e(t){var n,r,i,o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.urlResponse,r=t.sessionId,i=t.postBody,o=t.tenantId,u=t.error,s=t.type,!u){e.next=4;break}return this.reject(u),e.abrupt("return");case 4:return c={auth:this.auth,requestUri:n,sessionId:r,tenantId:o||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState},e.prev=5,e.t0=this,e.next=9,this.getIdpTask(s)(c);case 9:e.t1=e.sent,e.t0.resolve.call(e.t0,e.t1),e.next=16;break;case 13:e.prev=13,e.t2=e.catch(5),this.reject(e.t2);case 16:case"end":return e.stop()}}),e,this,[[5,13]])})));return function(t){return e.apply(this,arguments)}}()},{key:"onError",value:function(e){this.reject(e)}},{key:"getIdpTask",value:function(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Fo;case"linkViaPopup":case"linkViaRedirect":return Uo;case"reauthViaPopup":case"reauthViaRedirect":return Vo;default:en(this.auth,"internal-error")}}},{key:"resolve",value:function(e){sn(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}},{key:"reject",value:function(e){sn(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}},{key:"unregisterAndCleanUp",value:function(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}]),e}(),Bo=new hn(2e3,1e4);function qo(e,t,n){return Ko.apply(this,arguments)}function Ko(){return(Ko=u(a().mark((function e(t,n,r){var i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=xr(t),rn(t,n,vi),o=Lo(i,r),u=new Qo(i,"signInViaPopup",n,o),e.abrupt("return",u.executeNotNull());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Go(){return(Go=u(a().mark((function e(t,n,r){var i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return rn((i=ie(t)).auth,n,vi),o=Lo(i.auth,r),u=new Qo(i.auth,"reauthViaPopup",n,o,i),e.abrupt("return",u.executeNotNull());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ho(e,t,n){return Wo.apply(this,arguments)}function Wo(){return(Wo=u(a().mark((function e(t,n,r){var i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return rn((i=ie(t)).auth,n,vi),o=Lo(i.auth,r),u=new Qo(i.auth,"linkViaPopup",n,o,i),e.abrupt("return",u.executeNotNull());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Qo=function(e){x(n,e);var t=E(n);function n(e,r,i,a,o){var u;return y(this,n),(u=t.call(this,e,r,a,o)).provider=i,u.authWindow=null,u.pollId=null,n.currentPopupAction&&n.currentPopupAction.cancel(),n.currentPopupAction=b(u),u}return k(n,[{key:"executeNotNull",value:function(){var e=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.execute();case 2:return on(t=e.sent,this.auth,"internal-error"),e.abrupt("return",t);case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"onExecution",value:function(){var e=u(a().mark((function e(){var t,n=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return sn(1===this.filter.length,"Popup operations only handle one event"),t=Ka(),e.next=4,this.resolver._openPopup(this.auth,this.provider,this.filter[0],t);case 4:this.authWindow=e.sent,this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((function(e){n.reject(e)})),this.resolver._isIframeWebStorageSupported(this.auth,(function(e){e||n.reject(tn(n.auth,"web-storage-unsupported"))})),this.pollUserCancellation();case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"eventId",get:function(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}},{key:"cancel",value:function(){this.reject(tn(this.auth,"cancelled-popup-request"))}},{key:"cleanUp",value:function(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,n.currentPopupAction=null}},{key:"pollUserCancellation",value:function(){var e=this;!function t(){var n,r;(null===(r=null===(n=e.authWindow)||void 0===n?void 0:n.window)||void 0===r?void 0:r.closed)?e.pollId=window.setTimeout((function(){e.pollId=null,e.reject(tn(e.auth,"popup-closed-by-user"))}),8e3):e.pollId=window.setTimeout(t,Bo.get())}()}}]),n}(zo);Qo.currentPopupAction=null;var Yo="pendingRedirect",Jo=new Map,Xo=function(e){x(n,e);var t=E(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return y(this,n),(i=t.call(this,e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],r,void 0,a)).eventId=null,i}return k(n,[{key:"execute",value:function(){var e=u(a().mark((function e(){var t,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Jo.get(this.auth._key())){e.next=21;break}return e.prev=2,e.next=5,$o(this.resolver,this.auth);case 5:if(!e.sent){e.next=12;break}return e.next=9,Ot(T(n.prototype),"execute",this).call(this);case 9:e.t0=e.sent,e.next=13;break;case 12:e.t0=null;case 13:r=e.t0,t=function(){return Promise.resolve(r)},e.next=20;break;case 17:e.prev=17,e.t1=e.catch(2),t=function(){return Promise.reject(e.t1)};case 20:Jo.set(this.auth._key(),t);case 21:return this.bypassAuthState||Jo.set(this.auth._key(),(function(){return Promise.resolve(null)})),e.abrupt("return",t());case 23:case"end":return e.stop()}}),e,this,[[2,17]])})));return function(){return e.apply(this,arguments)}}()},{key:"onAuthEvent",value:function(){var e=u(a().mark((function e(t){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("signInViaRedirect"!==t.type){e.next=4;break}return e.abrupt("return",Ot(T(n.prototype),"onAuthEvent",this).call(this,t));case 4:if("unknown"!==t.type){e.next=7;break}return this.resolve(null),e.abrupt("return");case 7:if(!t.eventId){e.next=17;break}return e.next=10,this.auth._redirectUserForId(t.eventId);case 10:if(!(r=e.sent)){e.next=16;break}return this.user=r,e.abrupt("return",Ot(T(n.prototype),"onAuthEvent",this).call(this,t));case 16:this.resolve(null);case 17:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"onExecution",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()},{key:"cleanUp",value:function(){}}]),n}(zo);function $o(e,t){return Zo.apply(this,arguments)}function Zo(){return(Zo=u(a().mark((function e(t,n){var r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=iu(n),i=ru(t),e.next=4,i._isAvailable();case 4:if(e.sent){e.next=6;break}return e.abrupt("return",!1);case 6:return e.next=8,i._get(r);case 8:return e.t0=e.sent,o="true"===e.t0,e.next=12,i._remove(r);case 12:return e.abrupt("return",o);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function eu(e,t){return tu.apply(this,arguments)}function tu(){return(tu=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ru(t)._set(iu(n),"true"));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nu(e,t){Jo.set(e._key(),t)}function ru(e){return nr(e._redirectPersistence)}function iu(e){return ar(Yo,e.config.apiKey,e.name)}function au(e,t,n){return function(e,t,n){return ou.apply(this,arguments)}(e,t,n)}function ou(){return(ou=u(a().mark((function e(t,n,r){var i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=xr(t),rn(t,n,vi),e.next=4,i._initializationPromise;case 4:return o=Lo(i,r),e.next=7,eu(o,i);case 7:return e.abrupt("return",o._openRedirect(i,n,"signInViaRedirect"));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function uu(e,t,n){return function(e,t,n){return su.apply(this,arguments)}(e,t,n)}function su(){return(su=u(a().mark((function e(t,n,r){var i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return rn((i=ie(t)).auth,n,vi),e.next=4,i.auth._initializationPromise;case 4:return o=Lo(i.auth,r),e.next=7,eu(o,i.auth);case 7:return e.next=9,vu(i);case 9:return u=e.sent,e.abrupt("return",o._openRedirect(i.auth,n,"reauthViaRedirect",u));case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function cu(e,t,n){return function(e,t,n){return lu.apply(this,arguments)}(e,t,n)}function lu(){return(lu=u(a().mark((function e(t,n,r){var i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return rn((i=ie(t)).auth,n,vi),e.next=4,i.auth._initializationPromise;case 4:return o=Lo(i.auth,r),e.next=7,Mi(!1,i,n.providerId);case 7:return e.next=9,eu(o,i.auth);case 9:return e.next=11,vu(i);case 11:return u=e.sent,e.abrupt("return",o._openRedirect(i.auth,n,"linkViaRedirect",u));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fu(e,t){return hu.apply(this,arguments)}function hu(){return(hu=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,xr(t)._initializationPromise;case 2:return e.abrupt("return",du(t,n,!1));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function du(e,t){return pu.apply(this,arguments)}function pu(){return pu=u(a().mark((function e(t,n){var r,i,o,u,s,c=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=c.length>2&&void 0!==c[2]&&c[2],i=xr(t),o=Lo(i,n),u=new Xo(i,o,r),e.next=6,u.execute();case 6:if(!(s=e.sent)||r){e.next=13;break}return delete s.user._redirectEventId,e.next=11,i._persistUserIfCurrent(s.user);case 11:return e.next=13,i._setRedirectUser(null,n);case 13:return e.abrupt("return",s);case 14:case"end":return e.stop()}}),e)}))),pu.apply(this,arguments)}function vu(e){return mu.apply(this,arguments)}function mu(){return(mu=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Ka("".concat(t.uid,":::")),t._redirectEventId=n,e.next=4,t.auth._setRedirectUser(t);case 4:return e.next=6,t.auth._persistUserIfCurrent(t);case 6:return e.abrupt("return",n);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var yu=function(){function e(t){y(this,e),this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}return k(e,[{key:"registerConsumer",value:function(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}},{key:"unregisterConsumer",value:function(e){this.consumers.delete(e)}},{key:"onEvent",value:function(e){var t=this;if(this.hasEventBeenHandled(e))return!1;var n=!1;return this.consumers.forEach((function(r){t.isEventForConsumer(e,r)&&(n=!0,t.sendToConsumer(e,r),t.saveEventToCache(e))})),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return ku(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}},{key:"sendToConsumer",value:function(e,t){var n;if(e.error&&!ku(e)){var r=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(tn(this.auth,r))}else t.onAuthEvent(e)}},{key:"isEventForConsumer",value:function(e,t){var n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}},{key:"hasEventBeenHandled",value:function(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(gu(e))}},{key:"saveEventToCache",value:function(e){this.cachedEventUids.add(gu(e)),this.lastProcessedEventTime=Date.now()}}]),e}();function gu(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((function(e){return e})).join("-")}function ku(e){var t=e.type,n=e.error;return"unknown"===t&&(null===n||void 0===n?void 0:n.code)==="auth/".concat("no-auth-event")}function wu(e){return bu.apply(this,arguments)}function bu(){return bu=u(a().mark((function e(t){var n,r=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},e.abrupt("return",gn(t,"GET","/v1/projects",n));case 2:case"end":return e.stop()}}),e)}))),bu.apply(this,arguments)}var _u=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,xu=/^https?/;function Tu(){return(Tu=u(a().mark((function e(t){var n,r,i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.config.emulator){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,wu(t);case 4:n=e.sent,r=n.authorizedDomains,i=w(r),e.prev=7,i.s();case 9:if((o=i.n()).done){e.next=20;break}if(u=o.value,e.prev=11,!Iu(u)){e.next=14;break}return e.abrupt("return");case 14:e.next=18;break;case 16:e.prev=16,e.t0=e.catch(11);case 18:e.next=9;break;case 20:e.next=25;break;case 22:e.prev=22,e.t1=e.catch(7),i.e(e.t1);case 25:return e.prev=25,i.f(),e.finish(25);case 28:en(t,"unauthorized-domain");case 29:case"end":return e.stop()}}),e,null,[[7,22,25,28],[11,16]])})))).apply(this,arguments)}function Iu(e){var t=cn(),n=new URL(t),r=n.protocol,i=n.hostname;if(e.startsWith("chrome-extension://")){var a=new URL(e);return""===a.hostname&&""===i?"chrome-extension:"===r&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===r&&a.hostname===i}if(!xu.test(r))return!1;if(_u.test(e))return i===e;var o=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+o+"|"+o+")$","i").test(i)}var Eu=new hn(3e4,6e4);function Su(){var e=Ha().___jsl;if(null===e||void 0===e?void 0:e.H)for(var t=0,n=Object.keys(e.H);t<n.length;t++){var r=n[t];if(e.H[r].r=e.H[r].r||[],e.H[r].L=e.H[r].L||[],e.H[r].r=oe(e.H[r].L),e.CP)for(var i=0;i<e.CP.length;i++)e.CP[i]=null}}var Cu=null;function Au(e){return Cu=Cu||function(e){return new Promise((function(t,n){var r,i,a;function o(){Su(),gapi.load("gapi.iframes",{callback:function(){t(gapi.iframes.getContext())},ontimeout:function(){Su(),n(tn(e,"network-request-failed"))},timeout:Eu.get()})}if(null===(i=null===(r=Ha().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)t(gapi.iframes.getContext());else{if(!(null===(a=Ha().gapi)||void 0===a?void 0:a.load)){var u=Er("iframefcb");return Ha()[u]=function(){gapi.load?o():n(tn(e,"network-request-failed"))},Ir("https://apis.google.com/js/api.js?onload=".concat(u)).catch((function(e){return n(e)}))}o()}})).catch((function(e){throw Cu=null,e}))}(e),Cu}var Nu=new hn(5e3,15e3),Pu="__/auth/iframe",Du="emulator/auth/iframe",Ru={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ou=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Lu(e){var t=e.config;on(t.authDomain,e,"auth-domain-config-required");var n=t.emulator?dn(t,Du):"https://".concat(e.config.authDomain,"/").concat(Pu),r={apiKey:t.apiKey,appName:e.name,v:tt},i=Ou.get(e.config.apiHost);i&&(r.eid=i);var a=e._getFrameworks();return a.length&&(r.fw=a.join(",")),"".concat(n,"?").concat($(r).slice(1))}function Mu(e){return Fu.apply(this,arguments)}function Fu(){return Fu=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Au(t);case 2:return n=e.sent,on(r=Ha().gapi,t,"internal-error"),e.abrupt("return",n.open({where:document.body,url:Lu(t),messageHandlersFilter:r.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Ru,dontclear:!0},(function(e){return new Promise(function(){var n=u(a().mark((function n(r,i){var o,u,s;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return s=function(){Ha().clearTimeout(u),r(e)},n.next=3,e.restyle({setHideOnLeave:!1});case 3:o=tn(t,"network-request-failed"),u=Ha().setTimeout((function(){i(o)}),Nu.get()),e.ping(s).then(s,(function(){i(o)}));case 6:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}())})));case 6:case"end":return e.stop()}}),e)}))),Fu.apply(this,arguments)}var Vu={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Uu=function(){function e(t){y(this,e),this.window=t,this.associatedEvent=null}return k(e,[{key:"close",value:function(){if(this.window)try{this.window.close()}catch(e){}}}]),e}();function ju(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:500,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:600,a=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString(),u="",s=Object.assign(Object.assign({},Vu),{width:r.toString(),height:i.toString(),top:a,left:o}),c=U().toLowerCase();n&&(u=lr(c)?"_blank":n),sr(c)&&(t=t||"http://localhost",s.scrollbars="yes");var l=Object.entries(s).reduce((function(e,t){var n=m(t,2),r=n[0],i=n[1];return"".concat(e).concat(r,"=").concat(i,",")}),"");if(function(){var e;return vr(arguments.length>0&&void 0!==arguments[0]?arguments[0]:U())&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(c)&&"_self"!==u)return function(e,t){var n=document.createElement("a");n.href=e,n.target=t;var r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",u),new Uu(null);var f=window.open(t||"",u,l);on(f,e,"popup-blocked");try{f.focus()}catch(h){}return new Uu(f)}var zu="__/auth/handler",Bu="emulator/auth/handler",qu=encodeURIComponent("fac");function Ku(e,t,n,r,i,a){return Gu.apply(this,arguments)}function Gu(){return(Gu=u(a().mark((function e(t,n,r,i,o,u){var s,c,l,f,h,d,p,v,y,g,k,w,b;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(on(t.config.authDomain,t,"auth-domain-config-required"),on(t.config.apiKey,t,"invalid-api-key"),s={apiKey:t.config.apiKey,appName:t.name,authType:r,redirectUrl:i,v:tt,eventId:o},n instanceof vi)for(n.setDefaultLanguage(t.languageCode),s.providerId=n.providerId||"",Y(n.getCustomParameters())||(s.customParameters=JSON.stringify(n.getCustomParameters())),c=0,l=Object.entries(u||{});c<l.length;c++)f=m(l[c],2),h=f[0],d=f[1],s[h]=d;for(n instanceof mi&&(p=n.getScopes().filter((function(e){return""!==e}))).length>0&&(s.scopes=p.join(",")),t.tenantId&&(s.tid=t.tenantId),v=s,y=0,g=Object.keys(v);y<g.length;y++)k=g[y],void 0===v[k]&&delete v[k];return e.next=10,t._getAppCheckToken();case 10:return w=e.sent,b=w?"#".concat(qu,"=").concat(encodeURIComponent(w)):"",e.abrupt("return","".concat(Hu(t),"?").concat($(v).slice(1)).concat(b));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Hu(e){var t=e.config;return t.emulator?dn(t,Bu):"https://".concat(t.authDomain,"/").concat(zu)}var Wu="webStorageSupport",Qu=function(){function e(){y(this,e),this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=za,this._completeRedirectFn=du,this._overrideRedirectResult=nu}return k(e,[{key:"_openPopup",value:function(){var e=u(a().mark((function e(t,n,r,i){var o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return sn(null===(o=this.eventManagers[t._key()])||void 0===o?void 0:o.manager,"_initialize() not called before _openPopup()"),e.next=3,Ku(t,n,r,cn(),i);case 3:return u=e.sent,e.abrupt("return",ju(t,u,Ka()));case 5:case"end":return e.stop()}}),e,this)})));return function(t,n,r,i){return e.apply(this,arguments)}}()},{key:"_openRedirect",value:function(){var e=u(a().mark((function e(t,n,r,i){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._originValidation(t);case 2:return e.next=4,Ku(t,n,r,cn(),i);case 4:return Wa(e.sent),e.abrupt("return",new Promise((function(){})));case 7:case"end":return e.stop()}}),e,this)})));return function(t,n,r,i){return e.apply(this,arguments)}}()},{key:"_initialize",value:function(e){var t=this,n=e._key();if(this.eventManagers[n]){var r=this.eventManagers[n],i=r.manager,a=r.promise;return i?Promise.resolve(i):(sn(a,"If manager is not set, promise should be"),a)}var o=this.initAndGetManager(e);return this.eventManagers[n]={promise:o},o.catch((function(){delete t.eventManagers[n]})),o}},{key:"initAndGetManager",value:function(){var e=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Mu(t);case 2:return n=e.sent,r=new yu(t),n.register("authEvent",(function(e){return on(null===e||void 0===e?void 0:e.authEvent,t,"invalid-auth-event"),{status:r.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:r},this.iframes[t._key()]=n,e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_isIframeWebStorageSupported",value:function(e,t){this.iframes[e._key()].send(Wu,{type:Wu},(function(n){var r,i=null===(r=null===n||void 0===n?void 0:n[0])||void 0===r?void 0:r[Wu];void 0!==i&&t(!!i),en(e,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}},{key:"_originValidation",value:function(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=function(e){return Tu.apply(this,arguments)}(e)),this.originValidationPromises[t]}},{key:"_shouldInitProactively",get:function(){return mr()||cr()||vr()}}]),e}(),Yu=Qu,Ju=function(){function e(t){y(this,e),this.factorId=t}return k(e,[{key:"_process",value:function(e,t,n){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,n);case"signin":return this._finalizeSignIn(e,t.credential);default:return un("unexpected MultiFactorSessionType")}}}]),e}(),Xu=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this,"phone")).credential=e,r}return k(n,[{key:"_finalizeEnroll",value:function(e,t,n){return function(e,t){return gn(e,"POST","/v2/accounts/mfaEnrollment:finalize",yn(e,t))}(e,{idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},{key:"_finalizeSignIn",value:function(e,t){return function(e,t){return gn(e,"POST","/v2/accounts/mfaSignIn:finalize",yn(e,t))}(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}}],[{key:"_fromCredential",value:function(e){return new n(e)}}]),n}(Ju),$u=function(){function e(){y(this,e)}return k(e,null,[{key:"assertion",value:function(e){return Xu._fromCredential(e)}}]),e}();$u.FACTOR_ID="phone";var Zu=function(){function e(){y(this,e)}return k(e,null,[{key:"assertionForEnrollment",value:function(e,t){return es._fromSecret(e,t)}},{key:"assertionForSignIn",value:function(e,t){return es._fromEnrollmentId(e,t)}},{key:"generateSecret",value:function(){var e=u(a().mark((function e(t){var n,r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return on("undefined"!==typeof(null===(n=(r=t).user)||void 0===n?void 0:n.auth),"internal-error"),e.next=4,a=r.user.auth,o={idToken:r.credential,totpEnrollmentInfo:{}},gn(a,"POST","/v2/accounts/mfaEnrollment:start",yn(a,o));case 4:return i=e.sent,e.abrupt("return",ts._fromStartTotpMfaEnrollmentResponse(i,r.user.auth));case 6:case"end":return e.stop()}var a,o}),e)})));return function(t){return e.apply(this,arguments)}}()}]),e}();Zu.FACTOR_ID="totp";var es=function(e){x(n,e);var t=E(n);function n(e,r,i){var a;return y(this,n),(a=t.call(this,"totp")).otp=e,a.enrollmentId=r,a.secret=i,a}return k(n,[{key:"_finalizeEnroll",value:function(){var e=u(a().mark((function e(t,n,r){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return on("undefined"!==typeof this.secret,t,"argument-error"),e.abrupt("return",Ra(t,{idToken:n,displayName:r,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)}));case 2:case"end":return e.stop()}}),e,this)})));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"_finalizeSignIn",value:function(){var e=u(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return on(void 0!==this.enrollmentId&&void 0!==this.otp,t,"argument-error"),r={verificationCode:this.otp},e.abrupt("return",po(t,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:r}));case 3:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()}],[{key:"_fromSecret",value:function(e,t){return new n(t,void 0,e)}},{key:"_fromEnrollmentId",value:function(e,t){return new n(t,e)}}]),n}(Ju),ts=function(){function e(t,n,r,i,a,o,u){y(this,e),this.sessionInfo=o,this.auth=u,this.secretKey=t,this.hashingAlgorithm=n,this.codeLength=r,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=a}return k(e,[{key:"_makeTotpVerificationInfo",value:function(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}},{key:"generateQrCodeUrl",value:function(e,t){var n,r=!1;return(ns(e)||ns(t))&&(r=!0),r&&(ns(e)&&(e=(null===(n=this.auth.currentUser)||void 0===n?void 0:n.email)||"unknownuser"),ns(t)&&(t=this.auth.name)),"otpauth://totp/".concat(t,":").concat(e,"?secret=").concat(this.secretKey,"&issuer=").concat(t,"&algorithm=").concat(this.hashingAlgorithm,"&digits=").concat(this.codeLength)}}],[{key:"_fromStartTotpMfaEnrollmentResponse",value:function(t,n){return new e(t.totpSessionInfo.sharedSecretKey,t.totpSessionInfo.hashingAlgorithm,t.totpSessionInfo.verificationCodeLength,t.totpSessionInfo.periodSec,new Date(t.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),t.totpSessionInfo.sessionInfo,n)}}]),e}();function ns(e){return"undefined"===typeof e||0===(null===e||void 0===e?void 0:e.length)}var rs="@firebase/auth",is="1.3.0",as=function(){function e(t){y(this,e),this.auth=t,this.internalListeners=new Map}return k(e,[{key:"getUid",value:function(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}},{key:"getToken",value:function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.assertAuthConfigured(),e.next=3,this.auth._initializationPromise;case 3:if(this.auth.currentUser){e.next=5;break}return e.abrupt("return",null);case 5:return e.next=7,this.auth.currentUser.getIdToken(t);case 7:return n=e.sent,e.abrupt("return",{accessToken:n});case 9:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"addAuthTokenListener",value:function(e){if(this.assertAuthConfigured(),!this.internalListeners.has(e)){var t=this.auth.onIdTokenChanged((function(t){e((null===t||void 0===t?void 0:t.stsTokenManager.accessToken)||null)}));this.internalListeners.set(e,t),this.updateProactiveRefresh()}}},{key:"removeAuthTokenListener",value:function(e){this.assertAuthConfigured();var t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}},{key:"assertAuthConfigured",value:function(){on(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}},{key:"updateProactiveRefresh",value:function(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}]),e}();var os;!function(e){var t;null===(t=M())||void 0===t||t["_".concat(e)]}("authIdTokenMaxAge");function us(){return window}os="Browser",Qe(new ue("auth",(function(e,t){var n=t.options,r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),a=e.getProvider("app-check-internal"),o=r.options,u=o.apiKey,s=o.authDomain;on(u&&!u.includes(":"),"invalid-api-key",{appName:r.name});var c={apiKey:u,authDomain:s,clientPlatform:os,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:yr(os)},l=new _r(r,i,a,c);return function(e,t){var n=(null===t||void 0===t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(nr);(null===t||void 0===t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null===t||void 0===t?void 0:t.popupRedirectResolver)}(l,n),l}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((function(e,t,n){e.getProvider("auth-internal").initialize()}))),Qe(new ue("auth-internal",(function(e){return function(e){return new as(e)}(xr(e.getProvider("auth").getImmediate()))}),"PRIVATE").setInstantiationMode("EXPLICIT")),ut(rs,is,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(os)),ut(rs,is,"esm2017");var ss=2e3;function cs(e,t,n){return ls.apply(this,arguments)}function ls(){return(ls=u(a().mark((function e(t,n,r){var i,o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=us(),u=o.BuildInfo,sn(n.sessionId,"AuthEvent did not contain a session ID"),e.next=4,ms(n.sessionId);case 4:return s=e.sent,c={},vr()?c.ibi=u.packageName:hr()?c.apn=u.packageName:en(t,"operation-not-supported-in-this-environment"),u.displayName&&(c.appDisplayName=u.displayName),c.sessionId=s,e.abrupt("return",Ku(t,r,n.type,void 0,null!==(i=n.eventId)&&void 0!==i?i:void 0,c));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fs(){return(fs=u(a().mark((function e(t){var n,r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=us(),r=n.BuildInfo,i={},vr()?i.iosBundleId=r.packageName:hr()?i.androidPackageName=r.packageName:en(t,"operation-not-supported-in-this-environment"),e.next=5,wu(t,i);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function hs(e){var t=us().cordova;return new Promise((function(n){t.plugins.browsertab.isAvailable((function(r){var i=null;r?t.plugins.browsertab.openUrl(e):i=t.InAppBrowser.open(e,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return/(iPad|iPhone|iPod).*OS 7_\d/i.test(e)||/(iPad|iPhone|iPod).*OS 8_\d/i.test(e)}()?"_blank":"_system","location=yes"),n(i)}))}))}function ds(e,t,n){return ps.apply(this,arguments)}function ps(){return(ps=u(a().mark((function e(t,n,r){var i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=us(),o=i.cordova,u=function(){},e.prev=2,e.next=5,new Promise((function(e,i){var a=null;function s(){var t;e();var n=null===(t=o.plugins.browsertab)||void 0===t?void 0:t.close;"function"===typeof n&&n(),"function"===typeof(null===r||void 0===r?void 0:r.close)&&r.close()}function c(){a||(a=window.setTimeout((function(){i(tn(t,"redirect-cancelled-by-user"))}),ss))}function l(){"visible"===(null===document||void 0===document?void 0:document.visibilityState)&&c()}n.addPassiveListener(s),document.addEventListener("resume",c,!1),hr()&&document.addEventListener("visibilitychange",l,!1),u=function(){n.removePassiveListener(s),document.removeEventListener("resume",c,!1),document.removeEventListener("visibilitychange",l,!1),a&&window.clearTimeout(a)}}));case 5:return e.prev=5,u(),e.finish(5);case 8:case"end":return e.stop()}}),e,null,[[2,,5,8]])})))).apply(this,arguments)}function vs(e){var t,n,r,i,a,o,u,s,c,l,f=us();on("function"===typeof(null===(t=null===f||void 0===f?void 0:f.universalLinks)||void 0===t?void 0:t.subscribe),e,"invalid-cordova-configuration",{missingPlugin:"cordova-universal-links-plugin-fix"}),on("undefined"!==typeof(null===(n=null===f||void 0===f?void 0:f.BuildInfo)||void 0===n?void 0:n.packageName),e,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-buildInfo"}),on("function"===typeof(null===(a=null===(i=null===(r=null===f||void 0===f?void 0:f.cordova)||void 0===r?void 0:r.plugins)||void 0===i?void 0:i.browsertab)||void 0===a?void 0:a.openUrl),e,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),on("function"===typeof(null===(s=null===(u=null===(o=null===f||void 0===f?void 0:f.cordova)||void 0===o?void 0:o.plugins)||void 0===u?void 0:u.browsertab)||void 0===s?void 0:s.isAvailable),e,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),on("function"===typeof(null===(l=null===(c=null===f||void 0===f?void 0:f.cordova)||void 0===c?void 0:c.InAppBrowser)||void 0===l?void 0:l.open),e,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-inappbrowser"})}function ms(e){return ys.apply(this,arguments)}function ys(){return(ys=u(a().mark((function e(t){var n,r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=gs(t),e.next=3,crypto.subtle.digest("SHA-256",n);case 3:return r=e.sent,i=Array.from(new Uint8Array(r)),e.abrupt("return",i.map((function(e){return e.toString(16).padStart(2,"0")})).join(""));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gs(e){if(sn(/[0-9a-zA-Z]+/.test(e),"Can only convert alpha-numeric strings"),"undefined"!==typeof TextEncoder)return(new TextEncoder).encode(e);for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}var ks=20,ws=function(e){x(n,e);var t=E(n);function n(){var e;return y(this,n),(e=t.apply(this,arguments)).passiveListeners=new Set,e.initPromise=new Promise((function(t){e.resolveInialized=t})),e}return k(n,[{key:"addPassiveListener",value:function(e){this.passiveListeners.add(e)}},{key:"removePassiveListener",value:function(e){this.passiveListeners.delete(e)}},{key:"resetRedirect",value:function(){this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1}},{key:"onEvent",value:function(e){return this.resolveInialized(),this.passiveListeners.forEach((function(t){return t(e)})),Ot(T(n.prototype),"onEvent",this).call(this,e)}},{key:"initialized",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.initPromise;case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()}]),n}(yu);function bs(e,t){return{type:t,eventId:arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,urlResponse:null,sessionId:Es(),postBody:null,tenantId:e.tenantId,error:tn(e,"no-auth-event")}}function _s(e,t){return Ss()._set(Cs(e),t)}function xs(e){return Ts.apply(this,arguments)}function Ts(){return(Ts=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ss()._get(Cs(t));case 2:if(!(n=e.sent)){e.next=6;break}return e.next=6,Ss()._remove(Cs(t));case 6:return e.abrupt("return",n);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Is(e,t){var n,r,i=function(e){var t=As(e),n=t.link?decodeURIComponent(t.link):void 0,r=As(n).link,i=t.deep_link_id?decodeURIComponent(t.deep_link_id):void 0;return As(i).link||i||r||n||e}(t);if(i.includes("/__/auth/callback")){var a=As(i),o=a.firebaseError?function(e){try{return JSON.parse(e)}catch(t){return null}}(decodeURIComponent(a.firebaseError)):null,u=null===(r=null===(n=null===o||void 0===o?void 0:o.code)||void 0===n?void 0:n.split("auth/"))||void 0===r?void 0:r[1],s=u?tn(u):null;return s?{type:e.type,eventId:e.eventId,tenantId:e.tenantId,error:s,urlResponse:null,sessionId:null,postBody:null}:{type:e.type,eventId:e.eventId,tenantId:e.tenantId,sessionId:e.sessionId,urlResponse:i,postBody:null}}return null}function Es(){for(var e=[],t="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=0;n<ks;n++){var r=Math.floor(62*Math.random());e.push(t.charAt(r))}return e.join("")}function Ss(){return nr(Ua)}function Cs(e){return ar("authEvent",e.config.apiKey,e.name)}function As(e){if(!(null===e||void 0===e?void 0:e.includes("?")))return{};var t,n=e.split("?"),r=h(t=n)||ae(t)||p(t)||v();r[0];return Z(r.slice(1).join("?"))}var Ns=function(){function e(){y(this,e),this._redirectPersistence=za,this._shouldInitProactively=!0,this.eventManagers=new Map,this.originValidationPromises={},this._completeRedirectFn=du,this._overrideRedirectResult=nu}return k(e,[{key:"_initialize",value:function(){var e=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t._key(),(r=this.eventManagers.get(n))||(r=new ws(t),this.eventManagers.set(n,r),this.attachCallbackListeners(t,r)),e.abrupt("return",r);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_openPopup",value:function(e){en(e,"operation-not-supported-in-this-environment")}},{key:"_openRedirect",value:function(){var e=u(a().mark((function e(t,n,r,i){var o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vs(t),e.next=3,this._initialize(t);case 3:return o=e.sent,e.next=6,o.initialized();case 6:return o.resetRedirect(),Jo.clear(),e.next=10,this._originValidation(t);case 10:return u=bs(t,r,i),e.next=13,_s(t,u);case 13:return e.next=15,cs(t,u,n);case 15:return s=e.sent,e.next=18,hs(s);case 18:return c=e.sent,e.abrupt("return",ds(t,o,c));case 20:case"end":return e.stop()}}),e,this)})));return function(t,n,r,i){return e.apply(this,arguments)}}()},{key:"_isIframeWebStorageSupported",value:function(e,t){throw new Error("Method not implemented.")}},{key:"_originValidation",value:function(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=function(e){return fs.apply(this,arguments)}(e)),this.originValidationPromises[t]}},{key:"attachCallbackListeners",value:function(e,t){var n=us(),r=n.universalLinks,i=n.handleOpenURL,o=n.BuildInfo,s=setTimeout(u(a().mark((function n(){return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,xs(e);case 2:t.onEvent(Ds());case 3:case"end":return n.stop()}}),n)}))),500),c=function(){var n=u(a().mark((function n(r){var i,o;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return clearTimeout(s),n.next=3,xs(e);case 3:i=n.sent,o=null,i&&(null===r||void 0===r?void 0:r.url)&&(o=Is(i,r.url)),t.onEvent(o||Ds());case 7:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}();"undefined"!==typeof r&&"function"===typeof r.subscribe&&r.subscribe(null,c);var l=i,f="".concat(o.packageName.toLowerCase(),"://");us().handleOpenURL=function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.toLowerCase().startsWith(f)&&c({url:t}),"function"===typeof l)try{l(t)}catch(n){console.error(n)}case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}}]),e}(),Ps=Ns;function Ds(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:tn("no-auth-event")}}var Rs=1e3;function Os(){var e;return(null===(e=null===self||void 0===self?void 0:self.location)||void 0===e?void 0:e.protocol)||null}function Ls(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return!("file:"!==Os()&&"ionic:"!==Os()&&"capacitor:"!==Os()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))}function Ms(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return q()&&11===(null===document||void 0===document?void 0:document.documentMode)||function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U();return/Edge\/\d+/.test(e)}(e)}function Fs(){try{var e=self.localStorage,t=Ka();if(e)return e.setItem(t,"1"),e.removeItem(t),!Ms()||K()}catch(n){return Vs()&&K()}return!1}function Vs(){return"undefined"!==typeof n.g&&"WorkerGlobalScope"in n.g&&"importScripts"in n.g}function Us(){return("http:"===Os()||"https:"===Os()||z()||Ls())&&!(B()||j())&&Fs()&&!Vs()}function js(){return Ls()&&"undefined"!==typeof document}function zs(){return Bs.apply(this,arguments)}function Bs(){return(Bs=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(js()){e.next=2;break}return e.abrupt("return",!1);case 2:return e.abrupt("return",new Promise((function(e){var t=setTimeout((function(){e(!1)}),Rs);document.addEventListener("deviceready",(function(){clearTimeout(t),e(!0)}))})));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var qs={LOCAL:"local",NONE:"none",SESSION:"session"},Ks=on,Gs="persistence";function Hs(e,t){Ks(Object.values(qs).includes(t),e,"invalid-persistence-type"),B()?Ks(t!==qs.SESSION,e,"unsupported-persistence-type"):j()?Ks(t===qs.NONE,e,"unsupported-persistence-type"):Vs()?Ks(t===qs.NONE||t===qs.LOCAL&&K(),e,"unsupported-persistence-type"):Ks(t===qs.NONE||Fs(),e,"unsupported-persistence-type")}function Ws(e){return Qs.apply(this,arguments)}function Qs(){return(Qs=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t._initializationPromise;case 2:n=Ys(),r=ar(Gs,t.config.apiKey,t.name),n&&n.setItem(r,t._getPersistence());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ys(){var e;try{return(null===(e="undefined"!==typeof window?window:null)||void 0===e?void 0:e.sessionStorage)||null}catch(t){return null}}var Js=on,Xs=function(){function e(){y(this,e),this.browserResolver=nr(Yu),this.cordovaResolver=nr(Ps),this.underlyingResolver=null,this._redirectPersistence=za,this._completeRedirectFn=du,this._overrideRedirectResult=nu}return k(e,[{key:"_initialize",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.selectUnderlyingResolver();case 2:return e.abrupt("return",this.assertedUnderlyingResolver._initialize(t));case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_openPopup",value:function(){var e=u(a().mark((function e(t,n,r,i){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.selectUnderlyingResolver();case 2:return e.abrupt("return",this.assertedUnderlyingResolver._openPopup(t,n,r,i));case 3:case"end":return e.stop()}}),e,this)})));return function(t,n,r,i){return e.apply(this,arguments)}}()},{key:"_openRedirect",value:function(){var e=u(a().mark((function e(t,n,r,i){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.selectUnderlyingResolver();case 2:return e.abrupt("return",this.assertedUnderlyingResolver._openRedirect(t,n,r,i));case 3:case"end":return e.stop()}}),e,this)})));return function(t,n,r,i){return e.apply(this,arguments)}}()},{key:"_isIframeWebStorageSupported",value:function(e,t){this.assertedUnderlyingResolver._isIframeWebStorageSupported(e,t)}},{key:"_originValidation",value:function(e){return this.assertedUnderlyingResolver._originValidation(e)}},{key:"_shouldInitProactively",get:function(){return js()||this.browserResolver._shouldInitProactively}},{key:"assertedUnderlyingResolver",get:function(){return Js(this.underlyingResolver,"internal-error"),this.underlyingResolver}},{key:"selectUnderlyingResolver",value:function(){var e=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.underlyingResolver){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,zs();case 4:t=e.sent,this.underlyingResolver=t?this.cordovaResolver:this.browserResolver;case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()}]),e}();function $s(e){return e.unwrap()}function Zs(e,t){var n,r=null===(n=t.customData)||void 0===n?void 0:n._tokenResponse;if("auth/multi-factor-auth-required"===(null===t||void 0===t?void 0:t.code))t.resolver=new ic(e,function(e,t){var n,r=ie(e),i=t;return on(t.customData.operationType,r,"argument-error"),on(null===(n=i.customData._serverResponse)||void 0===n?void 0:n.mfaPendingCredential,r,"argument-error"),Pa._fromError(r,i)}(e,t));else if(r){var i=ec(t),a=t;i&&(a.credential=i,a.tenantId=r.tenantId||void 0,a.email=r.email||void 0,a.phoneNumber=r.phoneNumber||void 0)}}function ec(e){var t=(e instanceof G?e.customData:e)._tokenResponse;if(!t)return null;if(!(e instanceof G)&&"temporaryProof"in t&&"phoneNumber"in t)return Oo.credentialFromResult(e);var n,r=t.providerId;if(!r||r===Ft.PASSWORD)return null;switch(r){case Ft.GOOGLE:n=ki;break;case Ft.FACEBOOK:n=gi;break;case Ft.GITHUB:n=wi;break;case Ft.TWITTER:n=xi;break;default:var i=t.oauthIdToken,a=t.oauthAccessToken,o=t.oauthTokenSecret,u=t.pendingToken,s=t.nonce;return a||o||i||u?u?r.startsWith("saml.")?bi._create(r,u):ai._fromParams({providerId:r,signInMethod:r,pendingToken:u,idToken:i,accessToken:a}):new yi(r).credential({idToken:i,accessToken:a,rawNonce:s}):null}return e instanceof G?n.credentialFromError(e):n.credentialFromResult(e)}function tc(e,t){return t.catch((function(t){throw t instanceof G&&Zs(e,t),t})).then((function(e){var t,n=e.operationType,r=e.user;return{operationType:n,credential:(t=e,ec(t)),additionalUserInfo:Aa(e),user:ac.getOrCreate(r)}}))}function nc(e,t){return rc.apply(this,arguments)}function rc(){return(rc=u(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n;case 2:return r=e.sent,e.abrupt("return",{verificationId:r.verificationId,confirm:function(e){return tc(t,r.confirm(e))}});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ic=function(){function e(t,n){y(this,e),this.resolver=n,this.auth=t.wrapped()}return k(e,[{key:"session",get:function(){return this.resolver.session}},{key:"hints",get:function(){return this.resolver.hints}},{key:"resolveSignIn",value:function(e){return tc($s(this.auth),this.resolver.resolveSignIn(e))}}]),e}(),ac=function(){function e(t){y(this,e),this._delegate=t,this.multiFactor=function(e){var t=ie(e);return La.has(t)||La.set(t,Oa._fromUser(t)),La.get(t)}(t)}return k(e,[{key:"delete",value:function(){return this._delegate.delete()}},{key:"reload",value:function(){return this._delegate.reload()}},{key:"toJSON",value:function(){return this._delegate.toJSON()}},{key:"getIdTokenResult",value:function(e){return this._delegate.getIdTokenResult(e)}},{key:"getIdToken",value:function(e){return this._delegate.getIdToken(e)}},{key:"linkAndRetrieveDataWithCredential",value:function(e){return this.linkWithCredential(e)}},{key:"linkWithCredential",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",tc(this.auth,Ki(this._delegate,t)));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"linkWithPhoneNumber",value:function(){var e=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",nc(this.auth,Co(this._delegate,t,n)));case 1:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"linkWithPopup",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",tc(this.auth,Ho(this._delegate,t,Xs)));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"linkWithRedirect",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ws(xr(this.auth));case 2:return e.abrupt("return",cu(this._delegate,t,Xs));case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"reauthenticateAndRetrieveDataWithCredential",value:function(e){return this.reauthenticateWithCredential(e)}},{key:"reauthenticateWithCredential",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",tc(this.auth,Hi(this._delegate,t)));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"reauthenticateWithPhoneNumber",value:function(e,t){return nc(this.auth,function(e,t,n){return No.apply(this,arguments)}(this._delegate,e,t))}},{key:"reauthenticateWithPopup",value:function(e){return tc(this.auth,function(e,t,n){return Go.apply(this,arguments)}(this._delegate,e,Xs))}},{key:"reauthenticateWithRedirect",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ws(xr(this.auth));case 2:return e.abrupt("return",uu(this._delegate,t,Xs));case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"sendEmailVerification",value:function(e){return function(e,t){return ma.apply(this,arguments)}(this._delegate,e)}},{key:"unlink",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Di(this._delegate,t);case 2:return e.abrupt("return",this);case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"updateEmail",value:function(e){return function(e,t){return ba(ie(e),t,null)}(this._delegate,e)}},{key:"updatePassword",value:function(e){return function(e,t){return ba(ie(e),null,t)}(this._delegate,e)}},{key:"updatePhoneNumber",value:function(e){return function(e,t){return Ro.apply(this,arguments)}(this._delegate,e)}},{key:"updateProfile",value:function(e){return function(e,t){return wa.apply(this,arguments)}(this._delegate,e)}},{key:"verifyBeforeUpdateEmail",value:function(e,t){return function(e,t,n){return ya.apply(this,arguments)}(this._delegate,e,t)}},{key:"emailVerified",get:function(){return this._delegate.emailVerified}},{key:"isAnonymous",get:function(){return this._delegate.isAnonymous}},{key:"metadata",get:function(){return this._delegate.metadata}},{key:"phoneNumber",get:function(){return this._delegate.phoneNumber}},{key:"providerData",get:function(){return this._delegate.providerData}},{key:"refreshToken",get:function(){return this._delegate.refreshToken}},{key:"tenantId",get:function(){return this._delegate.tenantId}},{key:"displayName",get:function(){return this._delegate.displayName}},{key:"email",get:function(){return this._delegate.email}},{key:"photoURL",get:function(){return this._delegate.photoURL}},{key:"providerId",get:function(){return this._delegate.providerId}},{key:"uid",get:function(){return this._delegate.uid}},{key:"auth",get:function(){return this._delegate.auth}}],[{key:"getOrCreate",value:function(t){return e.USER_MAP.has(t)||e.USER_MAP.set(t,new e(t)),e.USER_MAP.get(t)}}]),e}();ac.USER_MAP=new WeakMap;var oc=on,uc=function(){function e(t,n){if(y(this,e),this.app=t,n.isInitialized())return this._delegate=n.getImmediate(),void this.linkUnderlyingAuth();var r=t.options.apiKey;oc(r,"invalid-api-key",{appName:t.name}),oc(r,"invalid-api-key",{appName:t.name});var i="undefined"!==typeof window?Xs:void 0;this._delegate=n.initialize({options:{persistence:cc(r,t.name),popupRedirectResolver:i}}),this._delegate._updateErrorMap(Qt),this.linkUnderlyingAuth()}return k(e,[{key:"emulatorConfig",get:function(){return this._delegate.emulatorConfig}},{key:"currentUser",get:function(){return this._delegate.currentUser?ac.getOrCreate(this._delegate.currentUser):null}},{key:"languageCode",get:function(){return this._delegate.languageCode},set:function(e){this._delegate.languageCode=e}},{key:"settings",get:function(){return this._delegate.settings}},{key:"tenantId",get:function(){return this._delegate.tenantId},set:function(e){this._delegate.tenantId=e}},{key:"useDeviceLanguage",value:function(){this._delegate.useDeviceLanguage()}},{key:"signOut",value:function(){return this._delegate.signOut()}},{key:"useEmulator",value:function(e,t){Nr(this._delegate,e,t)}},{key:"applyActionCode",value:function(e){return function(e,t){return aa.apply(this,arguments)}(this._delegate,e)}},{key:"checkActionCode",value:function(e){return oa(this._delegate,e)}},{key:"confirmPasswordReset",value:function(e,t){return function(e,t,n){return ia.apply(this,arguments)}(this._delegate,e,t)}},{key:"createUserWithEmailAndPassword",value:function(){var e=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",tc(this._delegate,ca(this._delegate,t,n)));case 1:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"fetchProvidersForEmail",value:function(e){return this.fetchSignInMethodsForEmail(e)}},{key:"fetchSignInMethodsForEmail",value:function(e){return function(e,t){return va.apply(this,arguments)}(this._delegate,e)}},{key:"isSignInWithEmailLink",value:function(e){return function(e,t){var n=di.parseLink(t);return"EMAIL_SIGNIN"===(null===n||void 0===n?void 0:n.operation)}(this._delegate,e)}},{key:"getRedirectResult",value:function(){var e=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oc(Us(),this._delegate,"operation-not-supported-in-this-environment"),e.next=3,fu(this._delegate,Xs);case 3:if(t=e.sent){e.next=6;break}return e.abrupt("return",{credential:null,user:null});case 6:return e.abrupt("return",tc(this._delegate,Promise.resolve(t)));case 7:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"addFrameworkForLogging",value:function(e){!function(e,t){xr(e)._logFramework(t)}(this._delegate,e)}},{key:"onAuthStateChanged",value:function(e,t,n){var r=sc(e,t,n),i=r.next,a=r.error,o=r.complete;return this._delegate.onAuthStateChanged(i,a,o)}},{key:"onIdTokenChanged",value:function(e,t,n){var r=sc(e,t,n),i=r.next,a=r.error,o=r.complete;return this._delegate.onIdTokenChanged(i,a,o)}},{key:"sendSignInLinkToEmail",value:function(e,t){return function(e,t,n){return fa.apply(this,arguments)}(this._delegate,e,t)}},{key:"sendPasswordResetEmail",value:function(e,t){return function(e,t,n){return ra.apply(this,arguments)}(this._delegate,e,t||void 0)}},{key:"setPersistence",value:function(){var e=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Hs(this._delegate,t),e.t0=t,e.next=e.t0===qs.SESSION?4:e.t0===qs.LOCAL?6:e.t0===qs.NONE?11:13;break;case 4:return n=za,e.abrupt("break",14);case 6:return e.next=8,nr(fo)._isAvailable();case 8:return r=e.sent,n=r?fo:Ua,e.abrupt("break",14);case 11:return n=ir,e.abrupt("break",14);case 13:return e.abrupt("return",en("argument-error",{appName:this._delegate.name}));case 14:return e.abrupt("return",this._delegate.setPersistence(n));case 15:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"signInAndRetrieveDataWithCredential",value:function(e){return this.signInWithCredential(e)}},{key:"signInAnonymously",value:function(){return tc(this._delegate,function(e){return Ci.apply(this,arguments)}(this._delegate))}},{key:"signInWithCredential",value:function(e){return tc(this._delegate,Bi(this._delegate,e))}},{key:"signInWithCustomToken",value:function(e){return tc(this._delegate,function(e,t){return Ji.apply(this,arguments)}(this._delegate,e))}},{key:"signInWithEmailAndPassword",value:function(e,t){return tc(this._delegate,function(e,t,n){return Bi(ie(e),pi.credential(t,n)).catch(function(){var t=u(a().mark((function t(n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw n.code==="auth/".concat("password-does-not-meet-requirements")&&ta(e),n;case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}(this._delegate,e,t))}},{key:"signInWithEmailLink",value:function(e,t){return tc(this._delegate,function(e,t,n){return ha.apply(this,arguments)}(this._delegate,e,t))}},{key:"signInWithPhoneNumber",value:function(e,t){return nc(this._delegate,function(e,t,n){return So.apply(this,arguments)}(this._delegate,e,t))}},{key:"signInWithPopup",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oc(Us(),this._delegate,"operation-not-supported-in-this-environment"),e.abrupt("return",tc(this._delegate,qo(this._delegate,t,Xs)));case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"signInWithRedirect",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return oc(Us(),this._delegate,"operation-not-supported-in-this-environment"),e.next=3,Ws(this._delegate);case 3:return e.abrupt("return",au(this._delegate,t,Xs));case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"updateCurrentUser",value:function(e){return this._delegate.updateCurrentUser(e)}},{key:"verifyPasswordResetCode",value:function(e){return function(e,t){return sa.apply(this,arguments)}(this._delegate,e)}},{key:"unwrap",value:function(){return this._delegate}},{key:"_delete",value:function(){return this._delegate._delete()}},{key:"linkUnderlyingAuth",value:function(){var e=this;this._delegate.wrapped=function(){return e}}}]),e}();function sc(e,t,n){var r=e;"function"!==typeof e&&(r=e.next,t=e.error,n=e.complete);var i=r;return{next:function(e){return i(e&&ac.getOrCreate(e))},error:t,complete:n}}function cc(e,t){var n=function(e,t){var n=Ys();if(!n)return[];var r=ar(Gs,e,t);switch(n.getItem(r)){case qs.NONE:return[ir];case qs.LOCAL:return[fo,za];case qs.SESSION:return[za];default:return[]}}(e,t);if("undefined"===typeof self||n.includes(fo)||n.push(fo),"undefined"!==typeof window)for(var r=0,i=[Ua,za];r<i.length;r++){var a=i[r];n.includes(a)||n.push(a)}return n.includes(ir)||n.push(ir),n}uc.Persistence=qs;var lc=function(){function e(){y(this,e),this.providerId="phone",this._delegate=new Oo($s(Rt.auth()))}return k(e,[{key:"verifyPhoneNumber",value:function(e,t){return this._delegate.verifyPhoneNumber(e,t)}},{key:"unwrap",value:function(){return this._delegate}}],[{key:"credential",value:function(e,t){return Oo.credential(e,t)}}]),e}();lc.PHONE_SIGN_IN_METHOD=Oo.PHONE_SIGN_IN_METHOD,lc.PROVIDER_ID=Oo.PROVIDER_ID;var fc,hc=on,dc=function(){function e(t,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Rt.app();y(this,e),hc(null===(r=i.options)||void 0===r?void 0:r.apiKey,"invalid-api-key",{appName:i.name}),this._delegate=new To(i.auth(),t,n),this.type=this._delegate.type}return k(e,[{key:"clear",value:function(){this._delegate.clear()}},{key:"render",value:function(){return this._delegate.render()}},{key:"verify",value:function(){return this._delegate.verify()}}]),e}();(fc=Rt).INTERNAL.registerComponent(new ue("auth-compat",(function(e){var t=e.getProvider("app-compat").getImmediate(),n=e.getProvider("auth");return new uc(t,n)}),"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:Vt,PASSWORD_RESET:Ut,RECOVER_EMAIL:jt,REVERT_SECOND_FACTOR_ADDITION:zt,VERIFY_AND_CHANGE_EMAIL:Bt,VERIFY_EMAIL:qt}},EmailAuthProvider:pi,FacebookAuthProvider:gi,GithubAuthProvider:wi,GoogleAuthProvider:ki,OAuthProvider:yi,SAMLAuthProvider:_i,PhoneAuthProvider:lc,PhoneMultiFactorGenerator:$u,RecaptchaVerifier:dc,TwitterAuthProvider:xi,Auth:uc,AuthCredential:Rr,Error:G}).setInstantiationMode("LAZY").setMultipleInstances(!1)),fc.registerVersion("@firebase/auth-compat","0.4.6");var pc,vc="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{},mc={},yc=yc||{},gc=vc||self;function kc(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 wc(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}var bc="closure_uid_"+(1e9*Math.random()>>>0),_c=0;function xc(e,t,n){return e.call.apply(e.bind,arguments)}function Tc(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function Ic(e,t,n){return(Ic=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?xc:Tc).apply(null,arguments)}function Ec(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 Sc(e,t){function n(){}n.prototype=t.prototype,e.$=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.ac=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}function Cc(){this.s=this.s,this.o=this.o}Cc.prototype.s=!1,Cc.prototype.sa=function(){var e;!this.s&&(this.s=!0,this.N(),0)&&(e=this,Object.prototype.hasOwnProperty.call(e,bc)&&e[bc]||(e[bc]=++_c))},Cc.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Ac=Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t,void 0)}:function(e,t){if("string"===typeof e)return"string"!==typeof t||1!=t.length?-1:e.indexOf(t,0);for(var n=0;n<e.length;n++)if(n in e&&e[n]===t)return n;return-1};function Nc(e){var t=e.length;if(0<t){for(var n=Array(t),r=0;r<t;r++)n[r]=e[r];return n}return[]}function Pc(e,t){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(kc(r)){var i=e.length||0,a=r.length||0;e.length=i+a;for(var o=0;o<a;o++)e[i+o]=r[o]}else e.push(r)}}function Dc(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}Dc.prototype.h=function(){this.defaultPrevented=!0};var Rc=function(){if(!gc.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{gc.addEventListener("test",(function(){}),t),gc.removeEventListener("test",(function(){}),t)}catch(n){}return e}();function Oc(e){return/^[\s\xa0]*$/.test(e)}function Lc(){var e=gc.navigator;return e&&(e=e.userAgent)?e:""}function Mc(e){return-1!=Lc().indexOf(e)}function Fc(e){return Fc[" "](e),e}Fc[" "]=function(){};var Vc,Uc,jc=Mc("Opera"),zc=Mc("Trident")||Mc("MSIE"),Bc=Mc("Edge"),qc=Bc||zc,Kc=Mc("Gecko")&&!(-1!=Lc().toLowerCase().indexOf("webkit")&&!Mc("Edge"))&&!(Mc("Trident")||Mc("MSIE"))&&!Mc("Edge"),Gc=-1!=Lc().toLowerCase().indexOf("webkit")&&!Mc("Edge");function Hc(){var e=gc.document;return e?e.documentMode:void 0}e:{var Wc="",Qc=function(){var e=Lc();return Kc?/rv:([^\);]+)(\)|;)/.exec(e):Bc?/Edge\/([\d\.]+)/.exec(e):zc?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):Gc?/WebKit\/(\S+)/.exec(e):jc?/(?:Version)[ \/]?(\S+)/.exec(e):void 0}();if(Qc&&(Wc=Qc?Qc[1]:""),zc){var Yc=Hc();if(null!=Yc&&Yc>parseFloat(Wc)){Vc=String(Yc);break e}}Vc=Wc}if(gc.document&&zc){var Jc=Hc();Uc=Jc||(parseInt(Vc,10)||void 0)}else Uc=void 0;var Xc=Uc;function $c(e,t){if(Dc.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(Kc){e:{try{Fc(t.nodeName);var i=!0;break e}catch(a){}i=!1}i||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"===typeof e.pointerType?e.pointerType:Zc[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&$c.$.h.call(this)}}Sc($c,Dc);var Zc={2:"touch",3:"pen",4:"mouse"};$c.prototype.h=function(){$c.$.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var el="closure_listenable_"+(1e6*Math.random()|0),tl=0;function nl(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.la=i,this.key=++tl,this.fa=this.ia=!1}function rl(e){e.fa=!0,e.listener=null,e.proxy=null,e.src=null,e.la=null}function il(e,t,n){for(var r in e)t.call(n,e[r],r,e)}function al(e){var t={};for(var n in e)t[n]=e[n];return t}var ol="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function ul(e,t){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])e[n]=r[n];for(var a=0;a<ol.length;a++)n=ol[a],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function sl(e){this.src=e,this.g={},this.h=0}function cl(e,t){var n=t.type;if(n in e.g){var r,i=e.g[n],a=Ac(i,t);(r=0<=a)&&Array.prototype.splice.call(i,a,1),r&&(rl(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function ll(e,t,n,r){for(var i=0;i<e.length;++i){var a=e[i];if(!a.fa&&a.listener==t&&a.capture==!!n&&a.la==r)return i}return-1}sl.prototype.add=function(e,t,n,r,i){var a=e.toString();(e=this.g[a])||(e=this.g[a]=[],this.h++);var o=ll(e,t,r,i);return-1<o?(t=e[o],n||(t.ia=!1)):((t=new nl(t,this.src,a,!!r,i)).ia=n,e.push(t)),t};var fl="closure_lm_"+(1e6*Math.random()|0),hl={};function dl(e,t,n,r,i){if(r&&r.once)return vl(e,t,n,r,i);if(Array.isArray(t)){for(var a=0;a<t.length;a++)dl(e,t[a],n,r,i);return null}return n=_l(n),e&&e[el]?e.O(t,n,wc(r)?!!r.capture:!!r,i):pl(e,t,n,!1,r,i)}function pl(e,t,n,r,i,a){if(!t)throw Error("Invalid event type");var o=wc(i)?!!i.capture:!!i,u=wl(e);if(u||(e[fl]=u=new sl(e)),(n=u.add(t,n,r,o,a)).proxy)return n;if(r=function(){function e(n){return t.call(e.src,e.listener,n)}var t=kl;return e}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)Rc||(i=o),void 0===i&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(gl(t.toString()),r);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(r)}return n}function vl(e,t,n,r,i){if(Array.isArray(t)){for(var a=0;a<t.length;a++)vl(e,t[a],n,r,i);return null}return n=_l(n),e&&e[el]?e.P(t,n,wc(r)?!!r.capture:!!r,i):pl(e,t,n,!0,r,i)}function ml(e,t,n,r,i){if(Array.isArray(t))for(var a=0;a<t.length;a++)ml(e,t[a],n,r,i);else r=wc(r)?!!r.capture:!!r,n=_l(n),e&&e[el]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=ll(a=e.g[t],n,r,i))&&(rl(a[n]),Array.prototype.splice.call(a,n,1),0==a.length&&(delete e.g[t],e.h--)))):e&&(e=wl(e))&&(t=e.g[t.toString()],e=-1,t&&(e=ll(t,n,r,i)),(n=-1<e?t[e]:null)&&yl(n))}function yl(e){if("number"!==typeof e&&e&&!e.fa){var t=e.src;if(t&&t[el])cl(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(gl(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=wl(t))?(cl(n,e),0==n.h&&(n.src=null,t[fl]=null)):rl(e)}}}function gl(e){return e in hl?hl[e]:hl[e]="on"+e}function kl(e,t){if(e.fa)e=!0;else{t=new $c(t,this);var n=e.listener,r=e.la||e.src;e.ia&&yl(e),e=n.call(r,t)}return e}function wl(e){return(e=e[fl])instanceof sl?e:null}var bl="__closure_events_fn_"+(1e9*Math.random()>>>0);function _l(e){return"function"===typeof e?e:(e[bl]||(e[bl]=function(t){return e.handleEvent(t)}),e[bl])}function xl(){Cc.call(this),this.i=new sl(this),this.S=this,this.J=null}function Tl(e,t){var n,r=e.J;if(r)for(n=[];r;r=r.J)n.push(r);if(e=e.S,r=t.type||t,"string"===typeof t)t=new Dc(t,e);else if(t instanceof Dc)t.target=t.target||e;else{var i=t;ul(t=new Dc(r,e),i)}if(i=!0,n)for(var a=n.length-1;0<=a;a--){var o=t.g=n[a];i=Il(o,r,!0,t)&&i}if(i=Il(o=t.g=e,r,!0,t)&&i,i=Il(o,r,!1,t)&&i,n)for(a=0;a<n.length;a++)i=Il(o=t.g=n[a],r,!1,t)&&i}function Il(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var i=!0,a=0;a<t.length;++a){var o=t[a];if(o&&!o.fa&&o.capture==n){var u=o.listener,s=o.la||o.src;o.ia&&cl(e.i,o),i=!1!==u.call(s,r)&&i}}return i&&!r.defaultPrevented}Sc(xl,Cc),xl.prototype[el]=!0,xl.prototype.removeEventListener=function(e,t,n,r){ml(this,e,t,n,r)},xl.prototype.N=function(){if(xl.$.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)rl(n[r]);delete t.g[e],t.h--}}this.J=null},xl.prototype.O=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},xl.prototype.P=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};var El=gc.JSON.stringify,Sl=function(){function e(t,n){y(this,e),this.i=t,this.j=n,this.h=0,this.g=null}return k(e,[{key:"get",value:function(){var e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}]),e}();function Cl(){var e=Ml,t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var Al=function(){function e(){y(this,e),this.h=this.g=null}return k(e,[{key:"add",value:function(e,t){var n=Nl.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}}]),e}(),Nl=new Sl((function(){return new Pl}),(function(e){return e.reset()})),Pl=function(){function e(){y(this,e),this.next=this.g=this.h=null}return k(e,[{key:"set",value:function(e,t){this.h=e,this.g=t,this.next=null}},{key:"reset",value:function(){this.next=this.g=this.h=null}}]),e}();function Dl(e){var t=1;e=e.split(":");for(var n=[];0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function Rl(e){gc.setTimeout((function(){throw e}),0)}var Ol,Ll=!1,Ml=new Al,Fl=function(){var e=gc.Promise.resolve(void 0);Ol=function(){e.then(Vl)}},Vl=function(){for(var e;e=Cl();){try{e.h.call(e.g)}catch(n){Rl(n)}var t=Nl;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}Ll=!1};function Ul(e,t){xl.call(this),this.h=e||1,this.g=t||gc,this.j=Ic(this.qb,this),this.l=Date.now()}function jl(e){e.ga=!1,e.T&&(e.g.clearTimeout(e.T),e.T=null)}function zl(e,t,n){if("function"===typeof e)n&&(e=Ic(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=Ic(e.handleEvent,e)}return 2147483647<Number(t)?-1:gc.setTimeout(e,t||0)}function Bl(e){e.g=zl((function(){e.g=null,e.i&&(e.i=!1,Bl(e))}),e.j);var t=e.h;e.h=null,e.m.apply(null,t)}Sc(Ul,xl),(pc=Ul.prototype).ga=!1,pc.T=null,pc.qb=function(){if(this.ga){var e=Date.now()-this.l;0<e&&e<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-e):(this.T&&(this.g.clearTimeout(this.T),this.T=null),Tl(this,"tick"),this.ga&&(jl(this),this.start()))}},pc.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())},pc.N=function(){Ul.$.N.call(this),jl(this),delete this.g};var ql=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this)).m=e,i.j=r,i.h=null,i.i=!1,i.g=null,i}return k(n,[{key:"l",value:function(e){this.h=arguments,this.g?this.i=!0:Bl(this)}},{key:"N",value:function(){Ot(T(n.prototype),"N",this).call(this),this.g&&(gc.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}]),n}(Cc);function Kl(e){Cc.call(this),this.h=e,this.g={}}Sc(Kl,Cc);var Gl=[];function Hl(e,t,n,r){Array.isArray(n)||(n&&(Gl[0]=n.toString()),n=Gl);for(var i=0;i<n.length;i++){var a=dl(t,n[i],r||e.handleEvent,!1,e.h||e);if(!a)break;e.g[a.key]=a}}function Wl(e){il(e.g,(function(e,t){this.g.hasOwnProperty(t)&&yl(e)}),e),e.g={}}function Ql(){this.g=!0}function Yl(e,t,n,r){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 r=n[e];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var a=i[0];if("noop"!=a&&"stop"!=a&&"close"!=a)for(var o=1;o<i.length;o++)i[o]=""}}}return El(n)}catch(u){return t}}(e,n)+(r?" "+r:"")}))}Kl.prototype.N=function(){Kl.$.N.call(this),Wl(this)},Kl.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},Ql.prototype.Ea=function(){this.g=!1},Ql.prototype.info=function(){};var Jl={},Xl=null;function $l(){return Xl=Xl||new xl}function Zl(e){Dc.call(this,Jl.Ta,e)}function ef(e){var t=$l();Tl(t,new Zl(t))}function tf(e,t){Dc.call(this,Jl.STAT_EVENT,e),this.stat=t}function nf(e){var t=$l();Tl(t,new tf(t,e))}function rf(e,t){Dc.call(this,Jl.Ua,e),this.size=t}function af(e,t){if("function"!==typeof e)throw Error("Fn must not be null and must be a function");return gc.setTimeout((function(){e()}),t)}Jl.Ta="serverreachability",Sc(Zl,Dc),Jl.STAT_EVENT="statevent",Sc(tf,Dc),Jl.Ua="timingevent",Sc(rf,Dc);var of={NO_ERROR:0,rb:1,Eb:2,Db:3,yb:4,Cb:5,Fb:6,Qa:7,TIMEOUT:8,Ib:9},uf={wb:"complete",Sb:"success",Ra:"error",Qa:"abort",Kb:"ready",Lb:"readystatechange",TIMEOUT:"timeout",Gb:"incrementaldata",Jb:"progress",zb:"downloadprogress",$b:"uploadprogress"};function sf(){}function cf(e){return e.h||(e.h=e.i())}function lf(){}sf.prototype.h=null;var ff,hf={OPEN:"a",vb:"b",Ra:"c",Hb:"d"};function df(){Dc.call(this,"d")}function pf(){Dc.call(this,"c")}function vf(){}function mf(e,t,n,r){this.l=e,this.j=t,this.m=n,this.W=r||1,this.U=new Kl(this),this.P=gf,e=qc?125:void 0,this.V=new Ul(e),this.I=null,this.i=!1,this.s=this.A=this.v=this.L=this.G=this.Y=this.B=null,this.F=[],this.g=null,this.C=0,this.o=this.u=null,this.ca=-1,this.J=!1,this.O=0,this.M=null,this.ba=this.K=this.aa=this.S=!1,this.h=new yf}function yf(){this.i=null,this.g="",this.h=!1}Sc(df,Dc),Sc(pf,Dc),Sc(vf,sf),vf.prototype.g=function(){return new XMLHttpRequest},vf.prototype.i=function(){return{}},ff=new vf;var gf=45e3,kf={},wf={};function bf(e,t,n){e.L=1,e.v=jf(Lf(t)),e.s=n,e.S=!0,_f(e,null)}function _f(e,t){e.G=Date.now(),Ef(e),e.A=Lf(e.v);var n=e.A,r=e.W;Array.isArray(r)||(r=[String(r)]),Zf(n.i,"t",r),e.C=0,n=e.l.J,e.h=new yf,e.g=ed(e.l,n?t:null,!e.s),0<e.O&&(e.M=new ql(Ic(e.Pa,e,e.g),e.O)),Hl(e.U,e.g,"readystatechange",e.nb),t=e.I?al(e.I):{},e.s?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ha(e.A,e.u,e.s,t)):(e.u="GET",e.g.ha(e.A,e.u,null,t)),ef(),function(e,t,n,r,i,a){e.info((function(){if(e.g)if(a)for(var o="",u=a.split("&"),s=0;s<u.length;s++){var c=u[s].split("=");if(1<c.length){var l=c[0];c=c[1];var f=l.split("_");o=2<=f.length&&"type"==f[1]?o+(l+"=")+c+"&":o+(l+"=redacted&")}}else o=null;else o=a;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+t+"\n"+n+"\n"+o}))}(e.j,e.u,e.A,e.m,e.W,e.s)}function xf(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.l.Ha)}function Tf(e,t,n){for(var r,i=!0;!e.J&&e.C<n.length;){if((r=If(e,n))==wf){4==t&&(e.o=4,nf(14),i=!1),Yl(e.j,e.m,null,"[Incomplete Response]");break}if(r==kf){e.o=4,nf(15),Yl(e.j,e.m,n,"[Invalid Chunk]"),i=!1;break}Yl(e.j,e.m,r,null),Pf(e,r)}xf(e)&&r!=wf&&r!=kf&&(e.h.g="",e.C=0),4!=t||0!=n.length||e.h.h||(e.o=1,nf(16),i=!1),e.i=e.i&&i,i?0<n.length&&!e.ba&&(e.ba=!0,(t=e.l).g==e&&t.ca&&!t.M&&(t.l.info("Great, no buffering proxy detected. Bytes received: "+n.length),Hh(t),t.M=!0,nf(11))):(Yl(e.j,e.m,n,"[Invalid Chunked Response]"),Nf(e),Af(e))}function If(e,t){var n=e.C,r=t.indexOf("\n",n);return-1==r?wf:(n=Number(t.substring(n,r)),isNaN(n)?kf:(r+=1)+n>t.length?wf:(t=t.slice(r,r+n),e.C=r+n,t))}function Ef(e){e.Y=Date.now()+e.P,Sf(e,e.P)}function Sf(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=af(Ic(e.lb,e),t)}function Cf(e){e.B&&(gc.clearTimeout(e.B),e.B=null)}function Af(e){0==e.l.H||e.J||Yh(e.l,e)}function Nf(e){Cf(e);var t=e.M;t&&"function"==typeof t.sa&&t.sa(),e.M=null,jl(e.V),Wl(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.sa())}function Pf(e,t){try{var n=e.l;if(0!=n.H&&(n.g==e||oh(n.i,e)))if(!e.K&&oh(n.i,e)&&3==n.H){try{var r=n.Ja.g.parse(t)}catch(a){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){e:if(!n.u){if(n.g){if(!(n.g.G+3e3<e.G))break e;Qh(n),Vh(n)}Gh(n),nf(18)}}else n.Fa=i[1],0<n.Fa-n.V&&37500>i[2]&&n.G&&0==n.A&&!n.v&&(n.v=af(Ic(n.ib,n),6e3));if(1>=ah(n.i)&&n.oa){try{n.oa()}catch(a){}n.oa=void 0}}else Xh(n,11)}else if((e.K||n.g==e)&&Qh(n),!Oc(t))for(i=n.Ja.g.parse(t),t=0;t<i.length;t++){var a=i[t];if(n.V=a[0],a=a[1],2==n.H)if("c"==a[0]){n.K=a[1],n.pa=a[2];var o=a[3];null!=o&&(n.ra=o,n.l.info("VER="+n.ra));var u=a[4];null!=u&&(n.Ga=u,n.l.info("SVER="+n.Ga));var s=a[5];null!=s&&"number"===typeof s&&0<s&&(r=1.5*s,n.L=r,n.l.info("backChannelRequestTimeoutMs_="+r)),r=n;var c=e.g;if(c){var l=c.g?c.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(l){var f=r.i;f.g||-1==l.indexOf("spdy")&&-1==l.indexOf("quic")&&-1==l.indexOf("h2")||(f.j=f.l,f.g=new Set,f.h&&(uh(f,f.h),f.h=null))}if(r.F){var h=c.g?c.g.getResponseHeader("X-HTTP-Session-Id"):null;h&&(r.Da=h,Uf(r.I,r.F,h))}}n.H=3,n.h&&n.h.Ba(),n.ca&&(n.S=Date.now()-e.G,n.l.info("Handshake RTT: "+n.S+"ms"));var d=e;if((r=n).wa=Zh(r,r.J?r.pa:null,r.Y),d.K){sh(r.i,d);var p=d,v=r.L;v&&p.setTimeout(v),p.B&&(Cf(p),Ef(p)),r.g=d}else Kh(r);0<n.j.length&&jh(n)}else"stop"!=a[0]&&"close"!=a[0]||Xh(n,7);else 3==n.H&&("stop"==a[0]||"close"==a[0]?"stop"==a[0]?Xh(n,7):Fh(n):"noop"!=a[0]&&n.h&&n.h.Aa(a),n.A=0)}ef()}catch(a){}}function Df(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(kc(e)||"string"===typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.ta&&"function"==typeof e.ta)return e.ta();if(!e.Z||"function"!=typeof e.Z){if("undefined"!==typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!==typeof Set&&e instanceof Set)){if(kc(e)||"string"===typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}for(var r in t=[],n=0,e)t[n++]=r;return t}}}(e),r=function(e){if(e.Z&&"function"==typeof e.Z)return e.Z();if("undefined"!==typeof Map&&e instanceof Map||"undefined"!==typeof Set&&e instanceof Set)return Array.from(e.values());if("string"===typeof e)return e.split("");if(kc(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}for(r in t=[],n=0,e)t[n++]=e[r];return t}(e),i=r.length,a=0;a<i;a++)t.call(void 0,r[a],n&&n[a],e)}(pc=mf.prototype).setTimeout=function(e){this.P=e},pc.nb=function(e){e=e.target;var t=this.M;t&&3==Ph(e)?t.l():this.Pa(e)},pc.Pa=function(e){try{if(e==this.g)e:{var t=Ph(this.g),n=this.g.Ia();this.g.da();if(!(3>t)&&(3!=t||qc||this.g&&(this.h.h||this.g.ja()||Dh(this.g)))){this.J||4!=t||7==n||ef(),Cf(this);var r=this.g.da();this.ca=r;t:if(xf(this)){var i=Dh(this.g);e="";var a=i.length,o=4==Ph(this.g);if(!this.h.i){if("undefined"===typeof TextDecoder){Nf(this),Af(this);var u="";break t}this.h.i=new gc.TextDecoder}for(n=0;n<a;n++)this.h.h=!0,e+=this.h.i.decode(i[n],{stream:o&&n==a-1});i.splice(0,a),this.h.g+=e,this.C=0,u=this.h.g}else u=this.g.ja();if(this.i=200==r,function(e,t,n,r,i,a,o){e.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+t+"\n"+n+"\n"+a+" "+o}))}(this.j,this.u,this.A,this.m,this.W,t,r),this.i){if(this.aa&&!this.K){t:{if(this.g){var s,c=this.g;if((s=c.g?c.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Oc(s)){var l=s;break t}}l=null}if(!(r=l)){this.i=!1,this.o=3,nf(12),Nf(this),Af(this);break e}Yl(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Pf(this,r)}this.S?(Tf(this,t,u),qc&&this.i&&3==t&&(Hl(this.U,this.V,"tick",this.mb),this.V.start())):(Yl(this.j,this.m,u,null),Pf(this,u)),4==t&&Nf(this),this.i&&!this.J&&(4==t?Yh(this.l,this):(this.i=!1,Ef(this)))}else(function(e){var t={};e=(e.g&&2<=Ph(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(var n=0;n<e.length;n++)if(!Oc(e[n])){var r=Dl(e[n]),i=r[0];if("string"===typeof(r=r[1])){r=r.trim();var a=t[i]||[];t[i]=a,a.push(r)}}!function(e,t){for(var n in e)t.call(void 0,e[n],n,e)}(t,(function(e){return e.join(", ")}))})(this.g),400==r&&0<u.indexOf("Unknown SID")?(this.o=3,nf(12)):(this.o=0,nf(13)),Nf(this),Af(this)}}}catch(t){}},pc.mb=function(){if(this.g){var e=Ph(this.g),t=this.g.ja();this.C<t.length&&(Cf(this),Tf(this,e,t),this.i&&4!=e&&Ef(this))}},pc.cancel=function(){this.J=!0,Nf(this)},pc.lb=function(){this.B=null;var e=Date.now();0<=e-this.Y?(function(e,t){e.info((function(){return"TIMEOUT: "+t}))}(this.j,this.A),2!=this.L&&(ef(),nf(17)),Nf(this),this.o=2,Af(this)):Sf(this,this.Y-e)};var Rf=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Of(e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,e instanceof Of){this.h=e.h,Mf(this,e.j),this.s=e.s,this.g=e.g,Ff(this,e.m),this.l=e.l;var t=e.i,n=new Yf;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),Vf(this,n),this.o=e.o}else e&&(t=String(e).match(Rf))?(this.h=!1,Mf(this,t[1]||"",!0),this.s=zf(t[2]||""),this.g=zf(t[3]||"",!0),Ff(this,t[4]),this.l=zf(t[5]||"",!0),Vf(this,t[6]||"",!0),this.o=zf(t[7]||"")):(this.h=!1,this.i=new Yf(null,this.h))}function Lf(e){return new Of(e)}function Mf(e,t,n){e.j=n?zf(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function Ff(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.m=t}else e.m=null}function Vf(e,t,n){t instanceof Yf?(e.i=t,function(e,t){t&&!e.j&&(Jf(e),e.i=null,e.g.forEach((function(e,t){var n=t.toLowerCase();t!=n&&(Xf(this,t),Zf(this,n,e))}),e)),e.j=t}(e.i,e.h)):(n||(t=Bf(t,Wf)),e.i=new Yf(t,e.h))}function Uf(e,t,n){e.i.set(t,n)}function jf(e){return Uf(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function zf(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function Bf(e,t,n){return"string"===typeof e?(e=encodeURI(e).replace(t,qf),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function qf(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}Of.prototype.toString=function(){var e=[],t=this.j;t&&e.push(Bf(t,Kf,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.s)&&e.push(Bf(t,Kf,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(Bf(n,"/"==n.charAt(0)?Hf:Gf,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.o)&&e.push("#",Bf(n,Qf)),e.join("")};var Kf=/[#\/\?@]/g,Gf=/[#\?:]/g,Hf=/[#\?]/g,Wf=/[#\?@]/g,Qf=/#/g;function Yf(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Jf(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 r=e[n].indexOf("="),i=null;if(0<=r){var a=e[n].substring(0,r);i=e[n].substring(r+1)}else a=e[n];t(a,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(e.i,(function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)})))}function Xf(e,t){Jf(e),t=eh(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function $f(e,t){return Jf(e),t=eh(e,t),e.g.has(t)}function Zf(e,t,n){Xf(e,t),0<n.length&&(e.i=null,e.g.set(eh(e,t),Nc(n)),e.h+=n.length)}function eh(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}(pc=Yf.prototype).add=function(e,t){Jf(this),this.i=null,e=eh(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},pc.forEach=function(e,t){Jf(this),this.g.forEach((function(n,r){n.forEach((function(n){e.call(t,n,r,this)}),this)}),this)},pc.ta=function(){Jf(this);for(var e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[],r=0;r<t.length;r++)for(var i=e[r],a=0;a<i.length;a++)n.push(t[r]);return n},pc.Z=function(e){Jf(this);var t=[];if("string"===typeof e)$f(this,e)&&(t=t.concat(this.g.get(eh(this,e))));else{e=Array.from(this.g.values());for(var n=0;n<e.length;n++)t=t.concat(e[n])}return t},pc.set=function(e,t){return Jf(this),this.i=null,$f(this,e=eh(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},pc.get=function(e,t){return e&&0<(e=this.Z(e)).length?String(e[0]):t},pc.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var e=[],t=Array.from(this.g.keys()),n=0;n<t.length;n++){var r=t[n],i=encodeURIComponent(String(r)),a=this.Z(r);for(r=0;r<a.length;r++){var o=i;""!==a[r]&&(o+="="+encodeURIComponent(String(a[r]))),e.push(o)}}return this.i=e.join("&")};var th=k((function e(t,n){y(this,e),this.g=t,this.map=n}));function nh(e){this.l=e||rh,gc.PerformanceNavigationTiming?e=0<(e=gc.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(gc.g&&gc.g.Ka&&gc.g.Ka()&&gc.g.Ka().dc),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var rh=10;function ih(e){return!!e.h||!!e.g&&e.g.size>=e.j}function ah(e){return e.h?1:e.g?e.g.size:0}function oh(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function uh(e,t){e.g?e.g.add(t):e.h=t}function sh(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function ch(e){if(null!=e.h)return e.i.concat(e.h.F);if(null!=e.g&&0!==e.g.size){var t,n=e.i,r=w(e.g.values());try{for(r.s();!(t=r.n()).done;){var i=t.value;n=n.concat(i.F)}}catch(a){r.e(a)}finally{r.f()}return n}return Nc(e.i)}nh.prototype.cancel=function(){if(this.i=ch(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){var e,t=w(this.g.values());try{for(t.s();!(e=t.n()).done;){e.value.cancel()}}catch(n){t.e(n)}finally{t.f()}this.g.clear()}};var lh,fh=function(){function e(){y(this,e)}return k(e,[{key:"stringify",value:function(e){return gc.JSON.stringify(e,void 0)}},{key:"parse",value:function(e){return gc.JSON.parse(e,void 0)}}]),e}();function hh(){this.g=new fh}function dh(e,t,n){var r=n||"";try{Df(e,(function(e,n){var i=e;wc(e)&&(i=El(e)),t.push(r+n+"="+encodeURIComponent(i))}))}catch(i){throw t.push(r+"type="+encodeURIComponent("_badmap")),i}}function ph(e,t,n,r,i){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,i(r)}catch(a){}}function vh(e){this.l=e.ec||null,this.j=e.ob||!1}function mh(e,t){xl.call(this),this.F=e,this.u=t,this.m=void 0,this.readyState=yh,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}Sc(vh,sf),vh.prototype.g=function(){return new mh(this.l,this.j)},vh.prototype.i=(lh={},function(){return lh}),Sc(mh,xl);var yh=0;function gh(e){e.j.read().then(e.Xa.bind(e)).catch(e.ka.bind(e))}function kh(e){e.readyState=4,e.l=null,e.j=null,e.A=null,wh(e)}function wh(e){e.onreadystatechange&&e.onreadystatechange.call(e)}(pc=mh.prototype).open=function(e,t){if(this.readyState!=yh)throw this.abort(),Error("Error reopening a connection");this.C=e,this.B=t,this.readyState=1,wh(this)},pc.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var t={headers:this.v,method:this.C,credentials:this.m,cache:void 0};e&&(t.body=e),(this.F||gc).fetch(new Request(this.B,t)).then(this.$a.bind(this),this.ka.bind(this))},pc.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,kh(this)),this.readyState=yh},pc.$a=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,wh(this)),this.g&&(this.readyState=3,wh(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if("undefined"!==typeof gc.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;gh(this)}else e.text().then(this.Za.bind(this),this.ka.bind(this))},pc.Xa=function(e){if(this.g){if(this.u&&e.value)this.response.push(e.value);else if(!this.u){var t=e.value?e.value:new Uint8Array(0);(t=this.A.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?kh(this):wh(this),3==this.readyState&&gh(this)}},pc.Za=function(e){this.g&&(this.response=this.responseText=e,kh(this))},pc.Ya=function(e){this.g&&(this.response=e,kh(this))},pc.ka=function(){this.g&&kh(this)},pc.setRequestHeader=function(e,t){this.v.append(e,t)},pc.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},pc.getAllResponseHeaders=function(){if(!this.h)return"";for(var e=[],t=this.h.entries(),n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(mh.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}});var bh=gc.JSON.parse;function _h(e){xl.call(this),this.headers=new Map,this.u=e||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=xh,this.L=this.M=!1}Sc(_h,xl);var xh="",Th=/^https?$/i,Ih=["POST","PUT"];function Eh(e,t){e.h=!1,e.g&&(e.l=!0,e.g.abort(),e.l=!1),e.j=t,e.m=5,Sh(e),Ah(e)}function Sh(e){e.F||(e.F=!0,Tl(e,"complete"),Tl(e,"error"))}function Ch(e){if(e.h&&"undefined"!=typeof yc&&(!e.C[1]||4!=Ph(e)||2!=e.da()))if(e.v&&4==Ph(e))zl(e.La,0,e);else if(Tl(e,"readystatechange"),4==Ph(e)){e.h=!1;try{var t,n=e.da();e:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break e;default:r=!1}if(!(t=r)){var i;if(i=0===n){var a=String(e.I).match(Rf)[1]||null;!a&&gc.self&&gc.self.location&&(a=gc.self.location.protocol.slice(0,-1)),i=!Th.test(a?a.toLowerCase():"")}t=i}if(t)Tl(e,"complete"),Tl(e,"success");else{e.m=6;try{var o=2<Ph(e)?e.g.statusText:""}catch(u){o=""}e.j=o+" ["+e.da()+"]",Sh(e)}}finally{Ah(e)}}}function Ah(e,t){if(e.g){Nh(e);var n=e.g,r=e.C[0]?function(){}:null;e.g=null,e.C=null,t||Tl(e,"ready");try{n.onreadystatechange=r}catch(i){}}}function Nh(e){e.g&&e.L&&(e.g.ontimeout=null),e.A&&(gc.clearTimeout(e.A),e.A=null)}function Ph(e){return e.g?e.g.readyState:0}function Dh(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.K){case xh:case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(Ud){return null}}function Rh(e){var t="";return il(e,(function(e,n){t+=n,t+=":",t+=e,t+="\r\n"})),t}function Oh(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=Rh(n),"string"===typeof e?null!=n&&encodeURIComponent(String(n)):Uf(e,t,n))}function Lh(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function Mh(e){this.Ga=0,this.j=[],this.l=new Ql,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=Lh("failFast",!1,e),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=Lh("baseRetryDelayMs",5e3,e),this.hb=Lh("retryDelaySeedMs",1e4,e),this.eb=Lh("forwardChannelMaxRetries",2,e),this.xa=Lh("forwardChannelRequestTimeoutMs",2e4,e),this.va=e&&e.xmlHttpFactory||void 0,this.Ha=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.i=new nh(e&&e.concurrentRequestLimit),this.Ja=new hh,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=e&&e.bc||!1,e&&e.Ea&&this.l.Ea(),e&&e.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&e&&e.detectBufferingProxy||!1,this.qa=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.qa=e.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}function Fh(e){if(Uh(e),3==e.H){var t=e.W++,n=Lf(e.I);if(Uf(n,"SID",e.K),Uf(n,"RID",t),Uf(n,"TYPE","terminate"),Bh(e,n),(t=new mf(e,e.l,t)).L=2,t.v=jf(Lf(n)),n=!1,gc.navigator&&gc.navigator.sendBeacon)try{n=gc.navigator.sendBeacon(t.v.toString(),"")}catch(r){}!n&&gc.Image&&((new Image).src=t.v,n=!0),n||(t.g=ed(t.l,null),t.g.ha(t.v)),t.G=Date.now(),Ef(t)}$h(e)}function Vh(e){e.g&&(Hh(e),e.g.cancel(),e.g=null)}function Uh(e){Vh(e),e.u&&(gc.clearTimeout(e.u),e.u=null),Qh(e),e.i.cancel(),e.m&&("number"===typeof e.m&&gc.clearTimeout(e.m),e.m=null)}function jh(e){if(!ih(e.i)&&!e.m){e.m=!0;var t=e.Na;Ol||Fl(),Ll||(Ol(),Ll=!0),Ml.add(t,e),e.C=0}}function zh(e,t){var n;n=t?t.m:e.W++;var r=Lf(e.I);Uf(r,"SID",e.K),Uf(r,"RID",n),Uf(r,"AID",e.V),Bh(e,r),e.o&&e.s&&Oh(r,e.o,e.s),n=new mf(e,e.l,n,e.C+1),null===e.o&&(n.I=e.s),t&&(e.j=t.F.concat(e.j)),t=qh(e,n,1e3),n.setTimeout(Math.round(.5*e.xa)+Math.round(.5*e.xa*Math.random())),uh(e.i,n),bf(n,r,t)}function Bh(e,t){e.na&&il(e.na,(function(e,n){Uf(t,n,e)})),e.h&&Df({},(function(e,n){Uf(t,n,e)}))}function qh(e,t,n){n=Math.min(e.j.length,n);var r=e.h?Ic(e.h.Va,e.h,e):null;e:for(var i=e.j,a=-1;;){var o=["count="+n];-1==a?0<n?(a=i[0].g,o.push("ofs="+a)):a=0:o.push("ofs="+a);for(var u=!0,s=0;s<n;s++){var c=i[s].g,l=i[s].map;if(0>(c-=a))a=Math.max(0,i[s].g-100),u=!1;else try{dh(l,o,"req"+c+"_")}catch(rv){r&&r(l)}}if(u){r=o.join("&");break e}}return e=e.j.splice(0,n),t.F=e,r}function Kh(e){if(!e.g&&!e.u){e.ba=1;var t=e.Ma;Ol||Fl(),Ll||(Ol(),Ll=!0),Ml.add(t,e),e.A=0}}function Gh(e){return!(e.g||e.u||3<=e.A)&&(e.ba++,e.u=af(Ic(e.Ma,e),Jh(e,e.A)),e.A++,!0)}function Hh(e){null!=e.B&&(gc.clearTimeout(e.B),e.B=null)}function Wh(e){e.g=new mf(e,e.l,"rpc",e.ba),null===e.o&&(e.g.I=e.s),e.g.O=0;var t=Lf(e.wa);Uf(t,"RID","rpc"),Uf(t,"SID",e.K),Uf(t,"AID",e.V),Uf(t,"CI",e.G?"0":"1"),!e.G&&e.qa&&Uf(t,"TO",e.qa),Uf(t,"TYPE","xmlhttp"),Bh(e,t),e.o&&e.s&&Oh(t,e.o,e.s),e.L&&e.g.setTimeout(e.L);var n=e.g;e=e.pa,n.L=1,n.v=jf(Lf(t)),n.s=null,n.S=!0,_f(n,e)}function Qh(e){null!=e.v&&(gc.clearTimeout(e.v),e.v=null)}function Yh(e,t){var n=null;if(e.g==t){Qh(e),Hh(e),e.g=null;var r=2}else{if(!oh(e.i,t))return;n=t.F,sh(e.i,t),r=1}if(0!=e.H)if(t.i)if(1==r){n=t.s?t.s.length:0,t=Date.now()-t.G;var i=e.C;Tl(r=$l(),new rf(r,n)),jh(e)}else Kh(e);else if(3==(i=t.o)||0==i&&0<t.ca||!(1==r&&function(e,t){return!(ah(e.i)>=e.i.j-(e.m?1:0))&&(e.m?(e.j=t.F.concat(e.j),!0):!(1==e.H||2==e.H||e.C>=(e.cb?0:e.eb))&&(e.m=af(Ic(e.Na,e,t),Jh(e,e.C)),e.C++,!0))}(e,t)||2==r&&Gh(e)))switch(n&&0<n.length&&(t=e.i,t.i=t.i.concat(n)),i){case 1:Xh(e,5);break;case 4:Xh(e,10);break;case 3:Xh(e,6);break;default:Xh(e,2)}}function Jh(e,t){var n=e.ab+Math.floor(Math.random()*e.hb);return e.isActive()||(n*=2),n*t}function Xh(e,t){if(e.l.info("Error code "+t),2==t){var n=null;e.h&&(n=null);var r=Ic(e.pb,e);n||(n=new Of("//www.google.com/images/cleardot.gif"),gc.location&&"http"==gc.location.protocol||Mf(n,"https"),jf(n)),function(e,t){var n=new Ql;if(gc.Image){var r=new Image;r.onload=Ec(ph,n,r,"TestLoadImage: loaded",!0,t),r.onerror=Ec(ph,n,r,"TestLoadImage: error",!1,t),r.onabort=Ec(ph,n,r,"TestLoadImage: abort",!1,t),r.ontimeout=Ec(ph,n,r,"TestLoadImage: timeout",!1,t),gc.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=e}else t(!1)}(n.toString(),r)}else nf(2);e.H=0,e.h&&e.h.za(t),$h(e),Uh(e)}function $h(e){if(e.H=0,e.ma=[],e.h){var t=ch(e.i);0==t.length&&0==e.j.length||(Pc(e.ma,t),Pc(e.ma,e.j),e.i.i.length=0,Nc(e.j),e.j.length=0),e.h.ya()}}function Zh(e,t,n){var r=n instanceof Of?Lf(n):new Of(n);if(""!=r.g)t&&(r.g=t+"."+r.g),Ff(r,r.m);else{var i=gc.location;r=i.protocol,t=t?t+"."+i.hostname:i.hostname,i=+i.port;var a=new Of(null);r&&Mf(a,r),t&&(a.g=t),i&&Ff(a,i),n&&(a.l=n),r=a}return n=e.F,t=e.Da,n&&t&&Uf(r,n,t),Uf(r,"VER",e.ra),Bh(e,r),r}function ed(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=n&&e.Ha&&!e.va?new _h(new vh({ob:!0})):new _h(e.va)).Oa(e.J),t}function td(){}function nd(){if(zc&&!(10<=Number(Xc)))throw Error("Environmental error: no available transport.")}function rd(e,t){xl.call(this),this.g=new Mh(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.s=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.Ca&&(e?e["X-WebChannel-Client-Profile"]=t.Ca:e={"X-WebChannel-Client-Profile":t.Ca}),this.g.U=e,(e=t&&t.cc)&&!Oc(e)&&(this.g.o=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!Oc(t)&&(this.g.F=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new od(this)}function id(e){df.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(var 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 ad(){pf.call(this),this.status=1}function od(e){this.g=e}function ud(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}function sd(e,t,n){n||(n=0);var r=Array(16);if("string"===typeof t)for(var i=0;16>i;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;16>i;++i)r[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];var a=e.g[3],o=t+(a^n&(i^a))+r[0]+3614090360&4294967295;o=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=(n=(i=(a=(t=n+(o<<7&4294967295|o>>>25))+((o=a+(i^t&(n^i))+r[1]+3905402710&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^a&(t^n))+r[2]+606105819&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(a^t))+r[3]+3250441966&4294967295)<<22&4294967295|o>>>10))+((o=t+(a^n&(i^a))+r[4]+4118548399&4294967295)<<7&4294967295|o>>>25))+((o=a+(i^t&(n^i))+r[5]+1200080426&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^a&(t^n))+r[6]+2821735955&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(a^t))+r[7]+4249261313&4294967295)<<22&4294967295|o>>>10))+((o=t+(a^n&(i^a))+r[8]+1770035416&4294967295)<<7&4294967295|o>>>25))+((o=a+(i^t&(n^i))+r[9]+2336552879&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^a&(t^n))+r[10]+4294925233&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(a^t))+r[11]+2304563134&4294967295)<<22&4294967295|o>>>10))+((o=t+(a^n&(i^a))+r[12]+1804603682&4294967295)<<7&4294967295|o>>>25))+((o=a+(i^t&(n^i))+r[13]+4254626195&4294967295)<<12&4294967295|o>>>20))+((o=i+(n^a&(t^n))+r[14]+2792965006&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^i&(a^t))+r[15]+1236535329&4294967295)<<22&4294967295|o>>>10))+((o=t+(i^a&(n^i))+r[1]+4129170786&4294967295)<<5&4294967295|o>>>27))+((o=a+(n^i&(t^n))+r[6]+3225465664&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(a^t))+r[11]+643717713&4294967295)<<14&4294967295|o>>>18))+((o=n+(a^t&(i^a))+r[0]+3921069994&4294967295)<<20&4294967295|o>>>12))+((o=t+(i^a&(n^i))+r[5]+3593408605&4294967295)<<5&4294967295|o>>>27))+((o=a+(n^i&(t^n))+r[10]+38016083&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(a^t))+r[15]+3634488961&4294967295)<<14&4294967295|o>>>18))+((o=n+(a^t&(i^a))+r[4]+3889429448&4294967295)<<20&4294967295|o>>>12))+((o=t+(i^a&(n^i))+r[9]+568446438&4294967295)<<5&4294967295|o>>>27))+((o=a+(n^i&(t^n))+r[14]+3275163606&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(a^t))+r[3]+4107603335&4294967295)<<14&4294967295|o>>>18))+((o=n+(a^t&(i^a))+r[8]+1163531501&4294967295)<<20&4294967295|o>>>12))+((o=t+(i^a&(n^i))+r[13]+2850285829&4294967295)<<5&4294967295|o>>>27))+((o=a+(n^i&(t^n))+r[2]+4243563512&4294967295)<<9&4294967295|o>>>23))+((o=i+(t^n&(a^t))+r[7]+1735328473&4294967295)<<14&4294967295|o>>>18))+((o=n+(a^t&(i^a))+r[12]+2368359562&4294967295)<<20&4294967295|o>>>12))+((o=t+(n^i^a)+r[5]+4294588738&4294967295)<<4&4294967295|o>>>28))+((o=a+(t^n^i)+r[8]+2272392833&4294967295)<<11&4294967295|o>>>21))+((o=i+(a^t^n)+r[11]+1839030562&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^a^t)+r[14]+4259657740&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^i^a)+r[1]+2763975236&4294967295)<<4&4294967295|o>>>28))+((o=a+(t^n^i)+r[4]+1272893353&4294967295)<<11&4294967295|o>>>21))+((o=i+(a^t^n)+r[7]+4139469664&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^a^t)+r[10]+3200236656&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^i^a)+r[13]+681279174&4294967295)<<4&4294967295|o>>>28))+((o=a+(t^n^i)+r[0]+3936430074&4294967295)<<11&4294967295|o>>>21))+((o=i+(a^t^n)+r[3]+3572445317&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^a^t)+r[6]+76029189&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^i^a)+r[9]+3654602809&4294967295)<<4&4294967295|o>>>28))+((o=a+(t^n^i)+r[12]+3873151461&4294967295)<<11&4294967295|o>>>21))+((o=i+(a^t^n)+r[15]+530742520&4294967295)<<16&4294967295|o>>>16))+((o=n+(i^a^t)+r[2]+3299628645&4294967295)<<23&4294967295|o>>>9))+((o=t+(i^(n|~a))+r[0]+4096336452&4294967295)<<6&4294967295|o>>>26))+((o=a+(n^(t|~i))+r[7]+1126891415&4294967295)<<10&4294967295|o>>>22))+((o=i+(t^(a|~n))+r[14]+2878612391&4294967295)<<15&4294967295|o>>>17))+((o=n+(a^(i|~t))+r[5]+4237533241&4294967295)<<21&4294967295|o>>>11))+((o=t+(i^(n|~a))+r[12]+1700485571&4294967295)<<6&4294967295|o>>>26))+((o=a+(n^(t|~i))+r[3]+2399980690&4294967295)<<10&4294967295|o>>>22))+((o=i+(t^(a|~n))+r[10]+4293915773&4294967295)<<15&4294967295|o>>>17))+((o=n+(a^(i|~t))+r[1]+2240044497&4294967295)<<21&4294967295|o>>>11))+((o=t+(i^(n|~a))+r[8]+1873313359&4294967295)<<6&4294967295|o>>>26))+((o=a+(n^(t|~i))+r[15]+4264355552&4294967295)<<10&4294967295|o>>>22))+((o=i+(t^(a|~n))+r[6]+2734768916&4294967295)<<15&4294967295|o>>>17))+((o=n+(a^(i|~t))+r[13]+1309151649&4294967295)<<21&4294967295|o>>>11))+((a=(t=n+((o=t+(i^(n|~a))+r[4]+4149444226&4294967295)<<6&4294967295|o>>>26))+((o=a+(n^(t|~i))+r[11]+3174756917&4294967295)<<10&4294967295|o>>>22))^((i=a+((o=i+(t^(a|~n))+r[2]+718787259&4294967295)<<15&4294967295|o>>>17))|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+a&4294967295}function cd(e,t){this.h=t;for(var n=[],r=!0,i=e.length-1;0<=i;i--){var a=0|e[i];r&&a==t||(n[i]=a,r=!1)}this.g=n}(pc=_h.prototype).Oa=function(e){this.M=e},pc.ha=function(e,t,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+e);t=t?t.toUpperCase():"GET",this.I=e,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():ff.g(),this.C=this.u?cf(this.u):cf(ff),this.g.onreadystatechange=Ic(this.La,this);try{this.G=!0,this.g.open(t,String(e),!0),this.G=!1}catch(u){return void Eh(this,u)}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else{if("function"!==typeof r.keys||"function"!==typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));var a,o=w(r.keys());try{for(o.s();!(a=o.n()).done;){var u=a.value;n.set(u,r.get(u))}}catch(d){o.e(d)}finally{o.f()}}r=Array.from(n.keys()).find((function(e){return"content-type"==e.toLowerCase()})),i=gc.FormData&&e instanceof gc.FormData,!(0<=Ac(Ih,t))||r||i||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");var s,c=w(n);try{for(c.s();!(s=c.n()).done;){var l=m(s.value,2),f=l[0],h=l[1];this.g.setRequestHeader(f,h)}}catch(d){c.e(d)}finally{c.f()}this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{Nh(this),0<this.B&&((this.L=function(e){return zc&&"number"===typeof e.timeout&&void 0!==e.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Ic(this.ua,this)):this.A=zl(this.ua,this.B,this)),this.v=!0,this.g.send(e),this.v=!1}catch(u){Eh(this,u)}},pc.ua=function(){"undefined"!=typeof yc&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Tl(this,"timeout"),this.abort(8))},pc.abort=function(e){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=e||7,Tl(this,"complete"),Tl(this,"abort"),Ah(this))},pc.N=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Ah(this,!0)),_h.$.N.call(this)},pc.La=function(){this.s||(this.G||this.v||this.l?Ch(this):this.kb())},pc.kb=function(){Ch(this)},pc.isActive=function(){return!!this.g},pc.da=function(){try{return 2<Ph(this)?this.g.status:-1}catch(lh){return-1}},pc.ja=function(){try{return this.g?this.g.responseText:""}catch(lh){return""}},pc.Wa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),bh(t)}},pc.Ia=function(){return this.m},pc.Sa=function(){return"string"===typeof this.j?this.j:String(this.j)},(pc=Mh.prototype).ra=8,pc.H=1,pc.Na=function(e){if(this.m)if(this.m=null,1==this.H){if(!e){this.W=Math.floor(1e5*Math.random()),e=this.W++;var t=new mf(this,this.l,e),n=this.s;if(this.U&&(n?ul(n=al(n),this.U):n=this.U),null!==this.o||this.O||(t.I=n,n=null),this.P)e:{for(var r=0,i=0;i<this.j.length;i++){var a=this.j[i];if(void 0===(a="__data__"in a.map&&"string"===typeof(a=a.map.__data__)?a.length:void 0))break;if(4096<(r+=a)){r=i;break e}if(4096===r||i===this.j.length-1){r=i+1;break e}}r=1e3}else r=1e3;r=qh(this,t,r),Uf(i=Lf(this.I),"RID",e),Uf(i,"CVER",22),this.F&&Uf(i,"X-HTTP-Session-Id",this.F),Bh(this,i),n&&(this.O?r="headers="+encodeURIComponent(String(Rh(n)))+"&"+r:this.o&&Oh(i,this.o,n)),uh(this.i,t),this.bb&&Uf(i,"TYPE","init"),this.P?(Uf(i,"$req",r),Uf(i,"SID","null"),t.aa=!0,bf(t,i,null)):bf(t,i,r),this.H=2}}else 3==this.H&&(e?zh(this,e):0==this.j.length||ih(this.i)||zh(this))},pc.Ma=function(){if(this.u=null,Wh(this),this.ca&&!(this.M||null==this.g||0>=this.S)){var e=2*this.S;this.l.info("BP detection timer enabled: "+e),this.B=af(Ic(this.jb,this),e)}},pc.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,nf(10),Vh(this),Wh(this))},pc.ib=function(){null!=this.v&&(this.v=null,Vh(this),Gh(this),nf(19))},pc.pb=function(e){e?(this.l.info("Successfully pinged google.com"),nf(2)):(this.l.info("Failed to ping google.com"),nf(1))},pc.isActive=function(){return!!this.h&&this.h.isActive(this)},(pc=td.prototype).Ba=function(){},pc.Aa=function(){},pc.za=function(){},pc.ya=function(){},pc.isActive=function(){return!0},pc.Va=function(){},nd.prototype.g=function(e,t){return new rd(e,t)},Sc(rd,xl),rd.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var e=this.g,t=this.l,n=this.h||void 0;nf(0),e.Y=t,e.na=n||{},e.G=e.aa,e.I=Zh(e,null,e.Y),jh(e)},rd.prototype.close=function(){Fh(this.g)},rd.prototype.u=function(e){var t=this.g;if("string"===typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=El(e),e=n);t.j.push(new th(t.fb++,e)),3==t.H&&jh(t)},rd.prototype.N=function(){this.g.h=null,delete this.j,Fh(this.g),delete this.g,rd.$.N.call(this)},Sc(id,df),Sc(ad,pf),Sc(od,td),od.prototype.Ba=function(){Tl(this.g,"a")},od.prototype.Aa=function(e){Tl(this.g,new id(e))},od.prototype.za=function(e){Tl(this.g,new ad)},od.prototype.ya=function(){Tl(this.g,"b")},Sc(ud,(function(){this.blockSize=-1})),ud.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0},ud.prototype.j=function(e,t){void 0===t&&(t=e.length);for(var n=t-this.blockSize,r=this.m,i=this.h,a=0;a<t;){if(0==i)for(;a<=n;)sd(this,e,a),a+=this.blockSize;if("string"===typeof e){for(;a<t;)if(r[i++]=e.charCodeAt(a++),i==this.blockSize){sd(this,r),i=0;break}}else for(;a<t;)if(r[i++]=e[a++],i==this.blockSize){sd(this,r),i=0;break}}this.h=i,this.i+=t},ud.prototype.l=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.i;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.j(e),e=Array(16),t=n=0;4>t;++t)for(var r=0;32>r;r+=8)e[n++]=this.g[t]>>>r&255;return e};var ld={};function fd(e){return-128<=e&&128>e?function(e,t){var n=ld;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,(function(e){return new cd([0|e],0>e?-1:0)})):new cd([0|e],0>e?-1:0)}function hd(e){if(isNaN(e)||!isFinite(e))return pd;if(0>e)return kd(hd(-e));for(var t=[],n=1,r=0;e>=n;r++)t[r]=e/n|0,n*=dd;return new cd(t,0)}var dd=4294967296,pd=fd(0),vd=fd(1),md=fd(16777216);function yd(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 gd(e){return-1==e.h}function kd(e){for(var t=e.g.length,n=[],r=0;r<t;r++)n[r]=~e.g[r];return new cd(n,~e.h).add(vd)}function wd(e,t){return e.add(kd(t))}function bd(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function _d(e,t){this.g=e,this.h=t}function xd(e,t){if(yd(t))throw Error("division by zero");if(yd(e))return new _d(pd,pd);if(gd(e))return t=xd(kd(e),t),new _d(kd(t.g),kd(t.h));if(gd(t))return t=xd(e,kd(t)),new _d(kd(t.g),t.h);if(30<e.g.length){if(gd(e)||gd(t))throw Error("slowDivide_ only works with positive integers.");for(var n=vd,r=t;0>=r.X(e);)n=Td(n),r=Td(r);var i=Id(n,1),a=Id(r,1);for(r=Id(r,2),n=Id(n,2);!yd(r);){var o=a.add(r);0>=o.X(e)&&(i=i.add(n),a=o),r=Id(r,1),n=Id(n,1)}return t=wd(e,i.R(t)),new _d(i,t)}for(i=pd;0<=e.X(t);){for(n=Math.max(1,Math.floor(e.ea()/t.ea())),r=48>=(r=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,r-48),o=(a=hd(n)).R(t);gd(o)||0<o.X(e);)o=(a=hd(n-=r)).R(t);yd(a)&&(a=vd),i=i.add(a),e=wd(e,o)}return new _d(i,e)}function Td(e){for(var t=e.g.length+1,n=[],r=0;r<t;r++)n[r]=e.D(r)<<1|e.D(r-1)>>>31;return new cd(n,e.h)}function Id(e,t){var n=t>>5;t%=32;for(var r=e.g.length-n,i=[],a=0;a<r;a++)i[a]=0<t?e.D(a+n)>>>t|e.D(a+n+1)<<32-t:e.D(a+n);return new cd(i,e.h)}(pc=cd.prototype).ea=function(){if(gd(this))return-kd(this).ea();for(var e=0,t=1,n=0;n<this.g.length;n++){var r=this.D(n);e+=(0<=r?r:dd+r)*t,t*=dd}return e},pc.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(yd(this))return"0";if(gd(this))return"-"+kd(this).toString(e);for(var t=hd(Math.pow(e,6)),n=this,r="";;){var i=xd(n,t).g,a=((0<(n=wd(n,i.R(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(yd(n=i))return a+r;for(;6>a.length;)a="0"+a;r=a+r}},pc.D=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},pc.X=function(e){return gd(e=wd(this,e))?-1:yd(e)?0:1},pc.abs=function(){return gd(this)?kd(this):this},pc.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0,i=0;i<=t;i++){var a=r+(65535&this.D(i))+(65535&e.D(i)),o=(a>>>16)+(this.D(i)>>>16)+(e.D(i)>>>16);r=o>>>16,a&=65535,o&=65535,n[i]=o<<16|a}return new cd(n,-2147483648&n[n.length-1]?-1:0)},pc.R=function(e){if(yd(this)||yd(e))return pd;if(gd(this))return gd(e)?kd(this).R(kd(e)):kd(kd(this).R(e));if(gd(e))return kd(this.R(kd(e)));if(0>this.X(md)&&0>e.X(md))return hd(this.ea()*e.ea());for(var t=this.g.length+e.g.length,n=[],r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(var i=0;i<e.g.length;i++){var a=this.D(r)>>>16,o=65535&this.D(r),u=e.D(i)>>>16,s=65535&e.D(i);n[2*r+2*i]+=o*s,bd(n,2*r+2*i),n[2*r+2*i+1]+=a*s,bd(n,2*r+2*i+1),n[2*r+2*i+1]+=o*u,bd(n,2*r+2*i+1),n[2*r+2*i+2]+=a*u,bd(n,2*r+2*i+2)}for(r=0;r<t;r++)n[r]=n[2*r+1]<<16|n[2*r];for(r=t;r<2*t;r++)n[r]=0;return new cd(n,0)},pc.gb=function(e){return xd(this,e).h},pc.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.D(r)&e.D(r);return new cd(n,this.h&e.h)},pc.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.D(r)|e.D(r);return new cd(n,this.h|e.h)},pc.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.D(r)^e.D(r);return new cd(n,this.h^e.h)},nd.prototype.createWebChannel=nd.prototype.g,rd.prototype.send=rd.prototype.u,rd.prototype.open=rd.prototype.m,rd.prototype.close=rd.prototype.close,of.NO_ERROR=0,of.TIMEOUT=8,of.HTTP_ERROR=6,uf.COMPLETE="complete",lf.EventType=hf,hf.OPEN="a",hf.CLOSE="b",hf.ERROR="c",hf.MESSAGE="d",xl.prototype.listen=xl.prototype.O,_h.prototype.listenOnce=_h.prototype.P,_h.prototype.getLastError=_h.prototype.Sa,_h.prototype.getLastErrorCode=_h.prototype.Ia,_h.prototype.getStatus=_h.prototype.da,_h.prototype.getResponseJson=_h.prototype.Wa,_h.prototype.getResponseText=_h.prototype.ja,_h.prototype.send=_h.prototype.ha,_h.prototype.setWithCredentials=_h.prototype.Oa,ud.prototype.digest=ud.prototype.l,ud.prototype.reset=ud.prototype.reset,ud.prototype.update=ud.prototype.j,cd.prototype.add=cd.prototype.add,cd.prototype.multiply=cd.prototype.R,cd.prototype.modulo=cd.prototype.gb,cd.prototype.compare=cd.prototype.X,cd.prototype.toNumber=cd.prototype.ea,cd.prototype.toString=cd.prototype.toString,cd.prototype.getBits=cd.prototype.D,cd.fromNumber=hd,cd.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 kd(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var r=hd(Math.pow(n,8)),i=pd,a=0;a<t.length;a+=8){var o=Math.min(8,t.length-a),u=parseInt(t.substring(a,a+o),n);8>o?(o=hd(Math.pow(n,o)),i=i.R(o).add(hd(u))):i=(i=i.R(r)).add(hd(u))}return i};var Ed=mc.createWebChannelTransport=function(){return new nd},Sd=mc.getStatEventTarget=function(){return $l()},Cd=mc.ErrorCode=of,Ad=mc.EventType=uf,Nd=mc.Event=Jl,Pd=mc.Stat={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},Dd=(mc.FetchXmlHttpFactory=vh,mc.WebChannel=lf),Rd=mc.XhrIo=_h,Od=mc.Md5=ud,Ld=mc.Integer=cd,Md="@firebase/firestore",Fd=function(){function e(t){y(this,e),this.uid=t}return k(e,[{key:"isAuthenticated",value:function(){return null!=this.uid}},{key:"toKey",value:function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}},{key:"isEqual",value:function(e){return e.uid===this.uid}}]),e}();Fd.UNAUTHENTICATED=new Fd(null),Fd.GOOGLE_CREDENTIALS=new Fd("google-credentials-uid"),Fd.FIRST_PARTY=new Fd("first-party-uid"),Fd.MOCK_USER=new Fd("mock-user");var Vd="10.5.0",Ud=new ge("@firebase/firestore");function jd(){return Ud.logLevel}function zd(e){if(Ud.logLevel<=fe.DEBUG){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n.map(Kd);Ud.debug.apply(Ud,["Firestore (".concat(Vd,"): ").concat(e)].concat(oe(i)))}}function Bd(e){if(Ud.logLevel<=fe.ERROR){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n.map(Kd);Ud.error.apply(Ud,["Firestore (".concat(Vd,"): ").concat(e)].concat(oe(i)))}}function qd(e){if(Ud.logLevel<=fe.WARN){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=n.map(Kd);Ud.warn.apply(Ud,["Firestore (".concat(Vd,"): ").concat(e)].concat(oe(i)))}}function Kd(e){if("string"==typeof e)return e;try{return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}function Gd(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unexpected state",t="FIRESTORE (".concat(Vd,") INTERNAL ASSERTION FAILED: ")+e;throw Bd(t),new Error(t)}function Hd(e,t){e||Gd()}function Wd(e,t){return e}var Qd={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},Yd=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this,e,r)).code=e,i.message=r,i.toString=function(){return"".concat(i.name,": [code=").concat(i.code,"]: ").concat(i.message)},i}return k(n)}(G),Jd=k((function e(){var t=this;y(this,e),this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))})),Xd=k((function e(t,n){y(this,e),this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization","Bearer ".concat(t))})),$d=function(){function e(){y(this,e)}return k(e,[{key:"getToken",value:function(){return Promise.resolve(null)}},{key:"invalidateToken",value:function(){}},{key:"start",value:function(e,t){e.enqueueRetryable((function(){return t(Fd.UNAUTHENTICATED)}))}},{key:"shutdown",value:function(){}}]),e}(),Zd=function(){function e(t){y(this,e),this.token=t,this.changeListener=null}return k(e,[{key:"getToken",value:function(){return Promise.resolve(this.token)}},{key:"invalidateToken",value:function(){}},{key:"start",value:function(e,t){var n=this;this.changeListener=t,e.enqueueRetryable((function(){return t(n.token.user)}))}},{key:"shutdown",value:function(){this.changeListener=null}}]),e}(),ep=function(){function e(t){y(this,e),this.t=t,this.currentUser=Fd.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}return k(e,[{key:"start",value:function(e,t){var n=this,r=this.i,i=function(e){return n.i!==r?(r=n.i,t(e)):Promise.resolve()},o=new Jd;this.o=function(){n.i++,n.currentUser=n.u(),o.resolve(),o=new Jd,e.enqueueRetryable((function(){return i(n.currentUser)}))};var s=function(){var t=o;e.enqueueRetryable(u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.promise;case 2:return e.next=4,i(n.currentUser);case 4:case"end":return e.stop()}}),e)}))))},c=function(e){zd("FirebaseAuthCredentialsProvider","Auth detected"),n.auth=e,n.auth.addAuthTokenListener(n.o),s()};this.t.onInit((function(e){return c(e)})),setTimeout((function(){if(!n.auth){var e=n.t.getImmediate({optional:!0});e?c(e):(zd("FirebaseAuthCredentialsProvider","Auth not yet detected"),o.resolve(),o=new Jd)}}),0),s()}},{key:"getToken",value:function(){var e=this,t=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then((function(n){return e.i!==t?(zd("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),e.getToken()):n?(Hd("string"==typeof n.accessToken),new Xd(n.accessToken,e.currentUser)):null})):Promise.resolve(null)}},{key:"invalidateToken",value:function(){this.forceRefresh=!0}},{key:"shutdown",value:function(){this.auth&&this.auth.removeAuthTokenListener(this.o)}},{key:"u",value:function(){var e=this.auth&&this.auth.getUid();return Hd(null===e||"string"==typeof e),new Fd(e)}}]),e}(),tp=function(){function e(t,n,r){y(this,e),this.l=t,this.h=n,this.P=r,this.type="FirstParty",this.user=Fd.FIRST_PARTY,this.I=new Map}return k(e,[{key:"T",value:function(){return this.P?this.P():null}},{key:"headers",get:function(){this.I.set("X-Goog-AuthUser",this.l);var e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}]),e}(),np=function(){function e(t,n,r){y(this,e),this.l=t,this.h=n,this.P=r}return k(e,[{key:"getToken",value:function(){return Promise.resolve(new tp(this.l,this.h,this.P))}},{key:"start",value:function(e,t){e.enqueueRetryable((function(){return t(Fd.FIRST_PARTY)}))}},{key:"shutdown",value:function(){}},{key:"invalidateToken",value:function(){}}]),e}(),rp=k((function e(t){y(this,e),this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)})),ip=function(){function e(t){y(this,e),this.A=t,this.forceRefresh=!1,this.appCheck=null,this.R=null}return k(e,[{key:"start",value:function(e,t){var n=this,r=function(e){null!=e.error&&zd("FirebaseAppCheckTokenProvider","Error getting App Check token; using placeholder token instead. Error: ".concat(e.error.message));var r=e.token!==n.R;return n.R=e.token,zd("FirebaseAppCheckTokenProvider","Received ".concat(r?"new":"existing"," token.")),r?t(e.token):Promise.resolve()};this.o=function(t){e.enqueueRetryable((function(){return r(t)}))};var i=function(e){zd("FirebaseAppCheckTokenProvider","AppCheck detected"),n.appCheck=e,n.appCheck.addTokenListener(n.o)};this.A.onInit((function(e){return i(e)})),setTimeout((function(){if(!n.appCheck){var e=n.A.getImmediate({optional:!0});e?i(e):zd("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}},{key:"getToken",value:function(){var e=this,t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((function(t){return t?(Hd("string"==typeof t.token),e.R=t.token,new rp(t.token)):null})):Promise.resolve(null)}},{key:"invalidateToken",value:function(){this.forceRefresh=!0}},{key:"shutdown",value:function(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}]),e}();function ap(e){var t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(var r=0;r<e;r++)n[r]=Math.floor(256*Math.random());return n}var op=function(){function e(){y(this,e)}return k(e,null,[{key:"V",value:function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(256/62),n="";n.length<20;)for(var r=ap(40),i=0;i<r.length;++i)n.length<20&&r[i]<t&&(n+=e.charAt(r[i]%62));return n}}]),e}();function up(e,t){return e<t?-1:e>t?1:0}function sp(e,t,n){return e.length===t.length&&e.every((function(e,r){return n(e,t[r])}))}function cp(e){return e+"\0"}var lp=function(){function e(t,n){if(y(this,e),this.seconds=t,this.nanoseconds=n,n<0)throw new Yd(Qd.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new Yd(Qd.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(t<-62135596800)throw new Yd(Qd.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Yd(Qd.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}return k(e,[{key:"toDate",value:function(){return new Date(this.toMillis())}},{key:"toMillis",value:function(){return 1e3*this.seconds+this.nanoseconds/1e6}},{key:"_compareTo",value:function(e){return this.seconds===e.seconds?up(this.nanoseconds,e.nanoseconds):up(this.seconds,e.seconds)}},{key:"isEqual",value:function(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}},{key:"toString",value:function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}},{key:"toJSON",value:function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}},{key:"valueOf",value:function(){var e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}],[{key:"now",value:function(){return e.fromMillis(Date.now())}},{key:"fromDate",value:function(t){return e.fromMillis(t.getTime())}},{key:"fromMillis",value:function(t){var n=Math.floor(t/1e3);return new e(n,Math.floor(1e6*(t-1e3*n)))}}]),e}(),fp=function(){function e(t){y(this,e),this.timestamp=t}return k(e,[{key:"compareTo",value:function(e){return this.timestamp._compareTo(e.timestamp)}},{key:"isEqual",value:function(e){return this.timestamp.isEqual(e.timestamp)}},{key:"toMicroseconds",value:function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}},{key:"toString",value:function(){return"SnapshotVersion("+this.timestamp.toString()+")"}},{key:"toTimestamp",value:function(){return this.timestamp}}],[{key:"fromTimestamp",value:function(t){return new e(t)}},{key:"min",value:function(){return new e(new lp(0,0))}},{key:"max",value:function(){return new e(new lp(253402300799,999999999))}}]),e}(),hp=function(){function e(t,n,r){y(this,e),void 0===n?n=0:n>t.length&&Gd(),void 0===r?r=t.length-n:r>t.length-n&&Gd(),this.segments=t,this.offset=n,this.len=r}return k(e,[{key:"length",get:function(){return this.len}},{key:"isEqual",value:function(t){return 0===e.comparator(this,t)}},{key:"child",value:function(t){var n=this.segments.slice(this.offset,this.limit());return t instanceof e?t.forEach((function(e){n.push(e)})):n.push(t),this.construct(n)}},{key:"limit",value:function(){return this.offset+this.length}},{key:"popFirst",value:function(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}},{key:"popLast",value:function(){return this.construct(this.segments,this.offset,this.length-1)}},{key:"firstSegment",value:function(){return this.segments[this.offset]}},{key:"lastSegment",value:function(){return this.get(this.length-1)}},{key:"get",value:function(e){return this.segments[this.offset+e]}},{key:"isEmpty",value:function(){return 0===this.length}},{key:"isPrefixOf",value:function(e){if(e.length<this.length)return!1;for(var t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}},{key:"isImmediateParentOf",value:function(e){if(this.length+1!==e.length)return!1;for(var t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}},{key:"forEach",value:function(e){for(var t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}},{key:"toArray",value:function(){return this.segments.slice(this.offset,this.limit())}}],[{key:"comparator",value:function(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){var i=e.get(r),a=t.get(r);if(i<a)return-1;if(i>a)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}]),e}(),dp=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.apply(this,arguments)}return k(n,[{key:"construct",value:function(e,t,r){return new n(e,t,r)}},{key:"canonicalString",value:function(){return this.toArray().join("/")}},{key:"toString",value:function(){return this.canonicalString()}}],[{key:"fromString",value:function(){for(var e=[],t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];for(var a=0,o=r;a<o.length;a++){var u=o[a];if(u.indexOf("//")>=0)throw new Yd(Qd.INVALID_ARGUMENT,"Invalid segment (".concat(u,"). Paths must not contain // in them."));e.push.apply(e,oe(u.split("/").filter((function(e){return e.length>0}))))}return new n(e)}},{key:"emptyPath",value:function(){return new n([])}}]),n}(hp),pp=/^[_a-zA-Z][_a-zA-Z0-9]*$/,vp=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.apply(this,arguments)}return k(n,[{key:"construct",value:function(e,t,r){return new n(e,t,r)}},{key:"canonicalString",value:function(){return this.toArray().map((function(e){return e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),n.isValidIdentifier(e)||(e="`"+e+"`"),e})).join(".")}},{key:"toString",value:function(){return this.canonicalString()}},{key:"isKeyField",value:function(){return 1===this.length&&"__name__"===this.get(0)}}],[{key:"isValidIdentifier",value:function(e){return pp.test(e)}},{key:"keyField",value:function(){return new n(["__name__"])}},{key:"fromServerFormat",value:function(e){for(var t=[],r="",i=0,a=function(){if(0===r.length)throw new Yd(Qd.INVALID_ARGUMENT,"Invalid field path (".concat(e,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"));t.push(r),r=""},o=!1;i<e.length;){var u=e[i];if("\\"===u){if(i+1===e.length)throw new Yd(Qd.INVALID_ARGUMENT,"Path has trailing escape character: "+e);var s=e[i+1];if("\\"!==s&&"."!==s&&"`"!==s)throw new Yd(Qd.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=s,i+=2}else"`"===u?(o=!o,i++):"."!==u||o?(r+=u,i++):(a(),i++)}if(a(),o)throw new Yd(Qd.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new n(t)}},{key:"emptyPath",value:function(){return new n([])}}]),n}(hp),mp=function(){function e(t){y(this,e),this.path=t}return k(e,[{key:"collectionGroup",get:function(){return this.path.popLast().lastSegment()}},{key:"hasCollectionId",value:function(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}},{key:"getCollectionGroup",value:function(){return this.path.get(this.path.length-2)}},{key:"getCollectionPath",value:function(){return this.path.popLast()}},{key:"isEqual",value:function(e){return null!==e&&0===dp.comparator(this.path,e.path)}},{key:"toString",value:function(){return this.path.toString()}}],[{key:"fromPath",value:function(t){return new e(dp.fromString(t))}},{key:"fromName",value:function(t){return new e(dp.fromString(t).popFirst(5))}},{key:"empty",value:function(){return new e(dp.emptyPath())}},{key:"comparator",value:function(e,t){return dp.comparator(e.path,t.path)}},{key:"isDocumentKey",value:function(e){return e.length%2==0}},{key:"fromSegments",value:function(t){return new e(new dp(t.slice()))}}]),e}(),yp=k((function e(t,n,r,i){y(this,e),this.indexId=t,this.collectionGroup=n,this.fields=r,this.indexState=i}));function gp(e){return e.fields.find((function(e){return 2===e.kind}))}function kp(e){return e.fields.filter((function(e){return 2!==e.kind}))}yp.UNKNOWN_ID=-1;var wp=k((function e(t,n){y(this,e),this.fieldPath=t,this.kind=n}));var bp=function(){function e(t,n){y(this,e),this.sequenceNumber=t,this.offset=n}return k(e,null,[{key:"empty",value:function(){return new e(0,Tp.min())}}]),e}();function _p(e,t){var n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,i=fp.fromTimestamp(1e9===r?new lp(n+1,0):new lp(n,r));return new Tp(i,mp.empty(),t)}function xp(e){return new Tp(e.readTime,e.key,-1)}var Tp=function(){function e(t,n,r){y(this,e),this.readTime=t,this.documentKey=n,this.largestBatchId=r}return k(e,null,[{key:"min",value:function(){return new e(fp.min(),mp.empty(),-1)}},{key:"max",value:function(){return new e(fp.max(),mp.empty(),-1)}}]),e}();function Ip(e,t){var n=e.readTime.compareTo(t.readTime);return 0!==n?n:0!==(n=mp.comparator(e.documentKey,t.documentKey))?n:up(e.largestBatchId,t.largestBatchId)}var Ep="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Sp=function(){function e(){y(this,e),this.onCommittedListeners=[]}return k(e,[{key:"addOnCommittedListener",value:function(e){this.onCommittedListeners.push(e)}},{key:"raiseOnCommittedEvent",value:function(){this.onCommittedListeners.forEach((function(e){return e()}))}}]),e}();function Cp(e){return Ap.apply(this,arguments)}function Ap(){return(Ap=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.code===Qd.FAILED_PRECONDITION&&t.message===Ep){e.next=2;break}throw t;case 2:zd("LocalStore","Unexpectedly lost primary lease");case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Np=function(){function e(t){var n=this;y(this,e),this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t((function(e){n.isDone=!0,n.result=e,n.nextCallback&&n.nextCallback(e)}),(function(e){n.isDone=!0,n.error=e,n.catchCallback&&n.catchCallback(e)}))}return k(e,[{key:"catch",value:function(e){return this.next(void 0,e)}},{key:"next",value:function(t,n){var r=this;return this.callbackAttached&&Gd(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(t,this.result):new e((function(e,i){r.nextCallback=function(n){r.wrapSuccess(t,n).next(e,i)},r.catchCallback=function(t){r.wrapFailure(n,t).next(e,i)}}))}},{key:"toPromise",value:function(){var e=this;return new Promise((function(t,n){e.next(t,n)}))}},{key:"wrapUserFunction",value:function(t){try{var n=t();return n instanceof e?n:e.resolve(n)}catch(t){return e.reject(t)}}},{key:"wrapSuccess",value:function(t,n){return t?this.wrapUserFunction((function(){return t(n)})):e.resolve(n)}},{key:"wrapFailure",value:function(t,n){return t?this.wrapUserFunction((function(){return t(n)})):e.reject(n)}}],[{key:"resolve",value:function(t){return new e((function(e,n){e(t)}))}},{key:"reject",value:function(t){return new e((function(e,n){n(t)}))}},{key:"waitFor",value:function(t){return new e((function(e,n){var r=0,i=0,a=!1;t.forEach((function(t){++r,t.next((function(){++i,a&&i===r&&e()}),(function(e){return n(e)}))})),a=!0,i===r&&e()}))}},{key:"or",value:function(t){var n,r=e.resolve(!1),i=w(t);try{var a=function(){var t=n.value;r=r.next((function(n){return n?e.resolve(n):t()}))};for(i.s();!(n=i.n()).done;)a()}catch(o){i.e(o)}finally{i.f()}return r}},{key:"forEach",value:function(e,t){var n=this,r=[];return e.forEach((function(e,i){r.push(t.call(n,e,i))})),this.waitFor(r)}},{key:"mapArray",value:function(t,n){return new e((function(e,r){for(var i=t.length,a=new Array(i),o=0,u=function(){var u=s;n(t[u]).next((function(t){a[u]=t,++o===i&&e(a)}),(function(e){return r(e)}))},s=0;s<i;s++)u()}))}},{key:"doWhile",value:function(t,n){return new e((function(e,r){!function i(){!0===t()?n().next((function(){i()}),r):e()}()}))}}]),e}(),Pp=function(){function e(t,n){var r=this;y(this,e),this.action=t,this.transaction=n,this.aborted=!1,this.m=new Jd,this.transaction.oncomplete=function(){r.m.resolve()},this.transaction.onabort=function(){n.error?r.m.reject(new Op(t,n.error)):r.m.resolve()},this.transaction.onerror=function(e){var n=Up(e.target.error);r.m.reject(new Op(t,n))}}return k(e,[{key:"g",get:function(){return this.m.promise}},{key:"abort",value:function(e){e&&this.m.reject(e),this.aborted||(zd("SimpleDb","Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}},{key:"p",value:function(){var e=this.transaction;this.aborted||"function"!=typeof e.commit||e.commit()}},{key:"store",value:function(e){var t=this.transaction.objectStore(e);return new Mp(t)}}],[{key:"open",value:function(t,n,r,i){try{return new e(n,t.transaction(i,r))}catch(t){throw new Op(n,t)}}}]),e}(),Dp=function(){function e(t,n,r){y(this,e),this.name=t,this.version=n,this.S=r,12.2===e.D(U())&&Bd("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}return k(e,[{key:"N",value:function(){var e=u(a().mark((function e(t){var n=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.db,e.t0){e.next=6;break}return zd("SimpleDb","Opening database:",this.name),e.next=5,new Promise((function(e,r){var i=indexedDB.open(n.name,n.version);i.onsuccess=function(t){var n=t.target.result;e(n)},i.onblocked=function(){r(new Op(t,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=function(e){var n=e.target.error;"VersionError"===n.name?r(new Yd(Qd.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):"InvalidStateError"===n.name?r(new Yd(Qd.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+n)):r(new Op(t,n))},i.onupgradeneeded=function(e){zd("SimpleDb",'Database "'+n.name+'" requires upgrade from version:',e.oldVersion);var t=e.target.result;n.S.B(t,i.transaction,e.oldVersion,n.version).next((function(){zd("SimpleDb","Database upgrade to version "+n.version+" complete")}))}}));case 5:this.db=e.sent;case 6:return this.L&&(this.db.onversionchange=function(e){return n.L(e)}),e.abrupt("return",this.db);case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"k",value:function(e){this.L=e,this.db&&(this.db.onversionchange=function(t){return e(t)})}},{key:"runTransaction",value:function(){var e=u(a().mark((function e(t,n,r,i){var o,u,s,c,l=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o="readonly"===n,u=0,s=a().mark((function e(){var n,s,c,f;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return++u,e.prev=1,e.next=4,l.N(t);case 4:return l.db=e.sent,n=Pp.open(l.db,t,o?"readonly":"readwrite",r),s=i(n).next((function(e){return n.p(),e})).catch((function(e){return n.abort(e),Np.reject(e)})).toPromise(),s.catch((function(){})),e.next=9,n.g;case 9:return e.t0=s,e.abrupt("return",{v:e.t0});case 13:if(e.prev=13,e.t1=e.catch(1),c=e.t1,f="FirebaseError"!==c.name&&u<3,zd("SimpleDb","Transaction failed with error:",c.message,"Retrying:",f),l.close(),f){e.next=18;break}return e.abrupt("return",{v:Promise.reject(c)});case 18:case"end":return e.stop()}}),e,null,[[1,13]])}));case 3:return e.delegateYield(s(),"t0",4);case 4:if(!(c=e.t0)){e.next=7;break}return e.abrupt("return",c.v);case 7:e.next=3;break;case 9:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}()},{key:"close",value:function(){this.db&&this.db.close(),this.db=void 0}}],[{key:"delete",value:function(e){return zd("SimpleDb","Removing database:",e),Fp(window.indexedDB.deleteDatabase(e)).toPromise()}},{key:"C",value:function(){if(!K())return!1;if(e.v())return!0;var t=U(),n=e.D(t),r=0<n&&n<10,i=e.F(t),a=0<i&&i<4.5;return!(t.indexOf("MSIE ")>0||t.indexOf("Trident/")>0||t.indexOf("Edge/")>0||r||a)}},{key:"v",value:function(){var e;return"undefined"!=typeof process&&"YES"===(null===(e={NODE_ENV:"production",PUBLIC_URL:".",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0})||void 0===e?void 0:e.M)}},{key:"O",value:function(e,t){return e.store(t)}},{key:"D",value:function(e){var t=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(n)}},{key:"F",value:function(e){var t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}}]),e}(),Rp=function(){function e(t){y(this,e),this.q=t,this.K=!1,this.$=null}return k(e,[{key:"isDone",get:function(){return this.K}},{key:"U",get:function(){return this.$}},{key:"cursor",set:function(e){this.q=e}},{key:"done",value:function(){this.K=!0}},{key:"W",value:function(e){this.$=e}},{key:"delete",value:function(){return Fp(this.q.delete())}}]),e}(),Op=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this,Qd.UNAVAILABLE,"IndexedDB transaction '".concat(e,"' failed: ").concat(r))).name="IndexedDbTransactionError",i}return k(n)}(Yd);function Lp(e){return"IndexedDbTransactionError"===e.name}var Mp=function(){function e(t){y(this,e),this.store=t}return k(e,[{key:"put",value:function(e,t){var n;return void 0!==t?(zd("SimpleDb","PUT",this.store.name,e,t),n=this.store.put(t,e)):(zd("SimpleDb","PUT",this.store.name,"<auto-key>",e),n=this.store.put(e)),Fp(n)}},{key:"add",value:function(e){return zd("SimpleDb","ADD",this.store.name,e,e),Fp(this.store.add(e))}},{key:"get",value:function(e){var t=this;return Fp(this.store.get(e)).next((function(n){return void 0===n&&(n=null),zd("SimpleDb","GET",t.store.name,e,n),n}))}},{key:"delete",value:function(e){return zd("SimpleDb","DELETE",this.store.name,e),Fp(this.store.delete(e))}},{key:"count",value:function(){return zd("SimpleDb","COUNT",this.store.name),Fp(this.store.count())}},{key:"G",value:function(e,t){var n=this.options(e,t);if(n.index||"function"!=typeof this.store.getAll){var r=this.cursor(n),i=[];return this.j(r,(function(e,t){i.push(t)})).next((function(){return i}))}var a=this.store.getAll(n.range);return new Np((function(e,t){a.onerror=function(e){t(e.target.error)},a.onsuccess=function(t){e(t.target.result)}}))}},{key:"H",value:function(e,t){var n=this.store.getAll(e,null===t?void 0:t);return new Np((function(e,t){n.onerror=function(e){t(e.target.error)},n.onsuccess=function(t){e(t.target.result)}}))}},{key:"J",value:function(e,t){zd("SimpleDb","DELETE ALL",this.store.name);var n=this.options(e,t);n.Y=!1;var r=this.cursor(n);return this.j(r,(function(e,t,n){return n.delete()}))}},{key:"Z",value:function(e,t){var n;t?n=e:(n={},t=e);var r=this.cursor(n);return this.j(r,t)}},{key:"X",value:function(e){var t=this.cursor({});return new Np((function(n,r){t.onerror=function(e){var t=Up(e.target.error);r(t)},t.onsuccess=function(t){var r=t.target.result;r?e(r.primaryKey,r.value).next((function(e){e?r.continue():n()})):n()}}))}},{key:"j",value:function(e,t){var n=[];return new Np((function(r,i){e.onerror=function(e){i(e.target.error)},e.onsuccess=function(e){var i=e.target.result;if(i){var a=new Rp(i),o=t(i.primaryKey,i.value,a);if(o instanceof Np){var u=o.catch((function(e){return a.done(),Np.reject(e)}));n.push(u)}a.isDone?r():null===a.U?i.continue():i.continue(a.U)}else r()}})).next((function(){return Np.waitFor(n)}))}},{key:"options",value:function(e,t){var n;return void 0!==e&&("string"==typeof e?n=e:t=e),{index:n,range:t}}},{key:"cursor",value:function(e){var t="next";if(e.reverse&&(t="prev"),e.index){var n=this.store.index(e.index);return e.Y?n.openKeyCursor(e.range,t):n.openCursor(e.range,t)}return this.store.openCursor(e.range,t)}}]),e}();function Fp(e){return new Np((function(t,n){e.onsuccess=function(e){var n=e.target.result;t(n)},e.onerror=function(e){var t=Up(e.target.error);n(t)}}))}var Vp=!1;function Up(e){var t=Dp.D(U());if(t>=12.2&&t<13){var n="An internal error was encountered in the Indexed Database server";if(e.message.indexOf(n)>=0){var r=new Yd("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '".concat(n,"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround."));return Vp||(Vp=!0,setTimeout((function(){throw r}),0)),r}}return e}var jp=function(){function e(t,n){y(this,e),this.asyncQueue=t,this.ee=n,this.task=null}return k(e,[{key:"start",value:function(){this.te(15e3)}},{key:"stop",value:function(){this.task&&(this.task.cancel(),this.task=null)}},{key:"started",get:function(){return null!==this.task}},{key:"te",value:function(e){var t=this;zd("IndexBackiller","Scheduled in ".concat(e,"ms")),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.task=null,e.prev=1,e.t0=zd,e.t1="Documents written: ",e.next=6,t.ee.ne();case 6:e.t2=e.sent,e.t3=e.t1.concat.call(e.t1,e.t2),(0,e.t0)("IndexBackiller",e.t3),e.next=19;break;case 11:if(e.prev=11,e.t4=e.catch(1),!Lp(e.t4)){e.next=17;break}zd("IndexBackiller","Ignoring IndexedDB error during index backfill: ",e.t4),e.next=19;break;case 17:return e.next=19,Cp(e.t4);case 19:return e.next=21,t.te(6e4);case 21:case"end":return e.stop()}}),e,null,[[1,11]])}))))}}]),e}(),zp=function(){function e(t,n){y(this,e),this.localStore=t,this.persistence=n}return k(e,[{key:"ne",value:function(){var e=u(a().mark((function e(){var t,n=this,r=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:50,e.abrupt("return",this.persistence.runTransaction("Backfill Indexes","readwrite-primary",(function(e){return n.re(e,t)})));case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"re",value:function(e,t){var n=this,r=new Set,i=t,a=!0;return Np.doWhile((function(){return!0===a&&i>0}),(function(){return n.localStore.indexManager.getNextCollectionGroupToUpdate(e).next((function(t){if(null!==t&&!r.has(t))return zd("IndexBackiller","Processing collection: ".concat(t)),n.ie(e,t,i).next((function(e){i-=e,r.add(t)}));a=!1}))})).next((function(){return t-i}))}},{key:"ie",value:function(e,t,n){var r=this;return this.localStore.indexManager.getMinOffsetFromCollectionGroup(e,t).next((function(i){return r.localStore.localDocuments.getNextDocuments(e,t,i,n).next((function(n){var a=n.changes;return r.localStore.indexManager.updateIndexEntries(e,a).next((function(){return r.se(i,n)})).next((function(n){return zd("IndexBackiller","Updating offset: ".concat(n)),r.localStore.indexManager.updateCollectionGroup(e,t,n)})).next((function(){return a.size}))}))}))}},{key:"se",value:function(e,t){var n=e;return t.changes.forEach((function(e,t){var r=xp(t);Ip(r,n)>0&&(n=r)})),new Tp(n.readTime,n.documentKey,Math.max(t.batchId,e.largestBatchId))}}]),e}(),Bp=function(){function e(t,n){var r=this;y(this,e),this.previousValue=t,n&&(n.sequenceNumberHandler=function(e){return r.oe(e)},this._e=function(e){return n.writeSequenceNumber(e)})}return k(e,[{key:"oe",value:function(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}},{key:"next",value:function(){var e=++this.previousValue;return this._e&&this._e(e),e}}]),e}();function qp(e){return null==e}function Kp(e){return 0===e&&1/e==-1/0}function Gp(e){return"number"==typeof e&&Number.isInteger(e)&&!Kp(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}function Hp(e){for(var t="",n=0;n<e.length;n++)t.length>0&&(t=Qp(t)),t=Wp(e.get(n),t);return Qp(t)}function Wp(e,t){for(var n=t,r=e.length,i=0;i<r;i++){var a=e.charAt(i);switch(a){case"\0":n+="\x01\x10";break;case"\x01":n+="\x01\x11";break;default:n+=a}}return n}function Qp(e){return e+"\x01\x01"}function Yp(e){var t=e.length;if(Hd(t>=2),2===t)return Hd("\x01"===e.charAt(0)&&"\x01"===e.charAt(1)),dp.emptyPath();for(var n=t-2,r=[],i="",a=0;a<t;){var o=e.indexOf("\x01",a);switch((o<0||o>n)&&Gd(),e.charAt(o+1)){case"\x01":var u=e.substring(a,o),s=void 0;0===i.length?s=u:(s=i+=u,i=""),r.push(s);break;case"\x10":i+=e.substring(a,o),i+="\0";break;case"\x11":i+=e.substring(a,o+1);break;default:Gd()}a=o+2}return new dp(r)}Bp.ae=-1;var Jp=["userId","batchId"];function Xp(e,t){return[e,Hp(t)]}function $p(e,t,n){return[e,Hp(t),n]}var Zp={},ev=["prefixPath","collectionGroup","readTime","documentId"],tv=["prefixPath","collectionGroup","documentId"],nv=["collectionGroup","readTime","prefixPath","documentId"],rv=["canonicalId","targetId"],iv=["targetId","path"],av=["path","targetId"],ov=["collectionId","parent"],uv=["indexId","uid"],sv=["uid","sequenceNumber"],cv=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],lv=["indexId","uid","orderedDocumentKey"],fv=["userId","collectionPath","documentId"],hv=["userId","collectionPath","largestBatchId"],dv=["userId","collectionGroup","largestBatchId"],pv=["mutationQueues","mutations","documentMutations","remoteDocuments","targets","owner","targetGlobal","targetDocuments"].concat(["clientMetadata"]).concat(["remoteDocumentGlobal"]).concat(["collectionParents"]).concat(["bundles","namedQueries"]),vv=[].concat(oe(pv),["documentOverlays"]),mv=["mutationQueues","mutations","documentMutations","remoteDocumentsV14","targets","owner","targetGlobal","targetDocuments","clientMetadata","remoteDocumentGlobal","collectionParents","bundles","namedQueries","documentOverlays"],yv=mv,gv=[].concat(yv,["indexConfiguration","indexState","indexEntries"]),kv=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this)).ue=e,i.currentSequenceNumber=r,i}return k(n)}(Sp);function wv(e,t){var n=Wd(e);return Dp.O(n.ue,t)}function bv(e){var t=0;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function _v(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function xv(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}var Tv=function(){function e(t,n){y(this,e),this.comparator=t,this.root=n||Ev.EMPTY}return k(e,[{key:"insert",value:function(t,n){return new e(this.comparator,this.root.insert(t,n,this.comparator).copy(null,null,Ev.BLACK,null,null))}},{key:"remove",value:function(t){return new e(this.comparator,this.root.remove(t,this.comparator).copy(null,null,Ev.BLACK,null,null))}},{key:"get",value:function(e){for(var t=this.root;!t.isEmpty();){var n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}},{key:"indexOf",value:function(e){for(var t=0,n=this.root;!n.isEmpty();){var r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}},{key:"isEmpty",value:function(){return this.root.isEmpty()}},{key:"size",get:function(){return this.root.size}},{key:"minKey",value:function(){return this.root.minKey()}},{key:"maxKey",value:function(){return this.root.maxKey()}},{key:"inorderTraversal",value:function(e){return this.root.inorderTraversal(e)}},{key:"forEach",value:function(e){this.inorderTraversal((function(t,n){return e(t,n),!1}))}},{key:"toString",value:function(){var e=[];return this.inorderTraversal((function(t,n){return e.push("".concat(t,":").concat(n)),!1})),"{".concat(e.join(", "),"}")}},{key:"reverseTraversal",value:function(e){return this.root.reverseTraversal(e)}},{key:"getIterator",value:function(){return new Iv(this.root,null,this.comparator,!1)}},{key:"getIteratorFrom",value:function(e){return new Iv(this.root,e,this.comparator,!1)}},{key:"getReverseIterator",value:function(){return new Iv(this.root,null,this.comparator,!0)}},{key:"getReverseIteratorFrom",value:function(e){return new Iv(this.root,e,this.comparator,!0)}}]),e}(),Iv=function(){function e(t,n,r,i){y(this,e),this.isReverse=i,this.nodeStack=[];for(var a=1;!t.isEmpty();)if(a=n?r(t.key,n):1,n&&i&&(a*=-1),a<0)t=this.isReverse?t.left:t.right;else{if(0===a){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}return k(e,[{key:"getNext",value:function(){var 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}},{key:"hasNext",value:function(){return this.nodeStack.length>0}},{key:"peek",value:function(){if(0===this.nodeStack.length)return null;var e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}]),e}(),Ev=function(){function e(t,n,r,i,a){y(this,e),this.key=t,this.value=n,this.color=null!=r?r:e.RED,this.left=null!=i?i:e.EMPTY,this.right=null!=a?a:e.EMPTY,this.size=this.left.size+1+this.right.size}return k(e,[{key:"copy",value:function(t,n,r,i,a){return new e(null!=t?t:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=a?a:this.right)}},{key:"isEmpty",value:function(){return!1}},{key:"inorderTraversal",value:function(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}},{key:"reverseTraversal",value:function(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}},{key:"min",value:function(){return this.left.isEmpty()?this:this.left.min()}},{key:"minKey",value:function(){return this.min().key}},{key:"maxKey",value:function(){return this.right.isEmpty()?this.key:this.right.maxKey()}},{key:"insert",value:function(e,t,n){var r=this,i=n(e,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n))).fixUp()}},{key:"removeMin",value:function(){if(this.left.isEmpty())return e.EMPTY;var t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),(t=t.copy(null,null,null,t.left.removeMin(),null)).fixUp()}},{key:"remove",value:function(t,n){var r,i=this;if(n(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===n(t,i.key)){if(i.right.isEmpty())return e.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,n))}return i.fixUp()}},{key:"isRed",value:function(){return this.color}},{key:"fixUp",value:function(){var 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}},{key:"moveRedLeft",value:function(){var e=this.colorFlip();return e.right.left.isRed()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip()),e}},{key:"moveRedRight",value:function(){var e=this.colorFlip();return e.left.left.isRed()&&(e=(e=e.rotateRight()).colorFlip()),e}},{key:"rotateLeft",value:function(){var t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}},{key:"rotateRight",value:function(){var t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}},{key:"colorFlip",value:function(){var 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)}},{key:"checkMaxDepth",value:function(){var e=this.check();return Math.pow(2,e)<=this.size+1}},{key:"check",value:function(){if(this.isRed()&&this.left.isRed())throw Gd();if(this.right.isRed())throw Gd();var e=this.left.check();if(e!==this.right.check())throw Gd();return e+(this.isRed()?0:1)}}]),e}();Ev.EMPTY=null,Ev.RED=!0,Ev.BLACK=!1,Ev.EMPTY=new(function(){function e(){y(this,e),this.size=0}return k(e,[{key:"key",get:function(){throw Gd()}},{key:"value",get:function(){throw Gd()}},{key:"color",get:function(){throw Gd()}},{key:"left",get:function(){throw Gd()}},{key:"right",get:function(){throw Gd()}},{key:"copy",value:function(e,t,n,r,i){return this}},{key:"insert",value:function(e,t,n){return new Ev(e,t)}},{key:"remove",value:function(e,t){return this}},{key:"isEmpty",value:function(){return!0}},{key:"inorderTraversal",value:function(e){return!1}},{key:"reverseTraversal",value:function(e){return!1}},{key:"minKey",value:function(){return null}},{key:"maxKey",value:function(){return null}},{key:"isRed",value:function(){return!1}},{key:"checkMaxDepth",value:function(){return!0}},{key:"check",value:function(){return 0}}]),e}());var Sv=function(){function e(t){y(this,e),this.comparator=t,this.data=new Tv(this.comparator)}return k(e,[{key:"has",value:function(e){return null!==this.data.get(e)}},{key:"first",value:function(){return this.data.minKey()}},{key:"last",value:function(){return this.data.maxKey()}},{key:"size",get:function(){return this.data.size}},{key:"indexOf",value:function(e){return this.data.indexOf(e)}},{key:"forEach",value:function(e){this.data.inorderTraversal((function(t,n){return e(t),!1}))}},{key:"forEachInRange",value:function(e,t){for(var n=this.data.getIteratorFrom(e[0]);n.hasNext();){var r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}},{key:"forEachWhile",value:function(e,t){var n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}},{key:"firstAfterOrEqual",value:function(e){var t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}},{key:"getIterator",value:function(){return new Cv(this.data.getIterator())}},{key:"getIteratorFrom",value:function(e){return new Cv(this.data.getIteratorFrom(e))}},{key:"add",value:function(e){return this.copy(this.data.remove(e).insert(e,!0))}},{key:"delete",value:function(e){return this.has(e)?this.copy(this.data.remove(e)):this}},{key:"isEmpty",value:function(){return this.data.isEmpty()}},{key:"unionWith",value:function(e){var t=this;return t.size<e.size&&(t=e,e=this),e.forEach((function(e){t=t.add(e)})),t}},{key:"isEqual",value:function(t){if(!(t instanceof e))return!1;if(this.size!==t.size)return!1;for(var n=this.data.getIterator(),r=t.data.getIterator();n.hasNext();){var i=n.getNext().key,a=r.getNext().key;if(0!==this.comparator(i,a))return!1}return!0}},{key:"toArray",value:function(){var e=[];return this.forEach((function(t){e.push(t)})),e}},{key:"toString",value:function(){var e=[];return this.forEach((function(t){return e.push(t)})),"SortedSet("+e.toString()+")"}},{key:"copy",value:function(t){var n=new e(this.comparator);return n.data=t,n}}]),e}(),Cv=function(){function e(t){y(this,e),this.iter=t}return k(e,[{key:"getNext",value:function(){return this.iter.getNext().key}},{key:"hasNext",value:function(){return this.iter.hasNext()}}]),e}();function Av(e){return e.hasNext()?e.getNext():void 0}var Nv=function(){function e(t){y(this,e),this.fields=t,t.sort(vp.comparator)}return k(e,[{key:"unionWith",value:function(t){var n,r=new Sv(vp.comparator),i=w(this.fields);try{for(i.s();!(n=i.n()).done;){var a=n.value;r=r.add(a)}}catch(c){i.e(c)}finally{i.f()}var o,u=w(t);try{for(u.s();!(o=u.n()).done;){var s=o.value;r=r.add(s)}}catch(c){u.e(c)}finally{u.f()}return new e(r.toArray())}},{key:"covers",value:function(e){var t,n=w(this.fields);try{for(n.s();!(t=n.n()).done;){if(t.value.isPrefixOf(e))return!0}}catch(r){n.e(r)}finally{n.f()}return!1}},{key:"isEqual",value:function(e){return sp(this.fields,e.fields,(function(e,t){return e.isEqual(t)}))}}],[{key:"empty",value:function(){return new e([])}}]),e}(),Pv=function(e){x(n,e);var t=E(n);function n(){var e;return y(this,n),(e=t.apply(this,arguments)).name="Base64DecodeError",e}return k(n)}(C(Error));var Dv=function(e){function t(e){y(this,t),this.binaryString=e}return k(t,[{key:Symbol.iterator,value:function(){var e=this,t=0;return{next:function(){return t<e.binaryString.length?{value:e.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}}},{key:"toBase64",value:function(){return e=this.binaryString,btoa(e);var e}},{key:"toUint8Array",value:function(){return function(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}},{key:"approximateByteSize",value:function(){return 2*this.binaryString.length}},{key:"compareTo",value:function(e){return up(this.binaryString,e.binaryString)}},{key:"isEqual",value:function(e){return this.binaryString===e.binaryString}}],[{key:"fromBase64String",value:function(e){var n=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new Pv("Invalid base64 string: "+e):e}}(e);return new t(n)}},{key:"fromUint8Array",value:function(e){var n=function(e){for(var t="",n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new t(n)}}]),t}();Dv.EMPTY_BYTE_STRING=new Dv("");var Rv=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Ov(e){if(Hd(!!e),"string"==typeof e){var t=0,n=Rv.exec(e);if(Hd(!!n),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),t=Number(r)}var i=new Date(e);return{seconds:Math.floor(i.getTime()/1e3),nanos:t}}return{seconds:Lv(e.seconds),nanos:Lv(e.nanos)}}function Lv(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function Mv(e){return"string"==typeof e?Dv.fromBase64String(e):Dv.fromUint8Array(e)}function Fv(e){var t,n;return"server_timestamp"===(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function Vv(e){var t=e.mapValue.fields.__previous_value__;return Fv(t)?Vv(t):t}function Uv(e){var t=Ov(e.mapValue.fields.__local_write_time__.timestampValue);return new lp(t.seconds,t.nanos)}var jv=k((function e(t,n,r,i,a,o,u,s,c){y(this,e),this.databaseId=t,this.appId=n,this.persistenceKey=r,this.host=i,this.ssl=a,this.forceLongPolling=o,this.autoDetectLongPolling=u,this.longPollingOptions=s,this.useFetchStreams=c})),zv=function(){function e(t,n){y(this,e),this.projectId=t,this.database=n||"(default)"}return k(e,[{key:"isDefaultDatabase",get:function(){return"(default)"===this.database}},{key:"isEqual",value:function(t){return t instanceof e&&t.projectId===this.projectId&&t.database===this.database}}],[{key:"empty",value:function(){return new e("","")}}]),e}(),Bv={mapValue:{fields:{__type__:{stringValue:"__max__"}}}},qv={nullValue:"NULL_VALUE"};function Kv(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?Fv(e)?4:im(e)?9007199254740991:10:Gd()}function Gv(e,t){if(e===t)return!0;var n=Kv(e);if(n!==Kv(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Uv(e).isEqual(Uv(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;var n=Ov(e.timestampValue),r=Ov(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Mv(e.bytesValue).isEqual(Mv(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return Lv(e.geoPointValue.latitude)===Lv(t.geoPointValue.latitude)&&Lv(e.geoPointValue.longitude)===Lv(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return Lv(e.integerValue)===Lv(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){var n=Lv(e.doubleValue),r=Lv(t.doubleValue);return n===r?Kp(n)===Kp(r):isNaN(n)&&isNaN(r)}return!1}(e,t);case 9:return sp(e.arrayValue.values||[],t.arrayValue.values||[],Gv);case 10:return function(e,t){var n=e.mapValue.fields||{},r=t.mapValue.fields||{};if(bv(n)!==bv(r))return!1;for(var i in n)if(n.hasOwnProperty(i)&&(void 0===r[i]||!Gv(n[i],r[i])))return!1;return!0}(e,t);default:return Gd()}}function Hv(e,t){return void 0!==(e.values||[]).find((function(e){return Gv(e,t)}))}function Wv(e,t){if(e===t)return 0;var n=Kv(e),r=Kv(t);if(n!==r)return up(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return up(e.booleanValue,t.booleanValue);case 2:return function(e,t){var n=Lv(e.integerValue||e.doubleValue),r=Lv(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return Qv(e.timestampValue,t.timestampValue);case 4:return Qv(Uv(e),Uv(t));case 5:return up(e.stringValue,t.stringValue);case 6:return function(e,t){var n=Mv(e),r=Mv(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){for(var n=e.split("/"),r=t.split("/"),i=0;i<n.length&&i<r.length;i++){var a=up(n[i],r[i]);if(0!==a)return a}return up(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){var n=up(Lv(e.latitude),Lv(t.latitude));return 0!==n?n:up(Lv(e.longitude),Lv(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return function(e,t){for(var n=e.values||[],r=t.values||[],i=0;i<n.length&&i<r.length;++i){var a=Wv(n[i],r[i]);if(a)return a}return up(n.length,r.length)}(e.arrayValue,t.arrayValue);case 10:return function(e,t){if(e===Bv.mapValue&&t===Bv.mapValue)return 0;if(e===Bv.mapValue)return 1;if(t===Bv.mapValue)return-1;var n=e.fields||{},r=Object.keys(n),i=t.fields||{},a=Object.keys(i);r.sort(),a.sort();for(var o=0;o<r.length&&o<a.length;++o){var u=up(r[o],a[o]);if(0!==u)return u;var s=Wv(n[r[o]],i[a[o]]);if(0!==s)return s}return up(r.length,a.length)}(e.mapValue,t.mapValue);default:throw Gd()}}function Qv(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return up(e,t);var n=Ov(e),r=Ov(t),i=up(n.seconds,r.seconds);return 0!==i?i:up(n.nanos,r.nanos)}function Yv(e){return Jv(e)}function Jv(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){var t=Ov(e);return"time(".concat(t.seconds,",").concat(t.nanos,")")}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return Mv(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return mp.fromName(e).toString()}(e.referenceValue):"geoPointValue"in e?function(e){return"geo(".concat(e.latitude,",").concat(e.longitude,")")}(e.geoPointValue):"arrayValue"in e?function(e){var t,n="[",r=!0,i=w(e.values||[]);try{for(i.s();!(t=i.n()).done;){var a=t.value;r?r=!1:n+=",",n+=Jv(a)}}catch(o){i.e(o)}finally{i.f()}return n+"]"}(e.arrayValue):"mapValue"in e?function(e){var t,n="{",r=!0,i=w(Object.keys(e.fields||{}).sort());try{for(i.s();!(t=i.n()).done;){var a=t.value;r?r=!1:n+=",",n+="".concat(a,":").concat(Jv(e.fields[a]))}}catch(o){i.e(o)}finally{i.f()}return n+"}"}(e.mapValue):Gd()}function Xv(e,t){return{referenceValue:"projects/".concat(e.projectId,"/databases/").concat(e.database,"/documents/").concat(t.path.canonicalString())}}function $v(e){return!!e&&"integerValue"in e}function Zv(e){return!!e&&"arrayValue"in e}function em(e){return!!e&&"nullValue"in e}function tm(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function nm(e){return!!e&&"mapValue"in e}function rm(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){var t={mapValue:{fields:{}}};return _v(e.mapValue.fields,(function(e,n){return t.mapValue.fields[e]=rm(n)})),t}if(e.arrayValue){for(var n={arrayValue:{values:[]}},r=0;r<(e.arrayValue.values||[]).length;++r)n.arrayValue.values[r]=rm(e.arrayValue.values[r]);return n}return Object.assign({},e)}function im(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}function am(e){return"nullValue"in e?qv:"booleanValue"in e?{booleanValue:!1}:"integerValue"in e||"doubleValue"in e?{doubleValue:NaN}:"timestampValue"in e?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in e?{stringValue:""}:"bytesValue"in e?{bytesValue:""}:"referenceValue"in e?Xv(zv.empty(),mp.empty()):"geoPointValue"in e?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in e?{arrayValue:{}}:"mapValue"in e?{mapValue:{}}:Gd()}function om(e){return"nullValue"in e?{booleanValue:!1}:"booleanValue"in e?{doubleValue:NaN}:"integerValue"in e||"doubleValue"in e?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in e?{stringValue:""}:"stringValue"in e?{bytesValue:""}:"bytesValue"in e?Xv(zv.empty(),mp.empty()):"referenceValue"in e?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in e?{arrayValue:{}}:"arrayValue"in e?{mapValue:{}}:"mapValue"in e?Bv:Gd()}function um(e,t){var n=Wv(e.value,t.value);return 0!==n?n:e.inclusive&&!t.inclusive?-1:!e.inclusive&&t.inclusive?1:0}function sm(e,t){var n=Wv(e.value,t.value);return 0!==n?n:e.inclusive&&!t.inclusive?1:!e.inclusive&&t.inclusive?-1:0}var cm=function(){function e(t){y(this,e),this.value=t}return k(e,[{key:"field",value:function(e){if(e.isEmpty())return this.value;for(var t=this.value,n=0;n<e.length-1;++n)if(!nm(t=(t.mapValue.fields||{})[e.get(n)]))return null;return(t=(t.mapValue.fields||{})[e.lastSegment()])||null}},{key:"set",value:function(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=rm(t)}},{key:"setAll",value:function(e){var t=this,n=vp.emptyPath(),r={},i=[];e.forEach((function(e,a){if(!n.isImmediateParentOf(a)){var o=t.getFieldsMap(n);t.applyChanges(o,r,i),r={},i=[],n=a.popLast()}e?r[a.lastSegment()]=rm(e):i.push(a.lastSegment())}));var a=this.getFieldsMap(n);this.applyChanges(a,r,i)}},{key:"delete",value:function(e){var t=this.field(e.popLast());nm(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}},{key:"isEqual",value:function(e){return Gv(this.value,e.value)}},{key:"getFieldsMap",value:function(e){var t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(var n=0;n<e.length;++n){var r=t.mapValue.fields[e.get(n)];nm(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}},{key:"applyChanges",value:function(e,t,n){_v(t,(function(t,n){return e[t]=n}));var r,i=w(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;delete e[a]}}catch(o){i.e(o)}finally{i.f()}}},{key:"clone",value:function(){return new e(rm(this.value))}}],[{key:"empty",value:function(){return new e({mapValue:{}})}}]),e}();function lm(e){var t=[];return _v(e.fields,(function(e,n){var r=new vp([e]);if(nm(n)){var i=lm(n.mapValue).fields;if(0===i.length)t.push(r);else{var a,o=w(i);try{for(o.s();!(a=o.n()).done;){var u=a.value;t.push(r.child(u))}}catch(s){o.e(s)}finally{o.f()}}}else t.push(r)})),new Nv(t)}var fm=function(){function e(t,n,r,i,a,o,u){y(this,e),this.key=t,this.documentType=n,this.version=r,this.readTime=i,this.createTime=a,this.data=o,this.documentState=u}return k(e,[{key:"convertToFoundDocument",value:function(e,t){return!this.createTime.isEqual(fp.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}},{key:"convertToNoDocument",value:function(e){return this.version=e,this.documentType=2,this.data=cm.empty(),this.documentState=0,this}},{key:"convertToUnknownDocument",value:function(e){return this.version=e,this.documentType=3,this.data=cm.empty(),this.documentState=2,this}},{key:"setHasCommittedMutations",value:function(){return this.documentState=2,this}},{key:"setHasLocalMutations",value:function(){return this.documentState=1,this.version=fp.min(),this}},{key:"setReadTime",value:function(e){return this.readTime=e,this}},{key:"hasLocalMutations",get:function(){return 1===this.documentState}},{key:"hasCommittedMutations",get:function(){return 2===this.documentState}},{key:"hasPendingWrites",get:function(){return this.hasLocalMutations||this.hasCommittedMutations}},{key:"isValidDocument",value:function(){return 0!==this.documentType}},{key:"isFoundDocument",value:function(){return 1===this.documentType}},{key:"isNoDocument",value:function(){return 2===this.documentType}},{key:"isUnknownDocument",value:function(){return 3===this.documentType}},{key:"isEqual",value:function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}},{key:"mutableCopy",value:function(){return new e(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}},{key:"toString",value:function(){return"Document(".concat(this.key,", ").concat(this.version,", ").concat(JSON.stringify(this.data.value),", {createTime: ").concat(this.createTime,"}), {documentType: ").concat(this.documentType,"}), {documentState: ").concat(this.documentState,"})")}}],[{key:"newInvalidDocument",value:function(t){return new e(t,0,fp.min(),fp.min(),fp.min(),cm.empty(),0)}},{key:"newFoundDocument",value:function(t,n,r,i){return new e(t,1,n,fp.min(),r,i,0)}},{key:"newNoDocument",value:function(t,n){return new e(t,2,n,fp.min(),fp.min(),cm.empty(),0)}},{key:"newUnknownDocument",value:function(t,n){return new e(t,3,n,fp.min(),fp.min(),cm.empty(),2)}}]),e}(),hm=k((function e(t,n){y(this,e),this.position=t,this.inclusive=n}));function dm(e,t,n){for(var r=0,i=0;i<e.position.length;i++){var a=t[i],o=e.position[i];if(r=a.field.isKeyField()?mp.comparator(mp.fromName(o.referenceValue),n.key):Wv(o,n.data.field(a.field)),"desc"===a.dir&&(r*=-1),0!==r)break}return r}function pm(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(var n=0;n<e.position.length;n++)if(!Gv(e.position[n],t.position[n]))return!1;return!0}var vm=k((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc";y(this,e),this.field=t,this.dir=n}));function mm(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}var ym=k((function e(){y(this,e)})),gm=function(e){x(n,e);var t=E(n);function n(e,r,i){var a;return y(this,n),(a=t.call(this)).field=e,a.op=r,a.value=i,a}return k(n,[{key:"matches",value:function(e){var t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(Wv(t,this.value)):null!==t&&Kv(this.value)===Kv(t)&&this.matchesComparison(Wv(t,this.value))}},{key:"matchesComparison",value:function(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 Gd()}}},{key:"isInequality",value:function(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}},{key:"getFlattenedFilters",value:function(){return[this]}},{key:"getFilters",value:function(){return[this]}}],[{key:"create",value:function(e,t,r){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,r):new Cm(e,t,r):"array-contains"===t?new Dm(e,r):"in"===t?new Rm(e,r):"not-in"===t?new Om(e,r):"array-contains-any"===t?new Lm(e,r):new n(e,t,r)}},{key:"createKeyFieldInFilter",value:function(e,t,n){return"in"===t?new Am(e,n):new Nm(e,n)}}]),n}(ym),km=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this)).filters=e,i.op=r,i.ce=null,i}return k(n,[{key:"matches",value:function(e){return wm(this)?void 0===this.filters.find((function(t){return!t.matches(e)})):void 0!==this.filters.find((function(t){return t.matches(e)}))}},{key:"getFlattenedFilters",value:function(){return null!==this.ce||(this.ce=this.filters.reduce((function(e,t){return e.concat(t.getFlattenedFilters())}),[])),this.ce}},{key:"getFilters",value:function(){return Object.assign([],this.filters)}}],[{key:"create",value:function(e,t){return new n(e,t)}}]),n}(ym);function wm(e){return"and"===e.op}function bm(e){return"or"===e.op}function _m(e){return xm(e)&&wm(e)}function xm(e){var t,n=w(e.filters);try{for(n.s();!(t=n.n()).done;){if(t.value instanceof km)return!1}}catch(r){n.e(r)}finally{n.f()}return!0}function Tm(e){if(e instanceof gm)return e.field.canonicalString()+e.op.toString()+Yv(e.value);if(_m(e))return e.filters.map((function(e){return Tm(e)})).join(",");var t=e.filters.map((function(e){return Tm(e)})).join(",");return"".concat(e.op,"(").concat(t,")")}function Im(e,t){return e instanceof gm?function(e,t){return t instanceof gm&&e.op===t.op&&e.field.isEqual(t.field)&&Gv(e.value,t.value)}(e,t):e instanceof km?function(e,t){return t instanceof km&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce((function(e,n,r){return e&&Im(n,t.filters[r])}),!0)}(e,t):void Gd()}function Em(e,t){var n=e.filters.concat(t);return km.create(n,e.op)}function Sm(e){return e instanceof gm?function(e){return"".concat(e.field.canonicalString()," ").concat(e.op," ").concat(Yv(e.value))}(e):e instanceof km?function(e){return e.op.toString()+" {"+e.getFilters().map(Sm).join(" ,")+"}"}(e):"Filter"}var Cm=function(e){x(n,e);var t=E(n);function n(e,r,i){var a;return y(this,n),(a=t.call(this,e,r,i)).key=mp.fromName(i.referenceValue),a}return k(n,[{key:"matches",value:function(e){var t=mp.comparator(e.key,this.key);return this.matchesComparison(t)}}]),n}(gm),Am=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this,e,"in",r)).keys=Pm("in",r),i}return k(n,[{key:"matches",value:function(e){return this.keys.some((function(t){return t.isEqual(e.key)}))}}]),n}(gm),Nm=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this,e,"not-in",r)).keys=Pm("not-in",r),i}return k(n,[{key:"matches",value:function(e){return!this.keys.some((function(t){return t.isEqual(e.key)}))}}]),n}(gm);function Pm(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map((function(e){return mp.fromName(e.referenceValue)}))}var Dm=function(e){x(n,e);var t=E(n);function n(e,r){return y(this,n),t.call(this,e,"array-contains",r)}return k(n,[{key:"matches",value:function(e){var t=e.data.field(this.field);return Zv(t)&&Hv(t.arrayValue,this.value)}}]),n}(gm),Rm=function(e){x(n,e);var t=E(n);function n(e,r){return y(this,n),t.call(this,e,"in",r)}return k(n,[{key:"matches",value:function(e){var t=e.data.field(this.field);return null!==t&&Hv(this.value.arrayValue,t)}}]),n}(gm),Om=function(e){x(n,e);var t=E(n);function n(e,r){return y(this,n),t.call(this,e,"not-in",r)}return k(n,[{key:"matches",value:function(e){if(Hv(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;var t=e.data.field(this.field);return null!==t&&!Hv(this.value.arrayValue,t)}}]),n}(gm),Lm=function(e){x(n,e);var t=E(n);function n(e,r){return y(this,n),t.call(this,e,"array-contains-any",r)}return k(n,[{key:"matches",value:function(e){var t=this,n=e.data.field(this.field);return!(!Zv(n)||!n.arrayValue.values)&&n.arrayValue.values.some((function(e){return Hv(t.value.arrayValue,e)}))}}]),n}(gm),Mm=k((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;y(this,e),this.path=t,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=a,this.startAt=o,this.endAt=u,this.le=null}));function Fm(e){return new Mm(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,arguments.length>6&&void 0!==arguments[6]?arguments[6]:null)}function Vm(e){var t=Wd(e);if(null===t.le){var n=t.path.canonicalString();null!==t.collectionGroup&&(n+="|cg:"+t.collectionGroup),n+="|f:",n+=t.filters.map((function(e){return Tm(e)})).join(","),n+="|ob:",n+=t.orderBy.map((function(e){return function(e){return e.field.canonicalString()+e.dir}(e)})).join(","),qp(t.limit)||(n+="|l:",n+=t.limit),t.startAt&&(n+="|lb:",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map((function(e){return Yv(e)})).join(",")),t.endAt&&(n+="|ub:",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map((function(e){return Yv(e)})).join(",")),t.le=n}return t.le}function Um(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(var n=0;n<e.orderBy.length;n++)if(!mm(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(var r=0;r<e.filters.length;r++)if(!Im(e.filters[r],t.filters[r]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!pm(e.startAt,t.startAt)&&pm(e.endAt,t.endAt)}function jm(e){return mp.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}function zm(e,t){return e.filters.filter((function(e){return e instanceof gm&&e.field.isEqual(t)}))}function Bm(e,t,n){var r,i=qv,a=!0,o=w(zm(e,t));try{for(o.s();!(r=o.n()).done;){var u=r.value,s=qv,c=!0;switch(u.op){case"<":case"<=":s=am(u.value);break;case"==":case"in":case">=":s=u.value;break;case">":s=u.value,c=!1;break;case"!=":case"not-in":s=qv}um({value:i,inclusive:a},{value:s,inclusive:c})<0&&(i=s,a=c)}}catch(h){o.e(h)}finally{o.f()}if(null!==n)for(var l=0;l<e.orderBy.length;++l)if(e.orderBy[l].field.isEqual(t)){var f=n.position[l];um({value:i,inclusive:a},{value:f,inclusive:n.inclusive})<0&&(i=f,a=n.inclusive);break}return{value:i,inclusive:a}}function qm(e,t,n){var r,i=Bv,a=!0,o=w(zm(e,t));try{for(o.s();!(r=o.n()).done;){var u=r.value,s=Bv,c=!0;switch(u.op){case">=":case">":s=om(u.value),c=!1;break;case"==":case"in":case"<=":s=u.value;break;case"<":s=u.value,c=!1;break;case"!=":case"not-in":s=Bv}sm({value:i,inclusive:a},{value:s,inclusive:c})>0&&(i=s,a=c)}}catch(h){o.e(h)}finally{o.f()}if(null!==n)for(var l=0;l<e.orderBy.length;++l)if(e.orderBy[l].field.isEqual(t)){var f=n.position[l];sm({value:i,inclusive:a},{value:f,inclusive:n.inclusive})>0&&(i=f,a=n.inclusive);break}return{value:i,inclusive:a}}var Km=k((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"F",u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;y(this,e),this.path=t,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=i,this.limit=a,this.limitType=o,this.startAt=u,this.endAt=s,this.he=null,this.Pe=null,this.Ie=null,this.startAt,this.endAt}));function Gm(e,t,n,r,i,a,o,u){return new Km(e,t,n,r,i,a,o,u)}function Hm(e){return new Km(e)}function Wm(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 Qm(e){return null!==e.collectionGroup}function Ym(e){var t=Wd(e);if(null===t.he){t.he=[];var n,r=new Set,i=w(t.explicitOrderBy);try{for(i.s();!(n=i.n()).done;){var a=n.value;t.he.push(a),r.add(a.field.canonicalString())}}catch(s){i.e(s)}finally{i.f()}var o=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",u=function(e){var t=new Sv(vp.comparator);return e.filters.forEach((function(e){e.getFlattenedFilters().forEach((function(e){e.isInequality()&&(t=t.add(e.field))}))})),t}(t);u.forEach((function(e){r.has(e.canonicalString())||e.isKeyField()||t.he.push(new vm(e,o))})),r.has(vp.keyField().canonicalString())||t.he.push(new vm(vp.keyField(),o))}return t.he}function Jm(e){var t=Wd(e);return t.Pe||(t.Pe=Xm(t,Ym(e))),t.Pe}function Xm(e,t){if("F"===e.limitType)return Fm(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);t=t.map((function(e){var t="desc"===e.dir?"asc":"desc";return new vm(e.field,t)}));var n=e.endAt?new hm(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new hm(e.startAt.position,e.startAt.inclusive):null;return Fm(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}function $m(e,t){var n=e.filters.concat([t]);return new Km(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function Zm(e,t,n){return new Km(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function ey(e,t){return Um(Jm(e),Jm(t))&&e.limitType===t.limitType}function ty(e){return"".concat(Vm(Jm(e)),"|lt:").concat(e.limitType)}function ny(e){return"Query(target=".concat(function(e){var t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=", filters: [".concat(e.filters.map((function(e){return Sm(e)})).join(", "),"]")),qp(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=", orderBy: [".concat(e.orderBy.map((function(e){return function(e){return"".concat(e.field.canonicalString()," (").concat(e.dir,")")}(e)})).join(", "),"]")),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((function(e){return Yv(e)})).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((function(e){return Yv(e)})).join(",")),"Target(".concat(t,")")}(Jm(e)),"; limitType=").concat(e.limitType,")")}function ry(e,t){return t.isFoundDocument()&&function(e,t){var n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):mp.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){var n,r=w(Ym(e));try{for(r.s();!(n=r.n()).done;){var i=n.value;if(!i.field.isKeyField()&&null===t.data.field(i.field))return!1}}catch(a){r.e(a)}finally{r.f()}return!0}(e,t)&&function(e,t){var n,r=w(e.filters);try{for(r.s();!(n=r.n()).done;){if(!n.value.matches(t))return!1}}catch(i){r.e(i)}finally{r.f()}return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){var r=dm(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,Ym(e),t))&&!(e.endAt&&!function(e,t,n){var r=dm(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,Ym(e),t))}(e,t)}function iy(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function ay(e){return function(t,n){var r,i=!1,a=w(Ym(e));try{for(a.s();!(r=a.n()).done;){var o=r.value,u=oy(o,t,n);if(0!==u)return u;i=i||o.field.isKeyField()}}catch(s){a.e(s)}finally{a.f()}return 0}}function oy(e,t,n){var r=e.field.isKeyField()?mp.comparator(t.key,n.key):function(e,t,n){var r=t.data.field(e),i=n.data.field(e);return null!==r&&null!==i?Wv(r,i):Gd()}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return Gd()}}var uy=function(){function e(t,n){y(this,e),this.mapKeyFn=t,this.equalsFn=n,this.inner={},this.innerSize=0}return k(e,[{key:"get",value:function(e){var t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n){var r,i=w(n);try{for(i.s();!(r=i.n()).done;){var a=m(r.value,2),o=a[0],u=a[1];if(this.equalsFn(o,e))return u}}catch(s){i.e(s)}finally{i.f()}}}},{key:"has",value:function(e){return void 0!==this.get(e)}},{key:"set",value:function(e,t){var n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(var i=0;i<r.length;i++)if(this.equalsFn(r[i][0],e))return void(r[i]=[e,t]);r.push([e,t]),this.innerSize++}},{key:"delete",value:function(e){var t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return 1===n.length?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}},{key:"forEach",value:function(e){_v(this.inner,(function(t,n){var r,i=w(n);try{for(i.s();!(r=i.n()).done;){var a=m(r.value,2),o=a[0],u=a[1];e(o,u)}}catch(s){i.e(s)}finally{i.f()}}))}},{key:"isEmpty",value:function(){return xv(this.inner)}},{key:"size",value:function(){return this.innerSize}}]),e}(),sy=new Tv(mp.comparator);function cy(){return sy}var ly=new Tv(mp.comparator);function fy(){for(var e=ly,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0,a=n;i<a.length;i++){var o=a[i];e=e.insert(o.key,o)}return e}function hy(e){var t=ly;return e.forEach((function(e,n){return t=t.insert(e,n.overlayedDocument)})),t}function dy(){return vy()}function py(){return vy()}function vy(){return new uy((function(e){return e.toString()}),(function(e,t){return e.isEqual(t)}))}var my=new Tv(mp.comparator),yy=new Sv(mp.comparator);function gy(){for(var e=yy,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0,a=n;i<a.length;i++){var o=a[i];e=e.add(o)}return e}var ky=new Sv(up);function wy(){return ky}function by(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:Kp(t)?"-0":t}}function _y(e){return{integerValue:""+e}}function xy(e,t){return Gp(t)?_y(t):by(e,t)}var Ty=k((function e(){y(this,e),this._=void 0}));function Iy(e,t,n){return e instanceof Cy?function(e,t){var n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&Fv(t)&&(t=Vv(t)),t&&(n.fields.__previous_value__=t),{mapValue:n}}(n,t):e instanceof Ay?Ny(e,t):e instanceof Py?Dy(e,t):function(e,t){var n=Sy(e,t),r=Oy(n)+Oy(e.Te);return $v(n)&&$v(e.Te)?_y(r):by(e.serializer,r)}(e,t)}function Ey(e,t,n){return e instanceof Ay?Ny(e,t):e instanceof Py?Dy(e,t):n}function Sy(e,t){return e instanceof Ry?function(e){return $v(e)||function(e){return!!e&&"doubleValue"in e}(e)}(t)?t:{integerValue:0}:null}var Cy=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.apply(this,arguments)}return k(n)}(Ty),Ay=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this)).elements=e,r}return k(n)}(Ty);function Ny(e,t){var n,r=Ly(t),i=w(e.elements);try{var a=function(){var e=n.value;r.some((function(t){return Gv(t,e)}))||r.push(e)};for(i.s();!(n=i.n()).done;)a()}catch(o){i.e(o)}finally{i.f()}return{arrayValue:{values:r}}}var Py=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this)).elements=e,r}return k(n)}(Ty);function Dy(e,t){var n,r=Ly(t),i=w(e.elements);try{var a=function(){var e=n.value;r=r.filter((function(t){return!Gv(t,e)}))};for(i.s();!(n=i.n()).done;)a()}catch(o){i.e(o)}finally{i.f()}return{arrayValue:{values:r}}}var Ry=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this)).serializer=e,i.Te=r,i}return k(n)}(Ty);function Oy(e){return Lv(e.integerValue||e.doubleValue)}function Ly(e){return Zv(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}var My=k((function e(t,n){y(this,e),this.field=t,this.transform=n}));var Fy=k((function e(t,n){y(this,e),this.version=t,this.transformResults=n})),Vy=function(){function e(t,n){y(this,e),this.updateTime=t,this.exists=n}return k(e,[{key:"isNone",get:function(){return void 0===this.updateTime&&void 0===this.exists}},{key:"isEqual",value:function(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}],[{key:"none",value:function(){return new e}},{key:"exists",value:function(t){return new e(void 0,t)}},{key:"updateTime",value:function(t){return new e(t)}}]),e}();function Uy(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}var jy=k((function e(){y(this,e)}));function zy(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new Zy(e.key,Vy.none()):new Hy(e.key,e.data,Vy.none());var n,r=e.data,i=cm.empty(),a=new Sv(vp.comparator),o=w(t.fields);try{for(o.s();!(n=o.n()).done;){var u=n.value;if(!a.has(u)){var s=r.field(u);null===s&&u.length>1&&(u=u.popLast(),s=r.field(u)),null===s?i.delete(u):i.set(u,s),a=a.add(u)}}}catch(c){o.e(c)}finally{o.f()}return new Wy(e.key,i,new Nv(a.toArray()),Vy.none())}function By(e,t,n){e instanceof Hy?function(e,t,n){var r=e.value.clone(),i=Yy(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof Wy?function(e,t,n){if(Uy(e.precondition,t)){var r=Yy(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(Qy(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}else t.convertToUnknownDocument(n.version)}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function qy(e,t,n,r){return e instanceof Hy?function(e,t,n,r){if(!Uy(e.precondition,t))return n;var i=e.value.clone(),a=Jy(e.fieldTransforms,r,t);return i.setAll(a),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof Wy?function(e,t,n,r){if(!Uy(e.precondition,t))return n;var i=Jy(e.fieldTransforms,r,t),a=t.data;return a.setAll(Qy(e)),a.setAll(i),t.convertToFoundDocument(t.version,a).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((function(e){return e.field})))}(e,t,n,r):function(e,t,n){return Uy(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function Ky(e,t){var n,r=null,i=w(e.fieldTransforms);try{for(i.s();!(n=i.n()).done;){var a=n.value,o=t.data.field(a.field),u=Sy(a.transform,o||null);null!=u&&(null===r&&(r=cm.empty()),r.set(a.field,u))}}catch(s){i.e(s)}finally{i.f()}return r||null}function Gy(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&sp(e,t,(function(e,t){return function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Ay&&t instanceof Ay||e instanceof Py&&t instanceof Py?sp(e.elements,t.elements,Gv):e instanceof Ry&&t instanceof Ry?Gv(e.Te,t.Te):e instanceof Cy&&t instanceof Cy}(e.transform,t.transform)}(e,t)}))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}var Hy=function(e){x(n,e);var t=E(n);function n(e,r,i){var a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return y(this,n),(a=t.call(this)).key=e,a.value=r,a.precondition=i,a.fieldTransforms=o,a.type=0,a}return k(n,[{key:"getFieldMask",value:function(){return null}}]),n}(jy),Wy=function(e){x(n,e);var t=E(n);function n(e,r,i,a){var o,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return y(this,n),(o=t.call(this)).key=e,o.data=r,o.fieldMask=i,o.precondition=a,o.fieldTransforms=u,o.type=1,o}return k(n,[{key:"getFieldMask",value:function(){return this.fieldMask}}]),n}(jy);function Qy(e){var t=new Map;return e.fieldMask.fields.forEach((function(n){if(!n.isEmpty()){var r=e.data.field(n);t.set(n,r)}})),t}function Yy(e,t,n){var r=new Map;Hd(e.length===n.length);for(var i=0;i<n.length;i++){var a=e[i],o=a.transform,u=t.data.field(a.field);r.set(a.field,Ey(o,u,n[i]))}return r}function Jy(e,t,n){var r,i=new Map,a=w(e);try{for(a.s();!(r=a.n()).done;){var o=r.value,u=o.transform,s=n.data.field(o.field);i.set(o.field,Iy(u,s,t))}}catch(c){a.e(c)}finally{a.f()}return i}var Xy,$y,Zy=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this)).key=e,i.precondition=r,i.type=2,i.fieldTransforms=[],i}return k(n,[{key:"getFieldMask",value:function(){return null}}]),n}(jy),eg=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this)).key=e,i.precondition=r,i.type=3,i.fieldTransforms=[],i}return k(n,[{key:"getFieldMask",value:function(){return null}}]),n}(jy),tg=function(){function e(t,n,r,i){y(this,e),this.batchId=t,this.localWriteTime=n,this.baseMutations=r,this.mutations=i}return k(e,[{key:"applyToRemoteDocument",value:function(e,t){for(var n=t.mutationResults,r=0;r<this.mutations.length;r++){var i=this.mutations[r];i.key.isEqual(e.key)&&By(i,e,n[r])}}},{key:"applyToLocalView",value:function(e,t){var n,r=w(this.baseMutations);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.key.isEqual(e.key)&&(t=qy(i,e,t,this.localWriteTime))}}catch(s){r.e(s)}finally{r.f()}var a,o=w(this.mutations);try{for(o.s();!(a=o.n()).done;){var u=a.value;u.key.isEqual(e.key)&&(t=qy(u,e,t,this.localWriteTime))}}catch(s){o.e(s)}finally{o.f()}return t}},{key:"applyToLocalDocumentSet",value:function(e,t){var n=this,r=py();return this.mutations.forEach((function(i){var a=e.get(i.key),o=a.overlayedDocument,u=n.applyToLocalView(o,a.mutatedFields),s=zy(o,u=t.has(i.key)?null:u);null!==s&&r.set(i.key,s),o.isValidDocument()||o.convertToNoDocument(fp.min())})),r}},{key:"keys",value:function(){return this.mutations.reduce((function(e,t){return e.add(t.key)}),gy())}},{key:"isEqual",value:function(e){return this.batchId===e.batchId&&sp(this.mutations,e.mutations,(function(e,t){return Gy(e,t)}))&&sp(this.baseMutations,e.baseMutations,(function(e,t){return Gy(e,t)}))}}]),e}(),ng=function(){function e(t,n,r,i){y(this,e),this.batch=t,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}return k(e,null,[{key:"from",value:function(t,n,r){Hd(t.mutations.length===r.length);for(var i=my,a=t.mutations,o=0;o<a.length;o++)i=i.insert(a[o].key,r[o].version);return new e(t,n,r,i)}}]),e}(),rg=function(){function e(t,n){y(this,e),this.largestBatchId=t,this.mutation=n}return k(e,[{key:"getKey",value:function(){return this.mutation.key}},{key:"isEqual",value:function(e){return null!==e&&this.mutation===e.mutation}},{key:"toString",value:function(){return"Overlay{\n largestBatchId: ".concat(this.largestBatchId,",\n mutation: ").concat(this.mutation.toString(),"\n }")}}]),e}(),ig=k((function e(t,n){y(this,e),this.count=t,this.unchangedNames=n}));function ag(e){switch(e){default:return Gd();case Qd.CANCELLED:case Qd.UNKNOWN:case Qd.DEADLINE_EXCEEDED:case Qd.RESOURCE_EXHAUSTED:case Qd.INTERNAL:case Qd.UNAVAILABLE:case Qd.UNAUTHENTICATED:return!1;case Qd.INVALID_ARGUMENT:case Qd.NOT_FOUND:case Qd.ALREADY_EXISTS:case Qd.PERMISSION_DENIED:case Qd.FAILED_PRECONDITION:case Qd.ABORTED:case Qd.OUT_OF_RANGE:case Qd.UNIMPLEMENTED:case Qd.DATA_LOSS:return!0}}function og(e){if(void 0===e)return Bd("GRPC error has no .code"),Qd.UNKNOWN;switch(e){case Xy.OK:return Qd.OK;case Xy.CANCELLED:return Qd.CANCELLED;case Xy.UNKNOWN:return Qd.UNKNOWN;case Xy.DEADLINE_EXCEEDED:return Qd.DEADLINE_EXCEEDED;case Xy.RESOURCE_EXHAUSTED:return Qd.RESOURCE_EXHAUSTED;case Xy.INTERNAL:return Qd.INTERNAL;case Xy.UNAVAILABLE:return Qd.UNAVAILABLE;case Xy.UNAUTHENTICATED:return Qd.UNAUTHENTICATED;case Xy.INVALID_ARGUMENT:return Qd.INVALID_ARGUMENT;case Xy.NOT_FOUND:return Qd.NOT_FOUND;case Xy.ALREADY_EXISTS:return Qd.ALREADY_EXISTS;case Xy.PERMISSION_DENIED:return Qd.PERMISSION_DENIED;case Xy.FAILED_PRECONDITION:return Qd.FAILED_PRECONDITION;case Xy.ABORTED:return Qd.ABORTED;case Xy.OUT_OF_RANGE:return Qd.OUT_OF_RANGE;case Xy.UNIMPLEMENTED:return Qd.UNIMPLEMENTED;case Xy.DATA_LOSS:return Qd.DATA_LOSS;default:return Gd()}}($y=Xy||(Xy={}))[$y.OK=0]="OK",$y[$y.CANCELLED=1]="CANCELLED",$y[$y.UNKNOWN=2]="UNKNOWN",$y[$y.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",$y[$y.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",$y[$y.NOT_FOUND=5]="NOT_FOUND",$y[$y.ALREADY_EXISTS=6]="ALREADY_EXISTS",$y[$y.PERMISSION_DENIED=7]="PERMISSION_DENIED",$y[$y.UNAUTHENTICATED=16]="UNAUTHENTICATED",$y[$y.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",$y[$y.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",$y[$y.ABORTED=10]="ABORTED",$y[$y.OUT_OF_RANGE=11]="OUT_OF_RANGE",$y[$y.UNIMPLEMENTED=12]="UNIMPLEMENTED",$y[$y.INTERNAL=13]="INTERNAL",$y[$y.UNAVAILABLE=14]="UNAVAILABLE",$y[$y.DATA_LOSS=15]="DATA_LOSS";var ug=null;function sg(){return new TextEncoder}var cg=new Ld([4294967295,4294967295],0);function lg(e){var t=sg().encode(e),n=new Od;return n.update(t),new Uint8Array(n.digest())}function fg(e){var t=new DataView(e.buffer),n=t.getUint32(0,!0),r=t.getUint32(4,!0),i=t.getUint32(8,!0),a=t.getUint32(12,!0);return[new Ld([n,r],0),new Ld([i,a],0)]}var hg=function(){function e(t,n,r){if(y(this,e),this.bitmap=t,this.padding=n,this.hashCount=r,n<0||n>=8)throw new dg("Invalid padding: ".concat(n));if(r<0)throw new dg("Invalid hash count: ".concat(r));if(t.length>0&&0===this.hashCount)throw new dg("Invalid hash count: ".concat(r));if(0===t.length&&0!==n)throw new dg("Invalid padding when bitmap length is 0: ".concat(n));this.Ee=8*t.length-n,this.de=Ld.fromNumber(this.Ee)}return k(e,[{key:"Ae",value:function(e,t,n){var r=e.add(t.multiply(Ld.fromNumber(n)));return 1===r.compare(cg)&&(r=new Ld([r.getBits(0),r.getBits(1)],0)),r.modulo(this.de).toNumber()}},{key:"Re",value:function(e){return 0!=(this.bitmap[Math.floor(e/8)]&1<<e%8)}},{key:"mightContain",value:function(e){if(0===this.Ee)return!1;for(var t=m(fg(lg(e)),2),n=t[0],r=t[1],i=0;i<this.hashCount;i++){var a=this.Ae(n,r,i);if(!this.Re(a))return!1}return!0}},{key:"insert",value:function(e){if(0!==this.Ee)for(var t=m(fg(lg(e)),2),n=t[0],r=t[1],i=0;i<this.hashCount;i++){var a=this.Ae(n,r,i);this.Ve(a)}}},{key:"Ve",value:function(e){var t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}}],[{key:"create",value:function(t,n,r){var i=t%8==0?0:8-t%8,a=new e(new Uint8Array(Math.ceil(t/8)),i,n);return r.forEach((function(e){return a.insert(e)})),a}}]),e}(),dg=function(e){x(n,e);var t=E(n);function n(){var e;return y(this,n),(e=t.apply(this,arguments)).name="BloomFilterError",e}return k(n)}(C(Error)),pg=function(){function e(t,n,r,i,a){y(this,e),this.snapshotVersion=t,this.targetChanges=n,this.targetMismatches=r,this.documentUpdates=i,this.resolvedLimboDocuments=a}return k(e,null,[{key:"createSynthesizedRemoteEventForCurrentChange",value:function(t,n,r){var i=new Map;return i.set(t,vg.createSynthesizedTargetChangeForCurrentChange(t,n,r)),new e(fp.min(),i,new Tv(up),cy(),gy())}}]),e}(),vg=function(){function e(t,n,r,i,a){y(this,e),this.resumeToken=t,this.current=n,this.addedDocuments=r,this.modifiedDocuments=i,this.removedDocuments=a}return k(e,null,[{key:"createSynthesizedTargetChangeForCurrentChange",value:function(t,n,r){return new e(r,n,gy(),gy(),gy())}}]),e}(),mg=k((function e(t,n,r,i){y(this,e),this.me=t,this.removedTargetIds=n,this.key=r,this.fe=i})),yg=k((function e(t,n){y(this,e),this.targetId=t,this.ge=n})),gg=k((function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Dv.EMPTY_BYTE_STRING,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;y(this,e),this.state=t,this.targetIds=n,this.resumeToken=r,this.cause=i})),kg=function(){function e(){y(this,e),this.pe=0,this.ye=_g(),this.we=Dv.EMPTY_BYTE_STRING,this.Se=!1,this.be=!0}return k(e,[{key:"current",get:function(){return this.Se}},{key:"resumeToken",get:function(){return this.we}},{key:"De",get:function(){return 0!==this.pe}},{key:"Ce",get:function(){return this.be}},{key:"ve",value:function(e){e.approximateByteSize()>0&&(this.be=!0,this.we=e)}},{key:"Fe",value:function(){var e=gy(),t=gy(),n=gy();return this.ye.forEach((function(r,i){switch(i){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:Gd()}})),new vg(this.we,this.Se,e,t,n)}},{key:"Me",value:function(){this.be=!1,this.ye=_g()}},{key:"xe",value:function(e,t){this.be=!0,this.ye=this.ye.insert(e,t)}},{key:"Oe",value:function(e){this.be=!0,this.ye=this.ye.remove(e)}},{key:"Ne",value:function(){this.pe+=1}},{key:"Be",value:function(){this.pe-=1}},{key:"Le",value:function(){this.be=!0,this.Se=!0}}]),e}(),wg=function(){function e(t){y(this,e),this.ke=t,this.qe=new Map,this.Qe=cy(),this.Ke=bg(),this.$e=new Tv(up)}return k(e,[{key:"Ue",value:function(e){var t,n=w(e.me);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.fe&&e.fe.isFoundDocument()?this.We(r,e.fe):this.Ge(r,e.key,e.fe)}}catch(u){n.e(u)}finally{n.f()}var i,a=w(e.removedTargetIds);try{for(a.s();!(i=a.n()).done;){var o=i.value;this.Ge(o,e.key,e.fe)}}catch(u){a.e(u)}finally{a.f()}}},{key:"ze",value:function(e){var t=this;this.forEachTarget(e,(function(n){var r=t.je(n);switch(e.state){case 0:t.He(n)&&r.ve(e.resumeToken);break;case 1:r.Be(),r.De||r.Me(),r.ve(e.resumeToken);break;case 2:r.Be(),r.De||t.removeTarget(n);break;case 3:t.He(n)&&(r.Le(),r.ve(e.resumeToken));break;case 4:t.He(n)&&(t.Je(n),r.ve(e.resumeToken));break;default:Gd()}}))}},{key:"forEachTarget",value:function(e,t){var n=this;e.targetIds.length>0?e.targetIds.forEach(t):this.qe.forEach((function(e,r){n.He(r)&&t(r)}))}},{key:"Ye",value:function(e){var t=e.targetId,n=e.ge.count,r=this.Ze(t);if(r){var i=r.target;if(jm(i))if(0===n){var a=new mp(i.path);this.Ge(t,a,fm.newNoDocument(a,fp.min()))}else Hd(1===n);else{var o=this.Xe(t);if(o!==n){var u=this.et(e),s=u?this.tt(u,e,o):1;if(0!==s){this.Je(t);var c=2===s?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.$e=this.$e.insert(t,c)}null==ug||ug.nt(function(e,t,n,r,i){var a,o,u,s,c,l,f={localCacheCount:e,existenceFilterCount:t.count,databaseId:n.database,projectId:n.projectId},h=t.unchangedNames;return h&&(f.bloomFilter={applied:0===i,hashCount:null!==(a=null==h?void 0:h.hashCount)&&void 0!==a?a:0,bitmapLength:null!==(s=null===(u=null===(o=null==h?void 0:h.bits)||void 0===o?void 0:o.bitmap)||void 0===u?void 0:u.length)&&void 0!==s?s:0,padding:null!==(l=null===(c=null==h?void 0:h.bits)||void 0===c?void 0:c.padding)&&void 0!==l?l:0,mightContain:function(e){var t;return null!==(t=null==r?void 0:r.mightContain(e))&&void 0!==t&&t}}),f}(o,e.ge,this.ke.rt(),u,s))}}}}},{key:"et",value:function(e){var t=e.ge.unchangedNames;if(!t||!t.bits)return null;var n,r,i=t.bits,a=i.bitmap,o=void 0===a?"":a,u=i.padding,s=void 0===u?0:u,c=t.hashCount,l=void 0===c?0:c;try{n=Mv(o).toUint8Array()}catch(e){if(e instanceof Pv)return qd("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{r=new hg(n,s,l)}catch(e){return qd(e instanceof dg?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===r.Ee?null:r}},{key:"tt",value:function(e,t,n){return t.ge.count===n-this.it(e,t.targetId)?0:2}},{key:"it",value:function(e,t){var n=this,r=this.ke.getRemoteKeysForTarget(t),i=0;return r.forEach((function(r){var a=n.ke.rt(),o="projects/".concat(a.projectId,"/databases/").concat(a.database,"/documents/").concat(r.path.canonicalString());e.mightContain(o)||(n.Ge(t,r,null),i++)})),i}},{key:"st",value:function(e){var t=this,n=new Map;this.qe.forEach((function(r,i){var a=t.Ze(i);if(a){if(r.current&&jm(a.target)){var o=new mp(a.target.path);null!==t.Qe.get(o)||t.ot(i,o)||t.Ge(i,o,fm.newNoDocument(o,e))}r.Ce&&(n.set(i,r.Fe()),r.Me())}}));var r=gy();this.Ke.forEach((function(e,n){var i=!0;n.forEachWhile((function(e){var n=t.Ze(e);return!n||"TargetPurposeLimboResolution"===n.purpose||(i=!1,!1)})),i&&(r=r.add(e))})),this.Qe.forEach((function(t,n){return n.setReadTime(e)}));var i=new pg(e,n,this.$e,this.Qe,r);return this.Qe=cy(),this.Ke=bg(),this.$e=new Tv(up),i}},{key:"We",value:function(e,t){if(this.He(e)){var n=this.ot(e,t.key)?2:0;this.je(e).xe(t.key,n),this.Qe=this.Qe.insert(t.key,t),this.Ke=this.Ke.insert(t.key,this._t(t.key).add(e))}}},{key:"Ge",value:function(e,t,n){if(this.He(e)){var r=this.je(e);this.ot(e,t)?r.xe(t,1):r.Oe(t),this.Ke=this.Ke.insert(t,this._t(t).delete(e)),n&&(this.Qe=this.Qe.insert(t,n))}}},{key:"removeTarget",value:function(e){this.qe.delete(e)}},{key:"Xe",value:function(e){var t=this.je(e).Fe();return this.ke.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}},{key:"Ne",value:function(e){this.je(e).Ne()}},{key:"je",value:function(e){var t=this.qe.get(e);return t||(t=new kg,this.qe.set(e,t)),t}},{key:"_t",value:function(e){var t=this.Ke.get(e);return t||(t=new Sv(up),this.Ke=this.Ke.insert(e,t)),t}},{key:"He",value:function(e){var t=null!==this.Ze(e);return t||zd("WatchChangeAggregator","Detected inactive target",e),t}},{key:"Ze",value:function(e){var t=this.qe.get(e);return t&&t.De?null:this.ke.ut(e)}},{key:"Je",value:function(e){var t=this;this.qe.set(e,new kg),this.ke.getRemoteKeysForTarget(e).forEach((function(n){t.Ge(e,n,null)}))}},{key:"ot",value:function(e,t){return this.ke.getRemoteKeysForTarget(e).has(t)}}]),e}();function bg(){return new Tv(mp.comparator)}function _g(){return new Tv(mp.comparator)}var xg={asc:"ASCENDING",desc:"DESCENDING"},Tg={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Ig={and:"AND",or:"OR"},Eg=k((function e(t,n){y(this,e),this.databaseId=t,this.useProto3Json=n}));function Sg(e,t){return e.useProto3Json||qp(t)?t:{value:t}}function Cg(e,t){return e.useProto3Json?"".concat(new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z",""),".").concat(("000000000"+t.nanoseconds).slice(-9),"Z"):{seconds:""+t.seconds,nanos:t.nanoseconds}}function Ag(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function Ng(e,t){return Cg(e,t.toTimestamp())}function Pg(e){return Hd(!!e),fp.fromTimestamp(function(e){var t=Ov(e);return new lp(t.seconds,t.nanos)}(e))}function Dg(e,t){return function(e){return new dp(["projects",e.projectId,"databases",e.database])}(e).child("documents").child(t).canonicalString()}function Rg(e){var t=dp.fromString(e);return Hd(nk(t)),t}function Og(e,t){return Dg(e.databaseId,t.path)}function Lg(e,t){var n=Rg(t);if(n.get(1)!==e.databaseId.projectId)throw new Yd(Qd.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new Yd(Qd.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new mp(Ug(n))}function Mg(e,t){return Dg(e.databaseId,t)}function Fg(e){var t=Rg(e);return 4===t.length?dp.emptyPath():Ug(t)}function Vg(e){return new dp(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Ug(e){return Hd(e.length>4&&"documents"===e.get(4)),e.popFirst(5)}function jg(e,t,n){return{name:Og(e,t),fields:n.value.mapValue.fields}}function zg(e,t,n){var r=Lg(e,t.name),i=Pg(t.updateTime),a=t.createTime?Pg(t.createTime):fp.min(),o=new cm({mapValue:{fields:t.fields}}),u=fm.newFoundDocument(r,i,a,o);return n&&u.setHasCommittedMutations(),n?u.setHasCommittedMutations():u}function Bg(e,t){return"found"in t?function(e,t){Hd(!!t.found),t.found.name,t.found.updateTime;var n=Lg(e,t.found.name),r=Pg(t.found.updateTime),i=t.found.createTime?Pg(t.found.createTime):fp.min(),a=new cm({mapValue:{fields:t.found.fields}});return fm.newFoundDocument(n,r,i,a)}(e,t):"missing"in t?function(e,t){Hd(!!t.missing),Hd(!!t.readTime);var n=Lg(e,t.missing),r=Pg(t.readTime);return fm.newNoDocument(n,r)}(e,t):Gd()}function qg(e,t){var n;if(t instanceof Hy)n={update:jg(e,t.key,t.value)};else if(t instanceof Zy)n={delete:Og(e,t.key)};else if(t instanceof Wy)n={update:jg(e,t.key,t.data),updateMask:tk(t.fieldMask)};else{if(!(t instanceof eg))return Gd();n={verify:Og(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map((function(e){return function(e,t){var n=t.transform;if(n instanceof Cy)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Ay)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Py)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Ry)return{fieldPath:t.field.canonicalString(),increment:n.Te};throw Gd()}(0,e)}))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:Ng(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:Gd()}(e,t.precondition)),n}function Kg(e,t){var n=t.currentDocument?function(e){return void 0!==e.updateTime?Vy.updateTime(Pg(e.updateTime)):void 0!==e.exists?Vy.exists(e.exists):Vy.none()}(t.currentDocument):Vy.none(),r=t.updateTransforms?t.updateTransforms.map((function(t){return function(e,t){var n=null;if("setToServerValue"in t)Hd("REQUEST_TIME"===t.setToServerValue),n=new Cy;else if("appendMissingElements"in t){var r=t.appendMissingElements.values||[];n=new Ay(r)}else if("removeAllFromArray"in t){var i=t.removeAllFromArray.values||[];n=new Py(i)}else"increment"in t?n=new Ry(e,t.increment):Gd();var a=vp.fromServerFormat(t.fieldPath);return new My(a,n)}(e,t)})):[];if(t.update){t.update.name;var i=Lg(e,t.update.name),a=new cm({mapValue:{fields:t.update.fields}});if(t.updateMask){var o=function(e){var t=e.fieldPaths||[];return new Nv(t.map((function(e){return vp.fromServerFormat(e)})))}(t.updateMask);return new Wy(i,a,o,n,r)}return new Hy(i,a,n,r)}if(t.delete){var u=Lg(e,t.delete);return new Zy(u,n)}if(t.verify){var s=Lg(e,t.verify);return new eg(s,n)}return Gd()}function Gg(e,t){return{documents:[Mg(e,t.path)]}}function Hg(e,t){var n={structuredQuery:{}},r=t.path;null!==t.collectionGroup?(n.parent=Mg(e,r),n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(n.parent=Mg(e,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);var i=function(e){if(0!==e.length)return ek(km.create(e,"and"))}(t.filters);i&&(n.structuredQuery.where=i);var a=function(e){if(0!==e.length)return e.map((function(e){return function(e){return{field:$g(e.field),direction:Yg(e.dir)}}(e)}))}(t.orderBy);a&&(n.structuredQuery.orderBy=a);var o=Sg(e,t.limit);return null!==o&&(n.structuredQuery.limit=o),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),n}function Wg(e){var t=Fg(e.parent),n=e.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){Hd(1===r);var a=n.from[0];a.allDescendants?i=a.collectionId:t=t.child(a.collectionId)}var o=[];n.where&&(o=function(e){var t=Qg(e);return t instanceof km&&_m(t)?t.getFilters():[t]}(n.where));var u=[];n.orderBy&&(u=function(e){return e.map((function(e){return function(e){return new vm(Zg(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e)}))}(n.orderBy));var s=null;n.limit&&(s=function(e){var t;return qp(t="object"==typeof e?e.value:e)?null:t}(n.limit));var c=null;n.startAt&&(c=function(e){var t=!!e.before,n=e.values||[];return new hm(n,t)}(n.startAt));var l=null;return n.endAt&&(l=function(e){var t=!e.before,n=e.values||[];return new hm(n,t)}(n.endAt)),Gm(t,i,u,o,s,"F",c,l)}function Qg(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":var t=Zg(e.unaryFilter.field);return gm.create(t,"==",{doubleValue:NaN});case"IS_NULL":var n=Zg(e.unaryFilter.field);return gm.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var r=Zg(e.unaryFilter.field);return gm.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":var i=Zg(e.unaryFilter.field);return gm.create(i,"!=",{nullValue:"NULL_VALUE"});default:return Gd()}}(e):void 0!==e.fieldFilter?function(e){return gm.create(Zg(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Gd()}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return km.create(e.compositeFilter.filters.map((function(e){return Qg(e)})),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return Gd()}}(e.compositeFilter.op))}(e):Gd()}function Yg(e){return xg[e]}function Jg(e){return Tg[e]}function Xg(e){return Ig[e]}function $g(e){return{fieldPath:e.canonicalString()}}function Zg(e){return vp.fromServerFormat(e.fieldPath)}function ek(e){return e instanceof gm?function(e){if("=="===e.op){if(tm(e.value))return{unaryFilter:{field:$g(e.field),op:"IS_NAN"}};if(em(e.value))return{unaryFilter:{field:$g(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(tm(e.value))return{unaryFilter:{field:$g(e.field),op:"IS_NOT_NAN"}};if(em(e.value))return{unaryFilter:{field:$g(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:$g(e.field),op:Jg(e.op),value:e.value}}}(e):e instanceof km?function(e){var t=e.getFilters().map((function(e){return ek(e)}));return 1===t.length?t[0]:{compositeFilter:{op:Xg(e.op),filters:t}}}(e):Gd()}function tk(e){var t=[];return e.fields.forEach((function(e){return t.push(e.canonicalString())})),{fieldPaths:t}}function nk(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}var rk=function(){function e(t,n,r,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:fp.min(),o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:fp.min(),u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Dv.EMPTY_BYTE_STRING,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;y(this,e),this.target=t,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=a,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=u,this.expectedCount=s}return k(e,[{key:"withSequenceNumber",value:function(t){return new e(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}},{key:"withResumeToken",value:function(t,n){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,t,null)}},{key:"withExpectedCount",value:function(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,t)}},{key:"withLastLimboFreeSnapshotVersion",value:function(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken,this.expectedCount)}}]),e}(),ik=k((function e(t){y(this,e),this.ct=t}));function ak(e,t){var n=t.key,r={prefixPath:n.getCollectionPath().popLast().toArray(),collectionGroup:n.collectionGroup,documentId:n.path.lastSegment(),readTime:ok(t.readTime),hasCommittedMutations:t.hasCommittedMutations};if(t.isFoundDocument())r.document=function(e,t){return{name:Og(e,t.key),fields:t.data.value.mapValue.fields,updateTime:Cg(e,t.version.toTimestamp()),createTime:Cg(e,t.createTime.toTimestamp())}}(e.ct,t);else if(t.isNoDocument())r.noDocument={path:n.path.toArray(),readTime:uk(t.version)};else{if(!t.isUnknownDocument())return Gd();r.unknownDocument={path:n.path.toArray(),version:uk(t.version)}}return r}function ok(e){var t=e.toTimestamp();return[t.seconds,t.nanoseconds]}function uk(e){var t=e.toTimestamp();return{seconds:t.seconds,nanoseconds:t.nanoseconds}}function sk(e){var t=new lp(e.seconds,e.nanoseconds);return fp.fromTimestamp(t)}function ck(e,t){for(var n=(t.baseMutations||[]).map((function(t){return Kg(e.ct,t)})),r=0;r<t.mutations.length-1;++r){var i=t.mutations[r];if(r+1<t.mutations.length&&void 0!==t.mutations[r+1].transform){var a=t.mutations[r+1];i.updateTransforms=a.transform.fieldTransforms,t.mutations.splice(r+1,1),++r}}var o=t.mutations.map((function(t){return Kg(e.ct,t)})),u=lp.fromMillis(t.localWriteTimeMs);return new tg(t.batchId,u,n,o)}function lk(e){var t,n=sk(e.readTime),r=void 0!==e.lastLimboFreeSnapshotVersion?sk(e.lastLimboFreeSnapshotVersion):fp.min();return t=function(e){return void 0!==e.documents}(e.query)?function(e){return Hd(1===e.documents.length),Jm(Hm(Fg(e.documents[0])))}(e.query):function(e){return Jm(Wg(e))}(e.query),new rk(t,e.targetId,"TargetPurposeListen",e.lastListenSequenceNumber,n,r,Dv.fromBase64String(e.resumeToken))}function fk(e,t){var n,r=uk(t.snapshotVersion),i=uk(t.lastLimboFreeSnapshotVersion);n=jm(t.target)?Gg(e.ct,t.target):Hg(e.ct,t.target);var a=t.resumeToken.toBase64();return{targetId:t.targetId,canonicalId:Vm(t.target),readTime:r,resumeToken:a,lastListenSequenceNumber:t.sequenceNumber,lastLimboFreeSnapshotVersion:i,query:n}}function hk(e){var t=Wg({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?Zm(t,t.limit,"L"):t}function dk(e,t){return new rg(t.largestBatchId,Kg(e.ct,t.overlayMutation))}function pk(e,t){var n=t.path.lastSegment();return[e,Hp(t.path.popLast()),n]}function vk(e,t,n,r){return{indexId:e,uid:t.uid||"",sequenceNumber:n,readTime:uk(r.readTime),documentKey:Hp(r.documentKey.path),largestBatchId:r.largestBatchId}}var mk=function(){function e(){y(this,e)}return k(e,[{key:"getBundleMetadata",value:function(e,t){return yk(e).get(t).next((function(e){if(e)return function(e){return{id:e.bundleId,createTime:sk(e.createTime),version:e.version}}(e)}))}},{key:"saveBundleMetadata",value:function(e,t){return yk(e).put(function(e){return{bundleId:e.id,createTime:uk(Pg(e.createTime)),version:e.version}}(t))}},{key:"getNamedQuery",value:function(e,t){return gk(e).get(t).next((function(e){if(e)return function(e){return{name:e.name,query:hk(e.bundledQuery),readTime:sk(e.readTime)}}(e)}))}},{key:"saveNamedQuery",value:function(e,t){return gk(e).put(function(e){return{name:e.name,readTime:uk(Pg(e.readTime)),bundledQuery:e.bundledQuery}}(t))}}]),e}();function yk(e){return wv(e,"bundles")}function gk(e){return wv(e,"namedQueries")}var kk=function(){function e(t,n){y(this,e),this.serializer=t,this.userId=n}return k(e,[{key:"getOverlay",value:function(e,t){var n=this;return wk(e).get(pk(this.userId,t)).next((function(e){return e?dk(n.serializer,e):null}))}},{key:"getOverlays",value:function(e,t){var n=this,r=dy();return Np.forEach(t,(function(t){return n.getOverlay(e,t).next((function(e){null!==e&&r.set(t,e)}))})).next((function(){return r}))}},{key:"saveOverlays",value:function(e,t,n){var r=this,i=[];return n.forEach((function(n,a){var o=new rg(t,a);i.push(r.ht(e,o))})),Np.waitFor(i)}},{key:"removeOverlaysForBatchId",value:function(e,t,n){var r=this,i=new Set;t.forEach((function(e){return i.add(Hp(e.getCollectionPath()))}));var a=[];return i.forEach((function(t){var i=IDBKeyRange.bound([r.userId,t,n],[r.userId,t,n+1],!1,!0);a.push(wk(e).J("collectionPathOverlayIndex",i))})),Np.waitFor(a)}},{key:"getOverlaysForCollection",value:function(e,t,n){var r=this,i=dy(),a=Hp(t),o=IDBKeyRange.bound([this.userId,a,n],[this.userId,a,Number.POSITIVE_INFINITY],!0);return wk(e).G("collectionPathOverlayIndex",o).next((function(e){var t,n=w(e);try{for(n.s();!(t=n.n()).done;){var a=t.value,o=dk(r.serializer,a);i.set(o.getKey(),o)}}catch(u){n.e(u)}finally{n.f()}return i}))}},{key:"getOverlaysForCollectionGroup",value:function(e,t,n,r){var i,a=this,o=dy(),u=IDBKeyRange.bound([this.userId,t,n],[this.userId,t,Number.POSITIVE_INFINITY],!0);return wk(e).Z({index:"collectionGroupOverlayIndex",range:u},(function(e,t,n){var u=dk(a.serializer,t);o.size()<r||u.largestBatchId===i?(o.set(u.getKey(),u),i=u.largestBatchId):n.done()})).next((function(){return o}))}},{key:"ht",value:function(e,t){return wk(e).put(function(e,t,n){var r=m(pk(t,n.mutation.key),3);r[0];return{userId:t,collectionPath:r[1],documentId:r[2],collectionGroup:n.mutation.key.getCollectionGroup(),largestBatchId:n.largestBatchId,overlayMutation:qg(e.ct,n.mutation)}}(this.serializer,this.userId,t))}}],[{key:"lt",value:function(t,n){return new e(t,n.uid||"")}}]),e}();function wk(e){return wv(e,"documentOverlays")}var bk=function(){function e(){y(this,e)}return k(e,[{key:"Pt",value:function(e,t){this.It(e,t),t.Tt()}},{key:"It",value:function(e,t){if("nullValue"in e)this.Et(t,5);else if("booleanValue"in e)this.Et(t,10),t.dt(e.booleanValue?1:0);else if("integerValue"in e)this.Et(t,15),t.dt(Lv(e.integerValue));else if("doubleValue"in e){var n=Lv(e.doubleValue);isNaN(n)?this.Et(t,13):(this.Et(t,15),Kp(n)?t.dt(0):t.dt(n))}else if("timestampValue"in e){var r=e.timestampValue;this.Et(t,20),"string"==typeof r?t.At(r):(t.At("".concat(r.seconds||"")),t.dt(r.nanos||0))}else if("stringValue"in e)this.Rt(e.stringValue,t),this.Vt(t);else if("bytesValue"in e)this.Et(t,30),t.ft(Mv(e.bytesValue)),this.Vt(t);else if("referenceValue"in e)this.gt(e.referenceValue,t);else if("geoPointValue"in e){var i=e.geoPointValue;this.Et(t,45),t.dt(i.latitude||0),t.dt(i.longitude||0)}else"mapValue"in e?im(e)?this.Et(t,Number.MAX_SAFE_INTEGER):(this.yt(e.mapValue,t),this.Vt(t)):"arrayValue"in e?(this.wt(e.arrayValue,t),this.Vt(t)):Gd()}},{key:"Rt",value:function(e,t){this.Et(t,25),this.St(e,t)}},{key:"St",value:function(e,t){t.At(e)}},{key:"yt",value:function(e,t){var n=e.fields||{};this.Et(t,55);for(var r=0,i=Object.keys(n);r<i.length;r++){var a=i[r];this.Rt(a,t),this.It(n[a],t)}}},{key:"wt",value:function(e,t){var n=e.values||[];this.Et(t,50);var r,i=w(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;this.It(a,t)}}catch(o){i.e(o)}finally{i.f()}}},{key:"gt",value:function(e,t){var n=this;this.Et(t,37),mp.fromName(e).path.forEach((function(e){n.Et(t,60),n.St(e,t)}))}},{key:"Et",value:function(e,t){e.dt(t)}},{key:"Vt",value:function(e){e.dt(2)}}]),e}();function _k(e){if(0===e)return 8;var t=0;return e>>4==0&&(t+=4,e<<=4),e>>6==0&&(t+=2,e<<=2),e>>7==0&&(t+=1),t}function xk(e){var t=64-function(e){for(var t=0,n=0;n<8;++n){var r=_k(255&e[n]);if(t+=r,8!==r)break}return t}(e);return Math.ceil(t/8)}bk.bt=new bk;var Tk=function(){function e(){y(this,e),this.buffer=new Uint8Array(1024),this.position=0}return k(e,[{key:"Dt",value:function(e){for(var t=e[Symbol.iterator](),n=t.next();!n.done;)this.Ct(n.value),n=t.next();this.vt()}},{key:"Ft",value:function(e){for(var t=e[Symbol.iterator](),n=t.next();!n.done;)this.Mt(n.value),n=t.next();this.xt()}},{key:"Ot",value:function(e){var t,n=w(e);try{for(n.s();!(t=n.n()).done;){var r=t.value,i=r.charCodeAt(0);if(i<128)this.Ct(i);else if(i<2048)this.Ct(960|i>>>6),this.Ct(128|63&i);else if(r<"\ud800"||"\udbff"<r)this.Ct(480|i>>>12),this.Ct(128|63&i>>>6),this.Ct(128|63&i);else{var a=r.codePointAt(0);this.Ct(240|a>>>18),this.Ct(128|63&a>>>12),this.Ct(128|63&a>>>6),this.Ct(128|63&a)}}}catch(o){n.e(o)}finally{n.f()}this.vt()}},{key:"Nt",value:function(e){var t,n=w(e);try{for(n.s();!(t=n.n()).done;){var r=t.value,i=r.charCodeAt(0);if(i<128)this.Mt(i);else if(i<2048)this.Mt(960|i>>>6),this.Mt(128|63&i);else if(r<"\ud800"||"\udbff"<r)this.Mt(480|i>>>12),this.Mt(128|63&i>>>6),this.Mt(128|63&i);else{var a=r.codePointAt(0);this.Mt(240|a>>>18),this.Mt(128|63&a>>>12),this.Mt(128|63&a>>>6),this.Mt(128|63&a)}}}catch(o){n.e(o)}finally{n.f()}this.xt()}},{key:"Bt",value:function(e){var t=this.Lt(e),n=xk(t);this.kt(1+n),this.buffer[this.position++]=255&n;for(var r=t.length-n;r<t.length;++r)this.buffer[this.position++]=255&t[r]}},{key:"qt",value:function(e){var t=this.Lt(e),n=xk(t);this.kt(1+n),this.buffer[this.position++]=~(255&n);for(var r=t.length-n;r<t.length;++r)this.buffer[this.position++]=~(255&t[r])}},{key:"Qt",value:function(){this.Kt(255),this.Kt(255)}},{key:"$t",value:function(){this.Ut(255),this.Ut(255)}},{key:"reset",value:function(){this.position=0}},{key:"seed",value:function(e){this.kt(e.length),this.buffer.set(e,this.position),this.position+=e.length}},{key:"Wt",value:function(){return this.buffer.slice(0,this.position)}},{key:"Lt",value:function(e){var t=function(e){var t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e,!1),new Uint8Array(t.buffer)}(e),n=0!=(128&t[0]);t[0]^=n?255:128;for(var r=1;r<t.length;++r)t[r]^=n?255:0;return t}},{key:"Ct",value:function(e){var t=255&e;0===t?(this.Kt(0),this.Kt(255)):255===t?(this.Kt(255),this.Kt(0)):this.Kt(t)}},{key:"Mt",value:function(e){var t=255&e;0===t?(this.Ut(0),this.Ut(255)):255===t?(this.Ut(255),this.Ut(0)):this.Ut(e)}},{key:"vt",value:function(){this.Kt(0),this.Kt(1)}},{key:"xt",value:function(){this.Ut(0),this.Ut(1)}},{key:"Kt",value:function(e){this.kt(1),this.buffer[this.position++]=e}},{key:"Ut",value:function(e){this.kt(1),this.buffer[this.position++]=~e}},{key:"kt",value:function(e){var t=e+this.position;if(!(t<=this.buffer.length)){var n=2*this.buffer.length;n<t&&(n=t);var r=new Uint8Array(n);r.set(this.buffer),this.buffer=r}}}]),e}(),Ik=function(){function e(t){y(this,e),this.Gt=t}return k(e,[{key:"ft",value:function(e){this.Gt.Dt(e)}},{key:"At",value:function(e){this.Gt.Ot(e)}},{key:"dt",value:function(e){this.Gt.Bt(e)}},{key:"Tt",value:function(){this.Gt.Qt()}}]),e}(),Ek=function(){function e(t){y(this,e),this.Gt=t}return k(e,[{key:"ft",value:function(e){this.Gt.Ft(e)}},{key:"At",value:function(e){this.Gt.Nt(e)}},{key:"dt",value:function(e){this.Gt.qt(e)}},{key:"Tt",value:function(){this.Gt.$t()}}]),e}(),Sk=function(){function e(){y(this,e),this.Gt=new Tk,this.zt=new Ik(this.Gt),this.jt=new Ek(this.Gt)}return k(e,[{key:"seed",value:function(e){this.Gt.seed(e)}},{key:"Ht",value:function(e){return 0===e?this.zt:this.jt}},{key:"Wt",value:function(){return this.Gt.Wt()}},{key:"reset",value:function(){this.Gt.reset()}}]),e}(),Ck=function(){function e(t,n,r,i){y(this,e),this.indexId=t,this.documentKey=n,this.arrayValue=r,this.directionalValue=i}return k(e,[{key:"Jt",value:function(){var t=this.directionalValue.length,n=0===t||255===this.directionalValue[t-1]?t+1:t,r=new Uint8Array(n);return r.set(this.directionalValue,0),n!==t?r.set([0],this.directionalValue.length):++r[r.length-1],new e(this.indexId,this.documentKey,this.arrayValue,r)}}]),e}();function Ak(e,t){var n=e.indexId-t.indexId;return 0!==n?n:0!==(n=Nk(e.arrayValue,t.arrayValue))?n:0!==(n=Nk(e.directionalValue,t.directionalValue))?n:mp.comparator(e.documentKey,t.documentKey)}function Nk(e,t){for(var n=0;n<e.length&&n<t.length;++n){var r=e[n]-t[n];if(0!==r)return r}return e.length-t.length}var Pk=function(){function e(t){y(this,e),this.Yt=new Sv((function(e,t){return vp.comparator(e.field,t.field)})),this.collectionId=null!=t.collectionGroup?t.collectionGroup:t.path.lastSegment(),this.Zt=t.orderBy,this.Xt=[];var n,r=w(t.filters);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.isInequality()?this.Yt=this.Yt.add(i):this.Xt.push(i)}}catch(a){r.e(a)}finally{r.f()}}return k(e,[{key:"en",get:function(){return this.Yt.size>1}},{key:"tn",value:function(e){if(Hd(e.collectionGroup===this.collectionId),this.en)return!1;var t=gp(e);if(void 0!==t&&!this.nn(t))return!1;for(var n=kp(e),r=new Set,i=0,a=0;i<n.length&&this.nn(n[i]);++i)r=r.add(n[i].fieldPath.canonicalString());if(i===n.length)return!0;if(this.Yt.size>0){var o=this.Yt.getIterator().getNext();if(!r.has(o.field.canonicalString())){var u=n[i];if(!this.rn(o,u)||!this.sn(this.Zt[a++],u))return!1}++i}for(;i<n.length;++i){var s=n[i];if(a>=this.Zt.length||!this.sn(this.Zt[a++],s))return!1}return!0}},{key:"on",value:function(){if(this.en)return null;var e,t=new Sv(vp.comparator),n=[],r=w(this.Xt);try{for(r.s();!(e=r.n()).done;){var i=e.value;if(!i.field.isKeyField())if("array-contains"===i.op||"array-contains-any"===i.op)n.push(new wp(i.field,2));else{if(t.has(i.field))continue;t=t.add(i.field),n.push(new wp(i.field,0))}}}catch(s){r.e(s)}finally{r.f()}var a,o=w(this.Zt);try{for(o.s();!(a=o.n()).done;){var u=a.value;u.field.isKeyField()||t.has(u.field)||(t=t.add(u.field),n.push(new wp(u.field,"asc"===u.dir?0:1)))}}catch(s){o.e(s)}finally{o.f()}return new yp(yp.UNKNOWN_ID,this.collectionId,n,bp.empty())}},{key:"nn",value:function(e){var t,n=w(this.Xt);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(this.rn(r,e))return!0}}catch(i){n.e(i)}finally{n.f()}return!1}},{key:"rn",value:function(e,t){if(void 0===e||!e.field.isEqual(t.fieldPath))return!1;var n="array-contains"===e.op||"array-contains-any"===e.op;return 2===t.kind===n}},{key:"sn",value:function(e,t){return!!e.field.isEqual(t.fieldPath)&&(0===t.kind&&"asc"===e.dir||1===t.kind&&"desc"===e.dir)}}]),e}();function Dk(e){var t,n;if(Hd(e instanceof gm||e instanceof km),e instanceof gm){if(e instanceof Rm){var r=(null===(n=null===(t=e.value.arrayValue)||void 0===t?void 0:t.values)||void 0===n?void 0:n.map((function(t){return gm.create(e.field,"==",t)})))||[];return km.create(r,"or")}return e}var i=e.filters.map((function(e){return Dk(e)}));return km.create(i,e.op)}function Rk(e){if(0===e.getFilters().length)return[];var t=Fk(Dk(e));return Hd(Mk(t)),Ok(t)||Lk(t)?[t]:t.getFilters()}function Ok(e){return e instanceof gm}function Lk(e){return e instanceof km&&_m(e)}function Mk(e){return Ok(e)||Lk(e)||function(e){if(e instanceof km&&bm(e)){var t,n=w(e.getFilters());try{for(n.s();!(t=n.n()).done;){var r=t.value;if(!Ok(r)&&!Lk(r))return!1}}catch(i){n.e(i)}finally{n.f()}return!0}return!1}(e)}function Fk(e){if(Hd(e instanceof gm||e instanceof km),e instanceof gm)return e;if(1===e.filters.length)return Fk(e.filters[0]);var t=e.filters.map((function(e){return Fk(e)})),n=km.create(t,e.op);return Mk(n=jk(n))?n:(Hd(n instanceof km),Hd(wm(n)),Hd(n.filters.length>1),n.filters.reduce((function(e,t){return Vk(e,t)})))}function Vk(e,t){var n;return Hd(e instanceof gm||e instanceof km),Hd(t instanceof gm||t instanceof km),n=e instanceof gm?t instanceof gm?function(e,t){return km.create([e,t],"and")}(e,t):Uk(e,t):t instanceof gm?Uk(t,e):function(e,t){if(Hd(e.filters.length>0&&t.filters.length>0),wm(e)&&wm(t))return Em(e,t.getFilters());var n=bm(e)?e:t,r=bm(e)?t:e,i=n.filters.map((function(e){return Vk(e,r)}));return km.create(i,"or")}(e,t),jk(n)}function Uk(e,t){if(wm(t))return Em(t,e.getFilters());var n=t.filters.map((function(t){return Vk(e,t)}));return km.create(n,"or")}function jk(e){if(Hd(e instanceof gm||e instanceof km),e instanceof gm)return e;var t=e.getFilters();if(1===t.length)return jk(t[0]);if(xm(e))return e;var n=t.map((function(e){return jk(e)})),r=[];return n.forEach((function(t){t instanceof gm?r.push(t):t instanceof km&&(t.op===e.op?r.push.apply(r,oe(t.filters)):r.push(t))})),1===r.length?r[0]:km.create(r,e.op)}var zk=function(){function e(){y(this,e),this._n=new Bk}return k(e,[{key:"addToCollectionParentIndex",value:function(e,t){return this._n.add(t),Np.resolve()}},{key:"getCollectionParents",value:function(e,t){return Np.resolve(this._n.getEntries(t))}},{key:"addFieldIndex",value:function(e,t){return Np.resolve()}},{key:"deleteFieldIndex",value:function(e,t){return Np.resolve()}},{key:"deleteAllFieldIndexes",value:function(e){return Np.resolve()}},{key:"createTargetIndexes",value:function(e,t){return Np.resolve()}},{key:"getDocumentsMatchingTarget",value:function(e,t){return Np.resolve(null)}},{key:"getIndexType",value:function(e,t){return Np.resolve(0)}},{key:"getFieldIndexes",value:function(e,t){return Np.resolve([])}},{key:"getNextCollectionGroupToUpdate",value:function(e){return Np.resolve(null)}},{key:"getMinOffset",value:function(e,t){return Np.resolve(Tp.min())}},{key:"getMinOffsetFromCollectionGroup",value:function(e,t){return Np.resolve(Tp.min())}},{key:"updateCollectionGroup",value:function(e,t,n){return Np.resolve()}},{key:"updateIndexEntries",value:function(e,t){return Np.resolve()}}]),e}(),Bk=function(){function e(){y(this,e),this.index={}}return k(e,[{key:"add",value:function(e){var t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new Sv(dp.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}},{key:"has",value:function(e){var t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}},{key:"getEntries",value:function(e){return(this.index[e]||new Sv(dp.comparator)).toArray()}}]),e}(),qk=new Uint8Array(0),Kk=function(){function e(t,n){y(this,e),this.user=t,this.databaseId=n,this.an=new Bk,this.un=new uy((function(e){return Vm(e)}),(function(e,t){return Um(e,t)})),this.uid=t.uid||""}return k(e,[{key:"addToCollectionParentIndex",value:function(e,t){var n=this;if(!this.an.has(t)){var r=t.lastSegment(),i=t.popLast();e.addOnCommittedListener((function(){n.an.add(t)}));var a={collectionId:r,parent:Hp(i)};return Gk(e).put(a)}return Np.resolve()}},{key:"getCollectionParents",value:function(e,t){var n=[],r=IDBKeyRange.bound([t,""],[cp(t),""],!1,!0);return Gk(e).G(r).next((function(e){var r,i=w(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(a.collectionId!==t)break;n.push(Yp(a.parent))}}catch(o){i.e(o)}finally{i.f()}return n}))}},{key:"addFieldIndex",value:function(e,t){var n=this,r=Wk(e),i=function(e){return{indexId:e.indexId,collectionGroup:e.collectionGroup,fields:e.fields.map((function(e){return[e.fieldPath.canonicalString(),e.kind]}))}}(t);delete i.indexId;var a=r.add(i);if(t.indexState){var o=Qk(e);return a.next((function(e){o.put(vk(e,n.user,t.indexState.sequenceNumber,t.indexState.offset))}))}return a.next()}},{key:"deleteFieldIndex",value:function(e,t){var n=Wk(e),r=Qk(e),i=Hk(e);return n.delete(t.indexId).next((function(){return r.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0))})).next((function(){return i.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0))}))}},{key:"deleteAllFieldIndexes",value:function(e){var t=Wk(e),n=Hk(e),r=Qk(e);return t.J().next((function(){return n.J()})).next((function(){return r.J()}))}},{key:"createTargetIndexes",value:function(e,t){var n=this;return Np.forEach(this.cn(t),(function(t){return n.getIndexType(e,t).next((function(r){if(0===r||1===r){var i=new Pk(t).on();if(null!=i)return n.addFieldIndex(e,i)}}))}))}},{key:"getDocumentsMatchingTarget",value:function(e,t){var n=this,r=Hk(e),i=!0,a=new Map;return Np.forEach(this.cn(t),(function(t){return n.ln(e,t).next((function(e){i&&(i=!!e),a.set(t,e)}))})).next((function(){if(i){var e=gy(),o=[];return Np.forEach(a,(function(i,a){zd("IndexedDbIndexManager","Using index ".concat(function(e){return"id=".concat(e.indexId,"|cg=").concat(e.collectionGroup,"|f=").concat(e.fields.map((function(e){return"".concat(e.fieldPath,":").concat(e.kind)})).join(","))}(i)," to execute ").concat(Vm(t)));var u=function(e,t){var n=gp(t);if(void 0===n)return null;var r,i=w(zm(e,n.fieldPath));try{for(i.s();!(r=i.n()).done;){var a=r.value;switch(a.op){case"array-contains-any":return a.value.arrayValue.values||[];case"array-contains":return[a.value]}}}catch(o){i.e(o)}finally{i.f()}return null}(a,i),s=function(e,t){var n,r=new Map,i=w(kp(t));try{for(i.s();!(n=i.n()).done;){var a,o=n.value,u=w(zm(e,o.fieldPath));try{for(u.s();!(a=u.n()).done;){var s=a.value;switch(s.op){case"==":case"in":r.set(o.fieldPath.canonicalString(),s.value);break;case"not-in":case"!=":return r.set(o.fieldPath.canonicalString(),s.value),Array.from(r.values())}}}catch(c){u.e(c)}finally{u.f()}}}catch(c){i.e(c)}finally{i.f()}return null}(a,i),c=function(e,t){var n,r=[],i=!0,a=w(kp(t));try{for(a.s();!(n=a.n()).done;){var o=n.value,u=0===o.kind?Bm(e,o.fieldPath,e.startAt):qm(e,o.fieldPath,e.startAt);r.push(u.value),i&&(i=u.inclusive)}}catch(s){a.e(s)}finally{a.f()}return new hm(r,i)}(a,i),l=function(e,t){var n,r=[],i=!0,a=w(kp(t));try{for(a.s();!(n=a.n()).done;){var o=n.value,u=0===o.kind?qm(e,o.fieldPath,e.endAt):Bm(e,o.fieldPath,e.endAt);r.push(u.value),i&&(i=u.inclusive)}}catch(s){a.e(s)}finally{a.f()}return new hm(r,i)}(a,i),f=n.hn(i,a,c),h=n.hn(i,a,l),d=n.Pn(i,a,s),p=n.In(i.indexId,u,f,c.inclusive,h,l.inclusive,d);return Np.forEach(p,(function(n){return r.H(n,t.limit).next((function(t){t.forEach((function(t){var n=mp.fromSegments(t.documentKey);e.has(n)||(e=e.add(n),o.push(n))}))}))}))})).next((function(){return o}))}return Np.resolve(null)}))}},{key:"cn",value:function(e){var t=this.un.get(e);return t||(t=0===e.filters.length?[e]:Rk(km.create(e.filters,"and")).map((function(t){return Fm(e.path,e.collectionGroup,e.orderBy,t.getFilters(),e.limit,e.startAt,e.endAt)})),this.un.set(e,t),t)}},{key:"In",value:function(e,t,n,r,i,a,o){for(var u=this,s=(null!=t?t.length:1)*Math.max(n.length,i.length),c=s/(null!=t?t.length:1),l=[],f=function(){var s=t?u.Tn(t[h/c]):qk,f=u.En(e,s,n[h%c],r),d=u.dn(e,s,i[h%c],a),p=o.map((function(t){return u.En(e,s,t,!0)}));l.push.apply(l,oe(u.createRange(f,d,p)))},h=0;h<s;++h)f();return l}},{key:"En",value:function(e,t,n,r){var i=new Ck(e,mp.empty(),t,n);return r?i:i.Jt()}},{key:"dn",value:function(e,t,n,r){var i=new Ck(e,mp.empty(),t,n);return r?i.Jt():i}},{key:"ln",value:function(e,t){var n=new Pk(t),r=null!=t.collectionGroup?t.collectionGroup:t.path.lastSegment();return this.getFieldIndexes(e,r).next((function(e){var t,r=null,i=w(e);try{for(i.s();!(t=i.n()).done;){var a=t.value;n.tn(a)&&(!r||a.fields.length>r.fields.length)&&(r=a)}}catch(o){i.e(o)}finally{i.f()}return r}))}},{key:"getIndexType",value:function(e,t){var n=this,r=2,i=this.cn(t);return Np.forEach(i,(function(t){return n.ln(e,t).next((function(e){e?0!==r&&e.fields.length<function(e){var t,n=new Sv(vp.comparator),r=!1,i=w(e.filters);try{for(i.s();!(t=i.n()).done;){var a,o=w(t.value.getFlattenedFilters());try{for(o.s();!(a=o.n()).done;){var u=a.value;u.field.isKeyField()||("array-contains"===u.op||"array-contains-any"===u.op?r=!0:n=n.add(u.field))}}catch(f){o.e(f)}finally{o.f()}}}catch(f){i.e(f)}finally{i.f()}var s,c=w(e.orderBy);try{for(c.s();!(s=c.n()).done;){var l=s.value;l.field.isKeyField()||(n=n.add(l.field))}}catch(f){c.e(f)}finally{c.f()}return n.size+(r?1:0)}(t)&&(r=1):r=0}))})).next((function(){return function(e){return null!==e.limit}(t)&&i.length>1&&2===r?1:r}))}},{key:"An",value:function(e,t){var n,r=new Sk,i=w(kp(e));try{for(i.s();!(n=i.n()).done;){var a=n.value,o=t.data.field(a.fieldPath);if(null==o)return null;var u=r.Ht(a.kind);bk.bt.Pt(o,u)}}catch(s){i.e(s)}finally{i.f()}return r.Wt()}},{key:"Tn",value:function(e){var t=new Sk;return bk.bt.Pt(e,t.Ht(0)),t.Wt()}},{key:"Rn",value:function(e,t){var n=new Sk;return bk.bt.Pt(Xv(this.databaseId,t),n.Ht(function(e){var t=kp(e);return 0===t.length?0:t[t.length-1].kind}(e))),n.Wt()}},{key:"Pn",value:function(e,t,n){if(null===n)return[];var r=[];r.push(new Sk);var i,a=0,o=w(kp(e));try{for(o.s();!(i=o.n()).done;){var u,s=i.value,c=n[a++],l=w(r);try{for(l.s();!(u=l.n()).done;){var f=u.value;if(this.Vn(t,s.fieldPath)&&Zv(c))r=this.mn(r,s,c);else{var h=f.Ht(s.kind);bk.bt.Pt(c,h)}}}catch(d){l.e(d)}finally{l.f()}}}catch(d){o.e(d)}finally{o.f()}return this.fn(r)}},{key:"hn",value:function(e,t,n){return this.Pn(e,t,n.position)}},{key:"fn",value:function(e){for(var t=[],n=0;n<e.length;++n)t[n]=e[n].Wt();return t}},{key:"mn",value:function(e,t,n){var r,i=oe(e),a=[],o=w(n.arrayValue.values||[]);try{for(o.s();!(r=o.n()).done;){var u,s=r.value,c=w(i);try{for(c.s();!(u=c.n()).done;){var l=u.value,f=new Sk;f.seed(l.Wt()),bk.bt.Pt(s,f.Ht(t.kind)),a.push(f)}}catch(h){c.e(h)}finally{c.f()}}}catch(h){o.e(h)}finally{o.f()}return a}},{key:"Vn",value:function(e,t){return!!e.filters.find((function(e){return e instanceof gm&&e.field.isEqual(t)&&("in"===e.op||"not-in"===e.op)}))}},{key:"getFieldIndexes",value:function(e,t){var n=this,r=Wk(e),i=Qk(e);return(t?r.G("collectionGroupIndex",IDBKeyRange.bound(t,t)):r.G()).next((function(e){var t=[];return Np.forEach(e,(function(e){return i.get([e.indexId,n.uid]).next((function(n){t.push(function(e,t){var n=t?new bp(t.sequenceNumber,new Tp(sk(t.readTime),new mp(Yp(t.documentKey)),t.largestBatchId)):bp.empty(),r=e.fields.map((function(e){var t=m(e,2),n=t[0],r=t[1];return new wp(vp.fromServerFormat(n),r)}));return new yp(e.indexId,e.collectionGroup,r,n)}(e,n))}))})).next((function(){return t}))}))}},{key:"getNextCollectionGroupToUpdate",value:function(e){return this.getFieldIndexes(e).next((function(e){return 0===e.length?null:(e.sort((function(e,t){var n=e.indexState.sequenceNumber-t.indexState.sequenceNumber;return 0!==n?n:up(e.collectionGroup,t.collectionGroup)})),e[0].collectionGroup)}))}},{key:"updateCollectionGroup",value:function(e,t,n){var r=this,i=Wk(e),a=Qk(e);return this.gn(e).next((function(e){return i.G("collectionGroupIndex",IDBKeyRange.bound(t,t)).next((function(t){return Np.forEach(t,(function(t){return a.put(vk(t.indexId,r.user,e,n))}))}))}))}},{key:"updateIndexEntries",value:function(e,t){var n=this,r=new Map;return Np.forEach(t,(function(t,i){var a=r.get(t.collectionGroup);return(a?Np.resolve(a):n.getFieldIndexes(e,t.collectionGroup)).next((function(a){return r.set(t.collectionGroup,a),Np.forEach(a,(function(r){return n.pn(e,t,r).next((function(t){var a=n.yn(i,r);return t.isEqual(a)?Np.resolve():n.wn(e,i,r,t,a)}))}))}))}))}},{key:"Sn",value:function(e,t,n,r){return Hk(e).put({indexId:r.indexId,uid:this.uid,arrayValue:r.arrayValue,directionalValue:r.directionalValue,orderedDocumentKey:this.Rn(n,t.key),documentKey:t.key.path.toArray()})}},{key:"bn",value:function(e,t,n,r){return Hk(e).delete([r.indexId,this.uid,r.arrayValue,r.directionalValue,this.Rn(n,t.key),t.key.path.toArray()])}},{key:"pn",value:function(e,t,n){var r=Hk(e),i=new Sv(Ak);return r.Z({index:"documentKeyIndex",range:IDBKeyRange.only([n.indexId,this.uid,this.Rn(n,t)])},(function(e,r){i=i.add(new Ck(n.indexId,t,r.arrayValue,r.directionalValue))})).next((function(){return i}))}},{key:"yn",value:function(e,t){var n=new Sv(Ak),r=this.An(t,e);if(null==r)return n;var i=gp(t);if(null!=i){var a=e.data.field(i.fieldPath);if(Zv(a)){var o,u=w(a.arrayValue.values||[]);try{for(u.s();!(o=u.n()).done;){var s=o.value;n=n.add(new Ck(t.indexId,e.key,this.Tn(s),r))}}catch(c){u.e(c)}finally{u.f()}}}else n=n.add(new Ck(t.indexId,e.key,qk,r));return n}},{key:"wn",value:function(e,t,n,r,i){var a=this;zd("IndexedDbIndexManager","Updating index entries for document '%s'",t.key);var o=[];return function(e,t,n,r,i){for(var a=e.getIterator(),o=t.getIterator(),u=Av(a),s=Av(o);u||s;){var c=!1,l=!1;if(u&&s){var f=n(u,s);f<0?l=!0:f>0&&(c=!0)}else null!=u?l=!0:c=!0;c?(r(s),s=Av(o)):l?(i(u),u=Av(a)):(u=Av(a),s=Av(o))}}(r,i,Ak,(function(r){o.push(a.Sn(e,t,n,r))}),(function(r){o.push(a.bn(e,t,n,r))})),Np.waitFor(o)}},{key:"gn",value:function(e){var t=1;return Qk(e).Z({index:"sequenceNumberIndex",reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},(function(e,n,r){r.done(),t=n.sequenceNumber+1})).next((function(){return t}))}},{key:"createRange",value:function(e,t,n){n=n.sort((function(e,t){return Ak(e,t)})).filter((function(e,t,n){return!t||0!==Ak(e,n[t-1])}));var r=[];r.push(e);var i,a=w(n);try{for(a.s();!(i=a.n()).done;){var o=i.value,u=Ak(o,e),s=Ak(o,t);if(0===u)r[0]=e.Jt();else if(u>0&&s<0)r.push(o),r.push(o.Jt());else if(s>0)break}}catch(d){a.e(d)}finally{a.f()}r.push(t);for(var c=[],l=0;l<r.length;l+=2){if(this.Dn(r[l],r[l+1]))return[];var f=[r[l].indexId,this.uid,r[l].arrayValue,r[l].directionalValue,qk,[]],h=[r[l+1].indexId,this.uid,r[l+1].arrayValue,r[l+1].directionalValue,qk,[]];c.push(IDBKeyRange.bound(f,h))}return c}},{key:"Dn",value:function(e,t){return Ak(e,t)>0}},{key:"getMinOffsetFromCollectionGroup",value:function(e,t){return this.getFieldIndexes(e,t).next(Yk)}},{key:"getMinOffset",value:function(e,t){var n=this;return Np.mapArray(this.cn(t),(function(t){return n.ln(e,t).next((function(e){return e||Gd()}))})).next(Yk)}}]),e}();function Gk(e){return wv(e,"collectionParents")}function Hk(e){return wv(e,"indexEntries")}function Wk(e){return wv(e,"indexConfiguration")}function Qk(e){return wv(e,"indexState")}function Yk(e){Hd(0!==e.length);for(var t=e[0].indexState.offset,n=t.largestBatchId,r=1;r<e.length;r++){var i=e[r].indexState.offset;Ip(i,t)<0&&(t=i),n<i.largestBatchId&&(n=i.largestBatchId)}return new Tp(t.readTime,t.documentKey,n)}var Jk={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Xk=function(){function e(t,n,r){y(this,e),this.cacheSizeCollectionThreshold=t,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}return k(e,null,[{key:"withCacheSize",value:function(t){return new e(t,e.DEFAULT_COLLECTION_PERCENTILE,e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}}]),e}();function $k(e,t,n){var r=e.store("mutations"),i=e.store("documentMutations"),a=[],o=IDBKeyRange.only(n.batchId),u=0,s=r.Z({range:o},(function(e,t,n){return u++,n.delete()}));a.push(s.next((function(){Hd(1===u)})));var c,l=[],f=w(n.mutations);try{for(f.s();!(c=f.n()).done;){var h=c.value,d=$p(t,h.key.path,n.batchId);a.push(i.delete(d)),l.push(h.key)}}catch(p){f.e(p)}finally{f.f()}return Np.waitFor(a).next((function(){return l}))}function Zk(e){if(!e)return 0;var t;if(e.document)t=e.document;else if(e.unknownDocument)t=e.unknownDocument;else{if(!e.noDocument)throw Gd();t=e.noDocument}return JSON.stringify(t).length}Xk.DEFAULT_COLLECTION_PERCENTILE=10,Xk.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Xk.DEFAULT=new Xk(41943040,Xk.DEFAULT_COLLECTION_PERCENTILE,Xk.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Xk.DISABLED=new Xk(-1,0,0);var ew=function(){function e(t,n,r,i){y(this,e),this.userId=t,this.serializer=n,this.indexManager=r,this.referenceDelegate=i,this.Cn={}}return k(e,[{key:"checkEmpty",value:function(e){var t=!0,n=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return nw(e).Z({index:"userMutationsIndex",range:n},(function(e,n,r){t=!1,r.done()})).next((function(){return t}))}},{key:"addMutationBatch",value:function(e,t,n,r){var i=this,a=rw(e),o=nw(e);return o.add({}).next((function(u){Hd("number"==typeof u);var s,c=new tg(u,t,n,r),l=function(e,t,n){var r=n.baseMutations.map((function(t){return qg(e.ct,t)})),i=n.mutations.map((function(t){return qg(e.ct,t)}));return{userId:t,batchId:n.batchId,localWriteTimeMs:n.localWriteTime.toMillis(),baseMutations:r,mutations:i}}(i.serializer,i.userId,c),f=[],h=new Sv((function(e,t){return up(e.canonicalString(),t.canonicalString())})),d=w(r);try{for(d.s();!(s=d.n()).done;){var p=s.value,v=$p(i.userId,p.key.path,u);h=h.add(p.key.path.popLast()),f.push(o.put(l)),f.push(a.put(v,Zp))}}catch(m){d.e(m)}finally{d.f()}return h.forEach((function(t){f.push(i.indexManager.addToCollectionParentIndex(e,t))})),e.addOnCommittedListener((function(){i.Cn[u]=c.keys()})),Np.waitFor(f).next((function(){return c}))}))}},{key:"lookupMutationBatch",value:function(e,t){var n=this;return nw(e).get(t).next((function(e){return e?(Hd(e.userId===n.userId),ck(n.serializer,e)):null}))}},{key:"vn",value:function(e,t){var n=this;return this.Cn[t]?Np.resolve(this.Cn[t]):this.lookupMutationBatch(e,t).next((function(e){if(e){var r=e.keys();return n.Cn[t]=r,r}return null}))}},{key:"getNextMutationBatchAfterBatchId",value:function(e,t){var n=this,r=t+1,i=IDBKeyRange.lowerBound([this.userId,r]),a=null;return nw(e).Z({index:"userMutationsIndex",range:i},(function(e,t,i){t.userId===n.userId&&(Hd(t.batchId>=r),a=ck(n.serializer,t)),i.done()})).next((function(){return a}))}},{key:"getHighestUnacknowledgedBatchId",value:function(e){var t=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),n=-1;return nw(e).Z({index:"userMutationsIndex",range:t,reverse:!0},(function(e,t,r){n=t.batchId,r.done()})).next((function(){return n}))}},{key:"getAllMutationBatches",value:function(e){var t=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return nw(e).G("userMutationsIndex",n).next((function(e){return e.map((function(e){return ck(t.serializer,e)}))}))}},{key:"getAllMutationBatchesAffectingDocumentKey",value:function(e,t){var n=this,r=Xp(this.userId,t.path),i=IDBKeyRange.lowerBound(r),a=[];return rw(e).Z({range:i},(function(r,i,o){var u=m(r,3),s=u[0],c=u[1],l=u[2],f=Yp(c);if(s===n.userId&&t.path.isEqual(f))return nw(e).get(l).next((function(e){if(!e)throw Gd();Hd(e.userId===n.userId),a.push(ck(n.serializer,e))}));o.done()})).next((function(){return a}))}},{key:"getAllMutationBatchesAffectingDocumentKeys",value:function(e,t){var n=this,r=new Sv(up),i=[];return t.forEach((function(t){var a=Xp(n.userId,t.path),o=IDBKeyRange.lowerBound(a),u=rw(e).Z({range:o},(function(e,i,a){var o=m(e,3),u=o[0],s=o[1],c=o[2],l=Yp(s);u===n.userId&&t.path.isEqual(l)?r=r.add(c):a.done()}));i.push(u)})),Np.waitFor(i).next((function(){return n.Fn(e,r)}))}},{key:"getAllMutationBatchesAffectingQuery",value:function(e,t){var n=this,r=t.path,i=r.length+1,a=Xp(this.userId,r),o=IDBKeyRange.lowerBound(a),u=new Sv(up);return rw(e).Z({range:o},(function(e,t,a){var o=m(e,3),s=o[0],c=o[1],l=o[2],f=Yp(c);s===n.userId&&r.isPrefixOf(f)?f.length===i&&(u=u.add(l)):a.done()})).next((function(){return n.Fn(e,u)}))}},{key:"Fn",value:function(e,t){var n=this,r=[],i=[];return t.forEach((function(t){i.push(nw(e).get(t).next((function(e){if(null===e)throw Gd();Hd(e.userId===n.userId),r.push(ck(n.serializer,e))})))})),Np.waitFor(i).next((function(){return r}))}},{key:"removeMutationBatch",value:function(e,t){var n=this;return $k(e.ue,this.userId,t).next((function(r){return e.addOnCommittedListener((function(){n.Mn(t.batchId)})),Np.forEach(r,(function(t){return n.referenceDelegate.markPotentiallyOrphaned(e,t)}))}))}},{key:"Mn",value:function(e){delete this.Cn[e]}},{key:"performConsistencyCheck",value:function(e){var t=this;return this.checkEmpty(e).next((function(n){if(!n)return Np.resolve();var r=IDBKeyRange.lowerBound(function(e){return[e]}(t.userId)),i=[];return rw(e).Z({range:r},(function(e,n,r){if(e[0]===t.userId){var a=Yp(e[1]);i.push(a)}else r.done()})).next((function(){Hd(0===i.length)}))}))}},{key:"containsKey",value:function(e,t){return tw(e,this.userId,t)}},{key:"xn",value:function(e){var t=this;return iw(e).get(this.userId).next((function(e){return e||{userId:t.userId,lastAcknowledgedBatchId:-1,lastStreamToken:""}}))}}],[{key:"lt",value:function(t,n,r,i){return Hd(""!==t.uid),new e(t.isAuthenticated()?t.uid:"",n,r,i)}}]),e}();function tw(e,t,n){var r=Xp(t,n.path),i=r[1],a=IDBKeyRange.lowerBound(r),o=!1;return rw(e).Z({range:a,Y:!0},(function(e,n,r){var a=m(e,3),u=a[0],s=a[1];a[2];u===t&&s===i&&(o=!0),r.done()})).next((function(){return o}))}function nw(e){return wv(e,"mutations")}function rw(e){return wv(e,"documentMutations")}function iw(e){return wv(e,"mutationQueues")}var aw=function(){function e(t){y(this,e),this.On=t}return k(e,[{key:"next",value:function(){return this.On+=2,this.On}}],[{key:"Nn",value:function(){return new e(0)}},{key:"Bn",value:function(){return new e(-1)}}]),e}(),ow=function(){function e(t,n){y(this,e),this.referenceDelegate=t,this.serializer=n}return k(e,[{key:"allocateTargetId",value:function(e){var t=this;return this.Ln(e).next((function(n){var r=new aw(n.highestTargetId);return n.highestTargetId=r.next(),t.kn(e,n).next((function(){return n.highestTargetId}))}))}},{key:"getLastRemoteSnapshotVersion",value:function(e){return this.Ln(e).next((function(e){return fp.fromTimestamp(new lp(e.lastRemoteSnapshotVersion.seconds,e.lastRemoteSnapshotVersion.nanoseconds))}))}},{key:"getHighestSequenceNumber",value:function(e){return this.Ln(e).next((function(e){return e.highestListenSequenceNumber}))}},{key:"setTargetsMetadata",value:function(e,t,n){var r=this;return this.Ln(e).next((function(i){return i.highestListenSequenceNumber=t,n&&(i.lastRemoteSnapshotVersion=n.toTimestamp()),t>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=t),r.kn(e,i)}))}},{key:"addTargetData",value:function(e,t){var n=this;return this.qn(e,t).next((function(){return n.Ln(e).next((function(r){return r.targetCount+=1,n.Qn(t,r),n.kn(e,r)}))}))}},{key:"updateTargetData",value:function(e,t){return this.qn(e,t)}},{key:"removeTargetData",value:function(e,t){var n=this;return this.removeMatchingKeysForTargetId(e,t.targetId).next((function(){return uw(e).delete(t.targetId)})).next((function(){return n.Ln(e)})).next((function(t){return Hd(t.targetCount>0),t.targetCount-=1,n.kn(e,t)}))}},{key:"removeTargets",value:function(e,t,n){var r=this,i=0,a=[];return uw(e).Z((function(o,u){var s=lk(u);s.sequenceNumber<=t&&null===n.get(s.targetId)&&(i++,a.push(r.removeTargetData(e,s)))})).next((function(){return Np.waitFor(a)})).next((function(){return i}))}},{key:"forEachTarget",value:function(e,t){return uw(e).Z((function(e,n){var r=lk(n);t(r)}))}},{key:"Ln",value:function(e){return sw(e).get("targetGlobalKey").next((function(e){return Hd(null!==e),e}))}},{key:"kn",value:function(e,t){return sw(e).put("targetGlobalKey",t)}},{key:"qn",value:function(e,t){return uw(e).put(fk(this.serializer,t))}},{key:"Qn",value:function(e,t){var n=!1;return e.targetId>t.highestTargetId&&(t.highestTargetId=e.targetId,n=!0),e.sequenceNumber>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=e.sequenceNumber,n=!0),n}},{key:"getTargetCount",value:function(e){return this.Ln(e).next((function(e){return e.targetCount}))}},{key:"getTargetData",value:function(e,t){var n=Vm(t),r=IDBKeyRange.bound([n,Number.NEGATIVE_INFINITY],[n,Number.POSITIVE_INFINITY]),i=null;return uw(e).Z({range:r,index:"queryTargetsIndex"},(function(e,n,r){var a=lk(n);Um(t,a.target)&&(i=a,r.done())})).next((function(){return i}))}},{key:"addMatchingKeys",value:function(e,t,n){var r=this,i=[],a=cw(e);return t.forEach((function(t){var o=Hp(t.path);i.push(a.put({targetId:n,path:o})),i.push(r.referenceDelegate.addReference(e,n,t))})),Np.waitFor(i)}},{key:"removeMatchingKeys",value:function(e,t,n){var r=this,i=cw(e);return Np.forEach(t,(function(t){var a=Hp(t.path);return Np.waitFor([i.delete([n,a]),r.referenceDelegate.removeReference(e,n,t)])}))}},{key:"removeMatchingKeysForTargetId",value:function(e,t){var n=cw(e),r=IDBKeyRange.bound([t],[t+1],!1,!0);return n.delete(r)}},{key:"getMatchingKeysForTargetId",value:function(e,t){var n=IDBKeyRange.bound([t],[t+1],!1,!0),r=cw(e),i=gy();return r.Z({range:n,Y:!0},(function(e,t,n){var r=Yp(e[1]),a=new mp(r);i=i.add(a)})).next((function(){return i}))}},{key:"containsKey",value:function(e,t){var n=Hp(t.path),r=IDBKeyRange.bound([n],[cp(n)],!1,!0),i=0;return cw(e).Z({index:"documentTargetsIndex",Y:!0,range:r},(function(e,t,n){var r=m(e,2),a=r[0];r[1];0!==a&&(i++,n.done())})).next((function(){return i>0}))}},{key:"ut",value:function(e,t){return uw(e).get(t).next((function(e){return e?lk(e):null}))}}]),e}();function uw(e){return wv(e,"targets")}function sw(e){return wv(e,"targetGlobal")}function cw(e){return wv(e,"targetDocuments")}function lw(e,t){var n=m(e,2),r=n[0],i=n[1],a=m(t,2),o=a[0],u=a[1],s=up(r,o);return 0===s?up(i,u):s}var fw=function(){function e(t){y(this,e),this.Kn=t,this.buffer=new Sv(lw),this.$n=0}return k(e,[{key:"Un",value:function(){return++this.$n}},{key:"Wn",value:function(e){var t=[e,this.Un()];if(this.buffer.size<this.Kn)this.buffer=this.buffer.add(t);else{var n=this.buffer.last();lw(t,n)<0&&(this.buffer=this.buffer.delete(n).add(t))}}},{key:"maxValue",get:function(){return this.buffer.last()[0]}}]),e}(),hw=function(){function e(t,n,r){y(this,e),this.garbageCollector=t,this.asyncQueue=n,this.localStore=r,this.Gn=null}return k(e,[{key:"start",value:function(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.zn(6e4)}},{key:"stop",value:function(){this.Gn&&(this.Gn.cancel(),this.Gn=null)}},{key:"started",get:function(){return null!==this.Gn}},{key:"zn",value:function(e){var t=this;zd("LruGarbageCollector","Garbage collection scheduled in ".concat(e,"ms")),this.Gn=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.Gn=null,e.prev=1,e.next=4,t.localStore.collectGarbage(t.garbageCollector);case 4:e.next=14;break;case 6:if(e.prev=6,e.t0=e.catch(1),!Lp(e.t0)){e.next=12;break}zd("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",e.t0),e.next=14;break;case 12:return e.next=14,Cp(e.t0);case 14:return e.next=16,t.zn(3e5);case 16:case"end":return e.stop()}}),e,null,[[1,6]])}))))}}]),e}(),dw=function(){function e(t,n){y(this,e),this.jn=t,this.params=n}return k(e,[{key:"calculateTargetCount",value:function(e,t){return this.jn.Hn(e).next((function(e){return Math.floor(t/100*e)}))}},{key:"nthSequenceNumber",value:function(e,t){var n=this;if(0===t)return Np.resolve(Bp.ae);var r=new fw(t);return this.jn.forEachTarget(e,(function(e){return r.Wn(e.sequenceNumber)})).next((function(){return n.jn.Jn(e,(function(e){return r.Wn(e)}))})).next((function(){return r.maxValue}))}},{key:"removeTargets",value:function(e,t,n){return this.jn.removeTargets(e,t,n)}},{key:"removeOrphanedDocuments",value:function(e,t){return this.jn.removeOrphanedDocuments(e,t)}},{key:"collect",value:function(e,t){var n=this;return-1===this.params.cacheSizeCollectionThreshold?(zd("LruGarbageCollector","Garbage collection skipped; disabled"),Np.resolve(Jk)):this.getCacheSize(e).next((function(r){return r<n.params.cacheSizeCollectionThreshold?(zd("LruGarbageCollector","Garbage collection skipped; Cache size ".concat(r," is lower than threshold ").concat(n.params.cacheSizeCollectionThreshold)),Jk):n.Yn(e,t)}))}},{key:"getCacheSize",value:function(e){return this.jn.getCacheSize(e)}},{key:"Yn",value:function(e,t){var n,r,i,a,o,u,s,c=this,l=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((function(t){return t>c.params.maximumSequenceNumbersToCollect?(zd("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of ".concat(c.params.maximumSequenceNumbersToCollect," from ").concat(t)),r=c.params.maximumSequenceNumbersToCollect):r=t,a=Date.now(),c.nthSequenceNumber(e,r)})).next((function(r){return n=r,o=Date.now(),c.removeTargets(e,n,t)})).next((function(t){return i=t,u=Date.now(),c.removeOrphanedDocuments(e,n)})).next((function(e){return s=Date.now(),jd()<=fe.DEBUG&&zd("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in ".concat(a-l,"ms\n\tDetermined least recently used ").concat(r," in ")+(o-a)+"ms\n"+"\tRemoved ".concat(i," targets in ")+(u-o)+"ms\n"+"\tRemoved ".concat(e," documents in ")+(s-u)+"ms\n"+"Total Duration: ".concat(s-l,"ms")),Np.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:i,documentsRemoved:e})}))}}]),e}();function pw(e,t){return new dw(e,t)}var vw=function(){function e(t,n){y(this,e),this.db=t,this.garbageCollector=pw(this,n)}return k(e,[{key:"Hn",value:function(e){var t=this.Zn(e);return this.db.getTargetCache().getTargetCount(e).next((function(e){return t.next((function(t){return e+t}))}))}},{key:"Zn",value:function(e){var t=0;return this.Jn(e,(function(e){t++})).next((function(){return t}))}},{key:"forEachTarget",value:function(e,t){return this.db.getTargetCache().forEachTarget(e,t)}},{key:"Jn",value:function(e,t){return this.Xn(e,(function(e,n){return t(n)}))}},{key:"addReference",value:function(e,t,n){return mw(e,n)}},{key:"removeReference",value:function(e,t,n){return mw(e,n)}},{key:"removeTargets",value:function(e,t,n){return this.db.getTargetCache().removeTargets(e,t,n)}},{key:"markPotentiallyOrphaned",value:function(e,t){return mw(e,t)}},{key:"er",value:function(e,t){return function(e,t){var n=!1;return iw(e).X((function(r){return tw(e,r,t).next((function(e){return e&&(n=!0),Np.resolve(!e)}))})).next((function(){return n}))}(e,t)}},{key:"removeOrphanedDocuments",value:function(e,t){var n=this,r=this.db.getRemoteDocumentCache().newChangeBuffer(),i=[],a=0;return this.Xn(e,(function(o,u){if(u<=t){var s=n.er(e,o).next((function(t){if(!t)return a++,r.getEntry(e,o).next((function(){return r.removeEntry(o,fp.min()),cw(e).delete(function(e){return[0,Hp(e.path)]}(o))}))}));i.push(s)}})).next((function(){return Np.waitFor(i)})).next((function(){return r.apply(e)})).next((function(){return a}))}},{key:"removeTarget",value:function(e,t){var n=t.withSequenceNumber(e.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(e,n)}},{key:"updateLimboDocument",value:function(e,t){return mw(e,t)}},{key:"Xn",value:function(e,t){var n,r=cw(e),i=Bp.ae;return r.Z({index:"documentTargetsIndex"},(function(e,r){var a=m(e,2),o=a[0],u=(a[1],r.path),s=r.sequenceNumber;0===o?(i!==Bp.ae&&t(new mp(Yp(n)),i),i=s,n=u):i=Bp.ae})).next((function(){i!==Bp.ae&&t(new mp(Yp(n)),i)}))}},{key:"getCacheSize",value:function(e){return this.db.getRemoteDocumentCache().getSize(e)}}]),e}();function mw(e,t){return cw(e).put(function(e,t){return{targetId:0,path:Hp(e.path),sequenceNumber:t}}(t,e.currentSequenceNumber))}var yw=function(){function e(){y(this,e),this.changes=new uy((function(e){return e.toString()}),(function(e,t){return e.isEqual(t)})),this.changesApplied=!1}return k(e,[{key:"addEntry",value:function(e){this.assertNotApplied(),this.changes.set(e.key,e)}},{key:"removeEntry",value:function(e,t){this.assertNotApplied(),this.changes.set(e,fm.newInvalidDocument(e).setReadTime(t))}},{key:"getEntry",value:function(e,t){this.assertNotApplied();var n=this.changes.get(t);return void 0!==n?Np.resolve(n):this.getFromCache(e,t)}},{key:"getEntries",value:function(e,t){return this.getAllFromCache(e,t)}},{key:"apply",value:function(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}},{key:"assertNotApplied",value:function(){}}]),e}(),gw=function(){function e(t){y(this,e),this.serializer=t}return k(e,[{key:"setIndexManager",value:function(e){this.indexManager=e}},{key:"addEntry",value:function(e,t,n){return _w(e).put(n)}},{key:"removeEntry",value:function(e,t,n){return _w(e).delete(function(e,t){var n=e.path.toArray();return[n.slice(0,n.length-2),n[n.length-2],ok(t),n[n.length-1]]}(t,n))}},{key:"updateMetadata",value:function(e,t){var n=this;return this.getMetadata(e).next((function(r){return r.byteSize+=t,n.tr(e,r)}))}},{key:"getEntry",value:function(e,t){var n=this,r=fm.newInvalidDocument(t);return _w(e).Z({index:"documentKeyIndex",range:IDBKeyRange.only(xw(t))},(function(e,i){r=n.nr(t,i)})).next((function(){return r}))}},{key:"rr",value:function(e,t){var n=this,r={size:0,document:fm.newInvalidDocument(t)};return _w(e).Z({index:"documentKeyIndex",range:IDBKeyRange.only(xw(t))},(function(e,i){r={document:n.nr(t,i),size:Zk(i)}})).next((function(){return r}))}},{key:"getEntries",value:function(e,t){var n=this,r=cy();return this.ir(e,t,(function(e,t){var i=n.nr(e,t);r=r.insert(e,i)})).next((function(){return r}))}},{key:"sr",value:function(e,t){var n=this,r=cy(),i=new Tv(mp.comparator);return this.ir(e,t,(function(e,t){var a=n.nr(e,t);r=r.insert(e,a),i=i.insert(e,Zk(t))})).next((function(){return{documents:r,_r:i}}))}},{key:"ir",value:function(e,t,n){if(t.isEmpty())return Np.resolve();var r=new Sv(Iw);t.forEach((function(e){return r=r.add(e)}));var i=IDBKeyRange.bound(xw(r.first()),xw(r.last())),a=r.getIterator(),o=a.getNext();return _w(e).Z({index:"documentKeyIndex",range:i},(function(e,t,r){for(var i=mp.fromSegments([].concat(oe(t.prefixPath),[t.collectionGroup,t.documentId]));o&&Iw(o,i)<0;)n(o,null),o=a.getNext();o&&o.isEqual(i)&&(n(o,t),o=a.hasNext()?a.getNext():null),o?r.W(xw(o)):r.done()})).next((function(){for(;o;)n(o,null),o=a.hasNext()?a.getNext():null}))}},{key:"getDocumentsMatchingQuery",value:function(e,t,n,r,i){var a=this,o=t.path,u=[o.popLast().toArray(),o.lastSegment(),ok(n.readTime),n.documentKey.path.isEmpty()?"":n.documentKey.path.lastSegment()],s=[o.popLast().toArray(),o.lastSegment(),[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],""];return _w(e).G(IDBKeyRange.bound(u,s,!0)).next((function(e){null==i||i.incrementDocumentReadCount(e.length);var n,o=cy(),u=w(e);try{for(u.s();!(n=u.n()).done;){var s=n.value,c=a.nr(mp.fromSegments(s.prefixPath.concat(s.collectionGroup,s.documentId)),s);c.isFoundDocument()&&(ry(t,c)||r.has(c.key))&&(o=o.insert(c.key,c))}}catch(l){u.e(l)}finally{u.f()}return o}))}},{key:"getAllFromCollectionGroup",value:function(e,t,n,r){var i=this,a=cy(),o=Tw(t,n),u=Tw(t,Tp.max());return _w(e).Z({index:"collectionGroupIndex",range:IDBKeyRange.bound(o,u,!0)},(function(e,t,n){var o=i.nr(mp.fromSegments(t.prefixPath.concat(t.collectionGroup,t.documentId)),t);(a=a.insert(o.key,o)).size===r&&n.done()})).next((function(){return a}))}},{key:"newChangeBuffer",value:function(e){return new ww(this,!!e&&e.trackRemovals)}},{key:"getSize",value:function(e){return this.getMetadata(e).next((function(e){return e.byteSize}))}},{key:"getMetadata",value:function(e){return bw(e).get("remoteDocumentGlobalKey").next((function(e){return Hd(!!e),e}))}},{key:"tr",value:function(e,t){return bw(e).put("remoteDocumentGlobalKey",t)}},{key:"nr",value:function(e,t){if(t){var n=function(e,t){var n;if(t.document)n=zg(e.ct,t.document,!!t.hasCommittedMutations);else if(t.noDocument){var r=mp.fromSegments(t.noDocument.path),i=sk(t.noDocument.readTime);n=fm.newNoDocument(r,i),t.hasCommittedMutations&&n.setHasCommittedMutations()}else{if(!t.unknownDocument)return Gd();var a=mp.fromSegments(t.unknownDocument.path),o=sk(t.unknownDocument.version);n=fm.newUnknownDocument(a,o)}return t.readTime&&n.setReadTime(function(e){var t=new lp(e[0],e[1]);return fp.fromTimestamp(t)}(t.readTime)),n}(this.serializer,t);if(!n.isNoDocument()||!n.version.isEqual(fp.min()))return n}return fm.newInvalidDocument(e)}}]),e}();function kw(e){return new gw(e)}var ww=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this)).ar=e,i.trackRemovals=r,i.ur=new uy((function(e){return e.toString()}),(function(e,t){return e.isEqual(t)})),i}return k(n,[{key:"applyChanges",value:function(e){var t=this,n=[],r=0,i=new Sv((function(e,t){return up(e.canonicalString(),t.canonicalString())}));return this.changes.forEach((function(a,o){var u=t.ur.get(a);if(n.push(t.ar.removeEntry(e,a,u.readTime)),o.isValidDocument()){var s=ak(t.ar.serializer,o);i=i.add(a.path.popLast());var c=Zk(s);r+=c-u.size,n.push(t.ar.addEntry(e,a,s))}else if(r-=u.size,t.trackRemovals){var l=ak(t.ar.serializer,o.convertToNoDocument(fp.min()));n.push(t.ar.addEntry(e,a,l))}})),i.forEach((function(r){n.push(t.ar.indexManager.addToCollectionParentIndex(e,r))})),n.push(this.ar.updateMetadata(e,r)),Np.waitFor(n)}},{key:"getFromCache",value:function(e,t){var n=this;return this.ar.rr(e,t).next((function(e){return n.ur.set(t,{size:e.size,readTime:e.document.readTime}),e.document}))}},{key:"getAllFromCache",value:function(e,t){var n=this;return this.ar.sr(e,t).next((function(e){var t=e.documents;return e._r.forEach((function(e,r){n.ur.set(e,{size:r,readTime:t.get(e).readTime})})),t}))}}]),n}(yw);function bw(e){return wv(e,"remoteDocumentGlobal")}function _w(e){return wv(e,"remoteDocumentsV14")}function xw(e){var t=e.path.toArray();return[t.slice(0,t.length-2),t[t.length-2],t[t.length-1]]}function Tw(e,t){var n=t.documentKey.path.toArray();return[e,ok(t.readTime),n.slice(0,n.length-2),n.length>0?n[n.length-1]:""]}function Iw(e,t){for(var n=e.path.toArray(),r=t.path.toArray(),i=0,a=0;a<n.length-2&&a<r.length-2;++a)if(i=up(n[a],r[a]))return i;return(i=up(n.length,r.length))||((i=up(n[n.length-2],r[r.length-2]))||up(n[n.length-1],r[r.length-1]))}var Ew=k((function e(t,n){y(this,e),this.overlayedDocument=t,this.mutatedFields=n})),Sw=function(){function e(t,n,r,i){y(this,e),this.remoteDocumentCache=t,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}return k(e,[{key:"getDocument",value:function(e,t){var n=this,r=null;return this.documentOverlayCache.getOverlay(e,t).next((function(i){return r=i,n.remoteDocumentCache.getEntry(e,t)})).next((function(e){return null!==r&&qy(r.mutation,e,Nv.empty(),lp.now()),e}))}},{key:"getDocuments",value:function(e,t){var n=this;return this.remoteDocumentCache.getEntries(e,t).next((function(t){return n.getLocalViewOfDocuments(e,t,gy()).next((function(){return t}))}))}},{key:"getLocalViewOfDocuments",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:gy(),i=dy();return this.populateOverlays(e,i,t).next((function(){return n.computeViews(e,t,i,r).next((function(e){var t=fy();return e.forEach((function(e,n){t=t.insert(e,n.overlayedDocument)})),t}))}))}},{key:"getOverlayedDocuments",value:function(e,t){var n=this,r=dy();return this.populateOverlays(e,r,t).next((function(){return n.computeViews(e,t,r,gy())}))}},{key:"populateOverlays",value:function(e,t,n){var r=[];return n.forEach((function(e){t.has(e)||r.push(e)})),this.documentOverlayCache.getOverlays(e,r).next((function(e){e.forEach((function(e,n){t.set(e,n)}))}))}},{key:"computeViews",value:function(e,t,n,r){var i=cy(),a=vy(),o=vy();return t.forEach((function(e,t){var o=n.get(t.key);r.has(t.key)&&(void 0===o||o.mutation instanceof Wy)?i=i.insert(t.key,t):void 0!==o?(a.set(t.key,o.mutation.getFieldMask()),qy(o.mutation,t,o.mutation.getFieldMask(),lp.now())):a.set(t.key,Nv.empty())})),this.recalculateAndSaveOverlays(e,i).next((function(e){return e.forEach((function(e,t){return a.set(e,t)})),t.forEach((function(e,t){var n;return o.set(e,new Ew(t,null!==(n=a.get(e))&&void 0!==n?n:null))})),o}))}},{key:"recalculateAndSaveOverlays",value:function(e,t){var n=this,r=vy(),i=new Tv((function(e,t){return e-t})),a=gy();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((function(e){var n,a=w(e);try{var o=function(){var e=n.value;e.keys().forEach((function(n){var a=t.get(n);if(null!==a){var o=r.get(n)||Nv.empty();o=e.applyToLocalView(a,o),r.set(n,o);var u=(i.get(e.batchId)||gy()).add(n);i=i.insert(e.batchId,u)}}))};for(a.s();!(n=a.n()).done;)o()}catch(u){a.e(u)}finally{a.f()}})).next((function(){for(var o=[],u=i.getReverseIterator(),s=function(){var i=u.getNext(),s=i.key,c=i.value,l=py();c.forEach((function(e){if(!a.has(e)){var n=zy(t.get(e),r.get(e));null!==n&&l.set(e,n),a=a.add(e)}})),o.push(n.documentOverlayCache.saveOverlays(e,s,l))};u.hasNext();)s();return Np.waitFor(o)})).next((function(){return r}))}},{key:"recalculateAndSaveOverlaysForDocumentKeys",value:function(e,t){var n=this;return this.remoteDocumentCache.getEntries(e,t).next((function(t){return n.recalculateAndSaveOverlays(e,t)}))}},{key:"getDocumentsMatchingQuery",value:function(e,t,n,r){return function(e){return mp.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Qm(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}},{key:"getNextDocuments",value:function(e,t,n,r){var i=this;return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next((function(a){var o=r-a.size>0?i.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-a.size):Np.resolve(dy()),u=-1,s=a;return o.next((function(t){return Np.forEach(t,(function(t,n){return u<n.largestBatchId&&(u=n.largestBatchId),a.get(t)?Np.resolve():i.remoteDocumentCache.getEntry(e,t).next((function(e){s=s.insert(t,e)}))})).next((function(){return i.populateOverlays(e,t,a)})).next((function(){return i.computeViews(e,s,t,gy())})).next((function(e){return{batchId:u,changes:hy(e)}}))}))}))}},{key:"getDocumentsMatchingDocumentQuery",value:function(e,t){return this.getDocument(e,new mp(t)).next((function(e){var t=fy();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}},{key:"getDocumentsMatchingCollectionGroupQuery",value:function(e,t,n,r){var i=this,a=t.collectionGroup,o=fy();return this.indexManager.getCollectionParents(e,a).next((function(u){return Np.forEach(u,(function(u){var s=function(e,t){return new Km(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,u.child(a));return i.getDocumentsMatchingCollectionQuery(e,s,n,r).next((function(e){e.forEach((function(e,t){o=o.insert(e,t)}))}))})).next((function(){return o}))}))}},{key:"getDocumentsMatchingCollectionQuery",value:function(e,t,n,r){var i,a=this;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((function(o){return i=o,a.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r)})).next((function(e){i.forEach((function(t,n){var r=n.getKey();null===e.get(r)&&(e=e.insert(r,fm.newInvalidDocument(r)))}));var n=fy();return e.forEach((function(e,r){var a=i.get(e);void 0!==a&&qy(a.mutation,r,Nv.empty(),lp.now()),ry(t,r)&&(n=n.insert(e,r))})),n}))}}]),e}(),Cw=function(){function e(t){y(this,e),this.serializer=t,this.cr=new Map,this.lr=new Map}return k(e,[{key:"getBundleMetadata",value:function(e,t){return Np.resolve(this.cr.get(t))}},{key:"saveBundleMetadata",value:function(e,t){return this.cr.set(t.id,function(e){return{id:e.id,version:e.version,createTime:Pg(e.createTime)}}(t)),Np.resolve()}},{key:"getNamedQuery",value:function(e,t){return Np.resolve(this.lr.get(t))}},{key:"saveNamedQuery",value:function(e,t){return this.lr.set(t.name,function(e){return{name:e.name,query:hk(e.bundledQuery),readTime:Pg(e.readTime)}}(t)),Np.resolve()}}]),e}(),Aw=function(){function e(){y(this,e),this.overlays=new Tv(mp.comparator),this.hr=new Map}return k(e,[{key:"getOverlay",value:function(e,t){return Np.resolve(this.overlays.get(t))}},{key:"getOverlays",value:function(e,t){var n=this,r=dy();return Np.forEach(t,(function(t){return n.getOverlay(e,t).next((function(e){null!==e&&r.set(t,e)}))})).next((function(){return r}))}},{key:"saveOverlays",value:function(e,t,n){var r=this;return n.forEach((function(n,i){r.ht(e,t,i)})),Np.resolve()}},{key:"removeOverlaysForBatchId",value:function(e,t,n){var r=this,i=this.hr.get(n);return void 0!==i&&(i.forEach((function(e){return r.overlays=r.overlays.remove(e)})),this.hr.delete(n)),Np.resolve()}},{key:"getOverlaysForCollection",value:function(e,t,n){for(var r=dy(),i=t.length+1,a=new mp(t.child("")),o=this.overlays.getIteratorFrom(a);o.hasNext();){var u=o.getNext().value,s=u.getKey();if(!t.isPrefixOf(s.path))break;s.path.length===i&&u.largestBatchId>n&&r.set(u.getKey(),u)}return Np.resolve(r)}},{key:"getOverlaysForCollectionGroup",value:function(e,t,n,r){for(var i=new Tv((function(e,t){return e-t})),a=this.overlays.getIterator();a.hasNext();){var o=a.getNext().value;if(o.getKey().getCollectionGroup()===t&&o.largestBatchId>n){var u=i.get(o.largestBatchId);null===u&&(u=dy(),i=i.insert(o.largestBatchId,u)),u.set(o.getKey(),o)}}for(var s=dy(),c=i.getIterator();c.hasNext()&&(c.getNext().value.forEach((function(e,t){return s.set(e,t)})),!(s.size()>=r)););return Np.resolve(s)}},{key:"ht",value:function(e,t,n){var r=this.overlays.get(n.key);if(null!==r){var i=this.hr.get(r.largestBatchId).delete(n.key);this.hr.set(r.largestBatchId,i)}this.overlays=this.overlays.insert(n.key,new rg(t,n));var a=this.hr.get(t);void 0===a&&(a=gy(),this.hr.set(t,a)),this.hr.set(t,a.add(n.key))}}]),e}(),Nw=function(){function e(){y(this,e),this.Pr=new Sv(Pw.Ir),this.Tr=new Sv(Pw.Er)}return k(e,[{key:"isEmpty",value:function(){return this.Pr.isEmpty()}},{key:"addReference",value:function(e,t){var n=new Pw(e,t);this.Pr=this.Pr.add(n),this.Tr=this.Tr.add(n)}},{key:"dr",value:function(e,t){var n=this;e.forEach((function(e){return n.addReference(e,t)}))}},{key:"removeReference",value:function(e,t){this.Ar(new Pw(e,t))}},{key:"Rr",value:function(e,t){var n=this;e.forEach((function(e){return n.removeReference(e,t)}))}},{key:"Vr",value:function(e){var t=this,n=new mp(new dp([])),r=new Pw(n,e),i=new Pw(n,e+1),a=[];return this.Tr.forEachInRange([r,i],(function(e){t.Ar(e),a.push(e.key)})),a}},{key:"mr",value:function(){var e=this;this.Pr.forEach((function(t){return e.Ar(t)}))}},{key:"Ar",value:function(e){this.Pr=this.Pr.delete(e),this.Tr=this.Tr.delete(e)}},{key:"gr",value:function(e){var t=new mp(new dp([])),n=new Pw(t,e),r=new Pw(t,e+1),i=gy();return this.Tr.forEachInRange([n,r],(function(e){i=i.add(e.key)})),i}},{key:"containsKey",value:function(e){var t=new Pw(e,0),n=this.Pr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}]),e}(),Pw=function(){function e(t,n){y(this,e),this.key=t,this.pr=n}return k(e,null,[{key:"Ir",value:function(e,t){return mp.comparator(e.key,t.key)||up(e.pr,t.pr)}},{key:"Er",value:function(e,t){return up(e.pr,t.pr)||mp.comparator(e.key,t.key)}}]),e}(),Dw=function(){function e(t,n){y(this,e),this.indexManager=t,this.referenceDelegate=n,this.mutationQueue=[],this.yr=1,this.wr=new Sv(Pw.Ir)}return k(e,[{key:"checkEmpty",value:function(e){return Np.resolve(0===this.mutationQueue.length)}},{key:"addMutationBatch",value:function(e,t,n,r){var i=this.yr;this.yr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];var a=new tg(i,t,n,r);this.mutationQueue.push(a);var o,u=w(r);try{for(u.s();!(o=u.n()).done;){var s=o.value;this.wr=this.wr.add(new Pw(s.key,i)),this.indexManager.addToCollectionParentIndex(e,s.key.path.popLast())}}catch(c){u.e(c)}finally{u.f()}return Np.resolve(a)}},{key:"lookupMutationBatch",value:function(e,t){return Np.resolve(this.Sr(t))}},{key:"getNextMutationBatchAfterBatchId",value:function(e,t){var n=t+1,r=this.br(n),i=r<0?0:r;return Np.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}},{key:"getHighestUnacknowledgedBatchId",value:function(){return Np.resolve(0===this.mutationQueue.length?-1:this.yr-1)}},{key:"getAllMutationBatches",value:function(e){return Np.resolve(this.mutationQueue.slice())}},{key:"getAllMutationBatchesAffectingDocumentKey",value:function(e,t){var n=this,r=new Pw(t,0),i=new Pw(t,Number.POSITIVE_INFINITY),a=[];return this.wr.forEachInRange([r,i],(function(e){var t=n.Sr(e.pr);a.push(t)})),Np.resolve(a)}},{key:"getAllMutationBatchesAffectingDocumentKeys",value:function(e,t){var n=this,r=new Sv(up);return t.forEach((function(e){var t=new Pw(e,0),i=new Pw(e,Number.POSITIVE_INFINITY);n.wr.forEachInRange([t,i],(function(e){r=r.add(e.pr)}))})),Np.resolve(this.Dr(r))}},{key:"getAllMutationBatchesAffectingQuery",value:function(e,t){var n=t.path,r=n.length+1,i=n;mp.isDocumentKey(i)||(i=i.child(""));var a=new Pw(new mp(i),0),o=new Sv(up);return this.wr.forEachWhile((function(e){var t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(o=o.add(e.pr)),!0)}),a),Np.resolve(this.Dr(o))}},{key:"Dr",value:function(e){var t=this,n=[];return e.forEach((function(e){var r=t.Sr(e);null!==r&&n.push(r)})),n}},{key:"removeMutationBatch",value:function(e,t){var n=this;Hd(0===this.Cr(t.batchId,"removed")),this.mutationQueue.shift();var r=this.wr;return Np.forEach(t.mutations,(function(i){var a=new Pw(i.key,t.batchId);return r=r.delete(a),n.referenceDelegate.markPotentiallyOrphaned(e,i.key)})).next((function(){n.wr=r}))}},{key:"Mn",value:function(e){}},{key:"containsKey",value:function(e,t){var n=new Pw(t,0),r=this.wr.firstAfterOrEqual(n);return Np.resolve(t.isEqual(r&&r.key))}},{key:"performConsistencyCheck",value:function(e){return this.mutationQueue.length,Np.resolve()}},{key:"Cr",value:function(e,t){return this.br(e)}},{key:"br",value:function(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}},{key:"Sr",value:function(e){var t=this.br(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}]),e}(),Rw=function(){function e(t){y(this,e),this.vr=t,this.docs=new Tv(mp.comparator),this.size=0}return k(e,[{key:"setIndexManager",value:function(e){this.indexManager=e}},{key:"addEntry",value:function(e,t){var n=t.key,r=this.docs.get(n),i=r?r.size:0,a=this.vr(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}},{key:"removeEntry",value:function(e){var t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}},{key:"getEntry",value:function(e,t){var n=this.docs.get(t);return Np.resolve(n?n.document.mutableCopy():fm.newInvalidDocument(t))}},{key:"getEntries",value:function(e,t){var n=this,r=cy();return t.forEach((function(e){var t=n.docs.get(e);r=r.insert(e,t?t.document.mutableCopy():fm.newInvalidDocument(e))})),Np.resolve(r)}},{key:"getDocumentsMatchingQuery",value:function(e,t,n,r){for(var i=cy(),a=t.path,o=new mp(a.child("")),u=this.docs.getIteratorFrom(o);u.hasNext();){var s=u.getNext(),c=s.key,l=s.value.document;if(!a.isPrefixOf(c.path))break;c.path.length>a.length+1||Ip(xp(l),n)<=0||(r.has(l.key)||ry(t,l))&&(i=i.insert(l.key,l.mutableCopy()))}return Np.resolve(i)}},{key:"getAllFromCollectionGroup",value:function(e,t,n,r){Gd()}},{key:"Fr",value:function(e,t){return Np.forEach(this.docs,(function(e){return t(e)}))}},{key:"newChangeBuffer",value:function(e){return new Ow(this)}},{key:"getSize",value:function(e){return Np.resolve(this.size)}}]),e}(),Ow=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this)).ar=e,r}return k(n,[{key:"applyChanges",value:function(e){var t=this,n=[];return this.changes.forEach((function(r,i){i.isValidDocument()?n.push(t.ar.addEntry(e,i)):t.ar.removeEntry(r)})),Np.waitFor(n)}},{key:"getFromCache",value:function(e,t){return this.ar.getEntry(e,t)}},{key:"getAllFromCache",value:function(e,t){return this.ar.getEntries(e,t)}}]),n}(yw),Lw=function(){function e(t){y(this,e),this.persistence=t,this.Mr=new uy((function(e){return Vm(e)}),Um),this.lastRemoteSnapshotVersion=fp.min(),this.highestTargetId=0,this.Or=0,this.Nr=new Nw,this.targetCount=0,this.Br=aw.Nn()}return k(e,[{key:"forEachTarget",value:function(e,t){return this.Mr.forEach((function(e,n){return t(n)})),Np.resolve()}},{key:"getLastRemoteSnapshotVersion",value:function(e){return Np.resolve(this.lastRemoteSnapshotVersion)}},{key:"getHighestSequenceNumber",value:function(e){return Np.resolve(this.Or)}},{key:"allocateTargetId",value:function(e){return this.highestTargetId=this.Br.next(),Np.resolve(this.highestTargetId)}},{key:"setTargetsMetadata",value:function(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.Or&&(this.Or=t),Np.resolve()}},{key:"qn",value:function(e){this.Mr.set(e.target,e);var t=e.targetId;t>this.highestTargetId&&(this.Br=new aw(t),this.highestTargetId=t),e.sequenceNumber>this.Or&&(this.Or=e.sequenceNumber)}},{key:"addTargetData",value:function(e,t){return this.qn(t),this.targetCount+=1,Np.resolve()}},{key:"updateTargetData",value:function(e,t){return this.qn(t),Np.resolve()}},{key:"removeTargetData",value:function(e,t){return this.Mr.delete(t.target),this.Nr.Vr(t.targetId),this.targetCount-=1,Np.resolve()}},{key:"removeTargets",value:function(e,t,n){var r=this,i=0,a=[];return this.Mr.forEach((function(o,u){u.sequenceNumber<=t&&null===n.get(u.targetId)&&(r.Mr.delete(o),a.push(r.removeMatchingKeysForTargetId(e,u.targetId)),i++)})),Np.waitFor(a).next((function(){return i}))}},{key:"getTargetCount",value:function(e){return Np.resolve(this.targetCount)}},{key:"getTargetData",value:function(e,t){var n=this.Mr.get(t)||null;return Np.resolve(n)}},{key:"addMatchingKeys",value:function(e,t,n){return this.Nr.dr(t,n),Np.resolve()}},{key:"removeMatchingKeys",value:function(e,t,n){this.Nr.Rr(t,n);var r=this.persistence.referenceDelegate,i=[];return r&&t.forEach((function(t){i.push(r.markPotentiallyOrphaned(e,t))})),Np.waitFor(i)}},{key:"removeMatchingKeysForTargetId",value:function(e,t){return this.Nr.Vr(t),Np.resolve()}},{key:"getMatchingKeysForTargetId",value:function(e,t){var n=this.Nr.gr(t);return Np.resolve(n)}},{key:"containsKey",value:function(e,t){return Np.resolve(this.Nr.containsKey(t))}}]),e}(),Mw=function(){function e(t,n){var r=this;y(this,e),this.Lr={},this.overlays={},this.kr=new Bp(0),this.qr=!1,this.qr=!0,this.referenceDelegate=t(this),this.Qr=new Lw(this),this.indexManager=new zk,this.remoteDocumentCache=function(e){return new Rw(e)}((function(e){return r.referenceDelegate.Kr(e)})),this.serializer=new ik(n),this.$r=new Cw(this.serializer)}return k(e,[{key:"start",value:function(){return Promise.resolve()}},{key:"shutdown",value:function(){return this.qr=!1,Promise.resolve()}},{key:"started",get:function(){return this.qr}},{key:"setDatabaseDeletedListener",value:function(){}},{key:"setNetworkEnabled",value:function(){}},{key:"getIndexManager",value:function(e){return this.indexManager}},{key:"getDocumentOverlayCache",value:function(e){var t=this.overlays[e.toKey()];return t||(t=new Aw,this.overlays[e.toKey()]=t),t}},{key:"getMutationQueue",value:function(e,t){var n=this.Lr[e.toKey()];return n||(n=new Dw(t,this.referenceDelegate),this.Lr[e.toKey()]=n),n}},{key:"getTargetCache",value:function(){return this.Qr}},{key:"getRemoteDocumentCache",value:function(){return this.remoteDocumentCache}},{key:"getBundleCache",value:function(){return this.$r}},{key:"runTransaction",value:function(e,t,n){var r=this;zd("MemoryPersistence","Starting transaction:",e);var i=new Fw(this.kr.next());return this.referenceDelegate.Ur(),n(i).next((function(e){return r.referenceDelegate.Wr(i).next((function(){return e}))})).toPromise().then((function(e){return i.raiseOnCommittedEvent(),e}))}},{key:"Gr",value:function(e,t){return Np.or(Object.values(this.Lr).map((function(n){return function(){return n.containsKey(e,t)}})))}}]),e}(),Fw=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this)).currentSequenceNumber=e,r}return k(n)}(Sp),Vw=function(){function e(t){y(this,e),this.persistence=t,this.zr=new Nw,this.jr=null}return k(e,[{key:"Jr",get:function(){if(this.jr)return this.jr;throw Gd()}},{key:"addReference",value:function(e,t,n){return this.zr.addReference(n,t),this.Jr.delete(n.toString()),Np.resolve()}},{key:"removeReference",value:function(e,t,n){return this.zr.removeReference(n,t),this.Jr.add(n.toString()),Np.resolve()}},{key:"markPotentiallyOrphaned",value:function(e,t){return this.Jr.add(t.toString()),Np.resolve()}},{key:"removeTarget",value:function(e,t){var n=this;this.zr.Vr(t.targetId).forEach((function(e){return n.Jr.add(e.toString())}));var r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next((function(e){e.forEach((function(e){return n.Jr.add(e.toString())}))})).next((function(){return r.removeTargetData(e,t)}))}},{key:"Ur",value:function(){this.jr=new Set}},{key:"Wr",value:function(e){var t=this,n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Np.forEach(this.Jr,(function(r){var i=mp.fromPath(r);return t.Yr(e,i).next((function(e){e||n.removeEntry(i,fp.min())}))})).next((function(){return t.jr=null,n.apply(e)}))}},{key:"updateLimboDocument",value:function(e,t){var n=this;return this.Yr(e,t).next((function(e){e?n.Jr.delete(t.toString()):n.Jr.add(t.toString())}))}},{key:"Kr",value:function(e){return 0}},{key:"Yr",value:function(e,t){var n=this;return Np.or([function(){return Np.resolve(n.zr.containsKey(t))},function(){return n.persistence.getTargetCache().containsKey(e,t)},function(){return n.persistence.Gr(e,t)}])}}],[{key:"Hr",value:function(t){return new e(t)}}]),e}(),Uw=function(){function e(t){y(this,e),this.serializer=t}return k(e,[{key:"B",value:function(e,t,n,r){var i=this,a=new Pp("createOrUpgrade",t);n<1&&r>=1&&(function(e){e.createObjectStore("owner")}(e),function(e){e.createObjectStore("mutationQueues",{keyPath:"userId"}),e.createObjectStore("mutations",{keyPath:"batchId",autoIncrement:!0}).createIndex("userMutationsIndex",Jp,{unique:!0}),e.createObjectStore("documentMutations")}(e),jw(e),function(e){e.createObjectStore("remoteDocuments")}(e));var o=Np.resolve();return n<3&&r>=3&&(0!==n&&(function(e){e.deleteObjectStore("targetDocuments"),e.deleteObjectStore("targets"),e.deleteObjectStore("targetGlobal")}(e),jw(e)),o=o.next((function(){return function(e){var t=e.store("targetGlobal"),n={highestTargetId:0,highestListenSequenceNumber:0,lastRemoteSnapshotVersion:fp.min().toTimestamp(),targetCount:0};return t.put("targetGlobalKey",n)}(a)}))),n<4&&r>=4&&(0!==n&&(o=o.next((function(){return function(e,t){return t.store("mutations").G().next((function(n){e.deleteObjectStore("mutations"),e.createObjectStore("mutations",{keyPath:"batchId",autoIncrement:!0}).createIndex("userMutationsIndex",Jp,{unique:!0});var r=t.store("mutations"),i=n.map((function(e){return r.put(e)}));return Np.waitFor(i)}))}(e,a)}))),o=o.next((function(){!function(e){e.createObjectStore("clientMetadata",{keyPath:"clientId"})}(e)}))),n<5&&r>=5&&(o=o.next((function(){return i.Xr(a)}))),n<6&&r>=6&&(o=o.next((function(){return function(e){e.createObjectStore("remoteDocumentGlobal")}(e),i.ei(a)}))),n<7&&r>=7&&(o=o.next((function(){return i.ti(a)}))),n<8&&r>=8&&(o=o.next((function(){return i.ni(e,a)}))),n<9&&r>=9&&(o=o.next((function(){!function(e){e.objectStoreNames.contains("remoteDocumentChanges")&&e.deleteObjectStore("remoteDocumentChanges")}(e)}))),n<10&&r>=10&&(o=o.next((function(){return i.ri(a)}))),n<11&&r>=11&&(o=o.next((function(){!function(e){e.createObjectStore("bundles",{keyPath:"bundleId"})}(e),function(e){e.createObjectStore("namedQueries",{keyPath:"name"})}(e)}))),n<12&&r>=12&&(o=o.next((function(){!function(e){var t=e.createObjectStore("documentOverlays",{keyPath:fv});t.createIndex("collectionPathOverlayIndex",hv,{unique:!1}),t.createIndex("collectionGroupOverlayIndex",dv,{unique:!1})}(e)}))),n<13&&r>=13&&(o=o.next((function(){return function(e){var t=e.createObjectStore("remoteDocumentsV14",{keyPath:ev});t.createIndex("documentKeyIndex",tv),t.createIndex("collectionGroupIndex",nv)}(e)})).next((function(){return i.ii(e,a)})).next((function(){return e.deleteObjectStore("remoteDocuments")}))),n<14&&r>=14&&(o=o.next((function(){return i.si(e,a)}))),n<15&&r>=15&&(o=o.next((function(){return function(e){e.createObjectStore("indexConfiguration",{keyPath:"indexId",autoIncrement:!0}).createIndex("collectionGroupIndex","collectionGroup",{unique:!1}),e.createObjectStore("indexState",{keyPath:uv}).createIndex("sequenceNumberIndex",sv,{unique:!1}),e.createObjectStore("indexEntries",{keyPath:cv}).createIndex("documentKeyIndex",lv,{unique:!1})}(e)}))),o}},{key:"ei",value:function(e){var t=0;return e.store("remoteDocuments").Z((function(e,n){t+=Zk(n)})).next((function(){var n={byteSize:t};return e.store("remoteDocumentGlobal").put("remoteDocumentGlobalKey",n)}))}},{key:"Xr",value:function(e){var t=this,n=e.store("mutationQueues"),r=e.store("mutations");return n.G().next((function(n){return Np.forEach(n,(function(n){var i=IDBKeyRange.bound([n.userId,-1],[n.userId,n.lastAcknowledgedBatchId]);return r.G("userMutationsIndex",i).next((function(r){return Np.forEach(r,(function(r){Hd(r.userId===n.userId);var i=ck(t.serializer,r);return $k(e,n.userId,i).next((function(){}))}))}))}))}))}},{key:"ti",value:function(e){var t=e.store("targetDocuments"),n=e.store("remoteDocuments");return e.store("targetGlobal").get("targetGlobalKey").next((function(e){var r=[];return n.Z((function(n,i){var a=new dp(n),o=function(e){return[0,Hp(e)]}(a);r.push(t.get(o).next((function(n){return n?Np.resolve():function(n){return t.put({targetId:0,path:Hp(n),sequenceNumber:e.highestListenSequenceNumber})}(a)})))})).next((function(){return Np.waitFor(r)}))}))}},{key:"ni",value:function(e,t){e.createObjectStore("collectionParents",{keyPath:ov});var n=t.store("collectionParents"),r=new Bk,i=function(e){if(r.add(e)){var t=e.lastSegment(),i=e.popLast();return n.put({collectionId:t,parent:Hp(i)})}};return t.store("remoteDocuments").Z({Y:!0},(function(e,t){var n=new dp(e);return i(n.popLast())})).next((function(){return t.store("documentMutations").Z({Y:!0},(function(e,t){var n=m(e,3),r=(n[0],n[1]),a=(n[2],Yp(r));return i(a.popLast())}))}))}},{key:"ri",value:function(e){var t=this,n=e.store("targets");return n.Z((function(e,r){var i=lk(r),a=fk(t.serializer,i);return n.put(a)}))}},{key:"ii",value:function(e,t){var n=t.store("remoteDocuments"),r=[];return n.Z((function(e,n){var i=t.store("remoteDocumentsV14"),a=function(e){return e.document?new mp(dp.fromString(e.document.name).popFirst(5)):e.noDocument?mp.fromSegments(e.noDocument.path):e.unknownDocument?mp.fromSegments(e.unknownDocument.path):Gd()}(n).path.toArray(),o={prefixPath:a.slice(0,a.length-2),collectionGroup:a[a.length-2],documentId:a[a.length-1],readTime:n.readTime||[0,0],unknownDocument:n.unknownDocument,noDocument:n.noDocument,document:n.document,hasCommittedMutations:!!n.hasCommittedMutations};r.push(i.put(o))})).next((function(){return Np.waitFor(r)}))}},{key:"si",value:function(e,t){var n=this,r=t.store("mutations"),i=kw(this.serializer),a=new Mw(Vw.Hr,this.serializer.ct);return r.G().next((function(e){var r=new Map;return e.forEach((function(e){var t,i=null!==(t=r.get(e.userId))&&void 0!==t?t:gy();ck(n.serializer,e).keys().forEach((function(e){return i=i.add(e)})),r.set(e.userId,i)})),Np.forEach(r,(function(e,r){var o=new Fd(r),u=kk.lt(n.serializer,o),s=a.getIndexManager(o),c=ew.lt(o,n.serializer,s,a.referenceDelegate);return new Sw(i,c,u,s).recalculateAndSaveOverlaysForDocumentKeys(new kv(t,Bp.ae),e).next()}))}))}}]),e}();function jw(e){e.createObjectStore("targetDocuments",{keyPath:iv}).createIndex("documentTargetsIndex",av,{unique:!0}),e.createObjectStore("targets",{keyPath:"targetId"}).createIndex("queryTargetsIndex",rv,{unique:!0}),e.createObjectStore("targetGlobal")}var zw="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",Bw=function(){function e(t,n,r,i,a,o,u,s,c,l){var f=arguments.length>10&&void 0!==arguments[10]?arguments[10]:15;if(y(this,e),this.allowTabSynchronization=t,this.persistenceKey=n,this.clientId=r,this.oi=a,this.window=o,this.document=u,this._i=c,this.ai=l,this.ui=f,this.kr=null,this.qr=!1,this.isPrimary=!1,this.networkEnabled=!0,this.ci=null,this.inForeground=!1,this.li=null,this.hi=null,this.Pi=Number.NEGATIVE_INFINITY,this.Ii=function(e){return Promise.resolve()},!e.C())throw new Yd(Qd.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new vw(this,i),this.Ti=n+"main",this.serializer=new ik(s),this.Ei=new Dp(this.Ti,this.ui,new Uw(this.serializer)),this.Qr=new ow(this.referenceDelegate,this.serializer),this.remoteDocumentCache=kw(this.serializer),this.$r=new mk,this.window&&this.window.localStorage?this.di=this.window.localStorage:(this.di=null,!1===l&&Bd("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}return k(e,[{key:"start",value:function(){var e=this;return this.Ai().then((function(){if(!e.isPrimary&&!e.allowTabSynchronization)throw new Yd(Qd.FAILED_PRECONDITION,zw);return e.Ri(),e.Vi(),e.mi(),e.runTransaction("getHighestListenSequenceNumber","readonly",(function(t){return e.Qr.getHighestSequenceNumber(t)}))})).then((function(t){e.kr=new Bp(t,e._i)})).then((function(){e.qr=!0})).catch((function(t){return e.Ei&&e.Ei.close(),Promise.reject(t)}))}},{key:"fi",value:function(e){var t=this;return this.Ii=function(){var n=u(a().mark((function n(r){return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!t.started){n.next=2;break}return n.abrupt("return",e(r));case 2:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}(),e(this.isPrimary)}},{key:"setDatabaseDeletedListener",value:function(e){this.Ei.k(function(){var t=u(a().mark((function t(n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=null===n.newVersion,!t.t0){t.next=4;break}return t.next=4,e();case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"setNetworkEnabled",value:function(e){var t=this;this.networkEnabled!==e&&(this.networkEnabled=e,this.oi.enqueueAndForget(u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=t.started,!e.t0){e.next=4;break}return e.next=4,t.Ai();case 4:case"end":return e.stop()}}),e)})))))}},{key:"Ai",value:function(){var e=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",(function(t){return Kw(t).put({clientId:e.clientId,updateTimeMs:Date.now(),networkEnabled:e.networkEnabled,inForeground:e.inForeground}).next((function(){if(e.isPrimary)return e.gi(t).next((function(t){t||(e.isPrimary=!1,e.oi.enqueueRetryable((function(){return e.Ii(!1)})))}))})).next((function(){return e.pi(t)})).next((function(n){return e.isPrimary&&!n?e.yi(t).next((function(){return!1})):!!n&&e.wi(t).next((function(){return!0}))}))})).catch((function(t){if(Lp(t))return zd("IndexedDbPersistence","Failed to extend owner lease: ",t),e.isPrimary;if(!e.allowTabSynchronization)throw t;return zd("IndexedDbPersistence","Releasing owner lease after error during lease refresh",t),!1})).then((function(t){e.isPrimary!==t&&e.oi.enqueueRetryable((function(){return e.Ii(t)})),e.isPrimary=t}))}},{key:"gi",value:function(e){var t=this;return qw(e).get("owner").next((function(e){return Np.resolve(t.Si(e))}))}},{key:"bi",value:function(e){return Kw(e).delete(this.clientId)}},{key:"Di",value:function(){var e=u(a().mark((function e(){var t,n,r,i,o=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPrimary||this.Ci(this.Pi,18e5)){e.next=6;break}return this.Pi=Date.now(),e.next=4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",(function(e){var t=wv(e,"clientMetadata");return t.G().next((function(e){var n=o.vi(e,18e5),r=e.filter((function(e){return-1===n.indexOf(e)}));return Np.forEach(r,(function(e){return t.delete(e.clientId)})).next((function(){return r}))}))})).catch((function(){return[]}));case 4:if(t=e.sent,this.di){n=w(t);try{for(n.s();!(r=n.n()).done;)i=r.value,this.di.removeItem(this.Fi(i.clientId))}catch(a){n.e(a)}finally{n.f()}}case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"mi",value:function(){var e=this;this.hi=this.oi.enqueueAfterDelay("client_metadata_refresh",4e3,(function(){return e.Ai().then((function(){return e.Di()})).then((function(){return e.mi()}))}))}},{key:"Si",value:function(e){return!!e&&e.ownerId===this.clientId}},{key:"pi",value:function(e){var t=this;return this.ai?Np.resolve(!0):qw(e).get("owner").next((function(n){if(null!==n&&t.Ci(n.leaseTimestampMs,5e3)&&!t.Mi(n.ownerId)){if(t.Si(n)&&t.networkEnabled)return!0;if(!t.Si(n)){if(!n.allowTabSynchronization)throw new Yd(Qd.FAILED_PRECONDITION,zw);return!1}}return!(!t.networkEnabled||!t.inForeground)||Kw(e).G().next((function(e){return void 0===t.vi(e,5e3).find((function(e){if(t.clientId!==e.clientId){var n=!t.networkEnabled&&e.networkEnabled,r=!t.inForeground&&e.inForeground,i=t.networkEnabled===e.networkEnabled;if(n||r&&i)return!0}return!1}))}))})).next((function(e){return t.isPrimary!==e&&zd("IndexedDbPersistence","Client ".concat(e?"is":"is not"," eligible for a primary lease.")),e}))}},{key:"shutdown",value:function(){var e=u(a().mark((function e(){var t=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.qr=!1,this.xi(),this.hi&&(this.hi.cancel(),this.hi=null),this.Oi(),this.Ni(),e.next=7,this.Ei.runTransaction("shutdown","readwrite",["owner","clientMetadata"],(function(e){var n=new kv(e,Bp.ae);return t.yi(n).next((function(){return t.bi(n)}))}));case 7:this.Ei.close(),this.Bi();case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"vi",value:function(e,t){var n=this;return e.filter((function(e){return n.Ci(e.updateTimeMs,t)&&!n.Mi(e.clientId)}))}},{key:"Li",value:function(){var e=this;return this.runTransaction("getActiveClients","readonly",(function(t){return Kw(t).G().next((function(t){return e.vi(t,18e5).map((function(e){return e.clientId}))}))}))}},{key:"started",get:function(){return this.qr}},{key:"getMutationQueue",value:function(e,t){return ew.lt(e,this.serializer,t,this.referenceDelegate)}},{key:"getTargetCache",value:function(){return this.Qr}},{key:"getRemoteDocumentCache",value:function(){return this.remoteDocumentCache}},{key:"getIndexManager",value:function(e){return new Kk(e,this.serializer.ct.databaseId)}},{key:"getDocumentOverlayCache",value:function(e){return kk.lt(this.serializer,e)}},{key:"getBundleCache",value:function(){return this.$r}},{key:"runTransaction",value:function(e,t,n){var r=this;zd("IndexedDbPersistence","Starting transaction:",e);var i,a="readonly"===t?"readonly":"readwrite",o=function(e){return 15===e?gv:14===e?yv:13===e?mv:12===e?vv:11===e?pv:void Gd()}(this.ui);return this.Ei.runTransaction(e,a,o,(function(a){return i=new kv(a,r.kr?r.kr.next():Bp.ae),"readwrite-primary"===t?r.gi(i).next((function(e){return!!e||r.pi(i)})).next((function(t){if(!t)throw Bd("Failed to obtain primary lease for action '".concat(e,"'.")),r.isPrimary=!1,r.oi.enqueueRetryable((function(){return r.Ii(!1)})),new Yd(Qd.FAILED_PRECONDITION,Ep);return n(i)})).next((function(e){return r.wi(i).next((function(){return e}))})):r.ki(i).next((function(){return n(i)}))})).then((function(e){return i.raiseOnCommittedEvent(),e}))}},{key:"ki",value:function(e){var t=this;return qw(e).get("owner").next((function(e){if(null!==e&&t.Ci(e.leaseTimestampMs,5e3)&&!t.Mi(e.ownerId)&&!t.Si(e)&&!(t.ai||t.allowTabSynchronization&&e.allowTabSynchronization))throw new Yd(Qd.FAILED_PRECONDITION,zw)}))}},{key:"wi",value:function(e){var t={ownerId:this.clientId,allowTabSynchronization:this.allowTabSynchronization,leaseTimestampMs:Date.now()};return qw(e).put("owner",t)}},{key:"yi",value:function(e){var t=this,n=qw(e);return n.get("owner").next((function(e){return t.Si(e)?(zd("IndexedDbPersistence","Releasing primary lease."),n.delete("owner")):Np.resolve()}))}},{key:"Ci",value:function(e,t){var n=Date.now();return!(e<n-t)&&(!(e>n)||(Bd("Detected an update time that is in the future: ".concat(e," > ").concat(n)),!1))}},{key:"Ri",value:function(){var e=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.li=function(){e.oi.enqueueAndForget((function(){return e.inForeground="visible"===e.document.visibilityState,e.Ai()}))},this.document.addEventListener("visibilitychange",this.li),this.inForeground="visible"===this.document.visibilityState)}},{key:"Oi",value:function(){this.li&&(this.document.removeEventListener("visibilitychange",this.li),this.li=null)}},{key:"Vi",value:function(){var e,t=this;"function"==typeof(null===(e=this.window)||void 0===e?void 0:e.addEventListener)&&(this.ci=function(){t.xi();var e=/(?:Version|Mobile)\/1[456]/;!j()&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")&&(navigator.appVersion.match(e)||navigator.userAgent.match(e))&&t.oi.enterRestrictedMode(!0),t.oi.enqueueAndForget((function(){return t.shutdown()}))},this.window.addEventListener("pagehide",this.ci))}},{key:"Ni",value:function(){this.ci&&(this.window.removeEventListener("pagehide",this.ci),this.ci=null)}},{key:"Mi",value:function(e){var t;try{var n=null!==(null===(t=this.di)||void 0===t?void 0:t.getItem(this.Fi(e)));return zd("IndexedDbPersistence","Client '".concat(e,"' ").concat(n?"is":"is not"," zombied in LocalStorage")),n}catch(e){return Bd("IndexedDbPersistence","Failed to get zombied client id.",e),!1}}},{key:"xi",value:function(){if(this.di)try{this.di.setItem(this.Fi(this.clientId),String(Date.now()))}catch(e){Bd("Failed to set zombie client id.",e)}}},{key:"Bi",value:function(){if(this.di)try{this.di.removeItem(this.Fi(this.clientId))}catch(e){}}},{key:"Fi",value:function(e){return"firestore_zombie_".concat(this.persistenceKey,"_").concat(e)}}],[{key:"C",value:function(){return Dp.C()}}]),e}();function qw(e){return wv(e,"owner")}function Kw(e){return wv(e,"clientMetadata")}function Gw(e,t){var n=e.projectId;return e.isDefaultDatabase||(n+="."+e.database),"firestore/"+t+"/"+n+"/"}var Hw=function(){function e(t,n,r,i){y(this,e),this.targetId=t,this.fromCache=n,this.qi=r,this.Qi=i}return k(e,null,[{key:"Ki",value:function(t,n){var r,i=gy(),a=gy(),o=w(n.docChanges);try{for(o.s();!(r=o.n()).done;){var u=r.value;switch(u.type){case 0:i=i.add(u.doc.key);break;case 1:a=a.add(u.doc.key)}}}catch(s){o.e(s)}finally{o.f()}return new e(t,n.fromCache,i,a)}}]),e}(),Ww=function(){function e(){y(this,e),this._documentReadCount=0}return k(e,[{key:"documentReadCount",get:function(){return this._documentReadCount}},{key:"incrementDocumentReadCount",value:function(e){this._documentReadCount+=e}}]),e}(),Qw=function(){function e(){y(this,e),this.$i=!1,this.Ui=!1,this.Wi=100,this.Gi=8}return k(e,[{key:"initialize",value:function(e,t){this.zi=e,this.indexManager=t,this.$i=!0}},{key:"getDocumentsMatchingQuery",value:function(e,t,n,r){var i=this,a={result:null};return this.ji(e,t).next((function(e){a.result=e})).next((function(){if(!a.result)return i.Hi(e,t,r,n).next((function(e){a.result=e}))})).next((function(){if(!a.result){var n=new Ww;return i.Ji(e,t,n).next((function(r){if(a.result=r,i.Ui)return i.Yi(e,t,n,r.size)}))}})).next((function(){return a.result}))}},{key:"Yi",value:function(e,t,n,r){return n.documentReadCount<this.Wi?(jd()<=fe.DEBUG&&zd("QueryEngine","SDK will not create cache indexes for query:",ny(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Wi,"documents"),Np.resolve()):(jd()<=fe.DEBUG&&zd("QueryEngine","Query:",ny(t),"scans",n.documentReadCount,"local documents and returns",r,"documents as results."),n.documentReadCount>this.Gi*r?(jd()<=fe.DEBUG&&zd("QueryEngine","The SDK decides to create cache indexes for query:",ny(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Jm(t))):Np.resolve())}},{key:"ji",value:function(e,t){var n=this;if(Wm(t))return Np.resolve(null);var r=Jm(t);return this.indexManager.getIndexType(e,r).next((function(i){return 0===i?null:(null!==t.limit&&1===i&&(t=Zm(t,null,"F"),r=Jm(t)),n.indexManager.getDocumentsMatchingTarget(e,r).next((function(i){var a=gy.apply(void 0,oe(i));return n.zi.getDocuments(e,a).next((function(i){return n.indexManager.getMinOffset(e,r).next((function(r){var o=n.Zi(t,i);return n.Xi(t,o,a,r.readTime)?n.ji(e,Zm(t,null,"F")):n.es(e,o,t,r)}))}))})))}))}},{key:"Hi",value:function(e,t,n,r){var i=this;return Wm(t)||r.isEqual(fp.min())?Np.resolve(null):this.zi.getDocuments(e,n).next((function(a){var o=i.Zi(t,a);return i.Xi(t,o,n,r)?Np.resolve(null):(jd()<=fe.DEBUG&&zd("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),ny(t)),i.es(e,o,t,_p(r,-1)).next((function(e){return e})))}))}},{key:"Zi",value:function(e,t){var n=new Sv(ay(e));return t.forEach((function(t,r){ry(e,r)&&(n=n.add(r))})),n}},{key:"Xi",value:function(e,t,n,r){if(null===e.limit)return!1;if(n.size!==t.size)return!0;var i="F"===e.limitType?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}},{key:"Ji",value:function(e,t,n){return jd()<=fe.DEBUG&&zd("QueryEngine","Using full collection scan to execute query:",ny(t)),this.zi.getDocumentsMatchingQuery(e,t,Tp.min(),n)}},{key:"es",value:function(e,t,n,r){return this.zi.getDocumentsMatchingQuery(e,n,r).next((function(e){return t.forEach((function(t){e=e.insert(t.key,t)})),e}))}}]),e}(),Yw=function(){function e(t,n,r,i){y(this,e),this.persistence=t,this.ts=n,this.serializer=i,this.ns=new Tv(up),this.rs=new uy((function(e){return Vm(e)}),Um),this.ss=new Map,this.os=t.getRemoteDocumentCache(),this.Qr=t.getTargetCache(),this.$r=t.getBundleCache(),this._s(r)}return k(e,[{key:"_s",value:function(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Sw(this.os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.os.setIndexManager(this.indexManager),this.ts.initialize(this.localDocuments,this.indexManager)}},{key:"collectGarbage",value:function(e){var t=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",(function(n){return e.collect(n,t.ns)}))}}]),e}();function Jw(e,t,n,r){return new Yw(e,t,n,r)}function Xw(e,t){return $w.apply(this,arguments)}function $w(){return $w=u(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Wd(t),e.next=3,r.persistence.runTransaction("Handle user change","readonly",(function(e){var t;return r.mutationQueue.getAllMutationBatches(e).next((function(i){return t=i,r._s(n),r.mutationQueue.getAllMutationBatches(e)})).next((function(n){var i,a=[],o=[],u=gy(),s=w(t);try{for(s.s();!(i=s.n()).done;){var c=i.value;a.push(c.batchId);var l,f=w(c.mutations);try{for(f.s();!(l=f.n()).done;){var h=l.value;u=u.add(h.key)}}catch(k){f.e(k)}finally{f.f()}}}catch(k){s.e(k)}finally{s.f()}var d,p=w(n);try{for(p.s();!(d=p.n()).done;){var v=d.value;o.push(v.batchId);var m,y=w(v.mutations);try{for(y.s();!(m=y.n()).done;){var g=m.value;u=u.add(g.key)}}catch(k){y.e(k)}finally{y.f()}}}catch(k){p.e(k)}finally{p.f()}return r.localDocuments.getDocuments(e,u).next((function(e){return{us:e,removedBatchIds:a,addedBatchIds:o}}))}))}));case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)}))),$w.apply(this,arguments)}function Zw(e,t){var n=Wd(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(function(e){var r=t.batch.keys(),i=n.os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){var i=n.batch,a=i.keys(),o=Np.resolve();return a.forEach((function(e){o=o.next((function(){return r.getEntry(t,e)})).next((function(t){var a=n.docVersions.get(e);Hd(null!==a),t.version.compareTo(a)<0&&(i.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))}))})),o.next((function(){return e.mutationQueue.removeMutationBatch(t,i)}))}(n,e,t,i).next((function(){return i.apply(e)})).next((function(){return n.mutationQueue.performConsistencyCheck(e)})).next((function(){return n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId)})).next((function(){return n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){for(var t=gy(),n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))})).next((function(){return n.localDocuments.getDocuments(e,r)}))}))}function eb(e){var t=Wd(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",(function(e){return t.Qr.getLastRemoteSnapshotVersion(e)}))}function tb(e,t){var n=Wd(e),r=t.snapshotVersion,i=n.ns;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(function(e){var a=n.os.newChangeBuffer({trackRemovals:!0});i=n.ns;var o=[];t.targetChanges.forEach((function(a,u){var s=i.get(u);if(s){o.push(n.Qr.removeMatchingKeys(e,a.removedDocuments,u).next((function(){return n.Qr.addMatchingKeys(e,a.addedDocuments,u)})));var c=s.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(u)?c=c.withResumeToken(Dv.EMPTY_BYTE_STRING,fp.min()).withLastLimboFreeSnapshotVersion(fp.min()):a.resumeToken.approximateByteSize()>0&&(c=c.withResumeToken(a.resumeToken,r)),i=i.insert(u,c),function(e,t,n){return 0===e.resumeToken.approximateByteSize()||(t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(s,c,a)&&o.push(n.Qr.updateTargetData(e,c))}}));var u=cy(),s=gy();if(t.documentUpdates.forEach((function(r){t.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))})),o.push(nb(e,a,t.documentUpdates).next((function(e){u=e.cs,s=e.ls}))),!r.isEqual(fp.min())){var c=n.Qr.getLastRemoteSnapshotVersion(e).next((function(t){return n.Qr.setTargetsMetadata(e,e.currentSequenceNumber,r)}));o.push(c)}return Np.waitFor(o).next((function(){return a.apply(e)})).next((function(){return n.localDocuments.getLocalViewOfDocuments(e,u,s)})).next((function(){return u}))})).then((function(e){return n.ns=i,e}))}function nb(e,t,n){var r=gy(),i=gy();return n.forEach((function(e){return r=r.add(e)})),t.getEntries(e,r).next((function(e){var r=cy();return n.forEach((function(n,a){var o=e.get(n);a.isFoundDocument()!==o.isFoundDocument()&&(i=i.add(n)),a.isNoDocument()&&a.version.isEqual(fp.min())?(t.removeEntry(n,a.readTime),r=r.insert(n,a)):!o.isValidDocument()||a.version.compareTo(o.version)>0||0===a.version.compareTo(o.version)&&o.hasPendingWrites?(t.addEntry(a),r=r.insert(n,a)):zd("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",a.version)})),{cs:r,ls:i}}))}function rb(e,t){var n=Wd(e);return n.persistence.runTransaction("Get next mutation batch","readonly",(function(e){return void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)}))}function ib(e,t){var n=Wd(e);return n.persistence.runTransaction("Allocate target","readwrite",(function(e){var r;return n.Qr.getTargetData(e,t).next((function(i){return i?(r=i,Np.resolve(r)):n.Qr.allocateTargetId(e).next((function(i){return r=new rk(t,i,"TargetPurposeListen",e.currentSequenceNumber),n.Qr.addTargetData(e,r).next((function(){return r}))}))}))})).then((function(e){var r=n.ns.get(e.targetId);return(null===r||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.ns=n.ns.insert(e.targetId,e),n.rs.set(t,e.targetId)),e}))}function ab(e,t,n){return ob.apply(this,arguments)}function ob(){return ob=u(a().mark((function e(t,n,r){var i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=Wd(t),o=i.ns.get(n),u=r?"readwrite":"readwrite-primary",e.prev=1,e.t0=r,e.t0){e.next=6;break}return e.next=6,i.persistence.runTransaction("Release target",u,(function(e){return i.persistence.referenceDelegate.removeTarget(e,o)}));case 6:e.next=13;break;case 8:if(e.prev=8,e.t1=e.catch(1),Lp(e.t1)){e.next=12;break}throw e.t1;case 12:zd("LocalStore","Failed to update sequence numbers for target ".concat(n,": ").concat(e.t1));case 13:i.ns=i.ns.remove(n),i.rs.delete(o.target);case 14:case"end":return e.stop()}}),e,null,[[1,8]])}))),ob.apply(this,arguments)}function ub(e,t,n){var r=Wd(e),i=fp.min(),a=gy();return r.persistence.runTransaction("Execute query","readwrite",(function(e){return function(e,t,n){var r=Wd(e),i=r.rs.get(n);return void 0!==i?Np.resolve(r.ns.get(i)):r.Qr.getTargetData(t,n)}(r,e,Jm(t)).next((function(t){if(t)return i=t.lastLimboFreeSnapshotVersion,r.Qr.getMatchingKeysForTargetId(e,t.targetId).next((function(e){a=e}))})).next((function(){return r.ts.getDocumentsMatchingQuery(e,t,n?i:fp.min(),n?a:gy())})).next((function(e){return lb(r,iy(t),e),{documents:e,hs:a}}))}))}function sb(e,t){var n=Wd(e),r=Wd(n.Qr),i=n.ns.get(t);return i?Promise.resolve(i.target):n.persistence.runTransaction("Get target data","readonly",(function(e){return r.ut(e,t).next((function(e){return e?e.target:null}))}))}function cb(e,t){var n=Wd(e),r=n.ss.get(t)||fp.min();return n.persistence.runTransaction("Get new document changes","readonly",(function(e){return n.os.getAllFromCollectionGroup(e,t,_p(r,-1),Number.MAX_SAFE_INTEGER)})).then((function(e){return lb(n,t,e),e}))}function lb(e,t,n){var r=e.ss.get(t)||fp.min();n.forEach((function(e,t){t.readTime.compareTo(r)>0&&(r=t.readTime)})),e.ss.set(t,r)}function fb(e,t,n,r){return hb.apply(this,arguments)}function hb(){return hb=u(a().mark((function e(t,n,r,i){var o,u,s,c,l,f,h,d,p,v;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=Wd(t),u=gy(),s=cy(),c=w(r);try{for(c.s();!(l=c.n()).done;)f=l.value,h=n.Ps(f.metadata.name),f.document&&(u=u.add(h)),(d=n.Is(f)).setReadTime(n.Ts(f.metadata.readTime)),s=s.insert(h,d)}catch(a){c.e(a)}finally{c.f()}return p=o.os.newChangeBuffer({trackRemovals:!0}),e.next=7,ib(o,function(e){return Jm(Hm(dp.fromString("__bundle__/docs/".concat(e))))}(i));case 7:return v=e.sent,e.abrupt("return",o.persistence.runTransaction("Apply bundle documents","readwrite",(function(e){return nb(e,p,s).next((function(t){return p.apply(e),t})).next((function(t){return o.Qr.removeMatchingKeysForTargetId(e,v.targetId).next((function(){return o.Qr.addMatchingKeys(e,u,v.targetId)})).next((function(){return o.localDocuments.getLocalViewOfDocuments(e,t.cs,t.ls)})).next((function(){return t.cs}))}))})));case 9:case"end":return e.stop()}}),e)}))),hb.apply(this,arguments)}function db(e,t){return pb.apply(this,arguments)}function pb(){return pb=u(a().mark((function e(t,n){var r,i,o,u=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.length>2&&void 0!==u[2]?u[2]:gy(),e.next=3,ib(t,Jm(hk(n.bundledQuery)));case 3:return i=e.sent,o=Wd(t),e.abrupt("return",o.persistence.runTransaction("Save named query","readwrite",(function(e){var t=Pg(n.readTime);if(i.snapshotVersion.compareTo(t)>=0)return o.$r.saveNamedQuery(e,n);var a=i.withResumeToken(Dv.EMPTY_BYTE_STRING,t);return o.ns=o.ns.insert(a.targetId,a),o.Qr.updateTargetData(e,a).next((function(){return o.Qr.removeMatchingKeysForTargetId(e,i.targetId)})).next((function(){return o.Qr.addMatchingKeys(e,r,i.targetId)})).next((function(){return o.$r.saveNamedQuery(e,n)}))})));case 6:case"end":return e.stop()}}),e)}))),pb.apply(this,arguments)}function vb(e,t){return"firestore_clients_".concat(e,"_").concat(t)}function mb(e,t,n){var r="firestore_mutations_".concat(e,"_").concat(n);return t.isAuthenticated()&&(r+="_".concat(t.uid)),r}function yb(e,t){return"firestore_targets_".concat(e,"_").concat(t)}var gb=function(){function e(t,n,r,i){y(this,e),this.user=t,this.batchId=n,this.state=r,this.error=i}return k(e,[{key:"ds",value:function(){var e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}}],[{key:"Es",value:function(t,n,r){var i,a=JSON.parse(r),o="object"==typeof a&&-1!==["pending","acknowledged","rejected"].indexOf(a.state)&&(void 0===a.error||"object"==typeof a.error);return o&&a.error&&((o="string"==typeof a.error.message&&"string"==typeof a.error.code)&&(i=new Yd(a.error.code,a.error.message))),o?new e(t,n,a.state,i):(Bd("SharedClientState","Failed to parse mutation state for ID '".concat(n,"': ").concat(r)),null)}}]),e}(),kb=function(){function e(t,n,r){y(this,e),this.targetId=t,this.state=n,this.error=r}return k(e,[{key:"ds",value:function(){var e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)}}],[{key:"Es",value:function(t,n){var r,i=JSON.parse(n),a="object"==typeof i&&-1!==["not-current","current","rejected"].indexOf(i.state)&&(void 0===i.error||"object"==typeof i.error);return a&&i.error&&((a="string"==typeof i.error.message&&"string"==typeof i.error.code)&&(r=new Yd(i.error.code,i.error.message))),a?new e(t,i.state,r):(Bd("SharedClientState","Failed to parse target state for ID '".concat(t,"': ").concat(n)),null)}}]),e}(),wb=function(){function e(t,n){y(this,e),this.clientId=t,this.activeTargetIds=n}return k(e,null,[{key:"Es",value:function(t,n){for(var r=JSON.parse(n),i="object"==typeof r&&r.activeTargetIds instanceof Array,a=wy(),o=0;i&&o<r.activeTargetIds.length;++o)i=Gp(r.activeTargetIds[o]),a=a.add(r.activeTargetIds[o]);return i?new e(t,a):(Bd("SharedClientState","Failed to parse client data for instance '".concat(t,"': ").concat(n)),null)}}]),e}(),bb=function(){function e(t,n){y(this,e),this.clientId=t,this.onlineState=n}return k(e,null,[{key:"Es",value:function(t){var n=JSON.parse(t);return"object"==typeof n&&-1!==["Unknown","Online","Offline"].indexOf(n.onlineState)&&"string"==typeof n.clientId?new e(n.clientId,n.onlineState):(Bd("SharedClientState","Failed to parse online state: ".concat(t)),null)}}]),e}(),_b=function(){function e(){y(this,e),this.activeTargetIds=wy()}return k(e,[{key:"As",value:function(e){this.activeTargetIds=this.activeTargetIds.add(e)}},{key:"Rs",value:function(e){this.activeTargetIds=this.activeTargetIds.delete(e)}},{key:"ds",value:function(){var e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}]),e}(),xb=function(){function e(t,n,r,i,a){y(this,e),this.window=t,this.oi=n,this.persistenceKey=r,this.Vs=i,this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null,this.fs=this.gs.bind(this),this.ps=new Tv(up),this.started=!1,this.ys=[];var o=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=a,this.ws=vb(this.persistenceKey,this.Vs),this.Ss=function(e){return"firestore_sequence_number_".concat(e)}(this.persistenceKey),this.ps=this.ps.insert(this.Vs,new _b),this.bs=new RegExp("^firestore_clients_".concat(o,"_([^_]*)$")),this.Ds=new RegExp("^firestore_mutations_".concat(o,"_(\\d+)(?:_(.*))?$")),this.Cs=new RegExp("^firestore_targets_".concat(o,"_(\\d+)$")),this.vs=function(e){return"firestore_online_state_".concat(e)}(this.persistenceKey),this.Fs=function(e){return"firestore_bundle_loaded_v2_".concat(e)}(this.persistenceKey),this.window.addEventListener("storage",this.fs)}return k(e,[{key:"start",value:function(){var e=u(a().mark((function e(){var t,n,r,i,o,u,s,c,l,f,h,d=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.syncEngine.Li();case 2:t=e.sent,n=w(t),e.prev=4,n.s();case 6:if((r=n.n()).done){e.next=14;break}if((i=r.value)!==this.Vs){e.next=10;break}return e.abrupt("continue",12);case 10:(o=this.getItem(vb(this.persistenceKey,i)))&&(u=wb.Es(i,o))&&(this.ps=this.ps.insert(u.clientId,u));case 12:e.next=6;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(4),n.e(e.t0);case 19:return e.prev=19,n.f(),e.finish(19);case 22:this.Ms(),(s=this.storage.getItem(this.vs))&&(c=this.xs(s))&&this.Os(c),l=w(this.ys);try{for(l.s();!(f=l.n()).done;)h=f.value,this.gs(h)}catch(a){l.e(a)}finally{l.f()}this.ys=[],this.window.addEventListener("pagehide",(function(){return d.shutdown()})),this.started=!0;case 28:case"end":return e.stop()}}),e,this,[[4,16,19,22]])})));return function(){return e.apply(this,arguments)}}()},{key:"writeSequenceNumber",value:function(e){this.setItem(this.Ss,JSON.stringify(e))}},{key:"getAllActiveQueryTargets",value:function(){return this.Ns(this.ps)}},{key:"isActiveQueryTarget",value:function(e){var t=!1;return this.ps.forEach((function(n,r){r.activeTargetIds.has(e)&&(t=!0)})),t}},{key:"addPendingMutation",value:function(e){this.Bs(e,"pending")}},{key:"updateMutationState",value:function(e,t,n){this.Bs(e,t,n),this.Ls(e)}},{key:"addLocalQueryTarget",value:function(e){var t="not-current";if(this.isActiveQueryTarget(e)){var n=this.storage.getItem(yb(this.persistenceKey,e));if(n){var r=kb.Es(e,n);r&&(t=r.state)}}return this.ks.As(e),this.Ms(),t}},{key:"removeLocalQueryTarget",value:function(e){this.ks.Rs(e),this.Ms()}},{key:"isLocalQueryTarget",value:function(e){return this.ks.activeTargetIds.has(e)}},{key:"clearQueryState",value:function(e){this.removeItem(yb(this.persistenceKey,e))}},{key:"updateQueryState",value:function(e,t,n){this.qs(e,t,n)}},{key:"handleUserChange",value:function(e,t,n){var r=this;t.forEach((function(e){r.Ls(e)})),this.currentUser=e,n.forEach((function(e){r.addPendingMutation(e)}))}},{key:"setOnlineState",value:function(e){this.Qs(e)}},{key:"notifyBundleLoaded",value:function(e){this.Ks(e)}},{key:"shutdown",value:function(){this.started&&(this.window.removeEventListener("storage",this.fs),this.removeItem(this.ws),this.started=!1)}},{key:"getItem",value:function(e){var t=this.storage.getItem(e);return zd("SharedClientState","READ",e,t),t}},{key:"setItem",value:function(e,t){zd("SharedClientState","SET",e,t),this.storage.setItem(e,t)}},{key:"removeItem",value:function(e){zd("SharedClientState","REMOVE",e),this.storage.removeItem(e)}},{key:"gs",value:function(e){var t=this,n=e;if(n.storageArea===this.storage){if(zd("SharedClientState","EVENT",n.key,n.newValue),n.key===this.ws)return void Bd("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.oi.enqueueRetryable(u(a().mark((function e(){var r,i,o,u,s,c,l;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.started){e.next=43;break}if(null===n.key){e.next=41;break}if(!t.bs.test(n.key)){e.next=11;break}if(null!=n.newValue){e.next=6;break}return r=t.$s(n.key),e.abrupt("return",t.Us(r,null));case 6:if(!(i=t.Ws(n.key,n.newValue))){e.next=9;break}return e.abrupt("return",t.Us(i.clientId,i));case 9:e.next=41;break;case 11:if(!t.Ds.test(n.key)){e.next=18;break}if(null===n.newValue){e.next=16;break}if(!(o=t.Gs(n.key,n.newValue))){e.next=16;break}return e.abrupt("return",t.zs(o));case 16:e.next=41;break;case 18:if(!t.Cs.test(n.key)){e.next=25;break}if(null===n.newValue){e.next=23;break}if(!(u=t.js(n.key,n.newValue))){e.next=23;break}return e.abrupt("return",t.Hs(u));case 23:e.next=41;break;case 25:if(n.key!==t.vs){e.next=32;break}if(null===n.newValue){e.next=30;break}if(!(s=t.xs(n.newValue))){e.next=30;break}return e.abrupt("return",t.Os(s));case 30:e.next=41;break;case 32:if(n.key!==t.Ss){e.next=37;break}c=function(e){var t=Bp.ae;if(null!=e)try{var n=JSON.parse(e);Hd("number"==typeof n),t=n}catch(e){Bd("SharedClientState","Failed to read sequence number from WebStorage",e)}return t}(n.newValue),c!==Bp.ae&&t.sequenceNumberHandler(c),e.next=41;break;case 37:if(n.key!==t.Fs){e.next=41;break}return l=t.Js(n.newValue),e.next=41,Promise.all(l.map((function(e){return t.syncEngine.Ys(e)})));case 41:e.next=44;break;case 43:t.ys.push(n);case 44:case"end":return e.stop()}}),e)}))))}}},{key:"ks",get:function(){return this.ps.get(this.Vs)}},{key:"Ms",value:function(){this.setItem(this.ws,this.ks.ds())}},{key:"Bs",value:function(e,t,n){var r=new gb(this.currentUser,e,t,n),i=mb(this.persistenceKey,this.currentUser,e);this.setItem(i,r.ds())}},{key:"Ls",value:function(e){var t=mb(this.persistenceKey,this.currentUser,e);this.removeItem(t)}},{key:"Qs",value:function(e){var t={clientId:this.Vs,onlineState:e};this.storage.setItem(this.vs,JSON.stringify(t))}},{key:"qs",value:function(e,t,n){var r=yb(this.persistenceKey,e),i=new kb(e,t,n);this.setItem(r,i.ds())}},{key:"Ks",value:function(e){var t=JSON.stringify(Array.from(e));this.setItem(this.Fs,t)}},{key:"$s",value:function(e){var t=this.bs.exec(e);return t?t[1]:null}},{key:"Ws",value:function(e,t){var n=this.$s(e);return wb.Es(n,t)}},{key:"Gs",value:function(e,t){var n=this.Ds.exec(e),r=Number(n[1]),i=void 0!==n[2]?n[2]:null;return gb.Es(new Fd(i),r,t)}},{key:"js",value:function(e,t){var n=this.Cs.exec(e),r=Number(n[1]);return kb.Es(r,t)}},{key:"xs",value:function(e){return bb.Es(e)}},{key:"Js",value:function(e){return JSON.parse(e)}},{key:"zs",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.user.uid!==this.currentUser.uid){e.next=2;break}return e.abrupt("return",this.syncEngine.Zs(t.batchId,t.state,t.error));case 2:zd("SharedClientState","Ignoring mutation for non-active user ".concat(t.user.uid));case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"Hs",value:function(e){return this.syncEngine.Xs(e.targetId,e.state,e.error)}},{key:"Us",value:function(e,t){var n=this,r=t?this.ps.insert(e,t):this.ps.remove(e),i=this.Ns(this.ps),a=this.Ns(r),o=[],u=[];return a.forEach((function(e){i.has(e)||o.push(e)})),i.forEach((function(e){a.has(e)||u.push(e)})),this.syncEngine.eo(o,u).then((function(){n.ps=r}))}},{key:"Os",value:function(e){this.ps.get(e.clientId)&&this.onlineStateHandler(e.onlineState)}},{key:"Ns",value:function(e){var t=wy();return e.forEach((function(e,n){t=t.unionWith(n.activeTargetIds)})),t}}],[{key:"C",value:function(e){return!(!e||!e.localStorage)}}]),e}(),Tb=function(){function e(){y(this,e),this.no=new _b,this.ro={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}return k(e,[{key:"addPendingMutation",value:function(e){}},{key:"updateMutationState",value:function(e,t,n){}},{key:"addLocalQueryTarget",value:function(e){return this.no.As(e),this.ro[e]||"not-current"}},{key:"updateQueryState",value:function(e,t,n){this.ro[e]=t}},{key:"removeLocalQueryTarget",value:function(e){this.no.Rs(e)}},{key:"isLocalQueryTarget",value:function(e){return this.no.activeTargetIds.has(e)}},{key:"clearQueryState",value:function(e){delete this.ro[e]}},{key:"getAllActiveQueryTargets",value:function(){return this.no.activeTargetIds}},{key:"isActiveQueryTarget",value:function(e){return this.no.activeTargetIds.has(e)}},{key:"start",value:function(){return this.no=new _b,Promise.resolve()}},{key:"handleUserChange",value:function(e,t,n){}},{key:"setOnlineState",value:function(e){}},{key:"shutdown",value:function(){}},{key:"writeSequenceNumber",value:function(e){}},{key:"notifyBundleLoaded",value:function(e){}}]),e}(),Ib=function(){function e(){y(this,e)}return k(e,[{key:"io",value:function(e){}},{key:"shutdown",value:function(){}}]),e}(),Eb=function(){function e(){var t=this;y(this,e),this.so=function(){return t.oo()},this._o=function(){return t.ao()},this.uo=[],this.co()}return k(e,[{key:"io",value:function(e){this.uo.push(e)}},{key:"shutdown",value:function(){window.removeEventListener("online",this.so),window.removeEventListener("offline",this._o)}},{key:"co",value:function(){window.addEventListener("online",this.so),window.addEventListener("offline",this._o)}},{key:"oo",value:function(){zd("ConnectivityMonitor","Network connectivity changed: AVAILABLE");var e,t=w(this.uo);try{for(t.s();!(e=t.n()).done;){(0,e.value)(0)}}catch(n){t.e(n)}finally{t.f()}}},{key:"ao",value:function(){zd("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");var e,t=w(this.uo);try{for(t.s();!(e=t.n()).done;){(0,e.value)(1)}}catch(n){t.e(n)}finally{t.f()}}}],[{key:"C",value:function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}]),e}(),Sb=null;function Cb(){return null===Sb?Sb=268435456+Math.round(2147483648*Math.random()):Sb++,"0x"+Sb.toString(16)}var Ab={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"},Nb=function(){function e(t){y(this,e),this.lo=t.lo,this.ho=t.ho}return k(e,[{key:"Po",value:function(e){this.Io=e}},{key:"To",value:function(e){this.Eo=e}},{key:"onMessage",value:function(e){this.Ao=e}},{key:"close",value:function(){this.ho()}},{key:"send",value:function(e){this.lo(e)}},{key:"Ro",value:function(){this.Io()}},{key:"Vo",value:function(e){this.Eo(e)}},{key:"mo",value:function(e){this.Ao(e)}}]),e}(),Pb="WebChannelConnection",Db=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this,e)).forceLongPolling=e.forceLongPolling,r.autoDetectLongPolling=e.autoDetectLongPolling,r.useFetchStreams=e.useFetchStreams,r.longPollingOptions=e.longPollingOptions,r}return k(n,[{key:"Co",value:function(e,t,n,r){var i=Cb();return new Promise((function(a,o){var u=new Rd;u.setWithCredentials(!0),u.listenOnce(Ad.COMPLETE,(function(){try{switch(u.getLastErrorCode()){case Cd.NO_ERROR:var t=u.getResponseJson();zd(Pb,"XHR for RPC '".concat(e,"' ").concat(i," received:"),JSON.stringify(t)),a(t);break;case Cd.TIMEOUT:zd(Pb,"RPC '".concat(e,"' ").concat(i," timed out")),o(new Yd(Qd.DEADLINE_EXCEEDED,"Request time out"));break;case Cd.HTTP_ERROR:var n=u.getStatus();if(zd(Pb,"RPC '".concat(e,"' ").concat(i," failed with status:"),n,"response text:",u.getResponseText()),n>0){var r=u.getResponseJson();Array.isArray(r)&&(r=r[0]);var s=null==r?void 0:r.error;if(s&&s.status&&s.message){var c=function(e){var t=e.toLowerCase().replace(/_/g,"-");return Object.values(Qd).indexOf(t)>=0?t:Qd.UNKNOWN}(s.status);o(new Yd(c,s.message))}else o(new Yd(Qd.UNKNOWN,"Server responded with status "+u.getStatus()))}else o(new Yd(Qd.UNAVAILABLE,"Connection failed."));break;default:Gd()}}finally{zd(Pb,"RPC '".concat(e,"' ").concat(i," completed."))}}));var s=JSON.stringify(r);zd(Pb,"RPC '".concat(e,"' ").concat(i," sending request:"),r),u.send(t,"POST",s,n,15)}))}},{key:"Fo",value:function(e,t,n){var r=Cb(),i=[this.fo,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=Ed(),o=Sd(),u={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/".concat(this.databaseId.projectId,"/databases/").concat(this.databaseId.database)},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},s=this.longPollingOptions.timeoutSeconds;void 0!==s&&(u.longPollingTimeout=Math.round(1e3*s)),this.useFetchStreams&&(u.useFetchStreams=!0),this.Do(u.initMessageHeaders,t,n),u.encodeInitMessageHeaders=!0;var c=i.join("");zd(Pb,"Creating RPC '".concat(e,"' stream ").concat(r,": ").concat(c),u);var l=a.createWebChannel(c,u),f=!1,h=!1,d=new Nb({lo:function(t){h?zd(Pb,"Not sending because RPC '".concat(e,"' stream ").concat(r," is closed:"),t):(f||(zd(Pb,"Opening RPC '".concat(e,"' stream ").concat(r," transport.")),l.open(),f=!0),zd(Pb,"RPC '".concat(e,"' stream ").concat(r," sending:"),t),l.send(t))},ho:function(){return l.close()}}),p=function(e,t,n){e.listen(t,(function(e){try{n(e)}catch(e){setTimeout((function(){throw e}),0)}}))};return p(l,Dd.EventType.OPEN,(function(){h||zd(Pb,"RPC '".concat(e,"' stream ").concat(r," transport opened."))})),p(l,Dd.EventType.CLOSE,(function(){h||(h=!0,zd(Pb,"RPC '".concat(e,"' stream ").concat(r," transport closed")),d.Vo())})),p(l,Dd.EventType.ERROR,(function(t){h||(h=!0,qd(Pb,"RPC '".concat(e,"' stream ").concat(r," transport errored:"),t),d.Vo(new Yd(Qd.UNAVAILABLE,"The operation could not be completed")))})),p(l,Dd.EventType.MESSAGE,(function(t){var n;if(!h){var i=t.data[0];Hd(!!i);var a=i,o=a.error||(null===(n=a[0])||void 0===n?void 0:n.error);if(o){zd(Pb,"RPC '".concat(e,"' stream ").concat(r," received error:"),o);var u=o.status,s=function(e){var t=Xy[e];if(void 0!==t)return og(t)}(u),c=o.message;void 0===s&&(s=Qd.INTERNAL,c="Unknown error status: "+u+" with message "+o.message),h=!0,d.Vo(new Yd(s,c)),l.close()}else zd(Pb,"RPC '".concat(e,"' stream ").concat(r," received:"),i),d.mo(i)}})),p(o,Nd.STAT_EVENT,(function(t){t.stat===Pd.PROXY?zd(Pb,"RPC '".concat(e,"' stream ").concat(r," detected buffering proxy")):t.stat===Pd.NOPROXY&&zd(Pb,"RPC '".concat(e,"' stream ").concat(r," detected no buffering proxy"))})),setTimeout((function(){d.Ro()}),0),d}}]),n}(function(){function e(t){y(this,e),this.databaseInfo=t,this.databaseId=t.databaseId;var n=t.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.fo=n+"://"+t.host,this.po="projects/".concat(r,"/databases/").concat(i),this.yo="(default)"===this.databaseId.database?"project_id=".concat(r):"project_id=".concat(r,"&database_id=").concat(i)}return k(e,[{key:"wo",get:function(){return!1}},{key:"So",value:function(e,t,n,r,i){var a=Cb(),o=this.bo(e,t);zd("RestConnection","Sending RPC '".concat(e,"' ").concat(a,":"),o,n);var u={"google-cloud-resource-prefix":this.po,"x-goog-request-params":this.yo};return this.Do(u,r,i),this.Co(e,o,u,n).then((function(t){return zd("RestConnection","Received RPC '".concat(e,"' ").concat(a,": "),t),t}),(function(t){throw qd("RestConnection","RPC '".concat(e,"' ").concat(a," failed with error: "),t,"url: ",o,"request:",n),t}))}},{key:"vo",value:function(e,t,n,r,i,a){return this.So(e,t,n,r,i)}},{key:"Do",value:function(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+Vd,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((function(t,n){return e[n]=t})),n&&n.headers.forEach((function(t,n){return e[n]=t}))}},{key:"bo",value:function(e,t){var n=Ab[e];return"".concat(this.fo,"/v1/").concat(t,":").concat(n)}}]),e}());function Rb(){return"undefined"!=typeof window?window:null}function Ob(){return"undefined"!=typeof document?document:null}function Lb(e){return new Eg(e,!0)}var Mb=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.5,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:6e4;y(this,e),this.oi=t,this.timerId=n,this.Mo=r,this.xo=i,this.Oo=a,this.No=0,this.Bo=null,this.Lo=Date.now(),this.reset()}return k(e,[{key:"reset",value:function(){this.No=0}},{key:"ko",value:function(){this.No=this.Oo}},{key:"qo",value:function(e){var t=this;this.cancel();var n=Math.floor(this.No+this.Qo()),r=Math.max(0,Date.now()-this.Lo),i=Math.max(0,n-r);i>0&&zd("ExponentialBackoff","Backing off for ".concat(i," ms (base delay: ").concat(this.No," ms, delay with jitter: ").concat(n," ms, last attempt: ").concat(r," ms ago)")),this.Bo=this.oi.enqueueAfterDelay(this.timerId,i,(function(){return t.Lo=Date.now(),e()})),this.No*=this.xo,this.No<this.Mo&&(this.No=this.Mo),this.No>this.Oo&&(this.No=this.Oo)}},{key:"Ko",value:function(){null!==this.Bo&&(this.Bo.skipDelay(),this.Bo=null)}},{key:"cancel",value:function(){null!==this.Bo&&(this.Bo.cancel(),this.Bo=null)}},{key:"Qo",value:function(){return(Math.random()-.5)*this.No}}]),e}(),Fb=function(){function e(t,n,r,i,a,o,u,s){y(this,e),this.oi=t,this.$o=r,this.Uo=i,this.connection=a,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=u,this.listener=s,this.state=0,this.Wo=0,this.Go=null,this.zo=null,this.stream=null,this.jo=new Mb(t,n)}return k(e,[{key:"Ho",value:function(){return 1===this.state||5===this.state||this.Jo()}},{key:"Jo",value:function(){return 2===this.state||3===this.state}},{key:"start",value:function(){4!==this.state?this.auth():this.Yo()}},{key:"stop",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.Ho(),!e.t0){e.next=4;break}return e.next=4,this.close(0);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"Zo",value:function(){this.state=0,this.jo.reset()}},{key:"Xo",value:function(){var e=this;this.Jo()&&null===this.Go&&(this.Go=this.oi.enqueueAfterDelay(this.$o,6e4,(function(){return e.e_()})))}},{key:"t_",value:function(e){this.n_(),this.stream.send(e)}},{key:"e_",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.Jo()){e.next=2;break}return e.abrupt("return",this.close(0));case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"n_",value:function(){this.Go&&(this.Go.cancel(),this.Go=null)}},{key:"r_",value:function(){this.zo&&(this.zo.cancel(),this.zo=null)}},{key:"close",value:function(){var e=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.n_(),this.r_(),this.jo.cancel(),this.Wo++,4!==t?this.jo.reset():n&&n.code===Qd.RESOURCE_EXHAUSTED?(Bd(n.toString()),Bd("Using maximum backoff delay to prevent overloading the backend."),this.jo.ko()):n&&n.code===Qd.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.i_(),this.stream.close(),this.stream=null),this.state=t,e.next=9,this.listener.To(n);case 9:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"i_",value:function(){}},{key:"auth",value:function(){var e=this;this.state=1;var t=this.s_(this.Wo),n=this.Wo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((function(t){var r=m(t,2),i=r[0],a=r[1];e.Wo===n&&e.o_(i,a)}),(function(n){t((function(){var t=new Yd(Qd.UNKNOWN,"Fetching auth token failed: "+n.message);return e.__(t)}))}))}},{key:"o_",value:function(e,t){var n=this,r=this.s_(this.Wo);this.stream=this.a_(e,t),this.stream.Po((function(){r((function(){return n.state=2,n.zo=n.oi.enqueueAfterDelay(n.Uo,1e4,(function(){return n.Jo()&&(n.state=3),Promise.resolve()})),n.listener.Po()}))})),this.stream.To((function(e){r((function(){return n.__(e)}))})),this.stream.onMessage((function(e){r((function(){return n.onMessage(e)}))}))}},{key:"Yo",value:function(){var e=this;this.state=5,this.jo.qo(u(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.state=0,e.start();case 1:case"end":return t.stop()}}),t)}))))}},{key:"__",value:function(e){return zd("PersistentStream","close with error: ".concat(e)),this.stream=null,this.close(4,e)}},{key:"s_",value:function(e){var t=this;return function(n){t.oi.enqueueAndForget((function(){return t.Wo===e?n():(zd("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())}))}}}]),e}(),Vb=function(e){x(n,e);var t=E(n);function n(e,r,i,a,o,u){var s;return y(this,n),(s=t.call(this,e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",r,i,a,u)).serializer=o,s}return k(n,[{key:"a_",value:function(e,t){return this.connection.Fo("Listen",e,t)}},{key:"onMessage",value:function(e){this.jo.reset();var t=function(e,t){var n;if("targetChange"in t){t.targetChange;var r=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:Gd()}(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],a=function(e,t){return e.useProto3Json?(Hd(void 0===t||"string"==typeof t),Dv.fromBase64String(t||"")):(Hd(void 0===t||t instanceof Uint8Array),Dv.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,u=o&&function(e){var t=void 0===e.code?Qd.UNKNOWN:og(e.code);return new Yd(t,e.message||"")}(o);n=new gg(r,i,a,u||null)}else if("documentChange"in t){t.documentChange;var s=t.documentChange;s.document,s.document.name,s.document.updateTime;var c=Lg(e,s.document.name),l=Pg(s.document.updateTime),f=s.document.createTime?Pg(s.document.createTime):fp.min(),h=new cm({mapValue:{fields:s.document.fields}}),d=fm.newFoundDocument(c,l,f,h),p=s.targetIds||[],v=s.removedTargetIds||[];n=new mg(p,v,d.key,d)}else if("documentDelete"in t){t.documentDelete;var m=t.documentDelete;m.document;var y=Lg(e,m.document),g=m.readTime?Pg(m.readTime):fp.min(),k=fm.newNoDocument(y,g),w=m.removedTargetIds||[];n=new mg([],w,k.key,k)}else if("documentRemove"in t){t.documentRemove;var b=t.documentRemove;b.document;var _=Lg(e,b.document),x=b.removedTargetIds||[];n=new mg([],x,_,null)}else{if(!("filter"in t))return Gd();t.filter;var T=t.filter;T.targetId;var I=T.count,E=void 0===I?0:I,S=T.unchangedNames,C=new ig(E,S),A=T.targetId;n=new yg(A,C)}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return fp.min();var t=e.targetChange;return t.targetIds&&t.targetIds.length?fp.min():t.readTime?Pg(t.readTime):fp.min()}(e);return this.listener.u_(t,n)}},{key:"c_",value:function(e){var t={};t.database=Vg(this.serializer),t.addTarget=function(e,t){var n,r=t.target;if((n=jm(r)?{documents:Gg(e,r)}:{query:Hg(e,r)}).targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=Ag(e,t.resumeToken);var i=Sg(e,t.expectedCount);null!==i&&(n.expectedCount=i)}else if(t.snapshotVersion.compareTo(fp.min())>0){n.readTime=Cg(e,t.snapshotVersion.toTimestamp());var a=Sg(e,t.expectedCount);null!==a&&(n.expectedCount=a)}return n}(this.serializer,e);var n=function(e,t){var n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Gd()}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.t_(t)}},{key:"l_",value:function(e){var t={};t.database=Vg(this.serializer),t.removeTarget=e,this.t_(t)}}]),n}(Fb),Ub=function(e){x(n,e);var t=E(n);function n(e,r,i,a,o,u){var s;return y(this,n),(s=t.call(this,e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",r,i,a,u)).serializer=o,s.h_=!1,s}return k(n,[{key:"P_",get:function(){return this.h_}},{key:"start",value:function(){this.h_=!1,this.lastStreamToken=void 0,Ot(T(n.prototype),"start",this).call(this)}},{key:"i_",value:function(){this.h_&&this.I_([])}},{key:"a_",value:function(e,t){return this.connection.Fo("Write",e,t)}},{key:"onMessage",value:function(e){if(Hd(!!e.streamToken),this.lastStreamToken=e.streamToken,this.h_){this.jo.reset();var t=function(e,t){return e&&e.length>0?(Hd(void 0!==t),e.map((function(e){return function(e,t){var n=e.updateTime?Pg(e.updateTime):Pg(t);return n.isEqual(fp.min())&&(n=Pg(t)),new Fy(n,e.transformResults||[])}(e,t)}))):[]}(e.writeResults,e.commitTime),n=Pg(e.commitTime);return this.listener.T_(n,t)}return Hd(!e.writeResults||0===e.writeResults.length),this.h_=!0,this.listener.E_()}},{key:"d_",value:function(){var e={};e.database=Vg(this.serializer),this.t_(e)}},{key:"I_",value:function(e){var t=this,n={streamToken:this.lastStreamToken,writes:e.map((function(e){return qg(t.serializer,e)}))};this.t_(n)}}]),n}(Fb),jb=function(e){x(n,e);var t=E(n);function n(e,r,i,a){var o;return y(this,n),(o=t.call(this)).authCredentials=e,o.appCheckCredentials=r,o.connection=i,o.serializer=a,o.A_=!1,o}return k(n,[{key:"R_",value:function(){if(this.A_)throw new Yd(Qd.FAILED_PRECONDITION,"The client has already been terminated.")}},{key:"So",value:function(e,t,n){var r=this;return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((function(i){var a=m(i,2),o=a[0],u=a[1];return r.connection.So(e,t,n,o,u)})).catch((function(e){throw"FirebaseError"===e.name?(e.code===Qd.UNAUTHENTICATED&&(r.authCredentials.invalidateToken(),r.appCheckCredentials.invalidateToken()),e):new Yd(Qd.UNKNOWN,e.toString())}))}},{key:"vo",value:function(e,t,n,r){var i=this;return this.R_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((function(a){var o=m(a,2),u=o[0],s=o[1];return i.connection.vo(e,t,n,u,s,r)})).catch((function(e){throw"FirebaseError"===e.name?(e.code===Qd.UNAUTHENTICATED&&(i.authCredentials.invalidateToken(),i.appCheckCredentials.invalidateToken()),e):new Yd(Qd.UNKNOWN,e.toString())}))}},{key:"terminate",value:function(){this.A_=!0}}]),n}(k((function e(){y(this,e)})));var zb=function(){function e(t,n){y(this,e),this.asyncQueue=t,this.onlineStateHandler=n,this.state="Unknown",this.m_=0,this.f_=null,this.g_=!0}return k(e,[{key:"p_",value:function(){var e=this;0===this.m_&&(this.y_("Unknown"),this.f_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(function(){return e.f_=null,e.w_("Backend didn't respond within 10 seconds."),e.y_("Offline"),Promise.resolve()})))}},{key:"S_",value:function(e){"Online"===this.state?this.y_("Unknown"):(this.m_++,this.m_>=1&&(this.b_(),this.w_("Connection failed 1 times. Most recent error: ".concat(e.toString())),this.y_("Offline")))}},{key:"set",value:function(e){this.b_(),this.m_=0,"Online"===e&&(this.g_=!1),this.y_(e)}},{key:"y_",value:function(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}},{key:"w_",value:function(e){var t="Could not reach Cloud Firestore backend. ".concat(e,"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.");this.g_?(Bd(t),this.g_=!1):zd("OnlineStateTracker",t)}},{key:"b_",value:function(){null!==this.f_&&(this.f_.cancel(),this.f_=null)}}]),e}(),Bb=k((function e(t,n,r,i,o){var s=this;y(this,e),this.localStore=t,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.D_=[],this.C_=new Map,this.v_=new Set,this.F_=[],this.M_=o,this.M_.io((function(e){r.enqueueAndForget(u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=Zb(s),!e.t0){e.next=5;break}return zd("RemoteStore","Restarting streams for network reachability change."),e.next=5,function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=Wd(t)).v_.add(4),e.next=4,Gb(n);case 4:return n.x_.set("Unknown"),n.v_.delete(4),e.next=8,qb(n);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()(s);case 5:case"end":return e.stop()}}),e)}))))})),this.x_=new zb(r,i)}));function qb(e){return Kb.apply(this,arguments)}function Kb(){return(Kb=u(a().mark((function e(t){var n,r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Zb(t)){e.next=18;break}n=w(t.F_),e.prev=2,n.s();case 4:if((r=n.n()).done){e.next=10;break}return i=r.value,e.next=8,i(!0);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),n.e(e.t0);case 15:return e.prev=15,n.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[2,12,15,18]])})))).apply(this,arguments)}function Gb(e){return Hb.apply(this,arguments)}function Hb(){return(Hb=u(a().mark((function e(t){var n,r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=w(t.F_),e.prev=1,n.s();case 3:if((r=n.n()).done){e.next=9;break}return i=r.value,e.next=7,i(!1);case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),n.e(e.t0);case 14:return e.prev=14,n.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])})))).apply(this,arguments)}function Wb(e,t){var n=Wd(e);n.C_.has(t.targetId)||(n.C_.set(t.targetId,t),$b(n)?Xb(n):C_(n).Jo()&&Yb(n,t))}function Qb(e,t){var n=Wd(e),r=C_(n);n.C_.delete(t),r.Jo()&&Jb(n,t),0===n.C_.size&&(r.Jo()?r.Xo():Zb(n)&&n.x_.set("Unknown"))}function Yb(e,t){if(e.O_.Ne(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(fp.min())>0){var n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}C_(e).c_(t)}function Jb(e,t){e.O_.Ne(t),C_(e).l_(t)}function Xb(e){e.O_=new wg({getRemoteKeysForTarget:function(t){return e.remoteSyncer.getRemoteKeysForTarget(t)},ut:function(t){return e.C_.get(t)||null},rt:function(){return e.datastore.serializer.databaseId}}),C_(e).start(),e.x_.p_()}function $b(e){return Zb(e)&&!C_(e).Ho()&&e.C_.size>0}function Zb(e){return 0===Wd(e).v_.size}function e_(e){e.O_=void 0}function t_(e){return n_.apply(this,arguments)}function n_(){return(n_=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.C_.forEach((function(e,n){Yb(t,e)}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function r_(e,t){return i_.apply(this,arguments)}function i_(){return(i_=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e_(t),$b(t)?(t.x_.S_(n),Xb(t)):t.x_.set("Unknown");case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function a_(e,t,n){return o_.apply(this,arguments)}function o_(){return o_=u(a().mark((function e(t,n,r){var i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.x_.set("Online"),!(n instanceof gg&&2===n.state&&n.cause)){e.next=13;break}return e.prev=1,e.next=4,function(){var e=u(a().mark((function e(t,n){var r,i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.cause,i=w(n.targetIds),e.prev=2,i.s();case 4:if((o=i.n()).done){e.next=14;break}if(u=o.value,e.t0=t.C_.has(u),!e.t0){e.next=12;break}return e.next=10,t.remoteSyncer.rejectListen(u,r);case 10:t.C_.delete(u),t.O_.removeTarget(u);case 12:e.next=4;break;case 14:e.next=19;break;case 16:e.prev=16,e.t1=e.catch(2),i.e(e.t1);case 19:return e.prev=19,i.f(),e.finish(19);case 22:case"end":return e.stop()}}),e,null,[[2,16,19,22]])})));return function(t,n){return e.apply(this,arguments)}}()(t,n);case 4:e.next=11;break;case 6:return e.prev=6,e.t0=e.catch(1),zd("RemoteStore","Failed to remove targets %s: %s ",n.targetIds.join(","),e.t0),e.next=11,u_(t,e.t0);case 11:case 22:e.next=29;break;case 13:if(n instanceof mg?t.O_.Ue(n):n instanceof yg?t.O_.Ye(n):t.O_.ze(n),r.isEqual(fp.min())){e.next=29;break}return e.prev=14,e.next=17,eb(t.localStore);case 17:if(i=e.sent,e.t1=r.compareTo(i)>=0,!e.t1){e.next=22;break}return e.next=22,function(e,t){var n=e.O_.st(t);return n.targetChanges.forEach((function(n,r){if(n.resumeToken.approximateByteSize()>0){var i=e.C_.get(r);i&&e.C_.set(r,i.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach((function(t,n){var r=e.C_.get(t);if(r){e.C_.set(t,r.withResumeToken(Dv.EMPTY_BYTE_STRING,r.snapshotVersion)),Jb(e,t);var i=new rk(r.target,t,n,r.sequenceNumber);Yb(e,i)}})),e.remoteSyncer.applyRemoteEvent(n)}(t,r);case 24:return e.prev=24,e.t2=e.catch(14),zd("RemoteStore","Failed to raise snapshot:",e.t2),e.next=29,u_(t,e.t2);case 29:case"end":return e.stop()}}),e,null,[[1,6],[14,24]])}))),o_.apply(this,arguments)}function u_(e,t,n){return s_.apply(this,arguments)}function s_(){return(s_=u(a().mark((function e(t,n,r){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Lp(n)){e.next=2;break}throw n;case 2:return t.v_.add(1),e.next=5,Gb(t);case 5:t.x_.set("Offline"),r||(r=function(){return eb(t.localStore)}),t.asyncQueue.enqueueRetryable(u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zd("RemoteStore","Retrying IndexedDB access"),e.next=3,r();case 3:return t.v_.delete(1),e.next=6,qb(t);case 6:case"end":return e.stop()}}),e)}))));case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function c_(e,t){return t().catch((function(n){return u_(e,n,t)}))}function l_(e){return f_.apply(this,arguments)}function f_(){return f_=u(a().mark((function e(t){var n,r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Wd(t),r=A_(n),i=n.D_.length>0?n.D_[n.D_.length-1].batchId:-1;case 2:if(!h_(n)){e.next=19;break}return e.prev=3,e.next=6,rb(n.localStore,i);case 6:if(null!==(o=e.sent)){e.next=10;break}return 0===n.D_.length&&r.Xo(),e.abrupt("break",19);case 10:i=o.batchId,d_(n,o),e.next=17;break;case 13:return e.prev=13,e.t0=e.catch(3),e.next=17,u_(n,e.t0);case 17:e.next=2;break;case 19:p_(n)&&v_(n);case 20:case"end":return e.stop()}}),e,null,[[3,13]])}))),f_.apply(this,arguments)}function h_(e){return Zb(e)&&e.D_.length<10}function d_(e,t){e.D_.push(t);var n=A_(e);n.Jo()&&n.P_&&n.I_(t.mutations)}function p_(e){return Zb(e)&&!A_(e).Ho()&&e.D_.length>0}function v_(e){A_(e).start()}function m_(e){return y_.apply(this,arguments)}function y_(){return(y_=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:A_(t).d_();case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g_(e){return k_.apply(this,arguments)}function k_(){return(k_=u(a().mark((function e(t){var n,r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=A_(t),r=w(t.D_);try{for(r.s();!(i=r.n()).done;)o=i.value,n.I_(o.mutations)}catch(a){r.e(a)}finally{r.f()}case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function w_(e,t,n){return b_.apply(this,arguments)}function b_(){return b_=u(a().mark((function e(t,n,r){var i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.D_.shift(),o=ng.from(i,n,r),e.next=3,c_(t,(function(){return t.remoteSyncer.applySuccessfulWrite(o)}));case 3:return e.next=5,l_(t);case 5:case"end":return e.stop()}}),e)}))),b_.apply(this,arguments)}function __(e,t){return x_.apply(this,arguments)}function x_(){return x_=u(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=n&&A_(t).P_,!e.t0){e.next=4;break}return e.next=4,function(){var e=u(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!function(e){return ag(e)&&e!==Qd.ABORTED}(n.code)){e.next=7;break}return r=t.D_.shift(),A_(t).Zo(),e.next=5,c_(t,(function(){return t.remoteSyncer.rejectFailedWrite(r.batchId,n)}));case 5:return e.next=7,l_(t);case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()(t,n);case 4:p_(t)&&v_(t);case 5:case"end":return e.stop()}}),e)}))),x_.apply(this,arguments)}function T_(e,t){return I_.apply(this,arguments)}function I_(){return I_=u(a().mark((function e(t,n){var r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=Wd(t)).asyncQueue.verifyOperationInProgress(),zd("RemoteStore","RemoteStore received new credentials"),i=Zb(r),r.v_.add(3),e.next=6,Gb(r);case 6:return i&&r.x_.set("Unknown"),e.next=9,r.remoteSyncer.handleCredentialChange(n);case 9:return r.v_.delete(3),e.next=12,qb(r);case 12:case"end":return e.stop()}}),e)}))),I_.apply(this,arguments)}function E_(e,t){return S_.apply(this,arguments)}function S_(){return(S_=u(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Wd(t),!n){e.next=7;break}return r.v_.delete(2),e.next=5,qb(r);case 5:e.next=13;break;case 7:if(e.t0=n,e.t0){e.next=13;break}return r.v_.add(2),e.next=12,Gb(r);case 12:r.x_.set("Unknown");case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C_(e){return e.N_||(e.N_=function(e,t,n){var r=Wd(e);return r.R_(),new Vb(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Po:t_.bind(null,e),To:r_.bind(null,e),u_:a_.bind(null,e)}),e.F_.push(function(){var t=u(a().mark((function t(n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=4;break}e.N_.Zo(),$b(e)?Xb(e):e.x_.set("Unknown"),t.next=7;break;case 4:return t.next=6,e.N_.stop();case 6:e_(e);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())),e.N_}function A_(e){return e.B_||(e.B_=function(e,t,n){var r=Wd(e);return r.R_(),new Ub(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Po:m_.bind(null,e),To:__.bind(null,e),E_:g_.bind(null,e),T_:w_.bind(null,e)}),e.F_.push(function(){var t=u(a().mark((function t(n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=6;break}return e.B_.Zo(),t.next=4,l_(e);case 4:t.next=9;break;case 6:return t.next=8,e.B_.stop();case 8:e.D_.length>0&&(zd("RemoteStore","Stopping write stream with ".concat(e.D_.length," pending writes")),e.D_=[]);case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())),e.B_}var N_=function(){function e(t,n,r,i,a){y(this,e),this.asyncQueue=t,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=a,this.deferred=new Jd,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((function(e){}))}return k(e,[{key:"promise",get:function(){return this.deferred.promise}},{key:"start",value:function(e){var t=this;this.timerHandle=setTimeout((function(){return t.handleDelayElapsed()}),e)}},{key:"skipDelay",value:function(){return this.handleDelayElapsed()}},{key:"cancel",value:function(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Yd(Qd.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}},{key:"handleDelayElapsed",value:function(){var e=this;this.asyncQueue.enqueueAndForget((function(){return null!==e.timerHandle?(e.clearTimeout(),e.op().then((function(t){return e.deferred.resolve(t)}))):Promise.resolve()}))}},{key:"clearTimeout",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}))}],[{key:"createAndSchedule",value:function(t,n,r,i,a){var o=new e(t,n,Date.now()+r,i,a);return o.start(r),o}}]),e}();function P_(e,t){if(Bd("AsyncQueue","".concat(t,": ").concat(e)),Lp(e))return new Yd(Qd.UNAVAILABLE,"".concat(t,": ").concat(e));throw e}var D_=function(){function e(t){y(this,e),this.comparator=t?function(e,n){return t(e,n)||mp.comparator(e.key,n.key)}:function(e,t){return mp.comparator(e.key,t.key)},this.keyedMap=fy(),this.sortedSet=new Tv(this.comparator)}return k(e,[{key:"has",value:function(e){return null!=this.keyedMap.get(e)}},{key:"get",value:function(e){return this.keyedMap.get(e)}},{key:"first",value:function(){return this.sortedSet.minKey()}},{key:"last",value:function(){return this.sortedSet.maxKey()}},{key:"isEmpty",value:function(){return this.sortedSet.isEmpty()}},{key:"indexOf",value:function(e){var t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}},{key:"size",get:function(){return this.sortedSet.size}},{key:"forEach",value:function(e){this.sortedSet.inorderTraversal((function(t,n){return e(t),!1}))}},{key:"add",value:function(e){var t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}},{key:"delete",value:function(e){var t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}},{key:"isEqual",value:function(t){if(!(t instanceof e))return!1;if(this.size!==t.size)return!1;for(var n=this.sortedSet.getIterator(),r=t.sortedSet.getIterator();n.hasNext();){var i=n.getNext().key,a=r.getNext().key;if(!i.isEqual(a))return!1}return!0}},{key:"toString",value:function(){var e=[];return this.forEach((function(t){e.push(t.toString())})),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}},{key:"copy",value:function(t,n){var r=new e;return r.comparator=this.comparator,r.keyedMap=t,r.sortedSet=n,r}}],[{key:"emptySet",value:function(t){return new e(t.comparator)}}]),e}(),R_=function(){function e(){y(this,e),this.L_=new Tv(mp.comparator)}return k(e,[{key:"track",value:function(e){var t=e.doc.key,n=this.L_.get(t);n?0!==e.type&&3===n.type?this.L_=this.L_.insert(t,e):3===e.type&&1!==n.type?this.L_=this.L_.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.L_=this.L_.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.L_=this.L_.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.L_=this.L_.remove(t):1===e.type&&2===n.type?this.L_=this.L_.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.L_=this.L_.insert(t,{type:2,doc:e.doc}):Gd():this.L_=this.L_.insert(t,e)}},{key:"k_",value:function(){var e=[];return this.L_.inorderTraversal((function(t,n){e.push(n)})),e}}]),e}(),O_=function(){function e(t,n,r,i,a,o,u,s,c){y(this,e),this.query=t,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=a,this.fromCache=o,this.syncStateChanged=u,this.excludesMetadataChanges=s,this.hasCachedResults=c}return k(e,[{key:"hasPendingWrites",get:function(){return!this.mutatedKeys.isEmpty()}},{key:"isEqual",value:function(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&ey(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;var t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(var r=0;r<t.length;r++)if(t[r].type!==n[r].type||!t[r].doc.isEqual(n[r].doc))return!1;return!0}}],[{key:"fromInitialDocuments",value:function(t,n,r,i,a){var o=[];return n.forEach((function(e){o.push({type:0,doc:e})})),new e(t,n,D_.emptySet(n),o,r,i,!0,!1,a)}}]),e}(),L_=k((function e(){y(this,e),this.q_=void 0,this.listeners=[]})),M_=k((function e(){y(this,e),this.queries=new uy((function(e){return ty(e)}),ey),this.onlineState="Unknown",this.Q_=new Set}));function F_(e,t){return V_.apply(this,arguments)}function V_(){return V_=u(a().mark((function e(t,n){var r,i,o,u,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Wd(t),i=n.query,o=!1,(u=r.queries.get(i))||(o=!0,u=new L_),!o){e.next=13;break}return e.prev=3,e.next=6,r.onListen(i);case 6:u.q_=e.sent,e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(3),s=P_(e.t0,"Initialization of query '".concat(ny(n.query),"' failed")),e.abrupt("return",void n.onError(s));case 13:r.queries.set(i,u),u.listeners.push(n),n.K_(r.onlineState),u.q_&&n.U_(u.q_)&&q_(r);case 14:case"end":return e.stop()}}),e,null,[[3,9]])}))),V_.apply(this,arguments)}function U_(e,t){return j_.apply(this,arguments)}function j_(){return j_=u(a().mark((function e(t,n){var r,i,o,u,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Wd(t),i=n.query,o=!1,(u=r.queries.get(i))&&(s=u.listeners.indexOf(n))>=0&&(u.listeners.splice(s,1),o=0===u.listeners.length),!o){e.next=6;break}return e.abrupt("return",(r.queries.delete(i),r.onUnlisten(i)));case 6:case"end":return e.stop()}}),e)}))),j_.apply(this,arguments)}function z_(e,t){var n,r=Wd(e),i=!1,a=w(t);try{for(a.s();!(n=a.n()).done;){var o=n.value,u=o.query,s=r.queries.get(u);if(s){var c,l=w(s.listeners);try{for(l.s();!(c=l.n()).done;){c.value.U_(o)&&(i=!0)}}catch(f){l.e(f)}finally{l.f()}s.q_=o}}}catch(f){a.e(f)}finally{a.f()}i&&q_(r)}function B_(e,t,n){var r=Wd(e),i=r.queries.get(t);if(i){var a,o=w(i.listeners);try{for(o.s();!(a=o.n()).done;){a.value.onError(n)}}catch(u){o.e(u)}finally{o.f()}}r.queries.delete(t)}function q_(e){e.Q_.forEach((function(e){e.next()}))}var K_=function(){function e(t,n,r){y(this,e),this.query=t,this.W_=n,this.G_=!1,this.z_=null,this.onlineState="Unknown",this.options=r||{}}return k(e,[{key:"U_",value:function(e){if(!this.options.includeMetadataChanges){var t,n=[],r=w(e.docChanges);try{for(r.s();!(t=r.n()).done;){var i=t.value;3!==i.type&&n.push(i)}}catch(o){r.e(o)}finally{r.f()}e=new O_(e.query,e.docs,e.oldDocs,n,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}var a=!1;return this.G_?this.j_(e)&&(this.W_.next(e),a=!0):this.H_(e,this.onlineState)&&(this.J_(e),a=!0),this.z_=e,a}},{key:"onError",value:function(e){this.W_.error(e)}},{key:"K_",value:function(e){this.onlineState=e;var t=!1;return this.z_&&!this.G_&&this.H_(this.z_,e)&&(this.J_(this.z_),t=!0),t}},{key:"H_",value:function(e,t){if(!e.fromCache)return!0;var n="Offline"!==t;return(!this.options.Y_||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}},{key:"j_",value:function(e){if(e.docChanges.length>0)return!0;var t=this.z_&&this.z_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}},{key:"J_",value:function(e){e=O_.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.G_=!0,this.W_.next(e)}}]),e}(),G_=function(){function e(t,n){y(this,e),this.Z_=t,this.byteLength=n}return k(e,[{key:"X_",value:function(){return"metadata"in this.Z_}}]),e}(),H_=function(){function e(t){y(this,e),this.serializer=t}return k(e,[{key:"Ps",value:function(e){return Lg(this.serializer,e)}},{key:"Is",value:function(e){return e.metadata.exists?zg(this.serializer,e.document,!1):fm.newNoDocument(this.Ps(e.metadata.name),this.Ts(e.metadata.readTime))}},{key:"Ts",value:function(e){return Pg(e)}}]),e}(),W_=function(){function e(t,n,r){y(this,e),this.ea=t,this.localStore=n,this.serializer=r,this.queries=[],this.documents=[],this.collectionGroups=new Set,this.progress=Q_(t)}return k(e,[{key:"ta",value:function(e){this.progress.bytesLoaded+=e.byteLength;var t=this.progress.documentsLoaded;if(e.Z_.namedQuery)this.queries.push(e.Z_.namedQuery);else if(e.Z_.documentMetadata){this.documents.push({metadata:e.Z_.documentMetadata}),e.Z_.documentMetadata.exists||++t;var n=dp.fromString(e.Z_.documentMetadata.name);this.collectionGroups.add(n.get(n.length-2))}else e.Z_.document&&(this.documents[this.documents.length-1].document=e.Z_.document,++t);return t!==this.progress.documentsLoaded?(this.progress.documentsLoaded=t,Object.assign({},this.progress)):null}},{key:"na",value:function(e){var t,n=new Map,r=new H_(this.serializer),i=w(e);try{for(i.s();!(t=i.n()).done;){var a=t.value;if(a.metadata.queries){var o,u=r.Ps(a.metadata.name),s=w(a.metadata.queries);try{for(s.s();!(o=s.n()).done;){var c=o.value,l=(n.get(c)||gy()).add(u);n.set(c,l)}}catch(f){s.e(f)}finally{s.f()}}}}catch(f){i.e(f)}finally{i.f()}return n}},{key:"complete",value:function(){var e=u(a().mark((function e(){var t,n,r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fb(this.localStore,new H_(this.serializer),this.documents,this.ea.id);case 2:t=e.sent,n=this.na(this.documents),r=w(this.queries),e.prev=5,r.s();case 7:if((i=r.n()).done){e.next=13;break}return o=i.value,e.next=11,db(this.localStore,o,n.get(o.name));case 11:e.next=7;break;case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(5),r.e(e.t0);case 18:return e.prev=18,r.f(),e.finish(18);case 21:return e.abrupt("return",(this.progress.taskState="Success",{progress:this.progress,ra:this.collectionGroups,ia:t}));case 22:case"end":return e.stop()}}),e,this,[[5,15,18,21]])})));return function(){return e.apply(this,arguments)}}()}]),e}();function Q_(e){return{taskState:"Running",documentsLoaded:0,bytesLoaded:0,totalDocuments:e.totalDocuments,totalBytes:e.totalBytes}}var Y_=k((function e(t){y(this,e),this.key=t})),J_=k((function e(t){y(this,e),this.key=t})),X_=function(){function e(t,n){y(this,e),this.query=t,this.sa=n,this.oa=null,this.hasCachedResults=!1,this.current=!1,this._a=gy(),this.mutatedKeys=gy(),this.aa=ay(t),this.ua=new D_(this.aa)}return k(e,[{key:"ca",get:function(){return this.sa}},{key:"la",value:function(e,t){var n=this,r=t?t.ha:new R_,i=t?t.ua:this.ua,a=t?t.mutatedKeys:this.mutatedKeys,o=i,u=!1,s="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,c="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((function(e,t){var l=i.get(e),f=ry(n.query,t)?t:null,h=!!l&&n.mutatedKeys.has(l.key),d=!!f&&(f.hasLocalMutations||n.mutatedKeys.has(f.key)&&f.hasCommittedMutations),p=!1;l&&f?l.data.isEqual(f.data)?h!==d&&(r.track({type:3,doc:f}),p=!0):n.Pa(l,f)||(r.track({type:2,doc:f}),p=!0,(s&&n.aa(f,s)>0||c&&n.aa(f,c)<0)&&(u=!0)):!l&&f?(r.track({type:0,doc:f}),p=!0):l&&!f&&(r.track({type:1,doc:l}),p=!0,(s||c)&&(u=!0)),p&&(f?(o=o.add(f),a=d?a.add(e):a.delete(e)):(o=o.delete(e),a=a.delete(e)))})),null!==this.query.limit)for(;o.size>this.query.limit;){var l="F"===this.query.limitType?o.last():o.first();o=o.delete(l.key),a=a.delete(l.key),r.track({type:1,doc:l})}return{ua:o,ha:r,Xi:u,mutatedKeys:a}}},{key:"Pa",value:function(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}},{key:"applyChanges",value:function(e,t,n){var r=this,i=this.ua;this.ua=e.ua,this.mutatedKeys=e.mutatedKeys;var a=e.ha.k_();a.sort((function(e,t){return function(e,t){var n=function(e){switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Gd()}};return n(e)-n(t)}(e.type,t.type)||r.aa(e.doc,t.doc)})),this.Ia(n);var o=t?this.Ta():[],u=0===this._a.size&&this.current?1:0,s=u!==this.oa;return this.oa=u,0!==a.length||s?{snapshot:new O_(this.query,e.ua,i,a,e.mutatedKeys,0===u,s,!1,!!n&&n.resumeToken.approximateByteSize()>0),Ea:o}:{Ea:o}}},{key:"K_",value:function(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({ua:this.ua,ha:new R_,mutatedKeys:this.mutatedKeys,Xi:!1},!1)):{Ea:[]}}},{key:"da",value:function(e){return!this.sa.has(e)&&!!this.ua.has(e)&&!this.ua.get(e).hasLocalMutations}},{key:"Ia",value:function(e){var t=this;e&&(e.addedDocuments.forEach((function(e){return t.sa=t.sa.add(e)})),e.modifiedDocuments.forEach((function(e){})),e.removedDocuments.forEach((function(e){return t.sa=t.sa.delete(e)})),this.current=e.current)}},{key:"Ta",value:function(){var e=this;if(!this.current)return[];var t=this._a;this._a=gy(),this.ua.forEach((function(t){e.da(t.key)&&(e._a=e._a.add(t.key))}));var n=[];return t.forEach((function(t){e._a.has(t)||n.push(new J_(t))})),this._a.forEach((function(e){t.has(e)||n.push(new Y_(e))})),n}},{key:"Aa",value:function(e){this.sa=e.hs,this._a=gy();var t=this.la(e.documents);return this.applyChanges(t,!0)}},{key:"Ra",value:function(){return O_.fromInitialDocuments(this.query,this.ua,this.mutatedKeys,0===this.oa,this.hasCachedResults)}}]),e}(),$_=k((function e(t,n,r){y(this,e),this.query=t,this.targetId=n,this.view=r})),Z_=k((function e(t){y(this,e),this.key=t,this.Va=!1})),ex=function(){function e(t,n,r,i,a,o){y(this,e),this.localStore=t,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=a,this.maxConcurrentLimboResolutions=o,this.ma={},this.fa=new uy((function(e){return ty(e)}),ey),this.ga=new Map,this.pa=new Set,this.ya=new Tv(mp.comparator),this.wa=new Map,this.Sa=new Nw,this.ba={},this.Da=new Map,this.Ca=aw.Bn(),this.onlineState="Unknown",this.va=void 0}return k(e,[{key:"isPrimaryClient",get:function(){return!0===this.va}}]),e}();function tx(e,t){return nx.apply(this,arguments)}function nx(){return nx=u(a().mark((function e(t,n){var r,i,o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Qx(t),!(u=r.fa.get(n))){e.next=6;break}i=u.targetId,r.sharedClientState.addLocalQueryTarget(i),o=u.view.Ra(),e.next=15;break;case 6:return e.next=8,ib(r.localStore,Jm(n));case 8:return s=e.sent,c=r.sharedClientState.addLocalQueryTarget(s.targetId),i=s.targetId,e.next=13,rx(r,n,i,"current"===c,s.resumeToken);case 13:o=e.sent,r.isPrimaryClient&&Wb(r.remoteStore,s);case 15:return e.abrupt("return",o);case 16:case"end":return e.stop()}}),e)}))),nx.apply(this,arguments)}function rx(e,t,n,r,i){return ix.apply(this,arguments)}function ix(){return ix=u(a().mark((function e(t,n,r,i,o){var s,c,l,f,h,d;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.Fa=function(e,n,r){return function(){var e=u(a().mark((function e(t,n,r,i){var o,u,s;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=n.view.la(r),e.t0=o.Xi,!e.t0){e.next=6;break}return e.next=5,ub(t.localStore,n.query,!1).then((function(e){var t=e.documents;return n.view.la(t,o)}));case 5:o=e.sent;case 6:return u=i&&i.targetChanges.get(n.targetId),s=n.view.applyChanges(o,t.isPrimaryClient,u),e.abrupt("return",(Tx(t,n.targetId,s.Ea),s.snapshot));case 8:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}()(t,e,n,r)},e.next=3,ub(t.localStore,n,!0);case 3:return s=e.sent,c=new X_(n,s.hs),l=c.la(s.documents),f=vg.createSynthesizedTargetChangeForCurrentChange(r,i&&"Offline"!==t.onlineState,o),h=c.applyChanges(l,t.isPrimaryClient,f),Tx(t,r,h.Ea),d=new $_(n,r,c),e.abrupt("return",(t.fa.set(n,d),t.ga.has(r)?t.ga.get(r).push(n):t.ga.set(r,[n]),h.snapshot));case 11:case"end":return e.stop()}}),e)}))),ix.apply(this,arguments)}function ax(e,t){return ox.apply(this,arguments)}function ox(){return ox=u(a().mark((function e(t,n){var r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Wd(t),i=r.fa.get(n),!((o=r.ga.get(i.targetId)).length>1)){e.next=3;break}return e.abrupt("return",(r.ga.set(i.targetId,o.filter((function(e){return!ey(e,n)}))),void r.fa.delete(n)));case 3:if(!r.isPrimaryClient){e.next=11;break}if(r.sharedClientState.removeLocalQueryTarget(i.targetId),e.t0=r.sharedClientState.isActiveQueryTarget(i.targetId),e.t0){e.next=9;break}return e.next=9,ab(r.localStore,i.targetId,!1).then((function(){r.sharedClientState.clearQueryState(i.targetId),Qb(r.remoteStore,i.targetId),_x(r,i.targetId)})).catch(Cp);case 9:e.next=14;break;case 11:return _x(r,i.targetId),e.next=14,ab(r.localStore,i.targetId,!0);case 14:case"end":return e.stop()}}),e)}))),ox.apply(this,arguments)}function ux(e,t,n){return sx.apply(this,arguments)}function sx(){return sx=u(a().mark((function e(t,n,r){var i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Yx(t),e.prev=1,e.next=4,function(e,t){var n,r,i=Wd(e),a=lp.now(),o=t.reduce((function(e,t){return e.add(t.key)}),gy());return i.persistence.runTransaction("Locally write mutations","readwrite",(function(e){var u=cy(),s=gy();return i.os.getEntries(e,o).next((function(e){(u=e).forEach((function(e,t){t.isValidDocument()||(s=s.add(e))}))})).next((function(){return i.localDocuments.getOverlayedDocuments(e,u)})).next((function(r){n=r;var o,u=[],s=w(t);try{for(s.s();!(o=s.n()).done;){var c=o.value,l=Ky(c,n.get(c.key).overlayedDocument);null!=l&&u.push(new Wy(c.key,l,lm(l.value.mapValue),Vy.exists(!0)))}}catch(f){s.e(f)}finally{s.f()}return i.mutationQueue.addMutationBatch(e,a,u,t)})).next((function(t){r=t;var a=t.applyToLocalDocumentSet(n,s);return i.documentOverlayCache.saveOverlays(e,t.batchId,a)}))})).then((function(){return{batchId:r.batchId,changes:hy(n)}}))}(i.localStore,n);case 4:return o=e.sent,i.sharedClientState.addPendingMutation(o.batchId),function(e,t,n){var r=e.ba[e.currentUser.toKey()];r||(r=new Tv(up)),r=r.insert(t,n),e.ba[e.currentUser.toKey()]=r}(i,o.batchId,r),e.next=9,Sx(i,o.changes);case 9:return e.next=11,l_(i.remoteStore);case 11:e.next=17;break;case 13:e.prev=13,e.t0=e.catch(1),u=P_(e.t0,"Failed to persist write"),r.reject(u);case 17:case"end":return e.stop()}}),e,null,[[1,13]])}))),sx.apply(this,arguments)}function cx(e,t){return lx.apply(this,arguments)}function lx(){return lx=u(a().mark((function e(t,n){var r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Wd(t),e.prev=1,e.next=4,tb(r.localStore,n);case 4:return i=e.sent,n.targetChanges.forEach((function(e,t){var n=r.wa.get(t);n&&(Hd(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1),e.addedDocuments.size>0?n.Va=!0:e.modifiedDocuments.size>0?Hd(n.Va):e.removedDocuments.size>0&&(Hd(n.Va),n.Va=!1))})),e.next=8,Sx(r,i,n);case 8:e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(1),e.next=14,Cp(e.t0);case 14:case"end":return e.stop()}}),e,null,[[1,10]])}))),lx.apply(this,arguments)}function fx(e,t,n){var r=Wd(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){var i=[];r.fa.forEach((function(e,n){var r=n.view.K_(t);r.snapshot&&i.push(r.snapshot)})),function(e,t){var n=Wd(e);n.onlineState=t;var r=!1;n.queries.forEach((function(e,n){var i,a=w(n.listeners);try{for(a.s();!(i=a.n()).done;){i.value.K_(t)&&(r=!0)}}catch(o){a.e(o)}finally{a.f()}})),r&&q_(n)}(r.eventManager,t),i.length&&r.ma.u_(i),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}function hx(e,t,n){return dx.apply(this,arguments)}function dx(){return dx=u(a().mark((function e(t,n,r){var i,o,u,s,c,l;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((i=Wd(t)).sharedClientState.updateQueryState(n,"rejected",r),o=i.wa.get(n),!(u=o&&o.key)){e.next=14;break}return s=(s=new Tv(mp.comparator)).insert(u,fm.newNoDocument(u,fp.min())),c=gy().add(u),l=new pg(fp.min(),new Map,new Tv(up),s,c),e.next=9,cx(i,l);case 9:i.ya=i.ya.remove(u),i.wa.delete(n),Ex(i),e.next=16;break;case 14:return e.next=16,ab(i.localStore,n,!1).then((function(){return _x(i,n,r)})).catch(Cp);case 16:case"end":return e.stop()}}),e)}))),dx.apply(this,arguments)}function px(e,t){return vx.apply(this,arguments)}function vx(){return vx=u(a().mark((function e(t,n){var r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Wd(t),i=n.batch.batchId,e.prev=1,e.next=4,Zw(r.localStore,n);case 4:return o=e.sent,bx(r,i,null),wx(r,i),r.sharedClientState.updateMutationState(i,"acknowledged"),e.next=10,Sx(r,o);case 10:e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(1),e.next=16,Cp(e.t0);case 16:case"end":return e.stop()}}),e,null,[[1,12]])}))),vx.apply(this,arguments)}function mx(e,t,n){return yx.apply(this,arguments)}function yx(){return yx=u(a().mark((function e(t,n,r){var i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Wd(t),e.prev=1,e.next=4,function(e,t){var n=Wd(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",(function(e){var r;return n.mutationQueue.lookupMutationBatch(e,t).next((function(t){return Hd(null!==t),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t)})).next((function(){return n.mutationQueue.performConsistencyCheck(e)})).next((function(){return n.documentOverlayCache.removeOverlaysForBatchId(e,r,t)})).next((function(){return n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r)})).next((function(){return n.localDocuments.getDocuments(e,r)}))}))}(i.localStore,n);case 4:return o=e.sent,bx(i,n,r),wx(i,n),i.sharedClientState.updateMutationState(n,"rejected",r),e.next=10,Sx(i,o);case 10:e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(1),e.next=16,Cp(e.t0);case 16:case"end":return e.stop()}}),e,null,[[1,12]])}))),yx.apply(this,arguments)}function gx(e,t){return kx.apply(this,arguments)}function kx(){return kx=u(a().mark((function e(t,n){var r,i,o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zb((r=Wd(t)).remoteStore)||zd("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."),e.prev=2,e.next=5,function(e){var t=Wd(e);return t.persistence.runTransaction("Get highest unacknowledged batch id","readonly",(function(e){return t.mutationQueue.getHighestUnacknowledgedBatchId(e)}))}(r.localStore);case 5:if(-1!==(i=e.sent)){e.next=8;break}return e.abrupt("return",void n.resolve());case 8:(o=r.Da.get(i)||[]).push(n),r.Da.set(i,o),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(2),u=P_(e.t0,"Initialization of waitForPendingWrites() operation failed"),n.reject(u);case 16:case"end":return e.stop()}}),e,null,[[2,12]])}))),kx.apply(this,arguments)}function wx(e,t){(e.Da.get(t)||[]).forEach((function(e){e.resolve()})),e.Da.delete(t)}function bx(e,t,n){var r=Wd(e),i=r.ba[r.currentUser.toKey()];if(i){var a=i.get(t);a&&(n?a.reject(n):a.resolve(),i=i.remove(t)),r.ba[r.currentUser.toKey()]=i}}function _x(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.sharedClientState.removeLocalQueryTarget(t);var r,i=w(e.ga.get(t));try{for(i.s();!(r=i.n()).done;){var a=r.value;e.fa.delete(a),n&&e.ma.Ma(a,n)}}catch(o){i.e(o)}finally{i.f()}e.ga.delete(t),e.isPrimaryClient&&e.Sa.Vr(t).forEach((function(t){e.Sa.containsKey(t)||xx(e,t)}))}function xx(e,t){e.pa.delete(t.path.canonicalString());var n=e.ya.get(t);null!==n&&(Qb(e.remoteStore,n),e.ya=e.ya.remove(t),e.wa.delete(n),Ex(e))}function Tx(e,t,n){var r,i=w(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;a instanceof Y_?(e.Sa.addReference(a.key,t),Ix(e,a)):a instanceof J_?(zd("SyncEngine","Document no longer in limbo: "+a.key),e.Sa.removeReference(a.key,t),e.Sa.containsKey(a.key)||xx(e,a.key)):Gd()}}catch(o){i.e(o)}finally{i.f()}}function Ix(e,t){var n=t.key,r=n.path.canonicalString();e.ya.get(n)||e.pa.has(r)||(zd("SyncEngine","New document in limbo: "+n),e.pa.add(r),Ex(e))}function Ex(e){for(;e.pa.size>0&&e.ya.size<e.maxConcurrentLimboResolutions;){var t=e.pa.values().next().value;e.pa.delete(t);var n=new mp(dp.fromString(t)),r=e.Ca.next();e.wa.set(r,new Z_(n)),e.ya=e.ya.insert(n,r),Wb(e.remoteStore,new rk(Jm(Hm(n.path)),r,"TargetPurposeLimboResolution",Bp.ae))}}function Sx(e,t,n){return Cx.apply(this,arguments)}function Cx(){return Cx=u(a().mark((function e(t,n,r){var i,o,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=Wd(t),o=[],s=[],c=[],e.t0=i.fa.isEmpty(),e.t0){e.next=9;break}return i.fa.forEach((function(e,t){c.push(i.Fa(t,n,r).then((function(e){if((e||r)&&i.isPrimaryClient&&i.sharedClientState.updateQueryState(t.targetId,(null==e?void 0:e.fromCache)?"not-current":"current"),e){o.push(e);var n=Hw.Ki(t.targetId,e);s.push(n)}})))})),e.next=6,Promise.all(c);case 6:return i.ma.u_(o),e.next=9,function(){var e=u(a().mark((function e(t,n){var r,i,o,u,s,c,l,f;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Wd(t),e.prev=1,e.next=4,r.persistence.runTransaction("notifyLocalViewChanges","readwrite",(function(e){return Np.forEach(n,(function(t){return Np.forEach(t.qi,(function(n){return r.persistence.referenceDelegate.addReference(e,t.targetId,n)})).next((function(){return Np.forEach(t.Qi,(function(n){return r.persistence.referenceDelegate.removeReference(e,t.targetId,n)}))}))}))}));case 4:e.next=11;break;case 6:if(e.prev=6,e.t0=e.catch(1),Lp(e.t0)){e.next=10;break}throw e.t0;case 10:zd("LocalStore","Failed to update sequence numbers: "+e.t0);case 11:i=w(n);try{for(i.s();!(o=i.n()).done;)u=o.value,s=u.targetId,u.fromCache||(c=r.ns.get(s),l=c.snapshotVersion,f=c.withLastLimboFreeSnapshotVersion(l),r.ns=r.ns.insert(s,f))}catch(a){i.e(a)}finally{i.f()}case 13:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(t,n){return e.apply(this,arguments)}}()(i.localStore,s);case 9:case"end":return e.stop()}}),e)}))),Cx.apply(this,arguments)}function Ax(e,t){return Nx.apply(this,arguments)}function Nx(){return(Nx=u(a().mark((function e(t,n){var r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=Wd(t)).currentUser.isEqual(n)){e.next=11;break}return zd("SyncEngine","User change. New user:",n.toKey()),e.next=5,Xw(r.localStore,n);case 5:return i=e.sent,r.currentUser=n,function(e,t){e.Da.forEach((function(e){e.forEach((function(e){e.reject(new Yd(Qd.CANCELLED,t))}))})),e.Da.clear()}(r,"'waitForPendingWrites' promise is rejected due to a user change."),r.sharedClientState.handleUserChange(n,i.removedBatchIds,i.addedBatchIds),e.next=11,Sx(r,i.us);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Px(e,t){var n=Wd(e),r=n.wa.get(t);if(r&&r.Va)return gy().add(r.key);var i=gy(),a=n.ga.get(t);if(!a)return i;var o,u=w(a);try{for(u.s();!(o=u.n()).done;){var s=o.value,c=n.fa.get(s);i=i.unionWith(c.view.ca)}}catch(l){u.e(l)}finally{u.f()}return i}function Dx(e,t){return Rx.apply(this,arguments)}function Rx(){return Rx=u(a().mark((function e(t,n){var r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Wd(t),e.next=3,ub(r.localStore,n.query,!0);case 3:return i=e.sent,o=n.view.Aa(i),e.abrupt("return",(r.isPrimaryClient&&Tx(r,n.targetId,o.Ea),o));case 6:case"end":return e.stop()}}),e)}))),Rx.apply(this,arguments)}function Ox(e,t){return Lx.apply(this,arguments)}function Lx(){return(Lx=u(a().mark((function e(t,n){var r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Wd(t),e.abrupt("return",cb(r.localStore,n).then((function(e){return Sx(r,e)})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Mx(e,t,n,r){return Fx.apply(this,arguments)}function Fx(){return Fx=u(a().mark((function e(t,n,r,i){var o,u;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=Wd(t),e.next=3,function(e,t){var n=Wd(e),r=Wd(n.mutationQueue);return n.persistence.runTransaction("Lookup mutation documents","readonly",(function(e){return r.vn(e,t).next((function(t){return t?n.localDocuments.getDocuments(e,t):Np.resolve(null)}))}))}(o.localStore,n);case 3:if(null===(u=e.sent)){e.next=15;break}if("pending"!==r){e.next=10;break}return e.next=8,l_(o.remoteStore);case 8:e.next=11;break;case 10:"acknowledged"===r||"rejected"===r?(bx(o,n,i||null),wx(o,n),function(e,t){Wd(Wd(e).mutationQueue).Mn(t)}(o.localStore,n)):Gd();case 11:return e.next=13,Sx(o,u);case 13:e.next=16;break;case 15:zd("SyncEngine","Cannot apply mutation batch with id: "+n);case 16:case"end":return e.stop()}}),e)}))),Fx.apply(this,arguments)}function Vx(e,t){return Ux.apply(this,arguments)}function Ux(){return(Ux=u(a().mark((function e(t,n){var r,i,o,u,s,c,l,f;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Qx(r=Wd(t)),Yx(r),!0!==n||!0===r.va){e.next=13;break}return i=r.sharedClientState.getAllActiveQueryTargets(),e.next=5,jx(r,i.toArray());case 5:return o=e.sent,r.va=!0,e.next=9,E_(r.remoteStore,!0);case 9:u=w(o);try{for(u.s();!(s=u.n()).done;)c=s.value,Wb(r.remoteStore,c)}catch(a){u.e(a)}finally{u.f()}e.next=25;break;case 13:if(!1!==n||!1===r.va){e.next=25;break}return l=[],f=Promise.resolve(),r.ga.forEach((function(e,t){r.sharedClientState.isLocalQueryTarget(t)?l.push(t):f=f.then((function(){return _x(r,t),ab(r.localStore,t,!0)})),Qb(r.remoteStore,t)})),e.next=19,f;case 19:return e.next=21,jx(r,l);case 21:return function(e){var t=Wd(e);t.wa.forEach((function(e,n){Qb(t.remoteStore,n)})),t.Sa.mr(),t.wa=new Map,t.ya=new Tv(mp.comparator)}(r),r.va=!1,e.next=25,E_(r.remoteStore,!1);case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function jx(e,t,n){return zx.apply(this,arguments)}function zx(){return zx=u(a().mark((function e(t,n,r){var i,o,u,s,c,l,f,h,d,p,v,m,y,g;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=Wd(t),o=[],u=[],s=w(n),e.prev=2,s.s();case 4:if((c=s.n()).done){e.next=45;break}if(l=c.value,f=void 0,!(h=i.ga.get(l))||0===h.length){e.next=34;break}return e.next=11,ib(i.localStore,Jm(h[0]));case 11:f=e.sent,d=w(h),e.prev=13,d.s();case 15:if((p=d.n()).done){e.next=24;break}return v=p.value,m=i.fa.get(v),e.next=20,Dx(i,m);case 20:(y=e.sent).snapshot&&u.push(y.snapshot);case 22:e.next=15;break;case 24:e.next=29;break;case 26:e.prev=26,e.t0=e.catch(13),d.e(e.t0);case 29:return e.prev=29,d.f(),e.finish(29);case 32:e.next=42;break;case 34:return e.next=36,sb(i.localStore,l);case 36:return g=e.sent,e.next=39,ib(i.localStore,g);case 39:return f=e.sent,e.next=42,rx(i,Bx(g),l,!1,f.resumeToken);case 42:o.push(f);case 43:e.next=4;break;case 45:e.next=50;break;case 47:e.prev=47,e.t1=e.catch(2),s.e(e.t1);case 50:return e.prev=50,s.f(),e.finish(50);case 53:return e.abrupt("return",(i.ma.u_(u),o));case 54:case"end":return e.stop()}}),e,null,[[2,47,50,53],[13,26,29,32]])}))),zx.apply(this,arguments)}function Bx(e){return Gm(e.path,e.collectionGroup,e.orderBy,e.filters,e.limit,"F",e.startAt,e.endAt)}function qx(e){return function(e){return Wd(Wd(e).persistence).Li()}(Wd(e).localStore)}function Kx(e,t,n,r){return Gx.apply(this,arguments)}function Gx(){return Gx=u(a().mark((function e(t,n,r,i){var o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(o=Wd(t)).va){e.next=3;break}return e.abrupt("return",void zd("SyncEngine","Ignoring unexpected query state notification."));case 3:if(!((u=o.ga.get(n))&&u.length>0)){e.next=20;break}e.t0=r,e.next="current"===e.t0||"not-current"===e.t0?8:"rejected"===e.t0?15:19;break;case 8:return e.next=10,cb(o.localStore,iy(u[0]));case 10:return s=e.sent,c=pg.createSynthesizedRemoteEventForCurrentChange(n,"current"===r,Dv.EMPTY_BYTE_STRING),e.next=14,Sx(o,s,c);case 14:return e.abrupt("break",20);case 15:return e.next=17,ab(o.localStore,n,!0);case 17:return _x(o,n,i),e.abrupt("break",20);case 19:Gd();case 20:case"end":return e.stop()}}),e)}))),Gx.apply(this,arguments)}function Hx(e,t,n){return Wx.apply(this,arguments)}function Wx(){return Wx=u(a().mark((function e(t,n,r){var i,o,u,s,c,l,f,h,d;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=Qx(t)).va){e.next=45;break}o=w(n),e.prev=3,o.s();case 5:if((u=o.n()).done){e.next=21;break}if(s=u.value,!i.ga.has(s)){e.next=10;break}return zd("SyncEngine","Adding an already active target "+s),e.abrupt("continue",19);case 10:return e.next=12,sb(i.localStore,s);case 12:return c=e.sent,e.next=15,ib(i.localStore,c);case 15:return l=e.sent,e.next=18,rx(i,Bx(c),l.targetId,!1,l.resumeToken);case 18:Wb(i.remoteStore,l);case 19:e.next=5;break;case 21:e.next=26;break;case 23:e.prev=23,e.t0=e.catch(3),o.e(e.t0);case 26:return e.prev=26,o.f(),e.finish(26);case 29:f=w(r),e.prev=30,d=a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=h.value,e.t0=i.ga.has(t),!e.t0){e.next=5;break}return e.next=5,ab(i.localStore,t,!1).then((function(){Qb(i.remoteStore,t),_x(i,t)})).catch(Cp);case 5:case"end":return e.stop()}}),e)})),f.s();case 33:if((h=f.n()).done){e.next=37;break}return e.delegateYield(d(),"t1",35);case 35:e.next=33;break;case 37:e.next=42;break;case 39:e.prev=39,e.t2=e.catch(30),f.e(e.t2);case 42:return e.prev=42,f.f(),e.finish(42);case 45:case"end":return e.stop()}}),e,null,[[3,23,26,29],[30,39,42,45]])}))),Wx.apply(this,arguments)}function Qx(e){var t=Wd(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=cx.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Px.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=hx.bind(null,t),t.ma.u_=z_.bind(null,t.eventManager),t.ma.Ma=B_.bind(null,t.eventManager),t}function Yx(e){var t=Wd(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=px.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=mx.bind(null,t),t}function Jx(e,t,n){var r=Wd(e);(function(){var e=u(a().mark((function e(t,n,r){var i,o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n.getMetadata();case 3:return i=e.sent,e.next=6,function(e,t){var n=Wd(e),r=Pg(t.createTime);return n.persistence.runTransaction("hasNewerBundle","readonly",(function(e){return n.$r.getBundleMetadata(e,t.id)})).then((function(e){return!!e&&e.createTime.compareTo(r)>=0}))}(t.localStore,i);case 6:if(!e.sent){e.next=11;break}return e.next=9,n.close();case 9:return r._completeWith(function(e){return{taskState:"Success",documentsLoaded:e.totalDocuments,bytesLoaded:e.totalBytes,totalDocuments:e.totalDocuments,totalBytes:e.totalBytes}}(i)),e.abrupt("return",Promise.resolve(new Set));case 11:return r._updateProgress(Q_(i)),o=new W_(i,t.localStore,n.serializer),e.next=15,n.xa();case 15:u=e.sent;case 16:if(!u){e.next=26;break}return e.next=19,o.ta(u);case 19:return(s=e.sent)&&r._updateProgress(s),e.next=23,n.xa();case 23:u=e.sent;case 24:e.next=16;break;case 26:return e.next=28,o.complete();case 28:return c=e.sent,e.next=31,Sx(t,c.ia,void 0);case 31:return e.next=33,function(e,t){var n=Wd(e);return n.persistence.runTransaction("Save bundle","readwrite",(function(e){return n.$r.saveBundleMetadata(e,t)}))}(t.localStore,i);case 33:return r._completeWith(c.progress),e.abrupt("return",Promise.resolve(c.ra));case 37:return e.prev=37,e.t0=e.catch(0),e.abrupt("return",(qd("SyncEngine","Loading bundle failed with ".concat(e.t0)),r._failWith(e.t0),Promise.resolve(new Set)));case 40:case"end":return e.stop()}}),e,null,[[0,37]])})));return function(t,n,r){return e.apply(this,arguments)}})()(r,t,n).then((function(e){r.sharedClientState.notifyBundleLoaded(e)}))}var Xx=function(){function e(){y(this,e),this.synchronizeTabs=!1}return k(e,[{key:"initialize",value:function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.serializer=Lb(t.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(t),this.persistence=this.createPersistence(t),e.next=5,this.persistence.start();case 5:this.localStore=this.createLocalStore(t),this.gcScheduler=this.createGarbageCollectionScheduler(t,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(t,this.localStore);case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"createGarbageCollectionScheduler",value:function(e,t){return null}},{key:"createIndexBackfillerScheduler",value:function(e,t){return null}},{key:"createLocalStore",value:function(e){return Jw(this.persistence,new Qw,e.initialUser,this.serializer)}},{key:"createPersistence",value:function(e){return new Mw(Vw.Hr,this.serializer)}},{key:"createSharedClientState",value:function(e){return new Tb}},{key:"terminate",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.gcScheduler&&this.gcScheduler.stop(),e.next=3,this.sharedClientState.shutdown();case 3:return e.next=5,this.persistence.shutdown();case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()}]),e}(),$x=function(e){x(n,e);var t=E(n);function n(e,r,i){var a;return y(this,n),(a=t.call(this)).Oa=e,a.cacheSizeBytes=r,a.forceOwnership=i,a.synchronizeTabs=!1,a}return k(n,[{key:"initialize",value:function(){var e=u(a().mark((function e(t){var r=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ot(T(n.prototype),"initialize",this).call(this,t);case 2:return e.next=4,this.Oa.initialize(this,t);case 4:return e.next=6,Yx(this.Oa.syncEngine);case 6:return e.next=8,l_(this.Oa.remoteStore);case 8:return e.next=10,this.persistence.fi((function(){return r.gcScheduler&&!r.gcScheduler.started&&r.gcScheduler.start(),r.indexBackfillerScheduler&&!r.indexBackfillerScheduler.started&&r.indexBackfillerScheduler.start(),Promise.resolve()}));case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"createLocalStore",value:function(e){return Jw(this.persistence,new Qw,e.initialUser,this.serializer)}},{key:"createGarbageCollectionScheduler",value:function(e,t){var n=this.persistence.referenceDelegate.garbageCollector;return new hw(n,e.asyncQueue,t)}},{key:"createIndexBackfillerScheduler",value:function(e,t){var n=new zp(t,this.persistence);return new jp(e.asyncQueue,n)}},{key:"createPersistence",value:function(e){var t=Gw(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey),n=void 0!==this.cacheSizeBytes?Xk.withCacheSize(this.cacheSizeBytes):Xk.DEFAULT;return new Bw(this.synchronizeTabs,t,e.clientId,n,e.asyncQueue,Rb(),Ob(),this.serializer,this.sharedClientState,!!this.forceOwnership)}},{key:"createSharedClientState",value:function(e){return new Tb}}]),n}(Xx),Zx=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this,e,r,!1)).Oa=e,i.cacheSizeBytes=r,i.synchronizeTabs=!0,i}return k(n,[{key:"initialize",value:function(){var e=u(a().mark((function e(t){var r,i=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ot(T(n.prototype),"initialize",this).call(this,t);case 2:if(r=this.Oa.syncEngine,e.t0=this.sharedClientState instanceof xb,!e.t0){e.next=8;break}return this.sharedClientState.syncEngine={Zs:Mx.bind(null,r),Xs:Kx.bind(null,r),eo:Hx.bind(null,r),Li:qx.bind(null,r),Ys:Ox.bind(null,r)},e.next=8,this.sharedClientState.start();case 8:return e.next=10,this.persistence.fi(function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Vx(i.Oa.syncEngine,t);case 2:i.gcScheduler&&(t&&!i.gcScheduler.started?i.gcScheduler.start():t||i.gcScheduler.stop()),i.indexBackfillerScheduler&&(t&&!i.indexBackfillerScheduler.started?i.indexBackfillerScheduler.start():t||i.indexBackfillerScheduler.stop());case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"createSharedClientState",value:function(e){var t=Rb();if(!xb.C(t))throw new Yd(Qd.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var n=Gw(e.databaseInfo.databaseId,e.databaseInfo.persistenceKey);return new xb(t,e.asyncQueue,n,e.clientId,e.initialUser)}}]),n}($x),eT=function(){function e(){y(this,e)}return k(e,[{key:"initialize",value:function(){var e=u(a().mark((function e(t,n){var r=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.localStore,e.t0){e.next=12;break}return this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=function(e){return fx(r.syncEngine,e,1)},this.remoteStore.remoteSyncer.handleCredentialChange=Ax.bind(null,this.syncEngine),e.next=12,E_(this.remoteStore,this.syncEngine.isPrimaryClient);case 12:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"createEventManager",value:function(e){return new M_}},{key:"createDatastore",value:function(e){var t=Lb(e.databaseInfo.databaseId),n=function(e){return new Db(e)}(e.databaseInfo);return function(e,t,n,r){return new jb(e,t,n,r)}(e.authCredentials,e.appCheckCredentials,n,t)}},{key:"createRemoteStore",value:function(e){var t=this;return function(e,t,n,r,i){return new Bb(e,t,n,r,i)}(this.localStore,this.datastore,e.asyncQueue,(function(e){return fx(t.syncEngine,e,0)}),Eb.C()?new Eb:new Ib)}},{key:"createSyncEngine",value:function(e,t){return function(e,t,n,r,i,a,o){var u=new ex(e,t,n,r,i,a);return o&&(u.va=!0),u}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}},{key:"terminate",value:function(){return function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Wd(t),zd("RemoteStore","RemoteStore shutting down."),n.v_.add(5),e.next=5,Gb(n);case 5:n.M_.shutdown(),n.x_.set("Unknown");case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()(this.remoteStore)}}]),e}();function tT(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10240,n=0;return{read:function(){return u(a().mark((function r(){var i;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(n<e.byteLength)){r.next=3;break}return i={value:e.slice(n,n+t),done:!1},r.abrupt("return",(n+=t,i));case 3:return r.abrupt("return",{done:!0});case 4:case"end":return r.stop()}}),r)})))()},cancel:function(){return u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},releaseLock:function(){},closed:Promise.resolve()}}var nT=function(){function e(t){y(this,e),this.observer=t,this.muted=!1}return k(e,[{key:"next",value:function(e){this.observer.next&&this.Na(this.observer.next,e)}},{key:"error",value:function(e){this.observer.error?this.Na(this.observer.error,e):Bd("Uncaught Error in snapshot listener:",e.toString())}},{key:"Ba",value:function(){this.muted=!0}},{key:"Na",value:function(e,t){var n=this;this.muted||setTimeout((function(){n.muted||e(t)}),0)}}]),e}(),rT=function(){function e(t,n){var r=this;y(this,e),this.La=t,this.serializer=n,this.metadata=new Jd,this.buffer=new Uint8Array,this.ka=new TextDecoder("utf-8"),this.qa().then((function(e){e&&e.X_()?r.metadata.resolve(e.Z_.metadata):r.metadata.reject(new Error("The first element of the bundle is not a metadata, it is\n ".concat(JSON.stringify(null==e?void 0:e.Z_))))}),(function(e){return r.metadata.reject(e)}))}return k(e,[{key:"close",value:function(){return this.La.cancel()}},{key:"getMetadata",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.metadata.promise);case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"xa",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getMetadata();case 2:return e.abrupt("return",this.qa());case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"qa",value:function(){var e=u(a().mark((function e(){var t,n,r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.Qa();case 2:if(null!==(t=e.sent)){e.next=5;break}return e.abrupt("return",null);case 5:return n=this.ka.decode(t),r=Number(n),isNaN(r)&&this.Ka("length string (".concat(n,") is not valid number")),e.next=9,this.$a(r);case 9:return i=e.sent,e.abrupt("return",new G_(JSON.parse(i),t.length+r));case 11:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"Ua",value:function(){return this.buffer.findIndex((function(e){return e==="{".charCodeAt(0)}))}},{key:"Qa",value:function(){var e=u(a().mark((function e(){var t,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.Ua()<0)){e.next=7;break}return e.next=3,this.Wa();case 3:if(!e.sent){e.next=5;break}return e.abrupt("break",7);case 5:e.next=0;break;case 7:if(0!==this.buffer.length){e.next=9;break}return e.abrupt("return",null);case 9:return(t=this.Ua())<0&&this.Ka("Reached the end of bundle when a length string is expected."),n=this.buffer.slice(0,t),e.abrupt("return",(this.buffer=this.buffer.slice(t),n));case 13:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"$a",value:function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.buffer.length<t)){e.next=8;break}return e.next=3,this.Wa();case 3:if(e.t0=e.sent,!e.t0){e.next=6;break}this.Ka("Reached the end of bundle when more is expected.");case 6:e.next=0;break;case 8:return n=this.ka.decode(this.buffer.slice(0,t)),e.abrupt("return",(this.buffer=this.buffer.slice(t),n));case 10:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"Ka",value:function(e){throw this.La.cancel(),new Error("Invalid bundle format: ".concat(e))}},{key:"Wa",value:function(){var e=u(a().mark((function e(){var t,n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.La.read();case 2:return(t=e.sent).done||((n=new Uint8Array(this.buffer.length+t.value.length)).set(this.buffer),n.set(t.value,this.buffer.length),this.buffer=n),e.abrupt("return",t.done);case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()}]),e}(),iT=function(){function e(t){y(this,e),this.datastore=t,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastWriteError=null,this.writtenDocs=new Set}return k(e,[{key:"lookup",value:function(){var e=u(a().mark((function e(t){var n,r=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.ensureCommitNotCalled(),!(this.mutations.length>0)){e.next=2;break}throw new Yd(Qd.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");case 2:return e.next=4,function(){var e=u(a().mark((function e(t,n){var r,i,o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Wd(t),i=Vg(r.serializer)+"/documents",o={documents:n.map((function(e){return Og(r.serializer,e)}))},e.next=5,r.vo("BatchGetDocuments",i,o,n.length);case 5:return u=e.sent,s=new Map,u.forEach((function(e){var t=Bg(r.serializer,e);s.set(t.key.toString(),t)})),c=[],e.abrupt("return",(n.forEach((function(e){var t=s.get(e.toString());Hd(!!t),c.push(t)})),c));case 10:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()(this.datastore,t);case 4:return n=e.sent,e.abrupt("return",(n.forEach((function(e){return r.recordVersion(e)})),n));case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"set",value:function(e,t){this.write(t.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}},{key:"update",value:function(e,t){try{this.write(t.toMutation(e,this.preconditionForUpdate(e)))}catch(e){this.lastWriteError=e}this.writtenDocs.add(e.toString())}},{key:"delete",value:function(e){this.write(new Zy(e,this.precondition(e))),this.writtenDocs.add(e.toString())}},{key:"commit",value:function(){var e=u(a().mark((function e(){var t,n=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.ensureCommitNotCalled(),!this.lastWriteError){e.next=2;break}throw this.lastWriteError;case 2:return t=this.readVersions,this.mutations.forEach((function(e){t.delete(e.key.toString())})),t.forEach((function(e,t){var r=mp.fromPath(t);n.mutations.push(new eg(r,n.precondition(r)))})),e.next=7,function(){var e=u(a().mark((function e(t,n){var r,i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Wd(t),i=Vg(r.serializer)+"/documents",o={writes:n.map((function(e){return qg(r.serializer,e)}))},e.next=3,r.So("Commit",i,o);case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()(this.datastore,this.mutations);case 7:this.committed=!0;case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"recordVersion",value:function(e){var t;if(e.isFoundDocument())t=e.version;else{if(!e.isNoDocument())throw Gd();t=fp.min()}var n=this.readVersions.get(e.key.toString());if(n){if(!t.isEqual(n))throw new Yd(Qd.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),t)}},{key:"precondition",value:function(e){var t=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&t?t.isEqual(fp.min())?Vy.exists(!1):Vy.updateTime(t):Vy.none()}},{key:"preconditionForUpdate",value:function(e){var t=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&t){if(t.isEqual(fp.min()))throw new Yd(Qd.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Vy.updateTime(t)}return Vy.exists(!0)}},{key:"write",value:function(e){this.ensureCommitNotCalled(),this.mutations.push(e)}},{key:"ensureCommitNotCalled",value:function(){}}]),e}(),aT=function(){function e(t,n,r,i,a){y(this,e),this.asyncQueue=t,this.datastore=n,this.options=r,this.updateFunction=i,this.deferred=a,this.Ga=r.maxAttempts,this.jo=new Mb(this.asyncQueue,"transaction_retry")}return k(e,[{key:"run",value:function(){this.Ga-=1,this.za()}},{key:"za",value:function(){var e=this;this.jo.qo(u(a().mark((function t(){var n,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=new iT(e.datastore),(r=e.ja(n))&&r.then((function(t){e.asyncQueue.enqueueAndForget((function(){return n.commit().then((function(){e.deferred.resolve(t)})).catch((function(t){e.Ha(t)}))}))})).catch((function(t){e.Ha(t)}));case 2:case"end":return t.stop()}}),t)}))))}},{key:"ja",value:function(e){try{var t=this.updateFunction(e);return!qp(t)&&t.catch&&t.then?t:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(e){return this.deferred.reject(e),null}}},{key:"Ha",value:function(e){var t=this;this.Ga>0&&this.Ja(e)?(this.Ga-=1,this.asyncQueue.enqueueAndForget((function(){return t.za(),Promise.resolve()}))):this.deferred.reject(e)}},{key:"Ja",value:function(e){if("FirebaseError"===e.name){var t=e.code;return"aborted"===t||"failed-precondition"===t||"already-exists"===t||!ag(t)}return!1}}]),e}(),oT=function(){function e(t,n,r,i){var o=this;y(this,e),this.authCredentials=t,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=i,this.user=Fd.UNAUTHENTICATED,this.clientId=op.V(),this.authCredentialListener=function(){return Promise.resolve()},this.appCheckCredentialListener=function(){return Promise.resolve()},this.authCredentials.start(r,function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zd("FirestoreClient","Received user=",t.uid),e.next=3,o.authCredentialListener(t);case 3:o.user=t;case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),this.appCheckCredentials.start(r,(function(e){return zd("FirestoreClient","Received new app check token=",e),o.appCheckCredentialListener(e,o.user)}))}return k(e,[{key:"getConfiguration",value:function(){var e=u(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100});case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"setCredentialChangeListener",value:function(e){this.authCredentialListener=e}},{key:"setAppCheckTokenChangeListener",value:function(e){this.appCheckCredentialListener=e}},{key:"verifyNotTerminated",value:function(){if(this.asyncQueue.isShuttingDown)throw new Yd(Qd.FAILED_PRECONDITION,"The client has already been terminated.")}},{key:"terminate",value:function(){var e=this;this.asyncQueue.enterRestrictedMode();var t=new Jd;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(u(a().mark((function n(){var r;return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,n.t0=e._onlineComponents,!n.t0){n.next=5;break}return n.next=5,e._onlineComponents.terminate();case 5:if(n.t1=e._offlineComponents,!n.t1){n.next=9;break}return n.next=9,e._offlineComponents.terminate();case 9:e.authCredentials.shutdown(),e.appCheckCredentials.shutdown(),t.resolve(),n.next=18;break;case 14:n.prev=14,n.t2=n.catch(0),r=P_(n.t2,"Failed to shutdown persistence"),t.reject(r);case 18:case"end":return n.stop()}}),n,null,[[0,14]])})))),t.promise}}]),e}();function uT(e,t){return sT.apply(this,arguments)}function sT(){return sT=u(a().mark((function e(t,n){var r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.asyncQueue.verifyOperationInProgress(),zd("FirestoreClient","Initializing OfflineComponentProvider"),e.next=3,t.getConfiguration();case 3:return r=e.sent,e.next=6,n.initialize(r);case 6:i=r.initialUser,t.setCredentialChangeListener(function(){var e=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=i.isEqual(t),e.t0){e.next=5;break}return e.next=4,Xw(n.localStore,t);case 4:i=t;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n.persistence.setDatabaseDeletedListener((function(){return t.terminate()})),t._offlineComponents=n;case 8:case"end":return e.stop()}}),e)}))),sT.apply(this,arguments)}function cT(e,t){return lT.apply(this,arguments)}function lT(){return lT=u(a().mark((function e(t,n){var r,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.asyncQueue.verifyOperationInProgress(),e.next=3,hT(t);case 3:return r=e.sent,zd("FirestoreClient","Initializing OnlineComponentProvider"),e.next=7,t.getConfiguration();case 7:return i=e.sent,e.next=10,n.initialize(r,i);case 10:t.setCredentialChangeListener((function(e){return T_(n.remoteStore,e)})),t.setAppCheckTokenChangeListener((function(e,t){return T_(n.remoteStore,t)})),t._onlineComponents=n;case 13:case"end":return e.stop()}}),e)}))),lT.apply(this,arguments)}function fT(e){return"FirebaseError"===e.name?e.code===Qd.FAILED_PRECONDITION||e.code===Qd.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}function hT(e){return dT.apply(this,arguments)}function dT(){return(dT=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t._offlineComponents){e.next=21;break}if(!t._uninitializedComponentsProvider){e.next=18;break}return zd("FirestoreClient","Using user provided OfflineComponentProvider"),e.prev=3,e.next=6,uT(t,t._uninitializedComponentsProvider._offline);case 6:e.next=16;break;case 8:if(e.prev=8,e.t0=e.catch(3),fT(n=e.t0)){e.next=13;break}throw n;case 13:return qd("Error using user provided cache. Falling back to memory cache: "+n),e.next=16,uT(t,new Xx);case 16:e.next=21;break;case 18:return zd("FirestoreClient","Using default OfflineComponentProvider"),e.next=21,uT(t,new Xx);case 21:return e.abrupt("return",t._offlineComponents);case 22:case"end":return e.stop()}}),e,null,[[3,8]])})))).apply(this,arguments)}function pT(e){return vT.apply(this,arguments)}function vT(){return(vT=u(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=t._onlineComponents,e.t0){e.next=11;break}if(!t._uninitializedComponentsProvider){e.next=8;break}return zd("FirestoreClient","Using user provided OnlineComponentProvider"),e.next=6,cT(t,t._uninitializedComponentsProvider._online);case 6:e.next=11;break;case 8:return zd("FirestoreClient","Using default OnlineComponentProvider"),e.next=11,cT(t,new eT);case 11:return e.abrupt("return",t._onlineComponents);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mT(e){return hT(e).then((function(e){return e.persistence}))}function yT(e){return hT(e).then((function(e){return e.localStore}))}function gT(e){return pT(e).then((function(e){return e.remoteStore}))}function kT(e){return pT(e).then((function(e){return e.syncEngine}))}function wT(e){return pT(e).then((function(e){return e.datastore}))}function bT(e){return _T.apply(this,arguments)}function _T(){return(_T=u(a().mark((function e(t){var n,r;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,pT(t);case 2:return n=e.sent,r=n.eventManager,e.abrupt("return",(r.onListen=tx.bind(null,n.syncEngine),r.onUnlisten=ax.bind(null,n.syncEngine),r));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xT(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new Jd;return e.asyncQueue.enqueueAndForget(u(a().mark((function i(){return a().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.t0=function(e,t,n,r,i){var a=new nT({next:function(a){t.enqueueAndForget((function(){return U_(e,o)}));var u=a.docs.has(n);!u&&a.fromCache?i.reject(new Yd(Qd.UNAVAILABLE,"Failed to get document because the client is offline.")):u&&a.fromCache&&r&&"server"===r.source?i.reject(new Yd(Qd.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):i.resolve(a)},error:function(e){return i.reject(e)}}),o=new K_(Hm(n.path),a,{includeMetadataChanges:!0,Y_:!0});return F_(e,o)},i.next=3,bT(e);case 3:return i.t1=i.sent,i.t2=e.asyncQueue,i.t3=t,i.t4=n,i.t5=r,i.abrupt("return",(0,i.t0)(i.t1,i.t2,i.t3,i.t4,i.t5));case 9:case"end":return i.stop()}}),i)})))),r.promise}function TT(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new Jd;return e.asyncQueue.enqueueAndForget(u(a().mark((function i(){return a().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.t0=function(e,t,n,r,i){var a=new nT({next:function(n){t.enqueueAndForget((function(){return U_(e,o)})),n.fromCache&&"server"===r.source?i.reject(new Yd(Qd.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):i.resolve(n)},error:function(e){return i.reject(e)}}),o=new K_(n,a,{includeMetadataChanges:!0,Y_:!0});return F_(e,o)},i.next=3,bT(e);case 3:return i.t1=i.sent,i.t2=e.asyncQueue,i.t3=t,i.t4=n,i.t5=r,i.abrupt("return",(0,i.t0)(i.t1,i.t2,i.t3,i.t4,i.t5));case 9:case"end":return i.stop()}}),i)})))),r.promise}function IT(e){var t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}var ET=new Map;function ST(e,t,n){if(!n)throw new Yd(Qd.INVALID_ARGUMENT,"Function ".concat(e,"() cannot be called with an empty ").concat(t,"."))}function CT(e,t,n,r){if(!0===t&&!0===r)throw new Yd(Qd.INVALID_ARGUMENT,"".concat(e," and ").concat(n," cannot be used together."))}function AT(e){if(!mp.isDocumentKey(e))throw new Yd(Qd.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but ".concat(e," has ").concat(e.length,"."))}function NT(e){if(mp.isDocumentKey(e))throw new Yd(Qd.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but ".concat(e," has ").concat(e.length,"."))}function PT(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e="".concat(e.substring(0,20),"...")),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";var t=function(e){return e.constructor?e.constructor.name:null}(e);return t?"a custom ".concat(t," object"):"an object"}return"function"==typeof e?"a function":Gd()}function DT(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new Yd(Qd.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");var n=PT(e);throw new Yd(Qd.INVALID_ARGUMENT,"Expected type '".concat(t.name,"', but it was: ").concat(n))}return e}function RT(e,t){if(t<=0)throw new Yd(Qd.INVALID_ARGUMENT,"Function ".concat(e,"() requires a positive number, but it was: ").concat(t,"."))}var OT=function(){function e(t){var n,r;if(y(this,e),void 0===t.host){if(void 0!==t.ssl)throw new Yd(Qd.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(n=t.ssl)||void 0===n||n;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Yd(Qd.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}CT("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===t.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=IT(null!==(r=t.experimentalLongPollingOptions)&&void 0!==r?r:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new Yd(Qd.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (must not be NaN)"));if(e.timeoutSeconds<5)throw new Yd(Qd.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (minimum allowed value is 5)"));if(e.timeoutSeconds>30)throw new Yd(Qd.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(e.timeoutSeconds," (maximum allowed value is 30)"))}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams}return k(e,[{key:"isEqual",value:function(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}]),e}(),LT=function(){function e(t,n,r,i){y(this,e),this._authCredentials=t,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new OT({}),this._settingsFrozen=!1}return k(e,[{key:"app",get:function(){if(!this._app)throw new Yd(Qd.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}},{key:"_initialized",get:function(){return this._settingsFrozen}},{key:"_terminated",get:function(){return void 0!==this._terminateTask}},{key:"_setSettings",value:function(e){if(this._settingsFrozen)throw new Yd(Qd.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 OT(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new $d;switch(e.type){case"firstParty":return new np(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new Yd(Qd.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}},{key:"_getSettings",value:function(){return this._settings}},{key:"_freezeSettings",value:function(){return this._settingsFrozen=!0,this._settings}},{key:"_delete",value:function(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}},{key:"toJSON",value:function(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}},{key:"_terminate",value:function(){return function(e){var t=ET.get(e);t&&(zd("ComponentProvider","Removing Datastore"),ET.delete(e),t.terminate())}(this),Promise.resolve()}}]),e}();function MT(e,t,n){var r,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=(e=DT(e,LT))._getSettings(),o="".concat(t,":").concat(n);if("firestore.googleapis.com"!==a.host&&a.host!==o&&qd("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),e._setSettings(Object.assign(Object.assign({},a),{host:o,ssl:!1})),i.mockUserToken){var u,s;if("string"==typeof i.mockUserToken)u=i.mockUserToken,s=Fd.MOCK_USER;else{u=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');var n=t||"demo-project",r=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");var a=Object.assign({iss:"https://securetoken.google.com/".concat(n),aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e);return[D(JSON.stringify({alg:"none",type:"JWT"})),D(JSON.stringify(a)),""].join(".")}(i.mockUserToken,null===(r=e._app)||void 0===r?void 0:r.options.projectId);var c=i.mockUserToken.sub||i.mockUserToken.user_id;if(!c)throw new Yd(Qd.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");s=new Fd(c)}e._authCredentials=new Zd(new Xd(u,s))}}var FT=function(){function e(t,n,r){y(this,e),this.converter=n,this._query=r,this.type="query",this.firestore=t}return k(e,[{key:"withConverter",value:function(t){return new e(this.firestore,t,this._query)}}]),e}(),VT=function(){function e(t,n,r){y(this,e),this.converter=n,this._key=r,this.type="document",this.firestore=t}return k(e,[{key:"_path",get:function(){return this._key.path}},{key:"id",get:function(){return this._key.path.lastSegment()}},{key:"path",get:function(){return this._key.path.canonicalString()}},{key:"parent",get:function(){return new UT(this.firestore,this.converter,this._key.path.popLast())}},{key:"withConverter",value:function(t){return new e(this.firestore,t,this._key)}}]),e}(),UT=function(e){x(n,e);var t=E(n);function n(e,r,i){var a;return y(this,n),(a=t.call(this,e,r,Hm(i)))._path=i,a.type="collection",a}return k(n,[{key:"id",get:function(){return this._query.path.lastSegment()}},{key:"path",get:function(){return this._query.path.canonicalString()}},{key:"parent",get:function(){var e=this._path.popLast();return e.isEmpty()?null:new VT(this.firestore,null,new mp(e))}},{key:"withConverter",value:function(e){return new n(this.firestore,e,this._path)}}]),n}(FT);function jT(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if(e=ie(e),ST("collection","path",t),e instanceof LT){var a=dp.fromString.apply(dp,[t].concat(r));return NT(a),new UT(e,null,a)}if(!(e instanceof VT||e instanceof UT))throw new Yd(Qd.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");var o=e._path.child(dp.fromString.apply(dp,[t].concat(r)));return NT(o),new UT(e.firestore,null,o)}function zT(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if(e=ie(e),1===arguments.length&&(t=op.V()),ST("doc","path",t),e instanceof LT){var a=dp.fromString.apply(dp,[t].concat(r));return AT(a),new VT(e,null,new mp(a))}if(!(e instanceof VT||e instanceof UT))throw new Yd(Qd.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");var o=e._path.child(dp.fromString.apply(dp,[t].concat(r)));return AT(o),new VT(e.firestore,e instanceof UT?e.converter:null,new mp(o))}function BT(e,t){return e=ie(e),t=ie(t),(e instanceof VT||e instanceof UT)&&(t instanceof VT||t instanceof UT)&&e.firestore===t.firestore&&e.path===t.path&&e.converter===t.converter}function qT(e,t){return e=ie(e),t=ie(t),e instanceof FT&&t instanceof FT&&e.firestore===t.firestore&&ey(e._query,t._query)&&e.converter===t.converter}var KT=function(){function e(){var t=this;y(this,e),this.Ya=Promise.resolve(),this.Za=[],this.Xa=!1,this.eu=[],this.tu=null,this.nu=!1,this.ru=!1,this.iu=[],this.jo=new Mb(this,"async_queue_retry"),this.su=function(){var e=Ob();e&&zd("AsyncQueue","Visibility state changed to "+e.visibilityState),t.jo.Ko()};var n=Ob();n&&"function"==typeof n.addEventListener&&n.addEventListener("visibilitychange",this.su)}return k(e,[{key:"isShuttingDown",get:function(){return this.Xa}},{key:"enqueueAndForget",value:function(e){this.enqueue(e)}},{key:"enqueueAndForgetEvenWhileRestricted",value:function(e){this.ou(),this._u(e)}},{key:"enterRestrictedMode",value:function(e){if(!this.Xa){this.Xa=!0,this.ru=e||!1;var t=Ob();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.su)}}},{key:"enqueue",value:function(e){var t=this;if(this.ou(),this.Xa)return new Promise((function(){}));var n=new Jd;return this._u((function(){return t.Xa&&t.ru?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)})).then((function(){return n.promise}))}},{key:"enqueueRetryable",value:function(e){var t=this;this.enqueueAndForget((function(){return t.Za.push(e),t.au()}))}},{key:"au",value:function(){var e=u(a().mark((function e(){var t=this;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0===this.Za.length){e.next=14;break}return e.prev=1,e.next=4,this.Za[0]();case 4:this.Za.shift(),this.jo.reset(),e.next=13;break;case 8:if(e.prev=8,e.t0=e.catch(1),Lp(e.t0)){e.next=12;break}throw e.t0;case 12:zd("AsyncQueue","Operation failed with retryable error: "+e.t0);case 13:this.Za.length>0&&this.jo.qo((function(){return t.au()}));case 14:case"end":return e.stop()}}),e,this,[[1,8]])})));return function(){return e.apply(this,arguments)}}()},{key:"_u",value:function(e){var t=this,n=this.Ya.then((function(){return t.nu=!0,e().catch((function(e){t.tu=e,t.nu=!1;var n=function(e){var t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}(e);throw Bd("INTERNAL UNHANDLED ERROR: ",n),e})).then((function(e){return t.nu=!1,e}))}));return this.Ya=n,n}},{key:"enqueueAfterDelay",value:function(e,t,n){var r=this;this.ou(),this.iu.indexOf(e)>-1&&(t=0);var i=N_.createAndSchedule(this,e,t,n,(function(e){return r.uu(e)}));return this.eu.push(i),i}},{key:"ou",value:function(){this.tu&&Gd()}},{key:"verifyOperationInProgress",value:function(){}},{key:"cu",value:function(){var e=u(a().mark((function e(){var t;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.Ya,e.next=3,t;case 3:if(t!==this.Ya){e.next=0;break}case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"lu",value:function(e){var t,n=w(this.eu);try{for(n.s();!(t=n.n()).done;){if(t.value.timerId===e)return!0}}catch(r){n.e(r)}finally{n.f()}return!1}},{key:"hu",value:function(e){var t=this;return this.cu().then((function(){t.eu.sort((function(e,t){return e.targetTimeMs-t.targetTimeMs}));var n,r=w(t.eu);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.skipDelay(),"all"!==e&&i.timerId===e)break}}catch(a){r.e(a)}finally{r.f()}return t.cu()}))}},{key:"Pu",value:function(e){this.iu.push(e)}},{key:"uu",value:function(e){var t=this.eu.indexOf(e);this.eu.splice(t,1)}}]),e}();function GT(e){return function(e,t){if("object"!=typeof e||null===e)return!1;var n,r=e,i=w(t);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(a in r&&"function"==typeof r[a])return!0}}catch(o){i.e(o)}finally{i.f()}return!1}(e,["next","error","complete"])}var HT=function(){function e(){y(this,e),this._progressObserver={},this._taskCompletionResolver=new Jd,this._lastProgress={taskState:"Running",totalBytes:0,totalDocuments:0,bytesLoaded:0,documentsLoaded:0}}return k(e,[{key:"onProgress",value:function(e,t,n){this._progressObserver={next:e,error:t,complete:n}}},{key:"catch",value:function(e){return this._taskCompletionResolver.promise.catch(e)}},{key:"then",value:function(e,t){return this._taskCompletionResolver.promise.then(e,t)}},{key:"_completeWith",value:function(e){this._updateProgress(e),this._progressObserver.complete&&this._progressObserver.complete(),this._taskCompletionResolver.resolve(e)}},{key:"_failWith",value:function(e){this._lastProgress.taskState="Error",this._progressObserver.next&&this._progressObserver.next(this._lastProgress),this._progressObserver.error&&this._progressObserver.error(e),this._taskCompletionResolver.reject(e)}},{key:"_updateProgress",value:function(e){this._lastProgress=e,this._progressObserver.next&&this._progressObserver.next(e)}}]),e}(),WT=function(e){x(n,e);var t=E(n);function n(e,r,i,a){var o;return y(this,n),(o=t.call(this,e,r,i,a)).type="firestore",o._queue=new KT,o._persistenceKey=(null==a?void 0:a.name)||"[DEFAULT]",o}return k(n,[{key:"_terminate",value:function(){return this._firestoreClient||YT(this),this._firestoreClient.terminate()}}]),n}(LT);function QT(e){return e._firestoreClient||YT(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function YT(e){var t,n,r,i=e._freezeSettings(),a=function(e,t,n,r){return new jv(e,t,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,IT(r.experimentalLongPollingOptions),r.useFetchStreams)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,i);e._firestoreClient=new oT(e._authCredentials,e._appCheckCredentials,e._queue,a),(null===(n=i.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(r=i.localCache)||void 0===r?void 0:r._onlineComponentProvider)&&(e._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.localCache.kind,_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider})}function JT(e,t,n){var r=new Jd;return e.asyncQueue.enqueue(u(a().mark((function i(){var o;return a().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,uT(e,n);case 3:return i.next=5,cT(e,t);case 5:r.resolve(),i.next=14;break;case 8:if(i.prev=8,i.t0=i.catch(0),fT(o=i.t0)){i.next=13;break}throw o;case 13:qd("Error enabling indexeddb cache. Falling back to memory cache: "+o),r.reject(o);case 14:case"end":return i.stop()}}),i,null,[[0,8]])})))).then((function(){return r.promise}))}function XT(e){return function(e){var t=new Jd;return e.asyncQueue.enqueueAndForget(u(a().mark((function n(){return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.t0=gx,n.next=3,kT(e);case 3:return n.t1=n.sent,n.t2=t,n.abrupt("return",(0,n.t0)(n.t1,n.t2));case 6:case"end":return n.stop()}}),n)})))),t.promise}(QT(e=DT(e,WT)))}function $T(e){return function(e){return e.asyncQueue.enqueue(u(a().mark((function t(){var n,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,mT(e);case 2:return n=t.sent,t.next=5,gT(e);case 5:return r=t.sent,t.abrupt("return",(n.setNetworkEnabled(!0),function(e){var t=Wd(e);return t.v_.delete(0),qb(t)}(r)));case 7:case"end":return t.stop()}}),t)}))))}(QT(e=DT(e,WT)))}function ZT(e){return function(e){return e.asyncQueue.enqueue(u(a().mark((function t(){var n,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,mT(e);case 2:return n=t.sent,t.next=5,gT(e);case 5:return r=t.sent,t.abrupt("return",(n.setNetworkEnabled(!1),function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=Wd(t)).v_.add(0),e.next=4,Gb(n);case 4:n.x_.set("Offline");case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()(r)));case 7:case"end":return t.stop()}}),t)}))))}(QT(e=DT(e,WT)))}function eI(e,t){var n=QT(e=DT(e,WT)),r=new HT;return function(e,t,n,r){var i=function(e,t){return function(e,t){return new rT(e,t)}(function(e,t){if(e instanceof Uint8Array)return tT(e,t);if(e instanceof ArrayBuffer)return tT(new Uint8Array(e),t);if(e instanceof ReadableStream)return e.getReader();throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream")}("string"==typeof e?sg().encode(e):e),t)}(n,Lb(t));e.asyncQueue.enqueueAndForget(u(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=Jx,t.next=3,kT(e);case 3:t.t1=t.sent,t.t2=i,t.t3=r,(0,t.t0)(t.t1,t.t2,t.t3);case 7:case"end":return t.stop()}}),t)}))))}(n,e._databaseId,t,r),r}function tI(e,t){return function(e,t){return e.asyncQueue.enqueue(u(a().mark((function n(){return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.t0=function(e,t){var n=Wd(e);return n.persistence.runTransaction("Get named query","readonly",(function(e){return n.$r.getNamedQuery(e,t)}))},n.next=3,yT(e);case 3:return n.t1=n.sent,n.t2=t,n.abrupt("return",(0,n.t0)(n.t1,n.t2));case 6:case"end":return n.stop()}}),n)}))))}(QT(e=DT(e,WT)),t).then((function(t){return t?new FT(e,null,t.query):null}))}function nI(e){if(e._initialized||e._terminated)throw new Yd(Qd.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.")}var rI=function(){function e(t){y(this,e),this._byteString=t}return k(e,[{key:"toBase64",value:function(){return this._byteString.toBase64()}},{key:"toUint8Array",value:function(){return this._byteString.toUint8Array()}},{key:"toString",value:function(){return"Bytes(base64: "+this.toBase64()+")"}},{key:"isEqual",value:function(e){return this._byteString.isEqual(e._byteString)}}],[{key:"fromBase64String",value:function(t){try{return new e(Dv.fromBase64String(t))}catch(t){throw new Yd(Qd.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}},{key:"fromUint8Array",value:function(t){return new e(Dv.fromUint8Array(t))}}]),e}(),iI=function(){function e(){y(this,e);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0;i<n.length;++i)if(0===n[i].length)throw new Yd(Qd.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new vp(n)}return k(e,[{key:"isEqual",value:function(e){return this._internalPath.isEqual(e._internalPath)}}]),e}();var aI=k((function e(t){y(this,e),this._methodName=t})),oI=function(){function e(t,n){if(y(this,e),!isFinite(t)||t<-90||t>90)throw new Yd(Qd.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(n)||n<-180||n>180)throw new Yd(Qd.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=t,this._long=n}return k(e,[{key:"latitude",get:function(){return this._lat}},{key:"longitude",get:function(){return this._long}},{key:"isEqual",value:function(e){return this._lat===e._lat&&this._long===e._long}},{key:"toJSON",value:function(){return{latitude:this._lat,longitude:this._long}}},{key:"_compareTo",value:function(e){return up(this._lat,e._lat)||up(this._long,e._long)}}]),e}(),uI=/^__.*__$/,sI=function(){function e(t,n,r){y(this,e),this.data=t,this.fieldMask=n,this.fieldTransforms=r}return k(e,[{key:"toMutation",value:function(e,t){return null!==this.fieldMask?new Wy(e,this.data,this.fieldMask,t,this.fieldTransforms):new Hy(e,this.data,t,this.fieldTransforms)}}]),e}(),cI=function(){function e(t,n,r){y(this,e),this.data=t,this.fieldMask=n,this.fieldTransforms=r}return k(e,[{key:"toMutation",value:function(e,t){return new Wy(e,this.data,this.fieldMask,t,this.fieldTransforms)}}]),e}();function lI(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Gd()}}var fI=function(){function e(t,n,r,i,a,o){y(this,e),this.settings=t,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=i,void 0===a&&this.Iu(),this.fieldTransforms=a||[],this.fieldMask=o||[]}return k(e,[{key:"path",get:function(){return this.settings.path}},{key:"Tu",get:function(){return this.settings.Tu}},{key:"Eu",value:function(t){return new e(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}},{key:"du",value:function(e){var t,n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.Eu({path:n,Au:!1});return r.Ru(e),r}},{key:"Vu",value:function(e){var t,n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.Eu({path:n,Au:!1});return r.Iu(),r}},{key:"mu",value:function(e){return this.Eu({path:void 0,Au:!0})}},{key:"fu",value:function(e){return PI(e,this.settings.methodName,this.settings.gu||!1,this.path,this.settings.pu)}},{key:"contains",value:function(e){return void 0!==this.fieldMask.find((function(t){return e.isPrefixOf(t)}))||void 0!==this.fieldTransforms.find((function(t){return e.isPrefixOf(t.field)}))}},{key:"Iu",value:function(){if(this.path)for(var e=0;e<this.path.length;e++)this.Ru(this.path.get(e))}},{key:"Ru",value:function(e){if(0===e.length)throw this.fu("Document fields must not be empty");if(lI(this.Tu)&&uI.test(e))throw this.fu('Document fields cannot begin and end with "__"')}}]),e}(),hI=function(){function e(t,n,r){y(this,e),this.databaseId=t,this.ignoreUndefinedProperties=n,this.serializer=r||Lb(t)}return k(e,[{key:"yu",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return new fI({Tu:e,methodName:t,pu:n,path:vp.emptyPath(),Au:!1,gu:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}]),e}();function dI(e){var t=e._freezeSettings(),n=Lb(e._databaseId);return new hI(e._databaseId,!!t.ignoreUndefinedProperties,n)}function pI(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=e.yu(a.merge||a.mergeFields?2:0,t,n,i);SI("Data must be an object, but it was:",o,r);var u,s,c=II(r,o);if(a.merge)u=new Nv(o.fieldMask),s=o.fieldTransforms;else if(a.mergeFields){var l,f=[],h=w(a.mergeFields);try{for(h.s();!(l=h.n()).done;){var d=CI(t,l.value,n);if(!o.contains(d))throw new Yd(Qd.INVALID_ARGUMENT,"Field '".concat(d,"' is specified in your field mask but missing from your input data."));DI(f,d)||f.push(d)}}catch(p){h.e(p)}finally{h.f()}u=new Nv(f),s=o.fieldTransforms.filter((function(e){return u.covers(e.field)}))}else u=null,s=o.fieldTransforms;return new sI(new cm(c),u,s)}var vI=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.apply(this,arguments)}return k(n,[{key:"_toFieldTransform",value:function(e){if(2!==e.Tu)throw 1===e.Tu?e.fu("".concat(this._methodName,"() can only appear at the top level of your update data")):e.fu("".concat(this._methodName,"() cannot be used with set() unless you pass {merge:true}"));return e.fieldMask.push(e.path),null}},{key:"isEqual",value:function(e){return e instanceof n}}]),n}(aI);function mI(e,t,n){return new fI({Tu:3,pu:t.settings.pu,methodName:e._methodName,Au:n},t.databaseId,t.serializer,t.ignoreUndefinedProperties)}var yI=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.apply(this,arguments)}return k(n,[{key:"_toFieldTransform",value:function(e){return new My(e.path,new Cy)}},{key:"isEqual",value:function(e){return e instanceof n}}]),n}(aI),gI=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this,e)).wu=r,i}return k(n,[{key:"_toFieldTransform",value:function(e){var t=mI(this,e,!0),n=this.wu.map((function(e){return TI(e,t)})),r=new Ay(n);return new My(e.path,r)}},{key:"isEqual",value:function(e){return this===e}}]),n}(aI),kI=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this,e)).wu=r,i}return k(n,[{key:"_toFieldTransform",value:function(e){var t=mI(this,e,!0),n=this.wu.map((function(e){return TI(e,t)})),r=new Py(n);return new My(e.path,r)}},{key:"isEqual",value:function(e){return this===e}}]),n}(aI),wI=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this,e)).Su=r,i}return k(n,[{key:"_toFieldTransform",value:function(e){var t=new Ry(e.serializer,xy(e.serializer,this.Su));return new My(e.path,t)}},{key:"isEqual",value:function(e){return this===e}}]),n}(aI);function bI(e,t,n,r){var i=e.yu(1,t,n);SI("Data must be an object, but it was:",i,r);var a=[],o=cm.empty();_v(r,(function(e,r){var u=NI(t,e,n);r=ie(r);var s=i.Vu(u);if(r instanceof vI)a.push(u);else{var c=TI(r,s);null!=c&&(a.push(u),o.set(u,c))}}));var u=new Nv(a);return new cI(o,u,i.fieldTransforms)}function _I(e,t,n,r,i,a){var o=e.yu(1,t,n),u=[CI(t,r,n)],s=[i];if(a.length%2!=0)throw new Yd(Qd.INVALID_ARGUMENT,"Function ".concat(t,"() needs to be called with an even number of arguments that alternate between field names and values."));for(var c=0;c<a.length;c+=2)u.push(CI(t,a[c])),s.push(a[c+1]);for(var l=[],f=cm.empty(),h=u.length-1;h>=0;--h)if(!DI(l,u[h])){var d=u[h],p=s[h];p=ie(p);var v=o.Vu(d);if(p instanceof vI)l.push(d);else{var m=TI(p,v);null!=m&&(l.push(d),f.set(d,m))}}var y=new Nv(l);return new cI(f,y,o.fieldTransforms)}function xI(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return TI(n,e.yu(r?4:3,t))}function TI(e,t){if(EI(e=ie(e)))return SI("Unsupported field value:",t,e),II(e,t);if(e instanceof aI)return function(e,t){if(!lI(t.Tu))throw t.fu("".concat(e._methodName,"() can only be used with update() and set()"));if(!t.path)throw t.fu("".concat(e._methodName,"() is not currently supported inside arrays"));var n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.Au&&4!==t.Tu)throw t.fu("Nested arrays are not supported");return function(e,t){var n,r=[],i=0,a=w(e);try{for(a.s();!(n=a.n()).done;){var o=TI(n.value,t.mu(i));null==o&&(o={nullValue:"NULL_VALUE"}),r.push(o),i++}}catch(u){a.e(u)}finally{a.f()}return{arrayValue:{values:r}}}(e,t)}return function(e,t){if(null===(e=ie(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return xy(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){var n=lp.fromDate(e);return{timestampValue:Cg(t.serializer,n)}}if(e instanceof lp){var r=new lp(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Cg(t.serializer,r)}}if(e instanceof oI)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof rI)return{bytesValue:Ag(t.serializer,e._byteString)};if(e instanceof VT){var i=t.databaseId,a=e.firestore._databaseId;if(!a.isEqual(i))throw t.fu("Document reference is for database ".concat(a.projectId,"/").concat(a.database," but should be for database ").concat(i.projectId,"/").concat(i.database));return{referenceValue:Dg(e.firestore._databaseId||t.databaseId,e._key.path)}}throw t.fu("Unsupported field value: ".concat(PT(e)))}(e,t)}function II(e,t){var n={};return xv(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):_v(e,(function(e,r){var i=TI(r,t.du(e));null!=i&&(n[e]=i)})),{mapValue:{fields:n}}}function EI(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof lp||e instanceof oI||e instanceof rI||e instanceof VT||e instanceof aI)}function SI(e,t,n){if(!EI(n)||!function(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}(n)){var r=PT(n);throw"an object"===r?t.fu(e+" a custom object"):t.fu(e+" "+r)}}function CI(e,t,n){if((t=ie(t))instanceof iI)return t._internalPath;if("string"==typeof t)return NI(e,t);throw PI("Field path arguments must be of type string or ",e,!1,void 0,n)}var AI=new RegExp("[~\\*/\\[\\]]");function NI(e,t,n){if(t.search(AI)>=0)throw PI("Invalid field path (".concat(t,"). Paths must not contain '~', '*', '/', '[', or ']'"),e,!1,void 0,n);try{return S(iI,oe(t.split(".")))._internalPath}catch(Sc){throw PI("Invalid field path (".concat(t,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"),e,!1,void 0,n)}}function PI(e,t,n,r,i){var a=r&&!r.isEmpty(),o=void 0!==i,u="Function ".concat(t,"() called with invalid data");n&&(u+=" (via `toFirestore()`)"),u+=". ";var s="";return(a||o)&&(s+=" (found",a&&(s+=" in field ".concat(r)),o&&(s+=" in document ".concat(i)),s+=")"),new Yd(Qd.INVALID_ARGUMENT,u+e+s)}function DI(e,t){return e.some((function(e){return e.isEqual(t)}))}var RI=function(){function e(t,n,r,i,a){y(this,e),this._firestore=t,this._userDataWriter=n,this._key=r,this._document=i,this._converter=a}return k(e,[{key:"id",get:function(){return this._key.path.lastSegment()}},{key:"ref",get:function(){return new VT(this._firestore,this._converter,this._key)}},{key:"exists",value:function(){return null!==this._document}},{key:"data",value:function(){if(this._document){if(this._converter){var e=new OI(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}},{key:"get",value:function(e){if(this._document){var t=this._document.data.field(LI("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}]),e}(),OI=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.apply(this,arguments)}return k(n,[{key:"data",value:function(){return Ot(T(n.prototype),"data",this).call(this)}}]),n}(RI);function LI(e,t){return"string"==typeof t?NI(e,t):t instanceof iI?t._internalPath:t._delegate._internalPath}function MI(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new Yd(Qd.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var FI=k((function e(){y(this,e)})),VI=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.apply(this,arguments)}return k(n)}(FI);function UI(e,t){for(var n=[],r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a];t instanceof FI&&n.push(t),function(e){var t=e.filter((function(e){return e instanceof zI})).length,n=e.filter((function(e){return e instanceof jI})).length;if(t>1||t>0&&n>0)throw new Yd(Qd.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(n=n.concat(i));var o,u=w(n);try{for(u.s();!(o=u.n()).done;){e=o.value._apply(e)}}catch(s){u.e(s)}finally{u.f()}return e}var jI=function(e){x(n,e);var t=E(n);function n(e,r,i){var a;return y(this,n),(a=t.call(this))._field=e,a._op=r,a._value=i,a.type="where",a}return k(n,[{key:"_apply",value:function(e){var t=this._parse(e);return ZI(e._query,t),new FT(e.firestore,e.converter,$m(e._query,t))}},{key:"_parse",value:function(e){var t=dI(e.firestore),n=function(e,t,n,r,i,a,o){var u;if(i.isKeyField()){if("array-contains"===a||"array-contains-any"===a)throw new Yd(Qd.INVALID_ARGUMENT,"Invalid Query. You can't perform '".concat(a,"' queries on documentId()."));if("in"===a||"not-in"===a){$I(o,a);var s,c=[],l=w(o);try{for(l.s();!(s=l.n()).done;){var f=s.value;c.push(XI(r,e,f))}}catch(h){l.e(h)}finally{l.f()}u={arrayValue:{values:c}}}else u=XI(r,e,o)}else"in"!==a&&"not-in"!==a&&"array-contains-any"!==a||$I(o,a),u=xI(n,t,o,"in"===a||"not-in"===a);return gm.create(i,a,u)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value);return n}}],[{key:"_create",value:function(e,t,r){return new n(e,t,r)}}]),n}(VI);var zI=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this)).type=e,i._queryConstraints=r,i}return k(n,[{key:"_parse",value:function(e){var t=this._queryConstraints.map((function(t){return t._parse(e)})).filter((function(e){return e.getFilters().length>0}));return 1===t.length?t[0]:km.create(t,this._getOperator())}},{key:"_apply",value:function(e){var t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){var n,r=e,i=w(t.getFlattenedFilters());try{for(i.s();!(n=i.n()).done;){var a=n.value;ZI(r,a),r=$m(r,a)}}catch(o){i.e(o)}finally{i.f()}}(e._query,t),new FT(e.firestore,e.converter,$m(e._query,t)))}},{key:"_getQueryConstraints",value:function(){return this._queryConstraints}},{key:"_getOperator",value:function(){return"and"===this.type?"and":"or"}}],[{key:"_create",value:function(e,t){return new n(e,t)}}]),n}(FI);var BI=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this))._field=e,i._direction=r,i.type="orderBy",i}return k(n,[{key:"_apply",value:function(e){var t=function(e,t,n){if(null!==e.startAt)throw new Yd(Qd.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==e.endAt)throw new Yd(Qd.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new vm(t,n)}(e._query,this._field,this._direction);return new FT(e.firestore,e.converter,function(e,t){var n=e.explicitOrderBy.concat([t]);return new Km(e.path,e.collectionGroup,n,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(e._query,t))}}],[{key:"_create",value:function(e,t){return new n(e,t)}}]),n}(VI);var qI=function(e){x(n,e);var t=E(n);function n(e,r,i){var a;return y(this,n),(a=t.call(this)).type=e,a._limit=r,a._limitType=i,a}return k(n,[{key:"_apply",value:function(e){return new FT(e.firestore,e.converter,Zm(e._query,this._limit,this._limitType))}}],[{key:"_create",value:function(e,t,r){return new n(e,t,r)}}]),n}(VI);var KI=function(e){x(n,e);var t=E(n);function n(e,r,i){var a;return y(this,n),(a=t.call(this)).type=e,a._docOrFields=r,a._inclusive=i,a}return k(n,[{key:"_apply",value:function(e){var t=JI(e,this.type,this._docOrFields,this._inclusive);return new FT(e.firestore,e.converter,function(e,t){return new Km(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,t,e.endAt)}(e._query,t))}}],[{key:"_create",value:function(e,t,r){return new n(e,t,r)}}]),n}(VI);function GI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return KI._create("startAt",t,!0)}function HI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return KI._create("startAfter",t,!1)}var WI=function(e){x(n,e);var t=E(n);function n(e,r,i){var a;return y(this,n),(a=t.call(this)).type=e,a._docOrFields=r,a._inclusive=i,a}return k(n,[{key:"_apply",value:function(e){var t=JI(e,this.type,this._docOrFields,this._inclusive);return new FT(e.firestore,e.converter,function(e,t){return new Km(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,t)}(e._query,t))}}],[{key:"_create",value:function(e,t,r){return new n(e,t,r)}}]),n}(VI);function QI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return WI._create("endBefore",t,!1)}function YI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return WI._create("endAt",t,!0)}function JI(e,t,n,r){if(n[0]=ie(n[0]),n[0]instanceof RI)return function(e,t,n,r,i){if(!r)throw new Yd(Qd.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for ".concat(n,"()."));var a,o=[],u=w(Ym(e));try{for(u.s();!(a=u.n()).done;){var s=a.value;if(s.field.isKeyField())o.push(Xv(t,r.key));else{var c=r.data.field(s.field);if(Fv(c))throw new Yd(Qd.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+s.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===c){var l=s.field.canonicalString();throw new Yd(Qd.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '".concat(l,"' (used as the orderBy) does not exist."))}o.push(c)}}}catch(f){u.e(f)}finally{u.f()}return new hm(o,i)}(e._query,e.firestore._databaseId,t,n[0]._document,r);var i=dI(e.firestore);return function(e,t,n,r,i,a){var o=e.explicitOrderBy;if(i.length>o.length)throw new Yd(Qd.INVALID_ARGUMENT,"Too many arguments provided to ".concat(r,"(). The number of arguments must be less than or equal to the number of orderBy() clauses"));for(var u=[],s=0;s<i.length;s++){var c=i[s];if(o[s].field.isKeyField()){if("string"!=typeof c)throw new Yd(Qd.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in ".concat(r,"(), but got a ").concat(typeof c));if(!Qm(e)&&-1!==c.indexOf("/"))throw new Yd(Qd.INVALID_ARGUMENT,"Invalid query. When querying a collection and ordering by documentId(), the value passed to ".concat(r,"() must be a plain document ID, but '").concat(c,"' contains a slash."));var l=e.path.child(dp.fromString(c));if(!mp.isDocumentKey(l))throw new Yd(Qd.INVALID_ARGUMENT,"Invalid query. When querying a collection group and ordering by documentId(), the value passed to ".concat(r,"() must result in a valid document path, but '").concat(l,"' is not because it contains an odd number of segments."));var f=new mp(l);u.push(Xv(t,f))}else{var h=xI(n,r,c);u.push(h)}}return new hm(u,a)}(e._query,e.firestore._databaseId,i,t,n,r)}function XI(e,t,n){if("string"==typeof(n=ie(n))){if(""===n)throw new Yd(Qd.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Qm(t)&&-1!==n.indexOf("/"))throw new Yd(Qd.INVALID_ARGUMENT,"Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '".concat(n,"' contains a '/' character."));var r=t.path.child(dp.fromString(n));if(!mp.isDocumentKey(r))throw new Yd(Qd.INVALID_ARGUMENT,"Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '".concat(r,"' is not because it has an odd number of segments (").concat(r.length,")."));return Xv(e,new mp(r))}if(n instanceof VT)return Xv(e,n._key);throw new Yd(Qd.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ".concat(PT(n),"."))}function $I(e,t){if(!Array.isArray(e)||0===e.length)throw new Yd(Qd.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '".concat(t.toString(),"' filters."))}function ZI(e,t){var n=function(e,t){var n,r=w(e);try{for(r.s();!(n=r.n()).done;){var i,a=w(n.value.getFlattenedFilters());try{for(a.s();!(i=a.n()).done;){var o=i.value;if(t.indexOf(o.op)>=0)return o.op}}catch(u){a.e(u)}finally{a.f()}}}catch(u){r.e(u)}finally{r.f()}return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new Yd(Qd.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '".concat(t.op.toString(),"' filter.")):new Yd(Qd.INVALID_ARGUMENT,"Invalid query. You cannot use '".concat(t.op.toString(),"' filters with '").concat(n.toString(),"' filters."))}var eE=function(){function e(){y(this,e)}return k(e,[{key:"convertValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";switch(Kv(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Lv(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(Mv(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 10:return this.convertObject(e.mapValue,t);default:throw Gd()}}},{key:"convertObject",value:function(e,t){return this.convertObjectMap(e.fields,t)}},{key:"convertObjectMap",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",r={};return _v(e,(function(e,i){r[e]=t.convertValue(i,n)})),r}},{key:"convertGeoPoint",value:function(e){return new oI(Lv(e.latitude),Lv(e.longitude))}},{key:"convertArray",value:function(e,t){var n=this;return(e.values||[]).map((function(e){return n.convertValue(e,t)}))}},{key:"convertServerTimestamp",value:function(e,t){switch(t){case"previous":var n=Vv(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Uv(e));default:return null}}},{key:"convertTimestamp",value:function(e){var t=Ov(e);return new lp(t.seconds,t.nanos)}},{key:"convertDocumentKey",value:function(e,t){var n=dp.fromString(e);Hd(nk(n));var r=new zv(n.get(1),n.get(3)),i=new mp(n.popFirst(5));return r.isEqual(t)||Bd("Document ".concat(i," contains a document reference within a different database (").concat(r.projectId,"/").concat(r.database,") which is not supported. It will be treated as a reference in the current database (").concat(t.projectId,"/").concat(t.database,") instead.")),i}}]),e}();function tE(e,t,n){return e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t}var nE=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this)).firestore=e,r}return k(n,[{key:"convertBytes",value:function(e){return new rI(e)}},{key:"convertReference",value:function(e){var t=this.convertDocumentKey(e,this.firestore._databaseId);return new VT(this.firestore,null,t)}}]),n}(eE);var rE=function(){function e(t,n){y(this,e),this.hasPendingWrites=t,this.fromCache=n}return k(e,[{key:"isEqual",value:function(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}]),e}(),iE=function(e){x(n,e);var t=E(n);function n(e,r,i,a,o,u){var s;return y(this,n),(s=t.call(this,e,r,i,a,u))._firestore=e,s._firestoreImpl=e,s.metadata=o,s}return k(n,[{key:"exists",value:function(){return Ot(T(n.prototype),"exists",this).call(this)}},{key:"data",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._document){if(this._converter){var t=new aE(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._document){var n=this._document.data.field(LI("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}}]),n}(RI),aE=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.apply(this,arguments)}return k(n,[{key:"data",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Ot(T(n.prototype),"data",this).call(this,e)}}]),n}(iE),oE=function(){function e(t,n,r,i){y(this,e),this._firestore=t,this._userDataWriter=n,this._snapshot=i,this.metadata=new rE(i.hasPendingWrites,i.fromCache),this.query=r}return k(e,[{key:"docs",get:function(){var e=[];return this.forEach((function(t){return e.push(t)})),e}},{key:"size",get:function(){return this._snapshot.docs.size}},{key:"empty",get:function(){return 0===this.size}},{key:"forEach",value:function(e,t){var n=this;this._snapshot.docs.forEach((function(r){e.call(t,new aE(n._firestore,n._userDataWriter,r.key,r,new rE(n._snapshot.mutatedKeys.has(r.key),n._snapshot.fromCache),n.query.converter))}))}},{key:"docChanges",value:function(){var e=!!(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Yd(Qd.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){var n=0;return e._snapshot.docChanges.map((function(t){var r=new aE(e._firestore,e._userDataWriter,t.doc.key,t.doc,new rE(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);return t.doc,{type:"added",doc:r,oldIndex:-1,newIndex:n++}}))}var r=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((function(e){return t||3!==e.type})).map((function(t){var n=new aE(e._firestore,e._userDataWriter,t.doc.key,t.doc,new rE(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),i=-1,a=-1;return 0!==t.type&&(i=r.indexOf(t.doc.key),r=r.delete(t.doc.key)),1!==t.type&&(a=(r=r.add(t.doc)).indexOf(t.doc.key)),{type:uE(t.type),doc:n,oldIndex:i,newIndex:a}}))}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}]),e}();function uE(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Gd()}}function sE(e,t){return e instanceof iE&&t instanceof iE?e._firestore===t._firestore&&e._key.isEqual(t._key)&&(null===e._document?null===t._document:e._document.isEqual(t._document))&&e._converter===t._converter:e instanceof oE&&t instanceof oE&&e._firestore===t._firestore&&qT(e.query,t.query)&&e.metadata.isEqual(t.metadata)&&e._snapshot.isEqual(t._snapshot)}var cE=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this)).firestore=e,r}return k(n,[{key:"convertBytes",value:function(e){return new rI(e)}},{key:"convertReference",value:function(e){var t=this.convertDocumentKey(e,this.firestore._databaseId);return new VT(this.firestore,null,t)}}]),n}(eE);function lE(e){e=DT(e,VT);var t=DT(e.firestore,WT),n=QT(t),r=new cE(t);return function(e,t){var n=new Jd;return e.asyncQueue.enqueueAndForget(u(a().mark((function r(){return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.t0=function(){var e=u(a().mark((function e(t,n,r){var i,o;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,function(e,t){var n=Wd(e);return n.persistence.runTransaction("read document","readonly",(function(e){return n.localDocuments.getDocument(e,t)}))}(t,n);case 3:(i=e.sent).isFoundDocument()?r.resolve(i):i.isNoDocument()?r.resolve(null):r.reject(new Yd(Qd.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)")),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(0),o=P_(e.t0,"Failed to get document '".concat(n," from cache")),r.reject(o);case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t,n,r){return e.apply(this,arguments)}}(),r.next=3,yT(e);case 3:return r.t1=r.sent,r.t2=t,r.t3=n,r.abrupt("return",(0,r.t0)(r.t1,r.t2,r.t3));case 7:case"end":return r.stop()}}),r)})))),n.promise}(n,e._key).then((function(n){return new iE(t,r,e._key,n,new rE(null!==n&&n.hasLocalMutations,!0),e.converter)}))}function fE(e){e=DT(e,FT);var t=DT(e.firestore,WT),n=QT(t),r=new cE(t);return MI(e._query),TT(n,e._query).then((function(n){return new oE(t,r,e,n)}))}function hE(e){e=DT(e,FT);var t=DT(e.firestore,WT),n=QT(t),r=new cE(t);return function(e,t){var n=new Jd;return e.asyncQueue.enqueueAndForget(u(a().mark((function r(){return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.t0=function(){var e=u(a().mark((function e(t,n,r){var i,o,u,s,c;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,ub(t,n,!0);case 3:i=e.sent,o=new X_(n,i.hs),u=o.la(i.documents),s=o.applyChanges(u,!1),r.resolve(s.snapshot),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),c=P_(e.t0,"Failed to execute query '".concat(n," against cache")),r.reject(c);case 14:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(t,n,r){return e.apply(this,arguments)}}(),r.next=3,yT(e);case 3:return r.t1=r.sent,r.t2=t,r.t3=n,r.abrupt("return",(0,r.t0)(r.t1,r.t2,r.t3));case 7:case"end":return r.stop()}}),r)})))),n.promise}(n,e._query).then((function(n){return new oE(t,r,e,n)}))}function dE(e){e=DT(e,FT);var t=DT(e.firestore,WT),n=QT(t),r=new cE(t);return TT(n,e._query,{source:"server"}).then((function(n){return new oE(t,r,e,n)}))}function pE(e,t,n){e=DT(e,VT);var r=DT(e.firestore,WT),i=tE(e.converter,t,n);return gE(r,[pI(dI(r),"setDoc",e._key,i,null!==e.converter,n).toMutation(e._key,Vy.none())])}function vE(e,t,n){e=DT(e,VT);for(var r=DT(e.firestore,WT),i=dI(r),a=arguments.length,o=new Array(a>3?a-3:0),u=3;u<a;u++)o[u-3]=arguments[u];return gE(r,[("string"==typeof(t=ie(t))||t instanceof iI?_I(i,"updateDoc",e._key,t,n,o):bI(i,"updateDoc",e._key,t)).toMutation(e._key,Vy.exists(!0))])}function mE(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i,o,s;e=ie(e);var c={includeMetadataChanges:!1},l=0;"object"!=typeof n[l]||GT(n[l])||(c=n[l],l++);var f,h,d,p={includeMetadataChanges:c.includeMetadataChanges};if(GT(n[l])){var v=n[l];n[l]=null===(i=v.next)||void 0===i?void 0:i.bind(v),n[l+1]=null===(o=v.error)||void 0===o?void 0:o.bind(v),n[l+2]=null===(s=v.complete)||void 0===s?void 0:s.bind(v)}if(e instanceof VT)h=DT(e.firestore,WT),d=Hm(e._key.path),f={next:function(t){n[l]&&n[l](kE(h,e,t))},error:n[l+1],complete:n[l+2]};else{var m=DT(e,FT);h=DT(m.firestore,WT),d=m._query;var y=new cE(h);f={next:function(e){n[l]&&n[l](new oE(h,y,m,e))},error:n[l+1],complete:n[l+2]},MI(e._query)}return function(e,t,n,r){var i=new nT(r),o=new K_(t,i,n);return e.asyncQueue.enqueueAndForget(u(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=F_,t.next=3,bT(e);case 3:return t.t1=t.sent,t.t2=o,t.abrupt("return",(0,t.t0)(t.t1,t.t2));case 6:case"end":return t.stop()}}),t)})))),function(){i.Ba(),e.asyncQueue.enqueueAndForget(u(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=U_,t.next=3,bT(e);case 3:return t.t1=t.sent,t.t2=o,t.abrupt("return",(0,t.t0)(t.t1,t.t2));case 6:case"end":return t.stop()}}),t)}))))}}(QT(h),d,p,f)}function yE(e,t){return function(e,t){var n=new nT(t);return e.asyncQueue.enqueueAndForget(u(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=function(e,t){Wd(e).Q_.add(t),t.next()},t.next=3,bT(e);case 3:return t.t1=t.sent,t.t2=n,t.abrupt("return",(0,t.t0)(t.t1,t.t2));case 6:case"end":return t.stop()}}),t)})))),function(){n.Ba(),e.asyncQueue.enqueueAndForget(u(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=function(e,t){Wd(e).Q_.delete(t)},t.next=3,bT(e);case 3:return t.t1=t.sent,t.t2=n,t.abrupt("return",(0,t.t0)(t.t1,t.t2));case 6:case"end":return t.stop()}}),t)}))))}}(QT(e=DT(e,WT)),GT(t)?t:{next:t})}function gE(e,t){return function(e,t){var n=new Jd;return e.asyncQueue.enqueueAndForget(u(a().mark((function r(){return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.t0=ux,r.next=3,kT(e);case 3:return r.t1=r.sent,r.t2=t,r.t3=n,r.abrupt("return",(0,r.t0)(r.t1,r.t2,r.t3));case 7:case"end":return r.stop()}}),r)})))),n.promise}(QT(e),t)}function kE(e,t,n){var r=n.docs.get(t._key),i=new cE(e);return new iE(e,i,t._key,r,new rE(n.hasPendingWrites,n.fromCache),t.converter)}var wE={maxAttempts:5},bE=function(){function e(t,n){y(this,e),this._firestore=t,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=dI(t)}return k(e,[{key:"set",value:function(e,t,n){this._verifyNotCommitted();var r=_E(e,this._firestore),i=tE(r.converter,t,n),a=pI(this._dataReader,"WriteBatch.set",r._key,i,null!==r.converter,n);return this._mutations.push(a.toMutation(r._key,Vy.none())),this}},{key:"update",value:function(e,t,n){this._verifyNotCommitted();for(var r,i=_E(e,this._firestore),a=arguments.length,o=new Array(a>3?a-3:0),u=3;u<a;u++)o[u-3]=arguments[u];return r="string"==typeof(t=ie(t))||t instanceof iI?_I(this._dataReader,"WriteBatch.update",i._key,t,n,o):bI(this._dataReader,"WriteBatch.update",i._key,t),this._mutations.push(r.toMutation(i._key,Vy.exists(!0))),this}},{key:"delete",value:function(e){this._verifyNotCommitted();var t=_E(e,this._firestore);return this._mutations=this._mutations.concat(new Zy(t._key,Vy.none())),this}},{key:"commit",value:function(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}},{key:"_verifyNotCommitted",value:function(){if(this._committed)throw new Yd(Qd.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}]),e}();function _E(e,t){if((e=ie(e)).firestore!==t)throw new Yd(Qd.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}var xE=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this,e,r))._firestore=e,i}return k(n,[{key:"get",value:function(e){var t=this,r=_E(e,this._firestore),i=new cE(this._firestore);return Ot(T(n.prototype),"get",this).call(this,e).then((function(e){return new iE(t._firestore,i,r._key,e._document,new rE(!1,!1),r.converter)}))}}]),n}(function(){function e(t,n){y(this,e),this._firestore=t,this._transaction=n,this._dataReader=dI(t)}return k(e,[{key:"get",value:function(e){var t=this,n=_E(e,this._firestore),r=new nE(this._firestore);return this._transaction.lookup([n._key]).then((function(e){if(!e||1!==e.length)return Gd();var i=e[0];if(i.isFoundDocument())return new RI(t._firestore,r,i.key,i,n.converter);if(i.isNoDocument())return new RI(t._firestore,r,n._key,null,n.converter);throw Gd()}))}},{key:"set",value:function(e,t,n){var r=_E(e,this._firestore),i=tE(r.converter,t,n),a=pI(this._dataReader,"Transaction.set",r._key,i,null!==r.converter,n);return this._transaction.set(r._key,a),this}},{key:"update",value:function(e,t,n){for(var r,i=_E(e,this._firestore),a=arguments.length,o=new Array(a>3?a-3:0),u=3;u<a;u++)o[u-3]=arguments[u];return r="string"==typeof(t=ie(t))||t instanceof iI?_I(this._dataReader,"Transaction.update",i._key,t,n,o):bI(this._dataReader,"Transaction.update",i._key,t),this._transaction.update(i._key,r),this}},{key:"delete",value:function(e){var t=_E(e,this._firestore);return this._transaction.delete(t._key),this}}]),e}());function TE(e,t,n){e=DT(e,WT);var r=Object.assign(Object.assign({},wE),n);return function(e){if(e.maxAttempts<1)throw new Yd(Qd.INVALID_ARGUMENT,"Max attempts must be at least 1")}(r),function(e,t,n){var r=new Jd;return e.asyncQueue.enqueueAndForget(u(a().mark((function i(){var o;return a().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,wT(e);case 2:o=i.sent,new aT(e.asyncQueue,o,n,t,r).run();case 4:case"end":return i.stop()}}),i)})))),r.promise}(QT(e),(function(n){return t(new xE(e,n))}),r)}function IE(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new gI("arrayUnion",t)}function EE(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new kI("arrayRemove",t)}new WeakMap;!function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!function(e){Vd=e}(tt),Qe(new ue("firestore",(function(e,n){var r=n.instanceIdentifier,i=n.options,a=e.getProvider("app").getImmediate(),o=new WT(new ep(e.getProvider("auth-internal")),new ip(e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new Yd(Qd.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new zv(e.options.projectId,t)}(a,r),a);return i=Object.assign({useFetchStreams:t},i),o._setSettings(i),o}),"PUBLIC").setMultipleInstances(!0)),ut(Md,"4.3.0",e),ut(Md,"4.3.0","esm2017")}();function SE(e,t){if(void 0===t)return{merge:!1};if(void 0!==t.mergeFields&&void 0!==t.merge)throw new Yd("invalid-argument","Invalid options passed to function ".concat(e,"(): You cannot ")+'specify both "merge" and "mergeFields".');return t}function CE(){if("undefined"===typeof Uint8Array)throw new Yd("unimplemented","Uint8Arrays are not available in this environment.")}function AE(){if("undefined"==typeof atob)throw new Yd("unimplemented","Blobs are unavailable in Firestore in this environment.")}var NE=function(){function e(t){y(this,e),this._delegate=t}return k(e,[{key:"toBase64",value:function(){return AE(),this._delegate.toBase64()}},{key:"toUint8Array",value:function(){return CE(),this._delegate.toUint8Array()}},{key:"isEqual",value:function(e){return this._delegate.isEqual(e._delegate)}},{key:"toString",value:function(){return"Blob(base64: "+this.toBase64()+")"}}],[{key:"fromBase64String",value:function(t){return AE(),new e(rI.fromBase64String(t))}},{key:"fromUint8Array",value:function(t){return CE(),new e(rI.fromUint8Array(t))}}]),e}();function PE(e){return function(e,t){if("object"!==typeof e||null===e)return!1;var n,r=e,i=w(t);try{for(i.s();!(n=i.n()).done;){var a=n.value;if(a in r&&"function"===typeof r[a])return!0}}catch(o){i.e(o)}finally{i.f()}return!1}(e,["next","error","complete"])}var DE=function(){function e(){y(this,e)}return k(e,[{key:"enableIndexedDbPersistence",value:function(e,t){return function(e,t){nI(e=DT(e,WT));var n=QT(e);if(n._uninitializedComponentsProvider)throw new Yd(Qd.FAILED_PRECONDITION,"SDK cache is already specified.");qd("enableIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");var r=e._freezeSettings(),i=new eT;return JT(n,i,new $x(i,r.cacheSizeBytes,null==t?void 0:t.forceOwnership))}(e._delegate,{forceOwnership:t})}},{key:"enableMultiTabIndexedDbPersistence",value:function(e){return function(e){nI(e=DT(e,WT));var t=QT(e);if(t._uninitializedComponentsProvider)throw new Yd(Qd.FAILED_PRECONDITION,"SDK cache is already specified.");qd("enableMultiTabIndexedDbPersistence() will be deprecated in the future, you can use `FirestoreSettings.cache` instead.");var n=e._freezeSettings(),r=new eT;return JT(t,r,new Zx(r,n.cacheSizeBytes))}(e._delegate)}},{key:"clearIndexedDbPersistence",value:function(e){return function(e){if(e._initialized&&!e._terminated)throw new Yd(Qd.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");var t=new Jd;return e._queue.enqueueAndForgetEvenWhileRestricted(u(a().mark((function n(){return a().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,function(){var e=u(a().mark((function e(t){var n;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Dp.C()){e.next=2;break}return e.abrupt("return",Promise.resolve());case 2:return n=t+"main",e.next=5,Dp.delete(n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()(Gw(e._databaseId,e._persistenceKey));case 3:t.resolve(),n.next=9;break;case 6:n.prev=6,n.t0=n.catch(0),t.reject(n.t0);case 9:case"end":return n.stop()}}),n,null,[[0,6]])})))),t.promise}(e._delegate)}}]),e}(),RE=function(){function e(t,n,r){var i=this;y(this,e),this._delegate=n,this._persistenceProvider=r,this.INTERNAL={delete:function(){return i.terminate()}},t instanceof zv||(this._appCompat=t)}return k(e,[{key:"_databaseId",get:function(){return this._delegate._databaseId}},{key:"settings",value:function(e){var t=this._delegate._getSettings();e.merge||t.host===e.host||qd("You are overriding the original host. If you did not intend to override your settings, use {merge: true}."),e.merge&&delete(e=Object.assign(Object.assign({},t),e)).merge,this._delegate._setSettings(e)}},{key:"useEmulator",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};MT(this._delegate,e,t,n)}},{key:"enableNetwork",value:function(){return $T(this._delegate)}},{key:"disableNetwork",value:function(){return ZT(this._delegate)}},{key:"enablePersistence",value:function(e){var t=!1,n=!1;return e&&CT("synchronizeTabs",t=!!e.synchronizeTabs,"experimentalForceOwningTab",n=!!e.experimentalForceOwningTab),t?this._persistenceProvider.enableMultiTabIndexedDbPersistence(this):this._persistenceProvider.enableIndexedDbPersistence(this,n)}},{key:"clearPersistence",value:function(){return this._persistenceProvider.clearIndexedDbPersistence(this)}},{key:"terminate",value:function(){return this._appCompat&&(this._appCompat._removeServiceInstance("firestore-compat"),this._appCompat._removeServiceInstance("firestore")),this._delegate._delete()}},{key:"waitForPendingWrites",value:function(){return XT(this._delegate)}},{key:"onSnapshotsInSync",value:function(e){return yE(this._delegate,e)}},{key:"app",get:function(){if(!this._appCompat)throw new Yd("failed-precondition","Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._appCompat}},{key:"collection",value:function(e){try{return new WE(this,jT(this._delegate,e))}catch(t){throw UE(t,"collection()","Firestore.collection()")}}},{key:"doc",value:function(e){try{return new VE(this,zT(this._delegate,e))}catch(t){throw UE(t,"doc()","Firestore.doc()")}}},{key:"collectionGroup",value:function(e){try{return new KE(this,function(e,t){if(e=DT(e,LT),ST("collectionGroup","collection id",t),t.indexOf("/")>=0)throw new Yd(Qd.INVALID_ARGUMENT,"Invalid collection ID '".concat(t,"' passed to function collectionGroup(). Collection IDs must not contain '/'."));return new FT(e,null,function(e){return new Km(dp.emptyPath(),e)}(t))}(this._delegate,e))}catch(t){throw UE(t,"collectionGroup()","Firestore.collectionGroup()")}}},{key:"runTransaction",value:function(e){var t=this;return TE(this._delegate,(function(n){return e(new LE(t,n))}))}},{key:"batch",value:function(){var e=this;return QT(this._delegate),new ME(new bE(this._delegate,(function(t){return gE(e._delegate,t)})))}},{key:"loadBundle",value:function(e){return eI(this._delegate,e)}},{key:"namedQuery",value:function(e){var t=this;return tI(this._delegate,e).then((function(e){return e?new KE(t,e):null}))}}]),e}(),OE=function(e){x(n,e);var t=E(n);function n(e){var r;return y(this,n),(r=t.call(this)).firestore=e,r}return k(n,[{key:"convertBytes",value:function(e){return new NE(new rI(e))}},{key:"convertReference",value:function(e){var t=this.convertDocumentKey(e,this.firestore._databaseId);return VE.forKey(t,this.firestore,null)}}]),n}(eE);var LE=function(){function e(t,n){y(this,e),this._firestore=t,this._delegate=n,this._userDataWriter=new OE(t)}return k(e,[{key:"get",value:function(e){var t=this,n=QE(e);return this._delegate.get(n).then((function(e){return new BE(t._firestore,new iE(t._firestore._delegate,t._userDataWriter,e._key,e._document,e.metadata,n.converter))}))}},{key:"set",value:function(e,t,n){var r=QE(e);return n?(SE("Transaction.set",n),this._delegate.set(r,t,n)):this._delegate.set(r,t),this}},{key:"update",value:function(e,t,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),a=3;a<r;a++)i[a-3]=arguments[a];var o,u=QE(e);2===arguments.length?this._delegate.update(u,t):(o=this._delegate).update.apply(o,[u,t,n].concat(i));return this}},{key:"delete",value:function(e){var t=QE(e);return this._delegate.delete(t),this}}]),e}(),ME=function(){function e(t){y(this,e),this._delegate=t}return k(e,[{key:"set",value:function(e,t,n){var r=QE(e);return n?(SE("WriteBatch.set",n),this._delegate.set(r,t,n)):this._delegate.set(r,t),this}},{key:"update",value:function(e,t,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),a=3;a<r;a++)i[a-3]=arguments[a];var o,u=QE(e);2===arguments.length?this._delegate.update(u,t):(o=this._delegate).update.apply(o,[u,t,n].concat(i));return this}},{key:"delete",value:function(e){var t=QE(e);return this._delegate.delete(t),this}},{key:"commit",value:function(){return this._delegate.commit()}}]),e}(),FE=function(){function e(t,n,r){y(this,e),this._firestore=t,this._userDataWriter=n,this._delegate=r}return k(e,[{key:"fromFirestore",value:function(e,t){var n=new aE(this._firestore._delegate,this._userDataWriter,e._key,e._document,e.metadata,null);return this._delegate.fromFirestore(new qE(this._firestore,n),null!==t&&void 0!==t?t:{})}},{key:"toFirestore",value:function(e,t){return t?this._delegate.toFirestore(e,t):this._delegate.toFirestore(e)}}],[{key:"getInstance",value:function(t,n){var r=e.INSTANCES,i=r.get(t);i||(i=new WeakMap,r.set(t,i));var a=i.get(n);return a||(a=new e(t,new OE(t),n),i.set(n,a)),a}}]),e}();FE.INSTANCES=new WeakMap;var VE=function(){function e(t,n){y(this,e),this.firestore=t,this._delegate=n,this._userDataWriter=new OE(t)}return k(e,[{key:"id",get:function(){return this._delegate.id}},{key:"parent",get:function(){return new WE(this.firestore,this._delegate.parent)}},{key:"path",get:function(){return this._delegate.path}},{key:"collection",value:function(e){try{return new WE(this.firestore,jT(this._delegate,e))}catch(t){throw UE(t,"collection()","DocumentReference.collection()")}}},{key:"isEqual",value:function(e){return(e=ie(e))instanceof VT&&BT(this._delegate,e)}},{key:"set",value:function(e,t){t=SE("DocumentReference.set",t);try{return t?pE(this._delegate,e,t):pE(this._delegate,e)}catch(n){throw UE(n,"setDoc()","DocumentReference.set()")}}},{key:"update",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];try{return 1===arguments.length?vE(this._delegate,e):vE.apply(void 0,[this._delegate,e,t].concat(r))}catch(a){throw UE(a,"updateDoc()","DocumentReference.update()")}}},{key:"delete",value:function(){return gE(DT((e=this._delegate).firestore,WT),[new Zy(e._key,Vy.none())]);var e}},{key:"onSnapshot",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=jE(n),a=zE(n,(function(t){return new BE(e.firestore,new iE(e.firestore._delegate,e._userDataWriter,t._key,t._document,t.metadata,e._delegate.converter))}));return mE(this._delegate,i,a)}},{key:"get",value:function(e){var t=this;return("cache"===(null===e||void 0===e?void 0:e.source)?lE(this._delegate):"server"===(null===e||void 0===e?void 0:e.source)?function(e){e=DT(e,VT);var t=DT(e.firestore,WT);return xT(QT(t),e._key,{source:"server"}).then((function(n){return kE(t,e,n)}))}(this._delegate):function(e){e=DT(e,VT);var t=DT(e.firestore,WT);return xT(QT(t),e._key).then((function(n){return kE(t,e,n)}))}(this._delegate)).then((function(e){return new BE(t.firestore,new iE(t.firestore._delegate,t._userDataWriter,e._key,e._document,e.metadata,t._delegate.converter))}))}},{key:"withConverter",value:function(t){return new e(this.firestore,t?this._delegate.withConverter(FE.getInstance(this.firestore,t)):this._delegate.withConverter(null))}}],[{key:"forPath",value:function(t,n,r){if(t.length%2!==0)throw new Yd("invalid-argument","Invalid document reference. Document references must have an even number of segments, but "+"".concat(t.canonicalString()," has ").concat(t.length));return new e(n,new VT(n._delegate,r,new mp(t)))}},{key:"forKey",value:function(t,n,r){return new e(n,new VT(n._delegate,r,t))}}]),e}();function UE(e,t,n){return e.message=e.message.replace(t,n),e}function jE(e){var t,n=w(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;if("object"===typeof r&&!PE(r))return r}}catch(i){n.e(i)}finally{n.f()}return{}}function zE(e,t){var n,r,i;return{next:function(e){i.next&&i.next(t(e))},error:null===(n=(i=PE(e[0])?e[0]:PE(e[1])?e[1]:"function"===typeof e[0]?{next:e[0],error:e[1],complete:e[2]}:{next:e[1],error:e[2],complete:e[3]}).error)||void 0===n?void 0:n.bind(i),complete:null===(r=i.complete)||void 0===r?void 0:r.bind(i)}}var BE=function(){function e(t,n){y(this,e),this._firestore=t,this._delegate=n}return k(e,[{key:"ref",get:function(){return new VE(this._firestore,this._delegate.ref)}},{key:"id",get:function(){return this._delegate.id}},{key:"metadata",get:function(){return this._delegate.metadata}},{key:"exists",get:function(){return this._delegate.exists()}},{key:"data",value:function(e){return this._delegate.data(e)}},{key:"get",value:function(e,t){return this._delegate.get(e,t)}},{key:"isEqual",value:function(e){return sE(this._delegate,e._delegate)}}]),e}(),qE=function(e){x(n,e);var t=E(n);function n(){return y(this,n),t.apply(this,arguments)}return k(n,[{key:"data",value:function(e){var t=this._delegate.data(e);return void 0!==t||Gd(),t}}]),n}(BE),KE=function(){function e(t,n){y(this,e),this.firestore=t,this._delegate=n,this._userDataWriter=new OE(t)}return k(e,[{key:"where",value:function(t,n,r){try{return new e(this.firestore,UI(this._delegate,function(e,t,n){var r=t,i=LI("where",e);return jI._create(i,r,n)}(t,n,r)))}catch(i){throw UE(i,/(orderBy|where)\(\)/,"Query.$1()")}}},{key:"orderBy",value:function(t,n){try{return new e(this.firestore,UI(this._delegate,function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asc",n=LI("orderBy",e);return BI._create(n,t)}(t,n)))}catch(r){throw UE(r,/(orderBy|where)\(\)/,"Query.$1()")}}},{key:"limit",value:function(t){try{return new e(this.firestore,UI(this._delegate,(RT("limit",n=t),qI._create("limit",n,"F"))))}catch(n){throw UE(n,"limit()","Query.limit()")}var n}},{key:"limitToLast",value:function(t){try{return new e(this.firestore,UI(this._delegate,(RT("limitToLast",n=t),qI._create("limitToLast",n,"L"))))}catch(n){throw UE(n,"limitToLast()","Query.limitToLast()")}var n}},{key:"startAt",value:function(){try{return new e(this.firestore,UI(this._delegate,GI.apply(void 0,arguments)))}catch(t){throw UE(t,"startAt()","Query.startAt()")}}},{key:"startAfter",value:function(){try{return new e(this.firestore,UI(this._delegate,HI.apply(void 0,arguments)))}catch(t){throw UE(t,"startAfter()","Query.startAfter()")}}},{key:"endBefore",value:function(){try{return new e(this.firestore,UI(this._delegate,QI.apply(void 0,arguments)))}catch(t){throw UE(t,"endBefore()","Query.endBefore()")}}},{key:"endAt",value:function(){try{return new e(this.firestore,UI(this._delegate,YI.apply(void 0,arguments)))}catch(t){throw UE(t,"endAt()","Query.endAt()")}}},{key:"isEqual",value:function(e){return qT(this._delegate,e._delegate)}},{key:"get",value:function(e){var t=this;return("cache"===(null===e||void 0===e?void 0:e.source)?hE(this._delegate):"server"===(null===e||void 0===e?void 0:e.source)?dE(this._delegate):fE(this._delegate)).then((function(e){return new HE(t.firestore,new oE(t.firestore._delegate,t._userDataWriter,t._delegate,e._snapshot))}))}},{key:"onSnapshot",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=jE(n),a=zE(n,(function(t){return new HE(e.firestore,new oE(e.firestore._delegate,e._userDataWriter,e._delegate,t._snapshot))}));return mE(this._delegate,i,a)}},{key:"withConverter",value:function(t){return new e(this.firestore,t?this._delegate.withConverter(FE.getInstance(this.firestore,t)):this._delegate.withConverter(null))}}]),e}(),GE=function(){function e(t,n){y(this,e),this._firestore=t,this._delegate=n}return k(e,[{key:"type",get:function(){return this._delegate.type}},{key:"doc",get:function(){return new qE(this._firestore,this._delegate.doc)}},{key:"oldIndex",get:function(){return this._delegate.oldIndex}},{key:"newIndex",get:function(){return this._delegate.newIndex}}]),e}(),HE=function(){function e(t,n){y(this,e),this._firestore=t,this._delegate=n}return k(e,[{key:"query",get:function(){return new KE(this._firestore,this._delegate.query)}},{key:"metadata",get:function(){return this._delegate.metadata}},{key:"size",get:function(){return this._delegate.size}},{key:"empty",get:function(){return this._delegate.empty}},{key:"docs",get:function(){var e=this;return this._delegate.docs.map((function(t){return new qE(e._firestore,t)}))}},{key:"docChanges",value:function(e){var t=this;return this._delegate.docChanges(e).map((function(e){return new GE(t._firestore,e)}))}},{key:"forEach",value:function(e,t){var n=this;this._delegate.forEach((function(r){e.call(t,new qE(n._firestore,r))}))}},{key:"isEqual",value:function(e){return sE(this._delegate,e._delegate)}}]),e}(),WE=function(e){x(n,e);var t=E(n);function n(e,r){var i;return y(this,n),(i=t.call(this,e,r)).firestore=e,i._delegate=r,i}return k(n,[{key:"id",get:function(){return this._delegate.id}},{key:"path",get:function(){return this._delegate.path}},{key:"parent",get:function(){var e=this._delegate.parent;return e?new VE(this.firestore,e):null}},{key:"doc",value:function(e){try{return new VE(this.firestore,void 0===e?zT(this._delegate):zT(this._delegate,e))}catch(t){throw UE(t,"doc()","CollectionReference.doc()")}}},{key:"add",value:function(e){var t=this;return function(e,t){var n=DT(e.firestore,WT),r=zT(e),i=tE(e.converter,t);return gE(n,[pI(dI(e.firestore),"addDoc",r._key,i,null!==e.converter,{}).toMutation(r._key,Vy.exists(!1))]).then((function(){return r}))}(this._delegate,e).then((function(e){return new VE(t.firestore,e)}))}},{key:"isEqual",value:function(e){return BT(this._delegate,e._delegate)}},{key:"withConverter",value:function(e){return new n(this.firestore,e?this._delegate.withConverter(FE.getInstance(this.firestore,e)):this._delegate.withConverter(null))}}]),n}(KE);function QE(e){return DT(e,VT)}var YE=function(){function e(){y(this,e);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this._delegate=S(iI,n)}return k(e,[{key:"isEqual",value:function(e){return(e=ie(e))instanceof iI&&this._delegate._internalPath.isEqual(e._internalPath)}}],[{key:"documentId",value:function(){return new e(vp.keyField().canonicalString())}}]),e}(),JE=function(){function e(t){y(this,e),this._delegate=t}return k(e,[{key:"isEqual",value:function(e){return this._delegate.isEqual(e._delegate)}}],[{key:"serverTimestamp",value:function(){var t=new yI("serverTimestamp");return t._methodName="FieldValue.serverTimestamp",new e(t)}},{key:"delete",value:function(){var t=new vI("deleteField");return t._methodName="FieldValue.delete",new e(t)}},{key:"arrayUnion",value:function(){var t=IE.apply(void 0,arguments);return t._methodName="FieldValue.arrayUnion",new e(t)}},{key:"arrayRemove",value:function(){var t=EE.apply(void 0,arguments);return t._methodName="FieldValue.arrayRemove",new e(t)}},{key:"increment",value:function(t){var n=new wI("increment",t);return n._methodName="FieldValue.increment",new e(n)}}]),e}(),XE={Firestore:RE,GeoPoint:oI,Timestamp:lp,Blob:NE,Transaction:LE,WriteBatch:ME,DocumentReference:VE,DocumentSnapshot:BE,Query:KE,QueryDocumentSnapshot:qE,QuerySnapshot:HE,CollectionReference:WE,FieldPath:YE,FieldValue:JE,setLogLevel:function(e){var t;t=e,Ud.setLogLevel(t)},CACHE_SIZE_UNLIMITED:-1};!function(e){!function(e,t){e.INTERNAL.registerComponent(new ue("firestore-compat",(function(e){var n=e.getProvider("app-compat").getImmediate(),r=e.getProvider("firestore").getImmediate();return t(n,r)}),"PUBLIC").setServiceProps(Object.assign({},XE)))}(e,(function(e,t){return new RE(e,t,new DE)})),e.registerVersion("@firebase/firestore-compat","0.3.19")}(Rt);var $E=n.p+"static/media/THDCHN.20f4c346e1e54c1db2ef.jpg",ZE=n.p+"static/media/THDCHN2.4e972dcca304b1729bcb.jpg";Rt.initializeApp({apiKey:"AIzaSyANi6jm1em0TW_3cIzaw8dStebKFi9Q5wc",authDomain:"praytgt.firebaseapp.com",projectId:"praytgt",storageBucket:"praytgt.appspot.com",messagingSenderId:"691132041579",appId:"1:691132041579:web:2a48aa29b5e8912e17242e",measurementId:"G-PSGR1KKEPR"});var eS=Rt.firestore();function tS(){var e=document.querySelector(".App header"),t=document.querySelector(".HeaderText");e&&t&&(e.style.height=t.clientHeight+"px")}function nS(){var e=document.querySelector("main"),t=document.querySelector(".App header"),n=document.querySelector(".form-container");if(e&&t&&n){var r=window.innerHeight,i=t.clientHeight,a=n.clientHeight;e.style.height="".concat(r-i-a-21,"px")}}function rS(){var e=(0,t.useRef)(),n=(0,t.useRef)(),r=eS.collection("messages"),i=m((0,t.useState)(25),2),o=i[0],s=i[1],c=m((0,t.useState)([]),2),l=c[0],h=c[1],d=m((0,t.useState)(""),2),p=d[0],v=d[1],y=m((0,t.useState)(""),2),g=y[0],k=y[1],w=m((0,t.useState)(0),2),b=w[0],_=w[1],x=m((0,t.useState)(0),2),T=x[0],I=x[1];(0,t.useEffect)((function(){l&&l.length>0&&(n.current.scrollTop=n.current.scrollHeight-T)}),[l,T]);(0,t.useEffect)((function(){n.current.scrollTop=T}),[T]),(0,t.useEffect)((function(){r.orderBy("createdAt","desc").limit(o).onSnapshot((function(e){var t=e.docs.map((function(e){return f({id:e.id},e.data())}));h(t)}))}),[o]),(0,t.useEffect)((function(){r.get().then((function(e){_(e.size)}))}));var E=function(){var t=u(a().mark((function t(n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.preventDefault(),t.next=3,r.add({text:p,createdAt:Rt.firestore.FieldValue.serverTimestamp(),userName:g});case 3:v(""),e.current.scrollIntoView({behavior:"smooth"});case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();return t.createElement(t.Fragment,null,t.createElement("main",{ref:n},o<b&&t.createElement("button",{className:"load-more",onClick:function(){I(n.current.scrollHeight-n.current.scrollTop),s(o+10)}},"T\u1ea3i th\xeam"),l&&l.slice(-o).reverse().map((function(e){return t.createElement(iS,{key:e.id,message:e})})),t.createElement("span",{ref:e})),t.createElement("form",{onSubmit:E,className:"form-container"},t.createElement("div",{className:"input-container"},t.createElement("input",{className:"username-input",value:g,onChange:function(e){return k(e.target.value)},placeholder:"\u0110i\u1ec1n t\xean ng\u01b0\u1eddi c\u1ea7u nguy\u1ec7n"})," ",t.createElement("textarea",{className:"message-input",value:p,onChange:function(e){v(e.target.value)},placeholder:"\u0110i\u1ec1n n\u1ed9i dung l\u1eddi c\u1ea7u nguy\u1ec7n",rows:1})),t.createElement("button",{type:"submit",disabled:!p||!g},"\ud83d\ude4f")," "))}function iS(e){var n=e.message,r=n.text,i=n.userName,a=n.createdAt,o=r.split("\n").map((function(e,n){return t.createElement(t.Fragment,{key:n},n>0&&t.createElement("br",null),e)})),u=a?a.toDate():null,s=u?u.toLocaleDateString("vi-VN"):null;return t.createElement(t.Fragment,null,t.createElement("div",{className:"message"},t.createElement("p",{className:"username"},i),t.createElement("p",null,o),t.createElement("p",{className:"message-date"},s)," "))}window.addEventListener("resize",tS),window.addEventListener("resize",nS);var aS=function(){return(0,t.useEffect)((function(){tS(),nS(),function(){var e=document.querySelector("main"),t=document.querySelector(".App header");if(e&&t){var n=t.clientHeight;e.style.marginTop="".concat(n,"px")}}()})),t.createElement("div",{className:"App"},t.createElement("header",null,t.createElement("img",{src:ZE,alt:"",class:"imageStyle"}),t.createElement("div",{class:"HeaderText"},t.createElement("p",{class:"line1"},'"\u1ede \u0111\xe2u c\xf3 hai ba ng\u01b0\u1eddi h\u1ee3p nhau nh\xe2n danh Th\u1ea7y, th\xec Th\u1ea7y s\u1ebd \u1edf gi\u1eefa h\u1ecd" (Mt. 18-20)'),t.createElement("p",{class:"line2"},"TH\u0110C C\xd9NG H\u1ee2P L\u1edcI C\u1ea6U NGUY\u1ec6N CHO NHAU",t.createElement("br",null),"Xin M\u1eb9 \u0110\u1ed3ng C\xf4ng v\xe0 Anh Quorum Primus chuy\u1ec3n c\u1ea7u l\xean Thi\xean Ch\xfaa cho ch\xfang con.")),t.createElement("img",{src:$E,alt:"",class:"imageStyle"})),t.createElement("section",null,t.createElement(rS,null)))};Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));r.render(t.createElement(t.StrictMode,null,t.createElement(aS,null)),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()})).catch((function(e){console.error(e.message)}))}()}();
//# sourceMappingURL=main.234a12a2.js.map