UNPKG

849 kBJavaScriptView Raw
1!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).firebase=e()}(this,function(){"use strict";!function(t){if(!t.fetch){var e="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,s="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),r="FormData"in t,i="ArrayBuffer"in t;if(i)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=function(t){return t&&DataView.prototype.isPrototypeOf(t)},u=ArrayBuffer.isView||function(t){return t&&-1<o.indexOf(Object.prototype.toString.call(t))};d.prototype.append=function(t,e){t=l(t),e=f(e);var n=this.map[t];this.map[t]=n?n+","+e:e},d.prototype.delete=function(t){delete this.map[l(t)]},d.prototype.get=function(t){return t=l(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(l(t))},d.prototype.set=function(t,e){this.map[l(t)]=f(e)},d.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},d.prototype.keys=function(){var n=[];return this.forEach(function(t,e){n.push(e)}),p(n)},d.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),p(e)},d.prototype.entries=function(){var n=[];return this.forEach(function(t,e){n.push([e,t])}),p(n)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries);var c=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},w.call(b.prototype),w.call(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:0,statusText:""});return t.type="error",t};var h=[301,302,303,307,308];E.redirect=function(t,e){if(-1===h.indexOf(e))throw new RangeError("Invalid status code");return new E(null,{status:e,headers:{location:t}})},t.Headers=d,t.Request=b,t.Response=E,t.fetch=function(i,o){return new Promise(function(n,t){var e=new b(i,o),r=new XMLHttpRequest;r.onload=function(){var t={status:r.status,statusText:r.statusText,headers:function(t){var i=new d;return t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var e=t.split(":"),n=e.shift().trim();if(n){var r=e.join(":").trim();i.append(n,r)}}),i}(r.getAllResponseHeaders()||"")};t.url="responseURL"in r?r.responseURL:t.headers.get("X-Request-URL");var e="response"in r?r.response:r.responseText;n(new E(e,t))},r.onerror=function(){t(new TypeError("Network request failed"))},r.ontimeout=function(){t(new TypeError("Network request failed"))},r.open(e.method,e.url,!0),"include"===e.credentials?r.withCredentials=!0:"omit"===e.credentials&&(r.withCredentials=!1),"responseType"in r&&s&&(r.responseType="blob"),e.headers.forEach(function(t,e){r.setRequestHeader(e,t)}),r.send(void 0===e._bodyInit?null:e._bodyInit)})},t.fetch.polyfill=!0}function l(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach(function(t,e){this.append(e,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function v(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function y(n){return new Promise(function(t,e){n.onload=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function g(t){var e=new FileReader,n=y(e);return e.readAsArrayBuffer(t),n}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function w(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t)if("string"==typeof t)this._bodyText=t;else if(s&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(r&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(i&&s&&a(t))this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!i||!ArrayBuffer.prototype.isPrototypeOf(t)&&!u(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=m(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var t=v(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?v(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var t=v(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,n=y(e);return e.readAsText(t),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}function b(t,e){var n=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=function(t){var e=t.toUpperCase();return-1<c.indexOf(e)?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function _(t){var i=new FormData;return t.trim().split("&").forEach(function(t){if(t){var e=t.split("="),n=e.shift().replace(/\+/g," "),r=e.join("=").replace(/\+/g," ");i.append(decodeURIComponent(n),decodeURIComponent(r))}}),i}function E(t,e){e=e||{},this.type="default",this.status=void 0===e.status?200:e.status,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}}("undefined"!=typeof self?self:void 0);var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t,e){return t(e={exports:{}},e.exports),e.exports}function n(t){return t&&t.Math==Math&&t}function y(t){try{return!!t()}catch(t){return!0}}function g(t){return"object"==typeof t?null!==t:"function"==typeof t}function r(t){return l?u.createElement(t):{}}function d(t){if(!g(t))throw TypeError(String(t)+" is not an object");return t}function o(t,e){if(!g(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!g(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!g(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!g(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}function m(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}function h(e,n){try{_(w,e,n)}catch(t){w[e]=n}return n}function c(t,e){return S.call(t,e)}function a(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++C+N).toString(36)}function i(t){return c(R,t)||(A&&c(O,t)?R[t]=O[t]:R[t]=D("Symbol."+t)),R[t]}var w=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||Function("return this")(),s=!1,f=!y(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}),u=w.document,l=g(u)&&g(u.createElement),p=!f&&!y(function(){return 7!=Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a}),v=Object.defineProperty,b={f:f?v:function(t,e,n){if(d(t),e=o(e,!0),d(n),p)try{return v(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},_=f?function(t,e,n){return b.f(t,e,m(1,n))}:function(t,e,n){return t[e]=n,t},E="__core-js_shared__",I=w[E]||h(E,{}),T=e(function(t){(t.exports=function(t,e){return I[t]||(I[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.4",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})}),S={}.hasOwnProperty,C=0,N=Math.random(),A=!!Object.getOwnPropertySymbols&&!y(function(){return!String(Symbol())}),k=A&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,R=T("wks"),O=w.Symbol,D=k?O:O&&O.withoutSetter||a,P={};P[i("toStringTag")]="z";var x="[object z]"===String(P),L=Function.toString;"function"!=typeof I.inspectSource&&(I.inspectSource=function(t){return L.call(t)});function M(t){return W[t]||(W[t]=a(t))}var F,U,j,q=I.inspectSource,V=w.WeakMap,B="function"==typeof V&&/native code/.test(q(V)),W=T("keys"),H={},K=w.WeakMap;if(B){var G=new K,z=G.get,Q=G.has,Y=G.set;F=function(t,e){return Y.call(G,t,e),e},U=function(t){return z.call(G,t)||{}},j=function(t){return Q.call(G,t)}}else{var J=M("state");H[J]=!0,F=function(t,e){return _(t,J,e),e},U=function(t){return c(t,J)?t[J]:{}},j=function(t){return c(t,J)}}function X(t){return tt.call(t).slice(8,-1)}var $={set:F,get:U,has:j,enforce:function(t){return j(t)?U(t):F(t,{})},getterFor:function(n){return function(t){var e;if(!g(t)||(e=U(t)).type!==n)throw TypeError("Incompatible receiver, "+n+" required");return e}}},Z=e(function(t){var e=$.get,a=$.enforce,u=String(String).split("String");(t.exports=function(t,e,n,r){var i=!!r&&!!r.unsafe,o=!!r&&!!r.enumerable,s=!!r&&!!r.noTargetGet;"function"==typeof n&&("string"!=typeof e||c(n,"name")||_(n,"name",e),a(n).source=u.join("string"==typeof e?e:"")),t!==w?(i?!s&&t[e]&&(o=!0):delete t[e],o?t[e]=n:_(t,e,n)):o?t[e]=n:h(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||q(this)})}),tt={}.toString,et=i("toStringTag"),nt="Arguments"==X(function(){return arguments}()),rt=x?X:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),et))?n:nt?X(e):"Object"==(r=X(e))&&"function"==typeof e.callee?"Arguments":r},it=x?{}.toString:function(){return"[object "+rt(this)+"]"};x||Z(Object.prototype,"toString",it,{unsafe:!0});function ot(t){return isNaN(t=+t)?0:(0<t?Et:_t)(t)}function st(t){if(null==t)throw TypeError("Can't call method on "+t);return t}function at(a){return function(t,e){var n,r,i=String(st(t)),o=ot(e),s=i.length;return o<0||s<=o?a?"":void 0:(n=i.charCodeAt(o))<55296||56319<n||o+1===s||(r=i.charCodeAt(o+1))<56320||57343<r?a?i.charAt(o):n:a?i.slice(o,o+2):r-56320+(n-55296<<10)+65536}}function ut(t){return At(st(t))}function ct(t){return"function"==typeof t?t:void 0}function ht(t,e){return arguments.length<2?ct(Ot[t])||ct(w[t]):Ot[t]&&Ot[t][e]||w[t]&&w[t][e]}function lt(t){return 0<t?Dt(ot(t),9007199254740991):0}function ft(a){return function(t,e,n){var r,i=ut(t),o=lt(i.length),s=function(t,e){var n=ot(t);return n<0?Pt(n+e,0):xt(n,e)}(n,o);if(a&&e!=e){for(;s<o;)if((r=i[s++])!=r)return!0}else for(;s<o;s++)if((a||s in i)&&i[s]===e)return a||s||0;return!a&&-1}}function pt(t,e){var n,r=ut(t),i=0,o=[];for(n in r)!c(H,n)&&c(r,n)&&o.push(n);for(;e.length>i;)c(r,n=e[i++])&&(~Lt(o,n)||o.push(n));return o}function dt(t,e){for(var n=qt(e),r=b.f,i=Rt.f,o=0;o<n.length;o++){var s=n[o];c(t,s)||r(t,s,i(e,s))}}function vt(t,e){var n=Wt[Bt(t)];return n==Kt||n!=Ht&&("function"==typeof e?y(e):!!e)}function yt(t,e){var n,r,i,o,s,a=t.target,u=t.global,c=t.stat;if(n=u?w:c?w[a]||h(a,{}):(w[a]||{}).prototype)for(r in e){if(o=e[r],i=t.noTargetGet?(s=zt(n,r))&&s.value:n[r],!Gt(u?r:a+(c?".":"#")+r,t.forced)&&void 0!==i){if(typeof o==typeof i)continue;dt(o,i)}(t.sham||i&&i.sham)&&_(o,"sham",!0),Z(n,r,o,t)}}function gt(t){return Object(st(t))}var mt,wt,bt,_t=Math.ceil,Et=Math.floor,It={codeAt:at(!1),charAt:at(!0)},Tt={}.propertyIsEnumerable,St=Object.getOwnPropertyDescriptor,Ct={f:St&&!Tt.call({1:2},1)?function(t){var e=St(this,t);return!!e&&e.enumerable}:Tt},Nt="".split,At=y(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==X(t)?Nt.call(t,""):Object(t)}:Object,kt=Object.getOwnPropertyDescriptor,Rt={f:f?kt:function(t,e){if(t=ut(t),e=o(e,!0),p)try{return kt(t,e)}catch(t){}if(c(t,e))return m(!Ct.f.call(t,e),t[e])}},Ot=w,Dt=Math.min,Pt=Math.max,xt=Math.min,Lt={includes:ft(!0),indexOf:ft(!1)}.indexOf,Mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ft=Mt.concat("length","prototype"),Ut={f:Object.getOwnPropertyNames||function(t){return pt(t,Ft)}},jt={f:Object.getOwnPropertySymbols},qt=ht("Reflect","ownKeys")||function(t){var e=Ut.f(d(t)),n=jt.f;return n?e.concat(n(t)):e},Vt=/#|\.prototype\./,Bt=vt.normalize=function(t){return String(t).replace(Vt,".").toLowerCase()},Wt=vt.data={},Ht=vt.NATIVE="N",Kt=vt.POLYFILL="P",Gt=vt,zt=Rt.f,Qt=!y(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Yt=M("IE_PROTO"),Jt=Object.prototype,Xt=Qt?Object.getPrototypeOf:function(t){return t=gt(t),c(t,Yt)?t[Yt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Jt:null},$t=i("iterator"),Zt=!1;[].keys&&("next"in(bt=[].keys())?(wt=Xt(Xt(bt)))!==Object.prototype&&(mt=wt):Zt=!0),null==mt&&(mt={}),c(mt,$t)||_(mt,$t,function(){return this});function te(){}function ee(t){return"<script>"+t+"</"+ue+">"}var ne,re={IteratorPrototype:mt,BUGGY_SAFARI_ITERATORS:Zt},ie=Object.keys||function(t){return pt(t,Mt)},oe=f?Object.defineProperties:function(t,e){d(t);for(var n,r=ie(e),i=r.length,o=0;o<i;)b.f(t,n=r[o++],e[n]);return t},se=ht("document","documentElement"),ae="prototype",ue="script",ce=M("IE_PROTO"),he=function(){try{ne=document.domain&&new ActiveXObject("htmlfile")}catch(t){}he=ne?function(t){t.write(ee("")),t.close();var e=t.parentWindow.Object;return t=null,e}(ne):function(){var t,e=r("iframe");return e.style.display="none",se.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(ee("document.F=Object")),t.close(),t.F}();for(var t=Mt.length;t--;)delete he[ae][Mt[t]];return he()};H[ce]=!0;function le(t,e,n){t&&!c(t=n?t:t.prototype,ge)&&ye(t,ge,{configurable:!0,value:e})}function fe(){return this}function pe(){return this}function de(t,e,n,r,i,o,s){function a(t){if(t===i&&v)return v;if(!Ee&&t in p)return p[t];switch(t){case"keys":case Te:case Se:return function(){return new n(this,t)}}return function(){return new n(this)}}!function(t,e,n){var r=e+" Iterator";t.prototype=ve(we,{next:m(1,n)}),le(t,r,!1),me[r]=fe}(n,e,r);var u,c,h,l=e+" Iterator",f=!1,p=t.prototype,d=p[Ie]||p["@@iterator"]||i&&p[i],v=!Ee&&d||a(i),y="Array"==e&&p.entries||d;if(y&&(u=Xt(y.call(new t)),_e!==Object.prototype&&u.next&&(Xt(u)!==_e&&(be?be(u,_e):"function"!=typeof u[Ie]&&_(u,Ie,pe)),le(u,l,!0))),i==Te&&d&&d.name!==Te&&(f=!0,v=function(){return d.call(this)}),p[Ie]!==v&&_(p,Ie,v),me[e]=v,i)if(c={values:a(Te),keys:o?v:a("keys"),entries:a(Se)},s)for(h in c)!Ee&&!f&&h in p||Z(p,h,c[h]);else yt({target:e,proto:!0,forced:Ee||f},c);return c}var ve=Object.create||function(t,e){var n;return null!==t?(te[ae]=d(t),n=new te,te[ae]=null,n[ce]=t):n=he(),void 0===e?n:oe(n,e)},ye=b.f,ge=i("toStringTag"),me={},we=re.IteratorPrototype,be=Object.setPrototypeOf||("__proto__"in{}?function(){var n,r=!1,t={};try{(n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(t,[]),r=t instanceof Array}catch(t){}return function(t,e){return d(t),function(t){if(!g(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(e),r?n.call(t,e):t.__proto__=e,t}}():void 0),_e=re.IteratorPrototype,Ee=re.BUGGY_SAFARI_ITERATORS,Ie=i("iterator"),Te="values",Se="entries",Ce=It.charAt,Ne="String Iterator",Ae=$.set,ke=$.getterFor(Ne);de(String,"String",function(t){Ae(this,{type:Ne,string:String(t),index:0})},function(){var t,e=ke(this),n=e.string,r=e.index;return r>=n.length?{value:void 0,done:!0}:(t=Ce(n,r),e.index+=t.length,{value:t,done:!1})});var Re={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Oe=i("unscopables"),De=Array.prototype;null==De[Oe]&&b.f(De,Oe,{configurable:!0,value:ve(null)});function Pe(t){De[Oe][t]=!0}var xe="Array Iterator",Le=$.set,Me=$.getterFor(xe),Fe=de(Array,"Array",function(t,e){Le(this,{type:xe,target:ut(t),index:0,kind:e})},function(){var t=Me(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?{value:t.target=void 0,done:!0}:"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}},"values");me.Arguments=me.Array,Pe("keys"),Pe("values"),Pe("entries");var Ue=i("iterator"),je=i("toStringTag"),qe=Fe.values;for(var Ve in Re){var Be=w[Ve],We=Be&&Be.prototype;if(We){if(We[Ue]!==qe)try{_(We,Ue,qe)}catch(au){We[Ue]=qe}if(We[je]||_(We,je,Ve),Re[Ve])for(var He in Fe)if(We[He]!==Fe[He])try{_(We,He,Fe[He])}catch(au){We[He]=Fe[He]}}}function Ke(t,e,n){for(var r in e)Z(t,r,e[r],n);return t}function Ge(t){var e=ht(t),n=b.f;f&&e&&!e[tn]&&n(e,tn,{configurable:!0,get:function(){return this}})}function ze(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}function Qe(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}function Ye(t){return void 0!==t&&(me.Array===t||nn[en]===t)}function Je(r,i,t){if(ze(r),void 0===i)return r;switch(t){case 0:return function(){return r.call(i)};case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}}function Xe(t){if(null!=t)return t[rn]||t["@@iterator"]||me[rt(t)]}function $e(e,t,n,r){try{return r?t(d(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&d(i.call(e)),t}}var Ze=w.Promise,tn=i("species"),en=i("iterator"),nn=Array.prototype,rn=i("iterator"),on=e(function(t){function p(t,e){this.stopped=t,this.result=e}(t.exports=function(t,e,n,r,i){var o,s,a,u,c,h,l,f=Je(e,n,r?2:1);if(i)o=t;else{if("function"!=typeof(s=Xe(t)))throw TypeError("Target is not iterable");if(Ye(s)){for(a=0,u=lt(t.length);a<u;a++)if((c=r?f(d(l=t[a])[0],l[1]):f(t[a]))&&c instanceof p)return c;return new p(!1)}o=s.call(t)}for(h=o.next;!(l=h.call(o)).done;)if("object"==typeof(c=$e(o,f,l.value,r))&&c&&c instanceof p)return c;return new p(!1)}).stop=function(t){return new p(!0,t)}}),sn=i("iterator"),an=!1;try{var un=0,cn={next:function(){return{done:!!un++}},return:function(){an=!0}};cn[sn]=function(){return this},Array.from(cn,function(){throw 2})}catch(au){}function hn(t,e){if(!e&&!an)return!1;var n=!1;try{var r={};r[sn]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n}function ln(t,e){var n,r=d(t).constructor;return void 0===r||null==(n=d(r)[wn])?e:ze(n)}function fn(t){if(kn.hasOwnProperty(t)){var e=kn[t];delete kn[t],e()}}function pn(t){return function(){fn(t)}}function dn(t){fn(t.data)}function vn(t){w.postMessage(t+"",En.protocol+"//"+En.host)}var yn,gn,mn,wn=i("species"),bn=ht("navigator","userAgent")||"",_n=/(iphone|ipod|ipad).*applewebkit/i.test(bn),En=w.location,In=w.setImmediate,Tn=w.clearImmediate,Sn=w.process,Cn=w.MessageChannel,Nn=w.Dispatch,An=0,kn={},Rn="onreadystatechange";In&&Tn||(In=function(t){for(var e=[],n=1;n<arguments.length;)e.push(arguments[n++]);return kn[++An]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},yn(An),An},Tn=function(t){delete kn[t]},"process"==X(Sn)?yn=function(t){Sn.nextTick(pn(t))}:Nn&&Nn.now?yn=function(t){Nn.now(pn(t))}:Cn&&!_n?(mn=(gn=new Cn).port2,gn.port1.onmessage=dn,yn=Je(mn.postMessage,mn,1)):!w.addEventListener||"function"!=typeof postMessage||w.importScripts||y(vn)?yn=Rn in r("script")?function(t){se.appendChild(r("script"))[Rn]=function(){se.removeChild(this),fn(t)}}:function(t){setTimeout(pn(t),0)}:(yn=vn,w.addEventListener("message",dn,!1)));var On,Dn,Pn,xn,Ln,Mn,Fn,Un,jn={set:In,clear:Tn},qn=Rt.f,Vn=jn.set,Bn=w.MutationObserver||w.WebKitMutationObserver,Wn=w.process,Hn=w.Promise,Kn="process"==X(Wn),Gn=qn(w,"queueMicrotask"),zn=Gn&&Gn.value;zn||(On=function(){var t,e;for(Kn&&(t=Wn.domain)&&t.exit();Dn;){e=Dn.fn,Dn=Dn.next;try{e()}catch(t){throw Dn?xn():Pn=void 0,t}}Pn=void 0,t&&t.enter()},xn=Kn?function(){Wn.nextTick(On)}:Bn&&!_n?(Ln=!0,Mn=document.createTextNode(""),new Bn(On).observe(Mn,{characterData:!0}),function(){Mn.data=Ln=!Ln}):Hn&&Hn.resolve?(Fn=Hn.resolve(void 0),Un=Fn.then,function(){Un.call(Fn,On)}):function(){Vn.call(w,On)});function Qn(t){var n,r;this.promise=new t(function(t,e){if(void 0!==n||void 0!==r)throw TypeError("Bad Promise constructor");n=t,r=e}),this.resolve=ze(n),this.reject=ze(r)}function Yn(t,e){if(d(t),g(e)&&e.constructor===t)return e;var n=tr.f(t);return(0,n.resolve)(e),n.promise}function Jn(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}var Xn,$n,Zn=zn||function(t){var e={fn:t,next:void 0};Pn&&(Pn.next=e),Dn||(Dn=e,xn()),Pn=e},tr={f:function(t){return new Qn(t)}},er=w.process,nr=er&&er.versions,rr=nr&&nr.v8;rr?$n=(Xn=rr.split("."))[0]+Xn[1]:bn&&(!(Xn=bn.match(/Edge\/(\d+)/))||74<=Xn[1])&&(Xn=bn.match(/Chrome\/(\d+)/))&&($n=Xn[1]);function ir(t){var e;return!(!g(t)||"function"!=typeof(e=t.then))&&e}function or(l,f,p){if(!f.notified){f.notified=!0;var d=f.reactions;Zn(function(){for(var t=f.value,e=1==f.state,n=0;d.length>n;){var r,i,o,s=d[n++],a=e?s.ok:s.fail,u=s.resolve,c=s.reject,h=s.domain;try{a?(e||(2===f.rejection&&xr(l,f),f.rejection=1),!0===a?r=t:(h&&h.enter(),r=a(t),h&&(h.exit(),o=!0)),r===s.promise?c(_r("Promise-chain cycle")):(i=ir(r))?i.call(r,u,c):u(r)):c(t)}catch(t){h&&!o&&h.exit(),c(t)}}f.reactions=[],f.notified=!1,p&&!f.rejection&&Dr(l,f)})}}function sr(t,e,n){var r,i;Ar?((r=Er.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),w.dispatchEvent(r)):r={promise:e,reason:n},(i=w["on"+t])?i(r):t===kr&&function(t,e){var n=w.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,e))}("Unhandled promise rejection",n)}function ar(e,n,r,i){return function(t){e(n,r,t,i)}}function ur(t,e,n,r){e.done||(e.done=!0,r&&(e=r),e.value=n,e.state=2,or(t,e,!0))}var cr,hr,lr,fr,pr=$n&&+$n,dr=jn.set,vr=i("species"),yr="Promise",gr=$.get,mr=$.set,wr=$.getterFor(yr),br=Ze,_r=w.TypeError,Er=w.document,Ir=w.process,Tr=ht("fetch"),Sr=tr.f,Cr=Sr,Nr="process"==X(Ir),Ar=!!(Er&&Er.createEvent&&w.dispatchEvent),kr="unhandledrejection",Rr=Gt(yr,function(){if(!(q(br)!==String(br))){if(66===pr)return!0;if(!Nr&&"function"!=typeof PromiseRejectionEvent)return!0}if(51<=pr&&/native code/.test(br))return!1;function t(t){t(function(){},function(){})}var e=br.resolve(1);return(e.constructor={})[vr]=t,!(e.then(function(){})instanceof t)}),Or=Rr||!hn(function(t){br.all(t).catch(function(){})}),Dr=function(n,r){dr.call(w,function(){var t,e=r.value;if(Pr(r)&&(t=Jn(function(){Nr?Ir.emit("unhandledRejection",e,n):sr(kr,n,e)}),r.rejection=Nr||Pr(r)?2:1,t.error))throw t.value})},Pr=function(t){return 1!==t.rejection&&!t.parent},xr=function(t,e){dr.call(w,function(){Nr?Ir.emit("rejectionHandled",t):sr("rejectionhandled",t,e.value)})},Lr=function(n,r,t,e){if(!r.done){r.done=!0,e&&(r=e);try{if(n===t)throw _r("Promise can't be resolved itself");var i=ir(t);i?Zn(function(){var e={done:!1};try{i.call(t,ar(Lr,n,e,r),ar(ur,n,e,r))}catch(t){ur(n,e,t,r)}}):(r.value=t,r.state=1,or(n,r,!1))}catch(t){ur(n,{done:!1},t,r)}}};Rr&&(br=function(t){Qe(this,br,yr),ze(t),cr.call(this);var e=gr(this);try{t(ar(Lr,this,e),ar(ur,this,e))}catch(t){ur(this,e,t)}},(cr=function(t){mr(this,{type:yr,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Ke(br.prototype,{then:function(t,e){var n=wr(this),r=Sr(ln(this,br));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=Nr?Ir.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&or(this,n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),hr=function(){var t=new cr,e=gr(t);this.promise=t,this.resolve=ar(Lr,t,e),this.reject=ar(ur,t,e)},tr.f=Sr=function(t){return t===br||t===lr?new hr(t):Cr(t)},"function"==typeof Ze&&(fr=Ze.prototype.then,Z(Ze.prototype,"then",function(t,e){var n=this;return new br(function(t,e){fr.call(n,t,e)}).then(t,e)},{unsafe:!0}),"function"==typeof Tr&&yt({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return Yn(br,Tr.apply(w,arguments))}}))),yt({global:!0,wrap:!0,forced:Rr},{Promise:br}),le(br,yr,!1),Ge(yr),lr=ht(yr),yt({target:yr,stat:!0,forced:Rr},{reject:function(t){var e=Sr(this);return e.reject.call(void 0,t),e.promise}}),yt({target:yr,stat:!0,forced:Rr},{resolve:function(t){return Yn(this,t)}}),yt({target:yr,stat:!0,forced:Or},{all:function(t){var a=this,e=Sr(a),u=e.resolve,c=e.reject,n=Jn(function(){var r=ze(a.resolve),i=[],o=0,s=1;on(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(a,t).then(function(t){n||(n=!0,i[e]=t,--s||u(i))},c)}),--s||u(i)});return n.error&&c(n.value),e.promise},race:function(t){var n=this,r=Sr(n),i=r.reject,e=Jn(function(){var e=ze(n.resolve);on(t,function(t){e.call(n,t).then(r.resolve,i)})});return e.error&&i(e.value),r.promise}}),yt({target:"Promise",stat:!0},{allSettled:function(t){var a=this,e=tr.f(a),u=e.resolve,n=e.reject,r=Jn(function(){var r=ze(a.resolve),i=[],o=0,s=1;on(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(a,t).then(function(t){n||(n=!0,i[e]={status:"fulfilled",value:t},--s||u(i))},function(t){n||(n=!0,i[e]={status:"rejected",reason:t},--s||u(i))})}),--s||u(i)});return r.error&&n(r.value),e.promise}});var Mr=!!Ze&&y(function(){Ze.prototype.finally.call({then:function(){}},function(){})});yt({target:"Promise",proto:!0,real:!0,forced:Mr},{finally:function(e){var n=ln(this,ht("Promise")),t="function"==typeof e;return this.then(t?function(t){return Yn(n,e()).then(function(){return t})}:e,t?function(t){return Yn(n,e()).then(function(){throw t})}:e)}}),"function"!=typeof Ze||Ze.prototype.finally||Z(Ze.prototype,"finally",ht("Promise").prototype.finally);Ot.Promise;var Fr=$.set,Ur=$.getterFor("AggregateError"),jr=function(t,e){var n=this;if(!(n instanceof jr))return new jr(t,e);be&&(n=be(new Error(e),Xt(n)));var r=[];return on(t,r.push,r),f?Fr(n,{errors:r,type:"AggregateError"}):n.errors=r,void 0!==e&&_(n,"message",String(e)),n};jr.prototype=ve(Error.prototype,{constructor:m(5,jr),message:m(5,""),name:m(5,"AggregateError")}),f&&b.f(jr.prototype,"errors",{get:function(){return Ur(this).errors},configurable:!0}),yt({global:!0},{AggregateError:jr}),yt({target:"Promise",stat:!0},{try:function(t){var e=tr.f(this),n=Jn(t);return(n.error?e.reject:e.resolve)(n.value),e.promise}});var qr="No one promise resolved";yt({target:"Promise",stat:!0},{any:function(t){var u=this,e=tr.f(u),c=e.resolve,h=e.reject,n=Jn(function(){var r=ze(u.resolve),i=[],o=0,s=1,a=!1;on(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(u,t).then(function(t){n||a||(a=!0,c(t))},function(t){n||a||(n=!0,i[e]=t,--s||h(new(ht("AggregateError"))(i,qr)))})}),--s||h(new(ht("AggregateError"))(i,qr))});return n.error&&h(n.value),e.promise}});function Vr(t,e){var n;return Kr(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!Kr(n.prototype)?g(n)&&null===(n=n[Gr])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)}function Br(p){var d=1==p,v=2==p,y=3==p,g=4==p,m=6==p,w=5==p||m;return function(t,e,n,r){for(var i,o,s=gt(t),a=At(s),u=Je(e,n,3),c=lt(a.length),h=0,l=r||Vr,f=d?l(t,c):v?l(t,0):void 0;h<c;h++)if((w||h in a)&&(o=u(i=a[h],h,s),p))if(d)f[h]=o;else if(o)switch(p){case 3:return!0;case 5:return i;case 6:return h;case 2:zr.call(f,i)}else if(g)return!1;return m?-1:y||g?g:f}}function Wr(t){throw t}function Hr(t,e){if(c(Jr,t))return Jr[t];var n=[][t],r=!!c(e=e||{},"ACCESSORS")&&e.ACCESSORS,i=c(e,0)?e[0]:Wr,o=c(e,1)?e[1]:void 0;return Jr[t]=!!n&&!y(function(){if(r&&!f)return!0;var t={length:-1};r?Yr(t,1,{enumerable:!0,get:Wr}):t[1]=1,n.call(t,i,o)})}var Kr=Array.isArray||function(t){return"Array"==X(t)},Gr=i("species"),zr=[].push,Qr={forEach:Br(0),map:Br(1),filter:Br(2),some:Br(3),every:Br(4),find:Br(5),findIndex:Br(6)},Yr=Object.defineProperty,Jr={},Xr=Qr.find,$r="find",Zr=!0,ti=Hr($r);$r in[]&&Array(1)[$r](function(){Zr=!1}),yt({target:"Array",proto:!0,forced:Zr||!ti},{find:function(t,e){return Xr(this,t,1<arguments.length?e:void 0)}}),Pe($r);function ei(t,e,n){return Je(ni,w[t].prototype[e],n)}var ni=Function.call,ri=(ei("Array","find"),Qr.findIndex),ii="findIndex",oi=!0,si=Hr(ii);ii in[]&&Array(1)[ii](function(){oi=!1}),yt({target:"Array",proto:!0,forced:oi||!si},{findIndex:function(t,e){return ri(this,t,1<arguments.length?e:void 0)}}),Pe(ii);function ai(t,e,n){var r=o(e);r in t?b.f(t,r,m(0,n)):t[r]=n}ei("Array","findIndex");var ui=!hn(function(t){Array.from(t)});yt({target:"Array",stat:!0,forced:ui},{from:function(t,e,n){var r,i,o,s,a,u,c=gt(t),h="function"==typeof this?this:Array,l=arguments.length,f=1<l?e:void 0,p=void 0!==f,d=Xe(c),v=0;if(p&&(f=Je(f,2<l?n:void 0,2)),null==d||h==Array&&Ye(d))for(i=new h(r=lt(c.length));v<r;v++)u=p?f(c[v],v):c[v],ai(i,v,u);else for(a=(s=d.call(c)).next,i=new h;!(o=a.call(s)).done;v++)u=p?$e(s,f,[o.value,v],!0):o.value,ai(i,v,u);return i.length=v,i}});Ot.Array.from;var ci,hi,li=Qr.some,fi=!!(hi=[]["some"])&&y(function(){hi.call(null,ci||function(){throw 1},1)}),pi=Hr("some");yt({target:"Array",proto:!0,forced:!fi||!pi},{some:function(t,e){return li(this,t,1<arguments.length?e:void 0)}});ei("Array","some");function di(t){return g(t)&&c(Ai,rt(t))}var vi,yi="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,gi=b.f,mi=w.Int8Array,wi=mi&&mi.prototype,bi=w.Uint8ClampedArray,_i=bi&&bi.prototype,Ei=mi&&Xt(mi),Ii=wi&&Xt(wi),Ti=Object.prototype,Si=(Ti.isPrototypeOf,i("toStringTag")),Ci=a("TYPED_ARRAY_TAG"),Ni=yi&&!!be&&"Opera"!==rt(w.opera),Ai={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8};for(vi in Ai)w[vi]||(Ni=!1);if((!Ni||"function"!=typeof Ei||Ei===Function.prototype)&&(Ei=function(){throw TypeError("Incorrect invocation")},Ni))for(vi in Ai)w[vi]&&be(w[vi],Ei);if((!Ni||!Ii||Ii===Ti)&&(Ii=Ei.prototype,Ni))for(vi in Ai)w[vi]&&be(w[vi].prototype,Ii);if(Ni&&Xt(_i)!==Ii&&be(_i,Ii),f&&!c(Ii,Si))for(vi in!0,gi(Ii,Si,{get:function(){return g(this)?this[Ci]:void 0}}),Ai)w[vi]&&_(w[vi],Ci,vi);function ki(){return xi.call(Fi(this))}var Ri=function(t){if(di(t))return t;throw TypeError("Target is not a typed array")},Oi=function(t,e,n){if(f){if(n)for(var r in Ai){var i=w[r];i&&c(i.prototype,t)&&delete i.prototype[t]}Ii[t]&&!n||Z(Ii,t,n?e:Ni&&wi[t]||e)}},Di=i("iterator"),Pi=w.Uint8Array,xi=Fe.values,Li=Fe.keys,Mi=Fe.entries,Fi=Ri,Ui=Oi,ji=Pi&&Pi.prototype[Di],qi=!!ji&&("values"==ji.name||null==ji.name);Ui("entries",function(){return Mi.call(Fi(this))}),Ui("keys",function(){return Li.call(Fi(this))}),Ui("values",ki,!qi),Ui(Di,ki,!qi);var Vi=Object.assign,Bi=Object.defineProperty,Wi=!Vi||y(function(){if(f&&1!==Vi({b:1},Vi(Bi({},"a",{enumerable:!0,get:function(){Bi(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=Vi({},t)[n]||ie(Vi({},e)).join("")!=r})?function(t,e){for(var n=gt(t),r=arguments.length,i=1,o=jt.f,s=Ct.f;i<r;)for(var a,u=At(arguments[i++]),c=o?ie(u).concat(o(u)):ie(u),h=c.length,l=0;l<h;)a=c[l++],f&&!s.call(u,a)||(n[a]=u[a]);return n}:Vi;yt({target:"Object",stat:!0,forced:Object.assign!==Wi},{assign:Wi});Ot.Object.assign;function Hi(a){return function(t){for(var e,n=ut(t),r=ie(n),i=r.length,o=0,s=[];o<i;)e=r[o++],f&&!Ki.call(n,e)||s.push(a?[e,n[e]]:n[e]);return s}}var Ki=Ct.f,Gi={entries:Hi(!0),values:Hi(!1)},zi=Gi.entries;yt({target:"Object",stat:!0},{entries:function(t){return zi(t)}});Ot.Object.entries;var Qi=Gi.values;yt({target:"Object",stat:!0},{values:function(t){return Qi(t)}});Ot.Object.values;function Yi(t){if(function(t){var e;return g(t)&&(void 0!==(e=t[Xi])?!!e:"RegExp"==X(t))}(t))throw TypeError("The method doesn't accept regular expressions");return t}function Ji(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[$i]=!1,"/./"[e](n)}catch(t){}}return!1}var Xi=i("match"),$i=i("match");yt({target:"String",proto:!0,forced:!Ji("includes")},{includes:function(t,e){return!!~String(st(this)).indexOf(Yi(t),1<arguments.length?e:void 0)}});ei("String","includes");var Zi,to=Rt.f,eo="".startsWith,no=Math.min,ro=Ji("startsWith"),io=!(ro||(!(Zi=to(String.prototype,"startsWith"))||Zi.writable));yt({target:"String",proto:!0,forced:!io&&!ro},{startsWith:function(t,e){var n=String(st(this));Yi(t);var r=lt(no(1<arguments.length?e:void 0,n.length)),i=String(t);return eo?eo.call(n,i,r):n.slice(r,r+i.length)===i}});ei("String","startsWith");yt({target:"String",proto:!0},{repeat:"".repeat||function(t){var e=String(st(this)),n="",r=ot(t);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;0<r;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n}});ei("String","repeat");function oo(t){if(!g(t))return!1;var e=t[uo];return void 0!==e?!!e:Kr(t)}var so,ao=i("species"),uo=i("isConcatSpreadable"),co=9007199254740991,ho="Maximum allowed index exceeded",lo=51<=pr||!y(function(){var t=[];return t[uo]=!1,t.concat()[0]!==t}),fo=(so="concat",51<=pr||!y(function(){var t=[];return(t.constructor={})[ao]=function(){return{foo:1}},1!==t[so](Boolean).foo}));yt({target:"Array",proto:!0,forced:!lo||!fo},{concat:function(t){var e,n,r,i,o,s=gt(this),a=Vr(s,0),u=0;for(e=-1,r=arguments.length;e<r;e++)if(oo(o=-1===e?s:arguments[e])){if(i=lt(o.length),co<u+i)throw TypeError(ho);for(n=0;n<i;n++,u++)n in o&&ai(a,u,o[n])}else{if(co<=u)throw TypeError(ho);ai(a,u++,o)}return a.length=u,a}});function po(t){var e=Ot.Symbol||(Ot.Symbol={});c(e,t)||To(e,t,{value:Io.f(t)})}function vo(t,e){var n=jo[t]=ve(Po[Ao]);return Ro(n,{type:No,tag:t,description:e}),f||(n.description=e),n}function yo(e,t){d(e);var n=ut(t),r=ie(n).concat(Jo(n));return So(r,function(t){f&&!Yo.call(n,t)||Qo(e,t,n[t])}),e}function go(t,e){var n=ut(t),r=o(e,!0);if(n!==Do||!c(jo,r)||c(qo,r)){var i=Lo(n,r);return!i||!c(jo,r)||c(n,Co)&&n[Co][r]||(i.enumerable=!0),i}}function mo(t){var e=Fo(ut(t)),n=[];return So(e,function(t){c(jo,t)||c(H,t)||n.push(t)}),n}var wo=Ut.f,bo={}.toString,_o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Eo={f:function(t){return _o&&"[object Window]"==bo.call(t)?function(t){try{return wo(t)}catch(t){return _o.slice()}}(t):wo(ut(t))}},Io={f:i},To=b.f,So=Qr.forEach,Co=M("hidden"),No="Symbol",Ao="prototype",ko=i("toPrimitive"),Ro=$.set,Oo=$.getterFor(No),Do=Object[Ao],Po=w.Symbol,xo=ht("JSON","stringify"),Lo=Rt.f,Mo=b.f,Fo=Eo.f,Uo=Ct.f,jo=T("symbols"),qo=T("op-symbols"),Vo=T("string-to-symbol-registry"),Bo=T("symbol-to-string-registry"),Wo=T("wks"),Ho=w.QObject,Ko=!Ho||!Ho[Ao]||!Ho[Ao].findChild,Go=f&&y(function(){return 7!=ve(Mo({},"a",{get:function(){return Mo(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=Lo(Do,e);r&&delete Do[e],Mo(t,e,n),r&&t!==Do&&Mo(Do,e,r)}:Mo,zo=k?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof Po},Qo=function(t,e,n){t===Do&&Qo(qo,e,n),d(t);var r=o(e,!0);return d(n),c(jo,r)?(n.enumerable?(c(t,Co)&&t[Co][r]&&(t[Co][r]=!1),n=ve(n,{enumerable:m(0,!1)})):(c(t,Co)||Mo(t,Co,m(1,{})),t[Co][r]=!0),Go(t,r,n)):Mo(t,r,n)},Yo=function(t){var e=o(t,!0),n=Uo.call(this,e);return!(this===Do&&c(jo,e)&&!c(qo,e))&&(!(n||!c(this,e)||!c(jo,e)||c(this,Co)&&this[Co][e])||n)},Jo=function(t){var e=t===Do,n=Fo(e?qo:ut(t)),r=[];return So(n,function(t){!c(jo,t)||e&&!c(Do,t)||r.push(jo[t])}),r};if(A||(Z((Po=function(t){if(this instanceof Po)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==t?String(t):void 0,n=a(e),r=function(t){this===Do&&r.call(qo,t),c(this,Co)&&c(this[Co],n)&&(this[Co][n]=!1),Go(this,n,m(1,t))};return f&&Ko&&Go(Do,n,{configurable:!0,set:r}),vo(n,e)})[Ao],"toString",function(){return Oo(this).tag}),Z(Po,"withoutSetter",function(t){return vo(a(t),t)}),Ct.f=Yo,b.f=Qo,Rt.f=go,Ut.f=Eo.f=mo,jt.f=Jo,Io.f=function(t){return vo(i(t),t)},f&&(Mo(Po[Ao],"description",{configurable:!0,get:function(){return Oo(this).description}}),Z(Do,"propertyIsEnumerable",Yo,{unsafe:!0}))),yt({global:!0,wrap:!0,forced:!A,sham:!A},{Symbol:Po}),So(ie(Wo),function(t){po(t)}),yt({target:No,stat:!0,forced:!A},{for:function(t){var e=String(t);if(c(Vo,e))return Vo[e];var n=Po(e);return Vo[e]=n,Bo[n]=e,n},keyFor:function(t){if(!zo(t))throw TypeError(t+" is not a symbol");if(c(Bo,t))return Bo[t]},useSetter:function(){Ko=!0},useSimple:function(){Ko=!1}}),yt({target:"Object",stat:!0,forced:!A,sham:!f},{create:function(t,e){return void 0===e?ve(t):yo(ve(t),e)},defineProperty:Qo,defineProperties:yo,getOwnPropertyDescriptor:go}),yt({target:"Object",stat:!0,forced:!A},{getOwnPropertyNames:mo,getOwnPropertySymbols:Jo}),yt({target:"Object",stat:!0,forced:y(function(){jt.f(1)})},{getOwnPropertySymbols:function(t){return jt.f(gt(t))}}),xo){var Xo=!A||y(function(){var t=Po();return"[null]"!=xo([t])||"{}"!=xo({a:t})||"{}"!=xo(Object(t))});yt({target:"JSON",stat:!0,forced:Xo},{stringify:function(t,e,n){for(var r,i=[t],o=1;o<arguments.length;)i.push(arguments[o++]);if((g(r=e)||void 0!==t)&&!zo(t))return Kr(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!zo(e))return e}),i[1]=e,xo.apply(null,i)}})}Po[Ao][ko]||_(Po[Ao],ko,Po[Ao].valueOf),le(Po,No),H[Co]=!0,po("asyncIterator");var $o=b.f,Zo=w.Symbol;if(!(!f||"function"!=typeof Zo||"description"in Zo.prototype&&void 0===Zo().description)){var ts={},es=function(t){var e=arguments.length<1||void 0===t?void 0:String(t),n=this instanceof es?new Zo(e):void 0===e?Zo():Zo(e);return""===e&&(ts[n]=!0),n};dt(es,Zo);var ns=es.prototype=Zo.prototype;ns.constructor=es;var rs=ns.toString,is="Symbol(test)"==String(Zo("test")),os=/^Symbol\((.*)\)[^)]+$/;$o(ns,"description",{configurable:!0,get:function(){var t=g(this)?this.valueOf():this,e=rs.call(t);if(c(ts,t))return"";var n=is?e.slice(7,-1):e.replace(os,"$1");return""===n?void 0:n}}),yt({global:!0,forced:!0},{Symbol:es})}po("hasInstance"),po("isConcatSpreadable"),po("iterator"),po("match"),po("matchAll"),po("replace"),po("search"),po("species"),po("split"),po("toPrimitive"),po("toStringTag"),po("unscopables"),le(Math,"Math",!0),le(w.JSON,"JSON",!0);Ot.Symbol;po("asyncDispose"),po("dispose"),po("observable"),po("patternMatch"),po("replaceAll");Io.f("iterator");function ss(r,t,e){function n(t){var n=u[t];Z(u,t,"add"==t?function(t){return n.call(this,0===t?0:t),this}:"delete"==t?function(t){return!(o&&!g(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return o&&!g(t)?void 0:n.call(this,0===t?0:t)}:"has"==t?function(t){return!(o&&!g(t))&&n.call(this,0===t?0:t)}:function(t,e){return n.call(this,0===t?0:t,e),this})}var i=-1!==r.indexOf("Map"),o=-1!==r.indexOf("Weak"),s=i?"set":"add",a=w[r],u=a&&a.prototype,c=a,h={};if(Gt(r,"function"!=typeof a||!(o||u.forEach&&!y(function(){(new a).entries().next()}))))c=e.getConstructor(t,r,i,s),cs.REQUIRED=!0;else if(Gt(r,!0)){var l=new c,f=l[s](o?{}:-0,1)!=l,p=y(function(){l.has(1)}),d=hn(function(t){new a(t)}),v=!o&&y(function(){for(var t=new a,e=5;e--;)t[s](e,e);return!t.has(-0)});d||(((c=t(function(t,e){Qe(t,c,r);var n=function(t,e,n){var r,i;return be&&"function"==typeof(r=e.constructor)&&r!==n&&g(i=r.prototype)&&i!==n.prototype&&be(t,i),t}(new a,t,c);return null!=e&&on(e,n[s],n,i),n})).prototype=u).constructor=c),(p||v)&&(n("delete"),n("has"),i&&n("get")),(v||f)&&n(s),o&&u.clear&&delete u.clear}return h[r]=c,yt({global:!0,forced:c!=a},h),le(c,r),o||e.setStrong(c,r,i),c}function as(t,e,n){var r,i,o,s,a=arguments.length,u=1<a?e:void 0;return ze(this),(r=void 0!==u)&&ze(u),null==t?new this:(i=[],r?(o=0,s=Je(u,2<a?n:void 0,2),on(t,function(t){i.push(s(t,o++))})):on(t,i.push,i),new this(i))}var us=!y(function(){return Object.isExtensible(Object.preventExtensions({}))}),cs=e(function(t){function n(t){e(t,r,{value:{objectID:"O"+ ++i,weakData:{}}})}var e=b.f,r=a("meta"),i=0,o=Object.isExtensible||function(){return!0},s=t.exports={REQUIRED:!1,fastKey:function(t,e){if(!g(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!c(t,r)){if(!o(t))return"F";if(!e)return"E";n(t)}return t[r].objectID},getWeakData:function(t,e){if(!c(t,r)){if(!o(t))return!0;if(!e)return!1;n(t)}return t[r].weakData},onFreeze:function(t){return us&&s.REQUIRED&&o(t)&&!c(t,r)&&n(t),t}};H[r]=!0}),hs=(cs.REQUIRED,cs.fastKey,cs.getWeakData,cs.onFreeze,b.f),ls=cs.fastKey,fs=$.set,ps=$.getterFor,ds={getConstructor:function(t,n,r,i){function o(t,e,n){var r,i,o=a(t),s=u(t,e);return s?s.value=n:(o.last=s={index:i=ls(e,!0),key:e,value:n,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),f?o.size++:t.size++,"F"!==i&&(o.index[i]=s)),t}var s=t(function(t,e){Qe(t,s,n),fs(t,{type:n,index:ve(null),first:void 0,last:void 0,size:0}),f||(t.size=0),null!=e&&on(e,t[i],t,r)}),a=ps(n),u=function(t,e){var n,r=a(t),i=ls(e);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==e)return n};return Ke(s.prototype,{clear:function(){for(var t=a(this),e=t.index,n=t.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete e[n.index],n=n.next;t.first=t.last=void 0,f?t.size=0:this.size=0},delete:function(t){var e=a(this),n=u(this,t);if(n){var r=n.next,i=n.previous;delete e.index[n.index],n.removed=!0,i&&(i.next=r),r&&(r.previous=i),e.first==n&&(e.first=r),e.last==n&&(e.last=i),f?e.size--:this.size--}return!!n},forEach:function(t,e){for(var n,r=a(this),i=Je(t,1<arguments.length?e:void 0,3);n=n?n.next:r.first;)for(i(n.value,n.key,this);n&&n.removed;)n=n.previous},has:function(t){return!!u(this,t)}}),Ke(s.prototype,r?{get:function(t){var e=u(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),f&&hs(s.prototype,"size",{get:function(){return a(this).size}}),s},setStrong:function(t,e,n){var r=e+" Iterator",i=ps(e),o=ps(r);de(t,e,function(t,e){fs(this,{type:r,target:t,state:i(t),kind:e,last:void 0})},function(){for(var t=o(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;return t.target&&(t.last=n=n?n.next:t.state.first)?"keys"==e?{value:n.key,done:!1}:"values"==e?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:{value:t.target=void 0,done:!0}},n?"entries":"values",!n,!0),Ge(e)}};ss("Map",function(e){return function(t){return e(this,arguments.length?t:void 0)}},ds),Ot.Map;yt({target:"Map",stat:!0},{from:as});function vs(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)}yt({target:"Map",stat:!0},{of:vs});function ys(){for(var t,e=d(this),n=ze(e.delete),r=!0,i=0,o=arguments.length;i<o;i++)t=n.call(e,arguments[i]),r=r&&t;return!!r}yt({target:"Map",proto:!0,real:!0,forced:s},{deleteAll:function(){return ys.apply(this,arguments)}});function gs(t){return Map.prototype.entries.call(t)}yt({target:"Map",proto:!0,real:!0,forced:s},{every:function(t,e){var n=d(this),r=gs(n),i=Je(t,1<arguments.length?e:void 0,3);return!on(r,function(t,e){if(!i(e,t,n))return on.stop()},void 0,!0,!0).stopped}}),yt({target:"Map",proto:!0,real:!0,forced:s},{filter:function(t,e){var n=d(this),r=gs(n),i=Je(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Map"))),s=ze(o.set);return on(r,function(t,e){i(e,t,n)&&s.call(o,t,e)},void 0,!0,!0),o}}),yt({target:"Map",proto:!0,real:!0,forced:s},{find:function(t,e){var n=d(this),r=gs(n),i=Je(t,1<arguments.length?e:void 0,3);return on(r,function(t,e){if(i(e,t,n))return on.stop(e)},void 0,!0,!0).result}}),yt({target:"Map",proto:!0,real:!0,forced:s},{findKey:function(t,e){var n=d(this),r=gs(n),i=Je(t,1<arguments.length?e:void 0,3);return on(r,function(t,e){if(i(e,t,n))return on.stop(t)},void 0,!0,!0).result}}),yt({target:"Map",stat:!0},{groupBy:function(t,n){var r=new this;ze(n);var i=ze(r.has),o=ze(r.get),s=ze(r.set);return on(t,function(t){var e=n(t);i.call(r,e)?o.call(r,e).push(t):s.call(r,e,[t])}),r}});yt({target:"Map",proto:!0,real:!0,forced:s},{includes:function(n){return on(gs(d(this)),function(t,e){if(function(t,e){return t===e||t!=t&&e!=e}(e,n))return on.stop()},void 0,!0,!0).stopped}}),yt({target:"Map",stat:!0},{keyBy:function(t,e){var n=new this;ze(e);var r=ze(n.set);return on(t,function(t){r.call(n,e(t),t)}),n}}),yt({target:"Map",proto:!0,real:!0,forced:s},{keyOf:function(n){return on(gs(d(this)),function(t,e){if(e===n)return on.stop(t)},void 0,!0,!0).result}}),yt({target:"Map",proto:!0,real:!0,forced:s},{mapKeys:function(t,e){var n=d(this),r=gs(n),i=Je(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Map"))),s=ze(o.set);return on(r,function(t,e){s.call(o,i(e,t,n),e)},void 0,!0,!0),o}}),yt({target:"Map",proto:!0,real:!0,forced:s},{mapValues:function(t,e){var n=d(this),r=gs(n),i=Je(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Map"))),s=ze(o.set);return on(r,function(t,e){s.call(o,t,i(e,t,n))},void 0,!0,!0),o}}),yt({target:"Map",proto:!0,real:!0,forced:s},{merge:function(t){for(var e=d(this),n=ze(e.set),r=0;r<arguments.length;)on(arguments[r++],n,e,!0);return e}}),yt({target:"Map",proto:!0,real:!0,forced:s},{reduce:function(n,t){var r=d(this),e=gs(r),i=arguments.length<2,o=i?void 0:t;if(ze(n),on(e,function(t,e){o=i?(i=!1,e):n(o,e,t,r)},void 0,!0,!0),i)throw TypeError("Reduce of empty map with no initial value");return o}}),yt({target:"Map",proto:!0,real:!0,forced:s},{some:function(t,e){var n=d(this),r=gs(n),i=Je(t,1<arguments.length?e:void 0,3);return on(r,function(t,e){if(i(e,t,n))return on.stop()},void 0,!0,!0).stopped}}),yt({target:"Map",proto:!0,real:!0,forced:s},{update:function(t,e,n){var r=d(this),i=arguments.length;ze(e);var o=r.has(t);if(!o&&i<3)throw TypeError("Updating absent value");var s=o?r.get(t):ze(2<i?n:void 0)(t,r);return r.set(t,e(s,t,r)),r}});function ms(t,e,n){var r,i=d(this),o=2<arguments.length?n:void 0;if("function"!=typeof e&&"function"!=typeof o)throw TypeError("At least one callback required");return i.has(t)?(r=i.get(t),"function"==typeof e&&(r=e(r),i.set(t,r))):"function"==typeof o&&(r=o(),i.set(t,r)),r}yt({target:"Map",proto:!0,real:!0,forced:s},{upsert:ms}),yt({target:"Map",proto:!0,real:!0,forced:s},{updateOrInsert:ms});ss("Set",function(e){return function(t){return e(this,arguments.length?t:void 0)}},ds),Ot.Set;yt({target:"Set",stat:!0},{from:as}),yt({target:"Set",stat:!0},{of:vs});yt({target:"Set",proto:!0,real:!0,forced:s},{addAll:function(){return function(){for(var t=d(this),e=ze(t.add),n=0,r=arguments.length;n<r;n++)e.call(t,arguments[n]);return t}.apply(this,arguments)}}),yt({target:"Set",proto:!0,real:!0,forced:s},{deleteAll:function(){return ys.apply(this,arguments)}});function ws(t){return Set.prototype.values.call(t)}yt({target:"Set",proto:!0,real:!0,forced:s},{every:function(t,e){var n=d(this),r=ws(n),i=Je(t,1<arguments.length?e:void 0,3);return!on(r,function(t){if(!i(t,t,n))return on.stop()},void 0,!1,!0).stopped}}),yt({target:"Set",proto:!0,real:!0,forced:s},{difference:function(t){var e=d(this),n=new(ln(e,ht("Set")))(e),r=ze(n.delete);return on(t,function(t){r.call(n,t)}),n}}),yt({target:"Set",proto:!0,real:!0,forced:s},{filter:function(t,e){var n=d(this),r=ws(n),i=Je(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Set"))),s=ze(o.add);return on(r,function(t){i(t,t,n)&&s.call(o,t)},void 0,!1,!0),o}}),yt({target:"Set",proto:!0,real:!0,forced:s},{find:function(t,e){var n=d(this),r=ws(n),i=Je(t,1<arguments.length?e:void 0,3);return on(r,function(t){if(i(t,t,n))return on.stop(t)},void 0,!1,!0).result}}),yt({target:"Set",proto:!0,real:!0,forced:s},{intersection:function(t){var e=d(this),n=new(ln(e,ht("Set"))),r=ze(e.has),i=ze(n.add);return on(t,function(t){r.call(e,t)&&i.call(n,t)}),n}}),yt({target:"Set",proto:!0,real:!0,forced:s},{isDisjointFrom:function(t){var e=d(this),n=ze(e.has);return!on(t,function(t){if(!0===n.call(e,t))return on.stop()}).stopped}}),yt({target:"Set",proto:!0,real:!0,forced:s},{isSubsetOf:function(t){var e=function(t){var e=Xe(t);if("function"!=typeof e)throw TypeError(String(t)+" is not iterable");return d(e.call(t))}(this),n=d(t),r=n.has;return"function"!=typeof r&&(n=new(ht("Set"))(t),r=ze(n.has)),!on(e,function(t){if(!1===r.call(n,t))return on.stop()},void 0,!1,!0).stopped}}),yt({target:"Set",proto:!0,real:!0,forced:s},{isSupersetOf:function(t){var e=d(this),n=ze(e.has);return!on(t,function(t){if(!1===n.call(e,t))return on.stop()}).stopped}}),yt({target:"Set",proto:!0,real:!0,forced:s},{join:function(t){var e=d(this),n=ws(e),r=void 0===t?",":String(t),i=[];return on(n,i.push,i,!1,!0),i.join(r)}}),yt({target:"Set",proto:!0,real:!0,forced:s},{map:function(t,e){var n=d(this),r=ws(n),i=Je(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Set"))),s=ze(o.add);return on(r,function(t){s.call(o,i(t,t,n))},void 0,!1,!0),o}}),yt({target:"Set",proto:!0,real:!0,forced:s},{reduce:function(e,t){var n=d(this),r=ws(n),i=arguments.length<2,o=i?void 0:t;if(ze(e),on(r,function(t){o=i?(i=!1,t):e(o,t,t,n)},void 0,!1,!0),i)throw TypeError("Reduce of empty set with no initial value");return o}}),yt({target:"Set",proto:!0,real:!0,forced:s},{some:function(t,e){var n=d(this),r=ws(n),i=Je(t,1<arguments.length?e:void 0,3);return on(r,function(t){if(i(t,t,n))return on.stop()},void 0,!1,!0).stopped}}),yt({target:"Set",proto:!0,real:!0,forced:s},{symmetricDifference:function(t){var e=d(this),n=new(ln(e,ht("Set")))(e),r=ze(n.delete),i=ze(n.add);return on(t,function(t){r.call(n,t)||i.call(n,t)}),n}}),yt({target:"Set",proto:!0,real:!0,forced:s},{union:function(t){var e=d(this),n=new(ln(e,ht("Set")))(e);return on(t,ze(n.add),n),n}});var bs=Math.floor;yt({target:"Number",stat:!0},{isInteger:function(t){return!g(t)&&isFinite(t)&&bs(t)===t}});Ot.Number.isInteger;var _s=function(t,e){return(_s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function Es(t,e){function n(){this.constructor=t}_s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Is=function(){return(Is=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function Ts(t,s,a,u){return new(a=a||Promise)(function(e,n){function r(t){try{o(u.next(t))}catch(t){n(t)}}function i(t){try{o(u.throw(t))}catch(t){n(t)}}function o(t){t.done?e(t.value):function(e){return e instanceof a?e:new a(function(t){t(e)})}(t.value).then(r,i)}o((u=u.apply(t,s||[])).next())})}function Ss(n,r){var i,o,s,t,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){a.label=e[1];break}if(6===e[0]&&a.label<s[1]){a.label=s[1],s=e;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(e);break}s[2]&&a.ops.pop(),a.trys.pop();continue}e=r.call(n,a)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}function Cs(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ns(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function As(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ns(arguments[e]));return t}function ks(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function Rs(t){for(var e=[],n=0,r=0;r<t.length;r++){var i=t.charCodeAt(r);i<128?e[n++]=i:(i<2048?e[n++]=i>>6|192:(55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128):e[n++]=i>>12|224,e[n++]=i>>6&63|128),e[n++]=63&i|128)}return e}function Os(t){try{return Ls.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}var Ds={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},Ps=function(t,e){if(!t)throw xs(e)},xs=function(t){return new Error("Firebase Database ("+Ds.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},Ls={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<t.length;i+=3){var o=t[i],s=i+1<t.length,a=s?t[i+1]:0,u=i+2<t.length,c=u?t[i+2]:0,h=o>>2,l=(3&o)<<4|a>>4,f=(15&a)<<2|c>>6,p=63&c;u||(p=64,s||(f=64)),r.push(n[h],n[l],n[f],n[p])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Rs(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){for(var e=[],n=0,r=0;n<t.length;){var i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(191<i&&i<224){var o=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(239<i&&i<365){var s=((7&i)<<18|(63&(o=t[n++]))<<12|(63&(a=t[n++]))<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{o=t[n++];var a=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&a)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<t.length;){var o=n[t.charAt(i++)],s=i<t.length?n[t.charAt(i)]:0,a=++i<t.length?n[t.charAt(i)]:64,u=++i<t.length?n[t.charAt(i)]:64;if(++i,null==o||null==s||null==a||null==u)throw Error();var c=o<<2|s>>4;if(r.push(c),64!==a){var h=s<<4&240|a>>2;if(r.push(h),64!==u){var l=a<<6&192|u;r.push(l)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),(this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};function Ms(t){return Fs(void 0,t)}function Fs(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n in e)e.hasOwnProperty(n)&&(t[n]=Fs(t[n],e[n]));return t}var Us=(js.prototype.wrapCallback=function(n){var r=this;return function(t,e){t?r.reject(t):r.resolve(e),"function"==typeof n&&(r.promise.catch(function(){}),1===n.length?n(t):n(t,e))}},js);function js(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}function qs(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function Vs(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(qs())}function Bs(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function Ws(){return!0===Ds.NODE_ADMIN}var Hs,Ks=(Es(Gs,Hs=Error),Gs);function Gs(t,e){var n=Hs.call(this,e)||this;return n.code=t,n.name="FirebaseError",Object.setPrototypeOf(n,Gs.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,zs.prototype.create),n}var zs=(Qs.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=e[0]||{},i=this.service+"/"+t,o=this.errors[t],s=o?function(t,r){return t.replace(Ys,function(t,e){var n=r[e];return null!=n?n.toString():"<"+e+"?>"})}(o,r):"Error",a=this.serviceName+": "+s+" ("+i+").",u=new Ks(i,a),c=0,h=Object.keys(r);c<h.length;c++){var l=h[c];"_"!==l.slice(-1)&&(l in u&&console.warn('Overwriting FirebaseError base field "'+l+'" can cause unexpected behavior.'),u[l]=r[l])}return u},Qs);function Qs(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var Ys=/\{\$([^}]+)}/g;function Js(t){return JSON.parse(t)}function Xs(t){return JSON.stringify(t)}function $s(t){var e={},n={},r={},i="";try{var o=t.split(".");e=Js(Os(o[0])||""),n=Js(Os(o[1])||""),i=o[2],r=n.d||{},delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}}function Zs(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ta(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function ea(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function na(t,e,n){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=e.call(n,t[i],i,t));return r}var ra=(ia.prototype.reset=function(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0},ia.prototype.compress_=function(t,e){e=e||0;var n=this.W_;if("string"==typeof t)for(var r=0;r<16;r++)n[r]=t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|t.charCodeAt(e+3),e+=4;else for(r=0;r<16;r++)n[r]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],e+=4;for(r=16;r<80;r++){var i=n[r-3]^n[r-8]^n[r-14]^n[r-16];n[r]=4294967295&(i<<1|i>>>31)}var o,s,a=this.chain_[0],u=this.chain_[1],c=this.chain_[2],h=this.chain_[3],l=this.chain_[4];for(r=0;r<80;r++)s=r<40?r<20?(o=h^u&(c^h),1518500249):(o=u^c^h,1859775393):r<60?(o=u&c|h&(u|c),2400959708):(o=u^c^h,3395469782),i=(a<<5|a>>>27)+o+l+s+n[r]&4294967295,l=h,h=c,c=4294967295&(u<<30|u>>>2),u=a,a=i;this.chain_[0]=this.chain_[0]+a&4294967295,this.chain_[1]=this.chain_[1]+u&4294967295,this.chain_[2]=this.chain_[2]+c&4294967295,this.chain_[3]=this.chain_[3]+h&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295},ia.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r<e;){if(0===o)for(;r<=n;)this.compress_(t,r),r+=this.blockSize;if("string"==typeof t){for(;r<e;)if(i[o]=t.charCodeAt(r),++r,++o===this.blockSize){this.compress_(i),o=0;break}}else for(;r<e;)if(i[o]=t[r],++r,++o===this.blockSize){this.compress_(i),o=0;break}}this.inbuf_=o,this.total_+=e}},ia.prototype.digest=function(){var t=[],e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(var n=this.blockSize-1;56<=n;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var i=24;0<=i;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t},ia);function ia(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(var t=1;t<this.blockSize;++t)this.pad_[t]=0;this.reset()}function oa(t,e){var n=new sa(t,e);return n.subscribe.bind(n)}var sa=(aa.prototype.next=function(e){this.forEachObserver(function(t){t.next(e)})},aa.prototype.error=function(e){this.forEachObserver(function(t){t.error(e)}),this.close(e)},aa.prototype.complete=function(){this.forEachObserver(function(t){t.complete()}),this.close()},aa.prototype.subscribe=function(t,e,n){var r,i=this;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(t,e){if("object"!=typeof t||null===t)return!1;for(var n=0,r=e;n<r.length;n++){var i=r[n];if(i in t&&"function"==typeof t[i])return!0}return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n}).next&&(r.next=ua),void 0===r.error&&(r.error=ua),void 0===r.complete&&(r.complete=ua);var o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(t){}}),this.observers.push(r),o},aa.prototype.unsubscribeOne=function(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},aa.prototype.forEachObserver=function(t){if(!this.finalized)for(var e=0;e<this.observers.length;e++)this.sendOne(e,t)},aa.prototype.sendOne=function(t,e){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[t])try{e(n.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}})},aa.prototype.close=function(t){var e=this;this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then(function(){e.observers=void 0,e.onNoObservers=void 0}))},aa);function aa(t,e){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then(function(){t(n)}).catch(function(t){n.error(t)})}function ua(){}function ca(t,e,n,r){var i;if(r<e?i="at least "+e:n<r&&(i=0===n?"none":"no more than "+n),i)throw new Error(t+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".")}function ha(t,e,n){var r="";switch(e){case 1:r=n?"first":"First";break;case 2:r=n?"second":"Second";break;case 3:r=n?"third":"Third";break;case 4:r=n?"fourth":"Fourth";break;default:throw new Error("errorPrefix called with argumentNumber > 4. Need to update it?")}var i=t+" failed: ";return i+=r+" argument "}function la(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(ha(t,e,r)+"must be a valid function.")}function fa(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(ha(t,e,r)+"must be a valid context object.")}function pa(t){for(var e=0,n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e++:r<2048?e+=2:55296<=r&&r<=56319?(e+=4,n++):e+=3}return e}var da=(va.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},va.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},va.prototype.setServiceProps=function(t){return this.serviceProps=t,this},va);function va(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var ya="[DEFAULT]",ga=(ma.prototype.get=function(t){void 0===t&&(t=ya);var e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){var n=new Us;this.instancesDeferred.set(e,n);try{var r=this.getOrInitializeService(e);r&&n.resolve(r)}catch(t){}}return this.instancesDeferred.get(e).promise},ma.prototype.getImmediate=function(t){var e=Is({identifier:ya,optional:!1},t),n=e.identifier,r=e.optional,i=this.normalizeInstanceIdentifier(n);try{var o=this.getOrInitializeService(i);if(o)return o;if(r)return null;throw Error("Service "+this.name+" is not available")}catch(t){if(r)return null;throw t}},ma.prototype.getComponent=function(){return this.component},ma.prototype.setComponent=function(t){var e,n;if(t.name!==this.name)throw Error("Mismatching Component "+t.name+" for Provider "+this.name+".");if(this.component)throw Error("Component for "+this.name+" has already been provided");if(function(t){return"EAGER"===t.instantiationMode}(this.component=t))try{this.getOrInitializeService(ya)}catch(t){}try{for(var r=Cs(this.instancesDeferred.entries()),i=r.next();!i.done;i=r.next()){var o=Ns(i.value,2),s=o[0],a=o[1],u=this.normalizeInstanceIdentifier(s);try{var c=this.getOrInitializeService(u);a.resolve(c)}catch(t){}}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},ma.prototype.clearInstance=function(t){void 0===t&&(t=ya),this.instancesDeferred.delete(t),this.instances.delete(t)},ma.prototype.delete=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return e=Array.from(this.instances.values()),[4,Promise.all(e.filter(function(t){return"INTERNAL"in t}).map(function(t){return t.INTERNAL.delete()}))];case 1:return t.sent(),[2]}})})},ma.prototype.isComponentSet=function(){return null!=this.component},ma.prototype.getOrInitializeService=function(t){var e=this.instances.get(t);return!e&&this.component&&(e=this.component.instanceFactory(this.container,function(t){return t===ya?void 0:t}(t)),this.instances.set(t,e)),e||null},ma.prototype.normalizeInstanceIdentifier=function(t){return this.component?this.component.multipleInstances?t:ya:t},ma);function ma(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}var wa,ba=(_a.prototype.addComponent=function(t){var e=this.getProvider(t.name);if(e.isComponentSet())throw new Error("Component "+t.name+" has already been registered with "+this.name);e.setComponent(t)},_a.prototype.addOrOverwriteComponent=function(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)},_a.prototype.getProvider=function(t){if(this.providers.has(t))return this.providers.get(t);var e=new ga(t,this);return this.providers.set(t,e),e},_a.prototype.getProviders=function(){return Array.from(this.providers.values())},_a);function _a(t){this.name=t,this.providers=new Map}function Ea(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}var Ia,Ta,Sa=[];(Ta=Ia=Ia||{})[Ta.DEBUG=0]="DEBUG",Ta[Ta.VERBOSE=1]="VERBOSE",Ta[Ta.INFO=2]="INFO",Ta[Ta.WARN=3]="WARN",Ta[Ta.ERROR=4]="ERROR",Ta[Ta.SILENT=5]="SILENT";function Ca(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(e<t.logLevel)){var i=(new Date).toISOString(),o=Ra[e];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+e+")");console[o].apply(console,Ea(["["+i+"] "+t.name+":"],n))}}var Na,Aa={debug:Ia.DEBUG,verbose:Ia.VERBOSE,info:Ia.INFO,warn:Ia.WARN,error:Ia.ERROR,silent:Ia.SILENT},ka=Ia.INFO,Ra=((wa={})[Ia.DEBUG]="log",wa[Ia.VERBOSE]="log",wa[Ia.INFO]="info",wa[Ia.WARN]="warn",wa[Ia.ERROR]="error",wa),Oa=(Object.defineProperty(Da.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in Ia))throw new TypeError("Invalid value assigned to `logLevel`");this._logLevel=t},enumerable:!0,configurable:!0}),Object.defineProperty(Da.prototype,"logHandler",{get:function(){return this._logHandler},set:function(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t},enumerable:!0,configurable:!0}),Object.defineProperty(Da.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!0,configurable:!0}),Da.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Ea([this,Ia.DEBUG],t)),this._logHandler.apply(this,Ea([this,Ia.DEBUG],t))},Da.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Ea([this,Ia.VERBOSE],t)),this._logHandler.apply(this,Ea([this,Ia.VERBOSE],t))},Da.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Ea([this,Ia.INFO],t)),this._logHandler.apply(this,Ea([this,Ia.INFO],t))},Da.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Ea([this,Ia.WARN],t)),this._logHandler.apply(this,Ea([this,Ia.WARN],t))},Da.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Ea([this,Ia.ERROR],t)),this._logHandler.apply(this,Ea([this,Ia.ERROR],t))},Da);function Da(t){this.name=t,this._logLevel=ka,this._logHandler=Ca,this._userLogHandler=null,Sa.push(this)}function Pa(t){var e="string"==typeof t?Aa[t]:t;Sa.forEach(function(t){t.logLevel=e})}var xa,La=((Na={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",Na["bad-app-name"]="Illegal App name: '{$appName}",Na["duplicate-app"]="Firebase App named '{$appName}' already exists",Na["app-deleted"]="Firebase App named '{$appName}' already deleted",Na["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",Na["invalid-log-argument"]="First argument to `onLog` must be null or a function.",Na),Ma=new zs("app","Firebase",La),Fa="@firebase/app",Ua="[DEFAULT]",ja=((xa={})[Fa]="fire-core",xa["@firebase/analytics"]="fire-analytics",xa["@firebase/auth"]="fire-auth",xa["@firebase/database"]="fire-rtdb",xa["@firebase/functions"]="fire-fn",xa["@firebase/installations"]="fire-iid",xa["@firebase/messaging"]="fire-fcm",xa["@firebase/performance"]="fire-perf",xa["@firebase/remote-config"]="fire-rc",xa["@firebase/storage"]="fire-gcs",xa["@firebase/firestore"]="fire-fst",xa["fire-js"]="fire-js",xa["firebase-wrapper"]="fire-js-all",xa),qa=new Oa("@firebase/app"),Va=(Object.defineProperty(Ba.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(t){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ba.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(Ba.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!0,configurable:!0}),Ba.prototype.delete=function(){var e=this;return new Promise(function(t){e.checkDestroyed_(),t()}).then(function(){return e.firebase_.INTERNAL.removeApp(e.name_),Promise.all(e.container.getProviders().map(function(t){return t.delete()}))}).then(function(){e.isDeleted_=!0})},Ba.prototype._getService=function(t,e){return void 0===e&&(e=Ua),this.checkDestroyed_(),this.container.getProvider(t).getImmediate({identifier:e})},Ba.prototype._removeServiceInstance=function(t,e){void 0===e&&(e=Ua),this.container.getProvider(t).clearInstance(e)},Ba.prototype._addComponent=function(e){try{this.container.addComponent(e)}catch(t){qa.debug("Component "+e.name+" failed to register with FirebaseApp "+this.name,t)}},Ba.prototype._addOrOverwriteComponent=function(t){this.container.addOrOverwriteComponent(t)},Ba.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw Ma.create("app-deleted",{appName:this.name_})},Ba);function Ba(t,e,n){var r,i,o=this;this.firebase_=n,this.isDeleted_=!1,this.name_=e.name,this.automaticDataCollectionEnabled_=e.automaticDataCollectionEnabled||!1,this.options_=Ms(t),this.container=new ba(e.name),this._addComponent(new da("app",function(){return o},"PUBLIC"));try{for(var s=Cs(this.firebase_.INTERNAL.components.values()),a=s.next();!a.done;a=s.next()){var u=a.value;this._addComponent(u)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}Va.prototype.name&&Va.prototype.options||Va.prototype.delete||console.log("dc");var Wa="7.13.1";function Ha(u){var c={},h=new Map,l={__esModule:!0,initializeApp:function(t,e){void 0===e&&(e={});if("object"!=typeof e||null===e){e={name:e}}var n=e;void 0===n.name&&(n.name=Ua);var r=n.name;if("string"!=typeof r||!r)throw Ma.create("bad-app-name",{appName:String(r)});if(Zs(c,r))throw Ma.create("duplicate-app",{appName:r});var i=new u(t,n,l);return c[r]=i},app:f,registerVersion:function(t,e,n){var r,i=null!==(r=ja[t])&&void 0!==r?r:t;n&&(i+="-"+n);var o=i.match(/\s|\//),s=e.match(/\s|\//);if(o||s){var a=['Unable to register library "'+i+'" with version "'+e+'":'];return o&&a.push('library name "'+i+'" contains illegal characters (whitespace or "/")'),o&&s&&a.push("and"),s&&a.push('version name "'+e+'" contains illegal characters (whitespace or "/")'),void qa.warn(a.join(" "))}p(new da(i+"-version",function(){return{library:i,version:e}},"VERSION"))},setLogLevel:Pa,onLog:function(t,e){if(null!==t&&"function"!=typeof t)throw Ma.create("invalid-log-argument",{appName:name});!function(s,e){for(var t=function(t){var o=null;e&&e.level&&(o=Aa[e.level]),t.userLogHandler=null===s?null:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=n.map(function(t){if(null==t)return null;if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return t.toString();if(t instanceof Error)return t.message;try{return JSON.stringify(t)}catch(t){return null}}).filter(function(t){return t}).join(" ");e>=(null!=o?o:t.logLevel)&&s({level:Ia[e].toLowerCase(),message:i,args:n,type:t.name})}},n=0,r=Sa;n<r.length;n++){t(r[n])}}(t,e)},apps:null,SDK_VERSION:Wa,INTERNAL:{registerComponent:p,removeApp:function(t){delete c[t]},components:h,useAsService:function(t,e){return"serverAuth"!==e?e:null}}};function f(t){if(!Zs(c,t=t||Ua))throw Ma.create("no-app",{appName:t});return c[t]}function p(n){var e,t,r=n.name;if(h.has(r))return qa.debug("There were multiple attempts to register component "+r+"."),"PUBLIC"===n.type?l[r]:null;if(h.set(r,n),"PUBLIC"===n.type){var i=function(t){if(void 0===t&&(t=f()),"function"!=typeof t[r])throw Ma.create("invalid-app-argument",{appName:r});return t[r]()};void 0!==n.serviceProps&&Fs(i,n.serviceProps),l[r]=i,u.prototype[r]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._getService.bind(this,r).apply(this,n.multipleInstances?t:[])}}try{for(var o=Cs(Object.keys(c)),s=o.next();!s.done;s=o.next()){var a=s.value;c[a]._addComponent(n)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return"PUBLIC"===n.type?l[r]:null}return l.default=l,Object.defineProperty(l,"apps",{get:function(){return Object.keys(c).map(function(t){return c[t]})}}),f.App=u,l}var Ka=function t(){var e=Ha(Va);return e.INTERNAL=Is(Is({},e.INTERNAL),{createFirebaseNamespace:t,extendNamespace:function(t){Fs(e,t)},createSubscribe:oa,ErrorFactory:zs,deepExtend:Fs}),e}(),Ga=(za.prototype.getPlatformInfoString=function(){return this.container.getProviders().map(function(t){if(function(t){var e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){var e=t.getImmediate();return e.library+"/"+e.version}return null}).filter(function(t){return t}).join(" ")},za);function za(t){this.container=t}if("object"==typeof self&&self.self===self&&void 0!==self.firebase){qa.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n ");var Qa=self.firebase.SDK_VERSION;Qa&&0<=Qa.indexOf("LITE")&&qa.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 Ya=Ka.initializeApp;Ka.initializeApp=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(t){return!1}}()&&qa.warn('\n Warning: This is a browser-targeted Firebase bundle but it appears it is being\n run in a Node environment. If running in a Node environment, make sure you\n are using the bundle specified by the "main" field in package.json.\n \n If you are using Webpack, you can specify "main" as the first item in\n "resolve.mainFields":\n https://webpack.js.org/configuration/resolve/#resolvemainfields\n \n If using Rollup, use the rollup-plugin-node-resolve plugin and specify "main"\n as the first item in "mainFields", e.g. [\'main\', \'module\'].\n https://github.com/rollup/rollup-plugin-node-resolve\n '),Ya.apply(void 0,t)};var Ja,Xa,Kl=Ka;(Ja=Kl).INTERNAL.registerComponent(new da("platform-logger",function(t){return new Ga(t)},"PRIVATE")),Ja.registerVersion(Fa,"0.6.0",Xa),Ja.registerVersion("fire-js","");Kl.registerVersion("firebase","7.13.1","app");(function(){var t,o="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){t!=Array.prototype&&t!=Object.prototype&&(t[e]=n.value)};var s=function(t){t=["object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global,t];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}return globalThis}(this);function c(t){var e="undefined"!=typeof Symbol&&Symbol.iterator&&t[Symbol.iterator];return e?e.call(t):{next:function(t){var e=0;return function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}(t)}}!function(t,e){if(e){var n=s;t=t.split(".");for(var r=0;r<t.length-1;r++){var i=t[r];i in n||(n[i]={}),n=n[i]}(e=e(r=n[t=t[t.length-1]]))!=r&&null!=e&&o(n,t,{configurable:!0,writable:!0,value:e})}}("Promise",function(t){function a(t){this.b=0,this.c=void 0,this.a=[];var e=this.f();try{t(e.resolve,e.reject)}catch(t){e.reject(t)}}function e(){this.a=null}function u(e){return e instanceof a?e:new a(function(t){t(e)})}if(t)return t;e.prototype.b=function(t){if(null==this.a){this.a=[];var e=this;this.c(function(){e.g()})}this.a.push(t)};var n=s.setTimeout;e.prototype.c=function(t){n(t,0)},e.prototype.g=function(){for(;this.a&&this.a.length;){var t=this.a;this.a=[];for(var e=0;e<t.length;++e){var n=t[e];t[e]=null;try{n()}catch(t){this.f(t)}}}this.a=null},e.prototype.f=function(t){this.c(function(){throw t})},a.prototype.f=function(){function t(e){return function(t){r||(r=!0,e.call(n,t))}}var n=this,r=!1;return{resolve:t(this.m),reject:t(this.g)}},a.prototype.m=function(t){if(t===this)this.g(new TypeError("A Promise cannot resolve to itself"));else if(t instanceof a)this.s(t);else{t:switch(typeof t){case"object":var e=null!=t;break t;case"function":e=!0;break t;default:e=!1}e?this.u(t):this.h(t)}},a.prototype.u=function(t){var e=void 0;try{e=t.then}catch(t){return void this.g(t)}"function"==typeof e?this.w(e,t):this.h(t)},a.prototype.g=function(t){this.i(2,t)},a.prototype.h=function(t){this.i(1,t)},a.prototype.i=function(t,e){if(0!=this.b)throw Error("Cannot settle("+t+", "+e+"): Promise already settled in state"+this.b);this.b=t,this.c=e,this.l()},a.prototype.l=function(){if(null!=this.a){for(var t=0;t<this.a.length;++t)i.b(this.a[t]);this.a=null}};var i=new e;return a.prototype.s=function(t){var e=this.f();t.Oa(e.resolve,e.reject)},a.prototype.w=function(t,e){var n=this.f();try{t.call(e,n.resolve,n.reject)}catch(t){n.reject(t)}},a.prototype.then=function(t,e){function n(e,t){return"function"==typeof e?function(t){try{r(e(t))}catch(t){i(t)}}:t}var r,i,o=new a(function(t,e){r=t,i=e});return this.Oa(n(t,r),n(e,i)),o},a.prototype.catch=function(t){return this.then(void 0,t)},a.prototype.Oa=function(t,e){function n(){switch(r.b){case 1:t(r.c);break;case 2:e(r.c);break;default:throw Error("Unexpected state: "+r.b)}}var r=this;null==this.a?i.b(n):this.a.push(n)},a.resolve=u,a.reject=function(n){return new a(function(t,e){e(n)})},a.race=function(i){return new a(function(t,e){for(var n=c(i),r=n.next();!r.done;r=n.next())u(r.value).Oa(t,e)})},a.all=function(t){var o=c(t),s=o.next();return s.done?u([]):new a(function(n,t){function e(e){return function(t){r[e]=t,0==--i&&n(r)}}for(var r=[],i=0;r.push(void 0),i++,u(s.value).Oa(e(r.length-1),t),!(s=o.next()).done;);})},a});var u=u||{},l=this||self,a=/^[\w+/_-]+[=]{0,2}$/,h=null;function f(){}function n(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}function p(t){var e=n(t);return"array"==e||"object"==e&&"number"==typeof t.length}function d(t){return"function"==n(t)}function v(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var e="closure_uid_"+(1e9*Math.random()>>>0),r=0;function i(t,e,n){return t.call.apply(t.bind,arguments)}function y(e,n,t){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var t=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(t,r),e.apply(n,t)}}return function(){return e.apply(n,arguments)}}function g(t,e,n){return(g=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?i:y).apply(null,arguments)}function m(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)}}var w=Date.now||function(){return+new Date};function b(t,e){function n(){}n.prototype=e.prototype,t.Za=e.prototype,t.prototype=new n,t.prototype.constructor=t}function _(t,e,n){this.code=T+t,this.message=e||S[t]||"",this.a=n||null}function E(t){var e=t&&t.code;return e?new _(e.substring(T.length),t.message,t.serverResponse):null}b(_,Error),_.prototype.v=function(){var t={code:this.code,message:this.message};return this.a&&(t.serverResponse=this.a),t},_.prototype.toJSON=function(){return this.v()};var I,T="auth/",S={"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","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.","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.","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.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","expired-action-code":"The action code has expired. ","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal error has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registed for the current project.","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.","invalid-auth-event":"An internal error has occurred.","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 use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","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.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is malformed or has expired.","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.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","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].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","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.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal error has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","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.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","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.","network-request-failed":"A network error (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal error has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","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.","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.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled."},C={hd:{Ra:"https://staging-identitytoolkit.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",Xa:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Ua:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"b"},pd:{Ra:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",Xa:"https://securetoken.googleapis.com/v1/token",Ua:"https://identitytoolkit.googleapis.com/v2/",id:"p"},rd:{Ra:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",Xa:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Ua:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"s"},sd:{Ra:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",Xa:"https://test-securetoken.sandbox.googleapis.com/v1/token",Ua:"https://test-identitytoolkit.sandbox.googleapis.com/v2/",id:"t"}};function N(t){for(var e in C)if(C[e].id===t)return{firebaseEndpoint:(t=C[e]).Ra,secureTokenEndpoint:t.Xa,identityPlatformEndpoint:t.Ua};return null}function A(t){if(!t)return!1;try{return!!t.$goog_Thenable}catch(t){return!1}}function k(t){if(Error.captureStackTrace)Error.captureStackTrace(this,k);else{var e=Error().stack;e&&(this.stack=e)}t&&(this.message=String(t))}function R(t,e){for(var n="",r=(t=t.split("%s")).length-1,i=0;i<r;i++)n+=t[i]+(i<e.length?e[i]:"%s");k.call(this,n+t[r])}function O(t,e){throw new R("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1))}function D(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function P(t,e){t.f(e),t.b<100&&(t.b++,e.next=t.a,t.a=e)}function x(){this.b=this.a=null}I=N("__EID__")?"__EID__":void 0,b(k,Error),k.prototype.name="CustomError",b(R,k),R.prototype.name="AssertionError",D.prototype.get=function(){if(0<this.b){this.b--;var t=this.a;this.a=t.next,t.next=null}else t=this.c();return t};var L=new D(function(){return new M},function(t){t.reset()});function M(){this.next=this.b=this.a=null}x.prototype.add=function(t,e){var n=L.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},M.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},M.prototype.reset=function(){this.next=this.b=this.a=null};var F=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1},U=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i="string"==typeof t?t.split(""):t,o=0;o<r;o++)o in i&&e.call(n,i[o],o,t)};var j=Array.prototype.filter?function(t,e){return Array.prototype.filter.call(t,e,void 0)}:function(t,e){for(var n=t.length,r=[],i=0,o="string"==typeof t?t.split(""):t,s=0;s<n;s++)if(s in o){var a=o[s];e.call(void 0,a,s,t)&&(r[i++]=a)}return r},q=Array.prototype.map?function(t,e){return Array.prototype.map.call(t,e,void 0)}:function(t,e){for(var n=t.length,r=Array(n),i="string"==typeof t?t.split(""):t,o=0;o<n;o++)o in i&&(r[o]=e.call(void 0,i[o],o,t));return r},V=Array.prototype.some?function(t,e){return Array.prototype.some.call(t,e,void 0)}:function(t,e){for(var n=t.length,r="string"==typeof t?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t))return!0;return!1};function B(t,e){return 0<=F(t,e)}function W(t,e){var n;return(n=0<=(e=F(t,e)))&&Array.prototype.splice.call(t,e,1),n}function H(n,r){!function(t,e){for(var n="string"==typeof t?t.split(""):t,r=t.length-1;0<=r;--r)r in n&&e.call(void 0,n[r],r,t)}(n,function(t,e){r.call(void 0,t,e,n)&&1==Array.prototype.splice.call(n,e,1).length&&0})}function K(t){return Array.prototype.concat.apply([],arguments)}function G(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}var z,Q=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]},Y=/&/g,J=/</g,X=/>/g,$=/"/g,Z=/'/g,tt=/\x00/g,et=/[\x00&<>"']/;function nt(t,e){return-1!=t.indexOf(e)}function rt(t,e){return t<e?-1:e<t?1:0}t:{var it=l.navigator;if(it){var ot=it.userAgent;if(ot){z=ot;break t}}z=""}function st(t){return nt(z,t)}function at(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function ut(t){for(var e in t)return!1;return!0}function ct(t){var e,n={};for(e in t)n[e]=t[e];return n}var ht="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function lt(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var o=0;o<ht.length;o++)n=ht[o],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function ft(t,e){t:{try{var n=t&&t.ownerDocument,r=n&&(n.defaultView||n.parentWindow);if((r=r||l).Element&&r.Location){var i=r;break t}}catch(t){}i=null}if(i&&void 0!==i[e]&&(!t||!(t instanceof i[e])&&(t instanceof i.Location||t instanceof i.Element))){if(v(t))try{var o=t.constructor.displayName||t.constructor.name||Object.prototype.toString.call(t)}catch(t){o="<object could not be stringified>"}else o=void 0===t?"undefined":null===t?"null":typeof t;O("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,o)}}function pt(t,e){this.a=t===yt&&e||"",this.b=vt}function dt(t){return t instanceof pt&&t.constructor===pt&&t.b===vt?t.a:(O("expected object of type Const, got '"+t+"'"),"type_error:Const")}pt.prototype.ra=!0,pt.prototype.qa=function(){return this.a},pt.prototype.toString=function(){return"Const{"+this.a+"}"};var vt={},yt={},gt=new pt(yt,"");function mt(t,e){this.a=t===Tt&&e||"",this.b=It}function wt(t){return t instanceof mt&&t.constructor===mt&&t.b===It?t.a:(O("expected object of type TrustedResourceUrl, got '"+t+"' of type "+n(t)),"type_error:TrustedResourceUrl")}function bt(t,n){var r=dt(t);if(!Et.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return t=r.replace(_t,function(t,e){if(!Object.prototype.hasOwnProperty.call(n,e))throw Error('Found marker, "'+e+'", in format string, "'+r+'", but no valid label mapping found in args: '+JSON.stringify(n));return(t=n[e])instanceof pt?dt(t):encodeURIComponent(String(t))}),new mt(Tt,t)}mt.prototype.ra=!0,mt.prototype.qa=function(){return this.a.toString()},mt.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var _t=/%{(\w+)}/g,Et=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,It={},Tt={};function St(t,e){this.a=t===Rt&&e||"",this.b=kt}function Ct(t){return t instanceof St&&t.constructor===St&&t.b===kt?t.a:(O("expected object of type SafeUrl, got '"+t+"' of type "+n(t)),"type_error:SafeUrl")}St.prototype.ra=!0,St.prototype.qa=function(){return this.a.toString()},St.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Nt=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function At(t){return t instanceof St?t:(t="object"==typeof t&&t.ra?t.qa():String(t),Nt.test(t)||(t="about:invalid#zClosurez"),new St(Rt,t))}var kt={},Rt={};function Ot(){this.a="",this.b=Pt}function Dt(t){return t instanceof Ot&&t.constructor===Ot&&t.b===Pt?t.a:(O("expected object of type SafeHtml, got '"+t+"' of type "+n(t)),"type_error:SafeHtml")}Ot.prototype.ra=!0,Ot.prototype.qa=function(){return this.a.toString()},Ot.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Pt={};function xt(t){var e=new Ot;return e.a=t,e}xt("<!DOCTYPE html>");var Lt=xt("");function Mt(t,e){for(var n=t.split("%s"),r="",i=Array.prototype.slice.call(arguments,1);i.length&&1<n.length;)r+=n.shift()+i.shift();return r+n.join("%s")}function Ft(t){return et.test(t)&&(-1!=t.indexOf("&")&&(t=t.replace(Y,"&amp;")),-1!=t.indexOf("<")&&(t=t.replace(J,"&lt;")),-1!=t.indexOf(">")&&(t=t.replace(X,"&gt;")),-1!=t.indexOf('"')&&(t=t.replace($,"&quot;")),-1!=t.indexOf("'")&&(t=t.replace(Z,"&#39;")),-1!=t.indexOf("\0")&&(t=t.replace(tt,"&#0;"))),t}function Ut(t){return Ut[" "](t),t}xt("<br>"),Ut[" "]=f;var jt,qt,Vt=st("Opera"),Bt=st("Trident")||st("MSIE"),Wt=st("Edge"),Ht=Wt||Bt,Kt=st("Gecko")&&!(nt(z.toLowerCase(),"webkit")&&!st("Edge"))&&!(st("Trident")||st("MSIE"))&&!st("Edge"),Gt=nt(z.toLowerCase(),"webkit")&&!st("Edge");function zt(){var t=l.document;return t?t.documentMode:void 0}t:{var Qt="",Yt=(qt=z,Kt?/rv:([^\);]+)(\)|;)/.exec(qt):Wt?/Edge\/([\d\.]+)/.exec(qt):Bt?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(qt):Gt?/WebKit\/(\S+)/.exec(qt):Vt?/(?:Version)[ \/]?(\S+)/.exec(qt):void 0);if(Yt&&(Qt=Yt?Yt[1]:""),Bt){var Jt=zt();if(null!=Jt&&Jt>parseFloat(Qt)){jt=String(Jt);break t}}jt=Qt}var Xt,$t={};function Zt(a){return function(t,e){var n=$t;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(a,function(){for(var t=0,e=Q(String(jt)).split("."),n=Q(String(a)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var o=e[i]||"",s=n[i]||"";do{if(o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],0==o[0].length&&0==s[0].length)break;t=rt(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||rt(0==o[2].length,0==s[2].length)||rt(o[2],s[2]),o=o[3],s=s[3]}while(0==t)}return 0<=t})}Xt=l.document&&Bt?zt():void 0;try{new self.OffscreenCanvas(0,0).getContext("2d")}catch(t){}var te=!Bt||9<=Number(Xt);function ee(t){var e=document;return"string"==typeof t?e.getElementById(t):t}function ne(n,t){at(t,function(t,e){t&&"object"==typeof t&&t.ra&&(t=t.qa()),"style"==e?n.style.cssText=t:"class"==e?n.className=t:"for"==e?n.htmlFor=t:oe.hasOwnProperty(e)?n.setAttribute(oe[e],t):0==e.lastIndexOf("aria-",0)||0==e.lastIndexOf("data-",0)?n.setAttribute(e,t):n[e]=t})}var re,ie,oe={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};function se(t,e,n){var r=arguments,i=document,o=String(r[0]),s=r[1];if(!te&&s&&(s.name||s.type)){if(o=["<",o],s.name&&o.push(' name="',Ft(s.name),'"'),s.type){o.push(' type="',Ft(s.type),'"');var a={};lt(a,s),delete a.type,s=a}o.push(">"),o=o.join("")}return o=ae(i,o),s&&("string"==typeof s?o.className=s:Array.isArray(s)?o.className=s.join(" "):ne(o,s)),2<r.length&&function(e,n,t){function r(t){t&&n.appendChild("string"==typeof t?e.createTextNode(t):t)}for(var i=2;i<t.length;i++){var o=t[i];!p(o)||v(o)&&0<o.nodeType?r(o):U(ue(o)?G(o):o,r)}}(i,o,r),o}function ae(t,e){return e=String(e),"application/xhtml+xml"===t.contentType&&(e=e.toLowerCase()),t.createElement(e)}function ue(t){if(t&&"number"==typeof t.length){if(v(t))return"function"==typeof t.item||"string"==typeof t.item;if(d(t))return"function"==typeof t.item}return!1}function ce(t){l.setTimeout(function(){throw t},0)}function he(){var t=l.MessageChannel;if(void 0===t&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!st("Presto")&&(t=function(){var t=ae(document,"IFRAME");t.style.display="none",function(t){var e=new mt(Tt,dt(gt));ft(t,"HTMLIFrameElement"),t.src=wt(e).toString()}(t),document.documentElement.appendChild(t);var e=t.contentWindow;(t=e.document).open(),t.write(Dt(Lt)),t.close();var n="callImmediate"+Math.random(),r="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host;t=g(function(t){"*"!=r&&t.origin!=r||t.data!=n||this.port1.onmessage()},this),e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,r)}}}),void 0===t||st("Trident")||st("MSIE"))return function(t){l.setTimeout(t,0)};var e=new t,n={},r=n;return e.port1.onmessage=function(){if(void 0!==n.next){var t=(n=n.next).Db;n.Db=null,t()}},function(t){r.next={Db:t},r=r.next,e.port2.postMessage(0)}}function le(t,e){ie||function(){if(l.Promise&&l.Promise.resolve){var t=l.Promise.resolve(void 0);ie=function(){t.then(de)}}else ie=function(){var t=de;!d(l.setImmediate)||l.Window&&l.Window.prototype&&!st("Edge")&&l.Window.prototype.setImmediate==l.setImmediate?(re=re||he())(t):l.setImmediate(t)}}(),fe||(ie(),fe=!0),pe.add(t,e)}var fe=!1,pe=new x;function de(){for(var t;n=e=void 0,n=null,(e=pe).a&&(n=e.a,e.a=e.a.next,e.a||(e.b=null),n.next=null),t=n;){try{t.a.call(t.b)}catch(t){ce(t)}P(L,t)}var e,n;fe=!1}function ve(t,e){if(this.a=ye,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,t!=f)try{var n=this;t.call(e,function(t){Ae(n,ge,t)},function(t){if(!(t instanceof Le))try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(t){}Ae(n,me,t)})}catch(t){Ae(this,me,t)}}var ye=0,ge=2,me=3;function we(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}we.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var be=new D(function(){return new we},function(t){t.reset()});function _e(t,e,n){var r=be.get();return r.g=t,r.b=e,r.f=n,r}function Ee(t){if(t instanceof ve)return t;var e=new ve(f);return Ae(e,ge,t),e}function Ie(n){return new ve(function(t,e){e(n)})}function Te(t,e,n){ke(t,e,n,null)||le(m(e,t))}function Se(n){return new ve(function(r){var i=n.length,o=[];if(i)for(var t=function(t,e,n){i--,o[t]=e?{Mb:!0,value:n}:{Mb:!1,reason:n},0==i&&r(o)},e=0;e<n.length;e++)Te(n[e],m(t,e,!0),m(t,e,!1));else r(o)})}function Ce(t,e){t.b||t.a!=ge&&t.a!=me||Re(t),t.f?t.f.next=e:t.b=e,t.f=e}function Ne(t,i,o,s){var e=_e(null,null,null);return e.a=new ve(function(n,r){e.g=i?function(t){try{var e=i.call(s,t);n(e)}catch(t){r(t)}}:n,e.b=o?function(t){try{var e=o.call(s,t);void 0===e&&t instanceof Le?r(t):n(e)}catch(t){r(t)}}:r}),Ce(e.a.c=t,e),e.a}function Ae(t,e,n){t.a==ye&&(t===n&&(e=me,n=new TypeError("Promise cannot resolve to itself")),t.a=1,ke(n,t.Yc,t.Zc,t)||(t.i=n,t.a=e,t.c=null,Re(t),e!=me||n instanceof Le||function(t,e){t.g=!0,le(function(){t.g&&xe.call(null,e)})}(t,n)))}function ke(t,e,n,r){if(t instanceof ve)return Ce(t,_e(e||f,n||null,r)),!0;if(A(t))return t.then(e,n,r),!0;if(v(t))try{var i=t.then;if(d(i))return function(t,e,n,r,i){function o(t){s||(s=!0,r.call(i,t))}var s=!1;try{e.call(t,function(t){s||(s=!0,n.call(i,t))},o)}catch(t){o(t)}}(t,i,e,n,r),!0}catch(t){return n.call(r,t),!0}return!1}function Re(t){t.h||(t.h=!0,le(t.ec,t))}function Oe(t){var e=null;return t.b&&(e=t.b,t.b=e.next,e.next=null),t.b||(t.f=null),e}function De(t,e,n,r){if(n==me&&e.b&&!e.c)for(;t&&t.g;t=t.c)t.g=!1;if(e.a)e.a.c=null,Pe(e,n,r);else try{e.c?e.g.call(e.f):Pe(e,n,r)}catch(t){xe.call(null,t)}P(be,e)}function Pe(t,e,n){e==ge?t.g.call(t.f,n):t.b&&t.b.call(t.f,n)}ve.prototype.then=function(t,e,n){return Ne(this,d(t)?t:null,d(e)?e:null,n)},ve.prototype.$goog_Thenable=!0,(t=ve.prototype).ma=function(t,e){return(t=_e(t,t,e)).c=!0,Ce(this,t),this},t.o=function(t,e){return Ne(this,null,t,e)},t.cancel=function(t){if(this.a==ye){var e=new Le(t);le(function(){!function t(e,n){if(e.a==ye)if(e.c){var r=e.c;if(r.b){for(var i=0,o=null,s=null,a=r.b;a&&(a.c||(i++,a.a==e&&(o=a),!(o&&1<i)));a=a.next)o||(s=a);o&&(r.a==ye&&1==i?t(r,n):(s?((i=s).next==r.f&&(r.f=i),i.next=i.next.next):Oe(r),De(r,o,me,n)))}e.c=null}else Ae(e,me,n)}(this,e)},this)}},t.Yc=function(t){this.a=ye,Ae(this,ge,t)},t.Zc=function(t){this.a=ye,Ae(this,me,t)},t.ec=function(){for(var t;t=Oe(this);)De(this,t,this.a,this.i);this.h=!1};var xe=ce;function Le(t){k.call(this,t)}function Me(){this.wa=this.wa,this.na=this.na}b(Le,k);var Fe=0;function Ue(t){if(!t.wa&&(t.wa=!0,t.Ba(),0!=Fe))(function(t){Object.prototype.hasOwnProperty.call(t,e)&&t[e]||(t[e]=++r)})(t)}Me.prototype.wa=!(Le.prototype.name="cancel"),Me.prototype.Ba=function(){if(this.na)for(;this.na.length;)this.na.shift()()};var je=Object.freeze||function(t){return t},qe=!Bt||9<=Number(Xt),Ve=Bt&&!Zt("9"),Be=function(){if(!l.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{l.addEventListener("test",f,e),l.removeEventListener("test",f,e)}catch(t){}return t}();function We(t,e){this.type=t,this.b=this.target=e,this.defaultPrevented=!1}function He(t,e){if(We.call(this,t?t.type:""),this.relatedTarget=this.b=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.pointerId=0,this.pointerType="",this.a=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.b=e,e=t.relatedTarget){if(Kt){t:{try{Ut(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,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!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:Ke[t.pointerType]||"",(this.a=t).defaultPrevented&&this.preventDefault()}}We.prototype.preventDefault=function(){this.defaultPrevented=!0},b(He,We);var Ke=je({2:"touch",3:"pen",4:"mouse"});He.prototype.preventDefault=function(){He.Za.preventDefault.call(this);var t=this.a;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,Ve)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}},He.prototype.f=function(){return this.a};var Ge="closure_listenable_"+(1e6*Math.random()|0),ze=0;function Qe(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.Ta=i,this.key=++ze,this.ua=this.Na=!1}function Ye(t){t.ua=!0,t.listener=null,t.proxy=null,t.src=null,t.Ta=null}function Je(t){this.src=t,this.a={},this.b=0}function Xe(t,e){var n=e.type;n in t.a&&W(t.a[n],e)&&(Ye(e),0==t.a[n].length&&(delete t.a[n],t.b--))}function $e(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.ua&&o.listener==e&&o.capture==!!n&&o.Ta==r)return i}return-1}Je.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=$e(t,e,r,i);return-1<s?(e=t[s],n||(e.Na=!1)):((e=new Qe(e,this.src,o,!!r,i)).Na=n,t.push(e)),e};var Ze="closure_lm_"+(1e6*Math.random()|0),tn={};function en(t,e,n,r,i){if(r&&r.once)rn(t,e,n,r,i);else if(Array.isArray(e))for(var o=0;o<e.length;o++)en(t,e[o],n,r,i);else n=pn(n),t&&t[Ge]?vn(t,e,n,v(r)?!!r.capture:!!r,i):nn(t,e,n,!1,r,i)}function nn(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s=v(i)?!!i.capture:!!i,a=ln(t);if(a||(t[Ze]=a=new Je(t)),!(n=a.add(e,n,r,s,o)).proxy)if(r=function(){var e=hn,n=qe?function(t){return e.call(n.src,n.listener,t)}:function(t){if(!(t=e.call(n.src,n.listener,t)))return t};return n}(),(n.proxy=r).src=t,r.listener=n,t.addEventListener)Be||(i=s),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(an(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}}function rn(t,e,n,r,i){if(Array.isArray(e))for(var o=0;o<e.length;o++)rn(t,e[o],n,r,i);else n=pn(n),t&&t[Ge]?yn(t,e,n,v(r)?!!r.capture:!!r,i):nn(t,e,n,!0,r,i)}function on(t,e,n,r,i){if(Array.isArray(e))for(var o=0;o<e.length;o++)on(t,e[o],n,r,i);else r=v(r)?!!r.capture:!!r,n=pn(n),t&&t[Ge]?(t=t.u,(e=String(e).toString())in t.a&&(-1<(n=$e(o=t.a[e],n,r,i))&&(Ye(o[n]),Array.prototype.splice.call(o,n,1),0==o.length&&(delete t.a[e],t.b--)))):(t=t&&ln(t))&&(e=t.a[e.toString()],t=-1,e&&(t=$e(e,n,r,i)),(n=-1<t?e[t]:null)&&sn(n))}function sn(t){if("number"!=typeof t&&t&&!t.ua){var e=t.src;if(e&&e[Ge])Xe(e.u,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(an(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=ln(e))?(Xe(n,t),0==n.b&&(n.src=null,e[Ze]=null)):Ye(t)}}}function an(t){return t in tn?tn[t]:tn[t]="on"+t}function un(t,e,n,r){var i=!0;if((t=ln(t))&&(e=t.a[e.toString()]))for(e=e.concat(),t=0;t<e.length;t++){var o=e[t];o&&o.capture==n&&!o.ua&&(o=cn(o,r),i=i&&!1!==o)}return i}function cn(t,e){var n=t.listener,r=t.Ta||t.src;return t.Na&&sn(t),n.call(r,e)}function hn(t,e){if(t.ua)return!0;if(qe)return cn(t,new He(e,this));if(!e)t:{e=["window","event"];for(var n=l,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}if(e=new He(r=e,this),n=!0,!(r.keyCode<0||null!=r.returnValue)){t:{var i=!1;if(0==r.keyCode)try{r.keyCode=-1;break t}catch(t){i=!0}!i&&null!=r.returnValue||(r.returnValue=!0)}for(r=[],i=e.b;i;i=i.parentNode)r.push(i);for(t=t.type,i=r.length-1;0<=i;i--){e.b=r[i];var o=un(r[i],t,!0,e);n=n&&o}for(i=0;i<r.length;i++)e.b=r[i],o=un(r[i],t,!1,e),n=n&&o}return n}function ln(t){return(t=t[Ze])instanceof Je?t:null}var fn="__closure_events_fn_"+(1e9*Math.random()>>>0);function pn(e){return d(e)?e:(e[fn]||(e[fn]=function(t){return e.handleEvent(t)}),e[fn])}function dn(){Me.call(this),this.u=new Je(this),(this.Yb=this).eb=null}function vn(t,e,n,r,i){t.u.add(String(e),n,!1,r,i)}function yn(t,e,n,r,i){t.u.add(String(e),n,!0,r,i)}function gn(t,e,n,r){if(!(e=t.u.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var s=e[o];if(s&&!s.ua&&s.capture==n){var a=s.listener,u=s.Ta||s.src;s.Na&&Xe(t.u,s),i=!1!==a.call(u,r)&&i}}return i&&!r.defaultPrevented}function mn(t,e,n){if(d(t))n&&(t=g(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=g(t.handleEvent,t)}return 2147483647<Number(e)?-1:l.setTimeout(t,e||0)}function wn(n){var r=null;return new ve(function(t,e){-1==(r=mn(function(){t(void 0)},n))&&e(Error("Failed to schedule timer."))}).o(function(t){throw l.clearTimeout(r),t})}function bn(t){if(t.V&&"function"==typeof t.V)return t.V();if("string"==typeof t)return t.split("");if(p(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}function _n(t){if(t.X&&"function"==typeof t.X)return t.X();if(!t.V||"function"!=typeof t.V){if(p(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}function En(t,e){this.b={},this.a=[],this.c=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof En)for(n=t.X(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function In(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];Tn(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){var i={};for(n=e=0;e<t.a.length;)Tn(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function Tn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}b(dn,Me),dn.prototype[Ge]=!0,dn.prototype.addEventListener=function(t,e,n,r){en(this,t,e,n,r)},dn.prototype.removeEventListener=function(t,e,n,r){on(this,t,e,n,r)},dn.prototype.dispatchEvent=function(t){var e,n=this.eb;if(n)for(e=[];n;n=n.eb)e.push(n);n=this.Yb;var r=t.type||t;if("string"==typeof t)t=new We(t,n);else if(t instanceof We)t.target=t.target||n;else{var i=t;lt(t=new We(r,n),i)}if(i=!0,e)for(var o=e.length-1;0<=o;o--){var s=t.b=e[o];i=gn(s,r,!0,t)&&i}if(i=gn(s=t.b=n,r,!0,t)&&i,i=gn(s,r,!1,t)&&i,e)for(o=0;o<e.length;o++)i=gn(s=t.b=e[o],r,!1,t)&&i;return i},dn.prototype.Ba=function(){if(dn.Za.Ba.call(this),this.u){var t,e=this.u;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)Ye(n[r]);delete e.a[t],e.b--}}this.eb=null},(t=En.prototype).V=function(){In(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},t.X=function(){return In(this),this.a.concat()},t.clear=function(){this.b={},this.c=this.a.length=0},t.get=function(t,e){return Tn(this.b,t)?this.b[t]:e},t.set=function(t,e){Tn(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},t.forEach=function(t,e){for(var n=this.X(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var Sn=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/\\#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Cn(t,e){var n;this.b=this.i=this.f="",this.l=null,this.g=this.c="",this.h=!1,t instanceof Cn?(this.h=void 0!==e?e:t.h,Nn(this,t.f),this.i=t.i,this.b=t.b,An(this,t.l),this.c=t.c,kn(this,Qn(t.a)),this.g=t.g):t&&(n=String(t).match(Sn))?(this.h=!!e,Nn(this,n[1]||"",!0),this.i=xn(n[2]||""),this.b=xn(n[3]||"",!0),An(this,n[4]),this.c=xn(n[5]||"",!0),kn(this,n[6]||"",!0),this.g=xn(n[7]||"")):(this.h=!!e,this.a=new Bn(null,this.h))}function Nn(t,e,n){t.f=n?xn(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function An(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.l=e}else t.l=null}function kn(t,e,n){e instanceof Bn?(t.a=e,function(t,e){e&&!t.f&&(Wn(t),t.c=null,t.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Kn(this,e),zn(this,n,t))},t)),t.f=e}(t.a,t.h)):(n||(e=Ln(e,qn)),t.a=new Bn(e,t.h))}function Rn(t,e,n){t.a.set(e,n)}function On(t,e){return t.a.get(e)}function Dn(t){return t instanceof Cn?new Cn(t):new Cn(t,void 0)}function Pn(t,e){var n=new Cn(null,void 0);return Nn(n,"https"),t&&(n.b=t),e&&(n.c=e),n}function xn(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Ln(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Mn),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Mn(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Cn.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Ln(e,Fn,!0),":");var n=this.b;return!n&&"file"!=e||(t.push("//"),(e=this.i)&&t.push(Ln(e,Fn,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.l)&&t.push(":",String(n))),(n=this.c)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(Ln(n,"/"==n.charAt(0)?jn:Un,!0))),(n=this.a.toString())&&t.push("?",n),(n=this.g)&&t.push("#",Ln(n,Vn)),t.join("")},Cn.prototype.resolve=function(t){var e=new Cn(this),n=!!t.f;n?Nn(e,t.f):n=!!t.i,n?e.i=t.i:n=!!t.b,n?e.b=t.b:n=null!=t.l;var r=t.c;if(n)An(e,t.l);else if(n=!!t.c){if("/"!=r.charAt(0))if(this.b&&!this.c)r="/"+r;else{var i=e.c.lastIndexOf("/");-1!=i&&(r=e.c.substr(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(nt(i,"./")||nt(i,"/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var o=[],s=0;s<i.length;){var a=i[s++];"."==a?r&&s==i.length&&o.push(""):".."==a?((1<o.length||1==o.length&&""!=o[0])&&o.pop(),r&&s==i.length&&o.push("")):(o.push(a),r=!0)}r=o.join("/")}else r=i}return n?e.c=r:n=""!==t.a.toString(),n?kn(e,Qn(t.a)):n=!!t.g,n&&(e.g=t.g),e};var Fn=/[#\/\?@]/g,Un=/[#\?:]/g,jn=/[#\?]/g,qn=/[#\?@]/g,Vn=/#/g;function Bn(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Wn(n){n.a||(n.a=new En,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var o=t[n].substring(0,r);i=t[n].substring(r+1)}else o=t[n];e(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(n.c,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function Hn(t){var e=_n(t);if(void 0===e)throw Error("Keys are undefined");var n=new Bn(null,void 0);t=bn(t);for(var r=0;r<e.length;r++){var i=e[r],o=t[r];Array.isArray(o)?zn(n,i,o):n.add(i,o)}return n}function Kn(t,e){Wn(t),e=Yn(t,e),Tn(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,Tn((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&In(t)))}function Gn(t,e){return Wn(t),e=Yn(t,e),Tn(t.a.b,e)}function zn(t,e,n){Kn(t,e),0<n.length&&(t.c=null,t.a.set(Yn(t,e),G(n)),t.b+=n.length)}function Qn(t){var e=new Bn;return e.c=t.c,t.a&&(e.a=new En(t.a),e.b=t.b),e}function Yn(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function Jn(t){var e=[];return function t(e,n,r){if(null==n)r.push("null");else{if("object"==typeof n){if(Array.isArray(n)){var i=n;n=i.length,r.push("[");for(var o="",s=0;s<n;s++)r.push(o),t(e,i[s],r),o=",";return void r.push("]")}if(!(n instanceof String||n instanceof Number||n instanceof Boolean)){for(i in r.push("{"),o="",n)Object.prototype.hasOwnProperty.call(n,i)&&("function"!=typeof(s=n[i])&&(r.push(o),tr(i,r),r.push(":"),t(e,s,r),o=","));return void r.push("}")}n=n.valueOf()}switch(typeof n){case"string":tr(n,r);break;case"number":r.push(isFinite(n)&&!isNaN(n)?String(n):"null");break;case"boolean":r.push(String(n));break;case"function":r.push("null");break;default:throw Error("Unknown type: "+typeof n)}}}(new Xn,t,e),e.join("")}function Xn(){}(t=Bn.prototype).add=function(t,e){Wn(this),this.c=null,t=Yn(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},t.clear=function(){this.a=this.c=null,this.b=0},t.forEach=function(n,r){Wn(this),this.a.forEach(function(t,e){U(t,function(t){n.call(r,t,e,this)},this)},this)},t.X=function(){Wn(this);for(var t=this.a.V(),e=this.a.X(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},t.V=function(t){Wn(this);var e=[];if("string"==typeof t)Gn(this,t)&&(e=K(e,this.a.get(Yn(this,t))));else{t=this.a.V();for(var n=0;n<t.length;n++)e=K(e,t[n])}return e},t.set=function(t,e){return Wn(this),this.c=null,Gn(this,t=Yn(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},t.get=function(t,e){return t&&0<(t=this.V(t)).length?String(t[0]):e},t.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.X(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.V(r);for(var o=0;o<r.length;o++){var s=i;""!==r[o]&&(s+="="+encodeURIComponent(String(r[o]))),t.push(s)}}return this.c=t.join("&")};var $n={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},Zn=/\uffff/.test("￿")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g;function tr(t,e){e.push('"',t.replace(Zn,function(t){var e=$n[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),$n[t]=e),e}),'"')}function er(){var t=br();return Bt&&!!Xt&&11==Xt||/Edge\/\d+/.test(t)}function nr(){return l.window&&l.window.location.href||self&&self.location&&self.location.href||""}function rr(t,e){e=e||l.window;var n="about:blank";t&&(n=Ct(At(t))),e.location.href=n}function ir(t){return!!((t=(t||br()).toLowerCase()).match(/android/)||t.match(/webos/)||t.match(/iphone|ipad|ipod/)||t.match(/blackberry/)||t.match(/windows phone/)||t.match(/iemobile/))}function or(t){t=t||l.window;try{t.close()}catch(t){}}function sr(t,e,n){var r=Math.floor(1e9*Math.random()).toString();e=e||500,n=n||600;var i=(window.screen.availHeight-n)/2,o=(window.screen.availWidth-e)/2;for(s in e={width:e,height:n,top:0<i?i:0,left:0<o?o:0,location:!0,resizable:!0,statusbar:!0,toolbar:!1},n=br().toLowerCase(),r&&(e.target=r,nt(n,"crios/")&&(e.target="_blank")),gr(br())==vr&&(t=t||"http://localhost",e.scrollbars=!0),n=t||"",(t=e)||(t={}),r=window,e=n instanceof St?n:At(void 0!==n.href?n.href:String(n)),n=t.target||n.target,i=[],t)switch(s){case"width":case"height":case"top":case"left":i.push(s+"="+t[s]);break;case"target":case"noopener":case"noreferrer":break;default:i.push(s+"="+(t[s]?1:0))}var s=i.join(",");if((st("iPhone")&&!st("iPod")&&!st("iPad")||st("iPad")||st("iPod"))&&r.navigator&&r.navigator.standalone&&n&&"_self"!=n?(ft(s=ae(document,"A"),"HTMLAnchorElement"),e instanceof St||e instanceof St||(e="object"==typeof e&&e.ra?e.qa():String(e),Nt.test(e)||(e="about:invalid#zClosurez"),e=new St(Rt,e)),s.href=Ct(e),s.setAttribute("target",n),t.noreferrer&&s.setAttribute("rel","noreferrer"),(t=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,r,1),s.dispatchEvent(t),s={}):t.noreferrer?(s=r.open("",n,s),t=Ct(e),s&&(Ht&&nt(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),s.opener=null,t=xt('<meta name="referrer" content="no-referrer"><meta http-equiv="refresh" content="0; url='+Ft(t)+'">'),r=s.document)&&(r.write(Dt(t)),r.close())):(s=r.open(Ct(e),n,s))&&t.noopener&&(s.opener=null),s)try{s.focus()}catch(t){}return s}var ar=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ur=/^[^@]+@[^@]+$/;function cr(){var e=null;return new ve(function(t){"complete"==l.document.readyState?t():(e=function(){t()},rn(window,"load",e))}).o(function(t){throw on(window,"load",e),t})}function hr(t){return t=t||br(),!("file:"!==Sr()&&"ionic:"!==Sr()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function lr(){var t=l.window;try{return!(!t||t==t.top)}catch(t){return!1}}function fr(){return void 0!==l.WorkerGlobalScope&&"function"==typeof l.importScripts}function pr(){return Kl.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":Kl.INTERNAL.hasOwnProperty("node")?"Node":fr()?"Worker":"Browser"}function dr(){var t=pr();return"ReactNative"===t||"Node"===t}var vr="Firefox",yr="Chrome";function gr(t){var e=t.toLowerCase();return nt(e,"opera/")||nt(e,"opr/")||nt(e,"opios/")?"Opera":nt(e,"iemobile")?"IEMobile":nt(e,"msie")||nt(e,"trident/")?"IE":nt(e,"edge/")?"Edge":nt(e,"firefox/")?vr:nt(e,"silk/")?"Silk":nt(e,"blackberry")?"Blackberry":nt(e,"webos")?"Webos":!nt(e,"safari/")||nt(e,"chrome/")||nt(e,"crios/")||nt(e,"android")?!nt(e,"chrome/")&&!nt(e,"crios/")||nt(e,"edge/")?nt(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":yr:"Safari"}var mr={jd:"FirebaseCore-web",ld:"FirebaseUI-web"};function wr(t,e){e=e||[];var n,r=[],i={};for(n in mr)i[mr[n]]=!0;for(n=0;n<e.length;n++)void 0!==i[e[n]]&&(delete i[e[n]],r.push(e[n]));return r.sort(),(e=r).length||(e=["FirebaseCore-web"]),"Browser"===(r=pr())?r=gr(i=br()):"Worker"===r&&(r=gr(i=br())+"-"+r),r+"/JsCore/"+t+"/"+e.join(",")}function br(){return l.navigator&&l.navigator.userAgent||""}function _r(t,e){t=t.split("."),e=e||l;for(var n=0;n<t.length&&"object"==typeof e&&null!=e;n++)e=e[t[n]];return n!=t.length&&(e=void 0),e}function Er(){try{var t=l.localStorage,e=Rr();if(t)return t.setItem(e,"1"),t.removeItem(e),!er()||!!l.indexedDB}catch(t){return fr()&&!!l.indexedDB}return!1}function Ir(){return(Tr()||"chrome-extension:"===Sr()||hr())&&!dr()&&Er()&&!fr()}function Tr(){return"http:"===Sr()||"https:"===Sr()}function Sr(){return l.location&&l.location.protocol||null}function Cr(t){return!ir(t=t||br())&&gr(t)!=vr}function Nr(t){return void 0===t?null:Jn(t)}function Ar(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&null!==t[e]&&void 0!==t[e]&&(n[e]=t[e]);return n}function kr(t){if(null!==t)return JSON.parse(t)}function Rr(t){return t||Math.floor(1e9*Math.random()).toString()}function Or(t){return"Safari"!=gr(t=t||br())&&!t.toLowerCase().match(/iphone|ipad|ipod/)}function Dr(){var t=l.___jsl;if(t&&t.H)for(var e in t.H)if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=t.H[e].L.concat(),t.CP)for(var n=0;n<t.CP.length;n++)t.CP[n]=null}function Pr(t,e){if(e<t)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=br(),e=pr(),this.b=ir(t)||"ReactNative"===e}function xr(){var t=l.document;return!t||void 0===t.visibilityState||"visible"==t.visibilityState}function Lr(t){try{var e=new Date(parseInt(t,10));if(!isNaN(e.getTime())&&!/[^0-9]/.test(t))return e.toUTCString()}catch(t){}return null}function Mr(){return!(!_r("fireauth.oauthhelper",l)&&!_r("fireauth.iframe",l))}Pr.prototype.get=function(){var t=l.navigator;return!t||"boolean"!=typeof t.onLine||!Tr()&&"chrome-extension:"!==Sr()&&void 0===t.connection||t.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var Fr,Ur={};function jr(t){Ur[t]||(Ur[t]=!0,"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(t))}try{var qr={};Object.defineProperty(qr,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(qr,"abcd",{configurable:!0,enumerable:!0,value:2}),Fr=2==qr.abcd}catch(t){Fr=!1}function Vr(t,e,n){Fr?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function Br(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&Vr(t,n,e[n])}function Wr(t){var e={};return Br(e,t),e}function Hr(t){var e=t;if("object"==typeof t&&null!=t)for(var n in e="length"in t?[]:{},t)Vr(e,n,Hr(t[n]));return e}function Kr(t){var e=t&&(t[Jr]?"phone":null);if(!(e&&t&&t[Yr]))throw new _("internal-error","Internal assert: invalid MultiFactorInfo object");Vr(this,"uid",t[Yr]),Vr(this,"displayName",t[zr]||null);var n=null;t[Qr]&&(n=new Date(t[Qr]).toUTCString()),Vr(this,"enrollmentTime",n),Vr(this,"factorId",e)}function Gr(t){try{var e=new Xr(t)}catch(t){e=null}return e}Kr.prototype.v=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};var zr="displayName",Qr="enrolledAt",Yr="mfaEnrollmentId",Jr="phoneInfo";function Xr(t){Kr.call(this,t),Vr(this,"phoneNumber",t[Jr])}function $r(t){var e={},n=t[ni],r=t[ii],i=t[oi];if(t=Gr(t[ri]),!i||i!=ti&&i!=ei&&!n||i==ei&&!r||i==Zr&&!t)throw Error("Invalid checkActionCode response!");i==ei?(e[ai]=n||null,e[ci]=n||null,e[si]=r):(e[ai]=r||null,e[ci]=r||null,e[si]=n||null),e[ui]=t||null,Vr(this,li,i),Vr(this,hi,Hr(e))}b(Xr,Kr),Xr.prototype.v=function(){var t=Xr.Za.v.call(this);return t.phoneNumber=this.phoneNumber,t};var Zr="REVERT_SECOND_FACTOR_ADDITION",ti="EMAIL_SIGNIN",ei="VERIFY_AND_CHANGE_EMAIL",ni="email",ri="mfaInfo",ii="newEmail",oi="requestType",si="email",ai="fromEmail",ui="multiFactorInfo",ci="previousEmail",hi="data",li="operation";function fi(t){var e=On(t=Dn(t),pi)||null,n=On(t,di)||null,r=On(t,gi)||null;if(r=r&&wi[r]||null,!e||!n||!r)throw new _("argument-error",pi+", "+di+"and "+gi+" are required in a valid action code URL.");Br(this,{apiKey:e,operation:r,code:n,continueUrl:On(t,vi)||null,languageCode:On(t,yi)||null,tenantId:On(t,mi)||null})}var pi="apiKey",di="oobCode",vi="continueUrl",yi="languageCode",gi="mode",mi="tenantId",wi={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:Zr,signIn:ti,verifyAndChangeEmail:ei,verifyEmail:"VERIFY_EMAIL"};function bi(t){try{return new fi(t)}catch(t){return null}}function _i(t){var e=t[Ci];if(void 0===e)throw new _("missing-continue-uri");if("string"!=typeof e||"string"==typeof e&&!e.length)throw new _("invalid-continue-uri");this.h=e,this.b=this.a=null,this.g=!1;var n=t[Ei];if(n&&"object"==typeof n){e=n[ki];var r=n[Ni];if(n=n[Ai],"string"==typeof e&&e.length){if(this.a=e,void 0!==r&&"boolean"!=typeof r)throw new _("argument-error",Ni+" property must be a boolean when specified.");if(this.g=!!r,void 0!==n&&("string"!=typeof n||"string"==typeof n&&!n.length))throw new _("argument-error",Ai+" property must be a non empty string when specified.");this.b=n||null}else{if(void 0!==e)throw new _("argument-error",ki+" property must be a non empty string when specified.");if(void 0!==r||void 0!==n)throw new _("missing-android-pkg-name")}}else if(void 0!==n)throw new _("argument-error",Ei+" property must be a non null object when specified.");if(this.f=null,(e=t[Si])&&"object"==typeof e){if("string"==typeof(e=e[Ri])&&e.length)this.f=e;else if(void 0!==e)throw new _("argument-error",Ri+" property must be a non empty string when specified.")}else if(void 0!==e)throw new _("argument-error",Si+" property must be a non null object when specified.");if(void 0!==(e=t[Ti])&&"boolean"!=typeof e)throw new _("argument-error",Ti+" property must be a boolean when specified.");if(this.c=!!e,void 0!==(t=t[Ii])&&("string"!=typeof t||"string"==typeof t&&!t.length))throw new _("argument-error",Ii+" property must be a non empty string when specified.");this.i=t||null}var Ei="android",Ii="dynamicLinkDomain",Ti="handleCodeInApp",Si="iOS",Ci="url",Ni="installApp",Ai="minimumVersion",ki="packageName",Ri="bundleId";function Oi(t){var e={};for(var n in e.continueUrl=t.h,e.canHandleCodeInApp=t.c,(e.androidPackageName=t.a)&&(e.androidMinimumVersion=t.b,e.androidInstallApp=t.g),e.iOSBundleId=t.f,e.dynamicLinkDomain=t.i,e)null===e[n]&&delete e[n];return e}var Di=null;function Pi(t){var e="";return function(r,t){function e(t){for(;i<r.length;){var e=r.charAt(i++),n=Di[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return t}!function(){if(!Di){Di={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;n<5;n++)for(var r=t.concat(e[n].split("")),i=0;i<r.length;i++){var o=r[i];void 0===Di[o]&&(Di[o]=i)}}}();for(var i=0;;){var n=e(-1),o=e(0),s=e(64),a=e(64);if(64===a&&-1===n)break;t(n<<2|o>>4),64!=s&&(t(o<<4&240|s>>2),64!=a&&t(s<<6&192|a))}}(t,function(t){e+=String.fromCharCode(t)}),e}function xi(t){var e=Mi(t);if(!(e&&e.sub&&e.iss&&e.aud&&e.exp))throw Error("Invalid JWT");this.g=t,this.c=e.exp,this.h=e.sub,this.a=e.provider_id||e.firebase&&e.firebase.sign_in_provider||null,this.f=e.firebase&&e.firebase.tenant||null,this.b=!!e.is_anonymous||"anonymous"==this.a}function Li(t){try{return new xi(t)}catch(t){return null}}function Mi(t){if(!t)return null;if(3!=(t=t.split(".")).length)return null;for(var e=(4-(t=t[1]).length%4)%4,n=0;n<e;n++)t+=".";try{return JSON.parse(Pi(t))}catch(t){}return null}xi.prototype.S=function(){return this.f},xi.prototype.i=function(){return this.b},xi.prototype.toString=function(){return this.g};var Fi="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),Ui=["client_id","response_type","scope","redirect_uri","state"],ji={kd:{Ha:"locale",ta:700,sa:600,ea:"facebook.com",Va:Ui},md:{Ha:null,ta:500,sa:750,ea:"github.com",Va:Ui},nd:{Ha:"hl",ta:515,sa:680,ea:"google.com",Va:Ui},td:{Ha:"lang",ta:485,sa:705,ea:"twitter.com",Va:Fi},gd:{Ha:"locale",ta:600,sa:600,ea:"apple.com",Va:[]}};function qi(t){for(var e in ji)if(ji[e].ea==t)return ji[e];return null}function Vi(t){var e={};e["facebook.com"]=Gi,e["google.com"]=Qi,e["github.com"]=zi,e["twitter.com"]=Yi;var n=t&&t[Wi];try{if(n)return e[n]?new e[n](t):new Ki(t);if(void 0!==t[Bi])return new Hi(t)}catch(t){}return null}var Bi="idToken",Wi="providerId";function Hi(t){var e=t[Wi];if(!e&&t[Bi]){var n=Li(t[Bi]);n&&n.a&&(e=n.a)}if(!e)throw Error("Invalid additional user info!");"anonymous"!=e&&"custom"!=e||(e=null),n=!1,void 0!==t.isNewUser?n=!!t.isNewUser:"identitytoolkit#SignupNewUserResponse"===t.kind&&(n=!0),Vr(this,"providerId",e),Vr(this,"isNewUser",n)}function Ki(t){Hi.call(this,t),Vr(this,"profile",Hr((t=kr(t.rawUserInfo||"{}"))||{}))}function Gi(t){if(Ki.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function zi(t){if(Ki.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");Vr(this,"username",this.profile&&this.profile.login||null)}function Qi(t){if(Ki.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function Yi(t){if(Ki.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");Vr(this,"username",t.screenName||null)}function Ji(t){var e=Dn(t),n=On(e,"link"),r=On(Dn(n),"link");return On(Dn(e=On(e,"deep_link_id")),"link")||e||r||n||t}function Xi(t,e){if(!t&&!e)throw new _("internal-error","Internal assert: no raw session string available");if(t&&e)throw new _("internal-error","Internal assert: unable to determine the session type");this.a=t||null,this.b=e||null,this.type=this.a?$i:Zi}b(Ki,Hi),b(Gi,Ki),b(zi,Ki),b(Qi,Ki),b(Yi,Ki);var $i="enroll",Zi="signin";function to(){}function eo(t,n){return t.then(function(t){if(t[Hs]){var e=Li(t[Hs]);if(!e||n!=e.h)throw new _("user-mismatch");return t}throw new _("user-mismatch")}).o(function(t){throw t&&t.code&&t.code==T+"user-not-found"?new _("user-mismatch"):t})}function no(t,e){if(!e)throw new _("internal-error","failed to construct a credential");this.a=e,Vr(this,"providerId",t),Vr(this,"signInMethod",t)}function ro(t){return{pendingToken:t.a,requestUri:"http://localhost"}}function io(t){if(t&&t.providerId&&t.signInMethod&&0==t.providerId.indexOf("saml.")&&t.pendingToken)try{return new no(t.providerId,t.pendingToken)}catch(t){}return null}function oo(t,e,n){if(this.a=null,e.idToken||e.accessToken)e.idToken&&Vr(this,"idToken",e.idToken),e.accessToken&&Vr(this,"accessToken",e.accessToken),e.nonce&&!e.pendingToken&&Vr(this,"nonce",e.nonce),e.pendingToken&&(this.a=e.pendingToken);else{if(!e.oauthToken||!e.oauthTokenSecret)throw new _("internal-error","failed to construct a credential");Vr(this,"accessToken",e.oauthToken),Vr(this,"secret",e.oauthTokenSecret)}Vr(this,"providerId",t),Vr(this,"signInMethod",n)}function so(t){var e={};return t.idToken&&(e.id_token=t.idToken),t.accessToken&&(e.access_token=t.accessToken),t.secret&&(e.oauth_token_secret=t.secret),e.providerId=t.providerId,t.nonce&&!t.a&&(e.nonce=t.nonce),e={postBody:Hn(e).toString(),requestUri:"http://localhost"},t.a&&(delete e.postBody,e.pendingToken=t.a),e}function ao(t){if(t&&t.providerId&&t.signInMethod){var e={idToken:t.oauthIdToken,accessToken:t.oauthTokenSecret?null:t.oauthAccessToken,oauthTokenSecret:t.oauthTokenSecret,oauthToken:t.oauthTokenSecret&&t.oauthAccessToken,nonce:t.nonce,pendingToken:t.pendingToken};try{return new oo(t.providerId,e,t.signInMethod)}catch(t){}}return null}function uo(t,e){this.Oc=e||[],Br(this,{providerId:t,isOAuthProvider:!0}),this.Fb={},this.lb=(qi(t)||{}).Ha||null,this.kb=null}function co(t){if("string"!=typeof t||0!=t.indexOf("saml."))throw new _("argument-error",'SAML provider IDs must be prefixed with "saml."');uo.call(this,t,[])}function ho(t){uo.call(this,t,Ui),this.a=[]}function lo(){ho.call(this,"facebook.com")}function fo(t){if(!t)throw new _("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return v(t)&&(e=t.accessToken),(new lo).credential({accessToken:e})}function po(){ho.call(this,"github.com")}function vo(t){if(!t)throw new _("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return v(t)&&(e=t.accessToken),(new po).credential({accessToken:e})}function yo(){ho.call(this,"google.com"),this.Aa("profile")}function go(t,e){var n=t;return v(t)&&(n=t.idToken,e=t.accessToken),(new yo).credential({idToken:n,accessToken:e})}function mo(){uo.call(this,"twitter.com",Fi)}function wo(t,e){var n=t;if(v(n)||(n={oauthToken:t,oauthTokenSecret:e}),!n.oauthToken||!n.oauthTokenSecret)throw new _("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new oo("twitter.com",n,"twitter.com")}function bo(t,e,n){this.a=t,this.f=e,Vr(this,"providerId","password"),Vr(this,"signInMethod",n===Eo.EMAIL_LINK_SIGN_IN_METHOD?Eo.EMAIL_LINK_SIGN_IN_METHOD:Eo.EMAIL_PASSWORD_SIGN_IN_METHOD)}function _o(t){return t&&t.email&&t.password?new bo(t.email,t.password,t.signInMethod):null}function Eo(){Br(this,{providerId:"password",isOAuthProvider:!1})}function Io(t,e){if(!(e=To(e)))throw new _("argument-error","Invalid email link!");return new bo(t,e.code,Eo.EMAIL_LINK_SIGN_IN_METHOD)}function To(t){return(t=bi(t=Ji(t)))&&t.operation===ti?t:null}function So(t){if(!(t.bb&&t.ab||t.Ja&&t.da))throw new _("internal-error");this.a=t,Vr(this,"providerId","phone"),this.ea="phone",Vr(this,"signInMethod","phone")}function Co(e){if(e&&"phone"===e.providerId&&(e.verificationId&&e.verificationCode||e.temporaryProof&&e.phoneNumber)){var n={};return U(["verificationId","verificationCode","temporaryProof","phoneNumber"],function(t){e[t]&&(n[t]=e[t])}),new So(n)}return null}function No(t){return t.a.Ja&&t.a.da?{temporaryProof:t.a.Ja,phoneNumber:t.a.da}:{sessionInfo:t.a.bb,code:t.a.ab}}function Ao(t){try{this.a=t||Kl.auth()}catch(t){throw new _("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}Br(this,{providerId:"phone",isOAuthProvider:!1})}function ko(t,e){if(!t)throw new _("missing-verification-id");if(!e)throw new _("missing-verification-code");return new So({bb:t,ab:e})}function Ro(t){if(t.temporaryProof&&t.phoneNumber)return new So({Ja:t.temporaryProof,da:t.phoneNumber});var e=t&&t.providerId;if(!e||"password"===e)return null;var n=t&&t.oauthAccessToken,r=t&&t.oauthTokenSecret,i=t&&t.nonce,o=t&&t.oauthIdToken,s=t&&t.pendingToken;try{switch(e){case"google.com":return go(o,n);case"facebook.com":return fo(n);case"github.com":return vo(n);case"twitter.com":return wo(n,r);default:return n||r||o||s?s?0==e.indexOf("saml.")?new no(e,s):new oo(e,{pendingToken:s,idToken:t.oauthIdToken,accessToken:t.oauthAccessToken},e):new ho(e).credential({idToken:o,accessToken:n,rawNonce:i}):null}}catch(t){return null}}function Oo(t){if(!t.isOAuthProvider)throw new _("invalid-oauth-provider")}function Do(t,e,n,r,i,o,s){if(this.c=t,this.b=e||null,this.g=n||null,this.f=r||null,this.i=o||null,this.h=s||null,this.a=i||null,!this.g&&!this.a)throw new _("invalid-auth-event");if(this.g&&this.a)throw new _("invalid-auth-event");if(this.g&&!this.f)throw new _("invalid-auth-event")}function Po(t){return(t=t||{}).type?new Do(t.type,t.eventId,t.urlResponse,t.sessionId,t.error&&E(t.error),t.postBody,t.tenantId):null}function xo(){this.b=null,this.a=[]}Xi.prototype.Fa=function(){return this.a?Ee(this.a):Ee(this.b)},Xi.prototype.v=function(){return this.type==$i?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}},to.prototype.ia=function(){},to.prototype.b=function(){},to.prototype.c=function(){},to.prototype.v=function(){},no.prototype.ia=function(t){return ha(t,ro(this))},no.prototype.b=function(t,e){var n=ro(this);return n.idToken=e,la(t,n)},no.prototype.c=function(t,e){return eo(fa(t,ro(this)),e)},no.prototype.v=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}},oo.prototype.ia=function(t){return ha(t,so(this))},oo.prototype.b=function(t,e){var n=so(this);return n.idToken=e,la(t,n)},oo.prototype.c=function(t,e){return eo(fa(t,so(this)),e)},oo.prototype.v=function(){var t={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(t.oauthIdToken=this.idToken),this.accessToken&&(t.oauthAccessToken=this.accessToken),this.secret&&(t.oauthTokenSecret=this.secret),this.nonce&&(t.nonce=this.nonce),this.a&&(t.pendingToken=this.a),t},uo.prototype.Ia=function(t){return this.Fb=ct(t),this},b(co,uo),b(ho,uo),ho.prototype.Aa=function(t){return B(this.a,t)||this.a.push(t),this},ho.prototype.Nb=function(){return G(this.a)},ho.prototype.credential=function(t,e){var n;if(!(n=v(t)?{idToken:t.idToken||null,accessToken:t.accessToken||null,nonce:t.rawNonce||null}:{idToken:t||null,accessToken:e||null}).idToken&&!n.accessToken)throw new _("argument-error","credential failed: must provide the ID token and/or the access token.");return new oo(this.providerId,n,this.providerId)},b(lo,ho),Vr(lo,"PROVIDER_ID","facebook.com"),Vr(lo,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),b(po,ho),Vr(po,"PROVIDER_ID","github.com"),Vr(po,"GITHUB_SIGN_IN_METHOD","github.com"),b(yo,ho),Vr(yo,"PROVIDER_ID","google.com"),Vr(yo,"GOOGLE_SIGN_IN_METHOD","google.com"),b(mo,uo),Vr(mo,"PROVIDER_ID","twitter.com"),Vr(mo,"TWITTER_SIGN_IN_METHOD","twitter.com"),bo.prototype.ia=function(t){return this.signInMethod==Eo.EMAIL_LINK_SIGN_IN_METHOD?za(t,ba,{email:this.a,oobCode:this.f}):za(t,Ba,{email:this.a,password:this.f})},bo.prototype.b=function(t,e){return this.signInMethod==Eo.EMAIL_LINK_SIGN_IN_METHOD?za(t,_a,{idToken:e,email:this.a,oobCode:this.f}):za(t,xa,{idToken:e,email:this.a,password:this.f})},bo.prototype.c=function(t,e){return eo(this.ia(t),e)},bo.prototype.v=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}},Br(Eo,{PROVIDER_ID:"password"}),Br(Eo,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),Br(Eo,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),So.prototype.ia=function(t){return t.cb(No(this))},So.prototype.b=function(t,e){var n=No(this);return n.idToken=e,za(t,Ha,n)},So.prototype.c=function(t,e){var n=No(this);return n.operation="REAUTH",eo(t=za(t,Ka,n),e)},So.prototype.v=function(){var t={providerId:"phone"};return this.a.bb&&(t.verificationId=this.a.bb),this.a.ab&&(t.verificationCode=this.a.ab),this.a.Ja&&(t.temporaryProof=this.a.Ja),this.a.da&&(t.phoneNumber=this.a.da),t},Ao.prototype.cb=function(r,i){var o=this.a.b;return Ee(i.verify()).then(function(e){if("string"!=typeof e)throw new _("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(i.type){case"recaptcha":var t=v(r)?r.session:null,n=v(r)?r.phoneNumber:r;return(t&&t.type==$i?t.Fa().then(function(t){return function(t,e){return za(t,Ma,e).then(function(t){return t.phoneSessionInfo.sessionInfo})}(o,{idToken:t,phoneEnrollmentInfo:{phoneNumber:n,recaptchaToken:e}})}):t&&t.type==Zi?t.Fa().then(function(t){return function(t,e){return za(t,Fa,e).then(function(t){return t.phoneResponseInfo.sessionInfo})}(o,{mfaPendingCredential:t,mfaEnrollmentId:r.multiFactorHint&&r.multiFactorHint.uid||r.multiFactorUid,phoneSignInInfo:{recaptchaToken:e}})}):function(t,e){return za(t,Da,e)}(o,{phoneNumber:n,recaptchaToken:e})).then(function(t){return"function"==typeof i.reset&&i.reset(),t},function(t){throw"function"==typeof i.reset&&i.reset(),t});default:throw new _("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}})},Br(Ao,{PROVIDER_ID:"phone"}),Br(Ao,{PHONE_SIGN_IN_METHOD:"phone"}),Do.prototype.getUid=function(){var t=[];return t.push(this.c),this.b&&t.push(this.b),this.f&&t.push(this.f),this.h&&t.push(this.h),t.join("-")},Do.prototype.S=function(){return this.h},Do.prototype.v=function(){return{type:this.c,eventId:this.b,urlResponse:this.g,sessionId:this.f,postBody:this.i,tenantId:this.h,error:this.a&&this.a.v()}};var Lo,Mo=null;function Fo(t){var e="unauthorized-domain",n=void 0,r=Dn(t);t=r.b,"chrome-extension"==(r=r.f)?n=Mt("This chrome extension ID (chrome-extension://%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):"http"==r||"https"==r?n=Mt("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):e="operation-not-supported-in-this-environment",_.call(this,e,n)}function Uo(t,e,n){_.call(this,t,n),(t=e||{}).Gb&&Vr(this,"email",t.Gb),t.da&&Vr(this,"phoneNumber",t.da),t.credential&&Vr(this,"credential",t.credential),t.Wb&&Vr(this,"tenantId",t.Wb)}function jo(t){if(t.code){var e=t.code||"";0==e.indexOf(T)&&(e=e.substring(T.length));var n={credential:Ro(t),Wb:t.tenantId};if(t.email)n.Gb=t.email;else if(t.phoneNumber)n.da=t.phoneNumber;else if(!n.credential)return new _(e,t.message||void 0);return new Uo(e,n,t.message)}return null}function qo(){}function Vo(t){return t.c||(t.c=t.b())}function Bo(){}function Wo(t){if(t.f||"undefined"!=typeof XMLHttpRequest||"undefined"==typeof ActiveXObject)return t.f;for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n<e.length;n++){var r=e[n];try{return new ActiveXObject(r),t.f=r}catch(t){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}function Ho(){}function Ko(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseType=this.responseText=this.response="",this.status=-1,this.statusText="",this.a.onload=g(this.oc,this),this.a.onerror=g(this.Pb,this),this.a.onprogress=g(this.pc,this),this.a.ontimeout=g(this.tc,this)}function Go(t,e){t.readyState=e,t.onreadystatechange&&t.onreadystatechange()}function zo(t,e,n){this.reset(t,e,n,void 0,void 0)}function Qo(t){this.f=t,this.b=this.c=this.a=null}function Yo(t,e){this.name=t,this.value=e}b(Fo,_),b(Uo,_),Uo.prototype.v=function(){var t={code:this.code,message:this.message};this.email&&(t.email=this.email),this.phoneNumber&&(t.phoneNumber=this.phoneNumber),this.tenantId&&(t.tenantId=this.tenantId);var e=this.credential&&this.credential.v();return e&&lt(t,e),t},Uo.prototype.toJSON=function(){return this.v()},qo.prototype.c=null,b(Bo,qo),Bo.prototype.a=function(){var t=Wo(this);return t?new ActiveXObject(t):new XMLHttpRequest},Bo.prototype.b=function(){var t={};return Wo(this)&&(t[0]=!0,t[1]=!0),t},Lo=new Bo,b(Ho,qo),Ho.prototype.a=function(){var t=new XMLHttpRequest;if("withCredentials"in t)return t;if("undefined"!=typeof XDomainRequest)return new Ko;throw Error("Unsupported browser")},Ho.prototype.b=function(){return{}},(t=Ko.prototype).open=function(t,e,n){if(null!=n&&!n)throw Error("Only async requests are supported.");this.a.open(t,e)},t.send=function(t){if(t){if("string"!=typeof t)throw Error("Only string data is supported");this.a.send(t)}else this.a.send()},t.abort=function(){this.a.abort()},t.setRequestHeader=function(){},t.getResponseHeader=function(t){return"content-type"==t.toLowerCase()?this.a.contentType:""},t.oc=function(){this.status=200,this.response=this.responseText=this.a.responseText,Go(this,4)},t.Pb=function(){this.status=500,this.response=this.responseText="",Go(this,4)},t.tc=function(){this.Pb()},t.pc=function(){this.status=200,Go(this,1)},t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType},zo.prototype.a=null,zo.prototype.reset=function(t,e,n,r,i){delete this.a},Yo.prototype.toString=function(){return this.name};var Jo=new Yo("SEVERE",1e3),Xo=new Yo("WARNING",900),$o=new Yo("CONFIG",700),Zo=new Yo("FINE",500);Qo.prototype.log=function(t,e,n){if(t.value>=function t(e){return e.c?e.c:e.a?t(e.a):(O("Root logger has no level set."),null)}(this).value)for(d(e)&&(e=e()),t=new zo(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var ts,es={},ns=null;function rs(t){var e;if(ns||(ns=new Qo(""),(es[""]=ns).c=$o),!(e=es[t])){e=new Qo(t);var n=t.lastIndexOf("."),r=t.substr(n+1);(n=rs(t.substr(0,n))).b||(n.b={}),(n.b[r]=e).a=n,es[t]=e}return e}function is(t,e){t&&t.log(Zo,e,void 0)}function os(t){this.f=t}function ss(t){dn.call(this),this.s=t,this.readyState=as,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.i=new Headers,this.b=null,this.m="GET",this.g="",this.a=!1,this.h=rs("goog.net.FetchXmlHttp"),this.l=this.c=this.f=null}b(os,qo),os.prototype.a=function(){return new ss(this.f)},os.prototype.b=(ts={},function(){return ts}),b(ss,dn);var as=0;function us(t){t.c.read().then(t.nc.bind(t)).catch(t.Sa.bind(t))}function cs(t,e){e&&t.f&&(t.status=t.f.status,t.statusText=t.f.statusText),t.readyState=4,t.f=null,t.c=null,t.l=null,hs(t)}function hs(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function ls(t){dn.call(this),this.headers=new En,this.D=t||null,this.c=!1,this.B=this.a=null,this.h=this.P=this.l="",this.f=this.O=this.i=this.N=!1,this.g=0,this.s=null,this.m=fs,this.w=this.R=!1}(t=ss.prototype).open=function(t,e){if(this.readyState!=as)throw this.abort(),Error("Error reopening a connection");this.m=t,this.g=e,this.readyState=1,hs(this)},t.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var e={headers:this.i,method:this.m,credentials:void 0,cache:void 0};t&&(e.body=t),this.s.fetch(new Request(this.g,e)).then(this.sc.bind(this),this.Sa.bind(this))},t.abort=function(){this.response=this.responseText="",this.i=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,cs(this,!1)),this.readyState=as},t.sc=function(t){this.a&&(this.f=t,this.b||(this.b=t.headers,this.readyState=2,hs(this)),this.a&&(this.readyState=3,hs(this),this.a&&("arraybuffer"===this.responseType?t.arrayBuffer().then(this.qc.bind(this),this.Sa.bind(this)):void 0!==l.ReadableStream&&"body"in t?(this.response=this.responseText="",this.c=t.body.getReader(),this.l=new TextDecoder,us(this)):t.text().then(this.rc.bind(this),this.Sa.bind(this)))))},t.nc=function(t){if(this.a){var e=this.l.decode(t.value?t.value:new Uint8Array(0),{stream:!t.done});e&&(this.response=this.responseText+=e),t.done?cs(this,!0):hs(this),3==this.readyState&&us(this)}},t.rc=function(t){this.a&&(this.response=this.responseText=t,cs(this,!0))},t.qc=function(t){this.a&&(this.response=t,cs(this,!0))},t.Sa=function(t){var e=this.h;e&&e.log(Xo,"Failed to fetch url "+this.g,t instanceof Error?t:Error(t)),this.a&&cs(this,!0)},t.setRequestHeader=function(t,e){this.i.append(t,e)},t.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.h)&&t.log(Xo,"Attempting to get response header but no headers have been received for url: "+this.g,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var t=this.h;return t&&t.log(Xo,"Attempting to get all response headers but no headers have been received for url: "+this.g,void 0),""}t=[];for(var e=this.b.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},b(ls,dn);var fs="";ls.prototype.b=rs("goog.net.XhrIo");var ps=/^https?$/i,ds=["POST","PUT"];function vs(e,t,n,r,i){if(e.a)throw Error("[goog.net.XhrIo] Object is active with another request="+e.l+"; newUri="+t);n=n?n.toUpperCase():"GET",e.l=t,e.h="",e.P=n,e.N=!1,e.c=!0,e.a=e.D?e.D.a():Lo.a(),e.B=e.D?Vo(e.D):Vo(Lo),e.a.onreadystatechange=g(e.Sb,e);try{is(e.b,Ts(e,"Opening Xhr")),e.O=!0,e.a.open(n,String(t),!0),e.O=!1}catch(t){return is(e.b,Ts(e,"Error opening Xhr: "+t.message)),void gs(e,t)}t=r||"";var o=new En(e.headers);i&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(p(t)||"string"==typeof t)U(t,e,void 0);else for(var n=_n(t),r=bn(t),i=r.length,o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}(i,function(t,e){o.set(e,t)}),i=function(t){t:{for(var e=ys,n=t.length,r="string"==typeof t?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t)){e=i;break t}e=-1}return e<0?null:"string"==typeof t?t.charAt(e):t[e]}(o.X()),r=l.FormData&&t instanceof l.FormData,!B(ds,n)||i||r||o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach(function(t,e){this.a.setRequestHeader(e,t)},e),e.m&&(e.a.responseType=e.m),"withCredentials"in e.a&&e.a.withCredentials!==e.R&&(e.a.withCredentials=e.R);try{_s(e),0<e.g&&(e.w=function(t){return Bt&&Zt(9)&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(e.a),is(e.b,Ts(e,"Will abort after "+e.g+"ms if incomplete, xhr2 "+e.w)),e.w?(e.a.timeout=e.g,e.a.ontimeout=g(e.Ka,e)):e.s=mn(e.Ka,e.g,e)),is(e.b,Ts(e,"Sending request")),e.i=!0,e.a.send(t),e.i=!1}catch(t){is(e.b,Ts(e,"Send error: "+t.message)),gs(e,t)}}function ys(t){return"content-type"==t.toLowerCase()}function gs(t,e){t.c=!1,t.a&&(t.f=!0,t.a.abort(),t.f=!1),t.h=e,ms(t),bs(t)}function ms(t){t.N||(t.N=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function ws(e){if(e.c&&void 0!==u)if(e.B[1]&&4==Es(e)&&2==Is(e))is(e.b,Ts(e,"Local request error detected and ignored"));else if(e.i&&4==Es(e))mn(e.Sb,0,e);else if(e.dispatchEvent("readystatechange"),4==Es(e)){is(e.b,Ts(e,"Request complete")),e.c=!1;try{var t,n=Is(e);t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(t=r)){var i;if(i=0===n){var o=String(e.l).match(Sn)[1]||null;if(!o&&l.self&&l.self.location){var s=l.self.location.protocol;o=s.substr(0,s.length-1)}i=!ps.test(o?o.toLowerCase():"")}t=i}if(t)e.dispatchEvent("complete"),e.dispatchEvent("success");else{try{var a=2<Es(e)?e.a.statusText:""}catch(t){is(e.b,"Can not get status: "+t.message),a=""}e.h=a+" ["+Is(e)+"]",ms(e)}}finally{bs(e)}}}function bs(e,t){if(e.a){_s(e);var n=e.a,r=e.B[0]?f:null;e.a=null,e.B=null,t||e.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){(e=e.b)&&e.log(Jo,"Problem encountered resetting onreadystatechange: "+t.message,void 0)}}}function _s(t){t.a&&t.w&&(t.a.ontimeout=null),t.s&&(l.clearTimeout(t.s),t.s=null)}function Es(t){return t.a?t.a.readyState:0}function Is(t){try{return 2<Es(t)?t.a.status:-1}catch(t){return-1}}function Ts(t,e){return e+" ["+t.P+" "+t.l+" "+Is(t)+"]"}function Ss(t){var e=Ms;this.g=[],this.w=e,this.s=t||null,this.f=this.a=!1,this.c=void 0,this.u=this.B=this.i=!1,this.h=0,this.b=null,this.l=0}function Cs(t,e,n){t.a=!0,t.c=n,t.f=!e,Rs(t)}function Ns(t){if(t.a){if(!t.u)throw new Os(t);t.u=!1}}function As(t,e,n,r){t.g.push([e,n,r]),t.a&&Rs(t)}function ks(t){return V(t.g,function(t){return d(t[1])})}function Rs(e){if(e.h&&e.a&&ks(e)){var n=e.h,r=xs[n];r&&(l.clearTimeout(r.a),delete xs[n]),e.h=0}e.b&&(e.b.l--,delete e.b),n=e.c;for(var t=r=!1;e.g.length&&!e.i;){var i=e.g.shift(),o=i[0],s=i[1];if(i=i[2],o=e.f?s:o)try{var a=o.call(i||e.s,n);void 0!==a&&(e.f=e.f&&(a==n||a instanceof Error),e.c=n=a),(A(n)||"function"==typeof l.Promise&&n instanceof l.Promise)&&(t=!0,e.i=!0)}catch(t){n=t,e.f=!0,ks(e)||(r=!0)}}e.c=n,t&&(a=g(e.m,e,!0),t=g(e.m,e,!1),n instanceof Ss?(As(n,a,t),n.B=!0):n.then(a,t)),r&&(n=new Ps(n),xs[n.a]=n,e.h=n.a)}function Os(){k.call(this)}function Ds(){k.call(this)}function Ps(t){this.a=l.setTimeout(g(this.c,this),0),this.b=t}(t=ls.prototype).Ka=function(){void 0!==u&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",is(this.b,Ts(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},t.abort=function(){this.a&&this.c&&(is(this.b,Ts(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),bs(this))},t.Ba=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),bs(this,!0)),ls.Za.Ba.call(this)},t.Sb=function(){this.wa||(this.O||this.i||this.f?ws(this):this.Hc())},t.Hc=function(){ws(this)},t.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.m){case fs:case"text":return this.a.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in this.a)return this.a.mozResponseArrayBuffer}var t=this.b;return t&&t.log(Jo,"Response type "+this.m+" is not supported on this browser",void 0),null}catch(t){return is(this.b,"Can not get response: "+t.message),null}},Ss.prototype.cancel=function(t){if(this.a)this.c instanceof Ss&&this.c.cancel();else{if(this.b){var e=this.b;delete this.b,t?e.cancel(t):(e.l--,e.l<=0&&e.cancel())}this.w?this.w.call(this.s,this):this.u=!0,this.a||(t=new Ds(this),Ns(this),Cs(this,!1,t))}},Ss.prototype.m=function(t,e){this.i=!1,Cs(this,t,e)},Ss.prototype.then=function(t,e,n){var r,i,o=new ve(function(t,e){r=t,i=e});return As(this,r,function(t){t instanceof Ds?o.cancel():i(t)}),o.then(t,e,n)},Ss.prototype.$goog_Thenable=!0,b(Os,k),Os.prototype.message="Deferred has already fired",Os.prototype.name="AlreadyCalledError",b(Ds,k),Ds.prototype.message="Deferred was canceled",Ds.prototype.name="CanceledError",Ps.prototype.c=function(){throw delete xs[this.a],this.b};var xs={};function Ls(t){var e,n=document,r=wt(t).toString(),i=ae(document,"SCRIPT"),o={Tb:i,Ka:void 0},s=new Ss(o);return e=window.setTimeout(function(){Fs(i,!0);var t=new qs(js,"Timeout reached for loading script "+r);Ns(s),Cs(s,!1,t)},5e3),o.Ka=e,i.onload=i.onreadystatechange=function(){i.readyState&&"loaded"!=i.readyState&&"complete"!=i.readyState||(Fs(i,!1,e),Ns(s),Cs(s,!0,null))},i.onerror=function(){Fs(i,!0,e);var t=new qs(Us,"Error while loading script "+r);Ns(s),Cs(s,!1,t)},lt(o={},{type:"text/javascript",charset:"UTF-8"}),ne(i,o),function(t,e){ft(t,"HTMLScriptElement"),t.src=wt(e),null===h&&(h=(e=(e=l.document).querySelector&&e.querySelector("script[nonce]"))&&(e=e.nonce||e.getAttribute("nonce"))&&a.test(e)?e:""),(e=h)&&t.setAttribute("nonce",e)}(i,t),function(t){var e;return(e=(t||document).getElementsByTagName("HEAD"))&&0!=e.length?e[0]:t.documentElement}(n).appendChild(i),s}function Ms(){if(this&&this.Tb){var t=this.Tb;t&&"SCRIPT"==t.tagName&&Fs(t,!0,this.Ka)}}function Fs(t,e,n){null!=n&&l.clearTimeout(n),t.onload=f,t.onerror=f,t.onreadystatechange=f,e&&window.setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},0)}var Us=0,js=1;function qs(t,e){var n="Jsloader error (code #"+t+")";e&&(n+=": "+e),k.call(this,n),this.code=t}function Vs(t){this.f=t}function Bs(t,e,n){if(this.c=t,t=e||{},this.u=t.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token",this.m=t.secureTokenTimeout||Ks,this.g=ct(t.secureTokenHeaders||Gs),this.h=t.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.l=t.identityPlatformEndpoint||"https://identitytoolkit.googleapis.com/v2/",this.i=t.firebaseTimeout||zs,this.a=ct(t.firebaseHeaders||Qs),n&&(this.a["X-Client-Version"]=n,this.g["X-Client-Version"]=n),n="Node"==pr(),!(n=l.XMLHttpRequest||n&&Kl.INTERNAL.node&&Kl.INTERNAL.node.XMLHttpRequest)&&!fr())throw new _("internal-error","The XMLHttpRequest compatibility library was not found.");this.f=void 0,fr()?this.f=new os(self):dr()?this.f=new Vs(n):this.f=new Ho,this.b=null}b(qs,k),b(Vs,qo),Vs.prototype.a=function(){return new this.f},Vs.prototype.b=function(){return{}};var Ws,Hs="idToken",Ks=new Pr(3e4,6e4),Gs={"Content-Type":"application/x-www-form-urlencoded"},zs=new Pr(3e4,6e4),Qs={"Content-Type":"application/json"};function Ys(t,e){e?t.a["X-Firebase-Locale"]=e:delete t.a["X-Firebase-Locale"]}function Js(t,e){e?(t.a["X-Client-Version"]=e,t.g["X-Client-Version"]=e):(delete t.a["X-Client-Version"],delete t.g["X-Client-Version"])}function Xs(t,e,n,r,i,o,s){(t=function(){var t=br();return!((t=gr(t)!=yr?null:(t=t.match(/\sChrome\/(\d+)/i))&&2==t.length?parseInt(t[1],10):null)&&t<30)&&(!Bt||!Xt||9<Xt)}()||fr()?g(t.w,t):(Ws=Ws||new ve(function(t,e){!function(t,e){if(((window.gapi||{}).client||{}).request)t();else{l[Zs]=function(){((window.gapi||{}).client||{}).request?t():e(Error("CORS_UNSUPPORTED"))},function(t,e){As(t,null,e,void 0)}(Ls(bt($s,{onload:Zs})),function(){e(Error("CORS_UNSUPPORTED"))})}}(t,e)}),g(t.s,t)))(e,n,r,i,o,s)}Bs.prototype.S=function(){return this.b},Bs.prototype.w=function(t,n,e,r,i,o){if(fr()&&(void 0===l.fetch||void 0===l.Headers||void 0===l.Request))throw new _("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to support HTTP requests from a Worker environment.");var s=new ls(this.f);if(o){s.g=Math.max(0,o);var a=setTimeout(function(){s.dispatchEvent("timeout")},o)}vn(s,"complete",function(){a&&clearTimeout(a);var e=null;try{e=JSON.parse(function(e){try{return e.a?e.a.responseText:""}catch(t){return is(e.b,"Can not get responseText: "+t.message),""}}(this))||null}catch(t){e=null}n&&n(e)}),yn(s,"ready",function(){a&&clearTimeout(a),Ue(this)}),yn(s,"timeout",function(){a&&clearTimeout(a),Ue(this),n&&n(null)}),vs(s,t,e,r,i)};var $s=new pt(yt,"https://apis.google.com/js/client.js?onload=%{onload}"),Zs="__fcb"+Math.floor(1e6*Math.random()).toString();function ta(t,e,n,r,i,o,s){var a=Dn(e+n);Rn(a,"key",t.c),s&&Rn(a,"cb",w().toString());var u="GET"==r;if(u)for(var c in i)i.hasOwnProperty(c)&&Rn(a,c,i[c]);return new ve(function(e,n){Xs(t,a.toString(),function(t){t?t.error?n(Ya(t,o||{})):e(t):n(new _("network-request-failed"))},r,u?void 0:Jn(Ar(i)),t.a,t.i.get())})}function ea(t){if("string"!=typeof(t=t.email)||!ur.test(t))throw new _("invalid-email")}function na(t){"email"in t&&ea(t)}function ra(t){if(!t[Hs]){if(t.mfaPendingCredential)throw new _("multi-factor-auth-required",null,ct(t));throw new _("internal-error")}}function ia(t){if(t.phoneNumber||t.temporaryProof){if(!t.phoneNumber||!t.temporaryProof)throw new _("internal-error")}else{if(!t.sessionInfo)throw new _("missing-verification-id");if(!t.code)throw new _("missing-verification-code")}}Bs.prototype.s=function(t,n,r,i,o){var s=this;Ws.then(function(){window.gapi.client.setApiKey(s.c);var e=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:t,method:r,body:i,headers:o,authType:"none",callback:function(t){window.gapi.auth.setToken(e),n&&n(t)}})}).o(function(t){n&&n({error:{message:t&&t.message||"CORS_UNSUPPORTED"}})})},Bs.prototype.vb=function(){return za(this,La,{})},Bs.prototype.xb=function(t,e){return za(this,Pa,{idToken:t,email:e})},Bs.prototype.yb=function(t,e){return za(this,xa,{idToken:t,password:e})};var oa={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};function sa(t){if(!t.phoneVerificationInfo)throw new _("internal-error");if(!t.phoneVerificationInfo.sessionInfo)throw new _("missing-verification-id");if(!t.phoneVerificationInfo.code)throw new _("missing-verification-code")}function aa(t){if(!t.requestUri||!t.sessionId&&!t.postBody&&!t.pendingToken)throw new _("internal-error")}function ua(t,e){return e.oauthIdToken&&e.providerId&&0==e.providerId.indexOf("oidc.")&&!e.pendingToken&&(t.sessionId?e.nonce=t.sessionId:t.postBody&&(Gn(t=new Bn(t.postBody),"nonce")&&(e.nonce=t.get("nonce")))),e}function ca(t){var e=null;if(t.needConfirmation?(t.code="account-exists-with-different-credential",e=jo(t)):"FEDERATED_USER_ID_ALREADY_LINKED"==t.errorMessage?(t.code="credential-already-in-use",e=jo(t)):"EMAIL_EXISTS"==t.errorMessage?(t.code="email-already-in-use",e=jo(t)):t.errorMessage&&(e=Qa(t.errorMessage)),e)throw e;ra(t)}function ha(t,e){return e.returnIdpCredential=!0,za(t,Ua,e)}function la(t,e){return e.returnIdpCredential=!0,za(t,qa,e)}function fa(t,e){return e.returnIdpCredential=!0,e.autoCreate=!1,za(t,ja,e)}function pa(t){if(!t.oobCode)throw new _("invalid-action-code")}(t=Bs.prototype).zb=function(t,r){var i={idToken:t},o=[];return at(oa,function(t,e){var n=r[e];null===n?o.push(t):e in r&&(i[e]=n)}),o.length&&(i.deleteAttribute=o),za(this,Pa,i)},t.rb=function(t,e){return lt(t={requestType:"PASSWORD_RESET",email:t},e),za(this,Aa,t)},t.sb=function(t,e){return lt(t={requestType:"EMAIL_SIGNIN",email:t},e),za(this,Sa,t)},t.qb=function(t,e){return lt(t={requestType:"VERIFY_EMAIL",idToken:t},e),za(this,Ca,t)},t.Ab=function(t,e,n){return lt(t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:t,newEmail:e},n),za(this,Na,t)},t.cb=function(t){return za(this,Wa,t)},t.jb=function(t,e){return za(this,Oa,{oobCode:t,newPassword:e})},t.Pa=function(t){return za(this,va,{oobCode:t})},t.fb=function(t){return za(this,da,{oobCode:t})};var da={endpoint:"setAccountInfo",A:pa,Y:"email",C:!0},va={endpoint:"resetPassword",A:pa,G:function(t){var e=t.requestType;if(!e||!t.email&&"EMAIL_SIGNIN"!=e&&"VERIFY_AND_CHANGE_EMAIL"!=e)throw new _("internal-error")},C:!0},ya={endpoint:"signupNewUser",A:function(t){if(ea(t),!t.password)throw new _("weak-password")},G:ra,U:!0,C:!0},ga={endpoint:"createAuthUri",C:!0},ma={endpoint:"deleteAccount",M:["idToken"]},wa={endpoint:"setAccountInfo",M:["idToken","deleteProvider"],A:function(t){if("array"!=n(t.deleteProvider))throw new _("internal-error")}},ba={endpoint:"emailLinkSignin",M:["email","oobCode"],A:ea,G:ra,U:!0,C:!0},_a={endpoint:"emailLinkSignin",M:["idToken","email","oobCode"],A:ea,G:ra,U:!0},Ea={endpoint:"accounts/mfaEnrollment:finalize",M:["idToken","phoneVerificationInfo"],A:sa,G:ra,C:!0,La:!0},Ia={endpoint:"accounts/mfaSignIn:finalize",M:["mfaPendingCredential","phoneVerificationInfo"],A:sa,G:ra,C:!0,La:!0},Ta={endpoint:"getAccountInfo"},Sa={endpoint:"getOobConfirmationCode",M:["requestType"],A:function(t){if("EMAIL_SIGNIN"!=t.requestType)throw new _("internal-error");ea(t)},Y:"email",C:!0},Ca={endpoint:"getOobConfirmationCode",M:["idToken","requestType"],A:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new _("internal-error")},Y:"email",C:!0},Na={endpoint:"getOobConfirmationCode",M:["idToken","newEmail","requestType"],A:function(t){if("VERIFY_AND_CHANGE_EMAIL"!=t.requestType)throw new _("internal-error")},Y:"email",C:!0},Aa={endpoint:"getOobConfirmationCode",M:["requestType"],A:function(t){if("PASSWORD_RESET"!=t.requestType)throw new _("internal-error");ea(t)},Y:"email",C:!0},ka={hb:!0,endpoint:"getProjectConfig",Rb:"GET"},Ra={hb:!0,endpoint:"getRecaptchaParam",Rb:"GET",G:function(t){if(!t.recaptchaSiteKey)throw new _("internal-error")}},Oa={endpoint:"resetPassword",A:pa,Y:"email",C:!0},Da={endpoint:"sendVerificationCode",M:["phoneNumber","recaptchaToken"],Y:"sessionInfo",C:!0},Pa={endpoint:"setAccountInfo",M:["idToken"],A:na,U:!0},xa={endpoint:"setAccountInfo",M:["idToken"],A:function(t){if(na(t),!t.password)throw new _("weak-password")},G:ra,U:!0},La={endpoint:"signupNewUser",G:ra,U:!0,C:!0},Ma={endpoint:"accounts/mfaEnrollment:start",M:["idToken","phoneEnrollmentInfo"],A:function(t){if(!t.phoneEnrollmentInfo)throw new _("internal-error");if(!t.phoneEnrollmentInfo.phoneNumber)throw new _("missing-phone-number");if(!t.phoneEnrollmentInfo.recaptchaToken)throw new _("missing-app-credential")},G:function(t){if(!t.phoneSessionInfo||!t.phoneSessionInfo.sessionInfo)throw new _("internal-error")},C:!0,La:!0},Fa={endpoint:"accounts/mfaSignIn:start",M:["mfaPendingCredential","mfaEnrollmentId","phoneSignInInfo"],A:function(t){if(!t.phoneSignInInfo||!t.phoneSignInInfo.recaptchaToken)throw new _("missing-app-credential")},G:function(t){if(!t.phoneResponseInfo||!t.phoneResponseInfo.sessionInfo)throw new _("internal-error")},C:!0,La:!0},Ua={endpoint:"verifyAssertion",A:aa,Wa:ua,G:ca,U:!0,C:!0},ja={endpoint:"verifyAssertion",A:aa,Wa:ua,G:function(t){if(t.errorMessage&&"USER_NOT_FOUND"==t.errorMessage)throw new _("user-not-found");if(t.errorMessage)throw Qa(t.errorMessage);ra(t)},U:!0,C:!0},qa={endpoint:"verifyAssertion",A:function(t){if(aa(t),!t.idToken)throw new _("internal-error")},Wa:ua,G:ca,U:!0},Va={endpoint:"verifyCustomToken",A:function(t){if(!t.token)throw new _("invalid-custom-token")},G:ra,U:!0,C:!0},Ba={endpoint:"verifyPassword",A:function(t){if(ea(t),!t.password)throw new _("wrong-password")},G:ra,U:!0,C:!0},Wa={endpoint:"verifyPhoneNumber",A:ia,G:ra,C:!0},Ha={endpoint:"verifyPhoneNumber",A:function(t){if(!t.idToken)throw new _("internal-error");ia(t)},G:function(t){if(t.temporaryProof)throw t.code="credential-already-in-use",jo(t);ra(t)}},Ka={Eb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:ia,G:ra,C:!0},Ga={endpoint:"accounts/mfaEnrollment:withdraw",M:["idToken","mfaEnrollmentId"],G:function(t){if(!!t[Hs]^!!t.refreshToken)throw new _("internal-error")},C:!0,La:!0};function za(t,e,n){if(!function(t,e){if(!e||!e.length)return!0;if(!t)return!1;for(var n=0;n<e.length;n++){var r=t[e[n]];if(null==r||""===r)return!1}return!0}(n,e.M))return Ie(new _("internal-error"));var r,i=!!e.La,o=e.Rb||"POST";return Ee(n).then(e.A).then(function(){return e.U&&(n.returnSecureToken=!0),e.C&&t.b&&void 0===n.tenantId&&(n.tenantId=t.b),ta(t,i?t.l:t.h,e.endpoint,o,n,e.Eb,e.hb||!1)}).then(function(t){return r=t,e.Wa?e.Wa(n,r):r}).then(e.G).then(function(){if(!e.Y)return r;if(!(e.Y in r))throw new _("internal-error");return r[e.Y]})}function Qa(t){return Ya({error:{errors:[{message:t}],code:400,message:t}})}function Ya(t,e){var n=(t.error&&t.error.errors&&t.error.errors[0]||{}).reason||"",r={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(n=r[n]?new _(r[n]):null)return n;for(var i in n=t.error&&t.error.message||"",lt(r={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_OR_INVALID_NONCE:"missing-or-invalid-nonce",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",INVALID_PROVIDER_ID:"invalid-provider-id",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code",INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id",QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",REJECTED_CREDENTIAL:"rejected-credential",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_DYNAMIC_LINK_DOMAIN:"invalid-dynamic-link-domain",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash",UNSUPPORTED_TENANT_OPERATION:"unsupported-tenant-operation",INVALID_TENANT_ID:"invalid-tenant-id",TENANT_ID_MISMATCH:"tenant-id-mismatch",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",EMAIL_CHANGE_NEEDS_VERIFICATION:"email-change-needs-verification",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",UNSUPPORTED_FIRST_FACTOR:"unsupported-first-factor",UNVERIFIED_EMAIL:"unverified-email"},e||{}),e=(e=n.match(/^[^\s]+\s*:\s*([\s\S]*)$/))&&1<e.length?e[1]:void 0,r)if(0===n.indexOf(i))return new _(r[i],e);return!e&&t&&(e=Nr(t)),new _("internal-error",e)}function Ja(t){this.b=t,this.a=null,this.nb=function(o){return(tu=tu||new ve(function(t,e){function n(){Dr(),_r("gapi.load")("gapi.iframes",{callback:t,ontimeout:function(){Dr(),e(Error("Network Error"))},timeout:$a.get()})}if(_r("gapi.iframes.Iframe"))t();else if(_r("gapi.load"))n();else{var r="__iframefcb"+Math.floor(1e6*Math.random()).toString();l[r]=function(){_r("gapi.load")?n():e(Error("Network Error"))},Ee(Ls(r=bt(Xa,{onload:r}))).o(function(){e(Error("Network Error"))})}}).o(function(t){throw tu=null,t})).then(function(){return new ve(function(r,i){_r("gapi.iframes.getContext")().open({where:document.body,url:o.b,messageHandlersFilter:_r("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"),attributes:{style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},dontclear:!0},function(t){function e(){clearTimeout(n),r()}o.a=t,o.a.restyle({setHideOnLeave:!1});var n=setTimeout(function(){i(Error("Network Error"))},Za.get());t.ping(e).then(e,function(){i(Error("Network Error"))})})})})}(this)}var Xa=new pt(yt,"https://apis.google.com/js/api.js?onload=%{onload}"),$a=new Pr(3e4,6e4),Za=new Pr(5e3,15e3),tu=null;function eu(t,e,n){this.i=t,this.g=e,this.h=n,this.f=null,this.a=Pn(this.i,"/__/auth/iframe"),Rn(this.a,"apiKey",this.g),Rn(this.a,"appName",this.h),this.b=null,this.c=[]}function nu(t,e,n,r,i){this.s=t,this.m=e,this.c=n,this.u=r,this.i=this.g=this.l=null,this.a=i,this.h=this.f=null}function ru(t){try{return Kl.app(t).auth().Ea()}catch(t){return[]}}function iu(t,e,n,r,i){this.u=t,this.f=e,this.b=n,this.c=r||null,this.h=i||null,this.m=this.s=this.w=null,this.g=[],this.l=this.a=null}function ou(t){var a=nr();return function(t){return za(t,ka,{}).then(function(t){return t.authorizedDomains||[]})}(t).then(function(t){t:{var e=Dn(a),n=e.f;e=e.b;for(var r=0;r<t.length;r++){var i=t[r],o=e,s=n;if(o=0==i.indexOf("chrome-extension://")?Dn(i).b==o&&"chrome-extension"==s:("http"==s||"https"==s)&&(ar.test(i)?o==i:(i=i.split(".").join("\\."),new RegExp("^(.+\\."+i+"|"+i+")$","i").test(o)))){t=!0;break t}}t=!1}if(!t)throw new Fo(nr())})}function su(i){return i.l||(i.l=cr().then(function(){if(!i.s){var t=i.c,e=i.h,n=ru(i.b),r=new eu(i.u,i.f,i.b);r.f=t,r.b=e,r.c=G(n||[]),i.s=r.toString()}i.i=new Ja(i.s),function(r){if(!r.i)throw Error("IfcHandler must be initialized!");!function(t,e){t.nb.then(function(){t.a.register("authEvent",e,_r("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}(r.i,function(t){var e={};if(t&&t.authEvent){var n=!1;for(t=Po(t.authEvent),e=0;e<r.g.length;e++)n=r.g[e](t)||n;return(e={}).status=n?"ACK":"ERROR",Ee(e)}return e.status="ERROR",Ee(e)})}(i)})),i.l}function au(t){return t.m||(t.w=t.c?wr(t.c,ru(t.b)):null,t.m=new Bs(t.f,N(t.h),t.w)),t.m}function uu(t,e,n,r,i,o,s,a,u,c,h){return(t=new nu(t,e,n,r,i)).l=o,t.g=s,t.i=a,t.b=ct(u||null),t.f=c,t.ub(h).toString()}function cu(t){if(this.a=t||Kl.INTERNAL.reactNative&&Kl.INTERNAL.reactNative.AsyncStorage,!this.a)throw new _("internal-error","The React Native compatibility library was not found.");this.type="asyncStorage"}function hu(t){this.b=t,this.a={},this.f=g(this.c,this)}eu.prototype.toString=function(){return this.f?Rn(this.a,"v",this.f):Kn(this.a.a,"v"),this.b?Rn(this.a,"eid",this.b):Kn(this.a.a,"eid"),this.c.length?Rn(this.a,"fw",this.c.join(",")):Kn(this.a.a,"fw"),this.a.toString()},nu.prototype.ub=function(t){return this.h=t,this},nu.prototype.toString=function(){var t=Pn(this.s,"/__/auth/handler");if(Rn(t,"apiKey",this.m),Rn(t,"appName",this.c),Rn(t,"authType",this.u),this.a.isOAuthProvider){var e=this.a;try{var n=Kl.app(this.c).auth().ja()}catch(t){n=null}for(var r in e.kb=n,Rn(t,"providerId",this.a.providerId),n=Ar((e=this.a).Fb))n[r]=n[r].toString();r=e.Oc,n=ct(n);for(var i=0;i<r.length;i++){var o=r[i];o in n&&delete n[o]}e.lb&&e.kb&&!n[e.lb]&&(n[e.lb]=e.kb),ut(n)||Rn(t,"customParameters",Nr(n))}if("function"==typeof this.a.Nb&&((e=this.a.Nb()).length&&Rn(t,"scopes",e.join(","))),this.l?Rn(t,"redirectUrl",this.l):Kn(t.a,"redirectUrl"),this.g?Rn(t,"eventId",this.g):Kn(t.a,"eventId"),this.i?Rn(t,"v",this.i):Kn(t.a,"v"),this.b)for(var s in this.b)this.b.hasOwnProperty(s)&&!On(t,s)&&Rn(t,s,this.b[s]);return this.h?Rn(t,"tid",this.h):Kn(t.a,"tid"),this.f?Rn(t,"eid",this.f):Kn(t.a,"eid"),(s=ru(this.c)).length&&Rn(t,"fw",s.join(",")),t.toString()},(t=iu.prototype).Lb=function(e,n,t){var r=new _("popup-closed-by-user"),i=new _("web-storage-unsupported"),o=this,s=!1;return this.ka().then(function(){(function(t){var e={type:"webStorageSupport"};return su(t).then(function(){return function(e,n){return e.nb.then(function(){return new ve(function(t){e.a.send(n.type,n,t,_r("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})})}(t.i,e)}).then(function(t){if(t&&t.length&&void 0!==t[0].webStorageSupport)return t[0].webStorageSupport;throw Error()})})(o).then(function(t){t||(e&&or(e),n(i),s=!0)})}).o(function(){}).then(function(){if(!s)return function(n){return new ve(function(e){return function t(){wn(2e3).then(function(){if(n&&!n.closed)return t();e()})}()})}(e)}).then(function(){if(!s)return wn(t).then(function(){n(r)})})},t.Ub=function(){var t=br();return!Cr(t)&&!Or(t)},t.Qb=function(){return!1},t.Jb=function(e,t,n,r,i,o,s,a){if(!e)return Ie(new _("popup-blocked"));if(s&&!Cr())return this.ka().o(function(t){or(e),i(t)}),r(),Ee();this.a||(this.a=ou(au(this)));var u=this;return this.a.then(function(){var t=u.ka().o(function(t){throw or(e),i(t),t});return r(),t}).then(function(){Oo(n),s||rr(uu(u.u,u.f,u.b,t,n,null,o,u.c,void 0,u.h,a),e)}).o(function(t){throw"auth/network-request-failed"==t.code&&(u.a=null),t})},t.Kb=function(t,e,n,r){this.a||(this.a=ou(au(this)));var i=this;return this.a.then(function(){Oo(e),rr(uu(i.u,i.f,i.b,t,e,nr(),n,i.c,void 0,i.h,r))}).o(function(t){throw"auth/network-request-failed"==t.code&&(i.a=null),t})},t.ka=function(){var t=this;return su(this).then(function(){return t.i.nb}).o(function(){throw t.a=null,new _("network-request-failed")})},t.Xb=function(){return!0},t.Ca=function(t){this.g.push(t)},t.Qa=function(e){H(this.g,function(t){return t==e})},(t=cu.prototype).get=function(t){return Ee(this.a.getItem(t)).then(function(t){return t&&kr(t)})},t.set=function(t,e){return Ee(this.a.setItem(t,Nr(e)))},t.T=function(t){return Ee(this.a.removeItem(t))},t.ba=function(){},t.ha=function(){};var lu,fu=[];function pu(t,e,n){ut(t.a)&&t.b.addEventListener("message",t.f),void 0===t.a[e]&&(t.a[e]=[]),t.a[e].push(n)}function du(t){this.a=t}function vu(t){this.c=t,this.b=!1,this.a=[]}function yu(r,t,e,n){var i,o,s,a,u=e||{},c=null;if(r.b)return Ie(Error("connection_unavailable"));var h=n?800:50,l="undefined"!=typeof MessageChannel?new MessageChannel:null;return new ve(function(e,n){l?(i=Math.floor(Math.random()*Math.pow(10,20)).toString(),l.port1.start(),s=setTimeout(function(){n(Error("unsupported_event"))},h),c={messageChannel:l,onMessage:o=function(t){t.data.eventId===i&&("ack"===t.data.status?(clearTimeout(s),a=setTimeout(function(){n(Error("timeout"))},3e3)):"done"===t.data.status?(clearTimeout(a),void 0!==t.data.response?e(t.data.response):n(Error("unknown_error"))):(clearTimeout(s),clearTimeout(a),n(Error("invalid_response"))))}},r.a.push(c),l.port1.addEventListener("message",o),r.c.postMessage({eventType:t,eventId:i,data:u},[l.port2])):n(Error("connection_unavailable"))}).then(function(t){return gu(r,c),t}).o(function(t){throw gu(r,c),t})}function gu(t,e){if(e){var n=e.messageChannel,r=e.onMessage;n&&(n.port1.removeEventListener("message",r),n.port1.close()),H(t.a,function(t){return t==e})}}function mu(){if(!_u())throw new _("web-storage-unsupported");this.c={},this.a=[],this.b=0,this.u=l.indexedDB,this.type="indexedDB",this.g=this.l=this.f=this.i=null,this.s=!1,this.h=null;var r=this;fr()&&self?(this.l=function(){var e=fr()?self:null;if(U(fu,function(t){t.b==e&&(n=t)}),!n){var n=new hu(e);fu.push(n)}return n}(),pu(this.l,"keyChanged",function(t,n){return Cu(r).then(function(e){return 0<e.length&&U(r.a,function(t){t(e)}),{keyProcessed:B(e,n.key)}})}),pu(this.l,"ping",function(){return Ee(["keyChanged"])})):function(){var t=l.navigator;return t&&t.serviceWorker?Ee().then(function(){return t.serviceWorker.ready}).then(function(t){return t.active||null}).o(function(){return null}):Ee(null)}().then(function(t){(r.h=t)&&(r.g=new vu(new du(t)),yu(r.g,"ping",null,!0).then(function(t){t[0].fulfilled&&B(t[0].value,"keyChanged")&&(r.s=!0)}).o(function(){}))})}function wu(r){return new ve(function(e,n){var t=r.u.open("firebaseLocalStorageDb",1);t.onerror=function(t){try{t.preventDefault()}catch(t){}n(Error(t.target.error))},t.onupgradeneeded=function(t){t=t.target.result;try{t.createObjectStore("firebaseLocalStorage",{keyPath:"fbase_key"})}catch(t){n(t)}},t.onsuccess=function(t){(t=t.target.result).objectStoreNames.contains("firebaseLocalStorage")?e(t):function(r){return new ve(function(t,e){var n=r.u.deleteDatabase("firebaseLocalStorageDb");n.onsuccess=function(){t()},n.onerror=function(t){e(Error(t.target.error))}})}(r).then(function(){return wu(r)}).then(function(t){e(t)}).o(function(t){n(t)})}})}function bu(t){return t.m||(t.m=wu(t)),t.m}function _u(){try{return!!l.indexedDB}catch(t){return!1}}function Eu(t){return t.objectStore("firebaseLocalStorage")}function Iu(t,e){return t.transaction(["firebaseLocalStorage"],e?"readwrite":"readonly")}function Tu(t){return new ve(function(e,n){t.onsuccess=function(t){t&&t.target?e(t.target.result):e()},t.onerror=function(t){n(t.target.error)}})}function Su(t,e){return t.g&&t.h&&function(){var t=l.navigator;return t&&t.serviceWorker&&t.serviceWorker.controller||null}()===t.h?yu(t.g,"keyChanged",{key:e},t.s).then(function(){}).o(function(){}):Ee()}function Cu(r){return bu(r).then(function(t){var i=Eu(Iu(t,!1));return i.getAll?Tu(i.getAll()):new ve(function(e,n){var r=[],t=i.openCursor();t.onsuccess=function(t){(t=t.target.result)?(r.push(t.value),t.continue()):e(r)},t.onerror=function(t){n(t.target.error)}})}).then(function(t){var e={},n=[];if(0==r.b){for(n=0;n<t.length;n++)e[t[n].fbase_key]=t[n].value;n=function t(e,n){var r,i=[];for(r in e)r in n?typeof e[r]!=typeof n[r]?i.push(r):"object"==typeof e[r]&&null!=e[r]&&null!=n[r]?0<t(e[r],n[r]).length&&i.push(r):e[r]!==n[r]&&i.push(r):i.push(r);for(r in n)r in e||i.push(r);return i}(r.c,e),r.c=e}return n})}function Nu(t){t.i&&t.i.cancel("STOP_EVENT"),t.f&&(clearTimeout(t.f),t.f=null)}function Au(t){var r=this,i=null;this.a=[],this.type="indexedDB",this.c=t,this.b=Ee().then(function(){if(_u()){var e=Rr(),n="__sak"+e;return lu=lu||new mu,(i=lu).set(n,e).then(function(){return i.get(n)}).then(function(t){if(t!==e)throw Error("indexedDB not supported!");return i.T(n)}).then(function(){return i}).o(function(){return r.c})}return r.c}).then(function(t){return r.type=t.type,t.ba(function(e){U(r.a,function(t){t(e)})}),t})}function ku(){this.a={},this.type="inMemory"}function Ru(){if(!function(){var t="Node"==pr();if(!(t=Ou()||t&&Kl.INTERNAL.node&&Kl.INTERNAL.node.localStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==pr())throw new _("internal-error","The LocalStorage compatibility library was not found.");throw new _("web-storage-unsupported")}this.a=Ou()||Kl.INTERNAL.node.localStorage,this.type="localStorage"}function Ou(){try{var t=l.localStorage,e=Rr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Du(){this.type="nullStorage"}function Pu(){if(!function(){var t="Node"==pr();if(!(t=xu()||t&&Kl.INTERNAL.node&&Kl.INTERNAL.node.sessionStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==pr())throw new _("internal-error","The SessionStorage compatibility library was not found.");throw new _("web-storage-unsupported")}this.a=xu()||Kl.INTERNAL.node.sessionStorage,this.type="sessionStorage"}function xu(){try{var t=l.sessionStorage,e=Rr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Lu(){var t={};t.Browser=Uu,t.Node=ju,t.ReactNative=qu,t.Worker=Vu,this.a=t[pr()]}hu.prototype.c=function(n){var r=n.data.eventType,i=n.data.eventId,t=this.a[r];if(t&&0<t.length){n.ports[0].postMessage({status:"ack",eventId:i,eventType:r,response:null});var e=[];U(t,function(t){e.push(Ee().then(function(){return t(n.origin,n.data.data)}))}),Se(e).then(function(t){var e=[];U(t,function(t){e.push({fulfilled:t.Mb,value:t.value,reason:t.reason?t.reason.message:void 0})}),U(e,function(t){for(var e in t)void 0===t[e]&&delete t[e]}),n.ports[0].postMessage({status:"done",eventId:i,eventType:r,response:e})})}},du.prototype.postMessage=function(t,e){this.a.postMessage(t,e)},vu.prototype.close=function(){for(;0<this.a.length;)gu(this,this.a[0]);this.b=!0},(t=mu.prototype).set=function(n,r){var i,o=!1,s=this;return bu(this).then(function(t){return Tu((t=Eu(Iu(i=t,!0))).get(n))}).then(function(t){var e=Eu(Iu(i,!0));return t?(t.value=r,Tu(e.put(t))):(s.b++,o=!0,(t={}).fbase_key=n,t.value=r,Tu(e.add(t)))}).then(function(){return s.c[n]=r,Su(s,n)}).ma(function(){o&&s.b--})},t.get=function(e){return bu(this).then(function(t){return Tu(Eu(Iu(t,!1)).get(e))}).then(function(t){return t&&t.value})},t.T=function(e){var n=!1,r=this;return bu(this).then(function(t){return n=!0,r.b++,Tu(Eu(Iu(t,!0)).delete(e))}).then(function(){return delete r.c[e],Su(r,e)}).ma(function(){n&&r.b--})},t.ba=function(t){0==this.a.length&&function(t){Nu(t),function e(){t.f=setTimeout(function(){t.i=Cu(t).then(function(e){0<e.length&&U(t.a,function(t){t(e)})}).then(function(){e()}).o(function(t){"STOP_EVENT"!=t.message&&e()})},800)}()}(this),this.a.push(t)},t.ha=function(e){H(this.a,function(t){return t==e}),0==this.a.length&&Nu(this)},(t=Au.prototype).get=function(e){return this.b.then(function(t){return t.get(e)})},t.set=function(e,n){return this.b.then(function(t){return t.set(e,n)})},t.T=function(e){return this.b.then(function(t){return t.T(e)})},t.ba=function(t){this.a.push(t)},t.ha=function(e){H(this.a,function(t){return t==e})},(t=ku.prototype).get=function(t){return Ee(this.a[t])},t.set=function(t,e){return this.a[t]=e,Ee()},t.T=function(t){return delete this.a[t],Ee()},t.ba=function(){},t.ha=function(){},(t=Ru.prototype).get=function(t){var e=this;return Ee().then(function(){return kr(e.a.getItem(t))})},t.set=function(e,n){var r=this;return Ee().then(function(){var t=Nr(n);null===t?r.T(e):r.a.setItem(e,t)})},t.T=function(t){var e=this;return Ee().then(function(){e.a.removeItem(t)})},t.ba=function(t){l.window&&en(l.window,"storage",t)},t.ha=function(t){l.window&&on(l.window,"storage",t)},(t=Du.prototype).get=function(){return Ee(null)},t.set=function(){return Ee()},t.T=function(){return Ee()},t.ba=function(){},t.ha=function(){},(t=Pu.prototype).get=function(t){var e=this;return Ee().then(function(){return kr(e.a.getItem(t))})},t.set=function(e,n){var r=this;return Ee().then(function(){var t=Nr(n);null===t?r.T(e):r.a.setItem(e,t)})},t.T=function(t){var e=this;return Ee().then(function(){e.a.removeItem(t)})},t.ba=function(){},t.ha=function(){};var Mu,Fu,Uu={F:Ru,$a:Pu},ju={F:Ru,$a:Pu},qu={F:cu,$a:Du},Vu={F:Ru,$a:Du},Bu={od:"local",NONE:"none",qd:"session"};function Wu(){var t=!(Or(br())||!lr()),e=Cr(),n=Er();this.m=t,this.h=e,this.l=n,this.a={},t=Mu=Mu||new Lu;try{this.g=!er()&&Mr()||!l.indexedDB?new t.a.F:new Au(fr()?new ku:new t.a.F)}catch(t){this.g=new ku,this.h=!0}try{this.i=new t.a.$a}catch(t){this.i=new ku}this.u=new ku,this.f=g(this.Vb,this),this.b={}}function Hu(){return Fu=Fu||new Wu}function Ku(t,e){switch(e){case"session":return t.i;case"none":return t.u;default:return t.g}}function Gu(t,e){return"firebase:"+t.name+(e?":"+e:"")}function zu(t,e,n){return n=Gu(e,n),"local"==e.F&&(t.b[n]=null),Ku(t,e.F).T(n)}function Qu(t){t.c&&(clearInterval(t.c),t.c=null)}function Yu(t){this.a=t,this.b=Hu()}(t=Wu.prototype).get=function(t,e){return Ku(this,t.F).get(Gu(t,e))},t.set=function(e,t,n){var r=Gu(e,n),i=this,o=Ku(this,e.F);return o.set(r,t).then(function(){return o.get(r)}).then(function(t){"local"==e.F&&(i.b[r]=t)})},t.addListener=function(t,e,n){t=Gu(t,e),this.l&&(this.b[t]=l.localStorage.getItem(t)),ut(this.a)&&(Ku(this,"local").ba(this.f),this.h||(er()||!Mr())&&l.indexedDB||!this.l||function(r){Qu(r),r.c=setInterval(function(){for(var t in r.a){var e=l.localStorage.getItem(t),n=r.b[t];e!=n&&(r.b[t]=e,e=new He({type:"storage",key:t,target:window,oldValue:n,newValue:e,a:!0}),r.Vb(e))}},1e3)}(this)),this.a[t]||(this.a[t]=[]),this.a[t].push(n)},t.removeListener=function(t,e,n){t=Gu(t,e),this.a[t]&&(H(this.a[t],function(t){return t==n}),0==this.a[t].length&&delete this.a[t]),ut(this.a)&&(Ku(this,"local").ha(this.f),Qu(this))},t.Vb=function(t){if(t&&t.f){var e=t.a.key;if(null==e)for(var n in this.a){var r=this.b[n];void 0===r&&(r=null);var i=l.localStorage.getItem(n);i!==r&&(this.b[n]=i,this.ib(n))}else if(0==e.indexOf("firebase:")&&this.a[e]){if(void 0!==t.a.a?Ku(this,"local").ha(this.f):Qu(this),this.m)if(n=l.localStorage.getItem(e),(r=t.a.newValue)!==n)null!==r?l.localStorage.setItem(e,r):l.localStorage.removeItem(e);else if(this.b[e]===r&&void 0===t.a.a)return;var o=this;n=function(){void 0===t.a.a&&o.b[e]===l.localStorage.getItem(e)||(o.b[e]=l.localStorage.getItem(e),o.ib(e))},Bt&&Xt&&10==Xt&&l.localStorage.getItem(e)!==t.a.newValue&&t.a.newValue!==t.a.oldValue?setTimeout(n,10):n()}}else U(t,g(this.ib,this))},t.ib=function(t){this.a[t]&&U(this.a[t],function(t){t()})};var Ju,Xu={name:"authEvent",F:"local"};function $u(){this.a=Hu()}function Zu(t,e){this.b=tc,this.f=l.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=t,this.h=e,this.l=l.Int32Array?new Int32Array(64):Array(64),void 0===Ju&&(Ju=l.Int32Array?new Int32Array(ac):ac),this.reset()}b(Zu,function(){this.b=-1});for(var tc=64,ec=tc-1,nc=[],rc=0;rc<ec;rc++)nc[rc]=0;var ic=K(128,nc);function oc(t){for(var e=t.f,n=t.l,r=0,i=0;i<e.length;)n[r++]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3],i=4*r;for(e=16;e<64;e++){i=0|n[e-15],r=0|n[e-2];var o=(0|n[e-16])+((i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3)|0,s=(0|n[e-7])+((r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)|0;n[e]=o+s|0}r=0|t.a[0],i=0|t.a[1];var a=0|t.a[2],u=0|t.a[3],c=0|t.a[4],h=0|t.a[5],l=0|t.a[6];for(o=0|t.a[7],e=0;e<64;e++){var f=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&a^i&a)|0;s=(o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0)+((s=(s=c&h^~c&l)+(0|Ju[e])|0)+(0|n[e])|0)|0,o=l,l=h,h=c,c=u+s|0,u=a,a=i,i=r,r=s+f|0}t.a[0]=t.a[0]+r|0,t.a[1]=t.a[1]+i|0,t.a[2]=t.a[2]+a|0,t.a[3]=t.a[3]+u|0,t.a[4]=t.a[4]+c|0,t.a[5]=t.a[5]+h|0,t.a[6]=t.a[6]+l|0,t.a[7]=t.a[7]+o|0}function sc(t,e,n){void 0===n&&(n=e.length);var r=0,i=t.c;if("string"==typeof e)for(;r<n;)t.f[i++]=e.charCodeAt(r++),i==t.b&&(oc(t),i=0);else{if(!p(e))throw Error("message must be string or array");for(;r<n;){var o=e[r++];if(!("number"==typeof o&&0<=o&&o<=255&&o==(0|o)))throw Error("message must be a byte array");t.f[i++]=o,i==t.b&&(oc(t),i=0)}}t.c=i,t.g+=n}Zu.prototype.reset=function(){this.g=this.c=0,this.a=l.Int32Array?new Int32Array(this.h):G(this.h)};var ac=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function uc(){Zu.call(this,8,cc)}b(uc,Zu);var cc=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function hc(t,e,n,r,i){this.u=t,this.i=e,this.l=n,this.m=r||null,this.s=i||null,this.h=e+":"+n,this.w=new $u,this.g=new Yu(this.h),this.f=null,this.b=[],this.a=this.c=null}function lc(t){return new _("invalid-cordova-configuration",t)}function fc(t){var e=new uc;sc(e,t),t=[];var n=8*e.g;e.c<56?sc(e,ic,56-e.c):sc(e,ic,e.b-(e.c-56));for(var r=63;56<=r;r--)e.f[r]=255&n,n/=256;for(oc(e),r=n=0;r<e.i;r++)for(var i=24;0<=i;i-=8)t[n++]=e.a[r]>>i&255;return function(t){return q(t,function(t){return 1<(t=t.toString(16)).length?t:"0"+t}).join("")}(t)}function pc(t,e){for(var n=0;n<t.b.length;n++)try{t.b[n](e)}catch(t){}}function dc(r){return r.f||(r.f=r.ka().then(function(){return new ve(function(n){r.Ca(function t(e){return n(e),r.Qa(t),!1}),function(i){function e(r){t=!0,n&&n.cancel(),vc(i).then(function(t){var e=o;if(t&&r&&r.url){var n=null;-1!=(e=Ji(r.url)).indexOf("/__/auth/callback")&&(n=(n="object"==typeof(n=kr(On(n=Dn(e),"firebaseError")||null))?E(n):null)?new Do(t.c,t.b,null,null,n,null,t.S()):new Do(t.c,t.b,e,t.f,null,null,t.S())),e=n||o}pc(i,e)})}var o=new Do("unknown",null,null,null,new _("no-auth-event")),t=!1,n=wn(500).then(function(){return vc(i).then(function(){t||pc(i,o)})}),r=l.handleOpenURL;l.handleOpenURL=function(t){if(0==t.toLowerCase().indexOf(_r("BuildInfo.packageName",l).toLowerCase()+"://")&&e({url:t}),"function"==typeof r)try{r(t)}catch(t){console.error(t)}},Mo=Mo||new xo,function(t){var n=Mo;n.a.push(t),n.b||(n.b=function(t){for(var e=0;e<n.a.length;e++)n.a[e](t)},"function"==typeof(t=_r("universalLinks.subscribe",l))&&t(null,n.b))}(e)}(r)})})),r.f}function vc(e){var n=null;return function(t){return t.b.get(Xu,t.a).then(function(t){return Po(t)})}(e.g).then(function(t){return n=t,zu((t=e.g).b,Xu,t.a)}).then(function(){return n})}function yc(t){this.a=t,this.b=Hu()}(t=hc.prototype).ka=function(){return this.Ga?this.Ga:this.Ga=(hr(void 0)?cr().then(function(){return new ve(function(t,e){var n=l.document,r=setTimeout(function(){e(Error("Cordova framework is not ready."))},1e3);n.addEventListener("deviceready",function(){clearTimeout(r),t()},!1)})}):Ie(Error("Cordova must run in an Android or iOS file scheme."))).then(function(){if("function"!=typeof _r("universalLinks.subscribe",l))throw lc("cordova-universal-links-plugin-fix is not installed");if(void 0===_r("BuildInfo.packageName",l))throw lc("cordova-plugin-buildinfo is not installed");if("function"!=typeof _r("cordova.plugins.browsertab.openUrl",l))throw lc("cordova-plugin-browsertab is not installed");if("function"!=typeof _r("cordova.InAppBrowser.open",l))throw lc("cordova-plugin-inappbrowser is not installed")},function(){throw new _("cordova-not-ready")})},t.Lb=function(t,e){return e(new _("operation-not-supported-in-this-environment")),Ee()},t.Jb=function(){return Ie(new _("operation-not-supported-in-this-environment"))},t.Xb=function(){return!1},t.Ub=function(){return!0},t.Qb=function(){return!0},t.Kb=function(t,e,n,r){if(this.c)return Ie(new _("redirect-operation-pending"));var i=this,o=l.document,s=null,a=null,u=null,c=null;return this.c=Ee().then(function(){return Oo(e),dc(i)}).then(function(){return function(n,t,e,r,i){var o=function(){for(var t=20,e=[];0<t;)e.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),t--;return e.join("")}(),s=new Do(t,r,null,o,new _("no-auth-event"),null,i),a=_r("BuildInfo.packageName",l);if("string"!=typeof a)throw new _("invalid-cordova-configuration");var u=_r("BuildInfo.displayName",l),c={};if(br().toLowerCase().match(/iphone|ipad|ipod/))c.ibi=a;else{if(!br().toLowerCase().match(/android/))return Ie(new _("operation-not-supported-in-this-environment"));c.apn=a}u&&(c.appDisplayName=u),o=fc(o),c.sessionId=o;var h=uu(n.u,n.i,n.l,t,e,null,r,n.m,c,n.s,i);return n.ka().then(function(){var t=n.h;return n.w.a.set(Xu,s.v(),t)}).then(function(){var t=_r("cordova.plugins.browsertab.isAvailable",l);if("function"!=typeof t)throw new _("invalid-cordova-configuration");var e=null;t(function(t){if(t){if("function"!=typeof(e=_r("cordova.plugins.browsertab.openUrl",l)))throw new _("invalid-cordova-configuration");e(h)}else{if("function"!=typeof(e=_r("cordova.InAppBrowser.open",l)))throw new _("invalid-cordova-configuration");t=br(),n.a=e(h,t.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||t.match(/(iPad|iPhone|iPod).*OS 8_\d/i)?"_blank":"_system","location=yes")}})})}(i,t,e,n,r)}).then(function(){return new ve(function(e,t){a=function(){var t=_r("cordova.plugins.browsertab.close",l);return e(),"function"==typeof t&&t(),i.a&&"function"==typeof i.a.close&&(i.a.close(),i.a=null),!1},i.Ca(a),u=function(){s=s||wn(2e3).then(function(){t(new _("redirect-cancelled-by-user"))})},c=function(){xr()&&u()},o.addEventListener("resume",u,!1),br().toLowerCase().match(/android/)||o.addEventListener("visibilitychange",c,!1)}).o(function(t){return vc(i).then(function(){throw t})})}).ma(function(){u&&o.removeEventListener("resume",u,!1),c&&o.removeEventListener("visibilitychange",c,!1),s&&s.cancel(),a&&i.Qa(a),i.c=null})},t.Ca=function(e){this.b.push(e),dc(this).o(function(t){"auth/invalid-cordova-configuration"===t.code&&(t=new Do("unknown",null,null,null,new _("no-auth-event")),e(t))})},t.Qa=function(e){H(this.b,function(t){return t==e})};var gc={name:"pendingRedirect",F:"session"};function mc(t){return zu(t.b,gc,t.a)}function wc(t,e,n){this.i={},this.w=0,this.D=t,this.u=e,this.m=n,this.h=[],this.f=!1,this.l=g(this.s,this),this.b=new Pc,this.B=new Uc,this.g=new yc(this.u+":"+this.m),this.c={},this.c.unknown=this.b,this.c.signInViaRedirect=this.b,this.c.linkViaRedirect=this.b,this.c.reauthViaRedirect=this.b,this.c.signInViaPopup=this.B,this.c.linkViaPopup=this.B,this.c.reauthViaPopup=this.B,this.a=bc(this.D,this.u,this.m,I)}function bc(t,e,n,r){var i=Kl.SDK_VERSION||null;return hr()?new hc(t,e,n,i,r):new iu(t,e,n,i,r)}function _c(e){e.f||(e.f=!0,e.a.Ca(e.l));var n=e.a;return e.a.ka().o(function(t){throw e.a==n&&e.reset(),t})}function Ec(n){n.a.Ub()&&_c(n).o(function(t){var e=new Do("unknown",null,null,null,new _("operation-not-supported-in-this-environment"));Ac(t)&&n.s(e)}),n.a.Qb()||xc(n.b)}function Ic(n,t){B(n.h,t)||n.h.push(t),n.f||function(t){return t.b.get(gc,t.a).then(function(t){return"pending"==t})}(n.g).then(function(t){t?mc(n.g).then(function(){_c(n).o(function(t){var e=new Do("unknown",null,null,null,new _("operation-not-supported-in-this-environment"));Ac(t)&&n.s(e)})}):Ec(n)}).o(function(){Ec(n)})}function Tc(t,e){H(t.h,function(t){return t==e})}wc.prototype.reset=function(){this.f=!1,this.a.Qa(this.l),this.a=bc(this.D,this.u,this.m),this.i={}},wc.prototype.s=function(t){if(!t)throw new _("invalid-auth-event");if(6e5<=w()-this.w&&(this.i={},this.w=0),t&&t.getUid()&&this.i.hasOwnProperty(t.getUid()))return!1;for(var e=!1,n=0;n<this.h.length;n++){var r=this.h[n];if(r.Cb(t.c,t.b)){(e=this.c[t.c])&&(e.h(t,r),t&&(t.f||t.b)&&(this.i[t.getUid()]=!0,this.w=w())),e=!0;break}}return xc(this.b),e};var Sc=new Pr(2e3,1e4),Cc=new Pr(3e4,6e4);function Nc(t,e,n,r,i,o,s){return t.a.Jb(e,n,r,function(){t.f||(t.f=!0,t.a.Ca(t.l))},function(){t.reset()},i,o,s)}function Ac(t){return!(!t||"auth/cordova-not-ready"!=t.code)}function kc(e,t,n,r,i){var o;return function(t){return t.b.set(gc,"pending",t.a)}(e.g).then(function(){return e.a.Kb(t,n,r,i).o(function(t){if(Ac(t))throw new _("operation-not-supported-in-this-environment");return o=t,mc(e.g).then(function(){throw o})}).then(function(){return e.a.Xb()?new ve(function(){}):mc(e.g).then(function(){return e.pa()}).then(function(){}).o(function(){})})})}function Rc(t,e,n,r,i){return t.a.Lb(r,function(t){e.la(n,null,t,i)},Sc.get())}wc.prototype.pa=function(){return this.b.pa()};var Oc={};function Dc(t,e,n){var r=e+":"+n;return Oc[r]||(Oc[r]=new wc(t,e,n)),Oc[r]}function Pc(){this.b=null,this.f=[],this.c=[],this.a=null,this.i=this.g=!1}function xc(t){t.g||(t.g=!0,Fc(t,!1,null,null))}function Lc(t){t.g&&!t.i&&Fc(t,!1,null,null)}function Mc(t,e){if(t.b=function(){return Ee(e)},t.f.length)for(var n=0;n<t.f.length;n++)t.f[n](e)}function Fc(t,e,n,r){e?r?function(t,e){if(t.b=function(){return Ie(e)},t.c.length)for(var n=0;n<t.c.length;n++)t.c[n](e)}(t,r):Mc(t,n):Mc(t,{user:null}),t.f=[],t.c=[]}function Uc(){}function jc(){this.Bb=!1,Object.defineProperty(this,"appVerificationDisabled",{get:function(){return this.Bb},set:function(t){this.Bb=t},enumerable:!1})}function qc(t,e){this.a=e,Vr(this,"verificationId",t)}function Vc(t,e,n,r){return new Ao(t).cb(e,n).then(function(t){return new qc(t,r)})}function Bc(t){var e=Mi(t);if(!(e&&e.exp&&e.auth_time&&e.iat))throw new _("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");Br(this,{token:t,expirationTime:Lr(1e3*e.exp),authTime:Lr(1e3*e.auth_time),issuedAtTime:Lr(1e3*e.iat),signInProvider:e.firebase&&e.firebase.sign_in_provider?e.firebase.sign_in_provider:null,signInSecondFactor:e.firebase&&e.firebase.sign_in_second_factor?e.firebase.sign_in_second_factor:null,claims:e})}function Wc(t,e,n){var r=e&&e[Kc];if(!r)throw new _("argument-error","Internal assert: Invalid MultiFactorResolver");this.a=t,this.f=ct(e),this.g=n,this.c=new Xi(null,r),this.b=[];var i=this;U(e[Hc]||[],function(t){(t=Gr(t))&&i.b.push(t)}),Vr(this,"auth",this.a),Vr(this,"session",this.c),Vr(this,"hints",this.b)}Pc.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},Pc.prototype.h=function(t,e){if(t){this.reset(),this.g=!0;var n=t.c,r=t.b,i=t.a&&"auth/web-storage-unsupported"==t.a.code,o=t.a&&"auth/operation-not-supported-in-this-environment"==t.a.code;this.i=!(!i&&!o),"unknown"!=n||i||o?t.a?(Fc(this,!0,null,t.a),Ee()):e.Da(n,r)?function(e,t,n){n=n.Da(t.c,t.b);var r=t.g,i=t.f,o=t.i,s=t.S(),a=!!t.c.match(/Redirect$/);n(r,i,s,o).then(function(t){Fc(e,a,t,null)}).o(function(t){Fc(e,a,null,t)})}(this,t,e):Ie(new _("invalid-auth-event")):(Fc(this,!1,null,null),Ee())}else Ie(new _("invalid-auth-event"))},Pc.prototype.pa=function(){var n=this;return new ve(function(t,e){n.b?n.b().then(t,e):(n.f.push(t),n.c.push(e),function(t){var e=new _("timeout");t.a&&t.a.cancel(),t.a=wn(Cc.get()).then(function(){t.b||(t.g=!0,Fc(t,!0,null,e))})}(n))})},Uc.prototype.h=function(t,e){if(t){var n=t.c,r=t.b;t.a?(e.la(t.c,null,t.a,t.b),Ee()):e.Da(n,r)?function(t,e){var n=t.b,r=t.c;e.Da(r,n)(t.g,t.f,t.S(),t.i).then(function(t){e.la(r,t,null,n)}).o(function(t){e.la(r,null,t,n)})}(t,e):Ie(new _("invalid-auth-event"))}else Ie(new _("invalid-auth-event"))},qc.prototype.confirm=function(t){return t=ko(this.verificationId,t),this.a(t)};var Hc="mfaInfo",Kc="mfaPendingCredential";function Gc(t,e,n,r){_.call(this,"multi-factor-auth-required",r,e),this.b=new Wc(t,e,n),Vr(this,"resolver",this.b)}function zc(t,e,n){if(t&&v(t.serverResponse)&&"auth/multi-factor-auth-required"===t.code)try{return new Gc(e,t.serverResponse,n,t.message)}catch(t){}return null}function Qc(){}function Yc(t){Vr(this,"factorId",t.ea),this.a=t}function Jc(t){if(Yc.call(this,t),this.a.ea!=Ao.PROVIDER_ID)throw new _("argument-error","firebase.auth.PhoneMultiFactorAssertion requires a valid firebase.auth.PhoneAuthCredential")}function Xc(t,e){for(var n in We.call(this,t),e)this[n]=e[n]}function $c(t,e){this.a=t,this.b=[],this.c=g(this.wc,this),en(this.a,"userReloaded",this.c);var r=[];e&&e.multiFactor&&e.multiFactor.enrolledFactors&&U(e.multiFactor.enrolledFactors,function(t){var e=null,n={};if(t){t.uid&&(n[Yr]=t.uid),t.displayName&&(n[zr]=t.displayName),t.enrollmentTime&&(n[Qr]=new Date(t.enrollmentTime).toISOString()),t.phoneNumber&&(n[Jr]=t.phoneNumber);try{e=new Xr(n)}catch(t){}t=e}else t=null;t&&r.push(t)}),Zc(this,r)}function Zc(t,e){t.b=e,Vr(t,"enrolledFactors",e)}function th(t,e,n){if(this.h=t,this.i=e,this.g=n,this.c=3e4,this.f=96e4,this.b=null,this.a=this.c,this.f<this.c)throw Error("Proactive refresh lower bound greater than upper bound!")}function eh(t,e){return e?(t.a=t.c,t.g()):(e=t.a,t.a*=2,t.a>t.f&&(t.a=t.f),e)}function nh(t){this.c=t,this.b=this.a=null}function rh(t){return t.b&&1e3*t.b.c||0}function ih(t,e){var n=e.refreshToken;t.b=Li(e[Hs]||""),t.a=n}function oh(e,t){return function(t,r){return new ve(function(e,n){"refresh_token"==r.grant_type&&r.refresh_token||"authorization_code"==r.grant_type&&r.code?Xs(t,t.u+"?key="+encodeURIComponent(t.c),function(t){t?t.error?n(Ya(t)):t.access_token&&t.refresh_token?e(t):n(new _("internal-error")):n(new _("network-request-failed"))},"POST",Hn(r).toString(),t.g,t.m.get()):n(new _("internal-error"))})}(e.c,t).then(function(t){return e.b=Li(t.access_token),e.a=t.refresh_token,{accessToken:e.b.toString(),refreshToken:e.a}}).o(function(t){throw"auth/user-token-expired"==t.code&&(e.a=null),t})}function sh(t,e){this.a=t||null,this.b=e||null,Br(this,{lastSignInTime:Lr(e||null),creationTime:Lr(t||null)})}function ah(t,e,n,r,i,o){Br(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}function uh(t,e,n){this.N=[],this.l=t.apiKey,this.m=t.appName,this.s=t.authDomain||null,t=Kl.SDK_VERSION?wr(Kl.SDK_VERSION):null,this.a=new Bs(this.l,N(I),t),this.b=new nh(this.a),vh(this,e[Hs]),ih(this.b,e),Vr(this,"refreshToken",this.b.a),mh(this,n||{}),dn.call(this),this.P=!1,this.s&&Ir()&&(this.i=Dc(this.s,this.l,this.m)),this.R=[],this.h=null,this.B=function(e){return new th(function(){return e.I(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var t=rh(e.b)-w()-3e5;return 0<t?t:0})}(this),this.Z=g(this.Ma,this);var r=this;this.oa=null,this.za=function(t){r.va(t.g)},this.aa=null,this.W=[],this.ya=function(t){hh(r,t.c)},this.$=null,this.O=new $c(this,n),Vr(this,"multiFactor",this.O)}function ch(t,e){t.aa&&on(t.aa,"languageCodeChanged",t.za),(t.aa=e)&&en(e,"languageCodeChanged",t.za)}function hh(t,e){t.W=e,Js(t.a,Kl.SDK_VERSION?wr(Kl.SDK_VERSION,t.W):null)}function lh(t,e){t.$&&on(t.$,"frameworkChanged",t.ya),(t.$=e)&&en(e,"frameworkChanged",t.ya)}function fh(e){try{return Kl.app(e.m).auth()}catch(t){throw new _("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+e.m+"'!")}}function ph(t){t.D||t.B.b||(t.B.start(),on(t,"tokenChanged",t.Z),en(t,"tokenChanged",t.Z))}function dh(t){on(t,"tokenChanged",t.Z),t.B.stop()}function vh(t,e){t.xa=e,Vr(t,"_lat",e)}function yh(t){for(var e=[],n=0;n<t.R.length;n++)e.push(t.R[n](t));return Se(e).then(function(){return t})}function gh(t){t.i&&!t.P&&(t.P=!0,Ic(t.i,t))}function mh(t,e){Br(t,{uid:e.uid,displayName:e.displayName||null,photoURL:e.photoURL||null,email:e.email||null,emailVerified:e.emailVerified||!1,phoneNumber:e.phoneNumber||null,isAnonymous:e.isAnonymous||!1,tenantId:e.tenantId||null,metadata:new sh(e.createdAt,e.lastLoginAt),providerData:[]}),t.a.b=t.tenantId}function wh(){}function bh(t){return Ee().then(function(){if(t.D)throw new _("app-deleted")})}function _h(t){return q(t.providerData,function(t){return t.providerId})}function Eh(t,e){e&&(Ih(t,e.providerId),t.providerData.push(e))}function Ih(t,e){H(t.providerData,function(t){return t.providerId==e})}function Th(t,e,n){("uid"!=e||n)&&t.hasOwnProperty(e)&&Vr(t,e,n)}function Sh(e,t){e!=t&&(Br(e,{uid:t.uid,displayName:t.displayName,photoURL:t.photoURL,email:t.email,emailVerified:t.emailVerified,phoneNumber:t.phoneNumber,isAnonymous:t.isAnonymous,tenantId:t.tenantId,providerData:[]}),t.metadata?Vr(e,"metadata",function(t){return new sh(t.a,t.b)}(t.metadata)):Vr(e,"metadata",new sh),U(t.providerData,function(t){Eh(e,t)}),function(t,e){t.b=e.b,t.a=e.a}(e.b,t.b),Vr(e,"refreshToken",e.b.a),Zc(e.O,t.O.b))}function Ch(n){return n.I().then(function(t){var e=n.isAnonymous;return function(t,e){return za(t.a,Ta,{idToken:e}).then(g(t.Ic,t))}(n,t).then(function(){return e||Th(n,"isAnonymous",!1),t})})}function Nh(t,e){e[Hs]&&t.xa!=e[Hs]&&(ih(t.b,e),t.dispatchEvent(new Xc("tokenChanged")),vh(t,e[Hs]),Th(t,"refreshToken",t.b.a))}function Ah(t,e){return Ch(t).then(function(){if(B(_h(t),e))return yh(t).then(function(){throw new _("provider-already-linked")})})}function kh(t,e,n){return Wr({user:t,credential:Ro(e),additionalUserInfo:e=Vi(e),operationType:n})}function Rh(t,e){return Nh(t,e),t.reload().then(function(){return t})}function Oh(n,r,t,e,i){if(!Ir())return Ie(new _("operation-not-supported-in-this-environment"));if(n.h&&!i)return Ie(n.h);var o=qi(t.providerId),s=Rr(n.uid+":::"),a=null;(!Cr()||lr())&&n.s&&t.isOAuthProvider&&(a=uu(n.s,n.l,n.m,r,t,null,s,Kl.SDK_VERSION||null,null,null,n.tenantId));var u=sr(a,o&&o.ta,o&&o.sa);return e=e().then(function(){if(Ph(n),!i)return n.I().then(function(){})}).then(function(){return Nc(n.i,u,r,t,s,!!a,n.tenantId)}).then(function(){return new ve(function(t,e){n.la(r,null,new _("cancelled-popup-request"),n.g||null),n.f=t,n.w=e,n.g=s,n.c=Rc(n.i,n,r,u,s)})}).then(function(t){return u&&or(u),t?Wr(t):null}).o(function(t){throw u&&or(u),t}),xh(n,e,i)}function Dh(e,t,n,r,i){if(!Ir())return Ie(new _("operation-not-supported-in-this-environment"));if(e.h&&!i)return Ie(e.h);var o=null,s=Rr(e.uid+":::");return r=r().then(function(){if(Ph(e),!i)return e.I().then(function(){})}).then(function(){return e.fa=s,yh(e)}).then(function(t){return e.ga&&(t=(t=e.ga).b.set(Fh,e.v(),t.a)),t}).then(function(){return kc(e.i,t,n,s,e.tenantId)}).o(function(t){if(o=t,e.ga)return Uh(e.ga);throw o}).then(function(){if(o)throw o}),xh(e,r,i)}function Ph(t){if(!t.i||!t.P){if(t.i&&!t.P)throw new _("internal-error");throw new _("auth-domain-config-required")}}function xh(n,t,e){var r=function(e,t,n){return e.h&&!n?(t.cancel(),Ie(e.h)):t.o(function(t){throw!t||"auth/user-disabled"!=t.code&&"auth/user-token-expired"!=t.code||(e.h||e.dispatchEvent(new Xc("userInvalidated")),e.h=t),t})}(n,t,e);return n.N.push(r),r.ma(function(){W(n.N,r)}),r.o(function(t){var e=null;throw t&&"auth/multi-factor-auth-required"===t.code&&(e=zc(t.v(),fh(n),g(n.hc,n))),e||t})}function Lh(t){if(!t.apiKey)return null;var e={apiKey:t.apiKey,authDomain:t.authDomain,appName:t.appName},n={};if(!t.stsTokenManager||!t.stsTokenManager.accessToken)return null;n[Hs]=t.stsTokenManager.accessToken,n.refreshToken=t.stsTokenManager.refreshToken||null;var r=new uh(e,n,t);return t.providerData&&U(t.providerData,function(t){t&&Eh(r,Wr(t))}),t.redirectEventId&&(r.fa=t.redirectEventId),r}function Mh(t){this.a=t,this.b=Hu()}Wc.prototype.Pc=function(t){var n=this;return t.ob(this.a.b,this.c).then(function(t){var e=ct(n.f);return delete e[Hc],delete e[Kc],lt(e,t),n.g(e)})},b(Gc,_),Qc.prototype.ob=function(t,e,n){return e.type==$i?function(e,n,t,r){return t.Fa().then(function(t){return t={idToken:t},void 0!==r&&(t.displayName=r),lt(t,{phoneVerificationInfo:No(e.a)}),za(n,Ea,t)})}(this,t,e,n):function(e,n,t){return t.Fa().then(function(t){return lt(t={mfaPendingCredential:t},{phoneVerificationInfo:No(e.a)}),za(n,Ia,t)})}(this,t,e)},b(Yc,Qc),b(Jc,Yc),b(Xc,We),(t=$c.prototype).wc=function(t){Zc(this,function(t){var e=[];return U(t.mfaInfo||[],function(t){(t=Gr(t))&&e.push(t)}),e}(t.ed))},t.Ob=function(){return this.a.I().then(function(t){return new Xi(t,null)})},t.dc=function(e,n){var r=this,i=this.a.a;return this.Ob().then(function(t){return e.ob(i,t,n)}).then(function(t){return Nh(r.a,t),r.a.reload()})},t.$c=function(t){var n=this,r="string"==typeof t?t:t.uid,e=this.a.a;return this.a.I().then(function(t){return za(e,Ga,{idToken:t,mfaEnrollmentId:r})}).then(function(t){var e=j(n.b,function(t){return t.uid!=r});return Zc(n,e),Nh(n.a,t),n.a.reload().o(function(t){if("auth/user-token-expired"!=t.code)throw t})})},t.v=function(){return{multiFactor:{enrolledFactors:q(this.b,function(t){return t.v()})}}},th.prototype.start=function(){this.a=this.c,function e(n,t){n.stop();n.b=wn(eh(n,t)).then(function(){return e=l.document,n=null,xr()||!e?Ee():new ve(function(t){n=function(){xr()&&(e.removeEventListener("visibilitychange",n,!1),t())},e.addEventListener("visibilitychange",n,!1)}).o(function(t){throw e.removeEventListener("visibilitychange",n,!1),t});var e,n}).then(function(){return n.h()}).then(function(){e(n,!0)}).o(function(t){n.i(t)&&e(n,!1)})}(this,!0)},th.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},nh.prototype.v=function(){return{apiKey:this.c.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:rh(this)}},nh.prototype.getToken=function(t){return t=!!t,this.b&&!this.a?Ie(new _("user-token-expired")):t||!this.b||w()>rh(this)-3e4?this.a?oh(this,{grant_type:"refresh_token",refresh_token:this.a}):Ee(null):Ee({accessToken:this.b.toString(),refreshToken:this.a})},sh.prototype.v=function(){return{lastLoginAt:this.b,createdAt:this.a}},b(uh,dn),uh.prototype.va=function(t){this.oa=t,Ys(this.a,t)},uh.prototype.ja=function(){return this.oa},uh.prototype.Ea=function(){return G(this.W)},uh.prototype.Ma=function(){this.B.b&&(this.B.stop(),this.B.start())},Vr(uh.prototype,"providerId","firebase"),(t=uh.prototype).reload=function(){var t=this;return xh(this,bh(this).then(function(){return Ch(t).then(function(){return yh(t)}).then(wh)}))},t.mc=function(t){return this.I(t).then(function(t){return new Bc(t)})},t.I=function(t){var e=this;return xh(this,bh(this).then(function(){return e.b.getToken(t)}).then(function(t){if(!t)throw new _("internal-error");return t.accessToken!=e.xa&&(vh(e,t.accessToken),e.dispatchEvent(new Xc("tokenChanged"))),Th(e,"refreshToken",t.refreshToken),t.accessToken}))},t.Ic=function(t){if(!(t=t.users)||!t.length)throw new _("internal-error");mh(this,{uid:(t=t[0]).localId,displayName:t.displayName,photoURL:t.photoUrl,email:t.email,emailVerified:!!t.emailVerified,phoneNumber:t.phoneNumber,lastLoginAt:t.lastLoginAt,createdAt:t.createdAt,tenantId:t.tenantId});for(var e=function(t){return(t=t.providerUserInfo)&&t.length?q(t,function(t){return new ah(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[]}(t),n=0;n<e.length;n++)Eh(this,e[n]);Th(this,"isAnonymous",!(this.email&&t.passwordHash||this.providerData&&this.providerData.length)),this.dispatchEvent(new Xc("userReloaded",{ed:t}))},t.Jc=function(t){return jr("firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.reauthenticateWithCredential instead."),this.pb(t)},t.pb=function(t){var e=this,n=null;return xh(this,t.c(this.a,this.uid).then(function(t){return Nh(e,t),n=kh(e,t,"reauthenticate"),e.h=null,e.reload()}).then(function(){return n}),!0)},t.Ac=function(t){return jr("firebase.User.prototype.linkAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.linkWithCredential instead."),this.mb(t)},t.mb=function(e){var n=this,r=null;return xh(this,Ah(this,e.providerId).then(function(){return n.I()}).then(function(t){return e.b(n.a,t)}).then(function(t){return r=kh(n,t,"link"),Rh(n,t)}).then(function(){return r}))},t.Bc=function(t,e){var n=this;return xh(this,Ah(this,"phone").then(function(){return Vc(fh(n),t,e,g(n.mb,n))}))},t.Kc=function(t,e){var n=this;return xh(this,Ee().then(function(){return Vc(fh(n),t,e,g(n.pb,n))}),!0)},t.xb=function(e){var n=this;return xh(this,this.I().then(function(t){return n.a.xb(t,e)}).then(function(t){return Nh(n,t),n.reload()}))},t.cd=function(e){var n=this;return xh(this,this.I().then(function(t){return e.b(n.a,t)}).then(function(t){return Nh(n,t),n.reload()}))},t.yb=function(e){var n=this;return xh(this,this.I().then(function(t){return n.a.yb(t,e)}).then(function(t){return Nh(n,t),n.reload()}))},t.zb=function(e){if(void 0===e.displayName&&void 0===e.photoURL)return bh(this);var n=this;return xh(this,this.I().then(function(t){return n.a.zb(t,{displayName:e.displayName,photoUrl:e.photoURL})}).then(function(t){return Nh(n,t),Th(n,"displayName",t.displayName||null),Th(n,"photoURL",t.photoUrl||null),U(n.providerData,function(t){"password"===t.providerId&&(Vr(t,"displayName",n.displayName),Vr(t,"photoURL",n.photoURL))}),yh(n)}).then(wh))},t.ad=function(e){var n=this;return xh(this,Ch(this).then(function(t){return B(_h(n),e)?function(t,e,n){return za(t,wa,{idToken:e,deleteProvider:n})}(n.a,t,[e]).then(function(t){var e={};return U(t.providerUserInfo||[],function(t){e[t.providerId]=!0}),U(_h(n),function(t){e[t]||Ih(n,t)}),e[Ao.PROVIDER_ID]||Vr(n,"phoneNumber",null),yh(n)}):yh(n).then(function(){throw new _("no-such-provider")})}))},t.delete=function(){var e=this;return xh(this,this.I().then(function(t){return za(e.a,ma,{idToken:t})}).then(function(){e.dispatchEvent(new Xc("userDeleted"))})).then(function(){for(var t=0;t<e.N.length;t++)e.N[t].cancel("app-deleted");ch(e,null),lh(e,null),e.N=[],e.D=!0,dh(e),Vr(e,"refreshToken",null),e.i&&Tc(e.i,e)})},t.Cb=function(t,e){return!!("linkViaPopup"==t&&(this.g||null)==e&&this.f||"reauthViaPopup"==t&&(this.g||null)==e&&this.f||"linkViaRedirect"==t&&(this.fa||null)==e||"reauthViaRedirect"==t&&(this.fa||null)==e)},t.la=function(t,e,n,r){"linkViaPopup"!=t&&"reauthViaPopup"!=t||r!=(this.g||null)||(n&&this.w?this.w(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.w)},t.Da=function(t,e){return"linkViaPopup"==t&&e==(this.g||null)?g(this.Hb,this):"reauthViaPopup"==t&&e==(this.g||null)?g(this.Ib,this):"linkViaRedirect"==t&&(this.fa||null)==e?g(this.Hb,this):"reauthViaRedirect"==t&&(this.fa||null)==e?g(this.Ib,this):null},t.Cc=function(t){var e=this;return Oh(this,"linkViaPopup",t,function(){return Ah(e,t.providerId).then(function(){return yh(e)})},!1)},t.Lc=function(t){return Oh(this,"reauthViaPopup",t,function(){return Ee()},!0)},t.Dc=function(t){var e=this;return Dh(this,"linkViaRedirect",t,function(){return Ah(e,t.providerId)},!1)},t.Mc=function(t){return Dh(this,"reauthViaRedirect",t,function(){return Ee()},!0)},t.Hb=function(e,n,t,r){var i=this;this.c&&(this.c.cancel(),this.c=null);var o=null;return t=this.I().then(function(t){return la(i.a,{requestUri:e,postBody:r,sessionId:n,idToken:t})}).then(function(t){return o=kh(i,t,"link"),Rh(i,t)}).then(function(){return o}),xh(this,t)},t.Ib=function(t,e,n,r){var i=this;this.c&&(this.c.cancel(),this.c=null);var o=null;return xh(this,Ee().then(function(){return eo(fa(i.a,{requestUri:t,sessionId:e,postBody:r,tenantId:n}),i.uid)}).then(function(t){return o=kh(i,t,"reauthenticate"),Nh(i,t),i.h=null,i.reload()}).then(function(){return o}),!0)},t.qb=function(e){var n=this,r=null;return xh(this,this.I().then(function(t){return r=t,void 0===e||ut(e)?{}:Oi(new _i(e))}).then(function(t){return n.a.qb(r,t)}).then(function(t){if(n.email!=t)return n.reload()}).then(function(){}))},t.Ab=function(e,n){var r=this,i=null;return xh(this,this.I().then(function(t){return i=t,void 0===n||ut(n)?{}:Oi(new _i(n))}).then(function(t){return r.a.Ab(i,e,t)}).then(function(t){if(r.email!=t)return r.reload()}).then(function(){}))},t.hc=function(t){var e=null,n=this;return xh(this,t=eo(Ee(t),n.uid).then(function(t){return e=kh(n,t,"reauthenticate"),Nh(n,t),n.h=null,n.reload()}).then(function(){return e}),!0)},t.toJSON=function(){return this.v()},t.v=function(){var e={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,tenantId:this.tenantId,providerData:[],apiKey:this.l,appName:this.m,authDomain:this.s,stsTokenManager:this.b.v(),redirectEventId:this.fa||null};return this.metadata&&lt(e,this.metadata.v()),U(this.providerData,function(t){e.providerData.push(function(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}(t))}),lt(e,this.O.v()),e};var Fh={name:"redirectUser",F:"session"};function Uh(t){return zu(t.b,Fh,t.a)}function jh(t){this.a=t,this.b=Hu(),this.c=null,this.f=function(e){var n=Bh("local"),r=Bh("session"),i=Bh("none");return function(n,r,i){var o=Gu(r,i),s=Ku(n,r.F);return n.get(r,i).then(function(t){var e=null;try{e=kr(l.localStorage.getItem(o))}catch(t){}if(e&&!t)return l.localStorage.removeItem(o),n.set(r,e,i);e&&t&&"localStorage"!=s.type&&l.localStorage.removeItem(o)})}(e.b,n,e.a).then(function(){return e.b.get(r,e.a)}).then(function(t){return t?r:e.b.get(i,e.a).then(function(t){return t?i:e.b.get(n,e.a).then(function(t){return t?n:e.b.get(Vh,e.a).then(function(t){return t?Bh(t):n})})})}).then(function(t){return e.c=t,qh(e,t.F)}).o(function(){e.c||(e.c=n)})}(this),this.b.addListener(Bh("local"),this.a,g(this.g,this))}function qh(t,e){var n,r=[];for(n in Bu)Bu[n]!==e&&r.push(zu(t.b,Bh(Bu[n]),t.a));return r.push(zu(t.b,Vh,t.a)),function(a){return new ve(function(n,e){var r=a.length,i=[];if(r)for(var t=function(t,e){r--,i[t]=e,0==r&&n(i)},o=function(t){e(t)},s=0;s<a.length;s++)Te(a[s],m(t,s),o);else n(i)})}(r)}jh.prototype.g=function(){var e=this,n=Bh("local");Gh(this,function(){return Ee().then(function(){return e.c&&"local"!=e.c.F?e.b.get(n,e.a):null}).then(function(t){if(t)return qh(e,"local").then(function(){e.c=n})})})};var Vh={name:"persistence",F:"session"};function Bh(t){return{name:"authUser",F:t}}function Wh(t,e){return Gh(t,function(){return t.b.set(t.c,e.v(),t.a)})}function Hh(t){return Gh(t,function(){return zu(t.b,t.c,t.a)})}function Kh(t,e){return Gh(t,function(){return t.b.get(t.c,t.a).then(function(t){return t&&e&&(t.authDomain=e),Lh(t||{})})})}function Gh(t,e){return t.f=t.f.then(e,e),t.f}function zh(t){if(this.l=!1,Vr(this,"settings",new jc),Vr(this,"app",t),!el(this).options||!el(this).options.apiKey)throw new _("invalid-api-key");t=Kl.SDK_VERSION?wr(Kl.SDK_VERSION):null,this.b=new Bs(el(this).options&&el(this).options.apiKey,N(I),t),this.P=[],this.m=[],this.O=[],this.$b=Kl.INTERNAL.createSubscribe(g(this.xc,this)),this.W=void 0,this.ac=Kl.INTERNAL.createSubscribe(g(this.yc,this)),Zh(this,null),this.i=new jh(el(this).options.apiKey+":"+el(this).name),this.B=new Mh(el(this).options.apiKey+":"+el(this).name),this.Z=ol(this,function(n){var t=el(n).options.authDomain,e=function(e){var t=function(t,e){return t.b.get(Fh,t.a).then(function(t){return t&&e&&(t.authDomain=e),Lh(t||{})})}(e.B,el(e).options.authDomain).then(function(t){return(e.D=t)&&(t.ga=e.B),Uh(e.B)});return ol(e,t)}(n).then(function(){return Kh(n.i,t)}).then(function(e){return e?(e.ga=n.B,n.D&&(n.D.fa||null)==(e.fa||null)?e:e.reload().then(function(){return Wh(n.i,e).then(function(){return e})}).o(function(t){return"auth/network-request-failed"==t.code?e:Hh(n.i)})):null}).then(function(t){Zh(n,t||null)});return ol(n,e)}(this)),this.h=ol(this,function(e){return e.Z.then(function(){return Xh(e)}).o(function(){}).then(function(){if(!e.l)return e.oa()}).o(function(){}).then(function(){if(!e.l){e.aa=!0;var t=e.i;t.b.addListener(Bh("local"),t.a,e.oa)}})}(this)),this.aa=!1,this.oa=g(this.Xc,this),this.Ma=g(this.ca,this),this.xa=g(this.jc,this),this.ya=g(this.uc,this),this.za=g(this.vc,this),this.a=null,function(e){var n=el(e).options.authDomain,r=el(e).options.apiKey;n&&Ir()&&(e.Zb=e.Z.then(function(){if(!e.l){if(e.a=Dc(n,r,el(e).name),Ic(e.a,e),nl(e)&&gh(nl(e)),e.D){gh(e.D);var t=e.D;t.va(e.ja()),ch(t,e),hh(t=e.D,e.N),lh(t,e),e.D=null}return e.a}}))}(this),this.INTERNAL={},this.INTERNAL.delete=g(this.delete,this),this.INTERNAL.logFramework=g(this.Ec,this),this.s=0,dn.call(this),function(t){Object.defineProperty(t,"lc",{get:function(){return this.ja()},set:function(t){this.va(t)},enumerable:!1}),t.$=null,Object.defineProperty(t,"ti",{get:function(){return this.S()},set:function(t){this.ub(t)},enumerable:!1}),t.R=null}(this),this.N=[]}function Qh(t){We.call(this,"languageCodeChanged"),this.g=t}function Yh(t){We.call(this,"frameworkChanged"),this.c=t}function Jh(t){return t.Zb||Ie(new _("auth-domain-config-required"))}function Xh(t){if(!Ir())return Ie(new _("operation-not-supported-in-this-environment"));var e=Jh(t).then(function(){return t.a.pa()}).then(function(t){return t?Wr(t):null});return ol(t,e)}function $h(e,t){var n={};return n.apiKey=el(e).options.apiKey,n.authDomain=el(e).options.authDomain,n.appName=el(e).name,e.Z.then(function(){return function(t,e,n,r){var i=new uh(t,e);return n&&(i.ga=n),r&&hh(i,r),i.reload().then(function(){return i})}(n,t,e.B,e.Ea())}).then(function(t){return nl(e)&&t.uid==nl(e).uid?Sh(nl(e),t):(Zh(e,t),gh(t)),e.ca(t)}).then(function(){il(e)})}function Zh(t,e){nl(t)&&(function(t,e){H(t.R,function(t){return t==e})}(nl(t),t.Ma),on(nl(t),"tokenChanged",t.xa),on(nl(t),"userDeleted",t.ya),on(nl(t),"userInvalidated",t.za),dh(nl(t))),e&&(e.R.push(t.Ma),en(e,"tokenChanged",t.xa),en(e,"userDeleted",t.ya),en(e,"userInvalidated",t.za),0<t.s&&ph(e)),Vr(t,"currentUser",e),e&&(e.va(t.ja()),ch(e,t),hh(e,t.N),lh(e,t))}function tl(n,t){var e=null,r=null;return ol(n,t.then(function(t){return e=Ro(t),r=Vi(t),$h(n,t)},function(t){var e=null;throw t&&"auth/multi-factor-auth-required"===t.code&&(e=zc(t.v(),n,g(n.ic,n))),e||t}).then(function(){return Wr({user:nl(n),credential:e,additionalUserInfo:r,operationType:"signIn"})}))}function el(t){return t.app}function nl(t){return t.currentUser}function rl(t){return nl(t)&&nl(t)._lat||null}function il(t){if(t.aa){for(var e=0;e<t.m.length;e++)t.m[e]&&t.m[e](rl(t));if(t.W!==t.getUid()&&t.O.length)for(t.W=t.getUid(),e=0;e<t.O.length;e++)t.O[e]&&t.O[e](rl(t))}}function ol(t,e){return t.P.push(e),e.ma(function(){W(t.P,e)}),e}function sl(){}function al(){this.a={},this.b=1e12}jh.prototype.tb=function(e){var n=null,r=this;return function(t){var e=new _("invalid-persistence-type"),n=new _("unsupported-persistence-type");t:{for(r in Bu)if(Bu[r]==t){var r=!0;break t}r=!1}if(!r||"string"!=typeof t)throw e;switch(pr()){case"ReactNative":if("session"===t)throw n;break;case"Node":if("none"!==t)throw n;break;default:if(!Er()&&"none"!==t)throw n}}(e),Gh(this,function(){return e!=r.c.F?r.b.get(r.c,r.a).then(function(t){return n=t,qh(r,e)}).then(function(){if(r.c=Bh(e),n)return r.b.set(r.c,n,r.a)}):Ee()})},b(zh,dn),b(Qh,We),b(Yh,We),(t=zh.prototype).tb=function(t){return t=this.i.tb(t),ol(this,t)},t.va=function(t){this.$===t||this.l||(this.$=t,Ys(this.b,this.$),this.dispatchEvent(new Qh(this.ja())))},t.ja=function(){return this.$},t.dd=function(){var t=l.navigator;this.va(t&&(t.languages&&t.languages[0]||t.language||t.userLanguage)||null)},t.Ec=function(t){this.N.push(t),Js(this.b,Kl.SDK_VERSION?wr(Kl.SDK_VERSION,this.N):null),this.dispatchEvent(new Yh(this.N))},t.Ea=function(){return G(this.N)},t.ub=function(t){this.R===t||this.l||(this.R=t,this.b.b=this.R)},t.S=function(){return this.R},t.toJSON=function(){return{apiKey:el(this).options.apiKey,authDomain:el(this).options.authDomain,appName:el(this).name,currentUser:nl(this)&&nl(this).v()}},t.Cb=function(t,e){switch(t){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==e&&!!this.f;default:return!1}},t.la=function(t,e,n,r){"signInViaPopup"==t&&this.g==r&&(n&&this.w?this.w(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.w)},t.Da=function(t,e){return"signInViaRedirect"==t||"signInViaPopup"==t&&this.g==e&&this.f?g(this.gc,this):null},t.gc=function(t,e,n,r){var i=this,o={requestUri:t,postBody:r,sessionId:e,tenantId:n};return this.c&&(this.c.cancel(),this.c=null),i.Z.then(function(){return tl(i,ha(i.b,o))})},t.Vc=function(e){if(!Ir())return Ie(new _("operation-not-supported-in-this-environment"));var n=this,t=qi(e.providerId),r=Rr(),i=null;(!Cr()||lr())&&el(this).options.authDomain&&e.isOAuthProvider&&(i=uu(el(this).options.authDomain,el(this).options.apiKey,el(this).name,"signInViaPopup",e,null,r,Kl.SDK_VERSION||null,null,null,this.S()));var o=sr(i,t&&t.ta,t&&t.sa);return ol(this,t=Jh(this).then(function(t){return Nc(t,o,"signInViaPopup",e,r,!!i,n.S())}).then(function(){return new ve(function(t,e){n.la("signInViaPopup",null,new _("cancelled-popup-request"),n.g),n.f=t,n.w=e,n.g=r,n.c=Rc(n.a,n,"signInViaPopup",o,r)})}).then(function(t){return o&&or(o),t?Wr(t):null}).o(function(t){throw o&&or(o),t}))},t.Wc=function(t){if(!Ir())return Ie(new _("operation-not-supported-in-this-environment"));var e=this;return ol(this,Jh(this).then(function(){return function(t){return Gh(t,function(){return t.b.set(Vh,t.c.F,t.a)})}(e.i)}).then(function(){return kc(e.a,"signInViaRedirect",t,void 0,e.S())}))},t.pa=function(){var e=this;return Xh(this).then(function(t){return e.a&&Lc(e.a.b),t}).o(function(t){throw e.a&&Lc(e.a.b),t})},t.bd=function(t){if(!t)return Ie(new _("null-user"));if(this.R!=t.tenantId)return Ie(new _("tenant-id-mismatch"));var e=this,n={};n.apiKey=el(this).options.apiKey,n.authDomain=el(this).options.authDomain,n.appName=el(this).name;var r=function(t,e,n,r){var i=t.b,o={};return o[Hs]=i.b&&i.b.toString(),o.refreshToken=i.a,e=new uh(e||{apiKey:t.l,authDomain:t.s,appName:t.m},o),n&&(e.ga=n),r&&hh(e,r),Sh(e,t),e}(t,n,e.B,e.Ea());return ol(this,this.h.then(function(){if(el(e).options.apiKey!=t.l)return r.reload()}).then(function(){return nl(e)&&t.uid==nl(e).uid?(Sh(nl(e),t),e.ca(t)):(Zh(e,r),gh(r),e.ca(r))}).then(function(){il(e)}))},t.wb=function(){var t=this,e=this.h.then(function(){return t.a&&Lc(t.a.b),nl(t)?(Zh(t,null),Hh(t.i).then(function(){il(t)})):Ee()});return ol(this,e)},t.Xc=function(){var r=this;return Kh(this.i,el(this).options.authDomain).then(function(t){if(!r.l){var e;if(e=nl(r)&&t){e=nl(r).uid;var n=t.uid;e=null!=e&&""!==e&&null!=n&&""!==n&&e==n}if(e)return Sh(nl(r),t),nl(r).I();(nl(r)||t)&&(Zh(r,t),t&&(gh(t),t.ga=r.B),r.a&&Ic(r.a,r),il(r))}})},t.ca=function(t){return Wh(this.i,t)},t.jc=function(){il(this),this.ca(nl(this))},t.uc=function(){this.wb()},t.vc=function(){this.wb()},t.ic=function(t){var e=this;return this.h.then(function(){return tl(e,Ee(t))})},t.xc=function(t){var e=this;this.addAuthTokenListener(function(){t.next(nl(e))})},t.yc=function(t){var e=this;!function(t,e){t.O.push(e),ol(t,t.h.then(function(){!t.l&&B(t.O,e)&&t.W!==t.getUid()&&(t.W=t.getUid(),e(rl(t)))}))}(this,function(){t.next(nl(e))})},t.Gc=function(t,e,n){var r=this;return this.aa&&Promise.resolve().then(function(){d(t)?t(nl(r)):d(t.next)&&t.next(nl(r))}),this.$b(t,e,n)},t.Fc=function(t,e,n){var r=this;return this.aa&&Promise.resolve().then(function(){r.W=r.getUid(),d(t)?t(nl(r)):d(t.next)&&t.next(nl(r))}),this.ac(t,e,n)},t.kc=function(t){var e=this,n=this.h.then(function(){return nl(e)?nl(e).I(t).then(function(t){return{accessToken:t}}):null});return ol(this,n)},t.Rc=function(t){var n=this;return this.h.then(function(){return tl(n,za(n.b,Va,{token:t}))}).then(function(t){var e=t.user;return Th(e,"isAnonymous",!1),n.ca(e),t})},t.Sc=function(t,e){var n=this;return this.h.then(function(){return tl(n,za(n.b,Ba,{email:t,password:e}))})},t.cc=function(t,e){var n=this;return this.h.then(function(){return tl(n,za(n.b,ya,{email:t,password:e}))})},t.Ya=function(t){var e=this;return this.h.then(function(){return tl(e,t.ia(e.b))})},t.Qc=function(t){return jr("firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential is deprecated. Please use firebase.auth.Auth.prototype.signInWithCredential instead."),this.Ya(t)},t.vb=function(){var n=this;return this.h.then(function(){var t=nl(n);return t&&t.isAnonymous?Wr({user:t,credential:null,additionalUserInfo:Wr({providerId:null,isNewUser:!1}),operationType:"signIn"}):tl(n,n.b.vb()).then(function(t){var e=t.user;return Th(e,"isAnonymous",!0),n.ca(e),t})})},t.getUid=function(){return nl(this)&&nl(this).uid||null},t.bc=function(t){this.addAuthTokenListener(t),this.s++,0<this.s&&nl(this)&&ph(nl(this))},t.Nc=function(e){var n=this;U(this.m,function(t){t==e&&n.s--}),this.s<0&&(this.s=0),0==this.s&&nl(this)&&dh(nl(this)),this.removeAuthTokenListener(e)},t.addAuthTokenListener=function(t){var e=this;this.m.push(t),ol(this,this.h.then(function(){e.l||B(e.m,t)&&t(rl(e))}))},t.removeAuthTokenListener=function(e){H(this.m,function(t){return t==e})},t.delete=function(){this.l=!0;for(var t=0;t<this.P.length;t++)this.P[t].cancel("app-deleted");return this.P=[],this.i&&(t=this.i).b.removeListener(Bh("local"),t.a,this.oa),this.a&&(Tc(this.a,this),Lc(this.a.b)),Promise.resolve()},t.fc=function(t){return ol(this,function(t,e){return za(t,ga,{identifier:e,continueUri:Tr()?nr():"http://localhost"}).then(function(t){return t.signinMethods||[]})}(this.b,t))},t.zc=function(t){return!!To(t)},t.sb=function(e,n){var r=this;return ol(this,Ee().then(function(){var t=new _i(n);if(!t.c)throw new _("argument-error",Ti+" must be true when sending sign in link to email");return Oi(t)}).then(function(t){return r.b.sb(e,t)}).then(function(){}))},t.fd=function(t){return this.Pa(t).then(function(t){return t.data.email})},t.jb=function(t,e){return ol(this,this.b.jb(t,e).then(function(){}))},t.Pa=function(t){return ol(this,this.b.Pa(t).then(function(t){return new $r(t)}))},t.fb=function(t){return ol(this,this.b.fb(t).then(function(){}))},t.rb=function(e,t){var n=this;return ol(this,Ee().then(function(){return void 0===t||ut(t)?{}:Oi(new _i(t))}).then(function(t){return n.b.rb(e,t)}).then(function(){}))},t.Uc=function(t,e){return ol(this,Vc(this,t,e,g(this.Ya,this)))},t.Tc=function(n,r){var i=this;return ol(this,Ee().then(function(){var t=r||nr(),e=Io(n,t);if(!(t=To(t)))throw new _("argument-error","Invalid email link!");if(t.tenantId!==i.S())throw new _("tenant-id-mismatch");return i.Ya(e)}))},sl.prototype.render=function(){},sl.prototype.reset=function(){},sl.prototype.getResponse=function(){},sl.prototype.execute=function(){};var ul=null;function cl(t,e){return(e=hl(e))&&t.a[e]||null}function hl(t){return(t=void 0===t?1e12:t)?t.toString():null}function ll(t,e){this.g=!1,this.c=e,this.a=this.b=null,this.h="invisible"!==this.c.size,this.f=ee(t);var n=this;this.i=function(){n.execute()},this.h?this.execute():en(this.f,"click",this.i)}function fl(t){if(t.g)throw Error("reCAPTCHA mock was already deleted!")}function pl(){}function dl(){}al.prototype.render=function(t,e){return this.a[this.b.toString()]=new ll(t,e),this.b++},al.prototype.reset=function(t){var e=cl(this,t);t=hl(t),e&&t&&(e.delete(),delete this.a[t])},al.prototype.getResponse=function(t){return(t=cl(this,t))?t.getResponse():null},al.prototype.execute=function(t){(t=cl(this,t))&&t.execute()},ll.prototype.getResponse=function(){return fl(this),this.b},ll.prototype.execute=function(){fl(this);var n=this;this.a||(this.a=setTimeout(function(){n.b=function(){for(var t=50,e=[];0<t;)e.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),t--;return e.join("")}();var t=n.c.callback,e=n.c["expired-callback"];if(t)try{t(n.b)}catch(t){}n.a=setTimeout(function(){if(n.a=null,n.b=null,e)try{e()}catch(t){}n.h&&n.execute()},6e4)},500))},ll.prototype.delete=function(){fl(this),this.g=!0,clearTimeout(this.a),this.a=null,on(this.f,"click",this.i)},Vr(pl,"FACTOR_ID","phone"),dl.prototype.g=function(){return Ee(ul=ul||new al)},dl.prototype.c=function(){};var vl=null;function yl(){this.b=l.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var gl=new pt(yt,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),ml=new Pr(3e4,6e4);yl.prototype.g=function(i){var o=this;return new ve(function(t,e){var r=setTimeout(function(){e(new _("network-request-failed"))},ml.get());!l.grecaptcha||i!==o.f&&!o.b?(l[o.a]=function(){if(l.grecaptcha){o.f=i;var n=l.grecaptcha.render;l.grecaptcha.render=function(t,e){return t=n(t,e),o.b++,t},clearTimeout(r),t(l.grecaptcha)}else clearTimeout(r),e(new _("internal-error"));delete l[o.a]},Ee(Ls(bt(gl,{onload:o.a,hl:i||""}))).o(function(){clearTimeout(r),e(new _("internal-error","Unable to load external reCAPTCHA dependencies!"))})):(clearTimeout(r),t(l.grecaptcha))})},yl.prototype.c=function(){this.b--};var wl=null;function bl(t,e,n,r,i,o,s){if(Vr(this,"type","recaptcha"),this.c=this.f=null,this.D=!1,this.u=e,this.g=null,s=s?vl=vl||new dl:wl=wl||new yl,this.m=s,this.a=n||{theme:"light",type:"image"},this.h=[],this.a[Il])throw new _("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i="invisible"===this.a[Tl],!l.document)throw new _("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!ee(e)||!this.i&&ee(e).hasChildNodes())throw new _("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.s=new Bs(t,o||null,i||null),this.w=r||function(){return null};var a=this;this.l=[];var u=this.a[_l];this.a[_l]=function(t){if(Sl(a,t),"function"==typeof u)u(t);else if("string"==typeof u){var e=_r(u,l);"function"==typeof e&&e(t)}};var c=this.a[El];this.a[El]=function(){if(Sl(a,null),"function"==typeof c)c();else if("string"==typeof c){var t=_r(c,l);"function"==typeof t&&t()}}}var _l="callback",El="expired-callback",Il="sitekey",Tl="size";function Sl(t,e){for(var n=0;n<t.l.length;n++)try{t.l[n](e)}catch(t){}}function Cl(t,e){return t.h.push(e),e.ma(function(){W(t.h,e)}),e}function Nl(t){if(t.D)throw new _("internal-error","RecaptchaVerifier instance has been destroyed.")}function Al(t,e,n){var r=!1;try{this.b=n||Kl.app()}catch(t){throw new _("argument-error","No firebase.app.App instance is currently initialized.")}if(!this.b.options||!this.b.options.apiKey)throw new _("invalid-api-key");n=this.b.options.apiKey;var i=this,o=null;try{o=this.b.auth().Ea()}catch(t){}try{r=this.b.auth().settings.appVerificationDisabledForTesting}catch(t){}o=Kl.SDK_VERSION?wr(Kl.SDK_VERSION,o):null,bl.call(this,n,t,e,function(){try{var e=i.b.auth().ja()}catch(t){e=null}return e},o,N(I),r)}function kl(t,e,n,r){t:{n=Array.prototype.slice.call(n);for(var i=0,o=!1,s=0;s<e.length;s++)if(e[s].optional)o=!0;else{if(o)throw new _("internal-error","Argument validator encountered a required argument after an optional argument.");i++}if(o=e.length,n.length<i||o<n.length)r="Expected "+(i==o?1==i?"1 argument":i+" arguments":i+"-"+o+" arguments")+" but got "+n.length+".";else{for(i=0;i<n.length;i++)if(o=e[i].optional&&void 0===n[i],!e[i].K(n[i])&&!o){if(e=e[i],i<0||i>=Rl.length)throw new _("internal-error","Argument validator received an unsupported number of arguments.");n=Rl[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.J+".";break t}r=null}}if(r)throw new _("argument-error",t+" failed: "+r)}(t=bl.prototype).Ga=function(){var e=this;return this.f?this.f:this.f=Cl(this,Ee().then(function(){if(Tr()&&!fr())return cr();throw new _("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return e.m.g(e.w())}).then(function(t){return e.g=t,za(e.s,Ra,{})}).then(function(t){e.a[Il]=t.recaptchaSiteKey}).o(function(t){throw e.f=null,t}))},t.render=function(){Nl(this);var n=this;return Cl(this,this.Ga().then(function(){if(null===n.c){var t=n.u;if(!n.i){var e=ee(t);t=se("DIV"),e.appendChild(t)}n.c=n.g.render(t,n.a)}return n.c}))},t.verify=function(){Nl(this);var i=this;return Cl(this,this.render().then(function(r){return new ve(function(e){var t=i.g.getResponse(r);if(t)e(t);else{var n=function(t){t&&(function(t,e){H(t.l,function(t){return t==e})}(i,n),e(t))};i.l.push(n),i.i&&i.g.execute(i.c)}})}))},t.reset=function(){Nl(this),null!==this.c&&this.g.reset(this.c)},t.clear=function(){Nl(this),this.D=!0,this.m.c();for(var t=0;t<this.h.length;t++)this.h[t].cancel("RecaptchaVerifier instance has been destroyed.");if(!this.i){t=ee(this.u);for(var e;e=t.firstChild;)t.removeChild(e)}},b(Al,bl);var Rl="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function Ol(t,e){return{name:t||"",J:"a valid string",optional:!!e,K:function(t){return"string"==typeof t}}}function Dl(t,e){return{name:t||"",J:"a boolean",optional:!!e,K:function(t){return"boolean"==typeof t}}}function Pl(t,e){return{name:t||"",J:"a valid object",optional:!!e,K:v}}function xl(t,e){return{name:t||"",J:"a function",optional:!!e,K:d}}function Ll(t,e){return{name:t||"",J:"null",optional:!!e,K:function(t){return null===t}}}function Ml(n){return{name:n?n+"Credential":"credential",J:n?"a valid "+n+" credential":"a valid credential",optional:!1,K:function(t){if(!t)return!1;var e=!n||t.providerId===n;return!(!t.ia||!e)}}}function Fl(t,e){return v(t)&&"string"==typeof t.type&&t.type===e&&d(t.Fa)}function Ul(t){return v(t)&&"string"==typeof t.uid}function jl(){return{name:"applicationVerifier",J:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,K:function(t){return!(!t||"string"!=typeof t.type||!d(t.verify))}}}function ql(e,n,t,r){return{name:t||"",J:e.J+" or "+n.J,optional:!!r,K:function(t){return e.K(t)||n.K(t)}}}function Vl(t,e){for(var n in e){var r=e[n].name;t[r]=Hl(r,t[n],e[n].j)}}function Bl(t,e){for(var n in e){var r=e[n].name;r!==n&&Object.defineProperty(t,r,{get:m(function(t){return this[t]},n),set:m(function(t,e,n,r){kl(t,[n],[r],!0),this[e]=r},r,n,e[n].gb),enumerable:!0})}}function Wl(t,e,n,r){t[e]=Hl(e,n,r)}function Hl(t,e,n){function r(){var t=Array.prototype.slice.call(arguments);return kl(o,n,t),e.apply(this,t)}if(!n)return e;var i,o=function(t){return(t=t.split("."))[t.length-1]}(t);for(i in e)r[i]=e[i];for(i in e.prototype)r.prototype[i]=e.prototype[i];return r}Vl(zh.prototype,{fb:{name:"applyActionCode",j:[Ol("code")]},Pa:{name:"checkActionCode",j:[Ol("code")]},jb:{name:"confirmPasswordReset",j:[Ol("code"),Ol("newPassword")]},cc:{name:"createUserWithEmailAndPassword",j:[Ol("email"),Ol("password")]},fc:{name:"fetchSignInMethodsForEmail",j:[Ol("email")]},pa:{name:"getRedirectResult",j:[]},zc:{name:"isSignInWithEmailLink",j:[Ol("emailLink")]},Fc:{name:"onAuthStateChanged",j:[ql(Pl(),xl(),"nextOrObserver"),xl("opt_error",!0),xl("opt_completed",!0)]},Gc:{name:"onIdTokenChanged",j:[ql(Pl(),xl(),"nextOrObserver"),xl("opt_error",!0),xl("opt_completed",!0)]},rb:{name:"sendPasswordResetEmail",j:[Ol("email"),ql(Pl("opt_actionCodeSettings",!0),Ll(null,!0),"opt_actionCodeSettings",!0)]},sb:{name:"sendSignInLinkToEmail",j:[Ol("email"),Pl("actionCodeSettings")]},tb:{name:"setPersistence",j:[Ol("persistence")]},Qc:{name:"signInAndRetrieveDataWithCredential",j:[Ml()]},vb:{name:"signInAnonymously",j:[]},Ya:{name:"signInWithCredential",j:[Ml()]},Rc:{name:"signInWithCustomToken",j:[Ol("token")]},Sc:{name:"signInWithEmailAndPassword",j:[Ol("email"),Ol("password")]},Tc:{name:"signInWithEmailLink",j:[Ol("email"),Ol("emailLink",!0)]},Uc:{name:"signInWithPhoneNumber",j:[Ol("phoneNumber"),jl()]},Vc:{name:"signInWithPopup",j:[{name:"authProvider",J:"a valid Auth provider",optional:!1,K:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},Wc:{name:"signInWithRedirect",j:[{name:"authProvider",J:"a valid Auth provider",optional:!1,K:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},bd:{name:"updateCurrentUser",j:[ql({name:"user",J:"an instance of Firebase User",optional:!1,K:function(t){return!!(t&&t instanceof uh)}},Ll(),"user")]},wb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[Ol(null,!0)]},dd:{name:"useDeviceLanguage",j:[]},fd:{name:"verifyPasswordResetCode",j:[Ol("code")]}}),Bl(zh.prototype,{lc:{name:"languageCode",gb:ql(Ol(),Ll(),"languageCode")},ti:{name:"tenantId",gb:ql(Ol(),Ll(),"tenantId")}}),(zh.Persistence=Bu).LOCAL="local",zh.Persistence.SESSION="session",zh.Persistence.NONE="none",Vl(uh.prototype,{delete:{name:"delete",j:[]},mc:{name:"getIdTokenResult",j:[Dl("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[Dl("opt_forceRefresh",!0)]},Ac:{name:"linkAndRetrieveDataWithCredential",j:[Ml()]},mb:{name:"linkWithCredential",j:[Ml()]},Bc:{name:"linkWithPhoneNumber",j:[Ol("phoneNumber"),jl()]},Cc:{name:"linkWithPopup",j:[{name:"authProvider",J:"a valid Auth provider",optional:!1,K:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},Dc:{name:"linkWithRedirect",j:[{name:"authProvider",J:"a valid Auth provider",optional:!1,K:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},Jc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[Ml()]},pb:{name:"reauthenticateWithCredential",j:[Ml()]},Kc:{name:"reauthenticateWithPhoneNumber",j:[Ol("phoneNumber"),jl()]},Lc:{name:"reauthenticateWithPopup",j:[{name:"authProvider",J:"a valid Auth provider",optional:!1,K:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},Mc:{name:"reauthenticateWithRedirect",j:[{name:"authProvider",J:"a valid Auth provider",optional:!1,K:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},reload:{name:"reload",j:[]},qb:{name:"sendEmailVerification",j:[ql(Pl("opt_actionCodeSettings",!0),Ll(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[Ol(null,!0)]},ad:{name:"unlink",j:[Ol("provider")]},xb:{name:"updateEmail",j:[Ol("email")]},yb:{name:"updatePassword",j:[Ol("password")]},cd:{name:"updatePhoneNumber",j:[Ml("phone")]},zb:{name:"updateProfile",j:[Pl("profile")]},Ab:{name:"verifyBeforeUpdateEmail",j:[Ol("email"),ql(Pl("opt_actionCodeSettings",!0),Ll(null,!0),"opt_actionCodeSettings",!0)]}}),Vl(al.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Vl(sl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Vl(ve.prototype,{ma:{name:"finally"},o:{name:"catch"},then:{name:"then"}}),Bl(jc.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",gb:Dl("appVerificationDisabledForTesting")}}),Vl(qc.prototype,{confirm:{name:"confirm",j:[Ol("verificationCode")]}}),Wl(to,"fromJSON",function(t){t="string"==typeof t?JSON.parse(t):t;for(var e,n=[ao,_o,Co,io],r=0;r<n.length;r++)if(e=n[r](t))return e;return null},[ql(Ol(),Pl(),"json")]),Wl(Eo,"credential",function(t,e){return new bo(t,e)},[Ol("email"),Ol("password")]),Vl(bo.prototype,{v:{name:"toJSON",j:[Ol(null,!0)]}}),Vl(lo.prototype,{Aa:{name:"addScope",j:[Ol("scope")]},Ia:{name:"setCustomParameters",j:[Pl("customOAuthParameters")]}}),Wl(lo,"credential",fo,[ql(Ol(),Pl(),"token")]),Wl(Eo,"credentialWithLink",Io,[Ol("email"),Ol("emailLink")]),Vl(po.prototype,{Aa:{name:"addScope",j:[Ol("scope")]},Ia:{name:"setCustomParameters",j:[Pl("customOAuthParameters")]}}),Wl(po,"credential",vo,[ql(Ol(),Pl(),"token")]),Vl(yo.prototype,{Aa:{name:"addScope",j:[Ol("scope")]},Ia:{name:"setCustomParameters",j:[Pl("customOAuthParameters")]}}),Wl(yo,"credential",go,[ql(Ol(),ql(Pl(),Ll()),"idToken"),ql(Ol(),Ll(),"accessToken",!0)]),Vl(mo.prototype,{Ia:{name:"setCustomParameters",j:[Pl("customOAuthParameters")]}}),Wl(mo,"credential",wo,[ql(Ol(),Pl(),"token"),Ol("secret",!0)]),Vl(ho.prototype,{Aa:{name:"addScope",j:[Ol("scope")]},credential:{name:"credential",j:[ql(Ol(),ql(Pl(),Ll()),"optionsOrIdToken"),ql(Ol(),Ll(),"accessToken",!0)]},Ia:{name:"setCustomParameters",j:[Pl("customOAuthParameters")]}}),Vl(oo.prototype,{v:{name:"toJSON",j:[Ol(null,!0)]}}),Vl(no.prototype,{v:{name:"toJSON",j:[Ol(null,!0)]}}),Wl(Ao,"credential",ko,[Ol("verificationId"),Ol("verificationCode")]),Vl(Ao.prototype,{cb:{name:"verifyPhoneNumber",j:[ql(Ol(),{name:"phoneInfoOptions",J:"valid phone info options",optional:!1,K:function(t){return!!t&&(t.session&&t.phoneNumber?Fl(t.session,$i)&&"string"==typeof t.phoneNumber:t.session&&t.multiFactorHint?Fl(t.session,Zi)&&Ul(t.multiFactorHint):t.session&&t.multiFactorUid?Fl(t.session,Zi)&&"string"==typeof t.multiFactorUid:!!t.phoneNumber&&"string"==typeof t.phoneNumber)}},"phoneInfoOptions"),jl()]}}),Vl(So.prototype,{v:{name:"toJSON",j:[Ol(null,!0)]}}),Vl(_.prototype,{toJSON:{name:"toJSON",j:[Ol(null,!0)]}}),Vl(Uo.prototype,{toJSON:{name:"toJSON",j:[Ol(null,!0)]}}),Vl(Fo.prototype,{toJSON:{name:"toJSON",j:[Ol(null,!0)]}}),Vl(Gc.prototype,{toJSON:{name:"toJSON",j:[Ol(null,!0)]}}),Vl(Wc.prototype,{Pc:{name:"resolveSignIn",j:[{name:"multiFactorAssertion",J:"a valid multiFactorAssertion",optional:!1,K:function(t){return!!t&&!!t.ob}}]}}),Vl($c.prototype,{Ob:{name:"getSession",j:[]},dc:{name:"enroll",j:[{name:"multiFactorAssertion",J:"a valid multiFactorAssertion",optional:!1,K:function(t){return!!t&&!!t.ob}},Ol("displayName",!0)]},$c:{name:"unenroll",j:[ql({name:"multiFactorInfo",J:"a valid multiFactorInfo",optional:!1,K:Ul},Ol(),"multiFactorInfoIdentifier")]}}),Vl(Al.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}),Wl(fi,"parseLink",bi,[Ol("link")]),Wl(pl,"assertion",function(t){return new Jc(t)},[Ml("phone")]),function(){if(void 0===Kl||!Kl.INTERNAL||!Kl.INTERNAL.registerComponent)throw Error("Cannot find the firebase namespace; be sure to include firebase-app.js before this library.");var t={ActionCodeInfo:{Operation:{EMAIL_SIGNIN:ti,PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:Zr,VERIFY_AND_CHANGE_EMAIL:ei,VERIFY_EMAIL:"VERIFY_EMAIL"}},Auth:zh,AuthCredential:to,Error:_};Wl(t,"EmailAuthProvider",Eo,[]),Wl(t,"FacebookAuthProvider",lo,[]),Wl(t,"GithubAuthProvider",po,[]),Wl(t,"GoogleAuthProvider",yo,[]),Wl(t,"TwitterAuthProvider",mo,[]),Wl(t,"OAuthProvider",ho,[Ol("providerId")]),Wl(t,"SAMLAuthProvider",co,[Ol("providerId")]),Wl(t,"PhoneAuthProvider",Ao,[{name:"auth",J:"an instance of Firebase Auth",optional:!0,K:function(t){return!!(t&&t instanceof zh)}}]),Wl(t,"RecaptchaVerifier",Al,[ql(Ol(),{name:"",J:"an HTML element",optional:!1,K:function(t){return!!(t&&t instanceof Element)}},"recaptchaContainer"),Pl("recaptchaParameters",!0),{name:"app",J:"an instance of Firebase App",optional:!0,K:function(t){return!!(t&&t instanceof Kl.app.App)}}]),Wl(t,"ActionCodeURL",fi,[]),Wl(t,"PhoneMultiFactorGenerator",pl,[]),Kl.INTERNAL.registerComponent({name:"auth",instanceFactory:function(t){return new zh(t=t.getProvider("app").getImmediate())},multipleInstances:!1,serviceProps:t,instantiationMode:"LAZY",type:"PUBLIC"}),Kl.INTERNAL.registerComponent({name:"auth-internal",instanceFactory:function(t){return{getUid:g((t=t.getProvider("auth").getImmediate()).getUid,t),getToken:g(t.kc,t),addAuthTokenListener:g(t.bc,t),removeAuthTokenListener:g(t.Nc,t)}},multipleInstances:!1,instantiationMode:"LAZY",type:"PRIVATE"}),Kl.registerVersion("@firebase/auth","0.14.1"),Kl.INTERNAL.extendNamespace({User:uh})}()}).apply("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var $a=(Za.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),Xs(e))},Za.prototype.get=function(t){var e=this.domStorage_.getItem(this.prefixedName_(t));return null==e?null:Js(e)},Za.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},Za.prototype.prefixedName_=function(t){return this.prefix_+t},Za.prototype.toString=function(){return this.domStorage_.toString()},Za);function Za(t){this.domStorage_=t,this.prefix_="firebase:"}var tu=(eu.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},eu.prototype.get=function(t){return Zs(this.cache_,t)?this.cache_[t]:null},eu.prototype.remove=function(t){delete this.cache_[t]},eu);function eu(){this.cache_={},this.isInMemoryStorage=!0}function nu(t){try{if("undefined"!=typeof window&&void 0!==window[t]){var e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new $a(e)}}catch(t){}return new tu}function ru(t){var e=function(t){for(var e=[],n=0,r=0;r<t.length;r++){var i=t.charCodeAt(r);if(55296<=i&&i<=56319){var o=i-55296;Ps(++r<t.length,"Surrogate pair missing trail surrogate."),i=65536+(o<<10)+(t.charCodeAt(r)-56320)}i<128?e[n++]=i:(i<2048?e[n++]=i>>6|192:(i<65536?e[n++]=i>>12|224:(e[n++]=i>>18|240,e[n++]=i>>12&63|128),e[n++]=i>>6&63|128),e[n++]=63&i|128)}return e}(t),n=new ra;n.update(e);var r=n.digest();return Ls.encodeByteArray(r)}function iu(t,e){Ps(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(gu.logLevel=Ia.VERBOSE,bu=gu.log.bind(gu),e&&yu.set("logging_enabled",!0)):"function"==typeof t?bu=t:(bu=null,yu.remove("logging_enabled"))}function ou(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!0===_u&&(_u=!1,null===bu&&!0===yu.get("logging_enabled")&&iu(!0)),bu){var n=wu.apply(null,t);bu(n)}}function su(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];ou.apply(void 0,As([n],t))}}function au(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE INTERNAL ERROR: "+wu.apply(void 0,As(t));gu.error(n)}function uu(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE FATAL ERROR: "+wu.apply(void 0,As(t));throw gu.error(n),new Error(n)}function cu(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE WARNING: "+wu.apply(void 0,As(t));gu.warn(n)}function hu(t){return"number"==typeof t&&(t!=t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)}function lu(t,e){return t===e?0:t<e?-1:1}function fu(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+Xs(e))}function pu(t,e){var n=t.length;if(n<=e)return[t];for(var r=[],i=0;i<n;i+=e)n<i+e?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r}var du,vu=nu("localStorage"),yu=nu("sessionStorage"),gu=new Oa("@firebase/database"),mu=(du=1,function(){return du++}),wu=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n="",r=0;r<t.length;r++){var i=t[r];Array.isArray(i)||i&&"object"==typeof i&&"number"==typeof i.length?n+=wu.apply(null,i):n+="object"==typeof i?Xs(i):i,n+=" "}return n},bu=null,_u=!0,Eu="[MIN_NAME]",Iu="[MAX_NAME]",Tu=function(t,e){if(t===e)return 0;if(t===Eu||e===Iu)return-1;if(e===Eu||t===Iu)return 1;var n=Ou(t),r=Ou(e);return null!==n?null!==r?n-r==0?t.length-e.length:n-r:-1:null!==r?1:t<e?-1:1},Su=function(t){if("object"!=typeof t||null===t)return Xs(t);var e=[];for(var n in t)e.push(n);e.sort();for(var r="{",i=0;i<e.length;i++)0!==i&&(r+=","),r+=Xs(e[i]),r+=":",r+=Su(t[e[i]]);return r+="}"};function Cu(t,e){for(var n in t)t.hasOwnProperty(n)&&e(n,t[n])}function Nu(t){var e,n,r,i,o;Ps(!hu(t),"Invalid JSON number"),0===t?e=1/t==-1/(r=n=0)?1:0:(e=t<0,r=(t=Math.abs(t))>=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023))+1023,Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,Math.round(t/Math.pow(2,-1074))));var s=[];for(o=52;o;o-=1)s.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;o-=1)s.push(n%2?1:0),n=Math.floor(n/2);s.push(e?1:0),s.reverse();var a=s.join(""),u="";for(o=0;o<64;o+=8){var c=parseInt(a.substr(o,8),2).toString(16);1===c.length&&(c="0"+c),u+=c}return u.toLowerCase()}function Au(t){try{t()}catch(e){setTimeout(function(){var t=e.stack||"";throw cu("Exception was thrown by user callback.",t),e},Math.floor(0))}}function ku(t,e){var n=setTimeout(t,e);return"object"==typeof n&&n.unref&&n.unref(),n}var Ru=new RegExp("^-?(0*)\\d{1,10}$"),Ou=function(t){if(Ru.test(t)){var e=Number(t);if(-2147483648<=e&&e<=2147483647)return e}return null},Du=(Object.defineProperty(Pu,"Empty",{get:function(){return new Pu("")},enumerable:!0,configurable:!0}),Pu.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},Pu.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},Pu.prototype.popFront=function(){var t=this.pieceNum_;return t<this.pieces_.length&&t++,new Pu(this.pieces_,t)},Pu.prototype.getBack=function(){return this.pieceNum_<this.pieces_.length?this.pieces_[this.pieces_.length-1]:null},Pu.prototype.toString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"},Pu.prototype.toUrlEncodedString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+encodeURIComponent(String(this.pieces_[e])));return t||"/"},Pu.prototype.slice=function(t){return void 0===t&&(t=0),this.pieces_.slice(this.pieceNum_+t)},Pu.prototype.parent=function(){if(this.pieceNum_>=this.pieces_.length)return null;for(var t=[],e=this.pieceNum_;e<this.pieces_.length-1;e++)t.push(this.pieces_[e]);return new Pu(t,0)},Pu.prototype.child=function(t){for(var e=[],n=this.pieceNum_;n<this.pieces_.length;n++)e.push(this.pieces_[n]);if(t instanceof Pu)for(n=t.pieceNum_;n<t.pieces_.length;n++)e.push(t.pieces_[n]);else{var r=t.split("/");for(n=0;n<r.length;n++)0<r[n].length&&e.push(r[n])}return new Pu(e,0)},Pu.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},Pu.relativePath=function(t,e){var n=t.getFront(),r=e.getFront();if(null===n)return e;if(n===r)return Pu.relativePath(t.popFront(),e.popFront());throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")},Pu.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;i<n.length&&i<r.length;i++){var o=Tu(n[i],r[i]);if(0!==o)return o}return n.length===r.length?0:n.length<r.length?-1:1},Pu.prototype.equals=function(t){if(this.getLength()!==t.getLength())return!1;for(var e=this.pieceNum_,n=t.pieceNum_;e<=this.pieces_.length;e++,n++)if(this.pieces_[e]!==t.pieces_[n])return!1;return!0},Pu.prototype.contains=function(t){var e=this.pieceNum_,n=t.pieceNum_;if(this.getLength()>t.getLength())return!1;for(;e<this.pieces_.length;){if(this.pieces_[e]!==t.pieces_[n])return!1;++e,++n}return!0},Pu);function Pu(t,e){if(void 0===e){this.pieces_=t.split("/");for(var n=0,r=0;r<this.pieces_.length;r++)0<this.pieces_[r].length&&(this.pieces_[n]=this.pieces_[r],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=e}var xu=(Object.defineProperty(Lu,"MAX_PATH_DEPTH",{get:function(){return 32},enumerable:!0,configurable:!0}),Object.defineProperty(Lu,"MAX_PATH_LENGTH_BYTES",{get:function(){return 768},enumerable:!0,configurable:!0}),Lu.prototype.push=function(t){0<this.parts_.length&&(this.byteLength_+=1),this.parts_.push(t),this.byteLength_+=pa(t),this.checkValid_()},Lu.prototype.pop=function(){var t=this.parts_.pop();this.byteLength_-=pa(t),0<this.parts_.length&&(this.byteLength_-=1)},Lu.prototype.checkValid_=function(){if(this.byteLength_>Lu.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+Lu.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>Lu.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Lu.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},Lu.prototype.toErrorString=function(){return 0===this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},Lu);function Lu(t,e){this.errorPrefix_=e,this.parts_=t.slice(),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n<this.parts_.length;n++)this.byteLength_+=pa(this.parts_[n]);this.checkValid_()}var Mu="firebaseio.com",Fu="websocket",Uu="long_polling",ju=(qu.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()||this.includeNamespaceInQueryParams},qu.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},qu.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},qu.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},qu.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&vu.set("host:"+this.host,this.internalHost))},qu.prototype.connectionURL=function(t,e){var n;if(Ps("string"==typeof t,"typeof type must == string"),Ps("object"==typeof e,"typeof params must == object"),t===Fu)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(t!==Uu)throw new Error("Unknown connection type: "+t);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(e.ns=this.namespace);var r=[];return Cu(e,function(t,e){r.push(t+"="+e)}),n+r.join("&")},qu.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},qu.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},qu);function qu(t,e,n,r,i,o){void 0===i&&(i=""),void 0===o&&(o=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.persistenceKey=i,this.includeNamespaceInQueryParams=o,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=vu.get("host:"+t)||this.host}function Vu(t){var e=Zu(t),n=e.namespace;"firebase"===e.domain&&uu(e.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),n&&"undefined"!==n||"localhost"===e.domain||uu("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),e.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&cu("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");var r="ws"===e.scheme||"wss"===e.scheme;return{repoInfo:new ju(e.host,e.secure,n,r,"",n!==e.subdomain),path:new Du(e.pathString)}}function Bu(t){return"string"==typeof t&&0!==t.length&&!tc.test(t)}function Wu(t){return"string"==typeof t&&0!==t.length&&!ec.test(t)}function Hu(t){return null===t||"string"==typeof t||"number"==typeof t&&!hu(t)||t&&"object"==typeof t&&Zs(t,".sv")}function Ku(t,e,n,r,i){i&&void 0===n||rc(ha(t,e,i),n,r)}function Gu(t,e,n,r,i){if(!i||void 0!==n){var o=ha(t,e,i);if(!n||"object"!=typeof n||Array.isArray(n))throw new Error(o+" must be an object containing the children to replace.");var s=[];Cu(n,function(t,e){var n=new Du(t);if(rc(o,e,r.child(n)),".priority"===n.getBack()&&!Hu(e))throw new Error(o+"contains an invalid value for '"+n.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");s.push(n)}),function(t,e){var n,r;for(n=0;n<e.length;n++)for(var i=(r=e[n]).slice(),o=0;o<i.length;o++)if(".priority"===i[o]&&o===i.length-1);else if(!Bu(i[o]))throw new Error(t+"contains an invalid key ("+i[o]+") in path "+r.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');e.sort(Du.comparePaths);var s=null;for(n=0;n<e.length;n++){if(r=e[n],null!==s&&s.contains(r))throw new Error(t+"contains a path "+s.toString()+" that is ancestor of another path "+r.toString());s=r}}(o,s)}}function zu(t,e,n,r){if(!r||void 0!==n){if(hu(n))throw new Error(ha(t,e,r)+"is "+n.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!Hu(n))throw new Error(ha(t,e,r)+"must be a valid Firebase priority (a string, finite number, server value, or null).")}}function Qu(t,e,n,r){if(!r||void 0!==n)switch(n){case"value":case"child_added":case"child_removed":case"child_changed":case"child_moved":break;default:throw new Error(ha(t,e,r)+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}}function Yu(t,e,n,r){if(!(r&&void 0===n||Bu(n)))throw new Error(ha(t,e,r)+'was an invalid key = "'+n+'". Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')}function Ju(t,e,n,r){if(!(r&&void 0===n||Wu(n)))throw new Error(ha(t,e,r)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')}function Xu(t,e){if(".info"===e.getFront())throw new Error(t+" failed = Can't modify data under /.info/")}function $u(t,e,n){var r=n.path.toString();if("string"!=typeof n.repoInfo.host||0===n.repoInfo.host.length||!Bu(n.repoInfo.namespace)&&"localhost"!==n.repoInfo.host.split(":")[0]||0!==r.length&&!function(t){return t=t&&t.replace(/^\/*\.info(\/|$)/,"/"),Wu(t)}(r))throw new Error(ha(t,e,!1)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')}var Zu=function(t){var e="",n="",r="",i="",o="",s=!0,a="https",u=443;if("string"==typeof t){var c=t.indexOf("//");0<=c&&(a=t.substring(0,c-1),t=t.substring(c+2));var h=t.indexOf("/");-1===h&&(h=t.length);var l=t.indexOf("?");-1===l&&(l=t.length),e=t.substring(0,Math.min(h,l)),h<l&&(i=function(t){for(var e="",n=t.split("/"),r=0;r<n.length;r++)if(0<n[r].length){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(t){}e+="/"+i}return e}(t.substring(h,l)));var f=function(t){var e,n,r={};"?"===t.charAt(0)&&(t=t.substring(1));try{for(var i=Cs(t.split("&")),o=i.next();!o.done;o=i.next()){var s=o.value;if(0!==s.length){var a=s.split("=");2===a.length?r[decodeURIComponent(a[0])]=decodeURIComponent(a[1]):cu("Invalid query segment '"+s+"' in query '"+t+"'")}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}(t.substring(Math.min(t.length,l)));0<=(c=e.indexOf(":"))?(s="https"===a||"wss"===a,u=parseInt(e.substring(c+1),10)):c=t.length;var p=e.split(".");3===p.length?(n=p[1],o=r=p[0].toLowerCase()):2===p.length?n=p[0]:"localhost"===p[0].slice(0,c).toLowerCase()&&(n="localhost"),"ns"in f&&(o=f.ns)}return{host:e,port:u,domain:n,subdomain:r,secure:s,scheme:a,pathString:i,namespace:o}},tc=/[\[\].#$\/\u0000-\u001F\u007F]/,ec=/[\[\].#$\u0000-\u001F\u007F]/,nc=10485760,rc=function(n,t,e){var r=e instanceof Du?new xu(e,n):e;if(void 0===t)throw new Error(n+"contains undefined "+r.toErrorString());if("function"==typeof t)throw new Error(n+"contains a function "+r.toErrorString()+" with contents = "+t.toString());if(hu(t))throw new Error(n+"contains "+t.toString()+" "+r.toErrorString());if("string"==typeof t&&t.length>nc/3&&pa(t)>nc)throw new Error(n+"contains a string greater than "+nc+" utf8 bytes "+r.toErrorString()+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){var i=!1,o=!1;if(Cu(t,function(t,e){if(".value"===t)i=!0;else if(".priority"!==t&&".sv"!==t&&(o=!0,!Bu(t)))throw new Error(n+" contains an invalid key ("+t+") "+r.toErrorString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');r.push(t),rc(n,e,r),r.pop()}),i&&o)throw new Error(n+' contains ".value" child '+r.toErrorString()+" in addition to actual children.")}},ic=(oc.prototype.cancel=function(t){ca("OnDisconnect.cancel",0,1,arguments.length),la("OnDisconnect.cancel",1,t,!0);var e=new Us;return this.repo_.onDisconnectCancel(this.path_,e.wrapCallback(t)),e.promise},oc.prototype.remove=function(t){ca("OnDisconnect.remove",0,1,arguments.length),Xu("OnDisconnect.remove",this.path_),la("OnDisconnect.remove",1,t,!0);var e=new Us;return this.repo_.onDisconnectSet(this.path_,null,e.wrapCallback(t)),e.promise},oc.prototype.set=function(t,e){ca("OnDisconnect.set",1,2,arguments.length),Xu("OnDisconnect.set",this.path_),Ku("OnDisconnect.set",1,t,this.path_,!1),la("OnDisconnect.set",2,e,!0);var n=new Us;return this.repo_.onDisconnectSet(this.path_,t,n.wrapCallback(e)),n.promise},oc.prototype.setWithPriority=function(t,e,n){ca("OnDisconnect.setWithPriority",2,3,arguments.length),Xu("OnDisconnect.setWithPriority",this.path_),Ku("OnDisconnect.setWithPriority",1,t,this.path_,!1),zu("OnDisconnect.setWithPriority",2,e,!1),la("OnDisconnect.setWithPriority",3,n,!0);var r=new Us;return this.repo_.onDisconnectSetWithPriority(this.path_,t,e,r.wrapCallback(n)),r.promise},oc.prototype.update=function(t,e){if(ca("OnDisconnect.update",1,2,arguments.length),Xu("OnDisconnect.update",this.path_),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,cu("Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}Gu("OnDisconnect.update",1,t,this.path_,!1),la("OnDisconnect.update",2,e,!0);var i=new Us;return this.repo_.onDisconnectUpdate(this.path_,t,i.wrapCallback(e)),i.promise},oc);function oc(t,e){this.repo_=t,this.path_=e}var sc=(ac.prototype.toJSON=function(){return ca("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},ac);function ac(t,e){this.committed=t,this.snapshot=e}var uc,cc,hc,lc=(uc="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",cc=0,hc=[],function(t){var e,n=t===cc;cc=t;var r=new Array(8);for(e=7;0<=e;e--)r[e]=uc.charAt(t%64),t=Math.floor(t/64);Ps(0===t,"Cannot push at time == 0");var i=r.join("");if(n){for(e=11;0<=e&&63===hc[e];e--)hc[e]=0;hc[e]++}else for(e=0;e<12;e++)hc[e]=Math.floor(64*Math.random());for(e=0;e<12;e++)i+=uc.charAt(hc[e]);return Ps(20===i.length,"nextPushId: Length should be 20."),i}),fc=(pc.Wrap=function(t,e){return new pc(t,e)},pc);function pc(t,e){this.name=t,this.node=e}var dc,vc=(yc.prototype.getCompare=function(){return this.compare.bind(this)},yc.prototype.indexedValueChanged=function(t,e){var n=new fc(Eu,t),r=new fc(Eu,e);return 0!==this.compare(n,r)},yc.prototype.minPost=function(){return fc.MIN},yc);function yc(){}var gc,mc=(Es(wc,gc=vc),Object.defineProperty(wc,"__EMPTY_NODE",{get:function(){return dc},set:function(t){dc=t},enumerable:!0,configurable:!0}),wc.prototype.compare=function(t,e){return Tu(t.name,e.name)},wc.prototype.isDefinedOn=function(t){throw xs("KeyIndex.isDefinedOn not expected to be called.")},wc.prototype.indexedValueChanged=function(t,e){return!1},wc.prototype.minPost=function(){return fc.MIN},wc.prototype.maxPost=function(){return new fc(Iu,dc)},wc.prototype.makePost=function(t,e){return Ps("string"==typeof t,"KeyIndex indexValue must always be a string."),new fc(t,dc)},wc.prototype.toString=function(){return".key"},wc);function wc(){return null!==gc&&gc.apply(this,arguments)||this}var bc,_c=new mc;function Ec(t){return"number"==typeof t?"number:"+Nu(t):"string:"+t}function Ic(t){if(t.isLeafNode()){var e=t.val();Ps("string"==typeof e||"number"==typeof e||"object"==typeof e&&Zs(e,".sv"),"Priority must be a string or number.")}else Ps(t===bc||t.isEmpty(),"priority of unexpected type.");Ps(t===bc||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")}var Tc,Sc,Cc,Nc,Ac=(Object.defineProperty(kc,"__childrenNodeConstructor",{get:function(){return Tc},set:function(t){Tc=t},enumerable:!0,configurable:!0}),kc.prototype.isLeafNode=function(){return!0},kc.prototype.getPriority=function(){return this.priorityNode_},kc.prototype.updatePriority=function(t){return new kc(this.value_,t)},kc.prototype.getImmediateChild=function(t){return".priority"===t?this.priorityNode_:kc.__childrenNodeConstructor.EMPTY_NODE},kc.prototype.getChild=function(t){return t.isEmpty()?this:".priority"===t.getFront()?this.priorityNode_:kc.__childrenNodeConstructor.EMPTY_NODE},kc.prototype.hasChild=function(){return!1},kc.prototype.getPredecessorChildName=function(t,e){return null},kc.prototype.updateImmediateChild=function(t,e){return".priority"===t?this.updatePriority(e):e.isEmpty()&&".priority"!==t?this:kc.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,e).updatePriority(this.priorityNode_)},kc.prototype.updateChild=function(t,e){var n=t.getFront();return null===n?e:e.isEmpty()&&".priority"!==n?this:(Ps(".priority"!==n||1===t.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(n,kc.__childrenNodeConstructor.EMPTY_NODE.updateChild(t.popFront(),e)))},kc.prototype.isEmpty=function(){return!1},kc.prototype.numChildren=function(){return 0},kc.prototype.forEachChild=function(t,e){return!1},kc.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},kc.prototype.hash=function(){if(null===this.lazyHash_){var t="";this.priorityNode_.isEmpty()||(t+="priority:"+Ec(this.priorityNode_.val())+":");var e=typeof this.value_;t+=e+":",t+="number"==e?Nu(this.value_):this.value_,this.lazyHash_=ru(t)}return this.lazyHash_},kc.prototype.getValue=function(){return this.value_},kc.prototype.compareTo=function(t){return t===kc.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof kc.__childrenNodeConstructor?-1:(Ps(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))},kc.prototype.compareToLeafNode_=function(t){var e=typeof t.value_,n=typeof this.value_,r=kc.VALUE_TYPE_ORDER.indexOf(e),i=kc.VALUE_TYPE_ORDER.indexOf(n);return Ps(0<=r,"Unknown leaf type: "+e),Ps(0<=i,"Unknown leaf type: "+n),r===i?"object"==n?0:this.value_<t.value_?-1:this.value_===t.value_?0:1:i-r},kc.prototype.withIndex=function(){return this},kc.prototype.isIndexed=function(){return!0},kc.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode()){var e=t;return this.value_===e.value_&&this.priorityNode_.equals(e.priorityNode_)}return!1},kc.VALUE_TYPE_ORDER=["object","boolean","number","string"],kc);function kc(t,e){void 0===e&&(e=kc.__childrenNodeConstructor.EMPTY_NODE),this.value_=t,this.priorityNode_=e,this.lazyHash_=null,Ps(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),Ic(this.priorityNode_)}function Rc(){return null!==Nc&&Nc.apply(this,arguments)||this}var Oc=new(Es(Rc,Nc=vc),Rc.prototype.compare=function(t,e){var n=t.node.getPriority(),r=e.node.getPriority(),i=n.compareTo(r);return 0===i?Tu(t.name,e.name):i},Rc.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},Rc.prototype.indexedValueChanged=function(t,e){return!t.getPriority().equals(e.getPriority())},Rc.prototype.minPost=function(){return fc.MIN},Rc.prototype.maxPost=function(){return new fc(Iu,new Ac("[PRIORITY-POST]",Cc))},Rc.prototype.makePost=function(t,e){var n=Sc(t);return new fc(e,new Ac("[PRIORITY-POST]",n))},Rc.prototype.toString=function(){return".priority"},Rc),Dc=(Pc.prototype.getNext=function(){if(0===this.nodeStack_.length)return null;var t,e=this.nodeStack_.pop();if(t=this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value},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},Pc.prototype.hasNext=function(){return 0<this.nodeStack_.length},Pc.prototype.peek=function(){if(0===this.nodeStack_.length)return null;var t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}},Pc);function Pc(t,e,n,r,i){void 0===i&&(i=null),this.isReverse_=r,this.resultGenerator_=i,this.nodeStack_=[];for(var o=1;!t.isEmpty();)if(t=t,o=e?n(t.key,e):1,r&&(o*=-1),o<0)t=this.isReverse_?t.left:t.right;else{if(0===o){this.nodeStack_.push(t);break}this.nodeStack_.push(t),t=this.isReverse_?t.right:t.left}}var xc=(Lc.prototype.copy=function(t,e,n,r,i){return new Lc(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)},Lc.prototype.count=function(){return this.left.count()+1+this.right.count()},Lc.prototype.isEmpty=function(){return!1},Lc.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)},Lc.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},Lc.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},Lc.prototype.minKey=function(){return this.min_().key},Lc.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},Lc.prototype.insert=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n))).fixUp_()},Lc.prototype.removeMin_=function(){if(this.left.isEmpty())return Uc.EMPTY_NODE;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_()},Lc.prototype.remove=function(t,e){var n,r;if(e(t,(n=this).key)<0)n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===e(t,n.key)){if(n.right.isEmpty())return Uc.EMPTY_NODE;r=n.right.min_(),n=n.copy(r.key,r.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.fixUp_()},Lc.prototype.isRed_=function(){return this.color},Lc.prototype.fixUp_=function(){var t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t},Lc.prototype.moveRedLeft_=function(){var t=this.colorFlip_();return t.right.left.isRed_()&&(t=(t=(t=t.copy(null,null,null,null,t.right.rotateRight_())).rotateLeft_()).colorFlip_()),t},Lc.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t.left.left.isRed_()&&(t=(t=t.rotateRight_()).colorFlip_()),t},Lc.prototype.rotateLeft_=function(){var t=this.copy(null,null,Lc.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},Lc.prototype.rotateRight_=function(){var t=this.copy(null,null,Lc.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},Lc.prototype.colorFlip_=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},Lc.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)<=this.count()+1},Lc.prototype.check_=function(){if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");var t=this.left.check_();if(t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)},Lc.RED=!0,Lc.BLACK=!1,Lc);function Lc(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:Lc.RED,this.left=null!=r?r:Uc.EMPTY_NODE,this.right=null!=i?i:Uc.EMPTY_NODE}var Mc=(Fc.prototype.copy=function(t,e,n,r,i){return this},Fc.prototype.insert=function(t,e,n){return new xc(t,e,null)},Fc.prototype.remove=function(t,e){return this},Fc.prototype.count=function(){return 0},Fc.prototype.isEmpty=function(){return!0},Fc.prototype.inorderTraversal=function(t){return!1},Fc.prototype.reverseTraversal=function(t){return!1},Fc.prototype.minKey=function(){return null},Fc.prototype.maxKey=function(){return null},Fc.prototype.check_=function(){return 0},Fc.prototype.isRed_=function(){return!1},Fc);function Fc(){}var Uc=(jc.prototype.insert=function(t,e){return new jc(this.comparator_,this.root_.insert(t,e,this.comparator_).copy(null,null,xc.BLACK,null,null))},jc.prototype.remove=function(t){return new jc(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,xc.BLACK,null,null))},jc.prototype.get=function(t){for(var e,n=this.root_;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key)))return n.value;e<0?n=n.left:0<e&&(n=n.right)}return null},jc.prototype.getPredecessorKey=function(t){for(var e,n=this.root_,r=null;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key))){if(n.left.isEmpty())return r?r.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}e<0?n=n.left:0<e&&(n=(r=n).right)}throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")},jc.prototype.isEmpty=function(){return this.root_.isEmpty()},jc.prototype.count=function(){return this.root_.count()},jc.prototype.minKey=function(){return this.root_.minKey()},jc.prototype.maxKey=function(){return this.root_.maxKey()},jc.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},jc.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},jc.prototype.getIterator=function(t){return new Dc(this.root_,null,this.comparator_,!1,t)},jc.prototype.getIteratorFrom=function(t,e){return new Dc(this.root_,t,this.comparator_,!1,e)},jc.prototype.getReverseIteratorFrom=function(t,e){return new Dc(this.root_,t,this.comparator_,!0,e)},jc.prototype.getReverseIterator=function(t){return new Dc(this.root_,null,this.comparator_,!0,t)},jc.EMPTY_NODE=new Mc,jc);function jc(t,e){void 0===e&&(e=jc.EMPTY_NODE),this.comparator_=t,this.root_=e}var qc=Math.log(2),Vc=(Bc.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<<this.current_);return this.current_--,t},Bc);function Bc(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/qc,10)),this.current_=this.count-1;var n,r=(n=this.count,parseInt(Array(n+1).join("1"),2));this.bits_=t+1&r}var Wc,Hc,Kc=function(c,t,h,e){c.sort(t);var l=function(t,e){var n,r,i=e-t;if(0==i)return null;if(1==i)return n=c[t],r=h?h(n):n,new xc(r,n.node,xc.BLACK,null,null);var o=parseInt(i/2,10)+t,s=l(t,o),a=l(o+1,e);return n=c[o],r=h?h(n):n,new xc(r,n.node,xc.BLACK,s,a)},n=function(t){for(var e=null,n=null,a=c.length,r=function(t,e){var n=a-t,r=a;a-=t;var i=l(1+n,r),o=c[n],s=h?h(o):o;u(new xc(s,o.node,e,null,i))},u=function(t){e=e?e.left=t:n=t},i=0;i<t.count;++i){var o=t.nextBitIsOne(),s=Math.pow(2,t.count-(i+1));o?r(s,xc.BLACK):(r(s,xc.BLACK),r(s,xc.RED))}return n}(new Vc(c.length));return new Uc(e||t,n)},Gc={},zc=(Object.defineProperty(Qc,"Default",{get:function(){return Ps(Oc,"ChildrenNode.ts has not been loaded"),Wc=Wc||new Qc({".priority":Gc},{".priority":Oc})},enumerable:!0,configurable:!0}),Qc.prototype.get=function(t){var e=ta(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e instanceof Uc?e:null},Qc.prototype.hasIndex=function(t){return Zs(this.indexSet_,t.toString())},Qc.prototype.addIndex=function(t,e){Ps(t!==_c,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var n,r=[],i=!1,o=e.getIterator(fc.Wrap),s=o.getNext();s;)i=i||t.isDefinedOn(s.node),r.push(s),s=o.getNext();n=i?Kc(r,t.getCompare()):Gc;var a=t.toString(),u=Is({},this.indexSet_);u[a]=t;var c=Is({},this.indexes_);return c[a]=n,new Qc(c,u)},Qc.prototype.addToIndexes=function(u,c){var h=this;return new Qc(na(this.indexes_,function(t,e){var n=ta(h.indexSet_,e);if(Ps(n,"Missing index implementation for "+e),t===Gc){if(n.isDefinedOn(u.node)){for(var r=[],i=c.getIterator(fc.Wrap),o=i.getNext();o;)o.name!==u.name&&r.push(o),o=i.getNext();return r.push(u),Kc(r,n.getCompare())}return Gc}var s=c.get(u.name),a=t;return s&&(a=a.remove(new fc(u.name,s))),a.insert(u,u.node)}),this.indexSet_)},Qc.prototype.removeFromIndexes=function(n,r){return new Qc(na(this.indexes_,function(t){if(t===Gc)return t;var e=r.get(n.name);return e?t.remove(new fc(n.name,e)):t}),this.indexSet_)},Qc);function Qc(t,e){this.indexes_=t,this.indexSet_=e}function Yc(t,e){return Tu(t.name,e.name)}function Jc(t,e){return Tu(t,e)}var Xc,$c=(Object.defineProperty(Zc,"EMPTY_NODE",{get:function(){return Hc=Hc||new Zc(new Uc(Jc),null,zc.Default)},enumerable:!0,configurable:!0}),Zc.prototype.isLeafNode=function(){return!1},Zc.prototype.getPriority=function(){return this.priorityNode_||Hc},Zc.prototype.updatePriority=function(t){return this.children_.isEmpty()?this:new Zc(this.children_,t,this.indexMap_)},Zc.prototype.getImmediateChild=function(t){if(".priority"===t)return this.getPriority();var e=this.children_.get(t);return null===e?Hc:e},Zc.prototype.getChild=function(t){var e=t.getFront();return null===e?this:this.getImmediateChild(e).getChild(t.popFront())},Zc.prototype.hasChild=function(t){return null!==this.children_.get(t)},Zc.prototype.updateImmediateChild=function(t,e){if(Ps(e,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(e);var n=new fc(t,e),r=void 0,i=void 0;i=e.isEmpty()?(r=this.children_.remove(t),this.indexMap_.removeFromIndexes(n,this.children_)):(r=this.children_.insert(t,e),this.indexMap_.addToIndexes(n,this.children_));var o=r.isEmpty()?Hc:this.priorityNode_;return new Zc(r,o,i)},Zc.prototype.updateChild=function(t,e){var n=t.getFront();if(null===n)return e;Ps(".priority"!==t.getFront()||1===t.getLength(),".priority must be the last token in a path");var r=this.getImmediateChild(n).updateChild(t.popFront(),e);return this.updateImmediateChild(n,r)},Zc.prototype.isEmpty=function(){return this.children_.isEmpty()},Zc.prototype.numChildren=function(){return this.children_.count()},Zc.prototype.val=function(n){if(this.isEmpty())return null;var r={},i=0,o=0,s=!0;if(this.forEachChild(Oc,function(t,e){r[t]=e.val(n),i++,s&&Zc.INTEGER_REGEXP_.test(t)?o=Math.max(o,Number(t)):s=!1}),!n&&s&&o<2*i){var t=[];for(var e in r)t[e]=r[e];return t}return n&&!this.getPriority().isEmpty()&&(r[".priority"]=this.getPriority().val()),r},Zc.prototype.hash=function(){if(null===this.lazyHash_){var r="";this.getPriority().isEmpty()||(r+="priority:"+Ec(this.getPriority().val())+":"),this.forEachChild(Oc,function(t,e){var n=e.hash();""!==n&&(r+=":"+t+":"+n)}),this.lazyHash_=""===r?"":ru(r)}return this.lazyHash_},Zc.prototype.getPredecessorChildName=function(t,e,n){var r=this.resolveIndex_(n);if(r){var i=r.getPredecessorKey(new fc(t,e));return i?i.name:null}return this.children_.getPredecessorKey(t)},Zc.prototype.getFirstChildName=function(t){var e=this.resolveIndex_(t);if(e){var n=e.minKey();return n&&n.name}return this.children_.minKey()},Zc.prototype.getFirstChild=function(t){var e=this.getFirstChildName(t);return e?new fc(e,this.children_.get(e)):null},Zc.prototype.getLastChildName=function(t){var e=this.resolveIndex_(t);if(e){var n=e.maxKey();return n&&n.name}return this.children_.maxKey()},Zc.prototype.getLastChild=function(t){var e=this.getLastChildName(t);return e?new fc(e,this.children_.get(e)):null},Zc.prototype.forEachChild=function(t,e){var n=this.resolveIndex_(t);return n?n.inorderTraversal(function(t){return e(t.name,t.node)}):this.children_.inorderTraversal(e)},Zc.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},Zc.prototype.getIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getIteratorFrom(t,function(t){return t});for(var r=this.children_.getIteratorFrom(t.name,fc.Wrap),i=r.peek();null!=i&&e.compare(i,t)<0;)r.getNext(),i=r.peek();return r},Zc.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},Zc.prototype.getReverseIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getReverseIteratorFrom(t,function(t){return t});for(var r=this.children_.getReverseIteratorFrom(t.name,fc.Wrap),i=r.peek();null!=i&&0<e.compare(i,t);)r.getNext(),i=r.peek();return r},Zc.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===eh?-1:0},Zc.prototype.withIndex=function(t){if(t===_c||this.indexMap_.hasIndex(t))return this;var e=this.indexMap_.addIndex(t,this.children_);return new Zc(this.children_,this.priorityNode_,e)},Zc.prototype.isIndexed=function(t){return t===_c||this.indexMap_.hasIndex(t)},Zc.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode())return!1;var e=t;if(this.getPriority().equals(e.getPriority())){if(this.children_.count()!==e.children_.count())return!1;for(var n=this.getIterator(Oc),r=e.getIterator(Oc),i=n.getNext(),o=r.getNext();i&&o;){if(i.name!==o.name||!i.node.equals(o.node))return!1;i=n.getNext(),o=r.getNext()}return null===i&&null===o}return!1},Zc.prototype.resolveIndex_=function(t){return t===_c?null:this.indexMap_.get(t.toString())},Zc.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,Zc);function Zc(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&Ic(this.priorityNode_),this.children_.isEmpty()&&Ps(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}function th(){return Xc.call(this,new Uc(Jc),$c.EMPTY_NODE,zc.Default)||this}var eh=new(Es(th,Xc=$c),th.prototype.compareTo=function(t){return t===this?0:1},th.prototype.equals=function(t){return t===this},th.prototype.getPriority=function(){return this},th.prototype.getImmediateChild=function(t){return $c.EMPTY_NODE},th.prototype.isEmpty=function(){return!1},th);Object.defineProperties(fc,{MIN:{value:new fc(Eu,$c.EMPTY_NODE)},MAX:{value:new fc(Iu,eh)}}),mc.__EMPTY_NODE=$c.EMPTY_NODE,Ac.__childrenNodeConstructor=$c,bc=eh,Cc=eh;var nh,rh=!0;function ih(r,t){if(void 0===t&&(t=null),null===r)return $c.EMPTY_NODE;if("object"==typeof r&&".priority"in r&&(t=r[".priority"]),Ps(null===t||"string"==typeof t||"number"==typeof t||"object"==typeof t&&".sv"in t,"Invalid priority type found: "+typeof t),"object"==typeof r&&".value"in r&&null!==r[".value"]&&(r=r[".value"]),"object"!=typeof r||".sv"in r)return new Ac(r,ih(t));if(r instanceof Array||!rh){var i=$c.EMPTY_NODE;return Cu(r,function(t,e){if(Zs(r,t)&&"."!==t.substring(0,1)){var n=ih(e);!n.isLeafNode()&&n.isEmpty()||(i=i.updateImmediateChild(t,n))}}),i.updatePriority(ih(t))}var o=[],s=!1;if(Cu(r,function(t,e){if("."!==t.substring(0,1)){var n=ih(e);n.isEmpty()||(s=s||!n.getPriority().isEmpty(),o.push(new fc(t,n)))}}),0===o.length)return $c.EMPTY_NODE;var e=Kc(o,Yc,function(t){return t.name},Jc);if(s){var n=Kc(o,Oc.getCompare());return new $c(e,ih(t),new zc({".priority":n},{".priority":Oc}))}return new $c(e,ih(t),zc.Default)}function oh(){return null!==nh&&nh.apply(this,arguments)||this}Sc=ih;var sh,ah=new(Es(oh,nh=vc),oh.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?Tu(t.name,e.name):n},oh.prototype.isDefinedOn=function(t){return!0},oh.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},oh.prototype.minPost=function(){return fc.MIN},oh.prototype.maxPost=function(){return fc.MAX},oh.prototype.makePost=function(t,e){var n=ih(t);return new fc(e,n)},oh.prototype.toString=function(){return".value"},oh),uh=(Es(ch,sh=vc),ch.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},ch.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},ch.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),i=n.compareTo(r);return 0===i?Tu(t.name,e.name):i},ch.prototype.makePost=function(t,e){var n=ih(t),r=$c.EMPTY_NODE.updateChild(this.indexPath_,n);return new fc(e,r)},ch.prototype.maxPost=function(){var t=$c.EMPTY_NODE.updateChild(this.indexPath_,eh);return new fc(Iu,t)},ch.prototype.toString=function(){return this.indexPath_.slice().join("/")},ch);function ch(t){var e=sh.call(this)||this;return e.indexPath_=t,Ps(!t.isEmpty()&&".priority"!==t.getFront(),"Can't create PathIndex with empty path or .priority key"),e}var hh=(lh.prototype.val=function(){return ca("DataSnapshot.val",0,0,arguments.length),this.node_.val()},lh.prototype.exportVal=function(){return ca("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},lh.prototype.toJSON=function(){return ca("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},lh.prototype.exists=function(){return ca("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},lh.prototype.child=function(t){ca("DataSnapshot.child",0,1,arguments.length),t=String(t),Ju("DataSnapshot.child",1,t,!1);var e=new Du(t),n=this.ref_.child(e);return new lh(this.node_.getChild(e),n,Oc)},lh.prototype.hasChild=function(t){ca("DataSnapshot.hasChild",1,1,arguments.length),Ju("DataSnapshot.hasChild",1,t,!1);var e=new Du(t);return!this.node_.getChild(e).isEmpty()},lh.prototype.getPriority=function(){return ca("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},lh.prototype.forEach=function(n){var r=this;return ca("DataSnapshot.forEach",1,1,arguments.length),la("DataSnapshot.forEach",1,n,!1),!this.node_.isLeafNode()&&!!this.node_.forEachChild(this.index_,function(t,e){return n(new lh(e,r.ref_.child(t),Oc))})},lh.prototype.hasChildren=function(){return ca("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()},Object.defineProperty(lh.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!0,configurable:!0}),lh.prototype.numChildren=function(){return ca("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},lh.prototype.getRef=function(){return ca("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(lh.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),lh);function lh(t,e,n){this.node_=t,this.ref_=e,this.index_=n}var fh=(ph.prototype.getPath=function(){var t=this.snapshot.getRef();return"value"===this.eventType?t.path:t.getParent().path},ph.prototype.getEventType=function(){return this.eventType},ph.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},ph.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+Xs(this.snapshot.exportVal())},ph);function ph(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}var dh=(vh.prototype.getPath=function(){return this.path},vh.prototype.getEventType=function(){return"cancel"},vh.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},vh.prototype.toString=function(){return this.path.toString()+":cancel"},vh);function vh(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}var yh=(gh.prototype.respondsTo=function(t){return"value"===t},gh.prototype.createEvent=function(t,e){var n=e.getQueryParams().getIndex();return new fh("value",this,new hh(t.snapshotNode,e.getRef(),n))},gh.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){Ps(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callback_;return function(){r.call(e,t.snapshot)}},gh.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new dh(this,t,e):null},gh.prototype.matches=function(t){return t instanceof gh&&(!t.callback_||!this.callback_||t.callback_===this.callback_&&t.context_===this.context_)},gh.prototype.hasAnyCallback=function(){return null!==this.callback_},gh);function gh(t,e,n){this.callback_=t,this.cancelCallback_=e,this.context_=n}var mh,wh=(bh.prototype.respondsTo=function(t){var e="children_added"===t?"child_added":t;return e="children_removed"===e?"child_removed":e,Zs(this.callbacks_,e)},bh.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new dh(this,t,e):null},bh.prototype.createEvent=function(t,e){Ps(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),r=e.getQueryParams().getIndex();return new fh(t.type,this,new hh(t.snapshotNode,n,r),t.prevName)},bh.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){Ps(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callbacks_[t.eventType];return function(){r.call(e,t.snapshot,t.prevName)}},bh.prototype.matches=function(e){var n=this;if(e instanceof bh){if(!this.callbacks_||!e.callbacks_)return!0;if(this.context_===e.context_){var t=Object.keys(e.callbacks_),r=Object.keys(this.callbacks_),i=t.length;if(i===r.length){if(1!==i)return r.every(function(t){return e.callbacks_[t]===n.callbacks_[t]});var o=t[0],s=r[0];return!(s!==o||e.callbacks_[o]&&this.callbacks_[s]&&e.callbacks_[o]!==this.callbacks_[s])}}}return!1},bh.prototype.hasAnyCallback=function(){return null!==this.callbacks_},bh);function bh(t,e,n){this.callbacks_=t,this.cancelCallback_=e,this.context_=n}var _h=(Object.defineProperty(Eh,"__referenceConstructor",{get:function(){return Ps(mh,"Reference.ts has not been loaded"),mh},set:function(t){mh=t},enumerable:!0,configurable:!0}),Eh.validateQueryEndpoints_=function(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===_c){var r="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",i="Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.";if(t.hasStart()){if(t.getIndexStartName()!==Eu)throw new Error(r);if("string"!=typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!==Iu)throw new Error(r);if("string"!=typeof n)throw new Error(i)}}else if(t.getIndex()===Oc){if(null!=e&&!Hu(e)||null!=n&&!Hu(n))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(Ps(t.getIndex()instanceof uh||t.getIndex()===ah,"unknown index type."),null!=e&&"object"==typeof e||null!=n&&"object"==typeof n)throw new Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},Eh.validateLimit_=function(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},Eh.prototype.validateNoPreviousOrderByCall_=function(t){if(!0===this.orderByCalled_)throw new Error(t+": You can't combine multiple orderBy calls.")},Eh.prototype.getQueryParams=function(){return this.queryParams_},Eh.prototype.getRef=function(){return ca("Query.ref",0,0,arguments.length),new Eh.__referenceConstructor(this.repo,this.path)},Eh.prototype.on=function(t,e,n,r){ca("Query.on",2,4,arguments.length),Qu("Query.on",1,t,!1),la("Query.on",2,e,!1);var i=Eh.getCancelAndContextArgs_("Query.on",n,r);if("value"===t)this.onValueEvent(e,i.cancel,i.context);else{var o={};o[t]=e,this.onChildEvent(o,i.cancel,i.context)}return e},Eh.prototype.onValueEvent=function(t,e,n){var r=new yh(t,e||null,n||null);this.repo.addEventCallbackForQuery(this,r)},Eh.prototype.onChildEvent=function(t,e,n){var r=new wh(t,e,n);this.repo.addEventCallbackForQuery(this,r)},Eh.prototype.off=function(t,e,n){ca("Query.off",0,3,arguments.length),Qu("Query.off",1,t,!0),la("Query.off",2,e,!0),fa("Query.off",3,n,!0);var r=null,i=null;"value"===t?r=new yh(e||null,null,n||null):t&&(e&&((i={})[t]=e),r=new wh(i,null,n||null)),this.repo.removeEventCallbackForQuery(this,r)},Eh.prototype.once=function(e,n,t,r){var i=this;ca("Query.once",1,4,arguments.length),Qu("Query.once",1,e,!1),la("Query.once",2,n,!0);var o=Eh.getCancelAndContextArgs_("Query.once",t,r),s=!0,a=new Us;a.promise.catch(function(){});var u=function(t){s&&(s=!1,i.off(e,u),n&&n.bind(o.context)(t),a.resolve(t))};return this.on(e,u,function(t){i.off(e,u),o.cancel&&o.cancel.bind(o.context)(t),a.reject(t)}),a.promise},Eh.prototype.limitToFirst=function(t){if(ca("Query.limitToFirst",1,1,arguments.length),"number"!=typeof t||Math.floor(t)!==t||t<=0)throw new Error("Query.limitToFirst: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new Eh(this.repo,this.path,this.queryParams_.limitToFirst(t),this.orderByCalled_)},Eh.prototype.limitToLast=function(t){if(ca("Query.limitToLast",1,1,arguments.length),"number"!=typeof t||Math.floor(t)!==t||t<=0)throw new Error("Query.limitToLast: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new Eh(this.repo,this.path,this.queryParams_.limitToLast(t),this.orderByCalled_)},Eh.prototype.orderByChild=function(t){if(ca("Query.orderByChild",1,1,arguments.length),"$key"===t)throw new Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===t)throw new Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===t)throw new Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');Ju("Query.orderByChild",1,t,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");var e=new Du(t);if(e.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");var n=new uh(e),r=this.queryParams_.orderBy(n);return Eh.validateQueryEndpoints_(r),new Eh(this.repo,this.path,r,!0)},Eh.prototype.orderByKey=function(){ca("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var t=this.queryParams_.orderBy(_c);return Eh.validateQueryEndpoints_(t),new Eh(this.repo,this.path,t,!0)},Eh.prototype.orderByPriority=function(){ca("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var t=this.queryParams_.orderBy(Oc);return Eh.validateQueryEndpoints_(t),new Eh(this.repo,this.path,t,!0)},Eh.prototype.orderByValue=function(){ca("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var t=this.queryParams_.orderBy(ah);return Eh.validateQueryEndpoints_(t),new Eh(this.repo,this.path,t,!0)},Eh.prototype.startAt=function(t,e){void 0===t&&(t=null),ca("Query.startAt",0,2,arguments.length),Ku("Query.startAt",1,t,this.path,!0),Yu("Query.startAt",2,e,!0);var n=this.queryParams_.startAt(t,e);if(Eh.validateLimit_(n),Eh.validateQueryEndpoints_(n),this.queryParams_.hasStart())throw new Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return void 0===t&&(e=t=null),new Eh(this.repo,this.path,n,this.orderByCalled_)},Eh.prototype.endAt=function(t,e){void 0===t&&(t=null),ca("Query.endAt",0,2,arguments.length),Ku("Query.endAt",1,t,this.path,!0),Yu("Query.endAt",2,e,!0);var n=this.queryParams_.endAt(t,e);if(Eh.validateLimit_(n),Eh.validateQueryEndpoints_(n),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new Eh(this.repo,this.path,n,this.orderByCalled_)},Eh.prototype.equalTo=function(t,e){if(ca("Query.equalTo",1,2,arguments.length),Ku("Query.equalTo",1,t,this.path,!1),Yu("Query.equalTo",2,e,!0),this.queryParams_.hasStart())throw new Error("Query.equalTo: Starting point was already set (by another call to startAt or equalTo).");if(this.queryParams_.hasEnd())throw new Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.startAt(t,e).endAt(t,e)},Eh.prototype.toString=function(){return ca("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},Eh.prototype.toJSON=function(){return ca("Query.toJSON",0,1,arguments.length),this.toString()},Eh.prototype.queryObject=function(){return this.queryParams_.getQueryObject()},Eh.prototype.queryIdentifier=function(){var t=this.queryObject(),e=Su(t);return"{}"===e?"default":e},Eh.prototype.isEqual=function(t){if(ca("Query.isEqual",1,1,arguments.length),!(t instanceof Eh))throw new Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.");var e=this.repo===t.repo,n=this.path.equals(t.path),r=this.queryIdentifier()===t.queryIdentifier();return e&&n&&r},Eh.getCancelAndContextArgs_=function(t,e,n){var r={cancel:null,context:null};if(e&&n)r.cancel=e,la(t,3,r.cancel,!0),r.context=n,fa(t,4,r.context,!0);else if(e)if("object"==typeof e&&null!==e)r.context=e;else{if("function"!=typeof e)throw new Error(ha(t,3,!0)+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(Eh.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),Eh);function Eh(t,e,n,r){this.repo=t,this.path=e,this.queryParams_=n,this.orderByCalled_=r}var Ih=(Th.prototype.find=function(t){if(null!=this.value)return this.value.getChild(t);if(!t.isEmpty()&&0<this.children.size){var e=t.getFront();return t=t.popFront(),this.children.has(e)?this.children.get(e).find(t):null}return null},Th.prototype.remember=function(t,e){if(t.isEmpty())this.value=e,this.children.clear();else if(null!==this.value)this.value=this.value.updateChild(t,e);else{var n=t.getFront();this.children.has(n)||this.children.set(n,new Th);var r=this.children.get(n);t=t.popFront(),r.remember(t,e)}},Th.prototype.forget=function(t){if(t.isEmpty())return this.value=null,this.children.clear(),!0;if(null!==this.value){if(this.value.isLeafNode())return!1;var e=this.value;this.value=null;var n=this;return e.forEachChild(Oc,function(t,e){n.remember(new Du(t),e)}),this.forget(t)}if(0<this.children.size){var r=t.getFront();return t=t.popFront(),!this.children.has(r)||this.children.get(r).forget(t)&&this.children.delete(r),0===this.children.size}return!0},Th.prototype.forEachTree=function(r,i){null!==this.value?i(r,this.value):this.forEachChild(function(t,e){var n=new Du(r.toString()+"/"+t);e.forEachTree(n,i)})},Th.prototype.forEachChild=function(n){this.children.forEach(function(t,e){n(e,t)})},Th);function Th(){this.value=null,this.children=new Map}function Sh(t,e){return t&&"object"==typeof t?(Ps(".sv"in t,"Unexpected leaf node or priority contents"),e[t[".sv"]]):t}var Ch,Nh,Ah=function(t,r){var i,e=t.getPriority().val(),n=Sh(e,r);if(t.isLeafNode()){var o=t,s=Sh(o.getValue(),r);return s!==o.getValue()||n!==o.getPriority().val()?new Ac(s,ih(n)):t}var a=t;return n!==(i=a).getPriority().val()&&(i=i.updatePriority(new Ac(n))),a.forEachChild(Oc,function(t,e){var n=Ah(e,r);n!==e&&(i=i.updateImmediateChild(t,n))}),i};(Nh=Ch=Ch||{})[Nh.OVERWRITE=0]="OVERWRITE",Nh[Nh.MERGE=1]="MERGE",Nh[Nh.ACK_USER_WRITE=2]="ACK_USER_WRITE",Nh[Nh.LISTEN_COMPLETE=3]="LISTEN_COMPLETE";var kh=(Rh.User=new Rh(!0,!1,null,!1),Rh.Server=new Rh(!1,!0,null,!1),Rh.forServerTaggedQuery=function(t){return new Rh(!1,!0,t,!0)},Rh);function Rh(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,Ps(!r||e,"Tagged queries must be from server.")}var Oh,Dh=(Ph.prototype.operationForChild=function(t){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return Ps(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var e=this.affectedTree.subtree(new Du(t));return new Ph(Du.Empty,e,this.revert)}return Ps(this.path.getFront()===t,"operationForChild called for unrelated child."),new Ph(this.path.popFront(),this.affectedTree,this.revert)},Ph);function Ph(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=Ch.ACK_USER_WRITE,this.source=kh.User}var xh=(Lh.fromObject=function(t){var n=Lh.Empty;return Cu(t,function(t,e){n=n.set(new Du(t),e)}),n},Lh.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},Lh.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:Du.Empty,value:this.value};if(t.isEmpty())return null;var n=t.getFront(),r=this.children.get(n);if(null===r)return null;var i=r.findRootMostMatchingPathAndValue(t.popFront(),e);return null==i?null:{path:new Du(n).child(i.path),value:i.value}},Lh.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},Lh.prototype.subtree=function(t){if(t.isEmpty())return this;var e=t.getFront(),n=this.children.get(e);return null!==n?n.subtree(t.popFront()):Lh.Empty},Lh.prototype.set=function(t,e){if(t.isEmpty())return new Lh(e,this.children);var n=t.getFront(),r=(this.children.get(n)||Lh.Empty).set(t.popFront(),e),i=this.children.insert(n,r);return new Lh(this.value,i)},Lh.prototype.remove=function(t){if(t.isEmpty())return this.children.isEmpty()?Lh.Empty:new Lh(null,this.children);var e=t.getFront(),n=this.children.get(e);if(n){var r=n.remove(t.popFront()),i=void 0;return i=r.isEmpty()?this.children.remove(e):this.children.insert(e,r),null===this.value&&i.isEmpty()?Lh.Empty:new Lh(this.value,i)}return this},Lh.prototype.get=function(t){if(t.isEmpty())return this.value;var e=t.getFront(),n=this.children.get(e);return n?n.get(t.popFront()):null},Lh.prototype.setTree=function(t,e){if(t.isEmpty())return e;var n=t.getFront(),r=(this.children.get(n)||Lh.Empty).setTree(t.popFront(),e),i=void 0;return i=r.isEmpty()?this.children.remove(n):this.children.insert(n,r),new Lh(this.value,i)},Lh.prototype.fold=function(t){return this.fold_(Du.Empty,t)},Lh.prototype.fold_=function(n,r){var i={};return this.children.inorderTraversal(function(t,e){i[t]=e.fold_(n.child(t),r)}),r(n,this.value,i)},Lh.prototype.findOnPath=function(t,e){return this.findOnPath_(t,Du.Empty,e)},Lh.prototype.findOnPath_=function(t,e,n){var r=!!this.value&&n(e,this.value);if(r)return r;if(t.isEmpty())return null;var i=t.getFront(),o=this.children.get(i);return o?o.findOnPath_(t.popFront(),e.child(i),n):null},Lh.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,Du.Empty,e)},Lh.prototype.foreachOnPath_=function(t,e,n){if(t.isEmpty())return this;this.value&&n(e,this.value);var r=t.getFront(),i=this.children.get(r);return i?i.foreachOnPath_(t.popFront(),e.child(r),n):Lh.Empty},Lh.prototype.foreach=function(t){this.foreach_(Du.Empty,t)},Lh.prototype.foreach_=function(n,r){this.children.inorderTraversal(function(t,e){e.foreach_(n.child(t),r)}),this.value&&r(n,this.value)},Lh.prototype.foreachChild=function(n){this.children.inorderTraversal(function(t,e){e.value&&n(t,e.value)})},Lh.Empty=new Lh(null),Lh);function Lh(t,e){void 0===e&&(e=Oh=Oh||new Uc(lu)),this.value=t,this.children=e}var Mh=(Fh.prototype.operationForChild=function(t){return this.path.isEmpty()?new Fh(this.source,Du.Empty):new Fh(this.source,this.path.popFront())},Fh);function Fh(t,e){this.source=t,this.path=e,this.type=Ch.LISTEN_COMPLETE}var Uh=(jh.prototype.operationForChild=function(t){return this.path.isEmpty()?new jh(this.source,Du.Empty,this.snap.getImmediateChild(t)):new jh(this.source,this.path.popFront(),this.snap)},jh);function jh(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=Ch.OVERWRITE}var qh=(Vh.prototype.operationForChild=function(t){if(this.path.isEmpty()){var e=this.children.subtree(new Du(t));return e.isEmpty()?null:e.value?new Uh(this.source,Du.Empty,e.value):new Vh(this.source,Du.Empty,e)}return Ps(this.path.getFront()===t,"Can't get a merge for a child not on the path of the operation"),new Vh(this.source,this.path.popFront(),this.children)},Vh.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},Vh);function Vh(t,e,n){this.source=t,this.path=e,this.children=n,this.type=Ch.MERGE}var Bh=(Wh.prototype.isFullyInitialized=function(){return this.fullyInitialized_},Wh.prototype.isFiltered=function(){return this.filtered_},Wh.prototype.isCompleteForPath=function(t){if(t.isEmpty())return this.isFullyInitialized()&&!this.filtered_;var e=t.getFront();return this.isCompleteForChild(e)},Wh.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},Wh.prototype.getNode=function(){return this.node_},Wh);function Wh(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}var Hh=(Kh.prototype.updateEventSnap=function(t,e,n){return new Kh(new Bh(t,e,n),this.serverCache_)},Kh.prototype.updateServerSnap=function(t,e,n){return new Kh(this.eventCache_,new Bh(t,e,n))},Kh.prototype.getEventCache=function(){return this.eventCache_},Kh.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},Kh.prototype.getServerCache=function(){return this.serverCache_},Kh.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},Kh.Empty=new Kh(new Bh($c.EMPTY_NODE,!1,!1),new Bh($c.EMPTY_NODE,!1,!1)),Kh);function Kh(t,e){this.eventCache_=t,this.serverCache_=e}var Gh=(zh.valueChange=function(t){return new zh(zh.VALUE,t)},zh.childAddedChange=function(t,e){return new zh(zh.CHILD_ADDED,e,t)},zh.childRemovedChange=function(t,e){return new zh(zh.CHILD_REMOVED,e,t)},zh.childChangedChange=function(t,e,n){return new zh(zh.CHILD_CHANGED,e,t,n)},zh.childMovedChange=function(t,e){return new zh(zh.CHILD_MOVED,e,t)},zh.CHILD_ADDED="child_added",zh.CHILD_REMOVED="child_removed",zh.CHILD_CHANGED="child_changed",zh.CHILD_MOVED="child_moved",zh.VALUE="value",zh);function zh(t,e,n,r,i){this.type=t,this.snapshotNode=e,this.childName=n,this.oldSnap=r,this.prevName=i}var Qh=(Yh.prototype.updateChild=function(t,e,n,r,i,o){Ps(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");var s=t.getImmediateChild(e);return s.getChild(r).equals(n.getChild(r))&&s.isEmpty()===n.isEmpty()?t:(null!=o&&(n.isEmpty()?t.hasChild(e)?o.trackChildChange(Gh.childRemovedChange(e,s)):Ps(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?o.trackChildChange(Gh.childAddedChange(e,n)):o.trackChildChange(Gh.childChangedChange(e,n,s))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},Yh.prototype.updateFullNode=function(r,n,i){return null!=i&&(r.isLeafNode()||r.forEachChild(Oc,function(t,e){n.hasChild(t)||i.trackChildChange(Gh.childRemovedChange(t,e))}),n.isLeafNode()||n.forEachChild(Oc,function(t,e){if(r.hasChild(t)){var n=r.getImmediateChild(t);n.equals(e)||i.trackChildChange(Gh.childChangedChange(t,e,n))}else i.trackChildChange(Gh.childAddedChange(t,e))})),n.withIndex(this.index_)},Yh.prototype.updatePriority=function(t,e){return t.isEmpty()?$c.EMPTY_NODE:t.updatePriority(e)},Yh.prototype.filtersNodes=function(){return!1},Yh.prototype.getIndexedFilter=function(){return this},Yh.prototype.getIndex=function(){return this.index_},Yh);function Yh(t){this.index_=t}var Jh=(Xh.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;Ps(e===Gh.CHILD_ADDED||e===Gh.CHILD_CHANGED||e===Gh.CHILD_REMOVED,"Only child changes supported for tracking"),Ps(".priority"!==n,"Only non-priority child changes can be tracked.");var r=this.changeMap.get(n);if(r){var i=r.type;if(e===Gh.CHILD_ADDED&&i===Gh.CHILD_REMOVED)this.changeMap.set(n,Gh.childChangedChange(n,t.snapshotNode,r.snapshotNode));else if(e===Gh.CHILD_REMOVED&&i===Gh.CHILD_ADDED)this.changeMap.delete(n);else if(e===Gh.CHILD_REMOVED&&i===Gh.CHILD_CHANGED)this.changeMap.set(n,Gh.childRemovedChange(n,r.oldSnap));else if(e===Gh.CHILD_CHANGED&&i===Gh.CHILD_ADDED)this.changeMap.set(n,Gh.childAddedChange(n,t.snapshotNode));else{if(e!==Gh.CHILD_CHANGED||i!==Gh.CHILD_CHANGED)throw xs("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap.set(n,Gh.childChangedChange(n,t.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,t)},Xh.prototype.getChanges=function(){return Array.from(this.changeMap.values())},Xh);function Xh(){this.changeMap=new Map}function $h(){}var Zh=new($h.prototype.getCompleteChild=function(t){return null},$h.prototype.getChildAfterChild=function(t,e,n){return null},$h),tl=(el.prototype.getCompleteChild=function(t){var e=this.viewCache_.getEventCache();if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);var n=null!=this.optCompleteServerCache_?new Bh(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(t,n)},el.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:this.viewCache_.getCompleteServerSnap(),i=this.writes_.calcIndexedSlice(r,e,1,n,t);return 0===i.length?null:i[0]},el);function el(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}var nl=function(t,e){this.viewCache=t,this.changes=e},rl=(il.prototype.assertIndexed=function(t){Ps(t.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),Ps(t.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},il.prototype.applyOperation=function(t,e,n,r){var i,o,s=new Jh;if(e.type===Ch.OVERWRITE){var a=e;i=a.source.fromUser?this.applyUserOverwrite_(t,a.path,a.snap,n,r,s):(Ps(a.source.fromServer,"Unknown source."),o=a.source.tagged||t.getServerCache().isFiltered()&&!a.path.isEmpty(),this.applyServerOverwrite_(t,a.path,a.snap,n,r,o,s))}else if(e.type===Ch.MERGE){var u=e;i=u.source.fromUser?this.applyUserMerge_(t,u.path,u.children,n,r,s):(Ps(u.source.fromServer,"Unknown source."),o=u.source.tagged||t.getServerCache().isFiltered(),this.applyServerMerge_(t,u.path,u.children,n,r,o,s))}else if(e.type===Ch.ACK_USER_WRITE){var c=e;i=c.revert?this.revertUserWrite_(t,c.path,n,r,s):this.ackUserWrite_(t,c.path,c.affectedTree,n,r,s)}else{if(e.type!==Ch.LISTEN_COMPLETE)throw xs("Unknown operation type: "+e.type);i=this.listenComplete_(t,e.path,n,s)}var h=s.getChanges();return il.maybeAddValueEvent_(t,i,h),new nl(i,h)},il.maybeAddValueEvent_=function(t,e,n){var r=e.getEventCache();if(r.isFullyInitialized()){var i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=t.getCompleteEventSnap();(0<n.length||!t.getEventCache().isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(Gh.valueChange(e.getCompleteEventSnap()))}},il.prototype.generateEventCacheAfterServerEvent_=function(t,e,n,r,i){var o=t.getEventCache();if(null!=n.shadowingWrite(e))return t;var s=void 0,a=void 0;if(e.isEmpty())if(Ps(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()){var u=t.getCompleteServerSnap(),c=u instanceof $c?u:$c.EMPTY_NODE,h=n.calcCompleteEventChildren(c);s=this.filter_.updateFullNode(t.getEventCache().getNode(),h,i)}else{var l=n.calcCompleteEventCache(t.getCompleteServerSnap());s=this.filter_.updateFullNode(t.getEventCache().getNode(),l,i)}else{var f=e.getFront();if(".priority"===f){Ps(1===e.getLength(),"Can't have a priority with additional path components");var p=o.getNode();a=t.getServerCache().getNode();var d=n.calcEventCacheAfterServerOverwrite(e,p,a);s=null!=d?this.filter_.updatePriority(p,d):o.getNode()}else{var v=e.popFront(),y=void 0;if(o.isCompleteForChild(f)){a=t.getServerCache().getNode();var g=n.calcEventCacheAfterServerOverwrite(e,o.getNode(),a);y=null!=g?o.getNode().getImmediateChild(f).updateChild(v,g):o.getNode().getImmediateChild(f)}else y=n.calcCompleteChild(f,t.getServerCache());s=null!=y?this.filter_.updateChild(o.getNode(),f,y,v,r,i):o.getNode()}}return t.updateEventSnap(s,o.isFullyInitialized()||e.isEmpty(),this.filter_.filtersNodes())},il.prototype.applyServerOverwrite_=function(t,e,n,r,i,o,s){var a,u=t.getServerCache(),c=o?this.filter_:this.filter_.getIndexedFilter();if(e.isEmpty())a=c.updateFullNode(u.getNode(),n,null);else if(c.filtersNodes()&&!u.isFiltered()){var h=u.getNode().updateChild(e,n);a=c.updateFullNode(u.getNode(),h,null)}else{var l=e.getFront();if(!u.isCompleteForPath(e)&&1<e.getLength())return t;var f=e.popFront(),p=u.getNode().getImmediateChild(l).updateChild(f,n);a=".priority"===l?c.updatePriority(u.getNode(),p):c.updateChild(u.getNode(),l,p,f,Zh,null)}var d=t.updateServerSnap(a,u.isFullyInitialized()||e.isEmpty(),c.filtersNodes()),v=new tl(r,d,i);return this.generateEventCacheAfterServerEvent_(d,e,r,v,s)},il.prototype.applyUserOverwrite_=function(t,e,n,r,i,o){var s,a,u=t.getEventCache(),c=new tl(r,t,i);if(e.isEmpty())a=this.filter_.updateFullNode(t.getEventCache().getNode(),n,o),s=t.updateEventSnap(a,!0,this.filter_.filtersNodes());else{var h=e.getFront();if(".priority"===h)a=this.filter_.updatePriority(t.getEventCache().getNode(),n),s=t.updateEventSnap(a,u.isFullyInitialized(),u.isFiltered());else{var l=e.popFront(),f=u.getNode().getImmediateChild(h),p=void 0;if(l.isEmpty())p=n;else{var d=c.getCompleteChild(h);p=null!=d?".priority"===l.getBack()&&d.getChild(l.parent()).isEmpty()?d:d.updateChild(l,n):$c.EMPTY_NODE}if(f.equals(p))s=t;else{var v=this.filter_.updateChild(u.getNode(),h,p,l,c,o);s=t.updateEventSnap(v,u.isFullyInitialized(),this.filter_.filtersNodes())}}}return s},il.cacheHasChild_=function(t,e){return t.getEventCache().isCompleteForChild(e)},il.prototype.applyUserMerge_=function(r,i,t,o,s,a){var u=this,c=r;return t.foreach(function(t,e){var n=i.child(t);il.cacheHasChild_(r,n.getFront())&&(c=u.applyUserOverwrite_(c,n,e,o,s,a))}),t.foreach(function(t,e){var n=i.child(t);il.cacheHasChild_(r,n.getFront())||(c=u.applyUserOverwrite_(c,n,e,o,s,a))}),c},il.prototype.applyMerge_=function(n,t){return t.foreach(function(t,e){n=n.updateChild(t,e)}),n},il.prototype.applyServerMerge_=function(o,t,e,s,a,u,c){var h=this;if(o.getServerCache().getNode().isEmpty()&&!o.getServerCache().isFullyInitialized())return o;var n,l=o;n=t.isEmpty()?e:xh.Empty.setTree(t,e);var f=o.getServerCache().getNode();return n.children.inorderTraversal(function(t,e){if(f.hasChild(t)){var n=o.getServerCache().getNode().getImmediateChild(t),r=h.applyMerge_(n,e);l=h.applyServerOverwrite_(l,new Du(t),r,s,a,u,c)}}),n.children.inorderTraversal(function(t,e){var n=!o.getServerCache().isCompleteForChild(t)&&null==e.value;if(!f.hasChild(t)&&!n){var r=o.getServerCache().getNode().getImmediateChild(t),i=h.applyMerge_(r,e);l=h.applyServerOverwrite_(l,new Du(t),i,s,a,u,c)}}),l},il.prototype.ackUserWrite_=function(t,r,e,n,i,o){if(null!=n.shadowingWrite(r))return t;var s=t.getServerCache().isFiltered(),a=t.getServerCache();if(null!=e.value){if(r.isEmpty()&&a.isFullyInitialized()||a.isCompleteForPath(r))return this.applyServerOverwrite_(t,r,a.getNode().getChild(r),n,i,s,o);if(r.isEmpty()){var u=xh.Empty;return a.getNode().forEachChild(_c,function(t,e){u=u.set(new Du(t),e)}),this.applyServerMerge_(t,r,u,n,i,s,o)}return t}var c=xh.Empty;return e.foreach(function(t,e){var n=r.child(t);a.isCompleteForPath(n)&&(c=c.set(t,a.getNode().getChild(n)))}),this.applyServerMerge_(t,r,c,n,i,s,o)},il.prototype.listenComplete_=function(t,e,n,r){var i=t.getServerCache(),o=t.updateServerSnap(i.getNode(),i.isFullyInitialized()||e.isEmpty(),i.isFiltered());return this.generateEventCacheAfterServerEvent_(o,e,n,Zh,r)},il.prototype.revertUserWrite_=function(t,e,n,r,i){var o;if(null!=n.shadowingWrite(e))return t;var s=new tl(n,t,r),a=t.getEventCache().getNode(),u=void 0;if(e.isEmpty()||".priority"===e.getFront()){var c=void 0;if(t.getServerCache().isFullyInitialized())c=n.calcCompleteEventCache(t.getCompleteServerSnap());else{var h=t.getServerCache().getNode();Ps(h instanceof $c,"serverChildren would be complete if leaf node"),c=n.calcCompleteEventChildren(h)}c=c,u=this.filter_.updateFullNode(a,c,i)}else{var l=e.getFront(),f=n.calcCompleteChild(l,t.getServerCache());null==f&&t.getServerCache().isCompleteForChild(l)&&(f=a.getImmediateChild(l)),(u=null!=f?this.filter_.updateChild(a,l,f,e.popFront(),s,i):t.getEventCache().getNode().hasChild(l)?this.filter_.updateChild(a,l,$c.EMPTY_NODE,e.popFront(),s,i):a).isEmpty()&&t.getServerCache().isFullyInitialized()&&(o=n.calcCompleteEventCache(t.getCompleteServerSnap())).isLeafNode()&&(u=this.filter_.updateFullNode(u,o,i))}return o=t.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(Du.Empty),t.updateEventSnap(u,o,this.filter_.filtersNodes())},il);function il(t){this.filter_=t}var ol=(sl.prototype.generateEventsForChanges=function(t,e,n){var r=this,i=[],o=[];return t.forEach(function(t){t.type===Gh.CHILD_CHANGED&&r.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(Gh.childMovedChange(t.childName,t.snapshotNode))}),this.generateEventsForType_(i,Gh.CHILD_REMOVED,t,n,e),this.generateEventsForType_(i,Gh.CHILD_ADDED,t,n,e),this.generateEventsForType_(i,Gh.CHILD_MOVED,o,n,e),this.generateEventsForType_(i,Gh.CHILD_CHANGED,t,n,e),this.generateEventsForType_(i,Gh.VALUE,t,n,e),i},sl.prototype.generateEventsForType_=function(r,e,t,i,o){var s=this,n=t.filter(function(t){return t.type===e});n.sort(this.compareChanges_.bind(this)),n.forEach(function(e){var n=s.materializeSingleChange_(e,o);i.forEach(function(t){t.respondsTo(e.type)&&r.push(t.createEvent(n,s.query_))})})},sl.prototype.materializeSingleChange_=function(t,e){return"value"===t.type||"child_removed"===t.type||(t.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.index_)),t},sl.prototype.compareChanges_=function(t,e){if(null==t.childName||null==e.childName)throw xs("Should only compare child_ events.");var n=new fc(t.childName,t.snapshotNode),r=new fc(e.childName,e.snapshotNode);return this.index_.compare(n,r)},sl);function sl(t){this.query_=t,this.index_=this.query_.getQueryParams().getIndex()}var al,ul=(cl.prototype.getQuery=function(){return this.query_},cl.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},cl.prototype.getCompleteServerCache=function(t){var e=this.viewCache_.getCompleteServerSnap();return e&&(this.query_.getQueryParams().loadsAllData()||!t.isEmpty()&&!e.getImmediateChild(t.getFront()).isEmpty())?e.getChild(t):null},cl.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},cl.prototype.addEventRegistration=function(t){this.eventRegistrations_.push(t)},cl.prototype.removeEventRegistration=function(t,n){var r=[];if(n){Ps(null==t,"A cancel should cancel all event registrations.");var i=this.query_.path;this.eventRegistrations_.forEach(function(t){n=n;var e=t.createCancelEvent(n,i);e&&r.push(e)})}if(t){for(var e=[],o=0;o<this.eventRegistrations_.length;++o){var s=this.eventRegistrations_[o];if(s.matches(t)){if(t.hasAnyCallback()){e=e.concat(this.eventRegistrations_.slice(o+1));break}}else e.push(s)}this.eventRegistrations_=e}else this.eventRegistrations_=[];return r},cl.prototype.applyOperation=function(t,e,n){t.type===Ch.MERGE&&null!==t.source.queryId&&(Ps(this.viewCache_.getCompleteServerSnap(),"We should always have a full cache before handling merges"),Ps(this.viewCache_.getCompleteEventSnap(),"Missing event cache, even though we have a server cache"));var r=this.viewCache_,i=this.processor_.applyOperation(r,t,e,n);return this.processor_.assertIndexed(i.viewCache),Ps(i.viewCache.getServerCache().isFullyInitialized()||!r.getServerCache().isFullyInitialized(),"Once a server snap is complete, it should never go back"),this.viewCache_=i.viewCache,this.generateEventsForChanges_(i.changes,i.viewCache.getEventCache().getNode(),null)},cl.prototype.getInitialEvents=function(t){var e=this.viewCache_.getEventCache(),n=[];return e.getNode().isLeafNode()||e.getNode().forEachChild(Oc,function(t,e){n.push(Gh.childAddedChange(t,e))}),e.isFullyInitialized()&&n.push(Gh.valueChange(e.getNode())),this.generateEventsForChanges_(n,e.getNode(),t)},cl.prototype.generateEventsForChanges_=function(t,e,n){var r=n?[n]:this.eventRegistrations_;return this.eventGenerator_.generateEventsForChanges(t,e,r)},cl);function cl(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new Qh(n.getIndex()),i=n.getNodeFilter();this.processor_=new rl(i);var o=e.getServerCache(),s=e.getEventCache(),a=r.updateFullNode($c.EMPTY_NODE,o.getNode(),null),u=i.updateFullNode($c.EMPTY_NODE,s.getNode(),null),c=new Bh(a,o.isFullyInitialized(),r.filtersNodes()),h=new Bh(u,s.isFullyInitialized(),i.filtersNodes());this.viewCache_=new Hh(h,c),this.eventGenerator_=new ol(this.query_)}var hl=(Object.defineProperty(ll,"__referenceConstructor",{get:function(){return Ps(al,"Reference.ts has not been loaded"),al},set:function(t){Ps(!al,"__referenceConstructor has already been defined"),al=t},enumerable:!0,configurable:!0}),ll.prototype.isEmpty=function(){return 0===this.views.size},ll.prototype.applyOperation=function(t,e,n){var r,i,o=t.source.queryId;if(null!==o){var s=this.views.get(o);return Ps(null!=s,"SyncTree gave us an op for an invalid query."),s.applyOperation(t,e,n)}var a=[];try{for(var u=Cs(this.views.values()),c=u.next();!c.done;c=u.next())s=c.value,a=a.concat(s.applyOperation(t,e,n))}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return a},ll.prototype.addEventRegistration=function(t,e,n,r,i){var o=t.queryIdentifier(),s=this.views.get(o);if(!s){var a=n.calcCompleteEventCache(i?r:null),u=!1;u=!!a||(a=r instanceof $c?n.calcCompleteEventChildren(r):$c.EMPTY_NODE,!1);var c=new Hh(new Bh(a,u,!1),new Bh(r,i,!1));s=new ul(t,c),this.views.set(o,s)}return s.addEventRegistration(e),s.getInitialEvents(e)},ll.prototype.removeEventRegistration=function(t,e,n){var r,i,o=t.queryIdentifier(),s=[],a=[],u=this.hasCompleteView();if("default"===o)try{for(var c=Cs(this.views.entries()),h=c.next();!h.done;h=c.next()){var l=Ns(h.value,2),f=l[0],p=l[1];a=a.concat(p.removeEventRegistration(e,n)),p.isEmpty()&&(this.views.delete(f),p.getQuery().getQueryParams().loadsAllData()||s.push(p.getQuery()))}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}else(p=this.views.get(o))&&(a=a.concat(p.removeEventRegistration(e,n)),p.isEmpty()&&(this.views.delete(o),p.getQuery().getQueryParams().loadsAllData()||s.push(p.getQuery())));return u&&!this.hasCompleteView()&&s.push(new ll.__referenceConstructor(t.repo,t.path)),{removed:s,events:a}},ll.prototype.getQueryViews=function(){var e,t,n=[];try{for(var r=Cs(this.views.values()),i=r.next();!i.done;i=r.next()){var o=i.value;o.getQuery().getQueryParams().loadsAllData()||n.push(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},ll.prototype.getCompleteServerCache=function(t){var e,n,r=null;try{for(var i=Cs(this.views.values()),o=i.next();!o.done;o=i.next()){var s=o.value;r=r||s.getCompleteServerCache(t)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},ll.prototype.viewForQuery=function(t){if(t.getQueryParams().loadsAllData())return this.getCompleteView();var e=t.queryIdentifier();return this.views.get(e)},ll.prototype.viewExistsForQuery=function(t){return null!=this.viewForQuery(t)},ll.prototype.hasCompleteView=function(){return null!=this.getCompleteView()},ll.prototype.getCompleteView=function(){var e,t;try{for(var n=Cs(this.views.values()),r=n.next();!r.done;r=n.next()){var i=r.value;if(i.getQuery().getQueryParams().loadsAllData())return i}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return null},ll);function ll(){this.views=new Map}var fl=(pl.prototype.addWrite=function(t,e){if(t.isEmpty())return new pl(new xh(e));var n=this.writeTree_.findRootMostValueAndPath(t);if(null!=n){var r=n.path,i=n.value,o=Du.relativePath(r,t);return i=i.updateChild(o,e),new pl(this.writeTree_.set(r,i))}var s=new xh(e);return new pl(this.writeTree_.setTree(t,s))},pl.prototype.addWrites=function(n,t){var r=this;return Cu(t,function(t,e){r=r.addWrite(n.child(t),e)}),r},pl.prototype.removeWrite=function(t){return t.isEmpty()?pl.Empty:new pl(this.writeTree_.setTree(t,xh.Empty))},pl.prototype.hasCompleteWrite=function(t){return null!=this.getCompleteNode(t)},pl.prototype.getCompleteNode=function(t){var e=this.writeTree_.findRootMostValueAndPath(t);return null!=e?this.writeTree_.get(e.path).getChild(Du.relativePath(e.path,t)):null},pl.prototype.getCompleteChildren=function(){var n=[],t=this.writeTree_.value;return null!=t?t.isLeafNode()||t.forEachChild(Oc,function(t,e){n.push(new fc(t,e))}):this.writeTree_.children.inorderTraversal(function(t,e){null!=e.value&&n.push(new fc(t,e.value))}),n},pl.prototype.childCompoundWrite=function(t){if(t.isEmpty())return this;var e=this.getCompleteNode(t);return new pl(null!=e?new xh(e):this.writeTree_.subtree(t))},pl.prototype.isEmpty=function(){return this.writeTree_.isEmpty()},pl.prototype.apply=function(t){return function n(r,t,i){if(null!=t.value)return i.updateChild(r,t.value);var o=null;return t.children.inorderTraversal(function(t,e){".priority"===t?(Ps(null!==e.value,"Priority writes must always be leaf nodes"),o=e.value):i=n(r.child(t),e,i)}),i.getChild(r).isEmpty()||null===o||(i=i.updateChild(r.child(".priority"),o)),i}(Du.Empty,this.writeTree_,t)},pl.Empty=new pl(new xh(null)),pl);function pl(t){this.writeTree_=t}var dl=(vl.prototype.childWrites=function(t){return new yl(t,this)},vl.prototype.addOverwrite=function(t,e,n,r){Ps(n>this.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.allWrites_.push({path:t,snap:e,writeId:n,visible:r}),r&&(this.visibleWrites_=this.visibleWrites_.addWrite(t,e)),this.lastWriteId_=n},vl.prototype.addMerge=function(t,e,n){Ps(n>this.lastWriteId_,"Stacking an older merge on top of newer ones"),this.allWrites_.push({path:t,children:e,writeId:n,visible:!0}),this.visibleWrites_=this.visibleWrites_.addWrites(t,e),this.lastWriteId_=n},vl.prototype.getWrite=function(t){for(var e=0;e<this.allWrites_.length;e++){var n=this.allWrites_[e];if(n.writeId===t)return n}return null},vl.prototype.removeWrite=function(e){var n=this,t=this.allWrites_.findIndex(function(t){return t.writeId===e});Ps(0<=t,"removeWrite called with nonexistent writeId.");var r=this.allWrites_[t];this.allWrites_.splice(t,1);for(var i=r.visible,o=!1,s=this.allWrites_.length-1;i&&0<=s;){var a=this.allWrites_[s];a.visible&&(t<=s&&this.recordContainsPath_(a,r.path)?i=!1:r.path.contains(a.path)&&(o=!0)),s--}return!!i&&(o?this.resetTree_():r.snap?this.visibleWrites_=this.visibleWrites_.removeWrite(r.path):Cu(r.children,function(t){n.visibleWrites_=n.visibleWrites_.removeWrite(r.path.child(t))}),!0)},vl.prototype.getCompleteWriteData=function(t){return this.visibleWrites_.getCompleteNode(t)},vl.prototype.calcCompleteEventCache=function(e,t,n,r){if(n||r){var i=this.visibleWrites_.childCompoundWrite(e);if(!r&&i.isEmpty())return t;if(r||null!=t||i.hasCompleteWrite(Du.Empty)){var o=vl.layerTree_(this.allWrites_,function(t){return(t.visible||r)&&(!n||!~n.indexOf(t.writeId))&&(t.path.contains(e)||e.contains(t.path))},e);return u=t||$c.EMPTY_NODE,o.apply(u)}return null}var s=this.visibleWrites_.getCompleteNode(e);if(null!=s)return s;var a=this.visibleWrites_.childCompoundWrite(e);if(a.isEmpty())return t;if(null!=t||a.hasCompleteWrite(Du.Empty)){var u=t||$c.EMPTY_NODE;return a.apply(u)}return null},vl.prototype.calcCompleteEventChildren=function(t,e){var r=$c.EMPTY_NODE,n=this.visibleWrites_.getCompleteNode(t);if(n)return n.isLeafNode()||n.forEachChild(Oc,function(t,e){r=r.updateImmediateChild(t,e)}),r;if(e){var i=this.visibleWrites_.childCompoundWrite(t);return e.forEachChild(Oc,function(t,e){var n=i.childCompoundWrite(new Du(t)).apply(e);r=r.updateImmediateChild(t,n)}),i.getCompleteChildren().forEach(function(t){r=r.updateImmediateChild(t.name,t.node)}),r}return this.visibleWrites_.childCompoundWrite(t).getCompleteChildren().forEach(function(t){r=r.updateImmediateChild(t.name,t.node)}),r},vl.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n,r){Ps(n||r,"Either existingEventSnap or existingServerSnap must exist");var i=t.child(e);if(this.visibleWrites_.hasCompleteWrite(i))return null;var o=this.visibleWrites_.childCompoundWrite(i);return o.isEmpty()?r.getChild(e):o.apply(r.getChild(e))},vl.prototype.calcCompleteChild=function(t,e,n){var r=t.child(e),i=this.visibleWrites_.getCompleteNode(r);return null!=i?i:n.isCompleteForChild(e)?this.visibleWrites_.childCompoundWrite(r).apply(n.getNode().getImmediateChild(e)):null},vl.prototype.shadowingWrite=function(t){return this.visibleWrites_.getCompleteNode(t)},vl.prototype.calcIndexedSlice=function(t,e,n,r,i,o){var s,a=this.visibleWrites_.childCompoundWrite(t),u=a.getCompleteNode(Du.Empty);if(null!=u)s=u;else{if(null==e)return[];s=a.apply(e)}if((s=s.withIndex(o)).isEmpty()||s.isLeafNode())return[];for(var c=[],h=o.getCompare(),l=i?s.getReverseIteratorFrom(n,o):s.getIteratorFrom(n,o),f=l.getNext();f&&c.length<r;)0!==h(f,n)&&c.push(f),f=l.getNext();return c},vl.prototype.recordContainsPath_=function(t,e){if(t.snap)return t.path.contains(e);for(var n in t.children)if(t.children.hasOwnProperty(n)&&t.path.child(n).contains(e))return!0;return!1},vl.prototype.resetTree_=function(){this.visibleWrites_=vl.layerTree_(this.allWrites_,vl.DefaultFilter_,Du.Empty),0<this.allWrites_.length?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},vl.DefaultFilter_=function(t){return t.visible},vl.layerTree_=function(t,e,n){for(var r=fl.Empty,i=0;i<t.length;++i){var o=t[i];if(e(o)){var s=o.path,a=void 0;if(o.snap)n.contains(s)?(a=Du.relativePath(n,s),r=r.addWrite(a,o.snap)):s.contains(n)&&(a=Du.relativePath(s,n),r=r.addWrite(Du.Empty,o.snap.getChild(a)));else{if(!o.children)throw xs("WriteRecord should have .snap or .children");if(n.contains(s))a=Du.relativePath(n,s),r=r.addWrites(a,o.children);else if(s.contains(n))if((a=Du.relativePath(s,n)).isEmpty())r=r.addWrites(Du.Empty,o.children);else{var u=ta(o.children,a.getFront());if(u){var c=u.getChild(a.popFront());r=r.addWrite(Du.Empty,c)}}}}}return r},vl);function vl(){this.visibleWrites_=fl.Empty,this.allWrites_=[],this.lastWriteId_=-1}var yl=(gl.prototype.calcCompleteEventCache=function(t,e,n){return this.writeTree_.calcCompleteEventCache(this.treePath_,t,e,n)},gl.prototype.calcCompleteEventChildren=function(t){return this.writeTree_.calcCompleteEventChildren(this.treePath_,t)},gl.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n){return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_,t,e,n)},gl.prototype.shadowingWrite=function(t){return this.writeTree_.shadowingWrite(this.treePath_.child(t))},gl.prototype.calcIndexedSlice=function(t,e,n,r,i){return this.writeTree_.calcIndexedSlice(this.treePath_,t,e,n,r,i)},gl.prototype.calcCompleteChild=function(t,e){return this.writeTree_.calcCompleteChild(this.treePath_,t,e)},gl.prototype.child=function(t){return new gl(this.treePath_.child(t),this.writeTree_)},gl);function gl(t,e){this.treePath_=t,this.writeTree_=e}var ml=(wl.prototype.applyUserOverwrite=function(t,e,n,r){return this.pendingWriteTree_.addOverwrite(t,e,n,r),r?this.applyOperationToSyncPoints_(new Uh(kh.User,t,e)):[]},wl.prototype.applyUserMerge=function(t,e,n){this.pendingWriteTree_.addMerge(t,e,n);var r=xh.fromObject(e);return this.applyOperationToSyncPoints_(new qh(kh.User,t,r))},wl.prototype.ackUserWrite=function(t,e){void 0===e&&(e=!1);var n=this.pendingWriteTree_.getWrite(t);if(this.pendingWriteTree_.removeWrite(t)){var r=xh.Empty;return null!=n.snap?r=r.set(Du.Empty,!0):Cu(n.children,function(t,e){r=r.set(new Du(t),e)}),this.applyOperationToSyncPoints_(new Dh(n.path,r,e))}return[]},wl.prototype.applyServerOverwrite=function(t,e){return this.applyOperationToSyncPoints_(new Uh(kh.Server,t,e))},wl.prototype.applyServerMerge=function(t,e){var n=xh.fromObject(e);return this.applyOperationToSyncPoints_(new qh(kh.Server,t,n))},wl.prototype.applyListenComplete=function(t){return this.applyOperationToSyncPoints_(new Mh(kh.Server,t))},wl.prototype.applyTaggedQueryOverwrite=function(t,e,n){var r=this.queryKeyForTag_(n);if(null==r)return[];var i=wl.parseQueryKey_(r),o=i.path,s=i.queryId,a=Du.relativePath(o,t),u=new Uh(kh.forServerTaggedQuery(s),a,e);return this.applyTaggedOperation_(o,u)},wl.prototype.applyTaggedQueryMerge=function(t,e,n){var r=this.queryKeyForTag_(n);if(r){var i=wl.parseQueryKey_(r),o=i.path,s=i.queryId,a=Du.relativePath(o,t),u=xh.fromObject(e),c=new qh(kh.forServerTaggedQuery(s),a,u);return this.applyTaggedOperation_(o,c)}return[]},wl.prototype.applyTaggedListenComplete=function(t,e){var n=this.queryKeyForTag_(e);if(n){var r=wl.parseQueryKey_(n),i=r.path,o=r.queryId,s=Du.relativePath(i,t),a=new Mh(kh.forServerTaggedQuery(o),s);return this.applyTaggedOperation_(i,a)}return[]},wl.prototype.addEventRegistration=function(t,e){var r=t.path,i=null,o=!1;this.syncPointTree_.foreachOnPath(r,function(t,e){var n=Du.relativePath(t,r);i=i||e.getCompleteServerCache(n),o=o||e.hasCompleteView()});var n,s=this.syncPointTree_.get(r);s?(o=o||s.hasCompleteView(),i=i||s.getCompleteServerCache(Du.Empty)):(s=new hl,this.syncPointTree_=this.syncPointTree_.set(r,s)),null!=i?n=!0:(n=!1,i=$c.EMPTY_NODE,this.syncPointTree_.subtree(r).foreachChild(function(t,e){var n=e.getCompleteServerCache(Du.Empty);n&&(i=i.updateImmediateChild(t,n))}));var a=s.viewExistsForQuery(t);if(!a&&!t.getQueryParams().loadsAllData()){var u=wl.makeQueryKey_(t);Ps(!this.queryToTagMap.has(u),"View does not exist, but we have a tag");var c=wl.getNextQueryTag_();this.queryToTagMap.set(u,c),this.tagToQueryMap.set(c,u)}var h=this.pendingWriteTree_.childWrites(r),l=s.addEventRegistration(t,e,h,i,n);if(!a&&!o){var f=s.viewForQuery(t);l=l.concat(this.setupListener_(t,f))}return l},wl.prototype.removeEventRegistration=function(t,e,n){var r=this,i=t.path,o=this.syncPointTree_.get(i),s=[];if(o&&("default"===t.queryIdentifier()||o.viewExistsForQuery(t))){var a=o.removeEventRegistration(t,e,n);o.isEmpty()&&(this.syncPointTree_=this.syncPointTree_.remove(i));var u=a.removed;s=a.events;var c=-1!==u.findIndex(function(t){return t.getQueryParams().loadsAllData()}),h=this.syncPointTree_.findOnPath(i,function(t,e){return e.hasCompleteView()});if(c&&!h){var l=this.syncPointTree_.subtree(i);if(!l.isEmpty())for(var f=this.collectDistinctViewsForSubTree_(l),p=0;p<f.length;++p){var d=f[p],v=d.getQuery(),y=this.createListenerForView_(d);this.listenProvider_.startListening(wl.queryForListening_(v),this.tagForQuery_(v),y.hashFn,y.onComplete)}}!h&&0<u.length&&!n&&(c?this.listenProvider_.stopListening(wl.queryForListening_(t),null):u.forEach(function(t){var e=r.queryToTagMap.get(wl.makeQueryKey_(t));r.listenProvider_.stopListening(wl.queryForListening_(t),e)})),this.removeTags_(u)}return s},wl.prototype.calcCompleteEventCache=function(i,t){var e=this.pendingWriteTree_,n=this.syncPointTree_.findOnPath(i,function(t,e){var n=Du.relativePath(t,i),r=e.getCompleteServerCache(n);if(r)return r});return e.calcCompleteEventCache(i,n,t,!0)},wl.prototype.collectDistinctViewsForSubTree_=function(t){return t.fold(function(t,e,n){if(e&&e.hasCompleteView())return[e.getCompleteView()];var r=[];return e&&(r=e.getQueryViews()),Cu(n,function(t,e){r=r.concat(e)}),r})},wl.prototype.removeTags_=function(t){for(var e=0;e<t.length;++e){var n=t[e];if(!n.getQueryParams().loadsAllData()){var r=wl.makeQueryKey_(n),i=this.queryToTagMap.get(r);this.queryToTagMap.delete(r),this.tagToQueryMap.delete(i)}}},wl.queryForListening_=function(t){return t.getQueryParams().loadsAllData()&&!t.getQueryParams().isDefault()?t.getRef():t},wl.prototype.setupListener_=function(t,e){var n=t.path,r=this.tagForQuery_(t),i=this.createListenerForView_(e),o=this.listenProvider_.startListening(wl.queryForListening_(t),r,i.hashFn,i.onComplete),s=this.syncPointTree_.subtree(n);if(r)Ps(!s.value.hasCompleteView(),"If we're adding a query, it shouldn't be shadowed");else for(var a=s.fold(function(t,e,n){if(!t.isEmpty()&&e&&e.hasCompleteView())return[e.getCompleteView().getQuery()];var r=[];return e&&(r=r.concat(e.getQueryViews().map(function(t){return t.getQuery()}))),Cu(n,function(t,e){r=r.concat(e)}),r}),u=0;u<a.length;++u){var c=a[u];this.listenProvider_.stopListening(wl.queryForListening_(c),this.tagForQuery_(c))}return o},wl.prototype.createListenerForView_=function(t){var n=this,r=t.getQuery(),i=this.tagForQuery_(r);return{hashFn:function(){return(t.getServerCache()||$c.EMPTY_NODE).hash()},onComplete:function(t){if("ok"===t)return i?n.applyTaggedListenComplete(r.path,i):n.applyListenComplete(r.path);var e=function(t,e){var n="Unknown Error";"too_big"===t?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"===t?n="Client doesn't have permission to access the desired data.":"unavailable"===t&&(n="The service is unavailable");var r=new Error(t+" at "+e.path.toString()+": "+n);return r.code=t.toUpperCase(),r}(t,r);return n.removeEventRegistration(r,null,e)}}},wl.makeQueryKey_=function(t){return t.path.toString()+"$"+t.queryIdentifier()},wl.parseQueryKey_=function(t){var e=t.indexOf("$");return Ps(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new Du(t.substr(0,e))}},wl.prototype.queryKeyForTag_=function(t){return this.tagToQueryMap.get(t)},wl.prototype.tagForQuery_=function(t){var e=wl.makeQueryKey_(t);return this.queryToTagMap.get(e)},wl.getNextQueryTag_=function(){return wl.nextQueryTag_++},wl.prototype.applyTaggedOperation_=function(t,e){var n=this.syncPointTree_.get(t);Ps(n,"Missing sync point for query tag that we're tracking");var r=this.pendingWriteTree_.childWrites(t);return n.applyOperation(e,r,null)},wl.prototype.applyOperationToSyncPoints_=function(t){return this.applyOperationHelper_(t,this.syncPointTree_,null,this.pendingWriteTree_.childWrites(Du.Empty))},wl.prototype.applyOperationHelper_=function(t,e,n,r){if(t.path.isEmpty())return this.applyOperationDescendantsHelper_(t,e,n,r);var i=e.get(Du.Empty);null==n&&null!=i&&(n=i.getCompleteServerCache(Du.Empty));var o=[],s=t.path.getFront(),a=t.operationForChild(s),u=e.children.get(s);if(u&&a){var c=n?n.getImmediateChild(s):null,h=r.child(s);o=o.concat(this.applyOperationHelper_(a,u,c,h))}return i&&(o=o.concat(i.applyOperation(t,r,n))),o},wl.prototype.applyOperationDescendantsHelper_=function(o,t,s,a){var u=this,e=t.get(Du.Empty);null==s&&null!=e&&(s=e.getCompleteServerCache(Du.Empty));var c=[];return t.children.inorderTraversal(function(t,e){var n=s?s.getImmediateChild(t):null,r=a.child(t),i=o.operationForChild(t);i&&(c=c.concat(u.applyOperationDescendantsHelper_(i,e,n,r)))}),e&&(c=c.concat(e.applyOperation(o,a,s))),c},wl.nextQueryTag_=1,wl);function wl(t){this.listenProvider_=t,this.syncPointTree_=xh.Empty,this.pendingWriteTree_=new dl,this.tagToQueryMap=new Map,this.queryToTagMap=new Map}var bl=(_l.prototype.getNode=function(t){return this.rootNode_.getChild(t)},_l.prototype.updateSnapshot=function(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)},_l);function _l(){this.rootNode_=$c.EMPTY_NODE}var El=(Il.prototype.getToken=function(t){return this.auth_?this.auth_.getToken(t).catch(function(t){return t&&"auth/token-not-initialized"===t.code?(ou("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t)}):Promise.resolve(null)},Il.prototype.addTokenChangeListener=function(e){this.auth_?this.auth_.addAuthTokenListener(e):(setTimeout(function(){return e(null)},0),this.authProvider_.get().then(function(t){return t.addAuthTokenListener(e)}))},Il.prototype.removeTokenChangeListener=function(e){this.authProvider_.get().then(function(t){return t.removeAuthTokenListener(e)})},Il.prototype.notifyForInvalidToken=function(){var t='Provided authentication credentials for the app named "'+this.app_.name+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.app_.options?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.app_.options?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',cu(t)},Il);function Il(t,e){var n=this;this.app_=t,this.authProvider_=e,this.auth_=null,this.auth_=e.getImmediate({optional:!0}),this.auth_||e.get().then(function(t){return n.auth_=t})}var Tl=(Sl.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),Zs(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},Sl.prototype.get=function(){return Ms(this.counters_)},Sl);function Sl(){this.counters_={}}var Cl=(Nl.getCollection=function(t){var e=t.toString();return this.collections_[e]||(this.collections_[e]=new Tl),this.collections_[e]},Nl.getOrCreateReporter=function(t,e){var n=t.toString();return this.reporters_[n]||(this.reporters_[n]=e()),this.reporters_[n]},Nl.collections_={},Nl.reporters_={},Nl);function Nl(){}var Al=(kl.prototype.get=function(){var t=this.collection_.get(),n=Is({},t);return this.last_&&Cu(this.last_,function(t,e){n[t]=n[t]-e}),this.last_=t,n},kl);function kl(t){this.collection_=t,this.last_=null}var Rl=(Ol.prototype.includeStat=function(t){this.statsToReport_[t]=!0},Ol.prototype.reportStats_=function(){var n=this,t=this.statsListener_.get(),r={},i=!1;Cu(t,function(t,e){0<e&&Zs(n.statsToReport_,t)&&(r[t]=e,i=!0)}),i&&this.server_.reportStats(r),ku(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},Ol);function Ol(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new Al(t);var n=1e4+2e4*Math.random();ku(this.reportStats_.bind(this),Math.floor(n))}var Dl=(Pl.prototype.queueEvents=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n],i=r.getPath();null===e||i.equals(e.getPath())||(this.eventLists_.push(e),e=null),null===e&&(e=new xl(i)),e.add(r)}e&&this.eventLists_.push(e)},Pl.prototype.raiseEventsAtPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_(function(t){return t.equals(e)})},Pl.prototype.raiseEventsForChangedPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_(function(t){return t.contains(e)||e.contains(t)})},Pl.prototype.raiseQueuedEventsMatchingPredicate_=function(t){this.recursionDepth_++;for(var e=!0,n=0;n<this.eventLists_.length;n++){var r=this.eventLists_[n];r&&(t(r.getPath())?(this.eventLists_[n].raise(),this.eventLists_[n]=null):e=!1)}e&&(this.eventLists_=[]),this.recursionDepth_--},Pl);function Pl(){this.eventLists_=[],this.recursionDepth_=0}var xl=(Ll.prototype.add=function(t){this.events_.push(t)},Ll.prototype.raise=function(){for(var t=0;t<this.events_.length;t++){var e=this.events_[t];if(null!==e){this.events_[t]=null;var n=e.getEventRunner();bu&&ou("event: "+e.toString()),Au(n)}}},Ll.prototype.getPath=function(){return this.path_},Ll);function Ll(t){this.path_=t,this.events_=[]}var Ml=(Fl.prototype.trigger=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(Array.isArray(this.listeners_[t]))for(var r=As(this.listeners_[t]),i=0;i<r.length;i++)r[i].callback.apply(r[i].context,e)},Fl.prototype.on=function(t,e,n){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:e,context:n});var r=this.getInitialEvent(t);r&&e.apply(n,r)},Fl.prototype.off=function(t,e,n){this.validateEventType_(t);for(var r=this.listeners_[t]||[],i=0;i<r.length;i++)if(r[i].callback===e&&(!n||n===r[i].context))return void r.splice(i,1)},Fl.prototype.validateEventType_=function(e){Ps(this.allowedEvents_.find(function(t){return t===e}),"Unknown event: "+e)},Fl);function Fl(t){this.allowedEvents_=t,this.listeners_={},Ps(Array.isArray(t)&&0<t.length,"Requires a non-empty array")}var Ul,jl=(Es(ql,Ul=Ml),ql.getInstance=function(){return new ql},ql.prototype.getInitialEvent=function(t){return Ps("visible"===t,"Unknown event type: "+t),[this.visible_]},ql);function ql(){var e,t,n=Ul.call(this,["visible"])||this;return"undefined"!=typeof document&&void 0!==document.addEventListener&&(void 0!==document.hidden?(t="visibilitychange",e="hidden"):void 0!==document.mozHidden?(t="mozvisibilitychange",e="mozHidden"):void 0!==document.msHidden?(t="msvisibilitychange",e="msHidden"):void 0!==document.webkitHidden&&(t="webkitvisibilitychange",e="webkitHidden")),n.visible_=!0,t&&document.addEventListener(t,function(){var t=!document[e];t!==n.visible_&&(n.visible_=t,n.trigger("visible",t))},!1),n}var Vl,Bl=(Es(Wl,Vl=Ml),Wl.getInstance=function(){return new Wl},Wl.prototype.getInitialEvent=function(t){return Ps("online"===t,"Unknown event type: "+t),[this.online_]},Wl.prototype.currentlyOnline=function(){return this.online_},Wl);function Wl(){var t=Vl.call(this,["online"])||this;return t.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||Vs()||(window.addEventListener("online",function(){t.online_||(t.online_=!0,t.trigger("online",!0))},!1),window.addEventListener("offline",function(){t.online_&&(t.online_=!1,t.trigger("online",!1))},!1)),t}var Hl=(Gl.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},Gl.prototype.handleResponse=function(t,e){var r=this;this.pendingResponses[t]=e;for(var n=function(){var e=i.pendingResponses[i.currentResponseNum];delete i.pendingResponses[i.currentResponseNum];for(var t=function(t){e[t]&&Au(function(){r.onMessage_(e[t])})},n=0;n<e.length;++n)t(n);if(i.currentResponseNum===i.closeAfterResponse)return i.onClose&&(i.onClose(),i.onClose=null),"break";i.currentResponseNum++},i=this;this.pendingResponses[this.currentResponseNum]&&"break"!==n(););},Gl);function Gl(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}var zl=(Ql.prototype.open=function(t,e){var s=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new Hl(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(function(){s.log_("Timed out trying to connect."),s.onClosed_(),s.connectTimeoutTimer_=null},Math.floor(3e4)),function(t){if("complete"===document.readyState)t();else{var e=!1,n=function(){document.body?e||(e=!0,t()):setTimeout(n,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&n()}),window.attachEvent("onload",n))}}(function(){if(!s.isClosed_){s.scriptTagHolder=new Yl(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Ns(t,5),r=n[0],i=n[1],o=n[2];if(n[3],n[4],s.incrementIncomingBytes_(t),s.scriptTagHolder)if(s.connectTimeoutTimer_&&(clearTimeout(s.connectTimeoutTimer_),s.connectTimeoutTimer_=null),s.everConnected_=!0,"start"===r)s.id=i,s.password=o;else{if("close"!==r)throw new Error("Unrecognized command received: "+r);i?(s.scriptTagHolder.sendNewPolls=!1,s.myPacketOrderer.closeAfter(i,function(){s.onClosed_()})):s.onClosed_()}},function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Ns(t,2),r=n[0],i=n[1];s.incrementIncomingBytes_(t),s.myPacketOrderer.handleResponse(r,i)},function(){s.onClosed_()},s.urlFn);var t={start:"t"};t.ser=Math.floor(1e8*Math.random()),s.scriptTagHolder.uniqueCallbackIdentifier&&(t.cb=s.scriptTagHolder.uniqueCallbackIdentifier),t.v="5",s.transportSessionId&&(t.s=s.transportSessionId),s.lastSessionId&&(t.ls=s.lastSessionId),"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(Mu)&&(t.r="f");var e=s.urlFn(t);s.log_("Connecting via long-poll to "+e),s.scriptTagHolder.addTag(e,function(){})}})},Ql.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},Ql.forceAllow=function(){Ql.forceAllow_=!0},Ql.forceDisallow=function(){Ql.forceDisallow_=!0},Ql.isAvailable=function(){return!!Ql.forceAllow_||!(Ql.forceDisallow_||"undefined"==typeof document||null==document.createElement||"object"==typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href)||"object"==typeof Windows&&"object"==typeof Windows.UI)},Ql.prototype.markConnectionHealthy=function(){},Ql.prototype.shutdown_=function(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)},Ql.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},Ql.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},Ql.prototype.send=function(t){var e=Xs(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);for(var n=function(t){var e=Rs(t);return Ls.encodeByteArray(e,!0)}(e),r=pu(n,1840),i=0;i<r.length;i++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,r.length,r[i]),this.curSegmentNum++},Ql.prototype.addDisconnectPingFrame=function(t,e){this.myDisconnFrame=document.createElement("iframe");var n={dframe:"t"};n.id=t,n.pw=e,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)},Ql.prototype.incrementIncomingBytes_=function(t){var e=Xs(t).length;this.bytesReceived+=e,this.stats_.incrementCounter("bytes_received",e)},Ql);function Ql(t,e,n,r){this.connId=t,this.repoInfo=e,this.transportSessionId=n,this.lastSessionId=r,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=su(t),this.stats_=Cl.getCollection(e),this.urlFn=function(t){return e.connectionURL(Uu,t)}}var Yl=(Jl.createIFrame_=function(){var e=document.createElement("iframe");if(e.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(e);try{e.contentWindow.document||ou("No IE domain setting required")}catch(t){var n=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+n+"';document.close();})())"}return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e},Jl.prototype.close=function(){var t=this;this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout(function(){null!==t.myIFrame&&(document.body.removeChild(t.myIFrame),t.myIFrame=null)},Math.floor(0)));var e=this.onDisconnect;e&&(this.onDisconnect=null,e())},Jl.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},Jl.prototype.newRequest_=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(0<this.pendingSegs.length?2:1)){this.currentSerial++;var t={};t.id=this.myID,t.pw=this.myPW,t.ser=this.currentSerial;for(var e=this.urlFn(t),n="",r=0;0<this.pendingSegs.length&&this.pendingSegs[0].d.length+30+n.length<=1870;){var i=this.pendingSegs.shift();n=n+"&seg"+r+"="+i.seg+"&ts"+r+"="+i.ts+"&d"+r+"="+i.d,r++}return e+=n,this.addLongPollTag_(e,this.currentSerial),!0}return!1},Jl.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},Jl.prototype.addLongPollTag_=function(t,e){var n=this;function r(){n.outstandingRequests.delete(e),n.newRequest_()}this.outstandingRequests.add(e);var i=setTimeout(r,Math.floor(25e3));this.addTag(t,function(){clearTimeout(i),r()})},Jl.prototype.addTag=function(t,n){var r=this;setTimeout(function(){try{if(!r.sendNewPolls)return;var e=r.myIFrame.doc.createElement("script");e.type="text/javascript",e.async=!0,e.src=t,e.onload=e.onreadystatechange=function(){var t=e.readyState;t&&"loaded"!==t&&"complete"!==t||(e.onload=e.onreadystatechange=null,e.parentNode&&e.parentNode.removeChild(e),n())},e.onerror=function(){ou("Long-poll script failed to load: "+t),r.sendNewPolls=!1,r.close()},r.myIFrame.doc.body.appendChild(e)}catch(t){}},Math.floor(1))},Jl);function Jl(t,e,n,r){this.onDisconnect=n,this.urlFn=r,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0,this.uniqueCallbackIdentifier=mu(),window["pLPCommand"+this.uniqueCallbackIdentifier]=t,window["pRTLPCB"+this.uniqueCallbackIdentifier]=e,this.myIFrame=Jl.createIFrame_();var i="";this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length)&&(i='<script>document.domain="'+document.domain+'";<\/script>');var o="<html><body>"+i+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(o),this.myIFrame.doc.close()}catch(t){ou("frame writing exception"),t.stack&&ou(t.stack),ou(t)}}var Xl="";var $l=null;"undefined"!=typeof MozWebSocket?$l=MozWebSocket:"undefined"!=typeof WebSocket&&($l=WebSocket);var Zl=(tf.connectionURL_=function(t,e,n){var r={v:"5"};return"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(Mu)&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),t.connectionURL(Fu,r)},tf.prototype.open=function(t,e){var n=this;this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,vu.set("previous_websocket_failure",!0);try{if(Ws()){var r=Ds.NODE_ADMIN?"AdminNode":"Node",i={headers:{"User-Agent":"Firebase/5/"+Xl+"/"+process.platform+"/"+r}},o=process.env,s=0===this.connURL.indexOf("wss://")?o.HTTPS_PROXY||o.https_proxy:o.HTTP_PROXY||o.http_proxy;s&&(i.proxy={origin:s}),this.mySock=new $l(this.connURL,[],i)}else this.mySock=new $l(this.connURL)}catch(t){this.log_("Error instantiating WebSocket.");var a=t.message||t.data;return a&&this.log_(a),void this.onClosed_()}this.mySock.onopen=function(){n.log_("Websocket connected."),n.everConnected_=!0},this.mySock.onclose=function(){n.log_("Websocket connection was disconnected."),n.mySock=null,n.onClosed_()},this.mySock.onmessage=function(t){n.handleIncomingFrame(t)},this.mySock.onerror=function(t){n.log_("WebSocket error. Closing connection.");var e=t.message||t.data;e&&n.log_(e),n.onClosed_()}},tf.prototype.start=function(){},tf.forceDisallow=function(){tf.forceDisallow_=!0},tf.isAvailable=function(){var t=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var e=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);e&&1<e.length&&parseFloat(e[1])<4.4&&(t=!0)}return!t&&null!==$l&&!tf.forceDisallow_},tf.previouslyFailed=function(){return vu.isInMemoryStorage||!0===vu.get("previous_websocket_failure")},tf.prototype.markConnectionHealthy=function(){vu.remove("previous_websocket_failure")},tf.prototype.appendFrame_=function(t){if(this.frames.push(t),this.frames.length===this.totalFrames){var e=this.frames.join("");this.frames=null;var n=Js(e);this.onMessage(n)}},tf.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},tf.prototype.extractFrameCount_=function(t){if(Ps(null===this.frames,"We already have a frame buffer"),t.length<=6){var e=Number(t);if(!isNaN(e))return this.handleNewFrameCount_(e),null}return this.handleNewFrameCount_(1),t},tf.prototype.handleIncomingFrame=function(t){if(null!==this.mySock){var e=t.data;if(this.bytesReceived+=e.length,this.stats_.incrementCounter("bytes_received",e.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(e);else{var n=this.extractFrameCount_(e);null!==n&&this.appendFrame_(n)}}},tf.prototype.send=function(t){this.resetKeepAlive();var e=Xs(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);var n=pu(e,16384);1<n.length&&this.sendString_(String(n.length));for(var r=0;r<n.length;r++)this.sendString_(n[r])},tf.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},tf.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},tf.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},tf.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(function(){t.mySock&&t.sendString_("0"),t.resetKeepAlive()},Math.floor(45e3))},tf.prototype.sendString_=function(t){try{this.mySock.send(t)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}},tf.responsesRequiredToBeHealthy=2,tf.healthyTimeout=3e4,tf);function tf(t,e,n,r){this.connId=t,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=su(this.connId),this.stats_=Cl.getCollection(e),this.connURL=tf.connectionURL_(e,n,r)}var ef=(Object.defineProperty(nf,"ALL_TRANSPORTS",{get:function(){return[zl,Zl]},enumerable:!0,configurable:!0}),nf.prototype.initTransports_=function(t){var e,n,r=Zl&&Zl.isAvailable(),i=r&&!Zl.previouslyFailed();if(t.webSocketOnly&&(r||cu("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)this.transports_=[Zl];else{var o=this.transports_=[];try{for(var s=Cs(nf.ALL_TRANSPORTS),a=s.next();!a.done;a=s.next()){var u=a.value;u&&u.isAvailable()&&o.push(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}}},nf.prototype.initialTransport=function(){if(0<this.transports_.length)return this.transports_[0];throw new Error("No transports available")},nf.prototype.upgradeTransport=function(){return 1<this.transports_.length?this.transports_[1]:null},nf);function nf(t){this.initTransports_(t)}var rf=(of.prototype.start_=function(){var t=this,e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,void 0,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(function(){t.conn_&&t.conn_.open(n,r)},Math.floor(0));var i=e.healthyTimeout||0;0<i&&(this.healthyTimeout_=ku(function(){t.healthyTimeout_=null,t.isHealthy_||(t.conn_&&102400<t.conn_.bytesReceived?(t.log_("Connection exceeded healthy timeout but has received "+t.conn_.bytesReceived+" bytes. Marking connection healthy."),t.isHealthy_=!0,t.conn_.markConnectionHealthy()):t.conn_&&10240<t.conn_.bytesSent?t.log_("Connection exceeded healthy timeout but has sent "+t.conn_.bytesSent+" bytes. Leaving connection alive."):(t.log_("Closing unhealthy connection after timeout."),t.close()))},Math.floor(i)))},of.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},of.prototype.disconnReceiver_=function(e){var n=this;return function(t){e===n.conn_?n.onConnectionLost_(t):e===n.secondaryConn_?(n.log_("Secondary connection lost."),n.onSecondaryConnectionLost_()):n.log_("closing an old connection")}},of.prototype.connReceiver_=function(e){var n=this;return function(t){2!==n.state_&&(e===n.rx_?n.onPrimaryMessageReceived_(t):e===n.secondaryConn_?n.onSecondaryMessageReceived_(t):n.log_("message on old connection"))}},of.prototype.sendRequest=function(t){var e={t:"d",d:t};this.sendData_(e)},of.prototype.tryCleanupConnection=function(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)},of.prototype.onSecondaryControl_=function(t){if("t"in t){var e=t.t;"a"===e?this.upgradeIfSecondaryHealthy_():"r"===e?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===e&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}},of.prototype.onSecondaryMessageReceived_=function(t){var e=fu("t",t),n=fu("d",t);if("c"===e)this.onSecondaryControl_(n);else{if("d"!==e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(n)}},of.prototype.upgradeIfSecondaryHealthy_=function(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:"p",d:{}}}))},of.prototype.proceedWithUpgrade_=function(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()},of.prototype.onPrimaryMessageReceived_=function(t){var e=fu("t",t),n=fu("d",t);"c"===e?this.onControl_(n):"d"===e&&this.onDataMessage_(n)},of.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},of.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},of.prototype.onControl_=function(t){var e=fu("t",t);if("d"in t){var n=t.d;if("h"===e)this.onHandshake_(n);else if("n"===e){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var r=0;r<this.pendingDataMessages.length;++r)this.onDataMessage_(this.pendingDataMessages[r]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===e?this.onConnectionShutdown_(n):"r"===e?this.onReset_(n):"e"===e?au("Server Error: "+n):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):au("Unknown control packet command: "+e)}},of.prototype.onHandshake_=function(t){var e=t.ts,n=t.v,r=t.h;this.sessionId=t.s,this.repoInfo_.updateHost(r),0===this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,e),"5"!==n&&cu("Protocol version mismatch detected"),this.tryStartUpgrade_())},of.prototype.tryStartUpgrade_=function(){var t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)},of.prototype.startUpgrade_=function(t){var e=this;this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.secondaryConn_),r=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,r),ku(function(){e.secondaryConn_&&(e.log_("Timed out trying to upgrade."),e.secondaryConn_.close())},Math.floor(6e4))},of.prototype.onReset_=function(t){this.log_("Reset packet received. New host: "+t),this.repoInfo_.updateHost(t),1===this.state_?this.close():(this.closeConnections_(),this.start_())},of.prototype.onConnectionEstablished_=function(t,e){var n=this;this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(e,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):ku(function(){n.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))},of.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},of.prototype.onSecondaryConnectionLost_=function(){var t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()},of.prototype.onConnectionLost_=function(t){this.conn_=null,t||0!==this.state_?1===this.state_&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(vu.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()},of.prototype.onConnectionShutdown_=function(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()},of.prototype.sendData_=function(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)},of.prototype.close=function(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))},of.prototype.closeConnections_=function(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)},of);function of(t,e,n,r,i,o,s){this.id=t,this.repoInfo_=e,this.onMessage_=n,this.onReady_=r,this.onDisconnect_=i,this.onKill_=o,this.lastSessionId=s,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=su("c:"+this.id+":"),this.transportManager_=new ef(e),this.log_("Connection created"),this.start_()}var sf=(af.prototype.put=function(t,e,n,r){},af.prototype.merge=function(t,e,n,r){},af.prototype.refreshAuthToken=function(t){},af.prototype.onDisconnectPut=function(t,e,n){},af.prototype.onDisconnectMerge=function(t,e,n){},af.prototype.onDisconnectCancel=function(t,e){},af.prototype.reportStats=function(t){},af);function af(){}var uf,cf=(Es(hf,uf=sf),hf.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,i={r:r,a:t,b:e};this.log_(Xs(i)),Ps(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),n&&(this.requestCBHash_[r]=n)},hf.prototype.listen=function(t,e,n,r){var i=t.queryIdentifier(),o=t.path.toString();this.log_("Listen called for "+o+" "+i),this.listens.has(o)||this.listens.set(o,new Map),Ps(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),Ps(!this.listens.get(o).has(i),"listen() called twice for same path/queryId.");var s={onComplete:r,hashFn:e,query:t,tag:n};this.listens.get(o).set(i,s),this.connected_&&this.sendListen_(s)},hf.prototype.sendListen_=function(r){var i=this,o=r.query,s=o.path.toString(),a=o.queryIdentifier();this.log_("Listen on "+s+" for "+a);var t={p:s};r.tag&&(t.q=o.queryObject(),t.t=r.tag),t.h=r.hashFn(),this.sendRequest("q",t,function(t){var e=t.d,n=t.s;hf.warnOnListenWarnings_(e,o),(i.listens.get(s)&&i.listens.get(s).get(a))===r&&(i.log_("listen response",t),"ok"!==n&&i.removeListen_(s,a),r.onComplete&&r.onComplete(n,e))})},hf.warnOnListenWarnings_=function(t,e){if(t&&"object"==typeof t&&Zs(t,"w")){var n=ta(t,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){var r='".indexOn": "'+e.getQueryParams().getIndex().toString()+'"',i=e.path.toString();cu("Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding "+r+" at "+i+" to your security rules for better performance.")}}},hf.prototype.refreshAuthToken=function(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},function(){}),this.reduceReconnectDelayIfAdminCredential_(t)},hf.prototype.reduceReconnectDelayIfAdminCredential_=function(t){(t&&40===t.length||function(t){var e=$s(t).claims;return"object"==typeof e&&!0===e.admin}(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},hf.prototype.tryAuth=function(){var r=this;if(this.connected_&&this.authToken_){var i=this.authToken_,t=function(t){var e=$s(t).claims;return!!e&&"object"==typeof e&&e.hasOwnProperty("iat")}(i)?"auth":"gauth",e={cred:i};null===this.authOverride_?e.noauth=!0:"object"==typeof this.authOverride_&&(e.authvar=this.authOverride_),this.sendRequest(t,e,function(t){var e=t.s,n=t.d||"error";r.authToken_===i&&("ok"===e?r.invalidAuthTokenCount_=0:r.onAuthRevoked_(e,n))})}},hf.prototype.unlisten=function(t,e){var n=t.path.toString(),r=t.queryIdentifier();this.log_("Unlisten called for "+n+" "+r),Ps(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,r)&&this.connected_&&this.sendUnlisten_(n,r,t.queryObject(),e)},hf.prototype.sendUnlisten_=function(t,e,n,r){this.log_("Unlisten on "+t+" for "+e);var i={p:t};r&&(i.q=n,i.t=r),this.sendRequest("n",i)},hf.prototype.onDisconnectPut=function(t,e,n){this.connected_?this.sendOnDisconnect_("o",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:e,onComplete:n})},hf.prototype.onDisconnectMerge=function(t,e,n){this.connected_?this.sendOnDisconnect_("om",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:e,onComplete:n})},hf.prototype.onDisconnectCancel=function(t,e){this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},hf.prototype.sendOnDisconnect_=function(t,e,n,r){var i={p:e,d:n};this.log_("onDisconnect "+t,i),this.sendRequest(t,i,function(t){r&&setTimeout(function(){r(t.s,t.d)},Math.floor(0))})},hf.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},hf.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},hf.prototype.putInternal=function(t,e,n,r,i){var o={p:e,d:n};void 0!==i&&(o.h=i),this.outstandingPuts_.push({action:t,request:o,onComplete:r}),this.outstandingPutCount_++;var s=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(s):this.log_("Buffering put: "+e)},hf.prototype.sendPut_=function(e){var n=this,r=this.outstandingPuts_[e].action,t=this.outstandingPuts_[e].request,i=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(r,t,function(t){n.log_(r+" response",t),delete n.outstandingPuts_[e],n.outstandingPutCount_--,0===n.outstandingPutCount_&&(n.outstandingPuts_=[]),i&&i(t.s,t.d)})},hf.prototype.reportStats=function(t){var n=this;if(this.connected_){var e={c:t};this.log_("reportStats",e),this.sendRequest("s",e,function(t){if("ok"!==t.s){var e=t.d;n.log_("reportStats","Error sending stats: "+e)}})}},hf.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+Xs(t));var e=t.r,n=this.requestCBHash_[e];n&&(delete this.requestCBHash_[e],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}},hf.prototype.onDataPush_=function(t,e){this.log_("handleServerMessage",t,e),"d"===t?this.onDataUpdate_(e.p,e.d,!1,e.t):"m"===t?this.onDataUpdate_(e.p,e.d,!0,e.t):"c"===t?this.onListenRevoked_(e.p,e.q):"ac"===t?this.onAuthRevoked_(e.s,e.d):"sd"===t?this.onSecurityDebugPacket_(e):au("Unrecognized action received from server: "+Xs(t)+"\nAre you using the latest client?")},hf.prototype.onReady_=function(t,e){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=(new Date).getTime(),this.handleTimestamp_(t),this.lastSessionId=e,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)},hf.prototype.scheduleConnect_=function(t){var e=this;Ps(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(function(){e.establishConnectionTimer_=null,e.establishConnection_()},Math.floor(t))},hf.prototype.onVisible_=function(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0)),this.visible_=t},hf.prototype.onOnline_=function(t){t?(this.log_("Browser went online."),this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())},hf.prototype.onRealtimeDisconnect_=function(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(3e4<(new Date).getTime()-this.lastConnectionEstablishedTime_&&(this.reconnectDelay_=1e3),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime());var t=(new Date).getTime()-this.lastConnectionAttemptTime_,e=Math.max(0,this.reconnectDelay_-t);e=Math.random()*e,this.log_("Trying to reconnect in "+e+"ms"),this.scheduleConnect_(e),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)},hf.prototype.establishConnection_=function(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;var e=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+hf.nextConnectionId_++,o=this,s=this.lastSessionId,a=!1,u=null,c=function(){u?u.close():(a=!0,r())};this.realtime_={close:c,sendRequest:function(t){Ps(u,"sendRequest call when we're not connected not allowed."),u.sendRequest(t)}};var t=this.forceTokenRefresh_;this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(t).then(function(t){a?ou("getToken() completed but was canceled"):(ou("getToken() completed. Creating connection."),o.authToken_=t&&t.accessToken,u=new rf(i,o.repoInfo_,e,n,r,function(t){cu(t+" ("+o.repoInfo_.toString()+")"),o.interrupt("server_kill")},s))}).then(null,function(t){o.log_("Failed to get token: "+t),a||c()})}},hf.prototype.interrupt=function(t){ou("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())},hf.prototype.resume=function(t){ou("Resuming connection for reason: "+t),delete this.interruptReasons_[t],ea(this.interruptReasons_)&&(this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0))},hf.prototype.handleTimestamp_=function(t){var e=t-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:e})},hf.prototype.cancelSentTransactions_=function(){for(var t=0;t<this.outstandingPuts_.length;t++){var e=this.outstandingPuts_[t];e&&"h"in e.request&&e.queued&&(e.onComplete&&e.onComplete("disconnect"),delete this.outstandingPuts_[t],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])},hf.prototype.onListenRevoked_=function(t,e){var n;n=e?e.map(function(t){return Su(t)}).join("$"):"default";var r=this.removeListen_(t,n);r&&r.onComplete&&r.onComplete("permission_denied")},hf.prototype.removeListen_=function(t,e){var n,r=new Du(t).toString();if(this.listens.has(r)){var i=this.listens.get(r);n=i.get(e),i.delete(e),0===i.size&&this.listens.delete(r)}else n=void 0;return n},hf.prototype.onAuthRevoked_=function(t,e){ou("Auth token revoked: "+t+"/"+e),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),"invalid_token"!==t&&"permission_denied"!==t||(this.invalidAuthTokenCount_++,3<=this.invalidAuthTokenCount_&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))},hf.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},hf.prototype.restoreState_=function(){var e,t,n,r;this.tryAuth();try{for(var i=Cs(this.listens.values()),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,Cs(s.values())),u=a.next();!u.done;u=a.next()){var c=u.value;this.sendListen_(c)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}for(var h=0;h<this.outstandingPuts_.length;h++)this.outstandingPuts_[h]&&this.sendPut_(h);for(;this.onDisconnectRequestQueue_.length;){var l=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(l.action,l.pathString,l.data,l.onComplete)}},hf.prototype.sendConnectStats_=function(){var t={};t["sdk.js."+Xl.replace(/\./g,"-")]=1,Vs()?t["framework.cordova"]=1:Bs()&&(t["framework.reactnative"]=1),this.reportStats(t)},hf.prototype.shouldReconnect_=function(){var t=Bl.getInstance().currentlyOnline();return ea(this.interruptReasons_)&&t},hf.nextPersistentConnectionId_=0,hf.nextConnectionId_=0,hf);function hf(t,e,n,r,i,o){var s=uf.call(this)||this;if(s.repoInfo_=t,s.onDataUpdate_=e,s.onConnectStatus_=n,s.onServerInfoUpdate_=r,s.authTokenProvider_=i,s.authOverride_=o,s.id=hf.nextPersistentConnectionId_++,s.log_=su("p:"+s.id+":"),s.interruptReasons_={},s.listens=new Map,s.outstandingPuts_=[],s.outstandingPutCount_=0,s.onDisconnectRequestQueue_=[],s.connected_=!1,s.reconnectDelay_=1e3,s.maxReconnectDelay_=3e5,s.securityDebugCallback_=null,s.lastSessionId=null,s.establishConnectionTimer_=null,s.visible_=!1,s.requestCBHash_={},s.requestNumber_=0,s.realtime_=null,s.authToken_=null,s.forceTokenRefresh_=!1,s.invalidAuthTokenCount_=0,s.firstConnection_=!0,s.lastConnectionAttemptTime_=null,s.lastConnectionEstablishedTime_=null,o&&!Ws())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");return s.scheduleConnect_(0),jl.getInstance().on("visible",s.onVisible_,s),-1===t.host.indexOf("fblocal")&&Bl.getInstance().on("online",s.onOnline_,s),s}var lf,ff=(Es(pf,lf=sf),pf.prototype.reportStats=function(t){throw new Error("Method not implemented.")},pf.getListenId_=function(t,e){return void 0!==e?"tag$"+e:(Ps(t.getQueryParams().isDefault(),"should have a tag if it's not a default query."),t.path.toString())},pf.prototype.listen=function(t,e,r,i){var o=this,s=t.path.toString();this.log_("Listen called for "+s+" "+t.queryIdentifier());var a=pf.getListenId_(t,r),u={};this.listens_[a]=u;var n=t.getQueryParams().toRestQueryStringParameters();this.restRequest_(s+".json",n,function(t,e){var n=e;404===t&&(t=n=null),null===t&&o.onDataUpdate_(s,n,!1,r),ta(o.listens_,a)===u&&i(t?401===t?"permission_denied":"rest_error:"+t:"ok",null)})},pf.prototype.unlisten=function(t,e){var n=pf.getListenId_(t,e);delete this.listens_[n]},pf.prototype.refreshAuthToken=function(t){},pf.prototype.restRequest_=function(i,o,s){var a=this;void 0===o&&(o={}),o.format="export",this.authTokenProvider_.getToken(!1).then(function(t){var e=t&&t.accessToken;e&&(o.auth=e);var n=(a.repoInfo_.secure?"https://":"http://")+a.repoInfo_.host+i+"?ns="+a.repoInfo_.namespace+function(t){for(var n=[],e=function(e,t){Array.isArray(t)?t.forEach(function(t){n.push(encodeURIComponent(e)+"="+encodeURIComponent(t))}):n.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},r=0,i=Object.entries(t);r<i.length;r++){var o=i[r];e(o[0],o[1])}return n.length?"&"+n.join("&"):""}(o);a.log_("Sending REST request for "+n);var r=new XMLHttpRequest;r.onreadystatechange=function(){if(s&&4===r.readyState){a.log_("REST Response for "+n+" received. status:",r.status,"response:",r.responseText);var t=null;if(200<=r.status&&r.status<300){try{t=Js(r.responseText)}catch(t){cu("Failed to parse JSON response for "+n+": "+r.responseText)}s(null,t)}else 401!==r.status&&404!==r.status&&cu("Got unsuccessful REST response for "+n+" Status: "+r.status),s(r.status);s=null}},r.open("GET",n,!0),r.send()})},pf);function pf(t,e,n){var r=lf.call(this)||this;return r.repoInfo_=t,r.onDataUpdate_=e,r.authTokenProvider_=n,r.log_=su("p:rest:"),r.listens_={},r}var df="repo_interrupt",vf=(yf.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},yf.prototype.name=function(){return this.repoInfo_.namespace},yf.prototype.serverTime=function(){var t=this.infoData_.getNode(new Du(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t},yf.prototype.generateServerValues=function(){return function(t){return(t=t||{}).timestamp=t.timestamp||(new Date).getTime(),t}({timestamp:this.serverTime()})},yf.prototype.onDataUpdate_=function(t,e,n,r){this.dataUpdateCount++;var i=new Du(t);e=this.interceptServerDataCallback_?this.interceptServerDataCallback_(t,e):e;var o=[];if(r)if(n){var s=na(e,function(t){return ih(t)});o=this.serverSyncTree_.applyTaggedQueryMerge(i,s,r)}else{var a=ih(e);o=this.serverSyncTree_.applyTaggedQueryOverwrite(i,a,r)}else if(n){var u=na(e,function(t){return ih(t)});o=this.serverSyncTree_.applyServerMerge(i,u)}else{var c=ih(e);o=this.serverSyncTree_.applyServerOverwrite(i,c)}var h=i;0<o.length&&(h=this.rerunTransactions_(i)),this.eventQueue_.raiseEventsForChangedPath(h,o)},yf.prototype.interceptServerData_=function(t){this.interceptServerDataCallback_=t},yf.prototype.onConnectStatus_=function(t){this.updateInfo_("connected",t),!1===t&&this.runOnDisconnectEvents_()},yf.prototype.onServerInfoUpdate_=function(t){var n=this;Cu(t,function(t,e){n.updateInfo_(t,e)})},yf.prototype.updateInfo_=function(t,e){var n=new Du("/.info/"+t),r=ih(e);this.infoData_.updateSnapshot(n,r);var i=this.infoSyncTree_.applyServerOverwrite(n,r);this.eventQueue_.raiseEventsForChangedPath(n,i)},yf.prototype.getNextWriteId_=function(){return this.nextWriteId_++},yf.prototype.setWithPriority=function(i,t,e,o){var s=this;this.log_("set",{path:i.toString(),value:t,priority:e});var n=this.generateServerValues(),r=ih(t,e),a=Ah(r,n),u=this.getNextWriteId_(),c=this.serverSyncTree_.applyUserOverwrite(i,a,u,!0);this.eventQueue_.queueEvents(c),this.server_.put(i.toString(),r.val(!0),function(t,e){var n="ok"===t;n||cu("set at "+i+" failed: "+t);var r=s.serverSyncTree_.ackUserWrite(u,!n);s.eventQueue_.raiseEventsForChangedPath(i,r),s.callOnCompleteCallback(o,t,e)});var h=this.abortTransactions_(i);this.rerunTransactions_(h),this.eventQueue_.raiseEventsForChangedPath(h,[])},yf.prototype.update=function(o,t,s){var a=this;this.log_("update",{path:o.toString(),value:t});var r=!0,i=this.generateServerValues(),u={};if(Cu(t,function(t,e){r=!1;var n=ih(e);u[t]=Ah(n,i)}),r)ou("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(s,"ok");else{var c=this.getNextWriteId_(),e=this.serverSyncTree_.applyUserMerge(o,u,c);this.eventQueue_.queueEvents(e),this.server_.merge(o.toString(),t,function(t,e){var n="ok"===t;n||cu("update at "+o+" failed: "+t);var r=a.serverSyncTree_.ackUserWrite(c,!n),i=0<r.length?a.rerunTransactions_(o):o;a.eventQueue_.raiseEventsForChangedPath(i,r),a.callOnCompleteCallback(s,t,e)}),Cu(t,function(t){var e=a.abortTransactions_(o.child(t));a.rerunTransactions_(e)}),this.eventQueue_.raiseEventsForChangedPath(o,[])}},yf.prototype.runOnDisconnectEvents_=function(){var r=this;this.log_("onDisconnectEvents");var t=this.generateServerValues(),e=function(t,n){var r=new Ih;return t.forEachTree(new Du(""),function(t,e){r.remember(t,Ah(e,n))}),r}(this.onDisconnect_,t),i=[];e.forEachTree(Du.Empty,function(t,e){i=i.concat(r.serverSyncTree_.applyServerOverwrite(t,e));var n=r.abortTransactions_(t);r.rerunTransactions_(n)}),this.onDisconnect_=new Ih,this.eventQueue_.raiseEventsForChangedPath(Du.Empty,i)},yf.prototype.onDisconnectCancel=function(n,r){var i=this;this.server_.onDisconnectCancel(n.toString(),function(t,e){"ok"===t&&i.onDisconnect_.forget(n),i.callOnCompleteCallback(r,t,e)})},yf.prototype.onDisconnectSet=function(n,t,r){var i=this,o=ih(t);this.server_.onDisconnectPut(n.toString(),o.val(!0),function(t,e){"ok"===t&&i.onDisconnect_.remember(n,o),i.callOnCompleteCallback(r,t,e)})},yf.prototype.onDisconnectSetWithPriority=function(n,t,e,r){var i=this,o=ih(t,e);this.server_.onDisconnectPut(n.toString(),o.val(!0),function(t,e){"ok"===t&&i.onDisconnect_.remember(n,o),i.callOnCompleteCallback(r,t,e)})},yf.prototype.onDisconnectUpdate=function(r,n,i){var o=this;if(ea(n))return ou("onDisconnect().update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(i,"ok");this.server_.onDisconnectMerge(r.toString(),n,function(t,e){"ok"===t&&Cu(n,function(t,e){var n=ih(e);o.onDisconnect_.remember(r.child(t),n)}),o.callOnCompleteCallback(i,t,e)})},yf.prototype.addEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.addEventRegistration(t,e):this.serverSyncTree_.addEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},yf.prototype.removeEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.removeEventRegistration(t,e):this.serverSyncTree_.removeEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},yf.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt(df)},yf.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume(df)},yf.prototype.stats=function(t){if(void 0===t&&(t=!1),"undefined"!=typeof console){var e;e=t?(this.statsListener_||(this.statsListener_=new Al(this.stats_)),this.statsListener_.get()):this.stats_.get();var i=Object.keys(e).reduce(function(t,e){return Math.max(e.length,t)},0);Cu(e,function(t,e){for(var n=t,r=t.length;r<i+2;r++)n+=" ";console.log(n+e)})}},yf.prototype.statsIncrementCounter=function(t){this.stats_.incrementCounter(t),this.statsReporter_.includeStat(t)},yf.prototype.log_=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="";this.persistentConnection_&&(n=this.persistentConnection_.id+":"),ou.apply(void 0,As([n],t))},yf.prototype.callOnCompleteCallback=function(r,i,o){r&&Au(function(){if("ok"===i)r(null);else{var t=(i||"error").toUpperCase(),e=t;o&&(e+=": "+o);var n=new Error(e);n.code=t,r(n)}})},Object.defineProperty(yf.prototype,"database",{get:function(){return this.__database||(this.__database=new Lf(this))},enumerable:!0,configurable:!0}),yf);function yf(t,e,n,r){var s=this;this.repoInfo_=t,this.app=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Dl,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new Ih,this.persistentConnection_=null;var i=new El(n,r);if(this.stats_=Cl.getCollection(t),e||0<=("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i))this.server_=new ff(this.repoInfo_,this.onDataUpdate_.bind(this),i),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var o=n.options.databaseAuthVariableOverride;if(null!=o){if("object"!=typeof o)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{Xs(o)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}this.persistentConnection_=new cf(this.repoInfo_,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),i,o),this.server_=this.persistentConnection_}i.addTokenChangeListener(function(t){s.server_.refreshAuthToken(t)}),this.statsReporter_=Cl.getOrCreateReporter(t,function(){return new Rl(s.stats_,s.server_)}),this.transactionsInit_(),this.infoData_=new bl,this.infoSyncTree_=new ml({startListening:function(t,e,n,r){var i=[],o=s.infoData_.getNode(t.path);return o.isEmpty()||(i=s.infoSyncTree_.applyServerOverwrite(t.path,o),setTimeout(function(){r("ok")},0)),i},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new ml({startListening:function(r,t,e,i){return s.server_.listen(r,e,t,function(t,e){var n=i(t,e);s.eventQueue_.raiseEventsForChangedPath(r.path,n)}),[]},stopListening:function(t,e){s.server_.unlisten(t,e)}})}var gf=(mf.prototype.getStartPost=function(){return this.startPost_},mf.prototype.getEndPost=function(){return this.endPost_},mf.prototype.matches=function(t){return this.index_.compare(this.getStartPost(),t)<=0&&this.index_.compare(t,this.getEndPost())<=0},mf.prototype.updateChild=function(t,e,n,r,i,o){return this.matches(new fc(e,n))||(n=$c.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,r,i,o)},mf.prototype.updateFullNode=function(t,e,n){e.isLeafNode()&&(e=$c.EMPTY_NODE);var r=e.withIndex(this.index_);r=r.updatePriority($c.EMPTY_NODE);var i=this;return e.forEachChild(Oc,function(t,e){i.matches(new fc(t,e))||(r=r.updateImmediateChild(t,$c.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,r,n)},mf.prototype.updatePriority=function(t,e){return t},mf.prototype.filtersNodes=function(){return!0},mf.prototype.getIndexedFilter=function(){return this.indexedFilter_},mf.prototype.getIndex=function(){return this.index_},mf.getStartPost_=function(t){if(t.hasStart()){var e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()},mf.getEndPost_=function(t){if(t.hasEnd()){var e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()},mf);function mf(t){this.indexedFilter_=new Qh(t.getIndex()),this.index_=t.getIndex(),this.startPost_=mf.getStartPost_(t),this.endPost_=mf.getEndPost_(t)}var wf=(bf.prototype.updateChild=function(t,e,n,r,i,o){return this.rangedFilter_.matches(new fc(e,n))||(n=$c.EMPTY_NODE),t.getImmediateChild(e).equals(n)?t:t.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(t,e,n,r,i,o):this.fullLimitUpdateChild_(t,e,n,i,o)},bf.prototype.updateFullNode=function(t,e,n){var r;if(e.isLeafNode()||e.isEmpty())r=$c.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<e.numChildren()&&e.isIndexed(this.index_)){r=$c.EMPTY_NODE.withIndex(this.index_);var i=void 0;i=this.reverse_?e.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):e.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);for(var o=0;i.hasNext()&&o<this.limit_;){var s=i.getNext();if(!(this.reverse_?this.index_.compare(this.rangedFilter_.getStartPost(),s)<=0:this.index_.compare(s,this.rangedFilter_.getEndPost())<=0))break;r=r.updateImmediateChild(s.name,s.node),o++}}else{r=(r=e.withIndex(this.index_)).updatePriority($c.EMPTY_NODE);var a=void 0,u=void 0,c=void 0;if(i=void 0,this.reverse_){i=r.getReverseIterator(this.index_),a=this.rangedFilter_.getEndPost(),u=this.rangedFilter_.getStartPost();var h=this.index_.getCompare();c=function(t,e){return h(e,t)}}else i=r.getIterator(this.index_),a=this.rangedFilter_.getStartPost(),u=this.rangedFilter_.getEndPost(),c=this.index_.getCompare();o=0;for(var l=!1;i.hasNext();)s=i.getNext(),!l&&c(a,s)<=0&&(l=!0),l&&o<this.limit_&&c(s,u)<=0?o++:r=r.updateImmediateChild(s.name,$c.EMPTY_NODE)}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,r,n)},bf.prototype.updatePriority=function(t,e){return t},bf.prototype.filtersNodes=function(){return!0},bf.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},bf.prototype.getIndex=function(){return this.index_},bf.prototype.fullLimitUpdateChild_=function(t,e,n,r,i){var o;if(this.reverse_){var s=this.index_.getCompare();o=function(t,e){return s(e,t)}}else o=this.index_.getCompare();var a=t;Ps(a.numChildren()===this.limit_,"");var u=new fc(e,n),c=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),h=this.rangedFilter_.matches(u);if(a.hasChild(e)){for(var l=a.getImmediateChild(e),f=r.getChildAfterChild(this.index_,c,this.reverse_);null!=f&&(f.name===e||a.hasChild(f.name));)f=r.getChildAfterChild(this.index_,f,this.reverse_);var p=null==f?1:o(f,u);if(h&&!n.isEmpty()&&0<=p)return null!=i&&i.trackChildChange(Gh.childChangedChange(e,n,l)),a.updateImmediateChild(e,n);null!=i&&i.trackChildChange(Gh.childRemovedChange(e,l));var d=a.updateImmediateChild(e,$c.EMPTY_NODE);return null!=f&&this.rangedFilter_.matches(f)?(null!=i&&i.trackChildChange(Gh.childAddedChange(f.name,f.node)),d.updateImmediateChild(f.name,f.node)):d}return n.isEmpty()?t:h&&0<=o(c,u)?(null!=i&&(i.trackChildChange(Gh.childRemovedChange(c.name,c.node)),i.trackChildChange(Gh.childAddedChange(e,n))),a.updateImmediateChild(e,n).updateImmediateChild(c.name,$c.EMPTY_NODE)):t},bf);function bf(t){this.rangedFilter_=new gf(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft()}var _f=(Ef.prototype.hasStart=function(){return this.startSet_},Ef.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===Ef.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},Ef.prototype.getIndexStartValue=function(){return Ps(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},Ef.prototype.getIndexStartName=function(){return Ps(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Eu},Ef.prototype.hasEnd=function(){return this.endSet_},Ef.prototype.getIndexEndValue=function(){return Ps(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},Ef.prototype.getIndexEndName=function(){return Ps(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Iu},Ef.prototype.hasLimit=function(){return this.limitSet_},Ef.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},Ef.prototype.getLimit=function(){return Ps(this.limitSet_,"Only valid if limit has been set"),this.limit_},Ef.prototype.getIndex=function(){return this.index_},Ef.prototype.copy_=function(){var t=new Ef;return t.limitSet_=this.limitSet_,t.limit_=this.limit_,t.startSet_=this.startSet_,t.indexStartValue_=this.indexStartValue_,t.startNameSet_=this.startNameSet_,t.indexStartName_=this.indexStartName_,t.endSet_=this.endSet_,t.indexEndValue_=this.indexEndValue_,t.endNameSet_=this.endNameSet_,t.indexEndName_=this.indexEndName_,t.index_=this.index_,t.viewFrom_=this.viewFrom_,t},Ef.prototype.limit=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_="",e},Ef.prototype.limitToFirst=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_=Ef.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,e},Ef.prototype.limitToLast=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_=Ef.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,e},Ef.prototype.startAt=function(t,e){var n=this.copy_();return n.startSet_=!0,void 0===t&&(t=null),n.indexStartValue_=t,null!=e?(n.startNameSet_=!0,n.indexStartName_=e):(n.startNameSet_=!1,n.indexStartName_=""),n},Ef.prototype.endAt=function(t,e){var n=this.copy_();return n.endSet_=!0,void 0===t&&(t=null),n.indexEndValue_=t,void 0!==e?(n.endNameSet_=!0,n.indexEndName_=e):(n.endNameSet_=!1,n.indexEndName_=""),n},Ef.prototype.orderBy=function(t){var e=this.copy_();return e.index_=t,e},Ef.prototype.getQueryObject=function(){var t=Ef.WIRE_PROTOCOL_CONSTANTS_,e={};if(this.startSet_&&(e[t.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&&(e[t.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&&(e[t.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&&(e[t.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_){e[t.LIMIT]=this.limit_;var n=this.viewFrom_;""===n&&(n=this.isViewFromLeft()?t.VIEW_FROM_LEFT:t.VIEW_FROM_RIGHT),e[t.VIEW_FROM]=n}return this.index_!==Oc&&(e[t.INDEX]=this.index_.toString()),e},Ef.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},Ef.prototype.isDefault=function(){return this.loadsAllData()&&this.index_===Oc},Ef.prototype.getNodeFilter=function(){return this.loadsAllData()?new Qh(this.getIndex()):this.hasLimit()?new wf(this):new gf(this)},Ef.prototype.toRestQueryStringParameters=function(){var t,e=Ef.REST_QUERY_CONSTANTS_,n={};return this.isDefault()||(t=this.index_===Oc?e.PRIORITY_INDEX:this.index_===ah?e.VALUE_INDEX:this.index_===_c?e.KEY_INDEX:(Ps(this.index_ instanceof uh,"Unrecognized index type!"),this.index_.toString()),n[e.ORDER_BY]=Xs(t),this.startSet_&&(n[e.START_AT]=Xs(this.indexStartValue_),this.startNameSet_&&(n[e.START_AT]+=","+Xs(this.indexStartName_))),this.endSet_&&(n[e.END_AT]=Xs(this.indexEndValue_),this.endNameSet_&&(n[e.END_AT]+=","+Xs(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?n[e.LIMIT_TO_FIRST]=this.limit_:n[e.LIMIT_TO_LAST]=this.limit_)),n},Ef.WIRE_PROTOCOL_CONSTANTS_={INDEX_START_VALUE:"sp",INDEX_START_NAME:"sn",INDEX_END_VALUE:"ep",INDEX_END_NAME:"en",LIMIT:"l",VIEW_FROM:"vf",VIEW_FROM_LEFT:"l",VIEW_FROM_RIGHT:"r",INDEX:"i"},Ef.REST_QUERY_CONSTANTS_={ORDER_BY:"orderBy",PRIORITY_INDEX:"$priority",VALUE_INDEX:"$value",KEY_INDEX:"$key",START_AT:"startAt",END_AT:"endAt",LIMIT_TO_FIRST:"limitToFirst",LIMIT_TO_LAST:"limitToLast"},Ef.DEFAULT=new Ef,Ef);function Ef(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Oc}var If,Tf=(Es(Sf,If=_h),Sf.prototype.getKey=function(){return ca("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},Sf.prototype.child=function(t){return ca("Reference.child",1,1,arguments.length),"number"==typeof t?t=String(t):t instanceof Du||(null===this.path.getFront()?function(t,e,n,r){n=n&&n.replace(/^\/*\.info(\/|$)/,"/"),Ju(t,e,n,r)}("Reference.child",1,t,!1):Ju("Reference.child",1,t,!1)),new Sf(this.repo,this.path.child(t))},Sf.prototype.getParent=function(){ca("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new Sf(this.repo,t)},Sf.prototype.getRoot=function(){ca("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},Sf.prototype.databaseProp=function(){return this.repo.database},Sf.prototype.set=function(t,e){ca("Reference.set",1,2,arguments.length),Xu("Reference.set",this.path),Ku("Reference.set",1,t,this.path,!1),la("Reference.set",2,e,!0);var n=new Us;return this.repo.setWithPriority(this.path,t,null,n.wrapCallback(e)),n.promise},Sf.prototype.update=function(t,e){if(ca("Reference.update",1,2,arguments.length),Xu("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,cu("Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}Gu("Reference.update",1,t,this.path,!1),la("Reference.update",2,e,!0);var i=new Us;return this.repo.update(this.path,t,i.wrapCallback(e)),i.promise},Sf.prototype.setWithPriority=function(t,e,n){if(ca("Reference.setWithPriority",2,3,arguments.length),Xu("Reference.setWithPriority",this.path),Ku("Reference.setWithPriority",1,t,this.path,!1),zu("Reference.setWithPriority",2,e,!1),la("Reference.setWithPriority",3,n,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.setWithPriority failed: "+this.getKey()+" is a read-only object.";var r=new Us;return this.repo.setWithPriority(this.path,t,e,r.wrapCallback(n)),r.promise},Sf.prototype.remove=function(t){return ca("Reference.remove",0,1,arguments.length),Xu("Reference.remove",this.path),la("Reference.remove",1,t,!0),this.set(null,t)},Sf.prototype.transaction=function(t,r,e){if(ca("Reference.transaction",1,3,arguments.length),Xu("Reference.transaction",this.path),la("Reference.transaction",1,t,!1),la("Reference.transaction",2,r,!0),function(t,e,n,r){if((!r||void 0!==n)&&"boolean"!=typeof n)throw new Error(ha(t,e,r)+"must be a boolean.")}("Reference.transaction",3,e,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.transaction failed: "+this.getKey()+" is a read-only object.";void 0===e&&(e=!0);var i=new Us;return"function"==typeof r&&i.promise.catch(function(){}),this.repo.startTransaction(this.path,t,function(t,e,n){t?i.reject(t):i.resolve(new sc(e,n)),"function"==typeof r&&r(t,e,n)},e),i.promise},Sf.prototype.setPriority=function(t,e){ca("Reference.setPriority",1,2,arguments.length),Xu("Reference.setPriority",this.path),zu("Reference.setPriority",1,t,!1),la("Reference.setPriority",2,e,!0);var n=new Us;return this.repo.setWithPriority(this.path.child(".priority"),t,null,n.wrapCallback(e)),n.promise},Sf.prototype.push=function(t,e){ca("Reference.push",0,2,arguments.length),Xu("Reference.push",this.path),Ku("Reference.push",1,t,this.path,!0),la("Reference.push",2,e,!0);var n,r=this.repo.serverTime(),i=lc(r),o=this.child(i),s=this.child(i);return n=null!=t?o.set(t,e).then(function(){return s}):Promise.resolve(s),o.then=n.then.bind(n),o.catch=n.then.bind(n,void 0),"function"==typeof e&&n.catch(function(){}),o},Sf.prototype.onDisconnect=function(){return Xu("Reference.onDisconnect",this.path),new ic(this.repo,this.path)},Object.defineProperty(Sf.prototype,"database",{get:function(){return this.databaseProp()},enumerable:!0,configurable:!0}),Object.defineProperty(Sf.prototype,"key",{get:function(){return this.getKey()},enumerable:!0,configurable:!0}),Object.defineProperty(Sf.prototype,"parent",{get:function(){return this.getParent()},enumerable:!0,configurable:!0}),Object.defineProperty(Sf.prototype,"root",{get:function(){return this.getRoot()},enumerable:!0,configurable:!0}),Sf);function Sf(t,e){if(!(t instanceof vf))throw new Error("new Reference() no longer supported - use app.database().");return If.call(this,t,e,_f.DEFAULT,!1)||this}_h.__referenceConstructor=Tf,hl.__referenceConstructor=Tf;var Cf,Nf,Af=function(){this.children={},this.childCount=0,this.value=null},kf=(Rf.prototype.subTree=function(t){for(var e=t instanceof Du?t:new Du(t),n=this,r=e.getFront();null!==r;)n=new Rf(r,n,ta(n.node_.children,r)||new Af),r=(e=e.popFront()).getFront();return n},Rf.prototype.getValue=function(){return this.node_.value},Rf.prototype.setValue=function(t){Ps(void 0!==t,"Cannot set value to undefined"),this.node_.value=t,this.updateParents_()},Rf.prototype.clear=function(){this.node_.value=null,this.node_.children={},this.node_.childCount=0,this.updateParents_()},Rf.prototype.hasChildren=function(){return 0<this.node_.childCount},Rf.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},Rf.prototype.forEachChild=function(n){var r=this;Cu(this.node_.children,function(t,e){n(new Rf(t,r,e))})},Rf.prototype.forEachDescendant=function(e,t,n){t&&!n&&e(this),this.forEachChild(function(t){t.forEachDescendant(e,!0,n)}),t&&n&&e(this)},Rf.prototype.forEachAncestor=function(t,e){for(var n=e?this:this.parent();null!==n;){if(t(n))return!0;n=n.parent()}return!1},Rf.prototype.forEachImmediateDescendantWithValue=function(e){this.forEachChild(function(t){null!==t.getValue()?e(t):t.forEachImmediateDescendantWithValue(e)})},Rf.prototype.path=function(){return new Du(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)},Rf.prototype.name=function(){return this.name_},Rf.prototype.parent=function(){return this.parent_},Rf.prototype.updateParents_=function(){null!==this.parent_&&this.parent_.updateChild_(this.name_,this)},Rf.prototype.updateChild_=function(t,e){var n=e.isEmpty(),r=Zs(this.node_.children,t);n&&r?(delete this.node_.children[t],this.node_.childCount--,this.updateParents_()):n||r||(this.node_.children[t]=e.node_,this.node_.childCount++,this.updateParents_())},Rf);function Rf(t,e,n){void 0===t&&(t=""),void 0===e&&(e=null),void 0===n&&(n=new Af),this.name_=t,this.parent_=e,this.node_=n}(Nf=Cf=Cf||{})[Nf.RUN=0]="RUN",Nf[Nf.SENT=1]="SENT",Nf[Nf.COMPLETED=2]="COMPLETED",Nf[Nf.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",Nf[Nf.NEEDS_ABORT=4]="NEEDS_ABORT",vf.MAX_TRANSACTION_RETRIES_=25,vf.prototype.transactionsInit_=function(){this.transactionQueueTree_=new kf},vf.prototype.startTransaction=function(t,e,n,r){this.log_("transaction on "+t);function i(){}var o=new Tf(this,t);o.on("value",i);var s={path:t,update:e,onComplete:n,status:null,order:mu(),applyLocally:r,retryCount:0,unwatcher:function(){o.off("value",i)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},a=this.getLatestState_(t);s.currentInputSnapshot=a;var u=s.update(a.val());if(void 0===u){if(s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete){var c=new hh(s.currentInputSnapshot,new Tf(this,s.path),Oc);s.onComplete(null,!1,c)}}else{rc("transaction failed: Data returned ",u,s.path),s.status=Cf.RUN;var h=this.transactionQueueTree_.subTree(t),l=h.getValue()||[];l.push(s),h.setValue(l);var f=void 0;if("object"==typeof u&&null!==u&&Zs(u,".priority"))f=ta(u,".priority"),Ps(Hu(f),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.");else f=(this.serverSyncTree_.calcCompleteEventCache(t)||$c.EMPTY_NODE).getPriority().val();f=f;var p=this.generateServerValues(),d=ih(u,f),v=Ah(d,p);s.currentOutputSnapshotRaw=d,s.currentOutputSnapshotResolved=v,s.currentWriteId=this.getNextWriteId_();var y=this.serverSyncTree_.applyUserOverwrite(t,v,s.currentWriteId,s.applyLocally);this.eventQueue_.raiseEventsForChangedPath(t,y),this.sendReadyTransactions_()}},vf.prototype.getLatestState_=function(t,e){return this.serverSyncTree_.calcCompleteEventCache(t,e)||$c.EMPTY_NODE},vf.prototype.sendReadyTransactions_=function(t){var e=this;if(void 0===t&&(t=this.transactionQueueTree_),t||this.pruneCompletedTransactionsBelowNode_(t),null!==t.getValue()){var n=this.buildTransactionQueue_(t);Ps(0<n.length,"Sending zero length transaction queue"),n.every(function(t){return t.status===Cf.RUN})&&this.sendTransactionQueue_(t.path(),n)}else t.hasChildren()&&t.forEachChild(function(t){e.sendReadyTransactions_(t)})},vf.prototype.sendTransactionQueue_=function(a,u){for(var c=this,t=u.map(function(t){return t.currentWriteId}),e=this.getLatestState_(a,t),n=e,r=e.hash(),i=0;i<u.length;i++){var o=u[i];Ps(o.status===Cf.RUN,"tryToSendTransactionQueue_: items in queue should all be run."),o.status=Cf.SENT,o.retryCount++;var s=Du.relativePath(a,o.path);n=n.updateChild(s,o.currentOutputSnapshotRaw)}var h=n.val(!0),l=a;this.server_.put(l.toString(),h,function(t){c.log_("transaction put response",{path:l.toString(),status:t});var e=[];if("ok"===t){for(var n=[],r=0;r<u.length;r++){if(u[r].status=Cf.COMPLETED,e=e.concat(c.serverSyncTree_.ackUserWrite(u[r].currentWriteId)),u[r].onComplete){var i=u[r].currentOutputSnapshotResolved,o=new Tf(c,u[r].path),s=new hh(i,o,Oc);n.push(u[r].onComplete.bind(null,null,!0,s))}u[r].unwatcher()}c.pruneCompletedTransactionsBelowNode_(c.transactionQueueTree_.subTree(a)),c.sendReadyTransactions_(),c.eventQueue_.raiseEventsForChangedPath(a,e);for(r=0;r<n.length;r++)Au(n[r])}else{if("datastale"===t)for(r=0;r<u.length;r++)u[r].status===Cf.SENT_NEEDS_ABORT?u[r].status=Cf.NEEDS_ABORT:u[r].status=Cf.RUN;else{cu("transaction at "+l.toString()+" failed: "+t);for(r=0;r<u.length;r++)u[r].status=Cf.NEEDS_ABORT,u[r].abortReason=t}c.rerunTransactions_(a)}},r)},vf.prototype.rerunTransactions_=function(t){var e=this.getAncestorTransactionNode_(t),n=e.path(),r=this.buildTransactionQueue_(e);return this.rerunTransactionQueue_(r,n),n},vf.prototype.rerunTransactionQueue_=function(t,e){if(0!==t.length){for(var n,r=[],i=[],o=t.filter(function(t){return t.status===Cf.RUN}).map(function(t){return t.currentWriteId}),s=0;s<t.length;s++){var a=t[s],u=Du.relativePath(e,a.path),c=!1,h=void 0;if(Ps(null!==u,"rerunTransactionsUnderNode_: relativePath should not be null."),a.status===Cf.NEEDS_ABORT)c=!0,h=a.abortReason,i=i.concat(this.serverSyncTree_.ackUserWrite(a.currentWriteId,!0));else if(a.status===Cf.RUN)if(a.retryCount>=vf.MAX_TRANSACTION_RETRIES_)c=!0,h="maxretry",i=i.concat(this.serverSyncTree_.ackUserWrite(a.currentWriteId,!0));else{var l=this.getLatestState_(a.path,o);a.currentInputSnapshot=l;var f=t[s].update(l.val());if(void 0!==f){rc("transaction failed: Data returned ",f,a.path);var p=ih(f);"object"==typeof f&&null!=f&&Zs(f,".priority")||(p=p.updatePriority(l.getPriority()));var d=a.currentWriteId,v=this.generateServerValues(),y=Ah(p,v);a.currentOutputSnapshotRaw=p,a.currentOutputSnapshotResolved=y,a.currentWriteId=this.getNextWriteId_(),o.splice(o.indexOf(d),1),i=(i=i.concat(this.serverSyncTree_.applyUserOverwrite(a.path,y,a.currentWriteId,a.applyLocally))).concat(this.serverSyncTree_.ackUserWrite(d,!0))}else c=!0,h="nodata",i=i.concat(this.serverSyncTree_.ackUserWrite(a.currentWriteId,!0))}if(this.eventQueue_.raiseEventsForChangedPath(e,i),i=[],c&&(t[s].status=Cf.COMPLETED,n=t[s].unwatcher,setTimeout(n,Math.floor(0)),t[s].onComplete))if("nodata"===h){var g=new Tf(this,t[s].path),m=t[s].currentInputSnapshot,w=new hh(m,g,Oc);r.push(t[s].onComplete.bind(null,null,!1,w))}else r.push(t[s].onComplete.bind(null,new Error(h),!1,null))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(s=0;s<r.length;s++)Au(r[s]);this.sendReadyTransactions_()}},vf.prototype.getAncestorTransactionNode_=function(t){var e,n=this.transactionQueueTree_;for(e=t.getFront();null!==e&&null===n.getValue();)n=n.subTree(e),e=(t=t.popFront()).getFront();return n},vf.prototype.buildTransactionQueue_=function(t){var e=[];return this.aggregateTransactionQueuesForNode_(t,e),e.sort(function(t,e){return t.order-e.order}),e},vf.prototype.aggregateTransactionQueuesForNode_=function(t,e){var n=this,r=t.getValue();if(null!==r)for(var i=0;i<r.length;i++)e.push(r[i]);t.forEachChild(function(t){n.aggregateTransactionQueuesForNode_(t,e)})},vf.prototype.pruneCompletedTransactionsBelowNode_=function(t){var e=this,n=t.getValue();if(n){for(var r=0,i=0;i<n.length;i++)n[i].status!==Cf.COMPLETED&&(n[r]=n[i],r++);n.length=r,t.setValue(0<n.length?n:null)}t.forEachChild(function(t){e.pruneCompletedTransactionsBelowNode_(t)})},vf.prototype.abortTransactions_=function(t){var e=this,n=this.getAncestorTransactionNode_(t).path(),r=this.transactionQueueTree_.subTree(t);return r.forEachAncestor(function(t){e.abortTransactionsOnNode_(t)}),this.abortTransactionsOnNode_(r),r.forEachDescendant(function(t){e.abortTransactionsOnNode_(t)}),n},vf.prototype.abortTransactionsOnNode_=function(t){var e=t.getValue();if(null!==e){for(var n=[],r=[],i=-1,o=0;o<e.length;o++)if(e[o].status===Cf.SENT_NEEDS_ABORT);else if(e[o].status===Cf.SENT)Ps(i===o-1,"All SENT items should be at beginning of queue."),e[i=o].status=Cf.SENT_NEEDS_ABORT,e[o].abortReason="set";else if(Ps(e[o].status===Cf.RUN,"Unexpected transaction status in abort"),e[o].unwatcher(),r=r.concat(this.serverSyncTree_.ackUserWrite(e[o].currentWriteId,!0)),e[o].onComplete){n.push(e[o].onComplete.bind(null,new Error("set"),!1,null))}-1===i?t.setValue(null):e.length=i+1,this.eventQueue_.raiseEventsForChangedPath(t.path(),r);for(o=0;o<n.length;o++)Au(n[o])}};var Of,Df="databaseURL",Pf=(xf.getInstance=function(){return Of=Of||new xf},xf.prototype.interrupt=function(){var e,t,n,r;try{for(var i=Cs(Object.keys(this.repos_)),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,Cs(Object.keys(this.repos_[s]))),u=a.next();!u.done;u=a.next()){var c=u.value;this.repos_[s][c].interrupt()}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},xf.prototype.resume=function(){var e,t,n,r;try{for(var i=Cs(Object.keys(this.repos_)),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,Cs(Object.keys(this.repos_[s]))),u=a.next();!u.done;u=a.next()){var c=u.value;this.repos_[s][c].resume()}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},xf.prototype.databaseFromApp=function(t,e,n){var r=n||t.options[Df];void 0===r&&uu("Can't determine Firebase Database URL. Be sure to include "+Df+" option when calling firebase.initializeApp().");var i=Vu(r),o=i.repoInfo,s=void 0;return"undefined"!=typeof process&&(s=process.env.FIREBASE_DATABASE_EMULATOR_HOST),s&&(r="http://"+s+"?ns="+o.namespace,o=(i=Vu(r)).repoInfo),$u("Invalid Firebase Database URL",1,i),i.path.isEmpty()||uu("Database URL must point to the root of a Firebase Database (not including a child path)."),this.createRepo(o,t,e).database},xf.prototype.deleteRepo=function(t){var e=ta(this.repos_,t.app.name);e&&ta(e,t.repoInfo_.toURLString())===t||uu("Database "+t.app.name+"("+t.repoInfo_+") has already been deleted."),t.interrupt(),delete e[t.repoInfo_.toURLString()]},xf.prototype.createRepo=function(t,e,n){var r=ta(this.repos_,e.name);r||(r={},this.repos_[e.name]=r);var i=ta(r,t.toURLString());return i&&uu("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),i=new vf(t,this.useRestClient_,e,n),r[t.toURLString()]=i},xf.prototype.forceRestClient=function(t){this.useRestClient_=t},xf);function xf(){this.repos_={},this.useRestClient_=!1}var Lf=(Object.defineProperty(Mf.prototype,"app",{get:function(){return this.repo_.app},enumerable:!0,configurable:!0}),Mf.prototype.ref=function(t){return this.checkDeleted_("ref"),ca("database.ref",0,1,arguments.length),t instanceof Tf?this.refFromURL(t.toString()):void 0!==t?this.root_.child(t):this.root_},Mf.prototype.refFromURL=function(t){var e="database.refFromURL";this.checkDeleted_(e),ca(e,1,1,arguments.length);var n=Vu(t);$u(e,1,n);var r=n.repoInfo;return r.host!==this.repo_.repoInfo_.host&&uu(e+": Host name does not match the current database: (found "+r.host+" but expected "+this.repo_.repoInfo_.host+")"),this.ref(n.path.toString())},Mf.prototype.checkDeleted_=function(t){null===this.repo_&&uu("Cannot call "+t+" on a deleted database.")},Mf.prototype.goOffline=function(){ca("database.goOffline",0,0,arguments.length),this.checkDeleted_("goOffline"),this.repo_.interrupt()},Mf.prototype.goOnline=function(){ca("database.goOnline",0,0,arguments.length),this.checkDeleted_("goOnline"),this.repo_.resume()},Mf.ServerValue={TIMESTAMP:{".sv":"timestamp"}},Mf);function Mf(t){(this.repo_=t)instanceof vf||uu("Don't call new Database() directly - please use firebase.database()."),this.root_=new Tf(t,Du.Empty),this.INTERNAL=new Ff(this)}var Ff=(Uf.prototype.delete=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return this.database.checkDeleted_("delete"),Pf.getInstance().deleteRepo(this.database.repo_),this.database.repo_=null,this.database.root_=null,this.database.INTERNAL=null,this.database=null,[2]})})},Uf);function Uf(t){this.database=t}var jf=Object.freeze({__proto__:null,forceLongPolling:function(){Zl.forceDisallow(),zl.forceAllow()},forceWebSockets:function(){zl.forceDisallow()},isWebSocketsAvailable:function(){return Zl.isAvailable()},setSecurityDebugCallback:function(t,e){t.repo.persistentConnection_.securityDebugCallback_=e},stats:function(t,e){t.repo.stats(e)},statsIncrementCounter:function(t,e){t.repo.statsIncrementCounter(e)},dataUpdateCount:function(t){return t.repo.dataUpdateCount},interceptServerData:function(t,e){return t.repo.interceptServerData_(e)}}),qf=cf;cf.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},cf.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};var Vf,Bf,Wf=rf,Hf=ju,Kf=Object.freeze({__proto__:null,DataConnection:qf,RealTimeConnection:Wf,hijackHash:function(i){var o=cf.prototype.put;return cf.prototype.put=function(t,e,n,r){void 0!==r&&(r=i()),o.call(this,t,e,n,r)},function(){cf.prototype.put=o}},ConnectionTarget:Hf,queryIdentifier:function(t){return t.queryIdentifier()},forceRestClient:function(t){Pf.getInstance().forceRestClient(t)}}),Gf=Lf.ServerValue;Vf=(Bf=Kl).SDK_VERSION,Xl=Vf,Bf.INTERNAL.registerComponent(new da("database",function(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal");return Pf.getInstance().databaseFromApp(n,r,e)},"PUBLIC").setServiceProps({Reference:Tf,Query:_h,Database:Lf,DataSnapshot:hh,enableLogging:iu,INTERNAL:jf,ServerValue:Gf,TEST_ACCESS:Kf}).setMultipleInstances(!0)),Bf.registerVersion("@firebase/database","0.5.24");var zf,Qf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Yf=Yf||{},Jf=Qf;function Xf(t){return"string"==typeof t}function $f(t){return"number"==typeof t}function Zf(t,e){t=t.split("."),e=e||Jf;for(var n=0;n<t.length;n++)if(null==(e=e[t[n]]))return null;return e}function tp(){}function ep(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}function np(t){return"array"==ep(t)}function rp(t){var e=ep(t);return"array"==e||"object"==e&&"number"==typeof t.length}function ip(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var op="closure_uid_"+(1e9*Math.random()>>>0),sp=0;function ap(t,e,n){return t.call.apply(t.bind,arguments)}function up(e,n,t){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var t=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(t,r),e.apply(n,t)}}return function(){return e.apply(n,arguments)}}function cp(t,e,n){return(cp=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ap:up).apply(null,arguments)}function hp(e){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}var lp=Date.now||function(){return+new Date};function fp(t,o){function e(){}e.prototype=o.prototype,t.N=o.prototype,t.prototype=new e,(t.prototype.constructor=t).yb=function(t,e,n){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return o.prototype[e].apply(t,r)}}function pp(){this.j=this.j,this.i=this.i}pp.prototype.j=!1,pp.prototype.la=function(){if(!this.j&&(this.j=!0,this.G(),0))this[op]||(this[op]=++sp)},pp.prototype.G=function(){if(this.i)for(;this.i.length;)this.i.shift()()};var dp=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if(Xf(t))return Xf(e)&&1==e.length?t.indexOf(e,0):-1;for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1},vp=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i=Xf(t)?t.split(""):t,o=0;o<r;o++)o in i&&e.call(n,i[o],o,t)};function yp(){return Array.prototype.concat.apply([],arguments)}function gp(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function mp(t){return/^[\s\xa0]*$/.test(t)}var wp,bp=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function _p(t,e){return-1!=t.indexOf(e)}function Ep(t,e){return t<e?-1:e<t?1:0}t:{var Ip=Jf.navigator;if(Ip){var Tp=Ip.userAgent;if(Tp){wp=Tp;break t}}wp=""}function Sp(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Cp(t){var e,n={};for(e in t)n[e]=t[e];return n}var Np="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ap(t){for(var e,n,r=1;r<arguments.length;r++){for(e in n=arguments[r])t[e]=n[e];for(var i=0;i<Np.length;i++)e=Np[i],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function kp(t){return kp[" "](t),t}kp[" "]=tp;var Rp,Op,Dp=_p(wp,"Opera"),Pp=_p(wp,"Trident")||_p(wp,"MSIE"),xp=_p(wp,"Edge"),Lp=xp||Pp,Mp=_p(wp,"Gecko")&&!(_p(wp.toLowerCase(),"webkit")&&!_p(wp,"Edge"))&&!(_p(wp,"Trident")||_p(wp,"MSIE"))&&!_p(wp,"Edge"),Fp=_p(wp.toLowerCase(),"webkit")&&!_p(wp,"Edge");function Up(){var t=Jf.document;return t?t.documentMode:void 0}t:{var jp="",qp=(Op=wp,Mp?/rv:([^\);]+)(\)|;)/.exec(Op):xp?/Edge\/([\d\.]+)/.exec(Op):Pp?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Op):Fp?/WebKit\/(\S+)/.exec(Op):Dp?/(?:Version)[ \/]?(\S+)/.exec(Op):void 0);if(qp&&(jp=qp?qp[1]:""),Pp){var Vp=Up();if(null!=Vp&&Vp>parseFloat(jp)){Rp=String(Vp);break t}}Rp=jp}var Bp,Wp={};function Hp(a){return function(t,e){var n=Wp;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(a,function(){for(var t=0,e=bp(String(Rp)).split("."),n=bp(String(a)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var o=e[i]||"",s=n[i]||"";do{if(o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],0==o[0].length&&0==s[0].length)break;t=Ep(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||Ep(0==o[2].length,0==s[2].length)||Ep(o[2],s[2]),o=o[3],s=s[3]}while(0==t)}return 0<=t})}var Kp=Jf.document;Bp=Kp&&Pp?Up()||("CSS1Compat"==Kp.compatMode?parseInt(Rp,10):5):void 0;var Gp=!Pp||9<=Number(Bp),zp=Pp&&!Hp("9"),Qp=function(){if(!Jf.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{Jf.addEventListener("test",tp,e),Jf.removeEventListener("test",tp,e)}catch(t){}return t}();function Yp(t,e){this.type=t,this.a=this.target=e,this.Ia=!0}function Jp(t,e){if(Yp.call(this,t?t.type:""),this.relatedTarget=this.a=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.pointerId=0,this.pointerType="",this.c=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.a=e,e=t.relatedTarget){if(Mp){t:{try{kp(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,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!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=Xf(t.pointerType)?t.pointerType:Xp[t.pointerType]||"",(this.c=t).defaultPrevented&&this.b()}}Yp.prototype.b=function(){this.Ia=!1},fp(Jp,Yp);var Xp={2:"touch",3:"pen",4:"mouse"};Jp.prototype.b=function(){Jp.N.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,zp)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}};var $p="closure_listenable_"+(1e6*Math.random()|0),Zp=0;function td(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.da=i,this.key=++Zp,this.X=this.Z=!1}function ed(t){t.X=!0,t.listener=null,t.proxy=null,t.src=null,t.da=null}function nd(t){this.src=t,this.a={},this.b=0}function rd(t,e){var n=e.type;if(n in t.a){var r,i=t.a[n],o=dp(i,e);(r=0<=o)&&Array.prototype.splice.call(i,o,1),r&&(ed(e),0==t.a[n].length&&(delete t.a[n],t.b--))}}function id(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.X&&o.listener==e&&o.capture==!!n&&o.da==r)return i}return-1}nd.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=id(t,e,r,i);return-1<s?(e=t[s],n||(e.Z=!1)):((e=new td(e,this.src,o,!!r,i)).Z=n,t.push(e)),e};var od="closure_lm_"+(1e6*Math.random()|0),sd={};function ad(t,e,n,r,i){if(r&&r.once)return function t(e,n,r,i,o){if(np(n)){for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);return null}r=vd(r);return e&&e[$p]?e.Aa(n,r,ip(i)?!!i.capture:!!i,o):ud(e,n,r,!0,i,o)}(t,e,n,r,i);if(np(e)){for(var o=0;o<e.length;o++)ad(t,e[o],n,r,i);return null}return n=vd(n),t&&t[$p]?t.za(e,n,ip(r)?!!r.capture:!!r,i):ud(t,e,n,!1,r,i)}function ud(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s=ip(i)?!!i.capture:!!i;if(s&&!Gp)return null;var a=pd(t);if(a||(t[od]=a=new nd(t)),(n=a.add(e,n,r,s,o)).proxy)return n;if(r=function(){var e=fd,n=Gp?function(t){return e.call(n.src,n.listener,t)}:function(t){if(!(t=e.call(n.src,n.listener,t)))return t};return n}(),(n.proxy=r).src=t,r.listener=n,t.addEventListener)Qp||(i=s),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(hd(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function cd(t){if(!$f(t)&&t&&!t.X){var e=t.src;if(e&&e[$p])rd(e.c,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(hd(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=pd(e))?(rd(n,t),0==n.b&&(n.src=null,e[od]=null)):ed(t)}}}function hd(t){return t in sd?sd[t]:sd[t]="on"+t}function ld(t,e){var n=t.listener,r=t.da||t.src;return t.Z&&cd(t),n.call(r,e)}function fd(t,e){return!!t.X||(Gp?ld(t,new Jp(e,this)):ld(t,e=new Jp(e||Zf("window.event"),this)))}function pd(t){return(t=t[od])instanceof nd?t:null}var dd="__closure_events_fn_"+(1e9*Math.random()>>>0);function vd(e){return"function"==ep(e)?e:(e[dd]||(e[dd]=function(t){return e.handleEvent(t)}),e[dd])}function yd(){pp.call(this),this.c=new nd(this),(this.J=this).B=null}function gd(t,e,n,r){if(!(e=t.c.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var s=e[o];if(s&&!s.X&&s.capture==n){var a=s.listener,u=s.da||s.src;s.Z&&rd(t.c,s),i=!1!==a.call(u,r)&&i}}return i&&0!=r.Ia}fp(yd,pp),yd.prototype[$p]=!0,(zf=yd.prototype).addEventListener=function(t,e,n,r){ad(this,t,e,n,r)},zf.removeEventListener=function(t,e,n,r){!function t(e,n,r,i,o){if(np(n))for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);else i=ip(i)?!!i.capture:!!i,r=vd(r),e&&e[$p]?(e=e.c,(n=String(n).toString())in e.a&&-1<(r=id(s=e.a[n],r,i,o))&&(ed(s[r]),Array.prototype.splice.call(s,r,1),0==s.length&&(delete e.a[n],e.b--))):(e=e&&pd(e))&&(n=e.a[n.toString()],e=-1,n&&(e=id(n,r,i,o)),(r=-1<e?n[e]:null)&&cd(r))}(this,t,e,n,r)},zf.dispatchEvent=function(t){var e,n=this.B;if(n)for(e=[];n;n=n.B)e.push(n);n=this.J;var r=t.type||t;if(Xf(t))t=new Yp(t,n);else if(t instanceof Yp)t.target=t.target||n;else{var i=t;Ap(t=new Yp(r,n),i)}if(i=!0,e)for(var o=e.length-1;0<=o;o--){var s=t.a=e[o];i=gd(s,r,!0,t)&&i}if(i=gd(s=t.a=n,r,!0,t)&&i,i=gd(s,r,!1,t)&&i,e)for(o=0;o<e.length;o++)i=gd(s=t.a=e[o],r,!1,t)&&i;return i},zf.G=function(){if(yd.N.G.call(this),this.c){var t,e=this.c;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)ed(n[r]);delete e.a[t],e.b--}}this.B=null},zf.za=function(t,e,n,r){return this.c.add(String(t),e,!1,n,r)},zf.Aa=function(t,e,n,r){return this.c.add(String(t),e,!0,n,r)};var md=Jf.JSON.stringify;function wd(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function bd(){this.b=this.a=null}wd.prototype.get=function(){if(0<this.b){this.b--;var t=this.a;this.a=t.next,t.next=null}else t=this.c();return t};var _d,Ed=new wd(function(){return new Id},function(t){t.reset()});function Id(){this.next=this.b=this.a=null}function Td(t){Jf.setTimeout(function(){throw t},0)}function Sd(t,e){_d||function(){var t=Jf.Promise.resolve(void 0);_d=function(){t.then(Ad)}}(),Cd||(_d(),Cd=!0),Nd.add(t,e)}bd.prototype.add=function(t,e){var n=Ed.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},Id.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null};var Cd=!(Id.prototype.reset=function(){this.next=this.b=this.a=null}),Nd=new bd;function Ad(){for(var t;r=n=void 0,r=null,(n=Nd).a&&(r=n.a,n.a=n.a.next,n.a||(n.b=null),r.next=null),t=r;){try{t.a.call(t.b)}catch(t){Td(t)}var e=Ed;e.f(t),e.b<100&&(e.b++,t.next=e.a,e.a=t)}var n,r;Cd=!1}function kd(t,e){yd.call(this),this.b=t||1,this.a=e||Jf,this.f=cp(this.gb,this),this.g=lp()}function Rd(t){t.ba=!1,t.L&&(t.a.clearTimeout(t.L),t.L=null)}function Od(t,e,n){if("function"==ep(t))n&&(t=cp(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=cp(t.handleEvent,t)}return 2147483647<Number(e)?-1:Jf.setTimeout(t,e||0)}function Dd(t,e,n){pp.call(this),this.f=null!=n?cp(t,n):t,this.c=e,this.b=cp(this.$a,this),this.a=[]}function Pd(t){t.U=Od(t.b,t.c),t.f.apply(null,t.a)}function xd(t){pp.call(this),this.b=t,this.a={}}fp(kd,yd),(zf=kd.prototype).ba=!1,zf.L=null,zf.gb=function(){if(this.ba){var t=lp()-this.g;0<t&&t<.8*this.b?this.L=this.a.setTimeout(this.f,this.b-t):(this.L&&(this.a.clearTimeout(this.L),this.L=null),this.dispatchEvent("tick"),this.ba&&(Rd(this),this.start()))}},zf.start=function(){this.ba=!0,this.L||(this.L=this.a.setTimeout(this.f,this.b),this.g=lp())},zf.G=function(){kd.N.G.call(this),Rd(this),delete this.a},fp(Dd,pp),(zf=Dd.prototype).ea=!1,zf.U=null,zf.Ta=function(t){this.a=arguments,this.U?this.ea=!0:Pd(this)},zf.G=function(){Dd.N.G.call(this),this.U&&(Jf.clearTimeout(this.U),this.U=null,this.ea=!1,this.a=[])},zf.$a=function(){this.U=null,this.ea&&(this.ea=!1,Pd(this))},fp(xd,pp);var Ld=[];function Md(t,e,n,r){np(n)||(n&&(Ld[0]=n.toString()),n=Ld);for(var i=0;i<n.length;i++){var o=ad(e,n[i],r||t.handleEvent,!1,t.b||t);if(!o)break;t.a[o.key]=o}}function Fd(t){Sp(t.a,function(t,e){this.a.hasOwnProperty(e)&&cd(t)},t),t.a={}}function Ud(){}xd.prototype.G=function(){xd.N.G.call(this),Fd(this)},xd.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var jd=new yd;function qd(t){Yp.call(this,"serverreachability",t)}function Vd(t){jd.dispatchEvent(new qd(jd,t))}function Bd(t){Yp.call(this,"statevent",t)}function Wd(t){jd.dispatchEvent(new Bd(jd,t))}function Hd(t){Yp.call(this,"timingevent",t)}function Kd(t,e){if("function"!=ep(t))throw Error("Fn must not be null and must be a function");return Jf.setTimeout(function(){t()},e)}fp(qd,Yp),fp(Bd,Yp),fp(Hd,Yp);var Gd={NO_ERROR:0,hb:1,ob:2,nb:3,kb:4,mb:5,pb:6,La:7,TIMEOUT:8,sb:9},zd={jb:"complete",wb:"success",Ma:"error",La:"abort",ub:"ready",vb:"readystatechange",TIMEOUT:"timeout",qb:"incrementaldata",tb:"progress",lb:"downloadprogress",xb:"uploadprogress"};function Qd(){}function Yd(t){var e;return(e=t.a)||(e=t.a={}),e}function Jd(){}Qd.prototype.a=null;var Xd,$d={OPEN:"a",ib:"b",Ma:"c",rb:"d"};function Zd(){Yp.call(this,"d")}function tv(){Yp.call(this,"c")}function ev(){}function nv(t,e,n){this.g=t,this.W=e,this.V=n||1,this.I=new xd(this),this.O=rv,t=Lp?125:void 0,this.P=new kd(t),this.h=null,this.b=!1,this.l=this.D=this.f=this.F=this.v=this.R=this.i=null,this.j=[],this.a=null,this.A=0,this.c=this.w=null,this.o=-1,this.m=!1,this.J=0,this.B=null,this.s=this.S=this.H=!1}fp(Zd,Yp),fp(tv,Yp),fp(ev,Qd),Xd=new ev;var rv=45e3,iv={},ov={};function sv(t,e,n){t.F=1,t.f=Ov(Tv(e)),t.l=n,t.H=!0,uv(t,null)}function av(t,e,n,r){t.F=1,t.f=Ov(Tv(e)),t.l=null,t.H=n,uv(t,r)}function uv(t,e){t.v=lp(),lv(t),t.D=Tv(t.f),Rv(t.D,"t",t.V),t.A=0,t.a=t.g.$(t.g.Y()?e:null),0<t.J&&(t.B=new Dd(cp(t.Ja,t,t.a),t.J)),Md(t.I,t.a,"readystatechange",t.cb),e=t.h?Cp(t.h):{},t.l?(t.w||(t.w="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.a.ca(t.D,t.w,t.l,e)):(t.w="GET",t.a.ca(t.D,t.w,null,e)),Vd(1)}function cv(t,e,n){for(var r=!0;!t.m&&t.A<n.length;){var i=hv(t,n);if(i==ov){4==e&&(t.c=4,Wd(14),r=!1);break}if(i==iv){t.c=4,Wd(15),r=!1;break}yv(t,i)}4==e&&0==n.length&&(t.c=1,Wd(16),r=!1),t.b=t.b&&r,r||(vv(t),dv(t))}function hv(t,e){var n=t.A,r=e.indexOf("\n",n);return-1==r?ov:(n=Number(e.substring(n,r)),isNaN(n)?iv:(r+=1)+n>e.length?ov:(e=e.substr(r,n),t.A=r+n,e))}function lv(t){t.R=lp()+t.O,fv(t,t.O)}function fv(t,e){if(null!=t.i)throw Error("WatchDog timer not null");t.i=Kd(cp(t.ab,t),e)}function pv(t){t.i&&(Jf.clearTimeout(t.i),t.i=null)}function dv(t){t.g.Ca()||t.m||t.g.na(t)}function vv(t){pv(t);var e=t.B;e&&"function"==typeof e.la&&e.la(),t.B=null,Rd(t.P),Fd(t.I),t.a&&(e=t.a,t.a=null,e.abort(),e.la())}function yv(t,e){try{t.g.Fa(t,e),Vd(4)}catch(t){}}function gv(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(rp(t)||Xf(t))vp(t,e,void 0);else{if(t.K&&"function"==typeof t.K)var n=t.K();else if(t.C&&"function"==typeof t.C)n=void 0;else if(rp(t)||Xf(t)){n=[];for(var r=t.length,i=0;i<r;i++)n.push(i)}else for(i in n=[],r=0,t)n[r++]=i;i=(r=function(t){if(t.C&&"function"==typeof t.C)return t.C();if(Xf(t))return t.split("");if(rp(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t)).length;for(var o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}}function mv(t,e){this.b={},this.a=[],this.c=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof mv)for(n=t.K(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function wv(t,e){_v(t.b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&bv(t))}function bv(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];_v(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){var i={};for(n=e=0;e<t.a.length;)_v(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function _v(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(zf=nv.prototype).setTimeout=function(t){this.O=t},zf.cb=function(t){t=t.target;var e=this.B;e&&3==Iy(t)?e.Ta():this.Ja(t)},zf.Ja=function(t){try{if(t==this.a)t:{var e=Iy(this.a),n=this.a.ya(),r=this.a.T();if(!(e<3||3==e&&!Lp&&!this.a.aa())){this.m||4!=e||7==n||Vd(8==n||r<=0?3:2),pv(this);var i=this.a.T();this.o=i;var o=this.a.aa();if(this.b=200==i){if(this.S&&!this.s){e:{if(this.a){var s=Ty(this.a,"X-HTTP-Initial-Response");if(s&&!mp(s)){var a=s;break e}}a=null}if(!a){this.b=!1,this.c=3,Wd(12),vv(this),dv(this);break t}this.s=!0,yv(this,a)}this.H?(cv(this,e,o),Lp&&this.b&&3==e&&(Md(this.I,this.P,"tick",this.bb),this.P.start())):yv(this,o),4==e&&vv(this),this.b&&!this.m&&(4==e?this.g.na(this):(this.b=!1,lv(this)))}else 400==i&&0<o.indexOf("Unknown SID")?(this.c=3,Wd(12)):(this.c=0,Wd(13)),vv(this),dv(this)}}}catch(t){}},zf.bb=function(){if(this.a){var t=Iy(this.a),e=this.a.aa();this.A<e.length&&(pv(this),cv(this,t,e),this.b&&4!=t&&lv(this))}},zf.cancel=function(){this.m=!0,vv(this)},zf.ab=function(){this.i=null;var t=lp();0<=t-this.R?(2!=this.F&&(Vd(3),Wd(17)),vv(this),this.c=2,dv(this)):fv(this,this.R-t)},(zf=mv.prototype).C=function(){bv(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},zf.K=function(){return bv(this),this.a.concat()},zf.get=function(t,e){return _v(this.b,t)?this.b[t]:e},zf.set=function(t,e){_v(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},zf.forEach=function(t,e){for(var n=this.K(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var Ev=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Iv(t,e){var n;this.b=this.j=this.f="",this.i=null,this.g=this.a="",this.h=!1,t instanceof Iv?(this.h=void 0!==e?e:t.h,Sv(this,t.f),this.j=t.j,Cv(this,t.b),Nv(this,t.i),this.a=t.a,Av(this,Kv(t.c)),this.g=t.g):t&&(n=String(t).match(Ev))?(this.h=!!e,Sv(this,n[1]||"",!0),this.j=Dv(n[2]||""),Cv(this,n[3]||"",!0),Nv(this,n[4]),this.a=Dv(n[5]||"",!0),Av(this,n[6]||"",!0),this.g=Dv(n[7]||"")):(this.h=!!e,this.c=new qv(null,this.h))}function Tv(t){return new Iv(t)}function Sv(t,e,n){t.f=n?Dv(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function Cv(t,e,n){t.b=n?Dv(e,!0):e}function Nv(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.i=e}else t.i=null}function Av(t,e,n){e instanceof qv?(t.c=e,function(t,e){e&&!t.f&&(Vv(t),t.c=null,t.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Bv(this,e),Hv(this,n,t))},t)),t.f=e}(t.c,t.h)):(n||(e=Pv(e,Uv)),t.c=new qv(e,t.h))}function kv(t,e,n){t.c.set(e,n)}function Rv(t,e,n){np(n)||(n=[String(n)]),Hv(t.c,e,n)}function Ov(t){return kv(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^lp()).toString(36)),t}function Dv(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Pv(t,e,n){return Xf(t)?(t=encodeURI(t).replace(e,xv),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function xv(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Iv.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Pv(e,Lv,!0),":");var n=this.b;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(Pv(e,Lv,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.i)&&t.push(":",String(n))),(n=this.a)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(Pv(n,"/"==n.charAt(0)?Fv:Mv,!0))),(n=this.c.toString())&&t.push("?",n),(n=this.g)&&t.push("#",Pv(n,jv)),t.join("")},Iv.prototype.resolve=function(t){var e=Tv(this),n=!!t.f;n?Sv(e,t.f):n=!!t.j,n?e.j=t.j:n=!!t.b,n?Cv(e,t.b):n=null!=t.i;var r=t.a;if(n)Nv(e,t.i);else if(n=!!t.a){if("/"!=r.charAt(0))if(this.b&&!this.a)r="/"+r;else{var i=e.a.lastIndexOf("/");-1!=i&&(r=e.a.substr(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(_p(i,"./")||_p(i,"/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var o=[],s=0;s<i.length;){var a=i[s++];"."==a?r&&s==i.length&&o.push(""):".."==a?((1<o.length||1==o.length&&""!=o[0])&&o.pop(),r&&s==i.length&&o.push("")):(o.push(a),r=!0)}r=o.join("/")}else r=i}return n?e.a=r:n=""!==t.c.toString(),n?Av(e,Kv(t.c)):n=!!t.g,n&&(e.g=t.g),e};var Lv=/[#\/\?@]/g,Mv=/[#\?:]/g,Fv=/[#\?]/g,Uv=/[#\?@]/g,jv=/#/g;function qv(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Vv(n){n.a||(n.a=new mv,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var o=t[n].substring(0,r);i=t[n].substring(r+1)}else o=t[n];e(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(n.c,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function Bv(t,e){Vv(t),e=Gv(t,e),_v(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,wv(t.a,e))}function Wv(t,e){return Vv(t),e=Gv(t,e),_v(t.a.b,e)}function Hv(t,e,n){Bv(t,e),0<n.length&&(t.c=null,t.a.set(Gv(t,e),gp(n)),t.b+=n.length)}function Kv(t){var e=new qv;return e.c=t.c,t.a&&(e.a=new mv(t.a),e.b=t.b),e}function Gv(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function zv(t){this.a=t,this.b=this.h=null,this.g=!1,this.i=null,this.c=-1,this.l=this.f=null}function Qv(t){var e=t.a.F.a;if(null!=e)Wd(4),e?(Wd(10),My(t.a,t,!1)):(Wd(11),My(t.a,t,!0));else{t.b=new nv(t,void 0,void 0),t.b.h=t.h,e=Vy(e=t.a,e.Y()?t.f:null,t.i),Wd(4),Rv(e,"TYPE","xmlhttp");var n=t.a.j,r=t.a.I;n&&r&&kv(e,n,r),av(t.b,e,!1,t.f)}}function Yv(){this.a=this.b=null}function Jv(){this.a=new mv}function Xv(t){var e=typeof t;return"object"==e&&t||"function"==e?"o"+(t[op]||(t[op]=++sp)):e.charAt(0)+t}function $v(t,e){this.b=t,this.a=e}function Zv(t){this.g=t||ty,t=Jf.PerformanceNavigationTiming?0<(t=Jf.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(Jf.ka&&Jf.ka.Da&&Jf.ka.Da()&&Jf.ka.Da().zb),this.f=t?this.g:1,this.a=null,1<this.f&&(this.a=new Jv),this.b=null,this.c=[]}(zf=qv.prototype).add=function(t,e){Vv(this),this.c=null,t=Gv(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},zf.forEach=function(n,r){Vv(this),this.a.forEach(function(t,e){vp(t,function(t){n.call(r,t,e,this)},this)},this)},zf.K=function(){Vv(this);for(var t=this.a.C(),e=this.a.K(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},zf.C=function(t){Vv(this);var e=[];if(Xf(t))Wv(this,t)&&(e=yp(e,this.a.get(Gv(this,t))));else{t=this.a.C();for(var n=0;n<t.length;n++)e=yp(e,t[n])}return e},zf.set=function(t,e){return Vv(this),this.c=null,Wv(this,t=Gv(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},zf.get=function(t,e){return t&&0<(t=this.C(t)).length?String(t[0]):e},zf.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.K(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.C(r);for(var o=0;o<r.length;o++){var s=i;""!==r[o]&&(s+="="+encodeURIComponent(String(r[o]))),t.push(s)}}return this.c=t.join("&")},fp(function(){},function(){}),(zf=zv.prototype).M=null,zf.$=function(t){return this.a.$(t)},zf.abort=function(){this.b&&(this.b.cancel(),this.b=null),this.c=-1},zf.Ca=function(){return!1},zf.Fa=function(t,e){if(this.c=t.o,0==this.M){if(!this.a.o&&(t=t.a)){var n=Ty(t,"X-Client-Wire-Protocol");this.l=n||null,this.a.j&&(t=Ty(t,"X-HTTP-Session-Id"))&&(this.a.I=t)}if(e){try{var r=this.a.ja.a.parse(e)}catch(t){return(e=this.a).m=this.c,void jy(e,2)}this.f=r[0]}else(e=this.a).m=this.c,jy(e,2)}else 1==this.M&&(this.g?Wd(6):"11111"==e?(Wd(5),this.g=!0,(!Pp||10<=Number(Bp))&&(this.c=200,this.b.cancel(),Wd(11),My(this.a,this,!0))):(Wd(7),this.g=!1))},zf.na=function(){if(this.c=this.b.o,this.b.b)0==this.M?(this.M=1,Qv(this)):1==this.M&&(this.g?(Wd(11),My(this.a,this,!0)):(Wd(10),My(this.a,this,!1)));else{0==this.M?Wd(8):1==this.M&&Wd(9);var t=this.a;t.m=this.c,jy(t,2)}},zf.Y=function(){return this.a.Y()},zf.ma=function(){return this.a.ma()},Jv.prototype.add=function(t){this.a.set(Xv(t),t)},Jv.prototype.C=function(){return this.a.C()};var ty=10;function ey(t,e){!t.a&&(_p(e,"spdy")||_p(e,"quic")||_p(e,"h2"))&&(t.f=t.g,t.a=new Jv,t.b&&(oy(t,t.b),t.b=null))}function ny(t){return!!t.b||!!t.a&&t.a.a.c>=t.f}function ry(t){return t.b?1:t.a?t.a.a.c:0}function iy(t,e){return t=t.b?t.b==e:!!t.a&&(e=Xv(e),_v(t.a.a.b,e))}function oy(t,e){t.a?t.a.add(e):t.b=e}function sy(t,e){var n;t.b&&t.b==e?t.b=null:((n=t.a)&&(n=Xv(e),n=_v(t.a.a.b,n)),n&&wv(t.a.a,Xv(e)))}function ay(t){if(null!=t.b)return t.c.concat(t.b.j);if(null==t.a||0==t.a.a.c)return gp(t.c);var e=t.c;return vp(t.a.C(),function(t){e=e.concat(t.j)}),e}function uy(){}function cy(){this.a=new uy}function hy(t,r,e){var i=e||"";try{gv(t,function(t,e){var n=t;ip(t)&&(n=md(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}function ly(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}Zv.prototype.cancel=function(){this.c=ay(this),this.b?(this.b.cancel(),this.b=null):this.a&&0!=this.a.a.c&&(vp(this.a.C(),function(t){t.cancel()}),function(t){t.b={},t.a.length=0,t.c=0}(this.a.a))},uy.prototype.stringify=function(t){return Jf.JSON.stringify(t,void 0)},uy.prototype.parse=function(t){return Jf.JSON.parse(t,void 0)};var fy=Jf.JSON.parse;function py(t){yd.call(this),this.headers=new mv,this.H=t||null,this.b=!1,this.s=this.a=null,this.A="",this.h=0,this.f="",this.g=this.w=this.l=this.v=!1,this.o=0,this.m=null,this.I=dy,this.D=this.F=!1}fp(py,yd);var dy="",vy=/^https?$/i,yy=["POST","PUT"];function gy(t){return"content-type"==t.toLowerCase()}function my(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,wy(t),_y(t)}function wy(t){t.v||(t.v=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function by(t){if(t.b&&void 0!==Yf&&(!t.s[1]||4!=Iy(t)||2!=t.T()))if(t.l&&4==Iy(t))Od(t.Ea,0,t);else if(t.dispatchEvent("readystatechange"),4==Iy(t)){t.b=!1;try{var e,n=t.T();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var o=String(t.A).match(Ev)[1]||null;if(!o&&Jf.self&&Jf.self.location){var s=Jf.self.location.protocol;o=s.substr(0,s.length-1)}i=!vy.test(o?o.toLowerCase():"")}e=i}if(e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.h=6;try{var a=2<Iy(t)?t.a.statusText:""}catch(t){a=""}t.f=a+" ["+t.T()+"]",wy(t)}}finally{_y(t)}}}function _y(t,e){if(t.a){Ey(t);var n=t.a,r=t.s[0]?tp:null;t.a=null,t.s=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){}}}function Ey(t){t.a&&t.D&&(t.a.ontimeout=null),t.m&&(Jf.clearTimeout(t.m),t.m=null)}function Iy(t){return t.a?t.a.readyState:0}function Ty(t,e){return t.a?t.a.getResponseHeader(e):null}function Sy(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}if(r)return t;if(n=function(t){var n="";return Sp(t,function(t,e){n+=e,n+=":",n+=t,n+="\r\n"}),n}(n),Xf(t)){if(e=encodeURIComponent(String(e)),e+=n=null!=n?"="+encodeURIComponent(String(n)):""){if((n=t.indexOf("#"))<0&&(n=t.length),(r=t.indexOf("?"))<0||n<r){r=n;var i=""}else i=t.substring(r+1,n);n=(t=[t.substr(0,r),i,t.substr(n)])[1],t[1]=e?n?n+"&"+e:e:n,t=t[0]+(t[1]?"?"+t[1]:"")+t[2]}return t}return kv(t,e,n),t}function Cy(t){this.f=[],this.F=new Yv,this.ga=this.pa=this.B=this.ha=this.a=this.I=this.j=this.V=this.g=this.J=this.i=null,this.Qa=this.P=0,this.Oa=!!Zf("internalChannelParams.failFast",t),this.ia=this.w=this.s=this.l=this.h=this.c=null,this.oa=!0,this.m=this.ra=this.O=-1,this.S=this.v=this.A=0,this.Na=Zf("internalChannelParams.baseRetryDelayMs",t)||5e3,this.Ra=Zf("internalChannelParams.retryDelaySeedMs",t)||1e4,this.Pa=Zf("internalChannelParams.forwardChannelMaxRetries",t)||2,this.qa=Zf("internalChannelParams.forwardChannelRequestTimeoutMs",t)||2e4,this.Ka=t&&t.Ab||void 0,this.D=void 0,this.R=t&&t.supportsCrossDomainXhr||!1,this.H="",this.b=new Zv(t&&t.concurrentRequestLimit),this.ja=new cy,this.o=!t||void 0===t.backgroundChannelTest||t.backgroundChannelTest,(this.W=t&&t.fastHandshake||!1)&&!this.o&&(this.o=!0),t&&t.forceLongPolling&&(this.oa=!1),this.fa=void 0}function Ny(t){if(Ay(t),3==t.u){var e=t.P++,n=Tv(t.B);kv(n,"SID",t.H),kv(n,"RID",e),kv(n,"TYPE","terminate"),Dy(t,n),(e=new nv(t,e,void 0)).F=2,e.f=Ov(Tv(n)),n=!1,Jf.navigator&&Jf.navigator.sendBeacon&&(n=Jf.navigator.sendBeacon(e.f.toString(),"")),!n&&Jf.Image&&((new Image).src=e.f,n=!0),n||(e.a=e.g.$(null),e.a.ca(e.f)),e.v=lp(),lv(e)}qy(t)}function Ay(t){t.w&&(t.w.abort(),t.w=null),t.a&&(t.a.cancel(),t.a=null),t.l&&(Jf.clearTimeout(t.l),t.l=null),Fy(t),t.b.cancel(),t.h&&($f(t.h)&&Jf.clearTimeout(t.h),t.h=null)}function ky(t,e){t.f.push(new $v(t.Qa++,e)),3==t.u&&Ry(t)}function Ry(t){ny(t.b)||t.h||(t.h=!0,Sd(t.Ha,t),t.A=0)}function Oy(t,e){var n;n=e?e.W:t.P++;var r=Tv(t.B);kv(r,"SID",t.H),kv(r,"RID",n),kv(r,"AID",t.O),Dy(t,r),t.g&&t.i&&Sy(r,t.g,t.i),n=new nv(t,n,t.A+1),null===t.g&&(n.h=t.i),e&&(t.f=e.j.concat(t.f)),e=Py(t,n,1e3),n.setTimeout(Math.round(.5*t.qa)+Math.round(.5*t.qa*Math.random())),oy(t.b,n),sv(n,r,e)}function Dy(t,n){t.c&&gv({},function(t,e){kv(n,e,t)})}function Py(t,e,n){n=Math.min(t.f.length,n);var r=t.c?cp(t.c.Sa,t.c,t):null;t:for(var i=t.f,o=-1;;){var s=["count="+n];-1==o?0<n?(o=i[0].b,s.push("ofs="+o)):o=0:s.push("ofs="+o);for(var a=!0,u=0;u<n;u++){var c=i[u].b,h=i[u].a;if((c-=o)<0)o=Math.max(0,i[u].b-100),a=!1;else try{hy(h,s,"req"+c+"_")}catch(t){r&&r(h)}}if(a){r=s.join("&");break t}}return t=t.f.splice(0,n),e.j=t,r}function xy(t){t.a||t.l||(t.S=1,Sd(t.Ga,t),t.v=0)}function Ly(t){return!(t.a||t.l||3<=t.v)&&(t.S++,t.l=Kd(cp(t.Ga,t),Uy(t,t.v)),t.v++,!0)}function My(t,e,n){var r=e.l;r&&ey(t.b,r),t.ia=t.oa&&n,t.m=e.c,t.B=Vy(t,null,t.ha),Ry(t)}function Fy(t){null!=t.s&&(Jf.clearTimeout(t.s),t.s=null)}function Uy(t,e){var n=t.Na+Math.floor(Math.random()*t.Ra);return t.ma()||(n*=2),n*e}function jy(t,e){if(2==e){var n=null;t.c&&(n=null);var r=cp(t.eb,t);n||(n=new Iv("//www.google.com/images/cleardot.gif"),Jf.location&&"http"==Jf.location.protocol||Sv(n,"https"),Ov(n)),function(t,e){var n=new Ud;if(Jf.Image){var r=new Image;r.onload=hp(ly,n,r,"TestLoadImage: loaded",!0,e),r.onerror=hp(ly,n,r,"TestLoadImage: error",!1,e),r.onabort=hp(ly,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=hp(ly,n,r,"TestLoadImage: timeout",!1,e),Jf.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=t}else e(!1)}(n.toString(),r)}else Wd(2);t.u=0,t.c&&t.c.ta(e),qy(t),Ay(t)}function qy(t){t.u=0,t.m=-1,t.c&&(0==ay(t.b).length&&0==t.f.length||(t.b.c.length=0,gp(t.f),t.f.length=0),t.c.sa())}function Vy(t,e,n){var r=function(t){return t instanceof Iv?Tv(t):new Iv(t,void 0)}(n);if(""!=r.b)e&&Cv(r,e+"."+r.b),Nv(r,r.i);else{var i,o=Jf.location;i=e?e+"."+o.hostname:o.hostname,r=function(t,e,n,r){var i=new Iv(null,void 0);return t&&Sv(i,t),e&&Cv(i,e),n&&Nv(i,n),r&&(i.a=r),i}(o.protocol,i,+o.port,n)}return t.V&&Sp(t.V,function(t,e){kv(r,e,t)}),e=t.j,n=t.I,e&&n&&kv(r,e,n),kv(r,"VER",t.wa),Dy(t,r),r}function By(){}function Wy(){if(Pp&&!(10<=Number(Bp)))throw Error("Environmental error: no available transport.")}function Hy(t,e){yd.call(this),this.a=new Cy(e),this.g=t,this.m=e&&e.fb?e.fb:function(t){for(var e=t,n=1;n<arguments.length;n++){var r,i=arguments[n];if(0==i.lastIndexOf("/",0))e=i;else(r=""==e)||(r=0<=(r=e.length-1)&&e.indexOf("/",r)==r),e+=r?i:"/"+i}return e}(this.g,"test"),this.b=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.a.i=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.xa&&(t?t["X-WebChannel-Client-Profile"]=e.xa:t={"X-WebChannel-Client-Profile":e.xa}),this.a.J=t,(t=e&&e.httpHeadersOverwriteParam)&&!mp(t)&&(this.a.g=t),this.l=e&&e.supportsCrossDomainXhr||!1,this.h=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!mp(e)&&(this.a.j=e,null!==(t=this.b)&&e in t&&(e in(t=this.b)&&delete t[e])),this.f=new zy(this)}function Ky(t){Zd.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.c=t)?(t=this.c,this.data=null!==e&&t in e?e[t]:void 0):this.data=e}else this.data=t}function Gy(){tv.call(this),this.status=1}function zy(t){this.a=t}(zf=py.prototype).ca=function(t,e,n,r){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.A+"; newUri="+t);e=e?e.toUpperCase():"GET",this.A=t,this.f="",this.h=0,this.v=!1,this.b=!0,this.a=new XMLHttpRequest,this.s=this.H?Yd(this.H):Yd(Xd),this.a.onreadystatechange=cp(this.Ea,this);try{this.w=!0,this.a.open(e,String(t),!0),this.w=!1}catch(t){return void my(this,t)}t=n||"";var i=new mv(this.headers);r&&gv(r,function(t,e){i.set(e,t)}),r=function(t){t:{for(var e=gy,n=t.length,r=Xf(t)?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t)){e=i;break t}e=-1}return e<0?null:Xf(t)?t.charAt(e):t[e]}(i.K()),n=Jf.FormData&&t instanceof Jf.FormData,0<=dp(yy,e)&&!r&&!n&&i.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),i.forEach(function(t,e){this.a.setRequestHeader(e,t)},this),this.I&&(this.a.responseType=this.I),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{Ey(this),0<this.o&&((this.D=function(t){return Pp&&Hp(9)&&$f(t.timeout)&&void 0!==t.ontimeout}(this.a))?(this.a.timeout=this.o,this.a.ontimeout=cp(this.Ba,this)):this.m=Od(this.Ba,this.o,this)),this.l=!0,this.a.send(t),this.l=!1}catch(t){my(this,t)}},zf.Ba=function(){void 0!==Yf&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,this.dispatchEvent("timeout"),this.abort(8))},zf.abort=function(t){this.a&&this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1,this.h=t||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),_y(this))},zf.G=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),_y(this,!0)),py.N.G.call(this)},zf.Ea=function(){this.j||(this.w||this.l||this.g?by(this):this.Za())},zf.Za=function(){by(this)},zf.T=function(){try{return 2<Iy(this)?this.a.status:-1}catch(t){return-1}},zf.aa=function(){try{return this.a?this.a.responseText:""}catch(t){return""}},zf.Ua=function(t){if(this.a){var e=this.a.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),fy(e)}},zf.ya=function(){return this.h},zf.Xa=function(){return Xf(this.f)?this.f:String(this.f)},(zf=Cy.prototype).wa=8,zf.u=1,zf.Ca=function(){return 0==this.u},zf.Ha=function(t){if(this.h)if(this.h=null,1==this.u){if(!t){this.P=Math.floor(1e5*Math.random()),t=this.P++;var e,n=new nv(this,t,void 0),r=this.i;if(this.J&&(r?Ap(r=Cp(r),this.J):r=this.J),null===this.g&&(n.h=r),this.W)t:{for(var i=e=0;i<this.f.length;i++){var o=this.f[i];if(void 0===(o="__data__"in o.a&&Xf(o=o.a.__data__)?o.length:void 0))break;if(4096<(e+=o)){e=i;break t}if(4096===e||i===this.f.length-1){e=i+1;break t}}e=1e3}else e=1e3;e=Py(this,n,e),kv(i=Tv(this.B),"RID",t),kv(i,"CVER",22),this.o&&this.j&&kv(i,"X-HTTP-Session-Id",this.j),Dy(this,i),this.g&&r&&Sy(i,this.g,r),oy(this.b,n),this.W?(kv(i,"$req",e),kv(i,"SID","null"),n.S=!0,sv(n,i,null)):sv(n,i,e),this.u=2}}else 3==this.u&&(t?Oy(this,t):0==this.f.length||ny(this.b)||Oy(this))},zf.Ga=function(){this.l=null,this.a=new nv(this,"rpc",this.S),null===this.g&&(this.a.h=this.i),this.a.J=0;var t=Tv(this.pa);kv(t,"RID","rpc"),kv(t,"SID",this.H),kv(t,"CI",this.ia?"0":"1"),kv(t,"AID",this.O),Dy(this,t),kv(t,"TYPE","xmlhttp"),this.g&&this.i&&Sy(t,this.g,this.i),this.D&&this.a.setTimeout(this.D),av(this.a,t,!0,this.ga)},zf.Fa=function(t,e){if(0!=this.u&&(this.a==t||iy(this.b,t)))if(this.m=t.o,!t.s&&iy(this.b,t)&&3==this.u){try{var n=this.ja.a.parse(e)}catch(t){n=null}if(np(n)&&3==n.length){if(0==(e=n)[0]){t:if(!this.l){if(this.a){if(!(this.a.v+3e3<t.v))break t;Fy(this),this.a.cancel(),this.a=null}Ly(this),Wd(18)}}else this.ra=e[1],0<this.ra-this.O&&e[2]<37500&&this.ia&&0==this.v&&!this.s&&(this.s=Kd(cp(this.Ya,this),6e3));if(ry(this.b)<=1&&this.fa){try{this.fa()}catch(t){}this.fa=void 0}}else jy(this,11)}else if(!t.s&&this.a!=t||Fy(this),!mp(e))for(e=n=this.ja.a.parse(e),n=0;n<e.length;n++){var r=e[n];if(this.O=r[0],r=r[1],2==this.u)if("c"==r[0]){this.H=r[1],this.ga=r[2];var i=r[3];null!=i&&(this.wa=i),null!=(r=r[5])&&$f(r)&&0<r&&(this.D=1.5*r),this.o&&(r=t.a)&&((i=Ty(r,"X-Client-Wire-Protocol"))&&ey(this.b,i),this.j&&(r=Ty(r,"X-HTTP-Session-Id")))&&(this.I=r,kv(this.B,this.j,r)),this.u=3,this.c&&this.c.va(),r=t,this.pa=Vy(this,this.Y()?this.ga:null,this.ha),r.s?(sy(this.b,r),(i=this.D)&&r.setTimeout(i),r.i&&(pv(r),lv(r)),this.a=r):xy(this),0<this.f.length&&Ry(this)}else"stop"!=r[0]&&"close"!=r[0]||jy(this,7);else 3==this.u&&("stop"==r[0]||"close"==r[0]?"stop"==r[0]?jy(this,7):Ny(this):"noop"!=r[0]&&this.c&&this.c.ua(r),this.v=0)}},zf.Ya=function(){null!=this.s&&(this.s=null,this.a.cancel(),this.a=null,Ly(this),Wd(19))},zf.na=function(t){var e=null;if(this.a==t){Fy(this),this.a=null;var n=2}else{if(!iy(this.b,t))return;e=t.j,sy(this.b,t),n=1}if(this.m=t.o,0!=this.u)if(t.b)1==n?(e=lp()-t.v,jd.dispatchEvent(new Hd(jd,t.l?t.l.length:0,e,this.A)),Ry(this)):xy(this);else{var r=t.c;if(3==r||0==r&&0<this.m||!(1==n&&function(t,e){return!(ry(t.b)>=t.b.f-(t.h?1:0))&&(t.h?(t.f=e.j.concat(t.f),!0):!(1==t.u||2==t.u||t.A>=(t.Oa?0:t.Pa))&&(t.h=Kd(cp(t.Ha,t,e),Uy(t,t.A)),t.A++,!0))}(this,t)||2==n&&Ly(this)))switch(e&&0<e.length&&(t=this.b,t.c=t.c.concat(e)),r){case 1:jy(this,5);break;case 4:jy(this,10);break;case 3:jy(this,6);break;default:jy(this,2)}}},zf.eb=function(t){Wd(t?2:1)},zf.$=function(t){if(t&&!this.R)throw Error("Can't create secondary domain capable XhrIo object.");return(t=new py(this.Ka)).F=this.R,t},zf.ma=function(){return!!this.c&&!0},zf.Y=function(){return this.R},(zf=By.prototype).va=function(){},zf.ua=function(){},zf.ta=function(){},zf.sa=function(){},zf.Sa=function(){},Wy.prototype.a=function(t,e){return new Hy(t,e)},fp(Hy,yd),(zf=Hy.prototype).addEventListener=function(t,e,n,r){Hy.N.addEventListener.call(this,t,e,n,r)},zf.removeEventListener=function(t,e,n,r){Hy.N.removeEventListener.call(this,t,e,n,r)},zf.Va=function(){this.a.c=this.f,this.l&&(this.a.R=!0);var t=this.a,e=this.m,n=this.g,r=this.b||void 0;Wd(0),t.ha=n,t.V=r||{},t.o&&(t.F.b=[],t.F.a=!1),t.w=new zv(t),null===t.g&&(t.w.h=t.i),n=e,t.g&&t.i&&(n=Sy(e,t.g,t.i)),(t=t.w).i=n,e=Vy(t.a,null,t.i),Wd(3),null!=(n=t.a.F.b)?(t.f=n[0],t.M=1,Qv(t)):(Rv(e,"MODE","init"),!t.a.o&&t.a.j&&Rv(e,"X-HTTP-Session-Id",t.a.j),t.b=new nv(t,void 0,void 0),t.b.h=t.h,av(t.b,e,!1,null),t.M=0)},zf.close=function(){Ny(this.a)},zf.Wa=function(t){if(Xf(t)){var e={};e.__data__=t,ky(this.a,e)}else this.h?((e={}).__data__=md(t),ky(this.a,e)):ky(this.a,t)},zf.G=function(){this.a.c=null,delete this.f,Ny(this.a),delete this.a,Hy.N.G.call(this)},fp(Ky,Zd),fp(Gy,tv),fp(zy,By),zy.prototype.va=function(){this.a.dispatchEvent("a")},zy.prototype.ua=function(t){this.a.dispatchEvent(new Ky(t))},zy.prototype.ta=function(t){this.a.dispatchEvent(new Gy(t))},zy.prototype.sa=function(){this.a.dispatchEvent("b")};var Qy=hp(function(t,e){function n(){}n.prototype=t.prototype;var r=new n;return t.apply(r,Array.prototype.slice.call(arguments,1)),r},Wy);Wy.prototype.createWebChannel=Wy.prototype.a,Hy.prototype.send=Hy.prototype.Wa,Hy.prototype.open=Hy.prototype.Va,Hy.prototype.close=Hy.prototype.close,Gd.NO_ERROR=0,Gd.TIMEOUT=8,Gd.HTTP_ERROR=6,zd.COMPLETE="complete",(Jd.EventType=$d).OPEN="a",$d.CLOSE="b",$d.ERROR="c",$d.MESSAGE="d",yd.prototype.listen=yd.prototype.za,py.prototype.listenOnce=py.prototype.Aa,py.prototype.getLastError=py.prototype.Xa,py.prototype.getLastErrorCode=py.prototype.ya,py.prototype.getStatus=py.prototype.T,py.prototype.getResponseJson=py.prototype.Ua,py.prototype.getResponseText=py.prototype.aa,py.prototype.send=py.prototype.ca;function Yy(t,e){this.user=e,this.type="OAuth",this.o={},this.o.Authorization="Bearer "+t}var Jy,Xy={createWebChannelTransport:Qy,ErrorCode:Gd,EventType:zd,WebChannel:Jd,XhrIo:py},$y=Xy.createWebChannelTransport,Zy=Xy.ErrorCode,tg=Xy.EventType,eg=Xy.WebChannel,ng=Xy.XhrIo,rg=Kl.SDK_VERSION,ig=(yg.prototype.t=function(){return null!=this.uid},yg.prototype.i=function(){return this.t()?"uid:"+this.uid:"anonymous-user"},yg.prototype.isEqual=function(t){return t.uid===this.uid},yg.UNAUTHENTICATED=new yg(null),yg.u=new yg("google-credentials-uid"),yg.s=new yg("first-party-uid"),yg),og={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"},sg=(Es(vg,Jy=Error),vg),ag=(dg.prototype.getToken=function(){return Promise.resolve(null)},dg.prototype.l=function(){},dg.prototype.v=function(t){H_(!this.h,"Can only call setChangeListener() once."),(this.h=t)(ig.UNAUTHENTICATED)},dg.prototype.m=function(){H_(null!==this.h,"removeChangeListener() when no listener registered"),this.h=null},dg),ug=(pg.prototype.getToken=function(){var e=this;H_(null!=this.g,"getToken cannot be called after listener removed.");var n=this._,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(function(t){if(e._!==n)throw new sg(og.ABORTED,"getToken aborted due to token change.");return t?(H_("string"==typeof t.accessToken,"Invalid tokenData returned from getToken():"+t),new Yy(t.accessToken,e.currentUser)):null}):Promise.resolve(null)},pg.prototype.l=function(){this.forceRefresh=!0},pg.prototype.v=function(t){H_(!this.h,"Can only call setChangeListener() once."),this.h=t,this.p&&t(this.currentUser)},pg.prototype.m=function(){H_(null!=this.g,"removeChangeListener() called twice"),H_(null!==this.h,"removeChangeListener() called when no listener registered"),this.auth&&this.auth.removeAuthTokenListener(this.g),this.g=null,this.h=null},pg.prototype.I=function(){var t=this.auth&&this.auth.getUid();return H_(null===t||"string"==typeof t,"Received invalid UID: "+t),new ig(t)},pg),cg=(Object.defineProperty(fg.prototype,"o",{get:function(){var t={"X-Goog-AuthUser":this.D},e=this.T.auth.R([]);return e&&(t.Authorization=e),t},enumerable:!0,configurable:!0}),fg),hg=(lg.prototype.getToken=function(){return Promise.resolve(new cg(this.T,this.D))},lg.prototype.v=function(t){t(ig.s)},lg.prototype.m=function(){},lg.prototype.l=function(){},lg);function lg(t,e){this.T=t,this.D=e}function fg(t,e){this.T=t,this.D=e,this.type="FirstParty",this.user=ig.s}function pg(t){var e=this;this.g=null,this.currentUser=ig.UNAUTHENTICATED,this.p=!1,this._=0,this.h=null,this.forceRefresh=!1,this.g=function(){e._++,e.currentUser=e.I(),e.p=!0,e.h&&e.h(e.currentUser)},this._=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.g):(this.g(null),t.get().then(function(t){e.auth=t,e.g&&e.auth.addAuthTokenListener(e.g)},function(){}))}function dg(){this.h=null}function vg(t,e){var n=Jy.call(this,e)||this;return n.code=t,n.message=e,n.name="FirebaseError",n.toString=function(){return n.name+": [code="+n.code+"]: "+n.message},n}function yg(t){this.uid=t}function gg(t,e){function n(){var t="This constructor is private.";throw e&&(t+=" ",t+=e),new sg(og.INVALID_ARGUMENT,t)}return n.prototype=t.prototype,Object.assign(n,t),n}function mg(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function wg(t,e){return void 0!==t?t:e}function bg(t,e){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Number(n);isNaN(r)||e(r,t[n])}}function _g(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Eg(t){for(var e in H_(null!=t&&"object"==typeof t,"isEmpty() expects object parameter."),t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Ig(t,e){if(0!==e.length)throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() does not support arguments, but was called with "+qg(e.length,"argument")+".")}function Tg(t,e,n){if(e.length!==n)throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() requires "+qg(n,"argument")+", but was called with "+qg(e.length,"argument")+".")}function Sg(t,e,n){if(e.length<n)throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() requires at least "+qg(n,"argument")+", but was called with "+qg(e.length,"argument")+".")}function Cg(t,e,n,r){if(e.length<n||e.length>r)throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+qg(e.length,"argument")+".")}function Ng(t,e,n,r){Dg(t,e,jg(n)+" argument",r)}function Ag(t,e,n,r){void 0!==r&&Ng(t,e,n,r)}function kg(t,e,n,r){Dg(t,e,n+" option",r)}function Rg(t,e,n,r){void 0!==r&&kg(t,e,n,r)}function Og(t,e,n,r,c){void 0!==r&&function(t,e,n,r){for(var i=[],o=0,s=c;o<s.length;o++){var a=s[o];if(a===r)return;i.push(xg(a))}var u=xg(r);throw new sg(og.INVALID_ARGUMENT,"Invalid value "+u+" provided to function "+t+'() for option "'+n+'". Acceptable values: '+i.join(", "))}(t,0,n,r)}function Dg(t,e,n,r){if(!("object"===e?Pg(r):"non-empty string"===e?"string"==typeof r&&""!==r:typeof r===e)){var i=xg(r);throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() requires its "+n+" to be of type "+e+", but it was: "+i)}}function Pg(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}function xg(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return 20<t.length&&(t=t.substring(0,20)+"..."),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"!=typeof t)return"function"==typeof t?"a function":W_("Unknown wrong type: "+typeof t);if(t instanceof Array)return"an array";var e=function(t){if(t.constructor){var e=/function\s+([^\s(]+)\s*\(/.exec(t.constructor.toString());if(e&&1<e.length)return e[1]}return null}(t);return e?"a custom "+e+" object":"an object"}function Lg(t,e,n){if(void 0===n)throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() requires a valid "+jg(e)+" argument, but it was undefined.")}function Mg(n,t,r){_g(t,function(t,e){if(r.indexOf(t)<0)throw new sg(og.INVALID_ARGUMENT,"Unknown option '"+t+"' passed to function "+n+"(). Available options: "+r.join(", "))})}function Fg(t,e,n,r){var i=xg(r);return new sg(og.INVALID_ARGUMENT,"Function "+t+"() requires its "+jg(n)+" argument to be a "+e+", but it was: "+i)}function Ug(t,e,n){if(n<=0)throw new sg(og.INVALID_ARGUMENT,'Function "'+t+'()" requires its '+jg(e)+" argument to be a positive number, but it was: "+n+".")}function jg(t){switch(t){case 1:return"first";case 2:return"second";case 3:return"third";default:return t+"th"}}function qg(t,e){return t+" "+e+(1===t?"":"s")}var Vg=(Bg.fromBase64String=function(t){return new Bg(x_.C().atob(t))},Bg.fromUint8Array=function(t){return new Bg(Wg(t))},Bg.prototype.toBase64=function(){return x_.C().btoa(this.A)},Bg.prototype.toUint8Array=function(){return Hg(this.A)},Bg.prototype.P=function(){return 2*this.A.length},Bg.prototype.isEqual=function(t){return this.A===t.A},Bg.k=new Bg(""),Bg);function Bg(t){this.A=t}function Wg(t){for(var e="",n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}function Hg(t){for(var e=new Uint8Array(t.length),n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function Kg(){if("undefined"==typeof Uint8Array)throw new sg(og.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function Gg(){if(!x_.C().N)throw new sg(og.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var zg,Qg,Yg=(bm.fromBase64String=function(t){Tg("Blob.fromBase64String",arguments,1),Ng("Blob.fromBase64String","string",1,t),Gg();try{return new bm(x_.C().atob(t))}catch(t){throw new sg(og.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+t)}},bm.fromUint8Array=function(t){if(Tg("Blob.fromUint8Array",arguments,1),Kg(),!(t instanceof Uint8Array))throw Fg("Blob.fromUint8Array","Uint8Array",1,t);return new bm(Wg(t))},bm.prototype.toBase64=function(){return Tg("Blob.toBase64",arguments,0),Gg(),x_.C().btoa(this.A)},bm.prototype.toUint8Array=function(){return Tg("Blob.toUint8Array",arguments,0),Kg(),Hg(this.A)},bm.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},bm.prototype.isEqual=function(t){return this.A===t.A},bm.prototype.O=function(){return 2*this.A.length},bm.prototype.F=function(t){return z_(this.A,t.A)},bm),Jg=gg(Yg,"Use Blob.fromUint8Array() or Blob.fromBase64String() instead."),Xg=(Object.defineProperty(wm.prototype,"latitude",{get:function(){return this.V},enumerable:!0,configurable:!0}),Object.defineProperty(wm.prototype,"longitude",{get:function(){return this.U},enumerable:!0,configurable:!0}),wm.prototype.isEqual=function(t){return this.V===t.V&&this.U===t.U},wm.prototype.F=function(t){return z_(this.V,t.V)||z_(this.U,t.U)},wm),$g=(mm.now=function(){return mm.fromMillis(Date.now())},mm.fromDate=function(t){return mm.fromMillis(t.getTime())},mm.fromMillis=function(t){var e=Math.floor(t/1e3);return new mm(e,1e6*(t-1e3*e))},mm.prototype.toDate=function(){return new Date(this.toMillis())},mm.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},mm.prototype.F=function(t){return this.seconds===t.seconds?z_(this.nanoseconds,t.nanoseconds):z_(this.seconds,t.seconds)},mm.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},mm.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},mm.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},mm),Zg=(gm.j=function(t){var e=Math.floor(t/1e6);return new gm(new $g(e,t%1e6*1e3))},gm.L=function(t){return new gm(t)},gm.q=function(){return gm.MIN},gm.prototype.B=function(t){return this.timestamp.F(t.timestamp)},gm.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},gm.prototype.M=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},gm.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},gm.prototype.G=function(){return this.timestamp},gm.MIN=new gm(new $g(0,0)),gm),tm=(Object.defineProperty(ym.prototype,"length",{get:function(){return this.len},enumerable:!0,configurable:!0}),ym.prototype.isEqual=function(t){return 0===ym.W(this,t)},ym.prototype.child=function(t){var e=this.segments.slice(this.offset,this.limit());return t instanceof ym?t.forEach(function(t){e.push(t)}):e.push(t),this.K(e)},ym.prototype.limit=function(){return this.offset+this.length},ym.prototype.H=function(t){return t=void 0===t?1:t,H_(this.length>=t,"Can't call popFirst() with less segments"),this.K(this.segments,this.offset+t,this.length-t)},ym.prototype.J=function(){return H_(!this.Y(),"Can't call popLast() on empty path"),this.K(this.segments,this.offset,this.length-1)},ym.prototype.X=function(){return H_(!this.Y(),"Can't call firstSegment() on empty path"),this.segments[this.offset]},ym.prototype.$=function(){return this.get(this.length-1)},ym.prototype.get=function(t){return H_(t<this.length,"Index out of range"),this.segments[this.offset+t]},ym.prototype.Y=function(){return 0===this.length},ym.prototype.Z=function(t){if(t.length<this.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},ym.prototype.tt=function(t){if(this.length+1!==t.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},ym.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},ym.prototype.nt=function(){return this.segments.slice(this.offset,this.limit())},ym.W=function(t,e){for(var n=Math.min(t.length,e.length),r=0;r<n;r++){var i=t.get(r),o=e.get(r);if(i<o)return-1;if(o<i)return 1}return t.length<e.length?-1:t.length>e.length?1:0},ym),em=(Es(vm,Qg=tm),vm.prototype.K=function(t,e,n){return new vm(t,e,n)},vm.prototype.it=function(){return this.nt().join("/")},vm.prototype.toString=function(){return this.it()},vm.et=function(t){if(0<=t.indexOf("//"))throw new sg(og.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new vm(t.split("/").filter(function(t){return 0<t.length}))},vm.rt=new vm([]),vm),nm=/^[_a-zA-Z][_a-zA-Z0-9]*$/,rm=(Es(dm,zg=tm),dm.prototype.K=function(t,e,n){return new dm(t,e,n)},dm.ut=function(t){return nm.test(t)},dm.prototype.it=function(){return this.nt().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),dm.ut(t)||(t="`"+t+"`"),t}).join(".")},dm.prototype.toString=function(){return this.it()},dm.prototype.st=function(){return 1===this.length&&"__name__"===this.get(0)},dm.ot=function(){return new dm(["__name__"])},dm.ht=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new sg(og.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");e.push(n),n=""},o=!1;r<t.length;){var s=t[r];if("\\"===s){if(r+1===t.length)throw new sg(og.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var a=t[r+1];if("\\"!==a&&"."!==a&&"`"!==a)throw new sg(og.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=a,r+=2}else"`"===s?o=!o:"."!==s||o?n+=s:i(),r++}if(i(),o)throw new sg(og.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new dm(e)},dm.rt=new dm([]),dm),im=(pm.prototype.at=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},pm.prototype.isEqual=function(t){return null!==t&&0===em.W(this.path,t.path)},pm.prototype.toString=function(){return this.path.toString()},pm.W=function(t,e){return em.W(t.path,e.path)},pm.ct=function(t){return t.length%2==0},pm.ft=function(t){return new pm(new em(t.slice()))},pm.lt=function(t){return new pm(em.et(t))},pm.EMPTY=new pm(new em([])),pm),om=(fm.prototype.dt=function(t,e){return new fm(this.W,this.root.dt(t,e,this.W).copy(null,null,am.vt,null,null))},fm.prototype.remove=function(t){return new fm(this.W,this.root.remove(t,this.W).copy(null,null,am.vt,null,null))},fm.prototype.get=function(t){for(var e=this.root;!e.Y();){var n=this.W(t,e.key);if(0===n)return e.value;n<0?e=e.left:0<n&&(e=e.right)}return null},fm.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.Y();){var r=this.W(t,n.key);if(0===r)return e+n.left.size;n=r<0?n.left:(e+=n.left.size+1,n.right)}return-1},fm.prototype.Y=function(){return this.root.Y()},Object.defineProperty(fm.prototype,"size",{get:function(){return this.root.size},enumerable:!0,configurable:!0}),fm.prototype.wt=function(){return this.root.wt()},fm.prototype.gt=function(){return this.root.gt()},fm.prototype.bt=function(t){return this.root.bt(t)},fm.prototype.forEach=function(n){this.bt(function(t,e){return n(t,e),!1})},fm.prototype.toString=function(){var n=[];return this.bt(function(t,e){return n.push(t+":"+e),!1}),"{"+n.join(", ")+"}"},fm.prototype.pt=function(t){return this.root.pt(t)},fm.prototype.yt=function(){return new sm(this.root,null,this.W,!1)},fm.prototype._t=function(t){return new sm(this.root,t,this.W,!1)},fm.prototype.It=function(){return new sm(this.root,null,this.W,!0)},fm.prototype.Tt=function(t){return new sm(this.root,t,this.W,!0)},fm),sm=(lm.prototype.Rt=function(){H_(0<this.Dt.length,"getNext() called on iterator when hasNext() is false.");var t=this.Dt.pop(),e={key:t.key,value:t.value};if(this.Et)for(t=t.left;!t.Y();)this.Dt.push(t),t=t.right;else for(t=t.right;!t.Y();)this.Dt.push(t),t=t.left;return e},lm.prototype.St=function(){return 0<this.Dt.length},lm.prototype.At=function(){if(0===this.Dt.length)return null;var t=this.Dt[this.Dt.length-1];return{key:t.key,value:t.value}},lm),am=(hm.prototype.copy=function(t,e,n,r,i){return new hm(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)},hm.prototype.Y=function(){return!1},hm.prototype.bt=function(t){return this.left.bt(t)||t(this.key,this.value)||this.right.bt(t)},hm.prototype.pt=function(t){return this.right.pt(t)||t(this.key,this.value)||this.left.pt(t)},hm.prototype.min=function(){return this.left.Y()?this:this.left.min()},hm.prototype.wt=function(){return this.min().key},hm.prototype.gt=function(){return this.right.Y()?this.key:this.right.gt()},hm.prototype.dt=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.dt(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.dt(t,e,n))).Ct()},hm.prototype.Pt=function(){if(this.left.Y())return hm.EMPTY;var t=this;return t.left.kt()||t.left.left.kt()||(t=t.Nt()),(t=t.copy(null,null,null,t.left.Pt(),null)).Ct()},hm.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r.left.Y()||r.left.kt()||r.left.left.kt()||(r=r.Nt()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.kt()&&(r=r.Ot()),r.right.Y()||r.right.kt()||r.right.left.kt()||(r=r.Ft()),0===e(t,r.key)){if(r.right.Y())return hm.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.Pt())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.Ct()},hm.prototype.kt=function(){return this.color},hm.prototype.Ct=function(){var t=this;return t.right.kt()&&!t.left.kt()&&(t=t.Vt()),t.left.kt()&&t.left.left.kt()&&(t=t.Ot()),t.left.kt()&&t.right.kt()&&(t=t.Ut()),t},hm.prototype.Nt=function(){var t=this.Ut();return t.right.left.kt()&&(t=(t=(t=t.copy(null,null,null,null,t.right.Ot())).Vt()).Ut()),t},hm.prototype.Ft=function(){var t=this.Ut();return t.left.left.kt()&&(t=(t=t.Ot()).Ut()),t},hm.prototype.Vt=function(){var t=this.copy(null,null,hm.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},hm.prototype.Ot=function(){var t=this.copy(null,null,hm.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},hm.prototype.Ut=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},hm.prototype.xt=function(){var t=this.jt();return Math.pow(2,t)<=this.size+1},hm.prototype.jt=function(){if(this.kt()&&this.left.kt())throw W_("Red node has red child("+this.key+","+this.value+")");if(this.right.kt())throw W_("Right child of ("+this.key+","+this.value+") is red");var t=this.left.jt();if(t!==this.right.jt())throw W_("Black depths differ");return t+(this.kt()?0:1)},hm.EMPTY=null,hm.RED=!0,hm.vt=!1,hm),um=(Object.defineProperty(cm.prototype,"key",{get:function(){throw W_("LLRBEmptyNode has no key.")},enumerable:!0,configurable:!0}),Object.defineProperty(cm.prototype,"value",{get:function(){throw W_("LLRBEmptyNode has no value.")},enumerable:!0,configurable:!0}),Object.defineProperty(cm.prototype,"color",{get:function(){throw W_("LLRBEmptyNode has no color.")},enumerable:!0,configurable:!0}),Object.defineProperty(cm.prototype,"left",{get:function(){throw W_("LLRBEmptyNode has no left child.")},enumerable:!0,configurable:!0}),Object.defineProperty(cm.prototype,"right",{get:function(){throw W_("LLRBEmptyNode has no right child.")},enumerable:!0,configurable:!0}),cm.prototype.copy=function(t,e,n,r,i){return this},cm.prototype.dt=function(t,e,n){return new am(t,e)},cm.prototype.remove=function(t,e){return this},cm.prototype.Y=function(){return!0},cm.prototype.bt=function(t){return!1},cm.prototype.pt=function(t){return!1},cm.prototype.wt=function(){return null},cm.prototype.gt=function(){return null},cm.prototype.kt=function(){return!1},cm.prototype.xt=function(){return!0},cm.prototype.jt=function(){return 0},cm);function cm(){this.size=0}function hm(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:hm.RED,this.left=null!=r?r:hm.EMPTY,this.right=null!=i?i:hm.EMPTY,this.size=this.left.size+1+this.right.size}function lm(t,e,n,r){this.Et=r,this.Dt=[];for(var i=1;!t.Y();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.Et?t.left:t.right;else{if(0===i){this.Dt.push(t);break}this.Dt.push(t),t=this.Et?t.right:t.left}}function fm(t,e){this.W=t,this.root=e||am.EMPTY}function pm(t){this.path=t,H_(pm.ct(t),"Invalid DocumentKey with an odd number of segments: "+t.nt().join("/"))}function dm(){return null!==zg&&zg.apply(this,arguments)||this}function vm(){return null!==Qg&&Qg.apply(this,arguments)||this}function ym(t,e,n){void 0===e?e=0:e>t.length&&W_("offset "+e+" out of range "+t.length),void 0===n?n=t.length-e:n>t.length-e&&W_("length "+n+" out of range "+(t.length-e)),this.segments=t,this.offset=e,this.len=n}function gm(t){this.timestamp=t}function mm(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new sg(og.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new sg(og.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new sg(og.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new sg(og.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function wm(t,e){if(Tg("GeoPoint",arguments,2),Ng("GeoPoint","number",1,t),Ng("GeoPoint","number",2,e),!isFinite(t)||t<-90||90<t)throw new sg(og.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||180<e)throw new sg(og.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this.V=t,this.U=e}function bm(t){Gg(),this.A=t}am.EMPTY=new um;var _m=(Dm.Lt=function(t){var e=new Dm(t.W);return t.forEach(function(t){e=e.add(t)}),e},Dm.prototype.has=function(t){return null!==this.data.get(t)},Dm.prototype.first=function(){return this.data.wt()},Dm.prototype.last=function(){return this.data.gt()},Object.defineProperty(Dm.prototype,"size",{get:function(){return this.data.size},enumerable:!0,configurable:!0}),Dm.prototype.indexOf=function(t){return this.data.indexOf(t)},Dm.prototype.forEach=function(n){this.data.bt(function(t,e){return n(t),!1})},Dm.prototype.qt=function(t,e){for(var n=this.data._t(t[0]);n.St();){var r=n.Rt();if(0<=this.W(r.key,t[1]))return;e(r.key)}},Dm.prototype.Bt=function(t,e){var n;for(n=void 0!==e?this.data._t(e):this.data.yt();n.St();)if(!t(n.Rt().key))return},Dm.prototype.Mt=function(t){var e=this.data._t(t);return e.St()?e.Rt().key:null},Dm.prototype.yt=function(){return new Em(this.data.yt())},Dm.prototype._t=function(t){return new Em(this.data._t(t))},Dm.prototype.add=function(t){return this.copy(this.data.remove(t).dt(t,!0))},Dm.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},Dm.prototype.Y=function(){return this.data.Y()},Dm.prototype.Qt=function(t){var e=this;return e.size<t.size&&(e=t,t=this),t.forEach(function(t){e=e.add(t)}),e},Dm.prototype.isEqual=function(t){if(!(t instanceof Dm))return!1;if(this.size!==t.size)return!1;for(var e=this.data.yt(),n=t.data.yt();e.St();){var r=e.Rt().key,i=n.Rt().key;if(0!==this.W(r,i))return!1}return!0},Dm.prototype.nt=function(){var e=[];return this.forEach(function(t){e.push(t)}),e},Dm.prototype.toString=function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"},Dm.prototype.copy=function(t){var e=new Dm(this.W);return e.data=t,e},Dm),Em=(Om.prototype.Rt=function(){return this.Gt.Rt().key},Om.prototype.St=function(){return this.Gt.St()},Om),Im=(Rm.prototype.Wt=function(t,e){return new Lw(e,t)},Rm.prototype.zt=function(t,e){return e},Rm.prototype.Kt=function(t){return null},Rm.prototype.isEqual=function(t){return t instanceof Rm},Rm.instance=new Rm,Rm),Tm=(km.prototype.Wt=function(t,e){return this.apply(t)},km.prototype.zt=function(t,e){return this.apply(t)},km.prototype.apply=function(t){for(var n=Pm(t),e=function(e){n.find(function(t){return t.isEqual(e)})||n.push(e)},r=0,i=this.elements;r<i.length;r++)e(i[r]);return new Vw(n)},km.prototype.Kt=function(t){return null},km.prototype.isEqual=function(t){return t instanceof km&&Q_(t.elements,this.elements)},km),Sm=(Am.prototype.Wt=function(t,e){return this.apply(t)},Am.prototype.zt=function(t,e){return this.apply(t)},Am.prototype.apply=function(t){for(var n=Pm(t),e=function(e){n=n.filter(function(t){return!t.isEqual(e)})},r=0,i=this.elements;r<i.length;r++)e(i[r]);return new Vw(n)},Am.prototype.Kt=function(t){return null},Am.prototype.isEqual=function(t){return t instanceof Am&&Q_(t.elements,this.elements)},Am),Cm=(Nm.prototype.Wt=function(t,e){var n=this.Kt(t);if(n instanceof Ow&&this.Ht instanceof Ow){var r=n.Jt+this.Ht.Jt;return new Ow(r)}return r=n.Jt+this.Ht.Jt,new Dw(r)},Nm.prototype.zt=function(t,e){return H_(null!==e,"Didn't receive transformResult for NUMERIC_ADD transform"),e},Nm.prototype.Kt=function(t){return t instanceof nw?t:new Ow(0)},Nm.prototype.isEqual=function(t){return t instanceof Nm&&this.Ht.isEqual(t.Ht)},Nm);function Nm(t){this.Ht=t}function Am(t){this.elements=t}function km(t){this.elements=t}function Rm(){}function Om(t){this.Gt=t}function Dm(t){this.W=t,this.data=new om(this.W)}function Pm(t){return t instanceof Vw?t.Jt.slice():[]}function xm(t,e){this.version=t,this.transformResults=e}var Lm,Mm,Fm,Um,jm,qm,Vm,Bm,Wm=(yw.Yt=function(t){return new yw(t)},yw.Xt=function(t){var e=new _m(rm.W);return t.forEach(function(t){return e=e.add(t)}),new yw(e)},yw.prototype.$t=function(e){var n=!1;return this.fields.forEach(function(t){t.Z(e)&&(n=!0)}),n},yw.prototype.isEqual=function(t){return this.fields.isEqual(t.fields)},yw),Hm=(vw.prototype.isEqual=function(t){return this.field.isEqual(t.field)&&this.transform.isEqual(t.transform)},vw),Km=(dw.exists=function(t){return new dw(void 0,t)},dw.updateTime=function(t){return new dw(t)},Object.defineProperty(dw.prototype,"Zt",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!0,configurable:!0}),dw.prototype.tn=function(t){return void 0!==this.updateTime?t instanceof Ww&&t.version.isEqual(this.updateTime):void 0!==this.exists?this.exists===t instanceof Ww:(H_(this.Zt,"Precondition should be empty"),!0)},dw.prototype.isEqual=function(t){return e=this.updateTime,n=t.updateTime,!((null!=e?!n||!e.isEqual(n):e!==n)||this.exists!==t.exists);var e,n},dw.NONE=new dw,dw),Gm=(pw.prototype.nn=function(t){null!=t&&H_(t.key.isEqual(this.key),"Can only apply a mutation to a document with the same key")},pw.in=function(t){return t instanceof Ww?t.version:Zg.MIN},pw),zm=(Es(fw,Bm=Gm),fw.prototype.zt=function(t,e){this.nn(t),H_(null==e.transformResults,"Transform results received by SetMutation.");var n=e.version;return new Ww(this.key,n,{hasCommittedMutations:!0},this.value)},fw.prototype.Wt=function(t,e,n){if(this.nn(t),!this.en.tn(t))return t;var r=Gm.in(t);return new Ww(this.key,r,{rn:!0},this.value)},fw.prototype.un=function(t){return null},fw.prototype.isEqual=function(t){return t instanceof fw&&this.key.isEqual(t.key)&&this.value.isEqual(t.value)&&this.en.isEqual(t.en)},fw),Qm=(Es(lw,Vm=Gm),lw.prototype.zt=function(t,e){if(this.nn(t),H_(null==e.transformResults,"Transform results received by PatchMutation."),!this.en.tn(t))return new Kw(this.key,e.version);var n=this.on(t);return new Ww(this.key,e.version,{hasCommittedMutations:!0},n)},lw.prototype.Wt=function(t,e,n){if(this.nn(t),!this.en.tn(t))return t;var r=Gm.in(t),i=this.on(t);return new Ww(this.key,r,{rn:!0},i)},lw.prototype.un=function(t){return null},lw.prototype.isEqual=function(t){return t instanceof lw&&this.key.isEqual(t.key)&&this.sn.isEqual(t.sn)&&this.en.isEqual(t.en)},lw.prototype.on=function(t){var e;return e=t instanceof Ww?t.data():jw.EMPTY,this.hn(e)},lw.prototype.hn=function(t){var n=this,r=t.cn();return this.sn.fields.forEach(function(t){if(!t.Y()){var e=n.data.field(t);null!==e?r.set(t,e):r.delete(t)}}),r.an()},lw),Ym=(Es(hw,qm=Gm),hw.prototype.zt=function(t,e){if(this.nn(t),H_(null!=e.transformResults,"Transform results missing for TransformMutation."),!this.en.tn(t))return new Kw(this.key,e.version);var n=this.fn(t),r=this.ln(t,e.transformResults),i=e.version,o=this.dn(n.data(),r);return new Ww(this.key,i,{hasCommittedMutations:!0},o)},hw.prototype.Wt=function(t,e,n){if(this.nn(t),!this.en.tn(t))return t;var r=this.fn(t),i=this.vn(n,t,e),o=this.dn(r.data(),i);return new Ww(this.key,r.version,{rn:!0},o)},hw.prototype.un=function(t){for(var e=null,n=0,r=this.fieldTransforms;n<r.length;n++){var i=r[n],o=t instanceof Ww?t.field(i.field):void 0,s=i.transform.Kt(o||null);null!=s&&(e=null==e?jw.wn().set(i.field,s):e.set(i.field,s))}return e?e.an():null},hw.prototype.isEqual=function(t){return t instanceof hw&&this.key.isEqual(t.key)&&Q_(this.fieldTransforms,t.fieldTransforms)&&this.en.isEqual(t.en)},hw.prototype.fn=function(t){return H_(t instanceof Ww,"Unknown MaybeDocument type "+t),H_(t.key.isEqual(this.key),"Can only transform a document with the same key"),t},hw.prototype.ln=function(t,e){var n=[];H_(this.fieldTransforms.length===e.length,"server transform result count ("+e.length+") should match field transform count ("+this.fieldTransforms.length+")");for(var r=0;r<e.length;r++){var i=this.fieldTransforms[r],o=i.transform,s=null;t instanceof Ww&&(s=t.field(i.field)),n.push(o.zt(s,e[r]))}return n},hw.prototype.vn=function(t,e,n){for(var r=[],i=0,o=this.fieldTransforms;i<o.length;i++){var s=o[i],a=s.transform,u=null;e instanceof Ww&&(u=e.field(s.field)),null===u&&n instanceof Ww&&(u=n.field(s.field)),r.push(a.Wt(u,t))}return r},hw.prototype.dn=function(t,e){H_(e.length===this.fieldTransforms.length,"TransformResults length mismatch.");for(var n=t.cn(),r=0;r<this.fieldTransforms.length;r++){var i=this.fieldTransforms[r].field;n.set(i,e[r])}return n.an()},hw),Jm=(Es(cw,jm=Gm),cw.prototype.zt=function(t,e){return this.nn(t),H_(null==e.transformResults,"Transform results received by DeleteMutation."),new Hw(this.key,e.version,{hasCommittedMutations:!0})},cw.prototype.Wt=function(t,e,n){return this.nn(t),this.en.tn(t)?(t&&H_(t.key.isEqual(this.key),"Can only apply mutation to document with same key"),new Hw(this.key,Zg.q())):t},cw.prototype.un=function(t){return null},cw.prototype.isEqual=function(t){return t instanceof cw&&this.key.isEqual(t.key)&&this.en.isEqual(t.en)},cw),Xm=(Es(uw,Um=Gm),uw.prototype.zt=function(t,e){W_("VerifyMutation should only be used in Transactions.")},uw.prototype.Wt=function(t,e,n){W_("VerifyMutation should only be used in Transactions.")},uw.prototype.un=function(t){W_("VerifyMutation should only be used in Transactions.")},uw.prototype.isEqual=function(t){return t instanceof uw&&this.key.isEqual(t.key)&&this.en.isEqual(t.en)},uw),$m=(aw.gn=function(t,e){switch(t.serverTimestamps){case"estimate":return new aw(1,e);case"previous":return new aw(2,e);case"none":case void 0:return new aw(0,e);default:return W_("fromSnapshotOptions() called with invalid options.")}},aw),Zm=(sw.prototype.toString=function(){var t=this.value();return null===t?"null":t.toString()},sw.prototype.bn=function(t){return H_(this.pn!==t.pn,"Default compareTo should not be used for values of same type."),z_(this.pn,t.pn)},sw),tw=(Es(ow,Fm=Zm),ow.prototype.value=function(t){return null},ow.prototype.isEqual=function(t){return t instanceof ow},ow.prototype.B=function(t){return t instanceof ow?0:this.bn(t)},ow.prototype.P=function(){return 4},ow.yn=new ow,ow),ew=(Es(iw,Mm=Zm),iw.prototype.value=function(t){return this.Jt},iw.prototype.isEqual=function(t){return t instanceof iw&&this.Jt===t.Jt},iw.prototype.B=function(t){return t instanceof iw?z_(this.Jt,t.Jt):this.bn(t)},iw.prototype.P=function(){return 4},iw.of=function(t){return t?iw._n:iw.In},iw._n=new iw(!0),iw.In=new iw(!1),iw),nw=(Es(rw,Lm=Zm),rw.prototype.value=function(t){return this.Jt},rw.prototype.B=function(t){return t instanceof rw?(e=this.Jt)<(n=t.Jt)?-1:n<e?1:e===n?0:isNaN(e)?isNaN(n)?0:-1:1:this.bn(t);var e,n},rw.prototype.P=function(){return 8},rw);function rw(t){var e=Lm.call(this)||this;return e.Jt=t,e.pn=2,e}function iw(t){var e=Mm.call(this)||this;return e.Jt=t,e.pn=1,e}function ow(){var t=Fm.call(this)||this;return t.pn=0,t.Jt=null,t}function sw(){}function aw(t,e){this.mn=t,this.timestampsInSnapshots=e}function uw(t,e){var n=Um.call(this)||this;return n.key=t,n.en=e,n.type=4,n}function cw(t,e){var n=jm.call(this)||this;return n.key=t,n.en=e,n.type=3,n}function hw(t,e){var n=qm.call(this)||this;return n.key=t,n.fieldTransforms=e,n.type=2,n.en=Km.exists(!0),n}function lw(t,e,n,r){var i=Vm.call(this)||this;return i.key=t,i.data=e,i.sn=n,i.en=r,i.type=1,i}function fw(t,e,n){var r=Bm.call(this)||this;return r.key=t,r.value=e,r.en=n,r.type=0,r}function pw(){}function dw(t,e){this.updateTime=t,this.exists=e,H_(void 0===t||void 0===e,'Precondition can specify "exists" or "updateTime" but not both')}function vw(t,e){this.field=t,this.transform=e}function yw(t){this.fields=t}function gw(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}var mw,ww,bw,_w,Ew,Iw,Tw,Sw,Cw,Nw,Aw,kw,Rw,Ow=(Es(sb,Rw=nw),sb.prototype.isEqual=function(t){return t instanceof sb&&gw(this.Jt,t.Jt)},sb),Dw=(Es(ob,kw=nw),ob.prototype.isEqual=function(t){return t instanceof ob&&gw(this.Jt,t.Jt)},ob.Tn=new ob(NaN),ob.POSITIVE_INFINITY=new ob(1/0),ob.NEGATIVE_INFINITY=new ob(-1/0),ob),Pw=(Es(ib,Aw=Zm),ib.prototype.value=function(t){return this.Jt},ib.prototype.isEqual=function(t){return t instanceof ib&&this.Jt===t.Jt},ib.prototype.B=function(t){return t instanceof ib?z_(this.Jt,t.Jt):this.bn(t)},ib.prototype.P=function(){return 2*this.Jt.length},ib),xw=(Es(rb,Nw=Zm),rb.prototype.value=function(t){return!t||t.timestampsInSnapshots?this.Jt:this.Jt.toDate()},rb.prototype.isEqual=function(t){return t instanceof rb&&this.Jt.isEqual(t.Jt)},rb.prototype.B=function(t){return t instanceof rb?this.Jt.F(t.Jt):t instanceof Lw?-1:this.bn(t)},rb.prototype.P=function(){return 16},rb),Lw=(Es(nb,Cw=Zm),nb.prototype.value=function(t){return t&&1===t.mn?new xw(this.En).value(t):t&&2===t.mn&&this.previousValue?this.previousValue.value(t):null},nb.prototype.isEqual=function(t){return t instanceof nb&&this.En.isEqual(t.En)},nb.prototype.B=function(t){return t instanceof nb?this.En.F(t.En):t instanceof xw?1:this.bn(t)},nb.prototype.toString=function(){return"<ServerTimestamp localTime="+this.En.toString()+">"},nb.prototype.P=function(){return 16+(this.previousValue?this.previousValue.P():0)},nb),Mw=(Es(eb,Sw=Zm),eb.prototype.value=function(t){return this.Jt},eb.prototype.isEqual=function(t){return t instanceof eb&&this.Jt.isEqual(t.Jt)},eb.prototype.B=function(t){return t instanceof eb?this.Jt.F(t.Jt):this.bn(t)},eb.prototype.P=function(){return this.Jt.O()},eb),Fw=(Es(tb,Tw=Zm),tb.prototype.value=function(t){return this.key},tb.prototype.isEqual=function(t){return t instanceof tb&&this.key.isEqual(t.key)&&this.Dn.isEqual(t.Dn)},tb.prototype.B=function(t){if(t instanceof tb){var e=this.Dn.B(t.Dn);return 0!==e?e:im.W(this.key,t.key)}return this.bn(t)},tb.prototype.P=function(){return this.Dn.projectId.length+this.Dn.database.length+this.key.toString().length},tb),Uw=(Es(Zw,Iw=Zm),Zw.prototype.value=function(t){return this.Jt},Zw.prototype.isEqual=function(t){return t instanceof Zw&&this.Jt.isEqual(t.Jt)},Zw.prototype.B=function(t){return t instanceof Zw?this.Jt.F(t.Jt):this.bn(t)},Zw.prototype.P=function(){return 16},Zw),jw=(Es($w,Ew=Zm),$w.wn=function(){return new qw($w.EMPTY.Jt)},$w.prototype.value=function(n){var r={};return this.Jt.bt(function(t,e){r[t]=e.value(n)}),r},$w.prototype.forEach=function(t){this.Jt.bt(t)},$w.prototype.isEqual=function(t){if(t instanceof $w){for(var e=this.Jt.yt(),n=t.Jt.yt();e.St()&&n.St();){var r=e.Rt(),i=n.Rt();if(r.key!==i.key||!r.value.isEqual(i.value))return!1}return!e.St()&&!n.St()}return!1},$w.prototype.B=function(t){if(t instanceof $w){for(var e=this.Jt.yt(),n=t.Jt.yt();e.St()&&n.St();){var r=e.Rt(),i=n.Rt(),o=z_(r.key,i.key)||r.value.B(i.value);if(o)return o}return z_(e.St(),n.St())}return this.bn(t)},$w.prototype.contains=function(t){return null!==this.field(t)},$w.prototype.field=function(t){H_(!t.Y(),"Can't get field of empty path");var e=this;return t.forEach(function(t){e=e instanceof $w?e.Jt.get(t):null}),e},$w.prototype.sn=function(){var i=new _m(rm.W);return this.Jt.forEach(function(t,e){var n=new rm([t]);if(e instanceof $w){var r=e.sn().fields;r.Y()?i=i.add(n):r.forEach(function(t){i=i.add(n.child(t))})}else i=i.add(n)}),Wm.Yt(i)},$w.prototype.P=function(){var n=0;return this.Jt.bt(function(t,e){n+=t.length+e.P()}),n},$w.prototype.toString=function(){return this.Jt.toString()},$w.prototype.cn=function(){return new qw(this.Jt)},$w.EMPTY=new $w(new om(z_)),$w),qw=(Xw.prototype.set=function(t,e){H_(!t.Y(),"Cannot set field for empty path on ObjectValue");var n=t.X();if(1===t.length)this.Jt=this.Jt.dt(n,e);else{var r=this.Jt.get(n),i=(r instanceof jw?r:jw.EMPTY).cn().set(t.H(),e).an();this.Jt=this.Jt.dt(n,i)}return this},Xw.prototype.delete=function(t){H_(!t.Y(),"Cannot delete field for empty path on ObjectValue");var e=t.X();if(1===t.length)this.Jt=this.Jt.remove(e);else{var n=this.Jt.get(e);if(n instanceof jw){var r=n.cn().delete(t.H()).an();this.Jt=this.Jt.dt(t.X(),r)}}return this},Xw.prototype.an=function(){return new jw(this.Jt)},Xw),Vw=(Es(Jw,_w=Zm),Jw.prototype.value=function(e){return this.Jt.map(function(t){return t.value(e)})},Jw.prototype.contains=function(t){for(var e=0,n=this.Jt;e<n.length;e++)if(n[e].isEqual(t))return!0;return!1},Jw.prototype.forEach=function(t){this.Jt.forEach(t)},Jw.prototype.isEqual=function(t){if(t instanceof Jw){if(this.Jt.length!==t.Jt.length)return!1;for(var e=0;e<this.Jt.length;e++)if(!this.Jt[e].isEqual(t.Jt[e]))return!1;return!0}return!1},Jw.prototype.B=function(t){if(t instanceof Jw){for(var e=Math.min(this.Jt.length,t.Jt.length),n=0;n<e;n++){var r=this.Jt[n].B(t.Jt[n]);if(r)return r}return z_(this.Jt.length,t.Jt.length)}return this.bn(t)},Jw.prototype.P=function(){return this.Jt.reduce(function(t,e){return t+e.P()},0)},Jw.prototype.toString=function(){return"["+this.Jt.map(function(t){return t.toString()}).join(",")+"]"},Jw),Bw=(Yw.Rn=function(t,e){return im.W(t.key,e.key)},Yw),Ww=(Es(Qw,bw=Bw),Qw.prototype.field=function(t){if(this.Sn)return this.Sn.field(t);this.An||(this.An=new Map);var e=t.it(),n=this.An.get(e);if(void 0===n){var r=this.Cn(t);n=void 0===r?null:this.converter(r),this.An.set(e,n)}return n},Qw.prototype.data=function(){var n=this;if(!this.Sn){var r=jw.wn();_g(this.proto.fields||{},function(t,e){r.set(new rm([t]),n.converter(e))}),this.Sn=r.an(),this.An=void 0}return this.Sn},Qw.prototype.value=function(){return this.data().value()},Qw.prototype.isEqual=function(t){return t instanceof Qw&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.rn===t.rn&&this.hasCommittedMutations===t.hasCommittedMutations&&this.data().isEqual(t.data())},Qw.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.data().toString()+", {hasLocalMutations: "+this.rn+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(Qw.prototype,"hasPendingWrites",{get:function(){return this.rn||this.hasCommittedMutations},enumerable:!0,configurable:!0}),Qw.prototype.Cn=function(t){H_(void 0!==this.proto,"Can only call getProtoField() when proto is defined");for(var e=this.proto.fields?this.proto.fields[t.X()]:void 0,n=1;n<t.length;++n){if(!e||!e.mapValue||!e.mapValue.fields)return;e=e.mapValue.fields[t.get(n)]}return e},Qw.Pn=function(t,e,n){var r=e.field(t),i=n.field(t);return null!==r&&null!==i?r.B(i):W_("Trying to compare documents on fields that don't exist")},Qw),Hw=(Es(zw,ww=Bw),zw.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(zw.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!0,configurable:!0}),zw.prototype.isEqual=function(t){return t instanceof zw&&t.hasCommittedMutations===this.hasCommittedMutations&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},zw),Kw=(Es(Gw,mw=Bw),Gw.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(Gw.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!0,configurable:!0}),Gw.prototype.isEqual=function(t){return t instanceof Gw&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Gw);function Gw(){return null!==mw&&mw.apply(this,arguments)||this}function zw(t,e,n){var r=ww.call(this,t,e)||this;return r.hasCommittedMutations=!(!n||!n.hasCommittedMutations),r}function Qw(t,e,n,r,i,o){var s=bw.call(this,t,e)||this;return s.Sn=r,s.proto=i,s.converter=o,H_(void 0!==s.Sn||void 0!==s.proto&&void 0!==s.converter,"If objectValue is not defined, proto and converter need to be set."),s.rn=!!n.rn,s.hasCommittedMutations=!!n.hasCommittedMutations,s}function Yw(t,e){this.key=t,this.version=e}function Jw(t){var e=_w.call(this)||this;return e.Jt=t,e.pn=8,e}function Xw(t){this.Jt=t}function $w(t){var e=Ew.call(this)||this;return e.Jt=t,e.pn=9,e}function Zw(t){var e=Iw.call(this)||this;return e.Jt=t,e.pn=7,e}function tb(t,e){var n=Tw.call(this)||this;return n.Dn=t,n.key=e,n.pn=6,n}function eb(t){var e=Sw.call(this)||this;return e.Jt=t,e.pn=5,e}function nb(t,e){var n=Cw.call(this)||this;return n.En=t,n.previousValue=e,n.pn=3,n}function rb(t){var e=Nw.call(this)||this;return e.Jt=t,e.pn=3,e}function ib(t){var e=Aw.call(this)||this;return e.Jt=t,e.pn=4,e}function ob(){return null!==kw&&kw.apply(this,arguments)||this}function sb(){return null!==Rw&&Rw.apply(this,arguments)||this}function ab(t){return null==t}function ub(t){return-0===t&&1/t==-1/0}function cb(t){return"number"==typeof t&&Number.isInteger(t)&&!ub(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var hb,lb,fb,pb,db,vb,yb,gb,mb=(zb.prototype.canonicalId=function(){if(null===this.kn){var t=this.path.it();null!==this.collectionGroup&&(t+="|cg:"+this.collectionGroup),t+="|f:";for(var e=0,n=this.filters;e<n.length;e++)t+=n[e].canonicalId(),t+=",";t+="|ob:";for(var r=0,i=this.orderBy;r<i.length;r++)t+=i[r].canonicalId(),t+=",";ab(this.limit)||(t+="|l:",t+=this.limit),this.startAt&&(t+="|lb:",t+=this.startAt.canonicalId()),this.endAt&&(t+="|ub:",t+=this.endAt.canonicalId()),this.kn=t}return this.kn},zb.prototype.toString=function(){var t=this.path.it();return null!==this.collectionGroup&&(t+=" collectionGroup="+this.collectionGroup),0<this.filters.length&&(t+=", filters: ["+this.filters.join(", ")+"]"),ab(this.limit)||(t+=", limit: "+this.limit),0<this.orderBy.length&&(t+=", orderBy: ["+this.orderBy.join(", ")+"]"),this.startAt&&(t+=", startAt: "+this.startAt.canonicalId()),this.endAt&&(t+=", endAt: "+this.endAt.canonicalId()),"Target("+t+")"},zb.prototype.isEqual=function(t){if(this.limit!==t.limit)return!1;if(this.orderBy.length!==t.orderBy.length)return!1;for(var e=0;e<this.orderBy.length;e++)if(!this.orderBy[e].isEqual(t.orderBy[e]))return!1;if(this.filters.length!==t.filters.length)return!1;for(e=0;e<this.filters.length;e++)if(!this.filters[e].isEqual(t.filters[e]))return!1;return this.collectionGroup===t.collectionGroup&&!!this.path.isEqual(t.path)&&!!(null!==this.startAt?this.startAt.isEqual(t.startAt):null===t.startAt)&&(null!==this.endAt?this.endAt.isEqual(t.endAt):null===t.endAt)},zb.prototype.Nn=function(){return im.ct(this.path)&&null===this.collectionGroup&&0===this.filters.length},zb),wb=(Gb.jn=function(t){return new Gb(t)},Object.defineProperty(Gb.prototype,"orderBy",{get:function(){if(null===this.Vn){var t=this.Ln(),e=this.qn();if(null!==t&&null===e)t.st()?this.Vn=[Rb]:this.Vn=[new kb(t),Rb];else{H_(null===t||null!==e&&t.isEqual(e),"First orderBy should match inequality field.");for(var n=!(this.Vn=[]),r=0,i=this.On;r<i.length;r++){var o=i[r];this.Vn.push(o),o.field.st()&&(n=!0)}if(!n){var s=0<this.On.length?this.On[this.On.length-1].dir:Nb.ASCENDING;this.Vn.push(s===Nb.ASCENDING?Rb:Ob)}}}return this.Vn},enumerable:!0,configurable:!0}),Gb.prototype.Bn=function(t){H_(null==this.Ln()||!(t instanceof _b)||!t.Mn()||t.field.isEqual(this.Ln()),"Query must only have one inequality field."),H_(!this.Nn(),"No filtering allowed for document query");var e=this.filters.concat([t]);return new Gb(this.path,this.collectionGroup,this.On.slice(),e,this.limit,this.Fn,this.startAt,this.endAt)},Gb.prototype.Qn=function(t){H_(!this.startAt&&!this.endAt,"Bounds must be set after orderBy");var e=this.On.concat([t]);return new Gb(this.path,this.collectionGroup,e,this.filters.slice(),this.limit,this.Fn,this.startAt,this.endAt)},Gb.prototype.Gn=function(t){return new Gb(this.path,this.collectionGroup,this.On.slice(),this.filters.slice(),t,"F",this.startAt,this.endAt)},Gb.prototype.Wn=function(t){return new Gb(this.path,this.collectionGroup,this.On.slice(),this.filters.slice(),t,"L",this.startAt,this.endAt)},Gb.prototype.zn=function(t){return new Gb(this.path,this.collectionGroup,this.On.slice(),this.filters.slice(),this.limit,this.Fn,t,this.endAt)},Gb.prototype.Kn=function(t){return new Gb(this.path,this.collectionGroup,this.On.slice(),this.filters.slice(),this.limit,this.Fn,this.startAt,t)},Gb.prototype.Hn=function(t){return new Gb(t,null,this.On.slice(),this.filters.slice(),this.limit,this.Fn,this.startAt,this.endAt)},Gb.prototype.Jn=function(){return 0===this.filters.length&&null===this.limit&&null==this.startAt&&null==this.endAt&&(0===this.On.length||1===this.On.length&&this.On[0].field.st())},Gb.prototype.canonicalId=function(){return this.Yn().canonicalId()+"|lt:"+this.Fn},Gb.prototype.toString=function(){return"Query(target="+this.Yn().toString()+"; limitType="+this.Fn+")"},Gb.prototype.isEqual=function(t){return this.Yn().isEqual(t.Yn())&&this.Fn===t.Fn},Gb.prototype.Xn=function(t,e){for(var n=!1,r=0,i=this.orderBy;r<i.length;r++){var o=i[r],s=o.compare(t,e);if(0!==s)return s;n=n||o.field.st()}return H_(n,"orderBy used that doesn't compare on key field"),0},Gb.prototype.matches=function(t){return this.$n(t)&&this.Zn(t)&&this.ti(t)&&this.ni(t)},Gb.prototype.ii=function(){return!ab(this.limit)&&"F"===this.Fn},Gb.prototype.ei=function(){return!ab(this.limit)&&"L"===this.Fn},Gb.prototype.qn=function(){return 0<this.On.length?this.On[0].field:null},Gb.prototype.Ln=function(){for(var t=0,e=this.filters;t<e.length;t++){var n=e[t];if(n instanceof _b&&n.Mn())return n.field}return null},Gb.prototype.ri=function(t){for(var e=0,n=this.filters;e<n.length;e++){var r=n[e];if(r instanceof _b&&0<=t.indexOf(r.op))return r.op}return null},Gb.prototype.Nn=function(){return this.Yn().Nn()},Gb.prototype.ui=function(){return null!==this.collectionGroup},Gb.prototype.Yn=function(){if(!this.Un)if("F"===this.Fn)this.Un=new mb(this.path,this.collectionGroup,this.orderBy,this.filters,this.limit,this.startAt,this.endAt);else{for(var t=[],e=0,n=this.orderBy;e<n.length;e++){var r=n[e],i=r.dir===Nb.DESCENDING?Nb.ASCENDING:Nb.DESCENDING;t.push(new kb(r.field,i))}var o=this.endAt?new Ab(this.endAt.position,!this.endAt.before):null,s=this.startAt?new Ab(this.startAt.position,!this.startAt.before):null;this.Un=new mb(this.path,this.collectionGroup,t,this.filters,this.limit,o,s)}return this.Un},Gb.prototype.$n=function(t){var e=t.key.path;return null!==this.collectionGroup?t.key.at(this.collectionGroup)&&this.path.Z(e):im.ct(this.path)?this.path.isEqual(e):this.path.tt(e)},Gb.prototype.Zn=function(t){for(var e=0,n=this.On;e<n.length;e++){var r=n[e];if(!r.field.st()&&null===t.field(r.field))return!1}return!0},Gb.prototype.ti=function(t){for(var e=0,n=this.filters;e<n.length;e++)if(!n[e].matches(t))return!1;return!0},Gb.prototype.ni=function(t){return!(this.startAt&&!this.startAt.si(this.orderBy,t)||this.endAt&&this.endAt.si(this.orderBy,t))},Gb.prototype.xn=function(t){H_(t.position.length<=this.orderBy.length,"Bound is longer than orderBy")},Gb),bb=(Kb.et=function(t){switch(t){case"<":return Kb.LESS_THAN;case"<=":return Kb.LESS_THAN_OR_EQUAL;case"==":return Kb.EQUAL;case">=":return Kb.GREATER_THAN_OR_EQUAL;case">":return Kb.GREATER_THAN;case"array-contains":return Kb.ARRAY_CONTAINS;case"in":return Kb.IN;case"array-contains-any":return Kb.ARRAY_CONTAINS_ANY;default:return W_("Unknown FieldFilter operator: "+t)}},Kb.prototype.toString=function(){return this.name},Kb.prototype.isEqual=function(t){return this.name===t.name},Kb.LESS_THAN=new Kb("<"),Kb.LESS_THAN_OR_EQUAL=new Kb("<="),Kb.EQUAL=new Kb("=="),Kb.GREATER_THAN=new Kb(">"),Kb.GREATER_THAN_OR_EQUAL=new Kb(">="),Kb.ARRAY_CONTAINS=new Kb("array-contains"),Kb.IN=new Kb("in"),Kb.ARRAY_CONTAINS_ANY=new Kb("array-contains-any"),Kb),_b=(Es(Hb,gb=function(){}),Hb.create=function(t,e,n){if(t.st())return e===bb.IN?(H_(n instanceof Vw,"Comparing on key with IN, but filter value not an ArrayValue"),H_(n.Jt.every(function(t){return t instanceof Fw}),"Comparing on key with IN, but an array value was not a RefValue"),new Ib(t,n)):(H_(n instanceof Fw,"Comparing on key, but filter value not a RefValue"),H_(e!==bb.ARRAY_CONTAINS&&e!==bb.ARRAY_CONTAINS_ANY,"'"+e.toString()+"' queries don't make sense on document keys."),new Eb(t,e,n));if(n.isEqual(tw.yn)){if(e!==bb.EQUAL)throw new sg(og.INVALID_ARGUMENT,"Invalid query. Null supports only equality comparisons.");return new Hb(t,e,n)}if(n.isEqual(Dw.Tn)){if(e!==bb.EQUAL)throw new sg(og.INVALID_ARGUMENT,"Invalid query. NaN supports only equality comparisons.");return new Hb(t,e,n)}return e===bb.ARRAY_CONTAINS?new Tb(t,n):e===bb.IN?(H_(n instanceof Vw,"IN filter has invalid value: "+n.toString()),new Sb(t,n)):e===bb.ARRAY_CONTAINS_ANY?(H_(n instanceof Vw,"ARRAY_CONTAINS_ANY filter has invalid value: "+n.toString()),new Cb(t,n)):new Hb(t,e,n)},Hb.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&this.value.pn===e.pn&&this.oi(e.B(this.value))},Hb.prototype.oi=function(t){switch(this.op){case bb.LESS_THAN:return t<0;case bb.LESS_THAN_OR_EQUAL:return t<=0;case bb.EQUAL:return 0===t;case bb.GREATER_THAN:return 0<t;case bb.GREATER_THAN_OR_EQUAL:return 0<=t;default:return W_("Unknown FieldFilter operator: "+this.op)}},Hb.prototype.Mn=function(){return 0<=[bb.LESS_THAN,bb.LESS_THAN_OR_EQUAL,bb.GREATER_THAN,bb.GREATER_THAN_OR_EQUAL].indexOf(this.op)},Hb.prototype.canonicalId=function(){return this.field.it()+this.op.toString()+this.value.toString()},Hb.prototype.isEqual=function(t){return t instanceof Hb&&this.op.isEqual(t.op)&&this.field.isEqual(t.field)&&this.value.isEqual(t.value)},Hb.prototype.toString=function(){return this.field.it()+" "+this.op+" "+this.value.value()},Hb),Eb=(Es(Wb,yb=_b),Wb.prototype.matches=function(t){var e=this.value,n=im.W(t.key,e.key);return this.oi(n)},Wb),Ib=(Es(Bb,vb=_b),Bb.prototype.matches=function(e){return this.value.Jt.some(function(t){return e.key.isEqual(t.key)})},Bb),Tb=(Es(Vb,db=_b),Vb.prototype.matches=function(t){var e=t.field(this.field);return e instanceof Vw&&e.contains(this.value)},Vb),Sb=(Es(qb,pb=_b),qb.prototype.matches=function(t){var e=this.value,n=t.field(this.field);return null!==n&&e.contains(n)},qb),Cb=(Es(jb,fb=_b),jb.prototype.matches=function(t){var e=this,n=t.field(this.field);return n instanceof Vw&&n.Jt.some(function(t){return e.value.contains(t)})},jb),Nb=(Ub.prototype.toString=function(){return this.name},Ub.ASCENDING=new Ub("asc"),Ub.DESCENDING=new Ub("desc"),Ub),Ab=(Fb.prototype.canonicalId=function(){for(var t=this.before?"b:":"a:",e=0,n=this.position;e<n.length;e++)t+=n[e].toString();return t},Fb.prototype.si=function(t,e){H_(this.position.length<=t.length,"Bound has more components than query's orderBy");for(var n=0,r=0;r<this.position.length;r++){var i=t[r],o=this.position[r];if(i.field.st())H_(o instanceof Fw,"Bound has a non-key value where the key path is being used."),n=im.W(o.key,e.key);else{var s=e.field(i.field);H_(null!==s,"Field should exist since document matched the orderBy already."),n=o.B(s)}if(i.dir===Nb.DESCENDING&&(n*=-1),0!==n)break}return this.before?n<=0:n<0},Fb.prototype.isEqual=function(t){if(null===t)return!1;if(this.before!==t.before||this.position.length!==t.position.length)return!1;for(var e=0;e<this.position.length;e++){var n=this.position[e],r=t.position[e];if(!n.isEqual(r))return!1}return!0},Fb),kb=(Mb.prototype.compare=function(t,e){var n=this.hi?Ww.Rn(t,e):Ww.Pn(this.field,t,e);switch(this.dir){case Nb.ASCENDING:return n;case Nb.DESCENDING:return-1*n;default:return W_("Unknown direction: "+this.dir)}},Mb.prototype.canonicalId=function(){return this.field.it()+this.dir.toString()},Mb.prototype.toString=function(){return this.field.it()+" ("+this.dir+")"},Mb.prototype.isEqual=function(t){return this.dir===t.dir&&this.field.isEqual(t.field)},Mb),Rb=new kb(rm.ot(),Nb.ASCENDING),Ob=new kb(rm.ot(),Nb.DESCENDING),Db=(Lb.prototype.fi=function(t){return new Lb(this.target,this.targetId,this.ci,t,this.ai,this.lastLimboFreeSnapshotVersion,this.resumeToken)},Lb.prototype.li=function(t,e){return new Lb(this.target,this.targetId,this.ci,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)},Lb.prototype.di=function(t){return new Lb(this.target,this.targetId,this.ci,this.sequenceNumber,this.ai,t,this.resumeToken)},Lb.prototype.isEqual=function(t){return this.targetId===t.targetId&&this.ci===t.ci&&this.sequenceNumber===t.sequenceNumber&&this.ai.isEqual(t.ai)&&this.lastLimboFreeSnapshotVersion.isEqual(t.lastLimboFreeSnapshotVersion)&&this.resumeToken.isEqual(t.resumeToken)&&this.target.isEqual(t.target)},Lb),Pb=(xb.prototype.isEqual=function(t){return t&&t.count===this.count},xb);function xb(t){this.count=t}function Lb(t,e,n,r,i,o,s){void 0===i&&(i=Zg.MIN),void 0===o&&(o=Zg.MIN),void 0===s&&(s=Vg.k),this.target=t,this.targetId=e,this.ci=n,this.sequenceNumber=r,this.ai=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s}function Mb(t,e){this.field=t,void 0===e&&(e=Nb.ASCENDING),this.dir=e,this.hi=t.st()}function Fb(t,e){this.position=t,this.before=e}function Ub(t){this.name=t}function jb(t,e){var n=fb.call(this,t,bb.ARRAY_CONTAINS_ANY,e)||this;return n.value=e,n}function qb(t,e){var n=pb.call(this,t,bb.IN,e)||this;return n.value=e,n}function Vb(t,e){return db.call(this,t,bb.ARRAY_CONTAINS,e)||this}function Bb(t,e){var n=vb.call(this,t,bb.IN,e)||this;return n.value=e,n}function Wb(){return null!==yb&&yb.apply(this,arguments)||this}function Hb(t,e,n){var r=gb.call(this)||this;return r.field=t,r.op=e,r.value=n,r}function Kb(t){this.name=t}function Gb(t,e,n,r,i,o,s,a){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o="F"),void 0===s&&(s=null),void 0===a&&(a=null),this.path=t,this.collectionGroup=e,this.On=n,this.filters=r,this.limit=i,this.Fn=o,this.startAt=s,this.endAt=a,this.Vn=null,this.Un=null,this.startAt&&this.xn(this.startAt),this.endAt&&this.xn(this.endAt)}function zb(t,e,n,r,i,o,s){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o=null),void 0===s&&(s=null),this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=s,this.kn=null}function Qb(t){switch(t){case og.OK:return W_("Treated status OK as error");case og.CANCELLED:case og.UNKNOWN:case og.DEADLINE_EXCEEDED:case og.RESOURCE_EXHAUSTED:case og.INTERNAL:case og.UNAVAILABLE:case og.UNAUTHENTICATED:return!1;case og.INVALID_ARGUMENT:case og.NOT_FOUND:case og.ALREADY_EXISTS:case og.PERMISSION_DENIED:case og.FAILED_PRECONDITION:case og.ABORTED:case og.OUT_OF_RANGE:case og.UNIMPLEMENTED:case og.DATA_LOSS:return!0;default:return W_("Unknown status code: "+t)}}function Yb(t){if(void 0===t)return V_("GRPC error has no .code"),og.UNKNOWN;switch(t){case hb.OK:return og.OK;case hb.CANCELLED:return og.CANCELLED;case hb.UNKNOWN:return og.UNKNOWN;case hb.DEADLINE_EXCEEDED:return og.DEADLINE_EXCEEDED;case hb.RESOURCE_EXHAUSTED:return og.RESOURCE_EXHAUSTED;case hb.INTERNAL:return og.INTERNAL;case hb.UNAVAILABLE:return og.UNAVAILABLE;case hb.UNAUTHENTICATED:return og.UNAUTHENTICATED;case hb.INVALID_ARGUMENT:return og.INVALID_ARGUMENT;case hb.NOT_FOUND:return og.NOT_FOUND;case hb.ALREADY_EXISTS:return og.ALREADY_EXISTS;case hb.PERMISSION_DENIED:return og.PERMISSION_DENIED;case hb.FAILED_PRECONDITION:return og.FAILED_PRECONDITION;case hb.ABORTED:return og.ABORTED;case hb.OUT_OF_RANGE:return og.OUT_OF_RANGE;case hb.UNIMPLEMENTED:return og.UNIMPLEMENTED;case hb.DATA_LOSS:return og.DATA_LOSS;default:return W_("Unknown status code: "+t)}}(lb=hb=hb||{})[lb.OK=0]="OK",lb[lb.CANCELLED=1]="CANCELLED",lb[lb.UNKNOWN=2]="UNKNOWN",lb[lb.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",lb[lb.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",lb[lb.NOT_FOUND=5]="NOT_FOUND",lb[lb.ALREADY_EXISTS=6]="ALREADY_EXISTS",lb[lb.PERMISSION_DENIED=7]="PERMISSION_DENIED",lb[lb.UNAUTHENTICATED=16]="UNAUTHENTICATED",lb[lb.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",lb[lb.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",lb[lb.ABORTED=10]="ABORTED",lb[lb.OUT_OF_RANGE=11]="OUT_OF_RANGE",lb[lb.UNIMPLEMENTED=12]="UNIMPLEMENTED",lb[lb.INTERNAL=13]="INTERNAL",lb[lb.UNAVAILABLE=14]="UNAVAILABLE",lb[lb.DATA_LOSS=15]="DATA_LOSS";var Jb=new om(im.W);function Xb(){return Jb}function $b(){return Xb()}var Zb=new om(im.W);function t_(){return Zb}var e_=new om(im.W);function n_(){return e_}var r_=new _m(im.W);function i_(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=r_,r=0,i=t;r<i.length;r++){var o=i[r];n=n.add(o)}return n}var o_=new _m(z_);function s_(){return o_}function a_(t,e,n,r){this.Fi=t,this.removedTargetIds=e,this.key=n,this.Vi=r}function u_(t,e){this.targetId=t,this.Ui=e}function c_(t,e,n,r){void 0===n&&(n=Vg.k),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}var h_=(I_.mi=function(t){return new I_(t.W)},I_.prototype.has=function(t){return null!=this.vi.get(t)},I_.prototype.get=function(t){return this.vi.get(t)},I_.prototype.first=function(){return this.wi.wt()},I_.prototype.last=function(){return this.wi.gt()},I_.prototype.Y=function(){return this.wi.Y()},I_.prototype.indexOf=function(t){var e=this.vi.get(t);return e?this.wi.indexOf(e):-1},Object.defineProperty(I_.prototype,"size",{get:function(){return this.wi.size},enumerable:!0,configurable:!0}),I_.prototype.forEach=function(n){this.wi.bt(function(t,e){return n(t),!1})},I_.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.vi.dt(t.key,t),e.wi.dt(t,null))},I_.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.vi.remove(t),this.wi.remove(e)):this},I_.prototype.isEqual=function(t){if(!(t instanceof I_))return!1;if(this.size!==t.size)return!1;for(var e=this.wi.yt(),n=t.wi.yt();e.St();){var r=e.Rt().key,i=n.Rt().key;if(!r.isEqual(i))return!1}return!0},I_.prototype.toString=function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"},I_.prototype.copy=function(t,e){var n=new I_;return n.W=this.W,n.vi=t,n.wi=e,n},I_),l_=(E_.prototype.track=function(t){var e=t.doc.key,n=this.gi.get(e);n?0!==t.type&&3===n.type?this.gi=this.gi.dt(e,t):3===t.type&&1!==n.type?this.gi=this.gi.dt(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.gi=this.gi.dt(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.gi=this.gi.dt(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.gi=this.gi.remove(e):1===t.type&&2===n.type?this.gi=this.gi.dt(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.gi=this.gi.dt(e,{type:2,doc:t.doc}):W_("unsupported combination of changes: "+JSON.stringify(t)+" after "+JSON.stringify(n)):this.gi=this.gi.dt(e,t)},E_.prototype.bi=function(){var n=[];return this.gi.bt(function(t,e){n.push(e)}),n},E_),f_=(__.Ti=function(t,e,n,r){var i=[];return e.forEach(function(t){i.push({type:0,doc:t})}),new __(t,e,h_.mi(e),i,n,r,!0,!1)},Object.defineProperty(__.prototype,"hasPendingWrites",{get:function(){return!this.yi.Y()},enumerable:!0,configurable:!0}),__.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this._i===t._i&&this.yi.isEqual(t.yi)&&this.query.isEqual(t.query)&&this.docs.isEqual(t.docs)&&this.pi.isEqual(t.pi)))return!1;var e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(var r=0;r<e.length;r++)if(e[r].type!==n[r].type||!e[r].doc.isEqual(n[r].doc))return!1;return!0},__),p_=(b_.Ai=function(t,e){var n,r=((n={})[t]=d_.Ci(t,e),n);return new b_(Zg.MIN,r,s_(),Xb(),i_())},b_),d_=(w_.Ci=function(t,e){return new w_(Vg.k,e,i_(),i_(),i_())},w_),v_=(Object.defineProperty(m_.prototype,"Pi",{get:function(){return this.qi},enumerable:!0,configurable:!0}),Object.defineProperty(m_.prototype,"resumeToken",{get:function(){return this.Li},enumerable:!0,configurable:!0}),Object.defineProperty(m_.prototype,"Mi",{get:function(){return 0!==this.xi},enumerable:!0,configurable:!0}),Object.defineProperty(m_.prototype,"Qi",{get:function(){return this.Bi},enumerable:!0,configurable:!0}),m_.prototype.Gi=function(t){0<t.P()&&(this.Bi=!0,this.Li=t)},m_.prototype.Wi=function(){var n=i_(),r=i_(),i=i_();return this.ji.forEach(function(t,e){switch(e){case 0:n=n.add(t);break;case 2:r=r.add(t);break;case 1:i=i.add(t);break;default:W_("Encountered invalid change type: "+e)}}),new d_(this.Li,this.qi,n,r,i)},m_.prototype.zi=function(){this.Bi=!1,this.ji=S_()},m_.prototype.Ki=function(t,e){this.Bi=!0,this.ji=this.ji.dt(t,e)},m_.prototype.Hi=function(t){this.Bi=!0,this.ji=this.ji.remove(t)},m_.prototype.Ji=function(){this.xi+=1},m_.prototype.Yi=function(){this.xi-=1},m_.prototype.Xi=function(){this.Bi=!0,this.qi=!0},m_),y_=(g_.prototype.ee=function(t){for(var e=0,n=t.Fi;e<n.length;e++){var r=n[e];t.Vi instanceof Ww?this.re(r,t.Vi):t.Vi instanceof Hw&&this.ue(r,t.key,t.Vi)}for(var i=0,o=t.removedTargetIds;i<o.length;i++)r=o[i],this.ue(r,t.key,t.Vi)},g_.prototype.se=function(n){var r=this;this.oe(n,function(t){var e=r.he(t);switch(n.state){case 0:r.ce(t)&&e.Gi(n.resumeToken);break;case 1:e.Yi(),e.Mi||e.zi(),e.Gi(n.resumeToken);break;case 2:e.Yi(),e.Mi||r.removeTarget(t),H_(!n.cause,"WatchChangeAggregator does not handle errored targets");break;case 3:r.ce(t)&&(e.Xi(),e.Gi(n.resumeToken));break;case 4:r.ce(t)&&(r.ae(t),e.Gi(n.resumeToken));break;default:W_("Unknown target watch change state: "+n.state)}})},g_.prototype.oe=function(t,e){0<t.targetIds.length?t.targetIds.forEach(e):bg(this.Zi,e)},g_.prototype.fe=function(t){var e=t.targetId,n=t.Ui.count,r=this.le(e);if(r){var i=r.target;if(i.Nn())if(0===n){var o=new im(i.path);this.ue(e,o,new Hw(o,Zg.q()))}else H_(1===n,"Single document existence filter with count: "+n);else this.de(e)!==n&&(this.ae(e),this.ie=this.ie.add(e))}},g_.prototype.ve=function(i){var o=this,s={};bg(this.Zi,function(t,e){var n=o.le(t);if(n){if(e.Pi&&n.target.Nn()){var r=new im(n.target.path);null!==o.te.get(r)||o.we(t,r)||o.ue(t,r,new Hw(r,i))}e.Qi&&(s[t]=e.Wi(),e.zi())}});var r=i_();this.ne.forEach(function(t,e){var n=!0;e.Bt(function(t){var e=o.le(t);return!e||2===e.ci||(n=!1)}),n&&(r=r.add(t))});var t=new p_(i,s,this.ie,this.te,r);return this.te=Xb(),this.ne=T_(),this.ie=new _m(z_),t},g_.prototype.re=function(t,e){if(this.ce(t)){var n=this.we(t,e.key)?2:0;this.he(t).Ki(e.key,n),this.te=this.te.dt(e.key,e),this.ne=this.ne.dt(e.key,this.me(e.key).add(t))}},g_.prototype.ue=function(t,e,n){if(this.ce(t)){var r=this.he(t);this.we(t,e)?r.Ki(e,1):r.Hi(e),this.ne=this.ne.dt(e,this.me(e).delete(t)),n&&(this.te=this.te.dt(e,n))}},g_.prototype.removeTarget=function(t){delete this.Zi[t]},g_.prototype.de=function(t){var e=this.he(t).Wi();return this.$i.ge(t).size+e.ki.size-e.Oi.size},g_.prototype.Ji=function(t){this.he(t).Ji()},g_.prototype.he=function(t){return this.Zi[t]||(this.Zi[t]=new v_),this.Zi[t]},g_.prototype.me=function(t){var e=this.ne.get(t);return e||(e=new _m(z_),this.ne=this.ne.dt(t,e)),e},g_.prototype.ce=function(t){var e=null!==this.le(t);return e||q_("WatchChangeAggregator","Detected inactive target",t),e},g_.prototype.le=function(t){var e=this.Zi[t];return e&&e.Mi?null:this.$i.be(t)},g_.prototype.ae=function(e){var n=this;H_(!this.Zi[e].Mi,"Should only reset active targets"),this.Zi[e]=new v_,this.$i.ge(e).forEach(function(t){n.ue(e,t,null)})},g_.prototype.we=function(t,e){return this.$i.ge(t).has(e)},g_);function g_(t){this.$i=t,this.Zi={},this.te=Xb(),this.ne=T_(),this.ie=new _m(z_)}function m_(){this.xi=0,this.ji=S_(),this.Li=Vg.k,this.qi=!1,this.Bi=!0}function w_(t,e,n,r,i){this.resumeToken=t,this.Pi=e,this.ki=n,this.Ni=r,this.Oi=i}function b_(t,e,n,r,i){this.ai=t,this.Ei=e,this.Di=n,this.Ri=r,this.Si=i}function __(t,e,n,r,i,o,s,a){this.query=t,this.docs=e,this.pi=n,this.docChanges=r,this.yi=i,this.fromCache=o,this._i=s,this.Ii=a}function E_(){this.gi=new om(im.W)}function I_(n){this.W=n?function(t,e){return n(t,e)||im.W(t.key,e.key)}:function(t,e){return im.W(t.key,e.key)},this.vi=t_(),this.wi=new om(this.W)}function T_(){return new om(im.W)}function S_(){return new om(im.W)}var C_,N_,A_=((C_={})[Nb.ASCENDING.name]="ASCENDING",C_[Nb.DESCENDING.name]="DESCENDING",C_),k_=((N_={})[bb.LESS_THAN.name]="LESS_THAN",N_[bb.LESS_THAN_OR_EQUAL.name]="LESS_THAN_OR_EQUAL",N_[bb.GREATER_THAN.name]="GREATER_THAN",N_[bb.GREATER_THAN_OR_EQUAL.name]="GREATER_THAN_OR_EQUAL",N_[bb.EQUAL.name]="EQUAL",N_[bb.ARRAY_CONTAINS.name]="ARRAY_CONTAINS",N_[bb.IN.name]="IN",N_[bb.ARRAY_CONTAINS_ANY.name]="ARRAY_CONTAINS_ANY",N_),R_=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function O_(t,e){H_(!ab(t),e+" is missing")}function D_(t){return"number"==typeof t?t:"string"==typeof t?Number(t):W_("can't parse "+t)}var P_=(F_.prototype.pe=function(t){var e=void 0===t.code?og.UNKNOWN:Yb(t.code);return new sg(e,t.message||"")},F_.prototype.ye=function(t){return this.options._e||ab(t)?t:{value:t}},F_.prototype.Ie=function(t){var e;return ab(e="object"==typeof t?t.value:t)?null:e},F_.prototype.G=function(t){return this.options._e?new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+t.nanoseconds).slice(-9)+"Z":{seconds:""+t.seconds,nanos:t.nanoseconds}},F_.prototype.L=function(t){if("string"==typeof t)return this.Te(t);H_(!!t,"Cannot deserialize null or undefined timestamp.");var e=D_(t.seconds||"0"),n=t.nanos||0;return new $g(e,n)},F_.prototype.Te=function(t){var e=0,n=R_.exec(t);if(H_(!!n,"invalid timestamp: "+t),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),e=Number(r)}var i=new Date(t),o=Math.floor(i.getTime()/1e3);return new $g(o,e)},F_.prototype.Ee=function(t){return this.options._e?t.toBase64():t.toUint8Array()},F_.prototype.De=function(t){return this.options._e?(H_(void 0===t||"string"==typeof t,"value must be undefined or a string when using proto3 Json"),Vg.fromBase64String(t||"")):(H_(void 0===t||t instanceof Uint8Array,"value must be undefined or Uint8Array"),Vg.fromUint8Array(t||new Uint8Array))},F_.prototype.Re=function(t){return"string"==typeof t?(H_(this.options._e,"Expected bytes to be passed in as Uint8Array, but got a string instead."),Yg.fromBase64String(t)):(H_(!this.options._e,"Expected bytes to be passed in as Uint8Array, but got a string instead."),Yg.fromUint8Array(t))},F_.prototype.toVersion=function(t){return this.G(t.G())},F_.prototype.fromVersion=function(t){return H_(!!t,"Trying to deserialize version that isn't set"),Zg.L(this.L(t))},F_.prototype.Se=function(t,e){return this.Ae(t).child("documents").child(e).it()},F_.prototype.Ce=function(t){var e=em.et(t);return H_(this.Pe(e),"Tried to deserialize invalid key "+e.toString()),e},F_.prototype.ke=function(t){return this.Se(this.Dn,t.path)},F_.prototype.Ne=function(t){var e=this.Ce(t);return H_(e.get(1)===this.Dn.projectId,"Tried to deserialize key from different project: "+e.get(1)+" vs "+this.Dn.projectId),H_(!e.get(3)&&!this.Dn.database||e.get(3)===this.Dn.database,"Tried to deserialize key from different database: "+e.get(3)+" vs "+this.Dn.database),new im(this.Oe(e))},F_.prototype.Fe=function(t){return this.Se(this.Dn,t)},F_.prototype.Ve=function(t){var e=this.Ce(t);return 4===e.length?em.rt:this.Oe(e)},Object.defineProperty(F_.prototype,"Ue",{get:function(){return new em(["projects",this.Dn.projectId,"databases",this.Dn.database]).it()},enumerable:!0,configurable:!0}),F_.prototype.Ae=function(t){return new em(["projects",t.projectId,"databases",t.database])},F_.prototype.Oe=function(t){return H_(4<t.length&&"documents"===t.get(4),"tried to deserialize invalid key "+t.toString()),t.H(5)},F_.prototype.Pe=function(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)},F_.prototype.xe=function(t){if(t instanceof tw)return{nullValue:"NULL_VALUE"};if(t instanceof ew)return{booleanValue:t.value()};if(t instanceof Ow)return{integerValue:""+t.value()};if(t instanceof Dw){var e=t.value();if(this.options._e){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"};if(ub(e))return{doubleValue:"-0"}}return{doubleValue:t.value()}}return t instanceof Pw?{stringValue:t.value()}:t instanceof jw?{mapValue:this.je(t)}:t instanceof Vw?{arrayValue:this.Le(t)}:t instanceof xw?{timestampValue:this.G(t.Jt)}:t instanceof Uw?{geoPointValue:{latitude:t.value().latitude,longitude:t.value().longitude}}:t instanceof Mw?{bytesValue:this.Ee(t.value())}:t instanceof Fw?{referenceValue:this.Se(t.Dn,t.key.path)}:W_("Unknown FieldValue "+JSON.stringify(t))},F_.prototype.qe=function(t){var e=this;if("nullValue"in t)return tw.yn;if("booleanValue"in t)return ew.of(t.booleanValue);if("integerValue"in t)return new Ow(D_(t.integerValue));if("doubleValue"in t){if(this.options._e){if("NaN"===t.doubleValue)return Dw.Tn;if("Infinity"===t.doubleValue)return Dw.POSITIVE_INFINITY;if("-Infinity"===t.doubleValue)return Dw.NEGATIVE_INFINITY;if("-0"===t.doubleValue)return new Dw(-0)}return new Dw(t.doubleValue)}if("stringValue"in t)return new Pw(t.stringValue);if("mapValue"in t)return this.Be(t.mapValue.fields||{});if("arrayValue"in t){O_(t.arrayValue,"arrayValue");var n=t.arrayValue.values||[];return new Vw(n.map(function(t){return e.qe(t)}))}if("timestampValue"in t)return O_(t.timestampValue,"timestampValue"),new xw(this.L(t.timestampValue));if("geoPointValue"in t){O_(t.geoPointValue,"geoPointValue");var r=t.geoPointValue.latitude||0,i=t.geoPointValue.longitude||0;return new Uw(new Xg(r,i))}if("bytesValue"in t){O_(t.bytesValue,"bytesValue");var o=this.Re(t.bytesValue);return new Mw(o)}if("referenceValue"in t){O_(t.referenceValue,"referenceValue");var s=this.Ce(t.referenceValue),a=new $_(s.get(1),s.get(3)),u=new im(this.Oe(s));return new Fw(a,u)}return W_("Unknown Value proto "+JSON.stringify(t))},F_.prototype.Me=function(t,e){return{name:this.ke(t),fields:this.Qe(e)}},F_.prototype.Ge=function(t){return H_(!t.rn,"Can't serialize documents with mutations."),{name:this.ke(t.key),fields:this.Qe(t.data()),updateTime:this.G(t.version.G())}},F_.prototype.We=function(t,e){var n=this,r=this.Ne(t.name),i=this.fromVersion(t.updateTime);return new Ww(r,i,{hasCommittedMutations:!!e},void 0,t,function(t){return n.qe(t)})},F_.prototype.Qe=function(t){var n=this,r={};return t.forEach(function(t,e){r[t]=n.xe(e)}),r},F_.prototype.Be=function(t){var n=this,e=t,r=jw.wn();return _g(e,function(t,e){r.set(new rm([t]),n.qe(e))}),r.an()},F_.prototype.je=function(t){return{fields:this.Qe(t)}},F_.prototype.Le=function(t){var e=this,n=[];return t.forEach(function(t){n.push(e.xe(t))}),{values:n}},F_.prototype.ze=function(t){var e=this;H_(!!t.found,"Tried to deserialize a found document from a missing document."),O_(t.found.name,"doc.found.name"),O_(t.found.updateTime,"doc.found.updateTime");var n=this.Ne(t.found.name),r=this.fromVersion(t.found.updateTime);return new Ww(n,r,{},void 0,t.found,function(t){return e.qe(t)})},F_.prototype.Ke=function(t){H_(!!t.missing,"Tried to deserialize a missing document from a found document."),H_(!!t.readTime,"Tried to deserialize a missing document without a read time.");var e=this.Ne(t.missing),n=this.fromVersion(t.readTime);return new Hw(e,n)},F_.prototype.He=function(t){return"found"in t?this.ze(t):"missing"in t?this.Ke(t):W_("invalid batch get response: "+JSON.stringify(t))},F_.prototype.Je=function(t){switch(t){case 1:return"ADD";case 3:return"CURRENT";case 0:return"NO_CHANGE";case 2:return"REMOVE";case 4:return"RESET";default:return W_("Unknown WatchTargetChangeState: "+t)}},F_.prototype.Ye=function(t){if(t instanceof u_)return{filter:{count:t.Ui.count,targetId:t.targetId}};if(t instanceof a_){if(t.Vi instanceof Ww){var e=t.Vi;return{documentChange:{document:{name:this.ke(e.key),fields:this.Qe(e.data()),updateTime:this.toVersion(e.version)},targetIds:t.Fi,removedTargetIds:t.removedTargetIds}}}if(t.Vi instanceof Hw)return e=t.Vi,{documentDelete:{document:this.ke(e.key),readTime:this.toVersion(e.version),removedTargetIds:t.removedTargetIds}};if(null===t.Vi)return{documentRemove:{document:this.ke(t.key),removedTargetIds:t.removedTargetIds}}}if(t instanceof c_){var n=void 0;return t.cause&&(n={code:function(t){if(void 0===t)return hb.OK;switch(t){case og.OK:return hb.OK;case og.CANCELLED:return hb.CANCELLED;case og.UNKNOWN:return hb.UNKNOWN;case og.DEADLINE_EXCEEDED:return hb.DEADLINE_EXCEEDED;case og.RESOURCE_EXHAUSTED:return hb.RESOURCE_EXHAUSTED;case og.INTERNAL:return hb.INTERNAL;case og.UNAVAILABLE:return hb.UNAVAILABLE;case og.UNAUTHENTICATED:return hb.UNAUTHENTICATED;case og.INVALID_ARGUMENT:return hb.INVALID_ARGUMENT;case og.NOT_FOUND:return hb.NOT_FOUND;case og.ALREADY_EXISTS:return hb.ALREADY_EXISTS;case og.PERMISSION_DENIED:return hb.PERMISSION_DENIED;case og.FAILED_PRECONDITION:return hb.FAILED_PRECONDITION;case og.ABORTED:return hb.ABORTED;case og.OUT_OF_RANGE:return hb.OUT_OF_RANGE;case og.UNIMPLEMENTED:return hb.UNIMPLEMENTED;case og.DATA_LOSS:return hb.DATA_LOSS;default:return W_("Unknown status code: "+t)}}(t.cause.code),message:t.cause.message}),{targetChange:{targetChangeType:this.Je(t.state),targetIds:t.targetIds,resumeToken:this.Ee(t.resumeToken),cause:n}}}return W_("Unrecognized watch change: "+JSON.stringify(t))},F_.prototype.Xe=function(t){var e,n=this;if("targetChange"in t){O_(t.targetChange,"targetChange");var r=this.$e(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],o=this.De(t.targetChange.resumeToken),s=t.targetChange.cause,a=s&&this.pe(s);e=new c_(r,i,o,a||null)}else if("documentChange"in t){O_(t.documentChange,"documentChange");var u=t.documentChange;O_(u.document,"documentChange.name"),O_(u.document.name,"documentChange.document.name"),O_(u.document.updateTime,"documentChange.document.updateTime");var c=this.Ne(u.document.name),h=this.fromVersion(u.document.updateTime),l=new Ww(c,h,{},void 0,u.document,function(t){return n.qe(t)}),f=u.targetIds||[],p=u.removedTargetIds||[];e=new a_(f,p,l.key,l)}else if("documentDelete"in t){O_(t.documentDelete,"documentDelete");var d=t.documentDelete;O_(d.document,"documentDelete.document"),c=this.Ne(d.document),h=d.readTime?this.fromVersion(d.readTime):Zg.q(),l=new Hw(c,h),p=d.removedTargetIds||[],e=new a_([],p,l.key,l)}else if("documentRemove"in t){O_(t.documentRemove,"documentRemove");var v=t.documentRemove;O_(v.document,"documentRemove"),c=this.Ne(v.document),p=v.removedTargetIds||[],e=new a_([],p,c,null)}else{if(!("filter"in t))return W_("Unknown change type "+JSON.stringify(t));O_(t.filter,"filter");var y=t.filter;O_(y.targetId,"filter.targetId");var g=y.count||0,m=new Pb(g),w=y.targetId;e=new u_(w,m)}return e},F_.prototype.$e=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:W_("Got unexpected TargetChange.state: "+t)},F_.prototype.Ze=function(t){if(!("targetChange"in t))return Zg.MIN;var e=t.targetChange;return e.targetIds&&e.targetIds.length?Zg.MIN:e.readTime?this.fromVersion(e.readTime):Zg.MIN},F_.prototype.tr=function(t){var e,n=this;if(t instanceof zm)e={update:this.Me(t.key,t.value)};else if(t instanceof Jm)e={delete:this.ke(t.key)};else if(t instanceof Qm)e={update:this.Me(t.key,t.data),updateMask:this.nr(t.sn)};else if(t instanceof Ym)e={transform:{document:this.ke(t.key),fieldTransforms:t.fieldTransforms.map(function(t){return n.ir(t)})}};else{if(!(t instanceof Xm))return W_("Unknown mutation type "+t.type);e={verify:this.ke(t.key)}}return t.en.Zt||(e.currentDocument=this.er(t.en)),e},F_.prototype.rr=function(t){var e=this,n=t.currentDocument?this.ur(t.currentDocument):Km.NONE;if(t.update){O_(t.update.name,"name");var r=this.Ne(t.update.name),i=this.Be(t.update.fields||{});if(t.updateMask){var o=this.sr(t.updateMask);return new Qm(r,i,o,n)}return new zm(r,i,n)}if(t.delete)return r=this.Ne(t.delete),new Jm(r,n);if(t.transform){r=this.Ne(t.transform.document);var s=t.transform.fieldTransforms.map(function(t){return e.or(t)});return H_(!0===n.exists,'Transforms only support precondition "exists == true"'),new Ym(r,s)}return t.verify?(r=this.Ne(t.verify),new Xm(r,n)):W_("unknown mutation proto: "+JSON.stringify(t))},F_.prototype.er=function(t){return H_(!t.Zt,"Can't serialize an empty precondition"),void 0!==t.updateTime?{updateTime:this.toVersion(t.updateTime)}:void 0!==t.exists?{exists:t.exists}:W_("Unknown precondition")},F_.prototype.ur=function(t){return void 0!==t.updateTime?Km.updateTime(this.fromVersion(t.updateTime)):void 0!==t.exists?Km.exists(t.exists):Km.NONE},F_.prototype.hr=function(t,e){var n=this,r=t.updateTime?this.fromVersion(t.updateTime):this.fromVersion(e);r.isEqual(Zg.MIN)&&(r=this.fromVersion(e));var i=null;return t.transformResults&&0<t.transformResults.length&&(i=t.transformResults.map(function(t){return n.qe(t)})),new xm(r,i)},F_.prototype.cr=function(t,e){var n=this;return t&&0<t.length?(H_(void 0!==e,"Received a write result without a commit time"),t.map(function(t){return n.hr(t,e)})):[]},F_.prototype.ir=function(t){var e=this,n=t.transform;if(n instanceof Im)return{fieldPath:t.field.it(),setToServerValue:"REQUEST_TIME"};if(n instanceof Tm)return{fieldPath:t.field.it(),appendMissingElements:{values:n.elements.map(function(t){return e.xe(t)})}};if(n instanceof Sm)return{fieldPath:t.field.it(),removeAllFromArray:{values:n.elements.map(function(t){return e.xe(t)})}};if(n instanceof Cm)return{fieldPath:t.field.it(),increment:this.xe(n.Ht)};throw W_("Unknown transform: "+t.transform)},F_.prototype.or=function(t){var e=this,n=null;if("setToServerValue"in t)H_("REQUEST_TIME"===t.setToServerValue,"Unknown server value transform proto: "+JSON.stringify(t)),n=Im.instance;else if("appendMissingElements"in t){var r=t.appendMissingElements.values||[];n=new Tm(r.map(function(t){return e.qe(t)}))}else if("removeAllFromArray"in t)r=t.removeAllFromArray.values||[],n=new Sm(r.map(function(t){return e.qe(t)}));else if("increment"in t){var i=this.qe(t.increment);H_(i instanceof nw,"NUMERIC_ADD transform requires a NumberValue"),n=new Cm(i)}else W_("Unknown transform proto: "+JSON.stringify(t));var o=rm.ht(t.fieldPath);return new Hm(o,n)},F_.prototype.ar=function(t){return{documents:[this.Fe(t.path)]}},F_.prototype.lr=function(t){var e=t.documents.length;H_(1===e,"DocumentsTarget contained other than 1 document: "+e);var n=t.documents[0];return wb.jn(this.Ve(n)).Yn()},F_.prototype.dr=function(t){var e={structuredQuery:{}},n=t.path;null!==t.collectionGroup?(H_(n.length%2==0,"Collection Group queries should be within a document path or root."),e.parent=this.Fe(n),e.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(H_(n.length%2!=0,"Document queries with filters are not supported."),e.parent=this.Fe(n.J()),e.structuredQuery.from=[{collectionId:n.$()}]);var r=this.vr(t.filters);r&&(e.structuredQuery.where=r);var i=this.wr(t.orderBy);i&&(e.structuredQuery.orderBy=i);var o=this.ye(t.limit);return null!==o&&(e.structuredQuery.limit=o),t.startAt&&(e.structuredQuery.startAt=this.mr(t.startAt)),t.endAt&&(e.structuredQuery.endAt=this.mr(t.endAt)),e},F_.prototype.gr=function(t){var e=this.Ve(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;if(0<r){H_(1===r,"StructuredQuery.from with more than one collection is not supported.");var o=n.from[0];o.allDescendants?i=o.collectionId:e=e.child(o.collectionId)}var s=[];n.where&&(s=this.br(n.where));var a=[];n.orderBy&&(a=this.pr(n.orderBy));var u=null;n.limit&&(u=this.Ie(n.limit));var c=null;n.startAt&&(c=this.yr(n.startAt));var h=null;return n.endAt&&(h=this.yr(n.endAt)),new wb(e,i,a,s,u,"F",c,h).Yn()},F_.prototype._r=function(t){var e=this.Ir(t.ci);return null==e?null:{"goog-listen-tags":e}},F_.prototype.Ir=function(t){switch(t){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return W_("Unrecognized query purpose: "+t)}},F_.prototype.Yn=function(t){var e,n=t.target;return(e=n.Nn()?{documents:this.ar(n)}:{query:this.dr(n)}).targetId=t.targetId,0<t.resumeToken.P()&&(e.resumeToken=this.Ee(t.resumeToken)),e},F_.prototype.vr=function(t){var e=this;if(0!==t.length){var n=t.map(function(t){return t instanceof _b?e.Tr(t):W_("Unrecognized filter: "+JSON.stringify(t))});return 1===n.length?n[0]:{compositeFilter:{op:"AND",filters:n}}}},F_.prototype.br=function(t){var e=this;return t?void 0!==t.unaryFilter?[this.Er(t)]:void 0!==t.fieldFilter?[this.Dr(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map(function(t){return e.br(t)}).reduce(function(t,e){return t.concat(e)}):W_("Unknown filter: "+JSON.stringify(t)):[]},F_.prototype.wr=function(t){var e=this;if(0!==t.length)return t.map(function(t){return e.Rr(t)})},F_.prototype.pr=function(t){var e=this;return t.map(function(t){return e.Sr(t)})},F_.prototype.mr=function(t){var e=this;return{before:t.before,values:t.position.map(function(t){return e.xe(t)})}},F_.prototype.yr=function(t){var e=this,n=!!t.before,r=t.values.map(function(t){return e.qe(t)});return new Ab(r,n)},F_.prototype.Ar=function(t){return A_[t.name]},F_.prototype.Cr=function(t){switch(t){case"ASCENDING":return Nb.ASCENDING;case"DESCENDING":return Nb.DESCENDING;default:return}},F_.prototype.Pr=function(t){return k_[t.name]},F_.prototype.kr=function(t){switch(t){case"EQUAL":return bb.EQUAL;case"GREATER_THAN":return bb.GREATER_THAN;case"GREATER_THAN_OR_EQUAL":return bb.GREATER_THAN_OR_EQUAL;case"LESS_THAN":return bb.LESS_THAN;case"LESS_THAN_OR_EQUAL":return bb.LESS_THAN_OR_EQUAL;case"ARRAY_CONTAINS":return bb.ARRAY_CONTAINS;case"IN":return bb.IN;case"ARRAY_CONTAINS_ANY":return bb.ARRAY_CONTAINS_ANY;case"OPERATOR_UNSPECIFIED":return W_("Unspecified operator");default:return W_("Unknown operator")}},F_.prototype.Nr=function(t){return{fieldPath:t.it()}},F_.prototype.Or=function(t){return rm.ht(t.fieldPath)},F_.prototype.Rr=function(t){return{field:this.Nr(t.field),direction:this.Ar(t.dir)}},F_.prototype.Sr=function(t){return new kb(this.Or(t.field),this.Cr(t.direction))},F_.prototype.Dr=function(t){return _b.create(this.Or(t.fieldFilter.field),this.kr(t.fieldFilter.op),this.qe(t.fieldFilter.value))},F_.prototype.Tr=function(t){if(t.op===bb.EQUAL){if(t.value.isEqual(Dw.Tn))return{unaryFilter:{field:this.Nr(t.field),op:"IS_NAN"}};if(t.value.isEqual(tw.yn))return{unaryFilter:{field:this.Nr(t.field),op:"IS_NULL"}}}return{fieldFilter:{field:this.Nr(t.field),op:this.Pr(t.op),value:this.xe(t.value)}}},F_.prototype.Er=function(t){switch(t.unaryFilter.op){case"IS_NAN":var e=this.Or(t.unaryFilter.field);return _b.create(e,bb.EQUAL,Dw.Tn);case"IS_NULL":var n=this.Or(t.unaryFilter.field);return _b.create(n,bb.EQUAL,tw.yn);case"OPERATOR_UNSPECIFIED":return W_("Unspecified filter");default:return W_("Unknown filter")}},F_.prototype.nr=function(t){var e=[];return t.fields.forEach(function(t){return e.push(t.it())}),{fieldPaths:e}},F_.prototype.sr=function(t){var e=(t.fieldPaths||[]).map(function(t){return rm.ht(t)});return Wm.Xt(e)},F_),x_=(M_.Fr=function(t){M_.platform&&W_("Platform already defined"),M_.platform=t},M_.C=function(){return M_.platform||W_("Platform not set"),M_.platform},M_),L_=new Oa("@firebase/firestore");function M_(){}function F_(t,e){this.Dn=t,this.options=e}function U_(){return L_.logLevel===Ia.DEBUG?0:L_.logLevel===Ia.SILENT?2:1}function j_(t){switch(t){case 0:L_.logLevel=Ia.DEBUG;break;case 1:L_.logLevel=Ia.ERROR;break;case 2:L_.logLevel=Ia.SILENT;break;default:L_.error("Firestore ("+rg+"): Invalid value passed to `setLogLevel`")}}function q_(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(L_.logLevel<=Ia.DEBUG){var i=n.map(B_);L_.debug.apply(L_,ks(["Firestore ("+rg+") ["+t+"]: "+e],i))}}function V_(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(L_.logLevel<=Ia.ERROR){var r=e.map(B_);L_.error.apply(L_,ks(["Firestore ("+rg+"): "+t],r))}}function B_(t){if("string"==typeof t)return t;var e=x_.C();try{return e.Vr(t)}catch(e){return t}}function W_(t){var e="FIRESTORE ("+rg+") INTERNAL ASSERTION FAILED: "+t;throw V_(e),new Error(e)}function H_(t,e){t||W_(e)}var K_=(G_.Ur=function(){for(var e="";e.length<20;)x_.C().randomBytes(40).forEach(function(t){e.length<20&&t<=247&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(t%62))});return H_(20===e.length,"Invalid auto ID: "+e),e},G_);function G_(){}function z_(t,e){return t<e?-1:e<t?1:0}function Q_(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].isEqual(e[n]))return!1;return!0}function Y_(t){return t+"\0"}function J_(t,e,n,r,i){this.Dn=t,this.persistenceKey=e,this.host=n,this.ssl=r,this.forceLongPolling=i}function X_(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}var $_=(Object.defineProperty(vE.prototype,"xr",{get:function(){return"(default)"===this.database},enumerable:!0,configurable:!0}),vE.prototype.isEqual=function(t){return t instanceof vE&&t.projectId===this.projectId&&t.database===this.database},vE.prototype.B=function(t){return z_(this.projectId,t.projectId)||z_(this.database,t.database)},vE),Z_=(dE.prototype.zt=function(t,e,n){e&&H_(e.key.isEqual(t),"applyToRemoteDocument: key "+t+" should match maybeDoc key\n "+e.key);var r=n.jr;H_(r.length===this.mutations.length,"Mismatch between mutations length\n ("+this.mutations.length+") and mutation results length\n ("+r.length+").");for(var i=0;i<this.mutations.length;i++){var o=this.mutations[i];if(o.key.isEqual(t)){var s=r[i];e=o.zt(e,s)}}return e},dE.prototype.Wt=function(t,e){e&&H_(e.key.isEqual(t),"applyToLocalDocument: key "+t+" should match maybeDoc key\n "+e.key);for(var n=0,r=this.baseMutations;n<r.length;n++)(a=r[n]).key.isEqual(t)&&(e=a.Wt(e,e,this.En));for(var i=e,o=0,s=this.mutations;o<s.length;o++){var a;(a=s[o]).key.isEqual(t)&&(e=a.Wt(e,i,this.En))}return e},dE.prototype.Lr=function(n){var r=this,i=n;return this.mutations.forEach(function(t){var e=r.Wt(t.key,n.get(t.key));e&&(i=i.dt(t.key,e))}),i},dE.prototype.keys=function(){return this.mutations.reduce(function(t,e){return t.add(e.key)},i_())},dE.prototype.isEqual=function(t){return this.batchId===t.batchId&&Q_(this.mutations,t.mutations)&&Q_(this.baseMutations,t.baseMutations)},dE),tE=(pE.from=function(t,e,n,r){H_(t.mutations.length===n.length,"Mutations sent "+t.mutations.length+" must equal results received "+n.length);for(var i=n_(),o=t.mutations,s=0;s<o.length;s++)i=i.dt(o[s].key,n[s].version);return new pE(t,e,n,r,i)},pE),eE=(fE.prototype.get=function(t){var e=this.Mr(t),n=this.Qr[e];if(void 0!==n)for(var r=0,i=n;r<i.length;r++){var o=i[r],s=o[0],a=o[1];if(s.isEqual(t))return a}},fE.prototype.has=function(t){return void 0!==this.get(t)},fE.prototype.set=function(t,e){var n=this.Mr(t),r=this.Qr[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(r[i][0].isEqual(t))return void(r[i]=[t,e]);r.push([t,e])}else this.Qr[n]=[[t,e]]},fE.prototype.delete=function(t){var e=this.Mr(t),n=this.Qr[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(n[r][0].isEqual(t))return 1===n.length?delete this.Qr[e]:n.splice(r,1),!0;return!1},fE.prototype.forEach=function(a){_g(this.Qr,function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],s=i[1];a(o,s)}})},fE.prototype.Y=function(){return Eg(this.Qr)},fE),nE=(lE.zr=function(t,e){for(var n=i_(),r=i_(),i=0,o=e.docChanges;i<o.length;i++){var s=o[i];switch(s.type){case 0:n=n.add(s.doc.key);break;case 1:r=r.add(s.doc.key)}}return new lE(t,e.fromCache,n,r)},lE),rE=(hE.prototype.Hr=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},hE.prototype.next=function(){var t=++this.previousValue;return this.Jr&&this.Jr(t),t},hE.Xr=-1,hE),iE=(cE.eu=function(t,e,n,r,i){var o=new cE(t,e,Date.now()+n,r,i);return o.start(n),o},cE.prototype.start=function(t){var e=this;this.ru=setTimeout(function(){return e.uu()},t)},cE.prototype.su=function(){return this.uu()},cE.prototype.cancel=function(t){null!==this.ru&&(this.clearTimeout(),this.iu.reject(new sg(og.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},cE.prototype.uu=function(){var e=this;this.$r.ou(function(){return null!==e.ru?(e.clearTimeout(),e.op().then(function(t){return e.iu.resolve(t)})):Promise.resolve()})},cE.prototype.clearTimeout=function(){null!==this.ru&&(this.nu(this),clearTimeout(this.ru),this.ru=null)},cE),oE=(Object.defineProperty(uE.prototype,"vu",{get:function(){return this.cu},enumerable:!0,configurable:!0}),uE.prototype.ou=function(t){this.enqueue(t)},uE.prototype.wu=function(t){this.mu(),this.gu(t)},uE.prototype.bu=function(t){return this.mu(),this.gu(t)},uE.prototype.pu=function(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.mu(),this.cu?[3,2]:(this.cu=!0,[4,this.bu(e)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},uE.prototype.enqueue=function(t){return this.mu(),this.cu?new Promise(function(t){}):this.gu(t)},uE.prototype.gu=function(t){var n=this,e=this.hu.then(function(){return n.lu=!0,t().catch(function(t){n.fu=t,n.lu=!1;var e=t.stack||t.message||"";throw V_("INTERNAL UNHANDLED ERROR: ",e),e.indexOf("Firestore Test Simulated Error")<0&&setTimeout(function(){throw t},0),t}).then(function(t){return n.lu=!1,t})});return this.hu=e},uE.prototype.yu=function(t,e,n){var r=this;this.mu(),H_(0<=e,"Attempted to schedule an operation with a negative delay of "+e),-1<this.du.indexOf(t)&&(e=0);var i=iE.eu(this,t,e,n,function(t){return r._u(t)});return this.au.push(i),i},uE.prototype.mu=function(){this.fu&&W_("AsyncQueue is already failed: "+(this.fu.stack||this.fu.message))},uE.prototype.Iu=function(){H_(this.lu,"verifyOpInProgress() called when no op in progress on this queue.")},uE.prototype.Tu=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,e=this.hu];case 1:t.sent(),t.label=2;case 2:if(e!==this.hu)return[3,0];t.label=3;case 3:return[2]}})})},uE.prototype.Eu=function(t){for(var e=0,n=this.au;e<n.length;e++)if(n[e].Zr===t)return!0;return!1},uE.prototype.Du=function(r){var i=this;return this.Tu().then(function(){H_("all"===r||i.Eu(r),"Attempted to drain to missing operation "+r),i.au.sort(function(t,e){return t.tu-e.tu});for(var t=0,e=i.au;t<e.length;t++){var n=e[t];if(n.su(),"all"!==r&&n.Zr===r)break}return i.Tu()})},uE.prototype.Ru=function(t){this.du.push(t)},uE.prototype._u=function(t){var e=this.au.indexOf(t);H_(0<=e,"Delayed operation not found."),this.au.splice(e,1)},uE),sE=(aE.prototype.catch=function(t){return this.next(void 0,t)},aE.prototype.next=function(r,i){var o=this;return this.Pu&&W_("Called next() or catch() twice for PersistencePromise"),this.Pu=!0,this.Cu?this.error?this.ku(i,this.error):this.Nu(r,this.result):new aE(function(e,n){o.Su=function(t){o.Nu(r,t).next(e,n)},o.Au=function(t){o.ku(i,t).next(e,n)}})},aE.prototype.Ou=function(){var n=this;return new Promise(function(t,e){n.next(t,e)})},aE.prototype.Fu=function(t){try{var e=t();return e instanceof aE?e:aE.resolve(e)}catch(t){return aE.reject(t)}},aE.prototype.Nu=function(t,e){return t?this.Fu(function(){return t(e)}):aE.resolve(e)},aE.prototype.ku=function(t,e){return t?this.Fu(function(){return t(e)}):aE.reject(e)},aE.resolve=function(n){return new aE(function(t,e){t(n)})},aE.reject=function(n){return new aE(function(t,e){e(n)})},aE.Vu=function(t){return new aE(function(e,n){var r=0,i=0,o=!1;t.forEach(function(t){++r,t.next(function(){++i,o&&i===r&&e()},function(t){return n(t)})}),o=!0,i===r&&e()})},aE.Uu=function(t){for(var n=aE.resolve(!1),e=function(e){n=n.next(function(t){return t?aE.resolve(t):e()})},r=0,i=t;r<i.length;r++)e(i[r]);return n},aE.forEach=function(t,n){var r=this,i=[];return t.forEach(function(t,e){i.push(n.call(r,t,e))}),this.Vu(i)},aE);function aE(t){var e=this;this.Su=null,this.Au=null,this.result=void 0,this.error=void 0,this.Cu=!1,this.Pu=!1,t(function(t){e.Cu=!0,e.result=t,e.Su&&e.Su(t)},function(t){e.Cu=!0,e.error=t,e.Au&&e.Au(t)})}function uE(){this.hu=Promise.resolve(),this.cu=!1,this.au=[],this.fu=null,this.lu=!1,this.du=[]}function cE(t,e,n,r,i){this.$r=t,this.Zr=e,this.tu=n,this.op=r,this.nu=i,this.iu=new X_,this.then=this.iu.promise.then.bind(this.iu.promise),this.catch=this.iu.promise.catch.bind(this.iu.promise),this.iu.promise.catch(function(t){})}function hE(t,e){var n=this;this.previousValue=t,e&&(e.Kr=function(t){return n.Hr(t)},this.Jr=function(t){return e.Yr(t)})}function lE(t,e,n,r){this.targetId=t,this.fromCache=e,this.Gr=n,this.Wr=r}function fE(t){this.Mr=t,this.Qr={}}function pE(t,e,n,r,i){this.batch=t,this.qr=e,this.jr=n,this.streamToken=r,this.Br=i}function dE(t,e,n,r){this.batchId=t,this.En=e,this.baseMutations=n,H_(0<(this.mutations=r).length,"Cannot create an empty mutation batch")}function vE(t,e){this.projectId=t,this.database=e||"(default)"}function yE(t,e){var n=t[0],r=t[1],i=e[0],o=e[1],s=z_(n,i);return 0===s?z_(r,o):s}var gE=(PE.prototype.Lu=function(){return++this.ju},PE.prototype.qu=function(t){var e=[t,this.Lu()];if(this.buffer.size<this.xu)this.buffer=this.buffer.add(e);else{var n=this.buffer.last();yE(e,n)<0&&(this.buffer=this.buffer.delete(n).add(e))}},Object.defineProperty(PE.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!0,configurable:!0}),PE),mE={Bu:!1,Mu:0,Qu:0,Gu:0},wE=(DE.Hu=function(t){return new DE(t,DE.Ju,DE.Yu)},DE.Xu=-1,DE.$u=1048576,DE.ts=new DE(DE.Zu=41943040,DE.Ju=10,DE.Yu=1e3),DE.DISABLED=new DE(DE.Xu,0,0),DE),bE=(OE.prototype.start=function(t){H_(null===this.rs,"Cannot start an already started LruScheduler"),this.ns.params.Wu!==wE.Xu&&this.us(t)},OE.prototype.stop=function(){this.rs&&(this.rs.cancel(),this.rs=null)},Object.defineProperty(OE.prototype,"ss",{get:function(){return null!==this.rs},enumerable:!0,configurable:!0}),OE.prototype.us=function(t){var e=this;H_(null===this.rs,"Cannot schedule GC while a task is pending");var n=this.es?3e5:6e4;q_("LruGarbageCollector","Garbage collection scheduled in "+n+"ms"),this.rs=this.$r.yu("lru_garbage_collection",n,function(){return e.rs=null,e.es=!0,t.os(e.ns).then(function(){return e.us(t)}).catch(xE)})},OE),_E=(RE.prototype.cs=function(t,e){return this.hs.as(t).next(function(t){return Math.floor(e/100*t)})},RE.prototype.fs=function(t,e){var n=this;if(0===e)return sE.resolve(rE.Xr);var r=new gE(e);return this.hs.oe(t,function(t){return r.qu(t.sequenceNumber)}).next(function(){return n.hs.ls(t,function(t){return r.qu(t)})}).next(function(){return r.maxValue})},RE.prototype.ds=function(t,e,n){return this.hs.ds(t,e,n)},RE.prototype.vs=function(t,e){return this.hs.vs(t,e)},RE.prototype.ws=function(e,n){var r=this;return this.params.Wu===wE.Xu?(q_("LruGarbageCollector","Garbage collection skipped; disabled"),sE.resolve(mE)):this.ms(e).next(function(t){return t<r.params.Wu?(q_("LruGarbageCollector","Garbage collection skipped; Cache size "+t+" is lower than threshold "+r.params.Wu),mE):r.gs(e,n)})},RE.prototype.ms=function(t){return this.hs.ms(t)},RE.prototype.gs=function(e,n){var r,i,o,s,a,u,c,h=this,l=Date.now();return this.cs(e,this.params.zu).next(function(t){return i=t>h.params.Ku?(q_("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.params.Ku+" from "+t),h.params.Ku):t,s=Date.now(),h.fs(e,i)}).next(function(t){return r=t,a=Date.now(),h.ds(e,r,n)}).next(function(t){return o=t,u=Date.now(),h.vs(e,r)}).next(function(t){return c=Date.now(),U_()<=0&&q_("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(s-l)+"ms\n\tDetermined least recently used "+i+" in "+(a-s)+"ms\n\tRemoved "+o+" targets in "+(u-a)+"ms\n\tRemoved "+t+" documents in "+(c-u)+"ms\nTotal Duration: "+(c-l)+"ms"),sE.resolve({Bu:!0,Mu:i,Qu:o,Gu:t})})},RE),EE=(kE.prototype.Y=function(){return this.bs.Y()},kE.prototype._s=function(t,e){var n=new IE(t,e);this.bs=this.bs.add(n),this.ps=this.ps.add(n)},kE.prototype.Is=function(t,e){var n=this;t.forEach(function(t){return n._s(t,e)})},kE.prototype.Ts=function(t,e){this.Es(new IE(t,e))},kE.prototype.Ds=function(t,e){var n=this;t.forEach(function(t){return n.Ts(t,e)})},kE.prototype.Rs=function(t){var e=this,n=im.EMPTY,r=new IE(n,t),i=new IE(n,t+1),o=[];return this.ps.qt([r,i],function(t){e.Es(t),o.push(t.key)}),o},kE.prototype.Ss=function(){var e=this;this.bs.forEach(function(t){return e.Es(t)})},kE.prototype.Es=function(t){this.bs=this.bs.delete(t),this.ps=this.ps.delete(t)},kE.prototype.As=function(t){var e=im.EMPTY,n=new IE(e,t),r=new IE(e,t+1),i=i_();return this.ps.qt([n,r],function(t){i=i.add(t.key)}),i},kE.prototype.Cs=function(t){var e=new IE(t,0),n=this.bs.Mt(e);return null!==n&&t.isEqual(n.key)},kE),IE=(AE.Rn=function(t,e){return im.W(t.key,e.key)||z_(t.Ps,e.Ps)},AE.ys=function(t,e){return z_(t.Ps,e.Ps)||im.W(t.key,e.key)},AE),TE=(Object.defineProperty(NE.prototype,"readTime",{get:function(){return H_(void 0!==this.Os,"Read time is not set. All removeEntry() calls must include a readTime if `trackRemovals` is used."),this.Os},set:function(t){H_(void 0===this.Os||this.Os.isEqual(t),"All changes in a RemoteDocumentChangeBuffer must have the same read time"),this.Os=t},enumerable:!0,configurable:!0}),NE.prototype.Fs=function(t,e){this.Vs(),this.readTime=e,this.ks.set(t.key,t)},NE.prototype.Us=function(t,e){this.Vs(),e&&(this.readTime=e),this.ks.set(t,null)},NE.prototype.xs=function(t,e){this.Vs();var n=this.ks.get(e);return void 0!==n?sE.resolve(n):this.js(t,e)},NE.prototype.getEntries=function(t,e){return this.Ls(t,e)},NE.prototype.apply=function(t){return this.Vs(),this.Ns=!0,this.qs(t)},NE.prototype.Vs=function(){H_(!this.Ns,"Changes have already been applied.")},NE),SE=(CE.prototype.start=function(){return this.eo()},CE.prototype.ro=function(i){return Ts(this,void 0,void 0,function(){var e,y,n,r=this;return Ss(this,function(t){switch(t.label){case 0:return e=this.Hs,y=this.to,[4,this.persistence.runTransaction("Handle user change","readonly",function(d){var v;return r.Hs.uo(d).next(function(t){return v=t,e=r.persistence.Js(i),y=new ZE(r.Ys,e,r.persistence.no()),e.uo(d)}).next(function(t){for(var e=[],n=[],r=i_(),i=0,o=v;i<o.length;i++){var s=o[i];e.push(s.batchId);for(var a=0,u=s.mutations;a<u.length;a++){var c=u[a];r=r.add(c.key)}}for(var h=0,l=t;h<l.length;h++){s=l[h],n.push(s.batchId);for(var f=0,p=s.mutations;f<p.length;f++)c=p[f],r=r.add(c.key)}return y.so(d,r).next(function(t){return{oo:t,ho:e,co:n}})})})];case 1:return n=t.sent(),this.Hs=e,this.to=y,this.Bs.io(this.to),[2,n]}})})},CE.prototype.ao=function(a){var u,c=this,h=$g.now(),t=a.reduce(function(t,e){return t.add(e.key)},i_());return this.persistence.runTransaction("Locally write mutations","readwrite",function(s){return c.to.so(s,t).next(function(t){u=t;for(var e=[],n=0,r=a;n<r.length;n++){var i=r[n],o=i.un(u.get(i.key));null!=o&&e.push(new Qm(i.key,o,o.sn(),Km.exists(!0)))}return c.Hs.fo(s,h,e,a)})}).then(function(t){var e=t.Lr(u);return{batchId:t.batchId,ks:e}})},CE.prototype.lo=function(t){var n=this;return this.persistence.runTransaction("Lookup mutation documents","readonly",function(e){return n.Hs.do(e,t).next(function(t){return t?n.to.so(e,t):sE.resolve(null)})})},CE.prototype.vo=function(r){var i=this;return this.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(t){var e=r.batch.keys(),n=i.Ys.wo({mo:!0});return i.Hs.vo(t,r.batch,r.streamToken).next(function(){return i.bo(t,r,n)}).next(function(){return n.apply(t)}).next(function(){return i.Hs.po(t)}).next(function(){return i.to.so(t,e)})})},CE.prototype.yo=function(t){var r=this;return this.persistence.runTransaction("Reject batch","readwrite-primary",function(e){var n;return r.Hs._o(e,t).next(function(t){return H_(null!==t,"Attempt to reject nonexistent batch!"),n=t.keys(),r.Hs.Io(e,t)}).next(function(){return r.Hs.po(e)}).next(function(){return r.to.so(e,n)})})},CE.prototype.To=function(){var e=this;return this.persistence.runTransaction("Get highest unacknowledged batch id","readonly",function(t){return e.Hs.To(t)})},CE.prototype.Eo=function(){var e=this;return this.persistence.runTransaction("Get last stream token","readonly",function(t){return e.Hs.Eo(t)})},CE.prototype.Do=function(e){var n=this;return this.persistence.runTransaction("Set last stream token","readwrite-primary",function(t){return n.Hs.Do(t,e)})},CE.prototype.Ro=function(){var e=this;return this.persistence.runTransaction("Get last remote snapshot version","readonly",function(t){return e.$s.Ro(t)})},CE.prototype.So=function(u){var c=this,h=u.ai,l=this.Qs;return this.persistence.runTransaction("Apply remote event","readwrite-primary",function(o){var i=c.Ys.wo({mo:!0});l=c.Qs;var s=[];bg(u.Ei,function(t,e){var n=l.get(t);if(n){s.push(c.$s.Ao(o,e.Oi,t).next(function(){return c.$s.Co(o,e.ki,t)}));var r=e.resumeToken;if(0<r.P()){var i=n.li(r,h).fi(o.Po);l=l.dt(t,i),CE.ko(n,i,e)&&s.push(c.$s.No(o,i))}}});var a=Xb(),n=i_();if(u.Ri.forEach(function(t,e){n=n.add(t)}),s.push(i.getEntries(o,n).next(function(r){u.Ri.forEach(function(t,e){var n=r.get(t);e instanceof Hw&&e.version.isEqual(Zg.MIN)?(i.Us(t,h),a=a.dt(t,e)):null==n||0<e.version.B(n.version)||0===e.version.B(n.version)&&n.hasPendingWrites?(H_(!Zg.MIN.isEqual(h),"Cannot add a document when the remote version is zero"),i.Fs(e,h),a=a.dt(t,e)):q_("LocalStore","Ignoring outdated watch update for ",t,". Current version:",n.version," Watch version:",e.version),u.Si.has(t)&&s.push(c.persistence.Ks.Oo(o,t))})})),!h.isEqual(Zg.MIN)){var t=c.$s.Ro(o).next(function(t){return H_(0<=h.B(t),"Watch stream reverted to previous snapshot?? "+h+" < "+t),c.$s.Fo(o,o.Po,h)});s.push(t)}return sE.Vu(s).next(function(){return i.apply(o)}).next(function(){return c.to.Vo(o,a)})}).then(function(t){return c.Qs=l,t})},CE.ko=function(t,e,n){return H_(0<e.resumeToken.P(),"Attempted to persist target data with no resume token"),0===t.resumeToken.P()||e.ai.M()-t.ai.M()>=this.Uo||0<n.ki.size+n.Ni.size+n.Oi.size},CE.prototype.xo=function(t){for(var n=this,e=0,r=t;e<r.length;e++){var i=r[e],o=i.targetId;if(this.Ms.Is(i.Gr,o),this.Ms.Ds(i.Wr,o),!i.fromCache){var s=this.Qs.get(o);H_(null!==s,"Can't set limbo-free snapshot version for unknown target: "+o);var a=s.ai,u=s.di(a);this.Qs=this.Qs.dt(o,u)}}return this.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(e){return sE.forEach(t,function(t){return sE.forEach(t.Wr,function(t){return n.persistence.Ks.Ts(e,t)})})})},CE.prototype.jo=function(e){var n=this;return this.persistence.runTransaction("Get next mutation batch","readonly",function(t){return void 0===e&&(e=-1),n.Hs.Lo(t,e)})},CE.prototype.qo=function(e){var n=this;return this.persistence.runTransaction("read document","readonly",function(t){return n.to.Bo(t,e)})},CE.prototype.Mo=function(r){var i=this;return this.persistence.runTransaction("Allocate target","readwrite",function(e){var n;return i.$s.Qo(e,r).next(function(t){return t?(n=t,sE.resolve(n)):i.$s.Go(e).next(function(t){return n=new Db(r,t,0,e.Po),i.$s.Wo(e,n).next(function(){return n})})})}).then(function(t){return null===i.Qs.get(t.targetId)&&(i.Qs=i.Qs.dt(t.targetId,t),i.Gs.set(r,t.targetId)),t})},CE.prototype.Qo=function(t,e){var n=this.Gs.get(e);return void 0!==n?sE.resolve(this.Qs.get(n)):this.$s.Qo(t,e)},CE.prototype.zo=function(n,r){var i=this,o=this.Qs.get(n);H_(null!==o,"Tried to release nonexistent target: "+n);var t=r?"readwrite":"readwrite-primary";return this.persistence.runTransaction("Release target",t,function(e){var t=i.Ms.Rs(n);return r?sE.resolve():sE.forEach(t,function(t){return i.persistence.Ks.Ts(e,t)}).next(function(){i.persistence.Ks.removeTarget(e,o)})}).then(function(){i.Qs=i.Qs.remove(n),i.Gs.delete(o.target)})},CE.prototype.Ko=function(t,n){var r=this,i=Zg.MIN,o=i_();return this.persistence.runTransaction("Execute query","readonly",function(e){return r.Qo(e,t.Yn()).next(function(t){if(t)return i=t.lastLimboFreeSnapshotVersion,r.$s.Ho(e,t.targetId).next(function(t){o=t})}).next(function(){return r.Bs.Jo(e,t,n?i:Zg.MIN,n?o:i_())}).next(function(t){return{documents:t,Yo:o}})})},CE.prototype.Xo=function(e){var n=this;return this.persistence.runTransaction("Remote document keys","readonly",function(t){return n.$s.Ho(t,e)})},CE.prototype.$o=function(){return this.persistence.$o()},CE.prototype.Zo=function(t){this.Hs.th(t)},CE.prototype.nh=function(t){this.persistence.nh(t)},CE.prototype.bo=function(t,i,o){var e=this,s=i.batch,n=s.keys(),a=sE.resolve();return n.forEach(function(r){a=a.next(function(){return o.xs(t,r)}).next(function(t){var e=t,n=i.Br.get(r);H_(null!==n,"ackVersions should contain every doc in the write."),(!e||e.version.B(n)<0)&&((e=s.zt(r,e,i))?o.Fs(e,i.qr):H_(!t,"Mutation batch "+s+" applied to document "+t+" resulted in null"))})}),a.next(function(){return e.Hs.Io(t,s)})},CE.prototype.os=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(t){return e.ws(t,n.Qs)})},CE.prototype.ih=function(e){var n=this,t=this.Qs.get(e);return t?Promise.resolve(t.target):this.persistence.runTransaction("Get target data","readonly",function(t){return n.$s.be(t,e).next(function(t){return t?t.target:null})})},CE.prototype.eh=function(){var r=this;return this.persistence.runTransaction("Get new document changes","readonly",function(t){return r.Ys.eh(t,r.Ws)}).then(function(t){var e=t.rh,n=t.readTime;return r.Ws=n,e})},CE.prototype.eo=function(){return Ts(this,void 0,void 0,function(){var e,n=this;return Ss(this,function(t){switch(t.label){case 0:return[4,(e=this).persistence.runTransaction("Synchronize last document change read time","readonly",function(t){return n.Ys.uh(t)})];case 1:return e.Ws=t.sent(),[2]}})})},CE.Uo=3e8,CE);function CE(t,e,n){this.persistence=t,this.Bs=e,this.Ms=new EE,this.Qs=new om(z_),this.Gs=new eE(function(t){return t.canonicalId()}),this.Ws=Zg.MIN,H_(t.ss,"LocalStore was passed an unstarted persistence implementation"),this.persistence.Ks.zs(this.Ms),this.Hs=t.Js(n),this.Ys=t.Xs(),this.$s=t.Zs(),this.to=new ZE(this.Ys,this.Hs,this.persistence.no()),this.Bs.io(this.to)}function NE(){this.ks=new eE(function(t){return t.toString()}),this.Ns=!1}function AE(t,e){this.key=t,this.Ps=e}function kE(){this.bs=new _m(IE.Rn),this.ps=new _m(IE.ys)}function RE(t,e){this.hs=t,this.params=e}function OE(t,e){this.ns=t,this.$r=e,this.es=!1,this.rs=null}function DE(t,e,n){this.Wu=t,this.zu=e,this.Ku=n}function PE(t){this.xu=t,this.buffer=new _m(yE),this.ju=0}function xE(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){if(e.code!==og.FAILED_PRECONDITION||e.message!==XE)throw e;return q_("LocalStore","Unexpectedly lost primary lease"),[2]})})}function LE(t,e){return H_(-1===e.indexOf("_"),"Client key cannot contain '_', but was '"+e+"'"),"firestore_clients_"+t+"_"+e}function ME(t,e,n){var r="firestore_mutations_"+t+"_"+n;return e.t()&&(r+="_"+e.uid),r}function FE(t,e){return"firestore_targets_"+t+"_"+e}var UE=(YE.sh=function(t,e,n){var r=JSON.parse(n),i="object"==typeof r&&-1!==["pending","acknowledged","rejected"].indexOf(r.state)&&(void 0===r.error||"object"==typeof r.error),o=void 0;return i&&r.error&&(i="string"==typeof r.error.message&&"string"==typeof r.error.code)&&(o=new sg(r.error.code,r.error.message)),i?new YE(t,e,r.state,o):(V_("SharedClientState","Failed to parse mutation state for ID '"+e+"': "+n),null)},YE.prototype.oh=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},YE),jE=(QE.sh=function(t,e){var n=JSON.parse(e),r="object"==typeof n&&-1!==["not-current","current","rejected"].indexOf(n.state)&&(void 0===n.error||"object"==typeof n.error),i=void 0;return r&&n.error&&(r="string"==typeof n.error.message&&"string"==typeof n.error.code)&&(i=new sg(n.error.code,n.error.message)),r?new QE(t,n.state,i):(V_("SharedClientState","Failed to parse target state for ID '"+t+"': "+e),null)},QE.prototype.oh=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},QE),qE=(zE.sh=function(t,e){for(var n=JSON.parse(e),r="object"==typeof n&&n.activeTargetIds instanceof Array,i=s_(),o=0;r&&o<n.activeTargetIds.length;++o)r=cb(n.activeTargetIds[o]),i=i.add(n.activeTargetIds[o]);return r?new zE(t,i):(V_("SharedClientState","Failed to parse client data for instance '"+t+"': "+e),null)},zE),VE=(GE.sh=function(t){var e=JSON.parse(t);return"object"==typeof e&&-1!==["Unknown","Online","Offline"].indexOf(e.onlineState)&&"string"==typeof e.clientId?new GE(e.clientId,e.onlineState):(V_("SharedClientState","Failed to parse online state: "+t),null)},GE),BE=(KE.prototype.hh=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},KE.prototype.ah=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},KE.prototype.oh=function(){var t={activeTargetIds:this.activeTargetIds.nt(),updateTimeMs:Date.now()};return JSON.stringify(t)},KE),WE=(HE.ph=function(t){return!(!t.window||null==t.window.localStorage)},HE.prototype.start=function(){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l,f=this;return Ss(this,function(t){switch(t.label){case 0:return H_(!this.ss,"WebStorageSharedClientState already started"),H_(null!==this.dh,"syncEngine property must be set before calling start()"),H_(null!==this.vh,"onlineStateHandler property must be set before calling start()"),[4,this.dh.$o()];case 1:for(e=t.sent(),n=0,r=e;n<r.length;n++)(i=r[n])!==this.lh&&(o=this.getItem(LE(this.persistenceKey,i)))&&(s=qE.sh(i,o))&&(this.wh[s.clientId]=s);for(this.Rh(),(a=this.storage.getItem(this.Dh))&&(u=this.Sh(a))&&this.Ah(u),c=0,h=this.bh;c<h.length;c++)l=h[c],this.gh(l);return this.bh=[],this.platform.window.addEventListener("unload",function(){return f.shutdown()}),this.ss=!0,[2]}})})},HE.prototype.Yr=function(t){this.setItem(this._h,JSON.stringify(t))},HE.prototype.Ch=function(){var n=s_();return _g(this.wh,function(t,e){n=n.Qt(e.activeTargetIds)}),n},HE.prototype.Ph=function(t){for(var e in this.wh)if(this.wh.hasOwnProperty(e)&&this.wh[e].activeTargetIds.has(t))return!0;return!1},HE.prototype.kh=function(t){this.Nh(t,"pending")},HE.prototype.Oh=function(t,e,n){this.Nh(t,e,n),this.Fh(t)},HE.prototype.Vh=function(t){var e="not-current";if(this.Ph(t)){var n=this.storage.getItem(FE(this.persistenceKey,t));if(n){var r=jE.sh(t,n);r&&(e=r.state)}}return this.Uh.hh(t),this.Rh(),e},HE.prototype.xh=function(t){this.Uh.ah(t),this.Rh()},HE.prototype.jh=function(t){return this.Uh.activeTargetIds.has(t)},HE.prototype.Lh=function(t){this.removeItem(FE(this.persistenceKey,t))},HE.prototype.qh=function(t,e,n){this.Bh(t,e,n)},HE.prototype.ro=function(t,e,n){var r=this;e.forEach(function(t){r.Fh(t)}),this.currentUser=t,n.forEach(function(t){r.kh(t)})},HE.prototype.Mh=function(t){this.Qh(t)},HE.prototype.shutdown=function(){this.ss&&(this.platform.window.removeEventListener("storage",this.mh),this.removeItem(this.yh),this.ss=!1)},HE.prototype.getItem=function(t){var e=this.storage.getItem(t);return q_("SharedClientState","READ",t,e),e},HE.prototype.setItem=function(t,e){q_("SharedClientState","SET",t,e),this.storage.setItem(t,e)},HE.prototype.removeItem=function(t){q_("SharedClientState","REMOVE",t),this.storage.removeItem(t)},HE.prototype.gh=function(a){var t=this;if(a.storageArea===this.storage){if(q_("SharedClientState","EVENT",a.key,a.newValue),a.key===this.yh)return void V_("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.fh.ou(function(){return Ts(t,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){if(!this.ss)return this.bh.push(a),[2];if(null===a.key)return[2];if(this.Ih.test(a.key)){if(null==a.newValue)return n=this.Gh(a.key),[2,this.Wh(n,null)];if(e=this.zh(a.key,a.newValue))return[2,this.Wh(e.clientId,e)]}else if(this.Th.test(a.key)){if(null!==a.newValue&&(r=this.Kh(a.key,a.newValue)))return[2,this.Hh(r)]}else if(this.Eh.test(a.key)){if(null!==a.newValue&&(i=this.Jh(a.key,a.newValue)))return[2,this.Yh(i)]}else if(a.key===this.Dh){if(null!==a.newValue&&(o=this.Sh(a.newValue)))return[2,this.Ah(o)]}else a.key===this._h&&(H_(!!this.Kr,"Missing sequenceNumberHandler"),(s=function(t){var e=rE.Xr;if(null!=t)try{var n=JSON.parse(t);H_("number"==typeof n,"Found non-numeric sequence number"),e=n}catch(t){V_("SharedClientState","Failed to read sequence number from WebStorage",t)}return e}(a.newValue))!==rE.Xr&&this.Kr(s));return[2]})})})}},Object.defineProperty(HE.prototype,"Uh",{get:function(){return this.wh[this.lh]},enumerable:!0,configurable:!0}),HE.prototype.Rh=function(){this.setItem(this.yh,this.Uh.oh())},HE.prototype.Nh=function(t,e,n){var r=new UE(this.currentUser,t,e,n),i=ME(this.persistenceKey,this.currentUser,t);this.setItem(i,r.oh())},HE.prototype.Fh=function(t){var e=ME(this.persistenceKey,this.currentUser,t);this.removeItem(e)},HE.prototype.Qh=function(t){var e={clientId:this.lh,onlineState:t};this.storage.setItem(this.Dh,JSON.stringify(e))},HE.prototype.Bh=function(t,e,n){var r=FE(this.persistenceKey,t),i=new jE(t,e,n);this.setItem(r,i.oh())},HE.prototype.Gh=function(t){var e=this.Ih.exec(t);return e?e[1]:null},HE.prototype.zh=function(t,e){var n=this.Gh(t);return H_(null!==n,"Cannot parse client state key '"+t+"'"),qE.sh(n,e)},HE.prototype.Kh=function(t,e){var n=this.Th.exec(t);H_(null!==n,"Cannot parse mutation batch key '"+t+"'");var r=Number(n[1]),i=void 0!==n[2]?n[2]:null;return UE.sh(new ig(i),r,e)},HE.prototype.Jh=function(t,e){var n=this.Eh.exec(t);H_(null!==n,"Cannot parse query target key '"+t+"'");var r=Number(n[1]);return jE.sh(r,e)},HE.prototype.Sh=function(t){return VE.sh(t)},HE.prototype.Hh=function(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return e.user.uid!==this.currentUser.uid?(q_("SharedClientState","Ignoring mutation for non-active user "+e.user.uid),[2]):[2,this.dh.Xh(e.batchId,e.state,e.error)]})})},HE.prototype.Yh=function(t){return this.dh.$h(t.targetId,t.state,t.error)},HE.prototype.Wh=function(t,e){var n=this,r=this.Ch();e?this.wh[t]=e:delete this.wh[t];var i=this.Ch(),o=[],s=[];return i.forEach(function(e){return Ts(n,void 0,void 0,function(){return Ss(this,function(t){return r.has(e)||o.push(e),[2]})})}),r.forEach(function(e){return Ts(n,void 0,void 0,function(){return Ss(this,function(t){return i.has(e)||s.push(e),[2]})})}),this.dh.Zh(o,s)},HE.prototype.Ah=function(t){this.wh[t.clientId]&&this.vh(t.onlineState)},HE);function HE(t,e,n,r,i){if(this.fh=t,this.platform=e,this.persistenceKey=n,this.lh=r,this.dh=null,this.vh=null,this.Kr=null,this.wh={},this.mh=this.gh.bind(this),this.ss=!1,this.bh=[],!HE.ph(this.platform))throw new sg(og.UNIMPLEMENTED,"LocalStorage is not available on this platform.");var o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.platform.window.localStorage,this.currentUser=i,this.yh=LE(this.persistenceKey,this.lh),this._h="firestore_sequence_number_"+this.persistenceKey,this.wh[this.lh]=new BE,this.Ih=new RegExp("^firestore_clients_"+o+"_([^_]*)$"),this.Th=new RegExp("^firestore_mutations_"+o+"_(\\d+)(?:_(.*))?$"),this.Eh=new RegExp("^firestore_targets_"+o+"_(\\d+)$"),this.Dh="firestore_online_state_"+this.persistenceKey,this.platform.window.addEventListener("storage",this.mh)}function KE(){this.activeTargetIds=s_()}function GE(t,e){this.clientId=t,this.onlineState=e}function zE(t,e){this.clientId=t,this.activeTargetIds=e}function QE(t,e,n){this.targetId=t,this.state=e,H_(void 0!==(this.error=n)==("rejected"===e),"QueryTargetMetadata must contain an error iff state is 'rejected'")}function YE(t,e,n,r){this.user=t,this.batchId=e,this.state=n,H_(void 0!==(this.error=r)==("rejected"===n),"MutationMetadata must contain an error iff state is 'rejected'")}var JE=(iI.prototype.kh=function(t){},iI.prototype.Oh=function(t,e,n){},iI.prototype.Vh=function(t){return this.tc.hh(t),this.nc[t]||"not-current"},iI.prototype.qh=function(t,e,n){this.nc[t]=e},iI.prototype.xh=function(t){this.tc.ah(t)},iI.prototype.jh=function(t){return this.tc.activeTargetIds.has(t)},iI.prototype.Lh=function(t){delete this.nc[t]},iI.prototype.Ch=function(){return this.tc.activeTargetIds},iI.prototype.Ph=function(t){return this.tc.activeTargetIds.has(t)},iI.prototype.start=function(){return this.tc=new BE,Promise.resolve()},iI.prototype.ro=function(t,e,n){},iI.prototype.Mh=function(t){},iI.prototype.shutdown=function(){},iI.prototype.Yr=function(t){},iI),XE="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",$E=(rI.prototype.ec=function(t){this.ic.push(t)},rI.prototype.rc=function(){this.ic.forEach(function(t){return t()})},rI),ZE=(nI.prototype.Bo=function(e,n){var r=this;return this.Hs.oc(e,n).next(function(t){return r.hc(e,n,t)})},nI.prototype.hc=function(t,r,i){return this.uc.xs(t,r).next(function(t){for(var e=0,n=i;e<n.length;e++)t=n[e].Wt(r,t);return t})},nI.prototype.cc=function(t,e,i){var o=$b();return e.forEach(function(t,e){for(var n=0,r=i;n<r.length;n++)e=r[n].Wt(t,e);o=o.dt(t,e)}),o},nI.prototype.so=function(e,t){var n=this;return this.uc.getEntries(e,t).next(function(t){return n.Vo(e,t)})},nI.prototype.Vo=function(r,i){var o=this;return this.Hs.ac(r,i).next(function(t){var e=o.cc(r,i,t),n=Xb();return e.forEach(function(t,e){e=e||new Hw(t,Zg.q()),n=n.dt(t,e)}),n})},nI.prototype.Jo=function(t,e,n){return e.Nn()?this.fc(t,e.path):e.ui()?this.lc(t,e,n):this.dc(t,e,n)},nI.prototype.fc=function(t,e){return this.Bo(t,new im(e)).next(function(t){var e=t_();return t instanceof Ww&&(e=e.dt(t.key,t)),e})},nI.prototype.lc=function(n,r,i){var o=this;H_(r.path.Y(),"Currently we only support collection group queries at the root.");var s=r.collectionGroup,a=t_();return this.sc.vc(n,s).next(function(t){return sE.forEach(t,function(t){var e=r.Hn(t.child(s));return o.dc(n,e,i).next(function(t){t.forEach(function(t,e){a=a.dt(t,e)})})}).next(function(){return a})})},nI.prototype.dc=function(e,n,t){var h,l,r=this;return this.uc.Jo(e,n,t).next(function(t){return h=t,r.Hs.wc(e,n)}).next(function(t){return l=t,r.mc(e,l,h).next(function(t){h=t;for(var e=0,n=l;e<n.length;e++)for(var r=n[e],i=0,o=r.mutations;i<o.length;i++){var s=o[i],a=s.key,u=h.get(a),c=s.Wt(u,u,r.En);h=c instanceof Ww?h.dt(a,c):h.remove(a)}})}).next(function(){return h.forEach(function(t,e){n.matches(e)||(h=h.remove(t))}),h})},nI.prototype.mc=function(t,e,n){for(var r=i_(),i=0,o=e;i<o.length;i++)for(var s=0,a=o[i].mutations;s<a.length;s++){var u=a[s];u instanceof Qm&&null===n.get(u.key)&&(r=r.add(u.key))}var c=n;return this.uc.getEntries(t,r).next(function(t){return t.forEach(function(t,e){null!==e&&e instanceof Ww&&(c=c.dt(t,e))}),c})},nI),tI=(eI.prototype.io=function(t){this.gc=t},eI.prototype.Jo=function(e,r,i,o){var s=this;return H_(void 0!==this.gc,"setLocalDocumentsView() not called"),r.Jn()||i.isEqual(Zg.MIN)?this.bc(e,r):this.gc.so(e,o).next(function(t){var n=s.pc(r,t);return(r.ii()||r.ei())&&s.yc(r.Fn,n,o,i)?s.bc(e,r):(U_()<=0&&q_("IndexFreeQueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),r.toString()),s.gc.Jo(e,r,i).next(function(e){return n.forEach(function(t){e=e.dt(t.key,t)}),e}))})},eI.prototype.pc=function(n,t){var r=new _m(function(t,e){return n.Xn(t,e)});return t.forEach(function(t,e){e instanceof Ww&&n.matches(e)&&(r=r.add(e))}),r},eI.prototype.yc=function(t,e,n,r){if(n.size!==e.size)return!0;var i="F"===t?e.last():e.first();return!!i&&(i.hasPendingWrites||0<i.version.B(r))},eI.prototype.bc=function(t,e){return U_()<=0&&q_("IndexFreeQueryEngine","Using full collection scan to execute query: %s",e.toString()),this.gc.Jo(t,e,Zg.MIN)},eI);function eI(){}function nI(t,e,n){this.uc=t,this.Hs=e,this.sc=n}function rI(){this.ic=[]}function iI(){this.tc=new BE,this.nc={},this.dh=null,this.vh=null,this.Kr=null}function oI(t){for(var e="",n=0;n<t.length;n++)0<e.length&&(e=aI(e)),e=sI(t.get(n),e);return aI(e)}function sI(t,e){for(var n=e,r=t.length,i=0;i<r;i++){var o=t.charAt(i);switch(o){case"\0":n+="";break;case"":n+="";break;default:n+=o}}return n}function aI(t){return t+""}function uI(t){var e=t.length;if(H_(2<=e,"Invalid path "+t),2===e)return H_(""===t.charAt(0)&&""===t.charAt(1),"Non-empty path "+t+" had length 2"),em.rt;for(var n=e-2,r=[],i="",o=0;o<e;){var s=t.indexOf("",o);switch((s<0||n<s)&&W_('Invalid encoded resource path: "'+t+'"'),t.charAt(s+1)){case"":var a=t.substring(o,s),u=void 0;0===i.length?u=a:(u=i+=a,i=""),r.push(u);break;case"":i+=t.substring(o,s),i+="\0";break;case"":i+=t.substring(o,s+1);break;default:W_('Invalid encoded resource path: "'+t+'"')}o=s+2}return new em(r)}var cI=(dI.prototype.Ic=function(t,e){return this._c.add(e),sE.resolve()},dI.prototype.vc=function(t,e){return sE.resolve(this._c.getEntries(e))},dI),hI=(pI.prototype.add=function(t){H_(t.length%2==1,"Expected a collection path.");var e=t.$(),n=t.J(),r=this.index[e]||new _m(em.W),i=!r.has(n);return this.index[e]=r.add(n),i},pI.prototype.has=function(t){var e=t.$(),n=t.J(),r=this.index[e];return r&&r.has(n)},pI.prototype.getEntries=function(t){return(this.index[t]||new _m(em.W)).nt()},pI),lI=(fI.prototype.Dc=function(t){return sE.resolve(0===this.Hs.length)},fI.prototype.vo=function(t,e,n){var r=e.batchId,i=this.Rc(r,"acknowledged");H_(0===i,"Can only acknowledge the first batch in the mutation queue");var o=this.Hs[i];return H_(r===o.batchId,"Queue ordering failure: expected batch "+r+", got batch "+o.batchId),this.lastStreamToken=n,sE.resolve()},fI.prototype.Eo=function(t){return sE.resolve(this.lastStreamToken)},fI.prototype.Do=function(t,e){return this.lastStreamToken=e,sE.resolve()},fI.prototype.fo=function(t,e,n,r){H_(0!==r.length,"Mutation batches should not be empty");var i=this.Tc;this.Tc++,0<this.Hs.length&&H_(this.Hs[this.Hs.length-1].batchId<i,"Mutation batchIDs must be monotonically increasing order");var o=new Z_(i,e,n,r);this.Hs.push(o);for(var s=0,a=r;s<a.length;s++){var u=a[s];this.Ec=this.Ec.add(new IE(u.key,i)),this.sc.Ic(t,u.key.path.J())}return sE.resolve(o)},fI.prototype._o=function(t,e){return sE.resolve(this.Sc(e))},fI.prototype.do=function(t,e){var n=this.Sc(e);return H_(null!=n,"Failed to find local mutation batch."),sE.resolve(n.keys())},fI.prototype.Lo=function(t,e){var n=e+1,r=this.Ac(n),i=r<0?0:r;return sE.resolve(this.Hs.length>i?this.Hs[i]:null)},fI.prototype.To=function(){return sE.resolve(0===this.Hs.length?-1:this.Tc-1)},fI.prototype.uo=function(t){return sE.resolve(this.Hs.slice())},fI.prototype.oc=function(t,n){var r=this,e=new IE(n,0),i=new IE(n,Number.POSITIVE_INFINITY),o=[];return this.Ec.qt([e,i],function(t){H_(n.isEqual(t.key),"Should only iterate over a single key's batches");var e=r.Sc(t.Ps);H_(null!==e,"Batches in the index must exist in the main table"),o.push(e)}),sE.resolve(o)},fI.prototype.ac=function(t,e){var r=this,i=new _m(z_);return e.forEach(function(e){var t=new IE(e,0),n=new IE(e,Number.POSITIVE_INFINITY);r.Ec.qt([t,n],function(t){H_(e.isEqual(t.key),"For each key, should only iterate over a single key's batches"),i=i.add(t.Ps)})}),sE.resolve(this.Cc(i))},fI.prototype.wc=function(t,e){H_(!e.ui(),"CollectionGroup queries should be handled in LocalDocumentsView");var n=e.path,r=n.length+1,i=n;im.ct(i)||(i=i.child(""));var o=new IE(new im(i),0),s=new _m(z_);return this.Ec.Bt(function(t){var e=t.key.path;return!!n.Z(e)&&(e.length===r&&(s=s.add(t.Ps)),!0)},o),sE.resolve(this.Cc(s))},fI.prototype.Cc=function(t){var n=this,r=[];return t.forEach(function(t){var e=n.Sc(t);null!==e&&r.push(e)}),r},fI.prototype.Io=function(n,r){var i=this;H_(0===this.Rc(r.batchId,"removed"),"Can only remove the first entry of the mutation queue"),this.Hs.shift();var o=this.Ec;return sE.forEach(r.mutations,function(t){var e=new IE(t.key,r.batchId);return o=o.delete(e),i.Ks.Pc(n,t.key)}).next(function(){i.Ec=o})},fI.prototype.th=function(t){},fI.prototype.Cs=function(t,e){var n=new IE(e,0),r=this.Ec.Mt(n);return sE.resolve(e.isEqual(r&&r.key))},fI.prototype.po=function(t){return 0===this.Hs.length&&H_(this.Ec.Y(),"Document leak -- detected dangling mutation references when queue is empty."),sE.resolve()},fI.prototype.Rc=function(t,e){var n=this.Ac(t);return H_(0<=n&&n<this.Hs.length,"Batches must exist to be "+e),n},fI.prototype.Ac=function(t){return 0===this.Hs.length?0:t-this.Hs[0].batchId},fI.prototype.Sc=function(t){var e=this.Ac(t);if(e<0||e>=this.Hs.length)return null;var n=this.Hs[e];return H_(n.batchId===t,"If found batch must match"),n},fI);function fI(t,e){this.sc=t,this.Ks=e,this.Hs=[],this.Tc=1,this.lastStreamToken=Vg.k,this.Ec=new _m(IE.Rn)}function pI(){this.index={}}function dI(){this._c=new hI}var vI,yI,gI,mI,wI=(GI.prototype.Fs=function(t,e,n){H_(!n.isEqual(Zg.MIN),"Cannot add a document with a read time of zero");var r=e.key,i=this.docs.get(r),o=i?i.size:0,s=this.kc(e);return this.docs=this.docs.dt(r,{Nc:e,size:s,readTime:n}),this.size+=s-o,this.sc.Ic(t,r.path.J())},GI.prototype.Us=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},GI.prototype.xs=function(t,e){var n=this.docs.get(e);return sE.resolve(n?n.Nc:null)},GI.prototype.getEntries=function(t,e){var n=this,r=$b();return e.forEach(function(t){var e=n.docs.get(t);r=r.dt(t,e?e.Nc:null)}),sE.resolve(r)},GI.prototype.Jo=function(t,e,n){H_(!e.ui(),"CollectionGroup queries should be handled in LocalDocumentsView");for(var r=t_(),i=new im(e.path.child("")),o=this.docs._t(i);o.St();){var s=o.Rt(),a=s.key,u=s.value,c=u.Nc,h=u.readTime;if(!e.path.Z(a.path))break;h.B(n)<=0||c instanceof Ww&&e.matches(c)&&(r=r.dt(c.key,c))}return sE.resolve(r)},GI.prototype.Oc=function(t,e){return sE.forEach(this.docs,function(t){return e(t)})},GI.prototype.eh=function(t,e){throw new Error("getNewDocumentChanges() is not supported with MemoryPersistence")},GI.prototype.uh=function(t){return sE.resolve(Zg.MIN)},GI.prototype.wo=function(t){return new GI.Fc(this)},GI.prototype.Vc=function(t){return sE.resolve(this.size)},GI.Fc=(Es(zI,mI=TE),zI.prototype.qs=function(n){var r=this,i=[];return this.ks.forEach(function(t,e){e?i.push(r.Uc.Fs(n,e,r.readTime)):r.Uc.Us(t)}),sE.Vu(i)},zI.prototype.js=function(t,e){return this.Uc.xs(t,e)},zI.prototype.Ls=function(t,e){return this.Uc.getEntries(t,e)},zI),GI),bI=(KI.prototype.next=function(){var t=this.Lc;return this.Lc+=2,t},KI.prototype.after=function(t){return this.jc(t+2),this.next()},KI.prototype.jc=function(t){H_((1&t)===this.xc,"Cannot supply target ID from different generator ID"),this.Lc=t},KI.qc=function(){return new KI(0,2)},KI.Bc=function(){return new KI(1)},KI),_I=(HI.prototype.oe=function(t,n){return this.Mc.forEach(function(t,e){return n(e)}),sE.resolve()},HI.prototype.Ro=function(t){return sE.resolve(this.lastRemoteSnapshotVersion)},HI.prototype.zc=function(t){return sE.resolve(this.Qc)},HI.prototype.Go=function(t){var e=this.Wc.after(this.highestTargetId);return this.highestTargetId=e,sE.resolve(e)},HI.prototype.Fo=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.Qc&&(this.Qc=e),sE.resolve()},HI.prototype.Kc=function(t){this.Mc.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.highestTargetId=e),t.sequenceNumber>this.Qc&&(this.Qc=t.sequenceNumber)},HI.prototype.Wo=function(t,e){return H_(!this.Mc.has(e.target),"Adding a target that already exists"),this.Kc(e),this.targetCount+=1,sE.resolve()},HI.prototype.No=function(t,e){return H_(this.Mc.has(e.target),"Updating a non-existent target"),this.Kc(e),sE.resolve()},HI.prototype.Hc=function(t,e){return H_(0<this.targetCount,"Removing a target from an empty cache"),H_(this.Mc.has(e.target),"Removing a non-existent target from the cache"),this.Mc.delete(e.target),this.Gc.Rs(e.targetId),this.targetCount-=1,sE.resolve()},HI.prototype.ds=function(n,r,i){var o=this,s=0,a=[];return this.Mc.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.Mc.delete(t),a.push(o.Jc(n,e.targetId)),s++)}),sE.Vu(a).next(function(){return s})},HI.prototype.Yc=function(t){return sE.resolve(this.targetCount)},HI.prototype.Qo=function(t,e){var n=this.Mc.get(e)||null;return sE.resolve(n)},HI.prototype.be=function(t,e){return W_("Not yet implemented.")},HI.prototype.Co=function(e,t,n){this.Gc.Is(t,n);var r=this.persistence.Ks,i=[];return r&&t.forEach(function(t){i.push(r._s(e,t))}),sE.Vu(i)},HI.prototype.Ao=function(e,t,n){this.Gc.Ds(t,n);var r=this.persistence.Ks,i=[];return r&&t.forEach(function(t){i.push(r.Ts(e,t))}),sE.Vu(i)},HI.prototype.Jc=function(t,e){return this.Gc.Rs(e),sE.resolve()},HI.prototype.Ho=function(t,e){var n=this.Gc.As(e);return sE.resolve(n)},HI.prototype.Cs=function(t,e){return sE.resolve(this.Gc.Cs(e))},HI),EI="You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.",II=(WI.prototype.shutdown=function(){return this.Zc=!1,Promise.resolve()},Object.defineProperty(WI.prototype,"ss",{get:function(){return this.Zc},enumerable:!0,configurable:!0}),WI.prototype.$o=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return[2,[this.clientId]]})})},WI.prototype.na=function(t){return t(!0)},WI.prototype.ia=function(){},WI.prototype.nh=function(t){},WI.prototype.no=function(){return this.sc},WI.prototype.Js=function(t){var e=this.Xc[t.i()];return e||(e=new lI(this.sc,this.Ks),this.Xc[t.i()]=e),e},WI.prototype.Zs=function(){return this.$s},WI.prototype.Xs=function(){return this.uc},WI.prototype.runTransaction=function(t,e,n){var r=this;q_("MemoryPersistence","Starting transaction:",t);var i=new TI(this.$c.next());return this.Ks.ea(),n(i).next(function(t){return r.Ks.ra(i).next(function(){return t})}).Ou().then(function(t){return i.rc(),t})},WI.prototype.ua=function(e,n){return sE.Uu((t=this.Xc,r=[],_g(t,function(t,e){return r.push(e)}),r).map(function(t){return function(){return t.Cs(e,n)}}));var t,r},WI),TI=(Es(BI,gI=$E),BI),SI=(Object.defineProperty(VI.prototype,"ha",{get:function(){if(this.oa)return this.oa;throw W_("orphanedDocuments is only valid during a transaction.")},enumerable:!0,configurable:!0}),VI.prototype.zs=function(t){this.sa=t},VI.prototype._s=function(t,e){return this.ha.delete(e),sE.resolve()},VI.prototype.Ts=function(t,e){return this.ha.add(e),sE.resolve()},VI.prototype.Pc=function(t,e){return this.ha.add(e),sE.resolve()},VI.prototype.removeTarget=function(t,e){var n=this,r=this.persistence.Zs();return r.Ho(t,e.targetId).next(function(t){t.forEach(function(t){return n.ha.add(t)})}).next(function(){return r.Hc(t,e)})},VI.prototype.ea=function(){this.oa=new Set},VI.prototype.ra=function(t){var n=this,r=this.persistence.Xs().wo();return sE.forEach(this.ha,function(e){return n.ca(t,e).next(function(t){t||r.Us(e)})}).next(function(){return n.oa=null,r.apply(t)})},VI.prototype.Oo=function(t,e){var n=this;return this.ca(t,e).next(function(t){t?n.ha.delete(e):n.ha.add(e)})},VI.prototype.ta=function(t){return 0},VI.prototype.ca=function(t,e){var n=this;return sE.Uu([function(){return n.persistence.Zs().Cs(t,e)},function(){return n.persistence.ua(t,e)},function(){return sE.resolve(n.sa.Cs(e))}])},VI),CI=(qI.prototype.initialize=function(t,e,n,r,i,o){if(o.aa)throw new sg(og.FAILED_PRECONDITION,EI);return this.clientId=r,Promise.resolve()},qI.prototype.fa=function(){var t=!1;return{ss:t,start:function(){return t=!0},stop:function(){return t=!1}}},qI.prototype.la=function(){return H_(!!this.clientId,"initialize() not called"),new II(this.clientId,function(t){return new SI(t)})},qI.prototype.da=function(){return new JE},qI.prototype.clearPersistence=function(){throw new sg(og.FAILED_PRECONDITION,EI)},qI),NI=(jI.prototype.reset=function(){this.ga=0},jI.prototype.ya=function(){this.ga=this.ma},jI.prototype._a=function(t){var e=this;this.cancel();var n=Math.floor(this.ga+this.Ia()),r=Math.max(0,Date.now()-this.pa),i=Math.max(0,n-r);0<this.ga&&q_("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.ga+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.ba=this.fh.yu(this.Zr,i,function(){return e.pa=Date.now(),t()}),this.ga*=this.wa,this.ga<this.va&&(this.ga=this.va),this.ga>this.ma&&(this.ga=this.ma)},jI.prototype.cancel=function(){null!==this.ba&&(this.ba.cancel(),this.ba=null)},jI.prototype.Ia=function(){return(Math.random()-.5)*this.ga},jI),AI=(UI.prototype.Aa=function(){return 1===this.state||2===this.state||4===this.state},UI.prototype.Ca=function(){return 2===this.state},UI.prototype.start=function(){3!==this.state?(H_(0===this.state,"Already started"),this.auth()):this.Pa()},UI.prototype.stop=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.Aa()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},UI.prototype.ka=function(){H_(!this.Aa(),"Can only inhibit backoff in a stopped state"),this.state=0,this.Sa.reset()},UI.prototype.Na=function(){var t=this;this.Ca()&&null===this.Ra&&(this.Ra=this.fh.yu(this.Ta,6e4,function(){return t.Oa()}))},UI.prototype.Fa=function(t){this.Va(),this.stream.send(t)},UI.prototype.Oa=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return this.Ca()?[2,this.close(0)]:[2]})})},UI.prototype.Va=function(){this.Ra&&(this.Ra.cancel(),this.Ra=null)},UI.prototype.close=function(e,n){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return H_(this.Aa(),"Only started streams should be closed."),H_(3===e||ab(n),"Can't provide an error when not in an error state."),this.Va(),this.Sa.cancel(),this.Da++,3!==e?this.Sa.reset():n&&n.code===og.RESOURCE_EXHAUSTED?(V_(n.toString()),V_("Using maximum backoff delay to prevent overloading the backend."),this.Sa.ya()):n&&n.code===og.UNAUTHENTICATED&&this.Ea.l(),null!==this.stream&&(this.Ua(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.xa(n)];case 1:return t.sent(),[2]}})})},UI.prototype.Ua=function(){},UI.prototype.auth=function(){var n=this;H_(0===this.state,"Must be in initial state to auth"),this.state=1;var t=this.ja(this.Da),e=this.Da;this.Ea.getToken().then(function(t){n.Da===e&&n.La(t)},function(e){t(function(){var t=new sg(og.UNKNOWN,"Fetching auth token failed: "+e.message);return n.qa(t)})})},UI.prototype.La=function(t){var e=this;H_(1===this.state,"Trying to start stream in a non-starting state");var n=this.ja(this.Da);this.stream=this.Ba(t),this.stream.Ma(function(){n(function(){return H_(1===e.state,"Expected stream to be in state Starting, but was "+e.state),e.state=2,e.listener.Ma()})}),this.stream.xa(function(t){n(function(){return e.qa(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},UI.prototype.Pa=function(){var t=this;H_(3===this.state,"Should only perform backoff when in Error state"),this.state=4,this.Sa._a(function(){return Ts(t,void 0,void 0,function(){return Ss(this,function(t){return H_(4===this.state,"Backoff elapsed but state is now: "+this.state),this.state=0,this.start(),H_(this.Aa(),"PersistentStream should have started"),[2]})})})},UI.prototype.qa=function(t){return H_(this.Aa(),"Can't handle server close on non-started stream"),q_("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},UI.prototype.ja=function(e){var n=this;return function(t){n.fh.ou(function(){return n.Da===e?t():(q_("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},UI),kI=(Es(FI,yI=AI),FI.prototype.Ba=function(t){return this.connection.Qa("Listen",t)},FI.prototype.onMessage=function(t){this.Sa.reset();var e=this.serializer.Xe(t),n=this.serializer.Ze(t);return this.listener.Ga(e,n)},FI.prototype.watch=function(t){var e={};e.database=this.serializer.Ue,e.addTarget=this.serializer.Yn(t);var n=this.serializer._r(t);n&&(e.labels=n),this.Fa(e)},FI.prototype.Wa=function(t){var e={};e.database=this.serializer.Ue,e.removeTarget=t,this.Fa(e)},FI),RI=(Es(MI,vI=AI),Object.defineProperty(MI.prototype,"Ka",{get:function(){return this.za},enumerable:!0,configurable:!0}),MI.prototype.start=function(){this.za=!1,vI.prototype.start.call(this)},MI.prototype.Ua=function(){this.za&&this.Ha([])},MI.prototype.Ba=function(t){return this.connection.Qa("Write",t)},MI.prototype.onMessage=function(t){if(H_(!!t.streamToken,"Got a write response without a stream token"),this.lastStreamToken=this.serializer.De(t.streamToken),this.za){this.Sa.reset();var e=this.serializer.cr(t.writeResults,t.commitTime),n=this.serializer.fromVersion(t.commitTime);return this.listener.Ja(n,e)}return H_(!t.writeResults||0===t.writeResults.length,"Got mutation results for handshake"),this.za=!0,this.listener.Ya()},MI.prototype.Xa=function(){H_(this.Ca(),"Writing handshake requires an opened stream"),H_(!this.za,"Handshake already completed");var t={};t.database=this.serializer.Ue,this.Fa(t)},MI.prototype.Ha=function(t){var e=this;H_(this.Ca(),"Writing mutations requires an opened stream"),H_(this.za,"Handshake must be complete before writing mutations"),H_(0<this.lastStreamToken.P(),"Trying to write mutation without a token");var n={streamToken:this.serializer.Ee(this.lastStreamToken),writes:t.map(function(t){return e.serializer.tr(t)})};this.Fa(n)},MI),OI=(LI.prototype.$a=function(t){return new RI(this.fh,this.connection,this.credentials,this.serializer,t)},LI.prototype.Za=function(t){return new kI(this.fh,this.connection,this.credentials,this.serializer,t)},LI.prototype.commit=function(t){var e=this,n={database:this.serializer.Ue,writes:t.map(function(t){return e.serializer.tr(t)})};return this.tf("Commit",n).then(function(t){return e.serializer.cr(t.writeResults,t.commitTime)})},LI.prototype.lookup=function(e){var i=this,t={database:this.serializer.Ue,documents:e.map(function(t){return i.serializer.ke(t)})};return this.nf("BatchGetDocuments",t).then(function(t){var n=Xb();t.forEach(function(t){var e=i.serializer.He(t);n=n.dt(e.key,e)});var r=[];return e.forEach(function(t){var e=n.get(t);H_(!!e,"Missing entity in write response for "+t),r.push(e)}),r})},LI.prototype.tf=function(e,n){var r=this;return this.credentials.getToken().then(function(t){return r.connection.tf(e,n,t)}).catch(function(t){throw t.code===og.UNAUTHENTICATED&&r.credentials.l(),t})},LI.prototype.nf=function(e,n){var r=this;return this.credentials.getToken().then(function(t){return r.connection.nf(e,n,t)}).catch(function(t){throw t.code===og.UNAUTHENTICATED&&r.credentials.l(),t})},LI),DI=(xI.documentId=function(){return xI.ef},xI.prototype.isEqual=function(t){if(!(t instanceof xI))throw Fg("isEqual","FieldPath",1,t);return this.if.isEqual(t.if)},xI.ef=new xI(rm.ot().it()),xI),PI=new RegExp("[~\\*/\\[\\]]");function xI(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];!function(t,e,n,r){if(!(e instanceof Array)||e.length<r)throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() requires its "+n+" argument to be an array with at least "+qg(r,"element")+".")}("FieldPath",t,"fieldNames",1);for(var n=0;n<t.length;++n)if(Ng("FieldPath","string",n,t[n]),0===t[n].length)throw new sg(og.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this.if=new rm(t)}function LI(t,e,n,r){this.fh=t,this.connection=e,this.credentials=n,this.serializer=r}function MI(t,e,n,r,i){var o=vI.call(this,t,"write_stream_connection_backoff","write_stream_idle",e,n,i)||this;return o.serializer=r,o.za=!1,o.lastStreamToken=Vg.k,o}function FI(t,e,n,r,i){var o=yI.call(this,t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i)||this;return o.serializer=r,o}function UI(t,e,n,r,i,o){this.fh=t,this.Ta=n,this.connection=r,this.Ea=i,this.listener=o,this.state=0,this.Da=0,this.Ra=null,this.stream=null,this.Sa=new NI(t,e)}function jI(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.fh=t,this.Zr=e,this.va=n,this.wa=r,this.ma=i,this.ga=0,this.ba=null,this.pa=Date.now(),this.reset()}function qI(){}function VI(t){this.persistence=t,this.sa=null,this.oa=null}function BI(t){var e=gI.call(this)||this;return e.Po=t,e}function WI(t,e){var n=this;this.clientId=t,this.Xc={},this.$c=new rE(0),this.Zc=!1,this.Zc=!0,this.Ks=e(this),this.$s=new _I(this),this.sc=new cI,this.uc=new wI(this.sc,function(t){return n.Ks.ta(t)})}function HI(t){this.persistence=t,this.Mc=new eE(function(t){return t.canonicalId()}),this.lastRemoteSnapshotVersion=Zg.MIN,this.highestTargetId=0,this.Qc=0,this.Gc=new EE,this.targetCount=0,this.Wc=bI.qc()}function KI(t,e){H_((1&(this.xc=t))===t,"Generator ID "+t+" contains more than 1 reserved bits"),this.jc(void 0!==e?e:this.xc)}function GI(t,e){this.sc=t,this.kc=e,this.docs=new om(im.W),this.size=0}function zI(t){var e=mI.call(this)||this;return e.Uc=t,e}var QI,YI,JI,XI,$I,ZI=(yT.delete=function(){return Ig("FieldValue.delete",arguments),tT.instance},yT.serverTimestamp=function(){return Ig("FieldValue.serverTimestamp",arguments),eT.instance},yT.arrayUnion=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Sg("FieldValue.arrayUnion",arguments,1),new nT(t)},yT.arrayRemove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Sg("FieldValue.arrayRemove",arguments,1),new rT(t)},yT.increment=function(t){return Ng("FieldValue.increment","number",1,t),Tg("FieldValue.increment",arguments,1),new iT(t)},yT.prototype.isEqual=function(t){return this===t},yT),tT=(Es(vT,$I=ZI),vT.instance=new vT,vT),eT=(Es(dT,XI=ZI),dT.instance=new dT,dT),nT=(Es(pT,JI=ZI),pT),rT=(Es(fT,YI=ZI),fT),iT=(Es(lT,QI=ZI),lT),oT=gg(ZI,"Use FieldValue.<field>() instead."),sT=/^__.*__$/,aT=(hT.prototype.hf=function(t,e){var n=[];return null!==this.sn?n.push(new Qm(t,this.data,this.sn,e)):n.push(new zm(t,this.data,e)),0<this.fieldTransforms.length&&n.push(new Ym(t,this.fieldTransforms)),n},hT),uT=(cT.prototype.hf=function(t,e){var n=[new Qm(t,this.data,this.sn,e)];return 0<this.fieldTransforms.length&&n.push(new Ym(t,this.fieldTransforms)),n},cT);function cT(t,e,n){this.data=t,this.sn=e,this.fieldTransforms=n}function hT(t,e,n){this.data=t,this.sn=e,this.fieldTransforms=n}function lT(t){var e=QI.call(this,"FieldValue.increment")||this;return e.sf=t,e}function fT(t){var e=YI.call(this,"FieldValue.arrayRemove")||this;return e.uf=t,e}function pT(t){var e=JI.call(this,"FieldValue.arrayUnion")||this;return e.uf=t,e}function dT(){return XI.call(this,"FieldValue.serverTimestamp")||this}function vT(){return $I.call(this,"FieldValue.delete")||this}function yT(t){this.rf=t}function gT(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw W_("Unexpected case for UserDataSource: "+t)}}var mT=(ET.prototype.lf=function(t){var e=null==this.path?null:this.path.child(t),n=new ET(this.cf,this.methodName,e,!1,this.fieldTransforms,this.sn);return n.df(t),n},ET.prototype.vf=function(t){var e=null==this.path?null:this.path.child(t),n=new ET(this.cf,this.methodName,e,!1,this.fieldTransforms,this.sn);return n.ff(),n},ET.prototype.wf=function(t){return new ET(this.cf,this.methodName,null,!0,this.fieldTransforms,this.sn)},ET.prototype.mf=function(t){var e=null===this.path||this.path.Y()?"":" (found in field "+this.path.toString()+")";return new sg(og.INVALID_ARGUMENT,"Function "+this.methodName+"() called with invalid data. "+t+e)},ET.prototype.contains=function(e){return void 0!==this.sn.find(function(t){return e.Z(t)})||void 0!==this.fieldTransforms.find(function(t){return e.Z(t.field)})},ET.prototype.ff=function(){if(null!==this.path)for(var t=0;t<this.path.length;t++)this.df(this.path.get(t))},ET.prototype.df=function(t){if(0===t.length)throw this.mf("Document fields must not be empty");if(gT(this.cf)&&sT.test(t))throw this.mf('Document fields cannot begin and end with "__"')},ET),wT=function(t,e){this.Dn=t,this.key=e},bT=(_T.prototype.bf=function(t,e){var n=new mT(0,t,rm.rt);TT("Data must be an object, but it was:",n,e);var r=this.pf(e,n);return new aT(r,null,n.fieldTransforms)},_T.prototype.yf=function(t,e,n){var r=new mT(2,t,rm.rt);TT("Data must be an object, but it was:",r,e);var i,o,s=this.pf(e,r);if(n){for(var a=new _m(rm.W),u=0,c=n;u<c.length;u++){var h=c[u],l=void 0;if(h instanceof DI)l=h.if;else{if("string"!=typeof h)throw W_("Expected stringOrFieldPath to be a string or a FieldPath");l=CT(t,h)}if(!r.contains(l))throw new sg(og.INVALID_ARGUMENT,"Field '"+l+"' is specified in your field mask but missing from your input data.");a=a.add(l)}i=Wm.Yt(a),o=r.fieldTransforms.filter(function(t){return i.$t(t.field)})}else i=Wm.Xt(r.sn),o=r.fieldTransforms;return new aT(s,i,o)},_T.prototype._f=function(o,t){var s=this,a=new mT(1,o,rm.rt);TT("Data must be an object, but it was:",a,t);var u=new _m(rm.W),c=jw.wn();_g(t,function(t,e){var n=CT(o,t),r=a.vf(n);if((e=s.If(e,r))instanceof tT)u=u.add(n);else{var i=s.pf(e,r);null!=i&&(u=u.add(n),c.set(n,i))}});var e=Wm.Yt(u);return new uT(c.an(),e,a.fieldTransforms)},_T.prototype.Tf=function(t,e,n,r){var i=new mT(1,t,rm.rt),o=[ST(t,e)],s=[n];if(r.length%2!=0)throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() needs to be called with an even number of arguments that alternate between field names and values.");for(var a=0;a<r.length;a+=2)o.push(ST(t,r[a])),s.push(r[a+1]);var u=new _m(rm.W),c=jw.wn();for(a=0;a<o.length;++a){var h=o[a],l=i.vf(h),f=this.If(s[a],l);if(f instanceof tT)u=u.add(h);else{var p=this.pf(f,l);null!=p&&(u=u.add(h),c.set(h,p))}}var d=Wm.Yt(u);return new uT(c.an(),d,i.fieldTransforms)},_T.prototype.Ef=function(t,e,n){void 0===n&&(n=!1);var r=new mT(n?4:3,t,rm.rt),i=this.pf(e,r);return H_(null!=i,"Parsed data should not be null."),H_(0===r.fieldTransforms.length,"Field transforms should have been disallowed."),i},_T.prototype.If=function(t,e){try{return this.gf(t)}catch(t){var n=NT(t);throw e.mf(n)}},_T.prototype.pf=function(t,e){if(IT(t=this.If(t,e)))return TT("Unsupported field value:",e,t),this.Df(t,e);if(t instanceof ZI)return this.Rf(t,e),null;if(e.path&&e.sn.push(e.path),t instanceof Array){if(e.af&&4!==e.cf)throw e.mf("Nested arrays are not supported");return this.Sf(t,e)}return this.Af(t,e)},_T.prototype.Df=function(t,r){var i=this,o=new om(z_);return Eg(t)?r.path&&0<r.path.length&&r.sn.push(r.path):_g(t,function(t,e){var n=i.pf(e,r.lf(t));null!=n&&(o=o.dt(t,n))}),new jw(o)},_T.prototype.Sf=function(t,e){for(var n=[],r=0,i=0,o=t;i<o.length;i++){var s=o[i],a=this.pf(s,e.wf(r));null==a&&(a=tw.yn),n.push(a),r++}return new Vw(n)},_T.prototype.Rf=function(t,e){if(!gT(e.cf))throw e.mf(t.rf+"() can only be used with update() and set()");if(null===e.path)throw e.mf(t.rf+"() is not currently supported inside arrays");if(t instanceof tT){if(2!==e.cf)throw 1===e.cf?(H_(0<e.path.length,"FieldValue.delete() at the top level should have already been handled."),e.mf("FieldValue.delete() can only appear at the top level of your update data")):e.mf("FieldValue.delete() cannot be used with set() unless you pass {merge:true}");e.sn.push(e.path)}else if(t instanceof eT)e.fieldTransforms.push(new Hm(e.path,Im.instance));else if(t instanceof nT){var n=this.Cf(t.rf,t.uf),r=new Tm(n);e.fieldTransforms.push(new Hm(e.path,r))}else if(t instanceof rT){n=this.Cf(t.rf,t.uf);var i=new Sm(n);e.fieldTransforms.push(new Hm(e.path,i))}else if(t instanceof iT){var o=this.Ef("FieldValue.increment",t.sf),s=new Cm(o);e.fieldTransforms.push(new Hm(e.path,s))}else W_("Unknown FieldValue type: "+t)},_T.prototype.Af=function(t,e){if(null===t)return tw.yn;if("number"==typeof t)return cb(t)?new Ow(t):new Dw(t);if("boolean"==typeof t)return ew.of(t);if("string"==typeof t)return new Pw(t);if(t instanceof Date)return new xw($g.fromDate(t));if(t instanceof $g)return new xw(new $g(t.seconds,1e3*Math.floor(t.nanoseconds/1e3)));if(t instanceof Xg)return new Uw(t);if(t instanceof Yg)return new Mw(t);if(t instanceof wT)return new Fw(t.Dn,t.key);throw e.mf("Unsupported field value: "+xg(t))},_T.prototype.Cf=function(r,t){var i=this;return t.map(function(t,e){var n=new mT(3,r,rm.rt);return i.pf(t,n.wf(e))})},_T);function _T(t){this.gf=t}function ET(t,e,n,r,i,o){this.cf=t,this.methodName=e,this.path=n,this.af=r,void 0===i&&this.ff(),this.af=void 0!==r&&r,this.fieldTransforms=i||[],this.sn=o||[]}function IT(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof $g||t instanceof Xg||t instanceof Yg||t instanceof wT||t instanceof ZI)}function TT(t,e,n){if(!IT(n)||!Pg(n)){var r=xg(n);throw"an object"===r?e.mf(t+" a custom object"):e.mf(t+" "+r)}}function ST(t,e){if(e instanceof DI)return e.if;if("string"==typeof e)return CT(t,e);throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() called with invalid data. Field path arguments must be of type string or FieldPath.")}function CT(t,e){try{return function(e){if(0<=e.search(PI))throw new sg(og.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(DI.bind.apply(DI,ks([void 0],e.split("."))))}catch(t){throw new sg(og.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(e).if}catch(e){var n=NT(e);throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() called with invalid data. "+n)}}function NT(t){return t instanceof Error?t.message:t.toString()}function AT(t){this.key=t}function kT(t){this.key=t}var RT=(FT.prototype.lookup=function(r){return Ts(this,void 0,void 0,function(){var e,n=this;return Ss(this,function(t){switch(t.label){case 0:if(this.Vf(),0<this.mutations.length)throw new sg(og.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,this.Pf.lookup(r)];case 1:return(e=t.sent()).forEach(function(t){t instanceof Hw||t instanceof Ww?n.Uf(t):W_("Document in a transaction was a "+t.constructor.name)}),[2,e]}})})},FT.prototype.set=function(t,e){this.write(e.hf(t,this.en(t))),this.Ff.add(t)},FT.prototype.update=function(t,e){try{this.write(e.hf(t,this.xf(t)))}catch(t){this.Of=t}this.Ff.add(t)},FT.prototype.delete=function(t){this.write([new Jm(t,this.en(t))]),this.Ff.add(t)},FT.prototype.commit=function(){return Ts(this,void 0,void 0,function(){var e,n=this;return Ss(this,function(t){switch(t.label){case 0:if(this.Vf(),this.Of)throw this.Of;return e=this.kf,this.mutations.forEach(function(t){e=e.remove(t.key)}),e.forEach(function(t,e){n.mutations.push(new Xm(t,n.en(t)))}),[4,this.Pf.commit(this.mutations)];case 1:return t.sent(),this.Nf=!0,[2]}})})},FT.prototype.Uf=function(t){var e;if(t instanceof Ww)e=t.version;else{if(!(t instanceof Hw))throw W_("Document in a transaction was a "+t.constructor.name);e=Zg.q()}var n=this.kf.get(t.key);if(null!==n){if(!e.isEqual(n))throw new sg(og.ABORTED,"Document version changed between two reads.")}else this.kf=this.kf.dt(t.key,e)},FT.prototype.en=function(t){var e=this.kf.get(t);return!this.Ff.has(t)&&e?Km.updateTime(e):Km.NONE},FT.prototype.xf=function(t){var e=this.kf.get(t);if(this.Ff.has(t)||!e)return Km.exists(!0);if(e.isEqual(Zg.q()))throw new sg(og.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Km.updateTime(e)},FT.prototype.write=function(t){this.Vf(),this.mutations=this.mutations.concat(t)},FT.prototype.Vf=function(){H_(!this.Nf,"A transaction object cannot be used after its update callback has been invoked.")},FT),OT=(MT.prototype.Bf=function(){var t=this;0===this.jf&&(this.Mf("Unknown"),H_(null===this.Lf,"onlineStateTimer shouldn't be started yet"),this.Lf=this.$r.yu("online_state_timeout",1e4,function(){return t.Lf=null,H_("Unknown"===t.state,"Timer should be canceled if we transitioned to a different state."),t.Qf("Backend didn't respond within 10 seconds."),t.Mf("Offline"),Promise.resolve()}))},MT.prototype.Gf=function(t){"Online"===this.state?(this.Mf("Unknown"),H_(0===this.jf,"watchStreamFailures must be 0"),H_(null===this.Lf,"onlineStateTimer must be null")):(this.jf++,1<=this.jf&&(this.Wf(),this.Qf("Connection failed 1 times. Most recent error: "+t.toString()),this.Mf("Offline")))},MT.prototype.set=function(t){this.Wf(),this.jf=0,"Online"===t&&(this.qf=!1),this.Mf(t)},MT.prototype.Mf=function(t){t!==this.state&&(this.state=t,this.vh(t))},MT.prototype.Qf=function(t){var e="Could not reach Cloud Firestore backend. "+t+"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.";this.qf?(V_(e),this.qf=!1):q_("OnlineStateTracker",e)},MT.prototype.Wf=function(){null!==this.Lf&&(this.Lf.cancel(),this.Lf=null)},MT),DT=(LT.prototype.start=function(){return this.enableNetwork()},LT.prototype.enableNetwork=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.networkEnabled=!0,this.$f()?(e=this.ul,[4,this.zf.Eo()]):[3,3];case 1:return e.lastStreamToken=t.sent(),this.cl()?this.al():this.tl.set("Unknown"),[4,this.fl()];case 2:t.sent(),t.label=3;case 3:return[2]}})})},LT.prototype.disableNetwork=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.networkEnabled=!1,[4,this.ll()];case 1:return t.sent(),this.tl.set("Offline"),[2]}})})},LT.prototype.ll=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,this.ul.stop()];case 1:return t.sent(),[4,this.nl.stop()];case 2:return t.sent(),0<this.Kf.length&&(q_("RemoteStore","Stopping write stream with "+this.Kf.length+" pending writes"),this.Kf=[]),this.dl(),[2]}})})},LT.prototype.shutdown=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return q_("RemoteStore","RemoteStore shutting down."),this.networkEnabled=!1,[4,this.ll()];case 1:return t.sent(),this.Yf.shutdown(),this.tl.set("Unknown"),[2]}})})},LT.prototype.listen=function(t){mg(this.Hf,t.targetId)||(this.Hf[t.targetId]=t,this.cl()?this.al():this.nl.Ca()&&this.vl(t))},LT.prototype.wl=function(t){H_(mg(this.Hf,t),"unlisten called on target no currently watched: "+t),delete this.Hf[t],this.nl.Ca()&&this.ml(t),Eg(this.Hf)&&(this.nl.Ca()?this.nl.Na():this.$f()&&this.tl.set("Unknown"))},LT.prototype.be=function(t){return this.Hf[t]||null},LT.prototype.ge=function(t){return this.dh.ge(t)},LT.prototype.vl=function(t){this.Jf.Ji(t.targetId),this.nl.watch(t)},LT.prototype.ml=function(t){this.Jf.Ji(t),this.nl.Wa(t)},LT.prototype.al=function(){H_(this.cl(),"startWatchStream() called when shouldStartWatchStream() is false."),this.Jf=new y_(this),this.nl.start(),this.tl.Bf()},LT.prototype.cl=function(){return this.$f()&&!this.nl.Aa()&&!Eg(this.Hf)},LT.prototype.$f=function(){return this.isPrimary&&this.networkEnabled},LT.prototype.dl=function(){this.Jf=null},LT.prototype.il=function(){return Ts(this,void 0,void 0,function(){var n=this;return Ss(this,function(t){return bg(this.Hf,function(t,e){n.vl(e)}),[2]})})},LT.prototype.el=function(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return void 0===e&&H_(!this.cl(),"Watch stream was stopped gracefully while still needed."),this.dl(),this.cl()?(this.tl.Gf(e),this.al()):this.tl.set("Unknown"),[2]})})},LT.prototype.rl=function(n,r){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.tl.set("Online"),n instanceof c_&&2===n.state&&n.cause?[2,this.gl(n)]:(n instanceof a_?this.Jf.ee(n):n instanceof u_?this.Jf.fe(n):(H_(n instanceof c_,"Expected watchChange to be an instance of WatchTargetChange"),this.Jf.se(n)),r.isEqual(Zg.MIN)?[3,3]:[4,this.zf.Ro()]);case 1:return e=t.sent(),0<=r.B(e)?[4,this.bl(r)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[2]}})})},LT.prototype.bl=function(r){var i=this;H_(!r.isEqual(Zg.MIN),"Can't raise event for unknown SnapshotVersion");var t=this.Jf.ve(r);return bg(t.Ei,function(t,e){if(0<e.resumeToken.P()){var n=i.Hf[t];n&&(i.Hf[t]=n.li(e.resumeToken,r))}}),t.Di.forEach(function(t){var e=i.Hf[t];if(e){i.Hf[t]=e.li(Vg.k,e.ai),i.ml(t);var n=new Db(e.target,t,1,e.sequenceNumber);i.vl(n)}}),this.dh.So(t)},LT.prototype.gl=function(t){var n=this;H_(!!t.cause,"Handling target error without a cause");var r=t.cause,i=Promise.resolve();return t.targetIds.forEach(function(e){i=i.then(function(){return Ts(n,void 0,void 0,function(){return Ss(this,function(t){return mg(this.Hf,e)?(delete this.Hf[e],this.Jf.removeTarget(e),[2,this.dh.pl(e,r)]):[2]})})})}),i},LT.prototype.fl=function(){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return this.yl()?(e=0<this.Kf.length?this.Kf[this.Kf.length-1].batchId:-1,[4,this.zf.jo(e)]):[3,4];case 1:return null!==(n=t.sent())?[3,2]:(0===this.Kf.length&&this.ul.Na(),[3,4]);case 2:return this._l(n),[4,this.fl()];case 3:t.sent(),t.label=4;case 4:return this.Il()&&this.Tl(),[2]}})})},LT.prototype.yl=function(){return this.$f()&&this.Kf.length<10},LT.prototype.El=function(){return this.Kf.length},LT.prototype._l=function(t){H_(this.yl(),"addToWritePipeline called when pipeline is full"),this.Kf.push(t),this.ul.Ca()&&this.ul.Ka&&this.ul.Ha(t.mutations)},LT.prototype.Il=function(){return this.$f()&&!this.ul.Aa()&&0<this.Kf.length},LT.prototype.Tl=function(){H_(this.Il(),"startWriteStream() called when shouldStartWriteStream() is false."),this.ul.start()},LT.prototype.sl=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return this.ul.Xa(),[2]})})},LT.prototype.hl=function(){var r=this;return this.zf.Do(this.ul.lastStreamToken).then(function(){for(var t=0,e=r.Kf;t<e.length;t++){var n=e[t];r.ul.Ha(n.mutations)}}).catch(xE)},LT.prototype.Ja=function(t,e){var n=this;H_(0<this.Kf.length,"Got result for empty write pipeline");var r=this.Kf.shift(),i=tE.from(r,t,e,this.ul.lastStreamToken);return this.dh.Dl(i).then(function(){return n.fl()})},LT.prototype.ol=function(n){return Ts(this,void 0,void 0,function(){var e=this;return Ss(this,function(t){return void 0===n&&H_(!this.Il(),"Write stream was stopped gracefully while still needed."),n&&0<this.Kf.length?[2,(this.ul.Ka?this.Rl(n):this.Sl(n)).then(function(){e.Il()&&e.Tl()})]:[2]})})},LT.prototype.Sl=function(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return Qb(e.code)?(q_("RemoteStore","RemoteStore error before completed handshake; resetting stream token: ",this.ul.lastStreamToken),this.ul.lastStreamToken=Vg.k,[2,this.zf.Do(Vg.k).catch(xE)]):[2]})})},LT.prototype.Rl=function(i){return Ts(this,void 0,void 0,function(){var n,r=this;return Ss(this,function(t){return Qb(e=i.code)&&e!==og.ABORTED?(n=this.Kf.shift(),this.ul.ka(),[2,this.dh.Al(n.batchId,i).then(function(){return r.fl()})]):[2];var e})})},LT.prototype.Cl=function(){return new RT(this.Pf)},LT.prototype.Zf=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.networkEnabled=!1,[4,this.ll()];case 1:return t.sent(),this.tl.set("Unknown"),[4,this.enableNetwork()];case 2:return t.sent(),[2]}})})},LT.prototype.Pl=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.$f()?(q_("RemoteStore","RemoteStore restarting streams for new credential"),[4,this.Zf()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},LT.prototype.kl=function(e){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return(this.isPrimary=e)&&this.networkEnabled?[4,this.enableNetwork()]:[3,2];case 1:return t.sent(),[3,4];case 2:return e?[3,4]:[4,this.ll()];case 3:t.sent(),this.tl.set("Unknown"),t.label=4;case 4:return[2]}})})},LT),PT=(Object.defineProperty(xT.prototype,"Ul",{get:function(){return this.Nl},enumerable:!0,configurable:!0}),xT.prototype.xl=function(t,e){var a=this,u=e?e.jl:new l_,c=e?e.Vl:this.Vl,h=e?e.yi:this.yi,l=c,f=!1,p=this.query.ii()&&c.size===this.query.limit?c.last():null,d=this.query.ei()&&c.size===this.query.limit?c.first():null;if(t.bt(function(t,e){var n=c.get(t),r=e instanceof Ww?e:null;r&&(H_(t.isEqual(r.key),"Mismatching keys found in document changes: "+t+" != "+r.key),r=a.query.matches(r)?r:null);var i=!!n&&a.yi.has(n.key),o=!!r&&(r.rn||a.yi.has(r.key)&&r.hasCommittedMutations),s=!1;n&&r?n.data().isEqual(r.data())?i!==o&&(u.track({type:3,doc:r}),s=!0):a.Ll(n,r)||(u.track({type:2,doc:r}),s=!0,(p&&0<a.query.Xn(r,p)||d&&a.query.Xn(r,d)<0)&&(f=!0)):!n&&r?(u.track({type:0,doc:r}),s=!0):n&&!r&&(u.track({type:1,doc:n}),s=!0,(p||d)&&(f=!0)),s&&(h=r?(l=l.add(r),o?h.add(t):h.delete(t)):(l=l.delete(t),h.delete(t)))}),this.query.ii()||this.query.ei())for(;l.size>this.query.limit;){var n=this.query.ii()?l.last():l.first();l=l.delete(n.key),h=h.delete(n.key),u.track({type:1,doc:n})}return H_(!f||!e,"View was refilled using docs that themselves needed refilling."),{Vl:l,jl:u,yc:f,yi:h}},xT.prototype.Ll=function(t,e){return t.rn&&e.hasCommittedMutations&&!e.rn},xT.prototype.qs=function(t,e,n){var o=this;H_(!t.yc,"Cannot apply changes that need a refill");var r=this.Vl;this.Vl=t.Vl,this.yi=t.yi;var i=t.jl.bi();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.query.Xn(t.doc,e.doc);function n(t){switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return W_("Unknown ChangeType: "+t)}}var r,i}),this.ql(n);var s=e?this.Bl():[],a=0===this.Fl.size&&this.Pi?1:0,u=a!==this.Ol;return this.Ol=a,0!==i.length||u?{snapshot:new f_(this.query,t.Vl,r,i,t.yi,0==a,u,!1),Ml:s}:{Ml:s}},xT.prototype.Ql=function(t){return this.Pi&&"Offline"===t?(this.Pi=!1,this.qs({Vl:this.Vl,jl:new l_,yi:this.yi,yc:!1},!1)):{Ml:[]}},xT.prototype.Gl=function(t){return!this.Nl.has(t)&&!!this.Vl.has(t)&&!this.Vl.get(t).rn},xT.prototype.ql=function(t){var e=this;t&&(t.ki.forEach(function(t){return e.Nl=e.Nl.add(t)}),t.Ni.forEach(function(t){return H_(e.Nl.has(t),"Modified document "+t+" not found in view.")}),t.Oi.forEach(function(t){return e.Nl=e.Nl.delete(t)}),this.Pi=t.Pi)},xT.prototype.Bl=function(){var e=this;if(!this.Pi)return[];var n=this.Fl;this.Fl=i_(),this.Vl.forEach(function(t){e.Gl(t.key)&&(e.Fl=e.Fl.add(t.key))});var r=[];return n.forEach(function(t){e.Fl.has(t)||r.push(new kT(t))}),this.Fl.forEach(function(t){n.has(t)||r.push(new AT(t))}),r},xT.prototype.Wl=function(t){this.Nl=t.Yo,this.Fl=i_();var e=this.xl(t.documents);return this.qs(e,!0)},xT.prototype.zl=function(){return f_.Ti(this.query,this.Vl,this.yi,0===this.Ol)},xT);function xT(t,e){this.query=t,this.Nl=e,this.Ol=null,this.Pi=!1,this.Fl=i_(),this.yi=i_(),this.Vl=new h_(t.Xn.bind(t))}function LT(t,e,n,r,i){var o=this;this.zf=t,this.Pf=e,this.Kf=[],this.Hf={},this.Jf=null,this.networkEnabled=!1,this.isPrimary=!1,this.Yf=i,this.Yf.Xf(function(t){n.ou(function(){return Ts(o,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.$f()?(q_("RemoteStore","Restarting streams for network reachability change."),[4,this.Zf()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}),this.tl=new OT(n,r),this.nl=this.Pf.Za({Ma:this.il.bind(this),xa:this.el.bind(this),Ga:this.rl.bind(this)}),this.ul=this.Pf.$a({Ma:this.sl.bind(this),xa:this.ol.bind(this),Ya:this.hl.bind(this),Ja:this.Ja.bind(this)})}function MT(t,e){this.$r=t,this.vh=e,this.state="Unknown",this.jf=0,this.Lf=null,this.qf=!0}function FT(t){this.Pf=t,this.kf=n_(),this.mutations=[],this.Nf=!1,this.Of=null,this.Ff=new Set}function UT(t,e,n){this.query=t,this.targetId=e,this.view=n}function jT(t){this.key=t,this.Zl=!1}function qT(){this.Nd=null,this.targetId=0,this.listeners=[]}var VT=($T.prototype.run=function(){this.Jl()},$T.prototype.Jl=function(){var t=this;this.Sa._a(function(){return Ts(t,void 0,void 0,function(){var e,n,r=this;return Ss(this,function(t){return e=this.Kl.Cl(),(n=this.Yl(e))&&n.then(function(t){r.$r.ou(function(){return e.commit().then(function(){r.iu.resolve(t)}).catch(function(t){r.Xl(t)})})}).catch(function(t){r.Xl(t)}),[2]})})})},$T.prototype.Yl=function(t){try{var e=this.updateFunction(t);return!ab(e)&&e.catch&&e.then?e:(this.iu.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.iu.reject(t),null}},$T.prototype.Xl=function(t){var e=this;0<this.Hl&&this.$l(t)?(this.Hl-=1,this.$r.ou(function(){return e.Jl(),Promise.resolve()})):this.iu.reject(t)},$T.prototype.$l=function(t){if("FirebaseError"!==t.name)return!1;var e=t.code;return"aborted"===e||"failed-precondition"===e||!Qb(e)},$T),BT=(Object.defineProperty(XT.prototype,"ld",{get:function(){return!0===this.isPrimary},enumerable:!0,configurable:!0}),XT.prototype.subscribe=function(t){H_(null!==t,"SyncEngine listener cannot be null"),H_(null===this.nd,"SyncEngine already has a subscriber."),this.nd=t},XT.prototype.listen=function(s){return Ts(this,void 0,void 0,function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return this.dd("listen()"),(r=this.ed.get(s))?(e=r.targetId,this.td.Vh(e),n=r.view.zl(),[3,4]):[3,1];case 1:return[4,this.zf.Mo(s.Yn())];case 2:return i=t.sent(),o=this.td.Vh(i.targetId),e=i.targetId,[4,this.vd(s,e,"current"===o)];case 3:n=t.sent(),this.isPrimary&&this.Kl.listen(i),t.label=4;case 4:return this.nd.Ga([n]),[2,e]}})})},XT.prototype.vd=function(a,u,c){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return[4,this.zf.Ko(a,!0)];case 1:return e=t.sent(),n=new PT(a,e.Yo),r=n.xl(e.documents),i=d_.Ci(u,c&&"Offline"!==this.onlineState),H_(0===(o=n.qs(r,!0===this.isPrimary,i)).Ml.length,"View returned limbo docs before target ack from the server."),H_(!!o.snapshot,"applyChanges for new view should always return a snapshot"),s=new UT(a,u,n),this.ed.set(a,s),this.rd[u]||(this.rd[u]=[]),this.rd[u].push(a),[2,o.snapshot]}})})},XT.prototype.wd=function(r){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,this.zf.Ko(r.query,!0)];case 1:return e=t.sent(),n=r.view.Wl(e),this.isPrimary&&this.md(r.targetId,n.Ml),[2,n]}})})},XT.prototype.wl=function(i){return Ts(this,void 0,void 0,function(){var e,n,r=this;return Ss(this,function(t){switch(t.label){case 0:return this.dd("unlisten()"),H_(!!(e=this.ed.get(i)),"Trying to unlisten on query not found:"+i),1<(n=this.rd[e.targetId]).length?(this.rd[e.targetId]=n.filter(function(t){return!t.isEqual(i)}),this.ed.delete(i),[2]):this.isPrimary?(this.td.xh(e.targetId),this.td.Ph(e.targetId)?[3,2]:[4,this.zf.zo(e.targetId,!1).then(function(){r.td.Lh(e.targetId),r.Kl.wl(e.targetId),r.gd(e.targetId)}).catch(xE)]):[3,3];case 1:t.sent(),t.label=2;case 2:return[3,5];case 3:return this.gd(e.targetId),[4,this.zf.zo(e.targetId,!0)];case 4:t.sent(),t.label=5;case 5:return[2]}})})},XT.prototype.write=function(n,r){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.dd("write()"),[4,this.zf.ao(n)];case 1:return e=t.sent(),this.td.kh(e.batchId),this.bd(e.batchId,r),[4,this.pd(e.ks)];case 2:return t.sent(),[4,this.Kl.fl()];case 3:return t.sent(),[2]}})})},XT.prototype.runTransaction=function(t,e,n){new VT(t,this.Kl,e,n).run()},XT.prototype.So=function(n){return Ts(this,void 0,void 0,function(){var e,r=this;return Ss(this,function(t){switch(t.label){case 0:this.dd("applyRemoteEvent()"),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.zf.So(n)];case 2:return e=t.sent(),_g(n.Ei,function(t,e){var n=r.sd[Number(t)];n&&(H_(e.ki.size+e.Ni.size+e.Oi.size<=1,"Limbo resolution for single document contains multiple changes."),0<e.ki.size?n.Zl=!0:0<e.Ni.size?H_(n.Zl,"Received change for limbo target document without add."):0<e.Oi.size&&(H_(n.Zl,"Received remove for limbo target document without add."),n.Zl=!1))}),[4,this.pd(e,n)];case 3:return t.sent(),[3,6];case 4:return[4,xE(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},XT.prototype.Ql=function(r,t){if(this.isPrimary&&0===t||!this.isPrimary&&1===t){this.dd("applyOnlineStateChange()");var i=[];this.ed.forEach(function(t,e){var n=e.view.Ql(r);H_(0===n.Ml.length,"OnlineState should not affect limbo documents."),n.snapshot&&i.push(n.snapshot)}),this.nd.yd(r),this.nd.Ga(i),this.onlineState=r,this.isPrimary&&this.td.Mh(r)}},XT.prototype.pl=function(a,u){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s=this;return Ss(this,function(t){switch(t.label){case 0:return this.dd("rejectListens()"),this.td.qh(a,"rejected",u),e=this.sd[a],(n=e&&e.key)?(this.ud=this.ud.remove(n),delete this.sd[a],r=(r=new om(im.W)).dt(n,new Hw(n,Zg.q())),i=i_().add(n),o=new p_(Zg.MIN,{},new _m(z_),r,i),[2,this.So(o)]):[3,1];case 1:return[4,this.zf.zo(a,!1).then(function(){return s.gd(a,u)}).catch(xE)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},XT.prototype.Xh=function(n,r,i){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.dd("applyBatchState()"),[4,this.zf.lo(n)];case 1:return null===(e=t.sent())?(q_("SyncEngine","Cannot apply mutation batch with id: "+n),[2]):"pending"!==r?[3,3]:[4,this.Kl.fl()];case 2:return t.sent(),[3,4];case 3:"acknowledged"===r||"rejected"===r?(this._d(n,i||null),this.zf.Zo(n)):W_("Unknown batchState: "+r),t.label=4;case 4:return[4,this.pd(e)];case 5:return t.sent(),[2]}})})},XT.prototype.Dl=function(r){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:this.dd("applySuccessfulWrite()"),e=r.batch.batchId,this._d(e,null),this.Id(e),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.zf.vo(r)];case 2:return n=t.sent(),this.td.Oh(e,"acknowledged"),[4,this.pd(n)];case 3:return t.sent(),[3,6];case 4:return[4,xE(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},XT.prototype.Al=function(n,r){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:this.dd("rejectFailedWrite()"),this._d(n,r),this.Id(n),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.zf.yo(n)];case 2:return e=t.sent(),this.td.Oh(n,"rejected",r),[4,this.pd(e)];case 3:return t.sent(),[3,6];case 4:return[4,xE(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},XT.prototype.Td=function(r){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return this.Kl.$f()||q_("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."),[4,this.zf.To()];case 1:return-1===(e=t.sent())?r.resolve():((n=this.ad.get(e)||[]).push(r),this.ad.set(e,n)),[2]}})})},XT.prototype.Id=function(t){(this.ad.get(t)||[]).forEach(function(t){t.resolve()}),this.ad.delete(t)},XT.prototype.Ed=function(e){this.ad.forEach(function(t){t.forEach(function(t){t.reject(new sg(og.CANCELLED,e))})}),this.ad.clear()},XT.prototype.bd=function(t,e){var n=this.hd[this.currentUser.i()];n=(n=n||new om(z_)).dt(t,e),this.hd[this.currentUser.i()]=n},XT.prototype._d=function(t,e){var n=this.hd[this.currentUser.i()];if(n){var r=n.get(t);r&&(H_(t===n.wt(),"Mutation callbacks processed out-of-order?"),e?r.reject(e):r.resolve(),n=n.remove(t)),this.hd[this.currentUser.i()]=n}},XT.prototype.gd=function(t,e){var n=this;void 0===e&&(e=null),this.td.xh(t),H_(this.rd[t]&&0!==this.rd[t].length,"There are no queries mapped to target id "+t);for(var r=0,i=this.rd[t];r<i.length;r++){var o=i[r];this.ed.delete(o),e&&this.nd.Dd(o,e)}if(delete this.rd[t],this.isPrimary){var s=this.od.As(t);this.od.Rs(t),s.forEach(function(t){n.od.Cs(t)||n.Rd(t)})}},XT.prototype.Rd=function(t){var e=this.ud.get(t);null!==e&&(this.Kl.wl(e),this.ud=this.ud.remove(t),delete this.sd[e])},XT.prototype.md=function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n];i instanceof AT?(this.od._s(i.key,t),this.Sd(i)):i instanceof kT?(q_("SyncEngine","Document no longer in limbo: "+i.key),this.od.Ts(i.key,t),this.od.Cs(i.key)||this.Rd(i.key)):W_("Unknown limbo change: "+JSON.stringify(i))}},XT.prototype.Sd=function(t){var e=t.key;if(!this.ud.get(e)){q_("SyncEngine","New document in limbo: "+e);var n=this.fd.next(),r=wb.jn(e.path);this.sd[n]=new jT(e),this.Kl.listen(new Db(r.Yn(),n,2,rE.Xr)),this.ud=this.ud.dt(e,n)}},XT.prototype.Ad=function(){return this.ud},XT.prototype.pd=function(r,u){return Ts(this,void 0,void 0,function(){var o,s,e,a=this;return Ss(this,function(t){switch(t.label){case 0:return o=[],s=[],e=[],this.ed.forEach(function(t,i){e.push(Promise.resolve().then(function(){var n=i.view.xl(r);return n.yc?a.zf.Ko(i.query,!1).then(function(t){var e=t.documents;return i.view.xl(e,n)}):n}).then(function(t){var e=u&&u.Ei[i.targetId],n=i.view.qs(t,!0===a.isPrimary,e);if(a.md(i.targetId,n.Ml),n.snapshot){a.isPrimary&&a.td.qh(i.targetId,n.snapshot.fromCache?"not-current":"current"),o.push(n.snapshot);var r=nE.zr(i.targetId,n.snapshot);s.push(r)}}))}),[4,Promise.all(e)];case 1:return t.sent(),this.nd.Ga(o),[4,this.zf.xo(s)];case 2:return t.sent(),[2]}})})},XT.prototype.dd=function(t){H_(null!==this.nd,"Trying to call "+t+" before calling subscribe().")},XT.prototype.Pl=function(r){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return e=!this.currentUser.isEqual(r),this.currentUser=r,e?(this.Ed("'waitForPendingWrites' promise is rejected due to a user change."),[4,this.zf.ro(r)]):[3,3];case 1:return n=t.sent(),this.td.ro(r,n.ho,n.co),[4,this.pd(n.oo)];case 2:t.sent(),t.label=3;case 3:return[4,this.Kl.Pl()];case 4:return t.sent(),[2]}})})},XT.prototype.kl=function(u){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a=this;return Ss(this,function(t){switch(t.label){case 0:return!0!==u||!0===this.isPrimary?[3,3]:(this.isPrimary=!0,[4,this.Kl.kl(!0)]);case 1:return t.sent(),o=this.td.Ch(),[4,this.Cd(o.nt())];case 2:for(e=t.sent(),n=0,r=e;n<r.length;n++)i=r[n],this.Kl.listen(i);return[3,7];case 3:return!1!==u||!1===this.isPrimary?[3,7]:(this.isPrimary=!1,o=[],s=Promise.resolve(),bg(this.rd,function(t,e){a.td.jh(t)?o.push(t):s=s.then(function(){return a.gd(t),a.zf.zo(t,!0)}),a.Kl.wl(t)}),[4,s]);case 4:return t.sent(),[4,this.Cd(o)];case 5:return t.sent(),this.Pd(),[4,this.Kl.kl(!1)];case 6:t.sent(),t.label=7;case 7:return[2]}})})},XT.prototype.Pd=function(){var e=this;bg(this.sd,function(t){e.Kl.wl(t)}),this.od.Ss(),this.sd=[],this.ud=new om(im.W)},XT.prototype.Cd=function(d){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l,f,p;return Ss(this,function(t){switch(t.label){case 0:e=[],n=[],r=0,i=d,t.label=1;case 1:return r<i.length?(o=i[r],s=void 0,(a=this.rd[o])&&0!==a.length?[4,this.zf.zo(o,!0)]:[3,8]):[3,14];case 2:return t.sent(),[4,this.zf.Mo(a[0].Yn())];case 3:s=t.sent(),u=0,c=a,t.label=4;case 4:return u<c.length?(h=c[u],H_(!!(l=this.ed.get(h)),"No query view found for "+h),[4,this.wd(l)]):[3,7];case 5:(f=t.sent()).snapshot&&n.push(f.snapshot),t.label=6;case 6:return u++,[3,4];case 7:return[3,12];case 8:return H_(!0===this.isPrimary,"A secondary tab should never have an active target without an active query."),[4,this.zf.ih(o)];case 9:return H_(!!(p=t.sent()),"Target for id "+o+" not found"),[4,this.zf.Mo(p)];case 10:return s=t.sent(),[4,this.vd(this.kd(p),o,!1)];case 11:t.sent(),t.label=12;case 12:e.push(s),t.label=13;case 13:return r++,[3,1];case 14:return this.nd.Ga(n),[2,e]}})})},XT.prototype.kd=function(t){return new wb(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)},XT.prototype.$o=function(){return this.zf.$o()},XT.prototype.$h=function(r,i,o){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:if(this.isPrimary)return q_("SyncEngine","Ignoring unexpected query state notification."),[2];if(!this.rd[r])return[3,7];switch(i){case"current":case"not-current":return[3,1];case"rejected":return[3,4]}return[3,6];case 1:return[4,this.zf.eh()];case 2:return e=t.sent(),n=p_.Ai(r,"current"===i),[4,this.pd(e,n)];case 3:return t.sent(),[3,7];case 4:return[4,this.zf.zo(r,!0)];case 5:return t.sent(),this.gd(r,o),[3,7];case 6:W_("Unexpected target state: "+i),t.label=7;case 7:return[2]}})})},XT.prototype.Zh=function(l,f){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h=this;return Ss(this,function(t){switch(t.label){case 0:if(!this.isPrimary)return[2];e=0,n=l,t.label=1;case 1:return e<n.length?(c=n[e],H_(!this.rd[c],"Trying to add an already active target"),[4,this.zf.ih(c)]):[3,6];case 2:return H_(!!(r=t.sent()),"Query data for active target "+c+" not found"),[4,this.zf.Mo(r)];case 3:return i=t.sent(),[4,this.vd(this.kd(r),i.targetId,!1)];case 4:t.sent(),this.Kl.listen(i),t.label=5;case 5:return e++,[3,1];case 6:o=function(e){return Ss(this,function(t){switch(t.label){case 0:return s.rd[e]?[4,s.zf.zo(e,!1).then(function(){h.Kl.wl(e),h.gd(e)}).catch(xE)]:[2,"continue"];case 1:return t.sent(),[2]}})},s=this,a=0,u=f,t.label=7;case 7:return a<u.length?(c=u[a],[5,o(c)]):[3,10];case 8:t.sent(),t.label=9;case 9:return a++,[3,7];case 10:return[2]}})})},XT.prototype.enableNetwork=function(){return this.zf.nh(!0),this.Kl.enableNetwork()},XT.prototype.disableNetwork=function(){return this.zf.nh(!1),this.Kl.disableNetwork()},XT.prototype.ge=function(t){var e=this.sd[t];if(e&&e.Zl)return i_().add(e.key);var n=i_(),r=this.rd[t];if(!r)return n;for(var i=0,o=r;i<o.length;i++){var s=o[i],a=this.ed.get(s);H_(!!a,"No query view found for "+s),n=n.Qt(a.view.Ul)}return n},XT),WT=(JT.prototype.listen=function(t){var e=t.query,n=!1,r=this.Od.get(e);return r||(n=!0,r=new qT,this.Od.set(e,r)),r.listeners.push(t),H_(!t.Ql(this.onlineState),"applyOnlineStateChange() shouldn't raise an event for brand-new listeners."),r.Nd&&t.Vd(r.Nd)&&this.Ud(),n?this.dh.listen(e).then(function(t){return r.targetId=t}):Promise.resolve(r.targetId)},JT.prototype.wl=function(o){return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){return e=o.query,n=!1,(r=this.Od.get(e))&&0<=(i=r.listeners.indexOf(o))&&(r.listeners.splice(i,1),n=0===r.listeners.length),n?(this.Od.delete(e),[2,this.dh.wl(e)]):[2]})})},JT.prototype.Ga=function(t){for(var e=!1,n=0,r=t;n<r.length;n++){var i=r[n],o=i.query,s=this.Od.get(o);if(s){for(var a=0,u=s.listeners;a<u.length;a++)u[a].Vd(i)&&(e=!0);s.Nd=i}}e&&this.Ud()},JT.prototype.Dd=function(t,e){var n=this.Od.get(t);if(n)for(var r=0,i=n.listeners;r<i.length;r++)i[r].onError(e);this.Od.delete(t)},JT.prototype.yd=function(i){this.onlineState=i;var o=!1;this.Od.forEach(function(t,e){for(var n=0,r=e.listeners;n<r.length;n++)r[n].Ql(i)&&(o=!0)}),o&&this.Ud()},JT.prototype.xd=function(t){this.Fd.add(t),t.next()},JT.prototype.jd=function(t){this.Fd.delete(t)},JT.prototype.Ud=function(){this.Fd.forEach(function(t){t.next()})},JT),HT=(YT.prototype.Vd=function(t){if(H_(0<t.docChanges.length||t._i,"We got a new snapshot with no changes?"),!this.options.includeMetadataChanges){for(var e=[],n=0,r=t.docChanges;n<r.length;n++){var i=r[n];3!==i.type&&e.push(i)}t=new f_(t.query,t.docs,t.pi,e,t.yi,t.fromCache,t._i,!0)}var o=!1;return this.qd?this.Md(t)&&(this.Ld.next(t),o=!0):this.Qd(t,this.onlineState)&&(this.Gd(t),o=!0),this.Bd=t,o},YT.prototype.onError=function(t){this.Ld.error(t)},YT.prototype.Ql=function(t){this.onlineState=t;var e=!1;return this.Bd&&!this.qd&&this.Qd(this.Bd,t)&&(this.Gd(this.Bd),e=!0),e},YT.prototype.Qd=function(t,e){if(H_(!this.qd,"Determining whether to raise first event but already had first event"),!t.fromCache)return!0;var n="Offline"!==e;return this.options.Wd&&n?(H_(t.fromCache,"Waiting for sync, but snapshot is not from cache"),!1):!t.docs.Y()||"Offline"===e},YT.prototype.Md=function(t){if(0<t.docChanges.length)return!0;var e=this.Bd&&this.Bd.hasPendingWrites!==t.hasPendingWrites;return!(!t._i&&!e)&&!0===this.options.includeMetadataChanges},YT.prototype.Gd=function(t){H_(!this.qd,"Trying to raise initial events for second time"),t=f_.Ti(t.query,t.docs,t.yi,t.fromCache),this.qd=!0,this.Ld.next(t)},YT),KT=(QT.prototype.start=function(e,n){var r=this;this.Kd();var i=new X_,o=new X_,s=!1;return this.credentials.v(function(t){s?r.$r.ou(function(){return r.Pl(t)}):(s=!0,r.Hd(e,n,t,o).then(function(){return r.Jd(t)}).then(i.resolve,i.reject))}),this.$r.ou(function(){return i.promise}),o.promise},QT.prototype.enableNetwork=function(){var t=this;return this.Kd(),this.$r.enqueue(function(){return t.dh.enableNetwork()})},QT.prototype.Hd=function(n,r,i,o){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,n.initialize(this.$r,this.zd,this.platform,this.clientId,i,r)];case 1:return t.sent(),this.persistence=n.la(),this.Yd=n.fa(),this.td=n.da(),o.resolve(),[3,3];case 2:if(e=t.sent(),o.reject(e),!this.Xd(e))throw e;return console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+e),[2,this.Hd(new CI,{aa:!1},i,o)];case 3:return[2]}})})},QT.prototype.Xd=function(t){return"FirebaseError"===t.name?t.code===og.FAILED_PRECONDITION||t.code===og.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code},QT.prototype.Kd=function(){if(this.$r.vu)throw new sg(og.FAILED_PRECONDITION,"The client has already been terminated.")},QT.prototype.Jd=function(c){var t=this;return q_("FirestoreClient","Initializing. user=",c.uid),this.platform.$d(this.zd).then(function(u){return Ts(t,void 0,void 0,function(){var e,n,r,i,o,s,a=this;return Ss(this,function(t){switch(t.label){case 0:return e=new tI,this.zf=new SE(this.persistence,e,c),[4,this.zf.start()];case 1:return t.sent(),n=this.platform.Zd(),r=this.platform.tv(this.zd.Dn),i=new OI(this.$r,u,this.credentials,r),o=function(t){return a.dh.Ql(t,0)},s=function(t){return a.dh.Ql(t,1)},this.Kl=new DT(this.zf,i,this.$r,o,n),this.dh=new BT(this.zf,this.Kl,this.td,c),this.td.vh=s,this.Kl.dh=this.dh,this.td.dh=this.dh,this.nv=new WT(this.dh),[4,this.td.start()];case 2:return t.sent(),[4,this.Kl.start()];case 3:return t.sent(),[4,this.persistence.na(function(e){return Ts(a,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,this.dh.kl(e)];case 1:return t.sent(),e&&!this.Yd.ss?this.Yd.start(this.zf):e||this.Yd.stop(),[2]}})})})];case 4:return t.sent(),[4,this.persistence.ia(function(){return Ts(a,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,this.terminate()];case 1:return t.sent(),[2]}})})})];case 5:return t.sent(),[2]}})})})},QT.prototype.Pl=function(t){return this.$r.Iu(),q_("FirestoreClient","Credential Changed. Current user: "+t.uid),this.dh.Pl(t)},QT.prototype.disableNetwork=function(){var t=this;return this.Kd(),this.$r.enqueue(function(){return t.dh.disableNetwork()})},QT.prototype.terminate=function(){var t=this;return this.$r.pu(function(){return Ts(t,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.Yd.stop(),[4,this.Kl.shutdown()];case 1:return t.sent(),[4,this.td.shutdown()];case 2:return t.sent(),[4,this.persistence.shutdown()];case 3:return t.sent(),this.credentials.m(),[2]}})})})},QT.prototype.waitForPendingWrites=function(){var t=this;this.Kd();var e=new X_;return this.$r.ou(function(){return t.dh.Td(e)}),e.promise},QT.prototype.listen=function(t,e,n){var r=this;this.Kd();var i=new HT(t,e,n);return this.$r.ou(function(){return r.nv.listen(i)}),i},QT.prototype.wl=function(t){var e=this;this.iv||this.$r.ou(function(){return e.nv.wl(t)})},QT.prototype.ev=function(t){var e=this;return this.Kd(),this.$r.enqueue(function(){return e.zf.qo(t)}).then(function(t){if(t instanceof Ww)return t;if(t instanceof Hw)return null;throw new sg(og.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.)")})},QT.prototype.rv=function(i){var t=this;return this.Kd(),this.$r.enqueue(function(){return Ts(t,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return[4,this.zf.Ko(i,!0)];case 1:return e=t.sent(),n=new PT(i,e.Yo),r=n.xl(e.documents),[2,n.qs(r,!1).snapshot]}})})})},QT.prototype.write=function(t){var e=this;this.Kd();var n=new X_;return this.$r.ou(function(){return e.dh.write(t,n)}),n.promise},QT.prototype.Dn=function(){return this.zd.Dn},QT.prototype.xd=function(t){var e=this;this.Kd(),this.$r.ou(function(){return e.nv.xd(t),Promise.resolve()})},QT.prototype.jd=function(t){this.iv||this.nv.jd(t)},Object.defineProperty(QT.prototype,"iv",{get:function(){return this.$r.vu},enumerable:!0,configurable:!0}),QT.prototype.transaction=function(t){var e=this;this.Kd();var n=new X_;return this.$r.ou(function(){return e.dh.runTransaction(e.$r,t,n),Promise.resolve()}),n.promise},QT),GT=(zT.prototype.next=function(t){this.uv(this.observer.next,t)},zT.prototype.error=function(t){this.uv(this.observer.error,t)},zT.prototype.sv=function(){this.muted=!0},zT.prototype.uv=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},zT);function zT(t){this.observer=t,this.muted=!1}function QT(t,e,n,r){this.platform=t,this.zd=e,this.credentials=n,this.$r=r,this.clientId=K_.Ur()}function YT(t,e,n){this.query=t,this.Ld=e,this.qd=!1,this.Bd=null,this.onlineState="Unknown",this.options=n||{}}function JT(t){this.dh=t,this.Od=new eE(function(t){return t.canonicalId()}),this.onlineState="Unknown",this.Fd=new Set,this.dh.subscribe(this)}function XT(t,e,n,r){this.zf=t,this.Kl=e,this.td=n,this.currentUser=r,this.nd=null,this.ed=new eE(function(t){return t.canonicalId()}),this.rd={},this.ud=new om(im.W),this.sd={},this.od=new EE,this.hd={},this.ad=new Map,this.fd=bI.Bc(),this.isPrimary=void 0,this.onlineState="Unknown"}function $T(t,e,n,r){this.$r=t,this.Kl=e,this.updateFunction=n,this.iu=r,this.Hl=5,this.Sa=new NI(this.$r,"retry_transaction")}function ZT(i){return function(){if("object"!=typeof i||null===i)return!1;for(var t=i,e=0,n=["next","error","complete"];e<n.length;e++){var r=n[e];if(r in t&&"function"==typeof t[r])return!0}return!1}()}var tS,eS=wE.Xu,nS=(_S.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.timestampsInSnapshots===t.timestampsInSnapshots&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.forceLongPolling===t.forceLongPolling},_S),rS=(bS.prototype.settings=function(t){if(Tg("Firestore.settings",arguments,1),Ng("Firestore.settings","object",1,t),mg(t,"persistence"))throw new sg(og.INVALID_ARGUMENT,'"persistence" is now specified with a separate call to firestore.enablePersistence().');var e=new nS(t);if(this.av&&!this.mv.isEqual(e))throw new sg(og.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.");void 0!==(this.mv=e).credentials&&(this.vv=function(t){if(!t)return new ag;switch(t.type){case"gapi":var e=t.S;return H_(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty),"unexpected gapi interface"),new hg(e,t.D||"0");case"provider":return t.S;default:throw new sg(og.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(e.credentials))},bS.prototype.enableNetwork=function(){return this.cv(),this.av.enableNetwork()},bS.prototype.disableNetwork=function(){return this.cv(),this.av.disableNetwork()},bS.prototype.enablePersistence=function(t){if(this.av)throw new sg(og.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.");var e=!1;return t&&(void 0!==t.experimentalTabSynchronization&&V_("The 'experimentalTabSynchronization' setting has been renamed to 'synchronizeTabs'. In a future release, the setting will be removed and it is recommended that you update your firestore.enablePersistence() call to use 'synchronizeTabs'."),e=wg(void 0!==t.synchronizeTabs?t.synchronizeTabs:t.experimentalTabSynchronization,!1)),this.pv(this.wv,{aa:!0,cacheSizeBytes:this.mv.cacheSizeBytes,synchronizeTabs:e})},bS.prototype.clearPersistence=function(){return Ts(this,void 0,void 0,function(){var r,e=this;return Ss(this,function(t){if(void 0!==this.av&&!this.av.iv)throw new sg(og.FAILED_PRECONDITION,"Persistence cannot be cleared after this Firestore instance is initialized.");return r=new X_,this.hv.wu(function(){return Ts(e,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=this.yv(),[4,this.wv.clearPersistence(e)];case 1:return t.sent(),r.resolve(),[3,3];case 2:return n=t.sent(),r.reject(n),[3,3];case 3:return[2]}})})}),[2,r.promise]})})},bS.prototype.terminate=function(){return this.app._removeServiceInstance("firestore"),this.INTERNAL.delete()},Object.defineProperty(bS.prototype,"_v",{get:function(){return this.cv(),this.av.iv},enumerable:!0,configurable:!0}),bS.prototype.waitForPendingWrites=function(){return this.cv(),this.av.waitForPendingWrites()},bS.prototype.onSnapshotsInSync=function(t){if(this.cv(),ZT(t))return this.Iv(t);Ng("Firestore.onSnapshotsInSync","function",1,t);var e={next:t};return this.Iv(e)},bS.prototype.Iv=function(t){var e=this,n=new GT({next:function(){t.next&&t.next()},error:function(t){throw W_("Uncaught Error in onSnapshotsInSync")}});return this.av.xd(n),function(){n.sv(),e.av.jd(n)}},bS.prototype.cv=function(){return this.av||this.pv(new CI,{aa:!1}),this.av},bS.prototype.yv=function(){return new J_(this.fv,this.dv,this.mv.host,this.mv.ssl,this.mv.forceLongPolling)},bS.prototype.pv=function(t,e){H_(!!this.mv.host,"FirestoreSettings.host is not set"),H_(!this.av,"configureClient() called multiple times");var n=this.yv();return this.av=new KT(x_.C(),n,this.vv,this.hv),this.av.start(t,e)},bS.prototype.bv=function(r){return new bT(function(t){if(t instanceof sS){var e=r,n=t.firestore.fv;if(!n.isEqual(e))throw new sg(og.INVALID_ARGUMENT,"Document reference is for database "+n.projectId+"/"+n.database+" but should be for database "+e.projectId+"/"+e.database);return new wT(r,t.Tv)}return t})},bS.lv=function(t){var e=t.options;if(!mg(e,"projectId"))throw new sg(og.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');var n=e.projectId;if(!n||"string"!=typeof n)throw new sg(og.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new $_(n)},Object.defineProperty(bS.prototype,"app",{get:function(){if(!this.ov)throw new sg(og.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.ov},enumerable:!0,configurable:!0}),bS.prototype.collection=function(t){return Tg("Firestore.collection",arguments,1),Ng("Firestore.collection","non-empty string",1,t),this.cv(),new IS(em.et(t),this)},bS.prototype.doc=function(t){return Tg("Firestore.doc",arguments,1),Ng("Firestore.doc","non-empty string",1,t),this.cv(),sS.Ev(em.et(t),this)},bS.prototype.collectionGroup=function(t){if(Tg("Firestore.collectionGroup",arguments,1),Ng("Firestore.collectionGroup","non-empty string",1,t),0<=t.indexOf("/"))throw new sg(og.INVALID_ARGUMENT,"Invalid collection ID '"+t+"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.");return this.cv(),new hS(new wb(em.rt,t),this)},bS.prototype.runTransaction=function(e){var n=this;return Tg("Firestore.runTransaction",arguments,1),Ng("Firestore.runTransaction","function",1,e),this.cv().transaction(function(t){return e(new iS(n,t))})},bS.prototype.batch=function(){return this.cv(),new oS(this)},Object.defineProperty(bS,"logLevel",{get:function(){switch(U_()){case 0:return"debug";case 1:return"error";case 2:return"silent";default:return W_("Unknown log level: "+U_())}},enumerable:!0,configurable:!0}),bS.setLogLevel=function(t){switch(Tg("Firestore.setLogLevel",arguments,1),Ng("Firestore.setLogLevel","non-empty string",1,t),t){case"debug":j_(0);break;case"error":j_(1);break;case"silent":j_(2);break;default:throw new sg(og.INVALID_ARGUMENT,"Invalid log level: "+t)}},bS.prototype.Dv=function(){return this.mv.timestampsInSnapshots},bS),iS=(wS.prototype.get=function(t){var n=this;Tg("Transaction.get",arguments,1);var r=AS("Transaction.get",t,this.Rv);return this.Sv.lookup([r.Tv]).then(function(t){if(!t||1!==t.length)return W_("Mismatch in docs returned from document lookup.");var e=t[0];if(e instanceof Hw)return new uS(n.Rv,r.Tv,null,!1,!1,r.Av);if(e instanceof Ww)return new uS(n.Rv,r.Tv,e,!1,!1,r.Av);throw W_("BatchGetDocumentsRequest returned unexpected document type: "+e.constructor.name)})},wS.prototype.set=function(t,e,n){Cg("Transaction.set",arguments,2,3);var r=AS("Transaction.set",t,this.Rv);n=SS("Transaction.set",n);var i=kS(r.Av,e,"Transaction.set"),o=i[0],s=i[1],a=n.merge||n.mergeFields?this.Rv.gv.yf(s,o,n.mergeFields):this.Rv.gv.bf(s,o);return this.Sv.set(r.Tv,a),this},wS.prototype.update=function(t,e,n){for(var r,i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return i="string"==typeof e||e instanceof DI?(Sg("Transaction.update",arguments,3),r=AS("Transaction.update",t,this.Rv),this.Rv.gv.Tf("Transaction.update",e,n,o)):(Tg("Transaction.update",arguments,2),r=AS("Transaction.update",t,this.Rv),this.Rv.gv._f("Transaction.update",e)),this.Sv.update(r.Tv,i),this},wS.prototype.delete=function(t){Tg("Transaction.delete",arguments,1);var e=AS("Transaction.delete",t,this.Rv);return this.Sv.delete(e.Tv),this},wS),oS=(mS.prototype.set=function(t,e,n){Cg("WriteBatch.set",arguments,2,3),this.kv();var r=AS("WriteBatch.set",t,this.Rv);n=SS("WriteBatch.set",n);var i=kS(r.Av,e,"WriteBatch.set"),o=i[0],s=i[1],a=n.merge||n.mergeFields?this.Rv.gv.yf(s,o,n.mergeFields):this.Rv.gv.bf(s,o);return this.Cv=this.Cv.concat(a.hf(r.Tv,Km.NONE)),this},mS.prototype.update=function(t,e,n){for(var r,i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return this.kv(),i="string"==typeof e||e instanceof DI?(Sg("WriteBatch.update",arguments,3),r=AS("WriteBatch.update",t,this.Rv),this.Rv.gv.Tf("WriteBatch.update",e,n,o)):(Tg("WriteBatch.update",arguments,2),r=AS("WriteBatch.update",t,this.Rv),this.Rv.gv._f("WriteBatch.update",e)),this.Cv=this.Cv.concat(i.hf(r.Tv,Km.exists(!0))),this},mS.prototype.delete=function(t){Tg("WriteBatch.delete",arguments,1),this.kv();var e=AS("WriteBatch.delete",t,this.Rv);return this.Cv=this.Cv.concat(new Jm(e.Tv,Km.NONE)),this},mS.prototype.commit=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){return this.kv(),this.Pv=!0,0<this.Cv.length?[2,this.Rv.cv().write(this.Cv)]:[2]})})},mS.prototype.kv=function(){if(this.Pv)throw new sg(og.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},mS),sS=(gS.Ev=function(t,e,n){if(t.length%2!=0)throw new sg(og.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.it()+" has "+t.length);return new gS(new im(t),e,n)},Object.defineProperty(gS.prototype,"id",{get:function(){return this.Tv.path.$()},enumerable:!0,configurable:!0}),Object.defineProperty(gS.prototype,"parent",{get:function(){return new IS(this.Tv.path.J(),this.firestore,this.Av)},enumerable:!0,configurable:!0}),Object.defineProperty(gS.prototype,"path",{get:function(){return this.Tv.path.it()},enumerable:!0,configurable:!0}),gS.prototype.collection=function(t){if(Tg("DocumentReference.collection",arguments,1),Ng("DocumentReference.collection","non-empty string",1,t),!t)throw new sg(og.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var e=em.et(t);return new IS(this.Tv.path.child(e),this.firestore)},gS.prototype.isEqual=function(t){if(!(t instanceof gS))throw Fg("isEqual","DocumentReference",1,t);return this.firestore===t.firestore&&this.Tv.isEqual(t.Tv)&&this.Av===t.Av},gS.prototype.set=function(t,e){Cg("DocumentReference.set",arguments,1,2),e=SS("DocumentReference.set",e);var n=kS(this.Av,t,"DocumentReference.set"),r=n[0],i=n[1],o=e.merge||e.mergeFields?this.firestore.gv.yf(i,r,e.mergeFields):this.firestore.gv.bf(i,r);return this.av.write(o.hf(this.Tv,Km.NONE))},gS.prototype.update=function(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return n="string"==typeof t||t instanceof DI?(Sg("DocumentReference.update",arguments,2),this.firestore.gv.Tf("DocumentReference.update",t,e,r)):(Tg("DocumentReference.update",arguments,1),this.firestore.gv._f("DocumentReference.update",t)),this.av.write(n.hf(this.Tv,Km.exists(!0)))},gS.prototype.delete=function(){return Tg("DocumentReference.delete",arguments,0),this.av.write([new Jm(this.Tv,Km.NONE)])},gS.prototype.onSnapshot=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];Cg("DocumentReference.onSnapshot",arguments,1,4);var n,r={includeMetadataChanges:!1},i=0;"object"!=typeof t[i]||ZT(t[i])||(Mg("DocumentReference.onSnapshot",r=t[i],["includeMetadataChanges"]),Rg("DocumentReference.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++);var o={includeMetadataChanges:r.includeMetadataChanges};return n=ZT(t[i])?t[i]:(Ng("DocumentReference.onSnapshot","function",i,t[i]),Ag("DocumentReference.onSnapshot","function",i+1,t[i+1]),Ag("DocumentReference.onSnapshot","function",i+2,t[i+2]),{next:t[i],error:t[i+1],complete:t[i+2]}),this.Nv(o,n)},gS.prototype.Nv=function(t,n){var r=this,e=function(t){console.error("Uncaught Error in onSnapshot:",t)};n.error&&(e=n.error.bind(n));var i=new GT({next:function(t){if(n.next){H_(t.docs.size<=1,"Too many documents returned on a document query");var e=t.docs.get(r.Tv);n.next(new uS(r.firestore,r.Tv,e,t.fromCache,t.hasPendingWrites,r.Av))}},error:e}),o=this.av.listen(wb.jn(this.Tv.path),i,t);return function(){i.sv(),r.av.wl(o)}},gS.prototype.get=function(n){var r=this;return Cg("DocumentReference.get",arguments,0,1),NS("DocumentReference.get",n),new Promise(function(e,t){n&&"cache"===n.source?r.firestore.cv().ev(r.Tv).then(function(t){e(new uS(r.firestore,r.Tv,t,!0,t instanceof Ww&&t.rn,r.Av))},t):r.Ov(e,t,n)})},gS.prototype.Ov=function(e,n,r){var i=this.Nv({includeMetadataChanges:!0,Wd:!0},{next:function(t){i(),!t.exists&&t.metadata.fromCache?n(new sg(og.UNAVAILABLE,"Failed to get document because the client is offline.")):t.exists&&t.metadata.fromCache&&r&&"server"===r.source?n(new sg(og.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.)')):e(t)},error:n})},gS.prototype.withConverter=function(t){return new gS(this.Tv,this.firestore,t)},gS),aS=(yS.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},yS),uS=(vS.prototype.data=function(t){if(Cg("DocumentSnapshot.data",arguments,0,1),t=CS("DocumentSnapshot.data",t),this.Fv){if(this.Av){var e=new cS(this.Rv,this.Tv,this.Fv,this.Vv,this.Uv);return this.Av.fromFirestore(e,t)}return this.xv(this.Fv.data(),$m.gn(t,this.Rv.Dv()))}},vS.prototype.get=function(t,e){if(Cg("DocumentSnapshot.get",arguments,1,2),e=CS("DocumentSnapshot.get",e),this.Fv){var n=this.Fv.data().field(ST("DocumentSnapshot.get",t));if(null!==n)return this.jv(n,$m.gn(e,this.Rv.Dv()))}},Object.defineProperty(vS.prototype,"id",{get:function(){return this.Tv.path.$()},enumerable:!0,configurable:!0}),Object.defineProperty(vS.prototype,"ref",{get:function(){return new sS(this.Tv,this.Rv,this.Av)},enumerable:!0,configurable:!0}),Object.defineProperty(vS.prototype,"exists",{get:function(){return null!==this.Fv},enumerable:!0,configurable:!0}),Object.defineProperty(vS.prototype,"metadata",{get:function(){return new aS(this.Uv,this.Vv)},enumerable:!0,configurable:!0}),vS.prototype.isEqual=function(t){if(!(t instanceof vS))throw Fg("isEqual","DocumentSnapshot",1,t);return this.Rv===t.Rv&&this.Vv===t.Vv&&this.Tv.isEqual(t.Tv)&&(null===this.Fv?null===t.Fv:this.Fv.isEqual(t.Fv))&&this.Av===t.Av},vS.prototype.xv=function(t,n){var r=this,i={};return t.forEach(function(t,e){i[t]=r.jv(e,n)}),i},vS.prototype.jv=function(t,e){if(t instanceof jw)return this.xv(t,e);if(t instanceof Vw)return this.Lv(t,e);if(t instanceof Fw){var n=t.value(e),r=this.Rv.cv().Dn();return t.Dn.isEqual(r)||V_("Document "+this.Tv.path+" contains a document reference within a different database ("+t.Dn.projectId+"/"+t.Dn.database+") which is not supported. It will be treated as a reference in the current database ("+r.projectId+"/"+r.database+") instead."),new sS(n,this.Rv,this.Av)}return t.value(e)},vS.prototype.Lv=function(t,e){var n=this;return t.Jt.map(function(t){return n.jv(t,e)})},vS),cS=(Es(dS,tS=uS),dS.prototype.data=function(t){var e=tS.prototype.data.call(this,t);return H_(void 0!==e,"Document in a QueryDocumentSnapshot should exist"),e},dS),hS=(pS.prototype.where=function(t,e,n){var r;Tg("Query.where",arguments,3),Lg("Query.where",3,n),function(t,e,n,r){if(!e.some(function(t){return t===r}))throw new sg(og.INVALID_ARGUMENT,"Invalid value "+xg(r)+" provided to function "+t+"() for its "+jg(n)+" argument. Acceptable values: "+e.join(", "))}("Query.where",["<","<=","==",">=",">","array-contains","in","array-contains-any"],2,e);var i=ST("Query.where",t),o=bb.et(e);if(i.st()){if(o===bb.ARRAY_CONTAINS||o===bb.ARRAY_CONTAINS_ANY)throw new sg(og.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+o.toString()+"' queries on FieldPath.documentId().");if(o===bb.IN){this.Bv(n,o);for(var s=[],a=0,u=n;a<u.length;a++){var c=u[a];s.push(this.Mv(c))}r=new Vw(s)}else r=this.Mv(n)}else o!==bb.IN&&o!==bb.ARRAY_CONTAINS_ANY||this.Bv(n,o),r=this.firestore.gv.Ef("Query.where",n,o===bb.IN);var h=_b.create(i,o,r);return this.Qv(h),new pS(this.qv.Bn(h),this.firestore,this.Av)},pS.prototype.orderBy=function(t,e){var n;if(Cg("Query.orderBy",arguments,1,2),Ag("Query.orderBy","non-empty string",2,e),void 0===e||"asc"===e)n=Nb.ASCENDING;else{if("desc"!==e)throw new sg(og.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+e+"', expected 'asc' or 'desc'.");n=Nb.DESCENDING}if(null!==this.qv.startAt)throw new sg(og.INVALID_ARGUMENT,"Invalid query. You must not call Query.startAt() or Query.startAfter() before calling Query.orderBy().");if(null!==this.qv.endAt)throw new sg(og.INVALID_ARGUMENT,"Invalid query. You must not call Query.endAt() or Query.endBefore() before calling Query.orderBy().");var r=ST("Query.orderBy",t),i=new kb(r,n);return this.Gv(i),new pS(this.qv.Qn(i),this.firestore,this.Av)},pS.prototype.limit=function(t){return Tg("Query.limit",arguments,1),Ng("Query.limit","number",1,t),Ug("Query.limit",1,t),new pS(this.qv.Gn(t),this.firestore,this.Av)},pS.prototype.limitToLast=function(t){return Tg("Query.limitToLast",arguments,1),Ng("Query.limitToLast","number",1,t),Ug("Query.limitToLast",1,t),new pS(this.qv.Wn(t),this.firestore,this.Av)},pS.prototype.startAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];Sg("Query.startAt",arguments,1);var r=this.Wv("Query.startAt",t,e,!0);return new pS(this.qv.zn(r),this.firestore,this.Av)},pS.prototype.startAfter=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];Sg("Query.startAfter",arguments,1);var r=this.Wv("Query.startAfter",t,e,!1);return new pS(this.qv.zn(r),this.firestore,this.Av)},pS.prototype.endBefore=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];Sg("Query.endBefore",arguments,1);var r=this.Wv("Query.endBefore",t,e,!0);return new pS(this.qv.Kn(r),this.firestore,this.Av)},pS.prototype.endAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];Sg("Query.endAt",arguments,1);var r=this.Wv("Query.endAt",t,e,!1);return new pS(this.qv.Kn(r),this.firestore,this.Av)},pS.prototype.isEqual=function(t){if(!(t instanceof pS))throw Fg("isEqual","Query",1,t);return this.firestore===t.firestore&&this.qv.isEqual(t.qv)},pS.prototype.withConverter=function(t){return new pS(this.qv,this.firestore,t)},pS.prototype.Wv=function(t,e,n,r){if(Lg(t,1,e),e instanceof uS){if(0<n.length)throw new sg(og.INVALID_ARGUMENT,"Too many arguments provided to "+t+"().");var i=e;if(!i.exists)throw new sg(og.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+t+"().");return this.zv(t,i.Fv,r)}var o=[e].concat(n);return this.Kv(t,o,r)},pS.prototype.zv=function(t,e,n){for(var r=[],i=0,o=this.qv.orderBy;i<o.length;i++){var s=o[i];if(s.field.st())r.push(new Fw(this.firestore.fv,e.key));else{var a=e.field(s.field);if(a instanceof Lw)throw new sg(og.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===a){var u=s.field.it();throw new sg(og.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+u+"' (used as the orderBy) does not exist.")}r.push(a)}}return new Ab(r,n)},pS.prototype.Kv=function(t,e,n){var r=this.qv.On;if(e.length>r.length)throw new sg(og.INVALID_ARGUMENT,"Too many arguments provided to "+t+"(). The number of arguments must be less than or equal to the number of Query.orderBy() clauses");for(var i=[],o=0;o<e.length;o++){var s=e[o];if(r[o].field.st()){if("string"!=typeof s)throw new sg(og.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+t+"(), but got a "+typeof s);if(!this.qv.ui()&&-1!==s.indexOf("/"))throw new sg(og.INVALID_ARGUMENT,"Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to "+t+"() must be a plain document ID, but '"+s+"' contains a slash.");var a=this.qv.path.child(em.et(s));if(!im.ct(a))throw new sg(og.INVALID_ARGUMENT,"Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to "+t+"() must result in a valid document path, but '"+a+"' is not because it contains an odd number of segments.");var u=new im(a);i.push(new Fw(this.firestore.fv,u))}else{var c=this.firestore.gv.Ef(t,s);i.push(c)}}return new Ab(i,n)},pS.prototype.onSnapshot=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];Cg("Query.onSnapshot",arguments,1,4);var n,r={},i=0;return"object"!=typeof t[i]||ZT(t[i])||(Mg("Query.onSnapshot",r=t[i],["includeMetadataChanges"]),Rg("Query.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++),n=ZT(t[i])?t[i]:(Ng("Query.onSnapshot","function",i,t[i]),Ag("Query.onSnapshot","function",i+1,t[i+1]),Ag("Query.onSnapshot","function",i+2,t[i+2]),{next:t[i],error:t[i+1],complete:t[i+2]}),this.Hv(this.qv),this.Nv(r,n)},pS.prototype.Nv=function(t,e){var n=this,r=function(t){console.error("Uncaught Error in onSnapshot:",t)};e.error&&(r=e.error.bind(e));var i=new GT({next:function(t){e.next&&e.next(new lS(n.firestore,n.qv,t,n.Av))},error:r}),o=this.firestore.cv(),s=o.listen(this.qv,i,t);return function(){i.sv(),o.wl(s)}},pS.prototype.Hv=function(t){if(t.ei()&&0===t.On.length)throw new sg(og.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")},pS.prototype.get=function(n){var r=this;return Cg("Query.get",arguments,0,1),NS("Query.get",n),this.Hv(this.qv),new Promise(function(e,t){n&&"cache"===n.source?r.firestore.cv().rv(r.qv).then(function(t){e(new lS(r.firestore,r.qv,t,r.Av))},t):r.Ov(e,t,n)})},pS.prototype.Ov=function(e,n,r){var i=this.Nv({includeMetadataChanges:!0,Wd:!0},{next:function(t){i(),t.metadata.fromCache&&r&&"server"===r.source?n(new sg(og.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.)')):e(t)},error:n})},pS.prototype.Mv=function(t){if("string"==typeof t){if(""===t)throw new sg(og.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!this.qv.ui()&&-1!==t.indexOf("/"))throw new sg(og.INVALID_ARGUMENT,"Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '"+t+"' contains a '/' character.");var e=this.qv.path.child(em.et(t));if(!im.ct(e))throw new sg(og.INVALID_ARGUMENT,"Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '"+e+"' is not because it has an odd number of segments ("+e.length+").");return new Fw(this.firestore.fv,new im(e))}if(t instanceof sS){var n=t;return new Fw(this.firestore.fv,n.Tv)}throw new sg(og.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+xg(t)+".")},pS.prototype.Bv=function(t,e){if(!Array.isArray(t)||0===t.length)throw new sg(og.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(10<t.length)throw new sg(og.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.");if(0<=t.indexOf(null))throw new sg(og.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'null' in the value array.");if(0<t.filter(function(t){return Number.isNaN(t)}).length)throw new sg(og.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'NaN' in the value array.")},pS.prototype.Qv=function(t){if(t instanceof _b){var e=[bb.ARRAY_CONTAINS,bb.ARRAY_CONTAINS_ANY],n=[bb.IN,bb.ARRAY_CONTAINS_ANY],r=0<=e.indexOf(t.op),i=0<=n.indexOf(t.op);if(t.Mn()){var o=this.qv.Ln();if(null!==o&&!o.isEqual(t.field))throw new sg(og.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+o.toString()+"' and '"+t.field.toString()+"'");var s=this.qv.qn();null!==s&&this.Jv(t.field,s)}else if(i||r){var a=null;if(i&&(a=this.qv.ri(n)),null===a&&r&&(a=this.qv.ri(e)),null!=a)throw a===t.op?new sg(og.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+t.op.toString()+"' filter."):new sg(og.INVALID_ARGUMENT,"Invalid query. You cannot use '"+t.op.toString()+"' filters with '"+a.toString()+"' filters.")}}},pS.prototype.Gv=function(t){if(null===this.qv.qn()){var e=this.qv.Ln();null!==e&&this.Jv(e,t.field)}},pS.prototype.Jv=function(t,e){if(!e.isEqual(t))throw new sg(og.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+t.toString()+"' and so you must also use '"+t.toString()+"' as your first Query.orderBy(), but your first Query.orderBy() is on field '"+e.toString()+"' instead.")},pS),lS=(Object.defineProperty(fS.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!0,configurable:!0}),Object.defineProperty(fS.prototype,"empty",{get:function(){return this.Xv.docs.Y()},enumerable:!0,configurable:!0}),Object.defineProperty(fS.prototype,"size",{get:function(){return this.Xv.docs.size},enumerable:!0,configurable:!0}),fS.prototype.forEach=function(e,n){var r=this;Cg("QuerySnapshot.forEach",arguments,1,2),Ng("QuerySnapshot.forEach","function",1,e),this.Xv.docs.forEach(function(t){e.call(n,r.tw(t))})},Object.defineProperty(fS.prototype,"query",{get:function(){return new hS(this.Yv,this.Rv,this.Av)},enumerable:!0,configurable:!0}),fS.prototype.docChanges=function(t){t&&(Mg("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),Rg("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var e=!(!t||!t.includeMetadataChanges);if(e&&this.Xv.Ii)throw new sg(og.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.$v&&this.Zv===e||(this.$v=function(i,e,o,s){if(o.pi.Y()){var n,r=0;return o.docChanges.map(function(t){var e=new cS(i,t.doc.key,t.doc,o.fromCache,o.yi.has(t.doc.key),s);return H_(0===t.type,"Invalid event type for first snapshot"),H_(!n||o.query.Xn(n,t.doc)<0,"Got added events in wrong order"),n=t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:r++}})}var a=o.pi;return o.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=new cS(i,t.doc.key,t.doc,o.fromCache,o.yi.has(t.doc.key),s),n=-1,r=-1;return 0!==t.type&&(H_(0<=(n=a.indexOf(t.doc.key)),"Index for document not found"),a=a.delete(t.doc.key)),1!==t.type&&(r=(a=a.add(t.doc)).indexOf(t.doc.key)),{type:function(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return W_("Unknown change type: "+t)}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this.Rv,e,this.Xv,this.Av),this.Zv=e),this.$v},fS.prototype.isEqual=function(t){if(!(t instanceof fS))throw Fg("isEqual","QuerySnapshot",1,t);return this.Rv===t.Rv&&this.Yv.isEqual(t.Yv)&&this.Xv.isEqual(t.Xv)&&this.Av===t.Av},fS.prototype.tw=function(t){return new cS(this.Rv,t.key,t,this.metadata.fromCache,this.Xv.yi.has(t.key),this.Av)},fS);function fS(t,e,n,r){this.Rv=t,this.Yv=e,this.Xv=n,this.Av=r,this.$v=null,this.Zv=null,this.metadata=new aS(n.hasPendingWrites,n.fromCache)}function pS(t,e,n){this.qv=t,this.firestore=e,this.Av=n}function dS(){return null!==tS&&tS.apply(this,arguments)||this}function vS(t,e,n,r,i,o){this.Rv=t,this.Tv=e,this.Fv=n,this.Vv=r,this.Uv=i,this.Av=o}function yS(t,e){this.hasPendingWrites=t,this.fromCache=e}function gS(t,e,n){this.Tv=t,this.firestore=e,this.Av=n,this.av=this.firestore.cv()}function mS(t){this.Rv=t,this.Cv=[],this.Pv=!1}function wS(t,e){this.Rv=t,this.Sv=e}function bS(t,e,n){var r=this;if(void 0===n&&(n=new CI),this.ov=null,this.hv=new oE,this.INTERNAL={delete:function(){return Ts(r,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.cv(),[4,this.av.terminate()];case 1:return t.sent(),[2]}})})}},"object"==typeof t.options){var i=t;this.ov=i,this.fv=bS.lv(i),this.dv=i.name,this.vv=new ug(e)}else{var o=t;if(!o.projectId)throw new sg(og.INVALID_ARGUMENT,"Must provide projectId");this.fv=new $_(o.projectId,o.database),this.dv="[DEFAULT]",this.vv=new ag}this.wv=n,this.mv=new nS({}),this.gv=this.bv(this.fv)}function _S(t){if(void 0===t.host){if(void 0!==t.ssl)throw new sg(og.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else kg("settings","non-empty string","host",t.host),this.host=t.host,Rg("settings","boolean","ssl",t.ssl),this.ssl=wg(t.ssl,!0);if(Mg("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling"]),Rg("settings","object","credentials",t.credentials),this.credentials=t.credentials,Rg("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),!0===t.timestampsInSnapshots?V_("\n The timestampsInSnapshots setting now defaults to true and you no\n longer need to explicitly set it. In a future release, the setting\n will be removed entirely and so it is recommended that you remove it\n from your firestore.settings() call now."):!1===t.timestampsInSnapshots&&V_("\n The timestampsInSnapshots setting will soon be removed. YOU MUST UPDATE\n YOUR CODE.\n\n To hide this warning, stop using the timestampsInSnapshots setting in your\n firestore.settings({ ... }) call.\n\n Once you remove the setting, Timestamps stored in Cloud Firestore will be\n read back as Firebase Timestamp objects instead of as system Date objects.\n So you will also need to update code expecting a Date to instead expect a\n Timestamp. For example:\n\n // Old:\n const date = snapshot.get('created_at');\n // New:\n const timestamp = snapshot.get('created_at'); const date =\n timestamp.toDate();\n\n Please audit all existing usages of Date when you enable the new\n behavior."),this.timestampsInSnapshots=wg(t.timestampsInSnapshots,!0),Rg("settings","number","cacheSizeBytes",t.cacheSizeBytes),void 0===t.cacheSizeBytes)this.cacheSizeBytes=wE.Zu;else{if(t.cacheSizeBytes!==eS&&t.cacheSizeBytes<wE.$u)throw new sg(og.INVALID_ARGUMENT,"cacheSizeBytes must be at least "+wE.$u);this.cacheSizeBytes=t.cacheSizeBytes}Rg("settings","boolean","experimentalForceLongPolling",t.experimentalForceLongPolling),this.forceLongPolling=void 0!==t.experimentalForceLongPolling&&t.experimentalForceLongPolling}ks(["length","forEach","map"],"undefined"!=typeof Symbol?[Symbol.iterator]:[]).forEach(function(t){try{Object.defineProperty(lS.prototype.docChanges,t,{get:function(){return function(){throw new sg(og.INVALID_ARGUMENT,'QuerySnapshot.docChanges has been changed from a property into a method, so usages like "querySnapshot.docChanges" should become "querySnapshot.docChanges()"')}()}})}catch(t){}});var ES,IS=(Es(TS,ES=hS),Object.defineProperty(TS.prototype,"id",{get:function(){return this.qv.path.$()},enumerable:!0,configurable:!0}),Object.defineProperty(TS.prototype,"parent",{get:function(){var t=this.qv.path.J();return t.Y()?null:new sS(new im(t),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(TS.prototype,"path",{get:function(){return this.qv.path.it()},enumerable:!0,configurable:!0}),TS.prototype.doc=function(t){if(Cg("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=K_.Ur()),Ng("CollectionReference.doc","non-empty string",1,t),""===t)throw new sg(og.INVALID_ARGUMENT,"Document path must be a non-empty string");var e=em.et(t);return sS.Ev(this.qv.path.child(e),this.firestore,this.Av)},TS.prototype.add=function(t){Tg("CollectionReference.add",arguments,1),Ng("CollectionReference.add","object",1,this.Av?this.Av.toFirestore(t):t);var e=this.doc();return e.set(t).then(function(){return e})},TS.prototype.withConverter=function(t){return new TS(this.nw,this.firestore,t)},TS);function TS(t,e,n){var r=ES.call(this,wb.jn(t),e,n)||this;if((r.nw=t).length%2!=1)throw new sg(og.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.it()+" has "+t.length);return r}function SS(t,e){if(void 0===e)return{merge:!1};if(Mg(t,e,["merge","mergeFields"]),Rg(t,"boolean","merge",e.merge),function(t,e,n,r,i){void 0!==r&&function(t,e,n,r,i){if(!(r instanceof Array))throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() requires its "+e+" option to be an array, but it was: "+xg(r));for(var o=0;o<r.length;++o)if(!i(r[o]))throw new sg(og.INVALID_ARGUMENT,"Function "+t+"() requires all "+e+" elements to be "+n+", but the value at index "+o+" was: "+xg(r[o]))}(t,e,n,r,i)}(t,"mergeFields","a string or a FieldPath",e.mergeFields,function(t){return"string"==typeof t||t instanceof DI}),void 0!==e.mergeFields&&void 0!==e.merge)throw new sg(og.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');return e}function CS(t,e){return void 0===e?{}:(Mg(t,e,["serverTimestamps"]),Og(t,0,"serverTimestamps",e.serverTimestamps,["estimate","previous","none"]),e)}function NS(t,e){Ag(t,"object",1,e),e&&(Mg(t,e,["source"]),Og(t,0,"source",e.source,["default","server","cache"]))}function AS(t,e,n){if(e instanceof sS){if(e.firestore!==n)throw new sg(og.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}throw Fg(t,"DocumentReference",1,e)}function kS(t,e,n){var r;return t?(r=t.toFirestore(e),n="toFirestore() in "+n):r=e,[r,n]}var RS=gg(rS,"Use firebase.firestore() instead."),OS=gg(iS,"Use firebase.firestore().runTransaction() instead."),DS=gg(oS,"Use firebase.firestore().batch() instead."),PS=gg(sS,"Use firebase.firestore().doc() instead."),xS=gg(uS),LS=gg(cS),MS=gg(hS),FS=gg(lS),US=gg(IS,"Use firebase.firestore().collection() instead."),jS=(GS.ew=function(o,t,s){return H_(GS.ph(),"IndexedDB not supported in current environment."),q_("SimpleDb","Opening database:",o),new sE(function(n,r){var i=window.indexedDB.open(o,t);i.onsuccess=function(t){var e=t.target.result;n(new GS(e))},i.onblocked=function(){r(new sg(og.FAILED_PRECONDITION,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=function(t){var e=t.target.error;"VersionError"===e.name?r(new sg(og.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):r(e)},i.onupgradeneeded=function(t){q_("SimpleDb",'Database "'+o+'" requires upgrade from version:',t.oldVersion);var e=t.target.result;s.createOrUpgrade(e,i.transaction,t.oldVersion,gC).next(function(){q_("SimpleDb","Database upgrade to version "+gC+" complete")})}}).Ou()},GS.delete=function(t){return q_("SimpleDb","Removing database:",t),zS(window.indexedDB.deleteDatabase(t)).Ou()},GS.ph=function(){if("undefined"==typeof window||null==window.indexedDB)return!1;if(GS.rw())return!0;if(void 0===window.navigator)return!1;var t=qs(),e=GS.iw(t),n=0<e&&e<10,r=GS.uw(t),i=0<r&&r<4.5;return!(0<t.indexOf("MSIE ")||0<t.indexOf("Trident/")||0<t.indexOf("Edge/")||n||i)},GS.rw=function(){var t;return"undefined"!=typeof process&&"YES"===(null===(t=process.env)||void 0===t?void 0:t.sw)},GS.ow=function(t,e){return t.store(e)},GS.iw=function(t){var e=t.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=e?e[1].split("_").slice(0,2).join("."):"-1";return Number(n)},GS.uw=function(t){var e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)},GS.prototype.hw=function(e){this.db.onversionchange=function(t){return e(t)}},GS.prototype.runTransaction=function(r,u,c){return Ts(this,void 0,void 0,function(){var o,s,e,a,n;return Ss(this,function(t){switch(t.label){case 0:o="readonly"===r,s=0,e=function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:++s,e=VS.open(a.db,o?"readonly":"readwrite",u),t.label=1;case 1:return t.trys.push([1,3,,4]),(n=c(e).catch(function(t){return e.abort(t),sE.reject(t)}).Ou()).catch(function(){}),[4,e.cw];case 2:return t.sent(),[2,{value:n}];case 3:return r=t.sent(),i="FirebaseError"!==r.name&&s<3,q_("SimpleDb","Transaction failed with error: %s. Retrying: %s.",r.message,i),i?[3,4]:[2,{value:Promise.reject(r)}];case 4:return[2]}})},a=this,t.label=1;case 1:return[5,e()];case 2:return"object"==typeof(n=t.sent())?[2,n.value]:[3,1];case 3:return[2]}})})},GS.prototype.close=function(){this.db.close()},GS),qS=(Object.defineProperty(KS.prototype,"Cu",{get:function(){return this.fw},enumerable:!0,configurable:!0}),Object.defineProperty(KS.prototype,"dw",{get:function(){return this.lw},enumerable:!0,configurable:!0}),Object.defineProperty(KS.prototype,"cursor",{set:function(t){this.aw=t},enumerable:!0,configurable:!0}),KS.prototype.done=function(){this.fw=!0},KS.prototype.vw=function(t){this.lw=t},KS.prototype.delete=function(){return zS(this.aw.delete())},KS),VS=(HS.open=function(t,e,n){return new HS(t.transaction(n,e))},Object.defineProperty(HS.prototype,"cw",{get:function(){return this.ww.promise},enumerable:!0,configurable:!0}),HS.prototype.abort=function(t){t&&this.ww.reject(t),this.aborted||(q_("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},HS.prototype.store=function(t){var e=this.transaction.objectStore(t);return H_(!!e,"Object store not part of transaction: "+t),new BS(e)},HS),BS=(WS.prototype.put=function(t,e){return zS(void 0!==e?(q_("SimpleDb","PUT",this.store.name,t,e),this.store.put(e,t)):(q_("SimpleDb","PUT",this.store.name,"<auto-key>",t),this.store.put(t)))},WS.prototype.add=function(t){return q_("SimpleDb","ADD",this.store.name,t,t),zS(this.store.add(t))},WS.prototype.get=function(e){var n=this;return zS(this.store.get(e)).next(function(t){return void 0===t&&(t=null),q_("SimpleDb","GET",n.store.name,e,t),t})},WS.prototype.delete=function(t){return q_("SimpleDb","DELETE",this.store.name,t),zS(this.store.delete(t))},WS.prototype.count=function(){return q_("SimpleDb","COUNT",this.store.name),zS(this.store.count())},WS.prototype.mw=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.gw(n,function(t,e){r.push(e)}).next(function(){return r})},WS.prototype.bw=function(t,e){q_("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.pw=!1;var r=this.cursor(n);return this.gw(r,function(t,e,n){return n.delete()})},WS.prototype.yw=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.gw(r,e)},WS.prototype._w=function(i){var t=this.cursor({});return new sE(function(n,r){t.onerror=function(t){var e=YS(t.target.error);r(e)},t.onsuccess=function(t){var e=t.target.result;e?i(e.primaryKey,e.value).next(function(t){t?e.continue():n()}):n()}})},WS.prototype.gw=function(t,s){var a=[];return new sE(function(o,e){t.onerror=function(t){e(t.target.error)},t.onsuccess=function(t){var e=t.target.result;if(e){var n=new qS(e),r=s(e.primaryKey,e.value,n);if(r instanceof sE){var i=r.catch(function(t){return n.done(),sE.reject(t)});a.push(i)}n.Cu?o():null===n.dw?e.continue():e.continue(n.dw)}else o()}}).next(function(){return sE.Vu(a)})},WS.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:(H_(void 0===e,"3rd argument must not be defined if 2nd is a range."),e=t)),{index:n,range:e}},WS.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.pw?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},WS);function WS(t){this.store=t}function HS(t){var n=this;this.transaction=t,this.aborted=!1,this.ww=new X_,this.transaction.oncomplete=function(){n.ww.resolve()},this.transaction.onabort=function(){t.error?n.ww.reject(t.error):n.ww.resolve()},this.transaction.onerror=function(t){var e=YS(t.target.error);n.ww.reject(e)}}function KS(t){this.aw=t,this.fw=!1,this.lw=null}function GS(t){this.db=t,12.2===GS.iw(qs())&&V_("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.")}function zS(t){return new sE(function(n,r){t.onsuccess=function(t){var e=t.target.result;n(e)},t.onerror=function(t){var e=YS(t.target.error);r(e)}})}var QS=!1;function YS(t){var e=jS.iw(qs());if(12.2<=e&&e<13){var n="An internal error was encountered in the Indexed Database server";if(0<=t.message.indexOf(n)){var r=new sg("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+n+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return QS||(QS=!0,setTimeout(function(){throw r},0)),r}}return t}var JS=(XS.Tw=function(t,e,n,r){return H_(""!==t.uid,"UserID must not be an empty string."),new XS(t.t()?t.uid:"",e,n,r)},XS.prototype.Dc=function(t){var r=!0,e=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return tC(t).yw({index:TC.userMutationsIndex,range:e},function(t,e,n){r=!1,n.done()}).next(function(){return r})},XS.prototype.vo=function(e,t,n){return this.Ew(e).next(function(t){return t.lastStreamToken=n.toBase64(),nC(e).put(t)})},XS.prototype.Eo=function(t){return this.Ew(t).next(function(t){return Vg.fromBase64String(t.lastStreamToken)})},XS.prototype.Do=function(e,n){return this.Ew(e).next(function(t){return t.lastStreamToken=n.toBase64(),nC(e).put(t)})},XS.prototype.fo=function(c,h,l,f){var p=this,d=eC(c),v=tC(c);return v.add({}).next(function(t){H_("number"==typeof t,"Auto-generated key is not a number");for(var e=new Z_(t,h,l,f),n=p.serializer.Dw(p.userId,e),r=[],i=new _m(function(t,e){return z_(t.it(),e.it())}),o=0,s=f;o<s.length;o++){var a=s[o],u=NC.key(p.userId,a.key.path,t);i=i.add(a.key.path.J()),r.push(v.put(n)),r.push(d.put(u,NC.PLACEHOLDER))}return i.forEach(function(t){r.push(p.sc.Ic(c,t))}),c.ec(function(){p.Iw[t]=e.keys()}),sE.Vu(r).next(function(){return e})})},XS.prototype._o=function(t,e){var n=this;return tC(t).get(e).next(function(t){return t?(H_(t.userId===n.userId,"Unexpected user '"+t.userId+"' for mutation batch "+e),n.serializer.Rw(t)):null})},XS.prototype.do=function(t,n){var r=this;return this.Iw[n]?sE.resolve(this.Iw[n]):this._o(t,n).next(function(t){if(t){var e=t.keys();return r.Iw[n]=e}return null})},XS.prototype.Lo=function(t,e){var r=this,i=e+1,n=IDBKeyRange.lowerBound([this.userId,i]),o=null;return tC(t).yw({index:TC.userMutationsIndex,range:n},function(t,e,n){e.userId===r.userId&&(H_(e.batchId>=i,"Should have found mutation after "+i),o=r.serializer.Rw(e)),n.done()}).next(function(){return o})},XS.prototype.To=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return tC(t).yw({index:TC.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},XS.prototype.uo=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return tC(t).mw(TC.userMutationsIndex,n).next(function(t){return t.map(function(t){return e.serializer.Rw(t)})})},XS.prototype.oc=function(a,u){var c=this,t=NC.prefixForPath(this.userId,u.path),e=IDBKeyRange.lowerBound(t),h=[];return eC(a).yw({range:e},function(e,t,n){var r=e[0],i=e[1],o=e[2],s=uI(i);if(r===c.userId&&u.path.isEqual(s))return tC(a).get(o).next(function(t){if(!t)throw W_("Dangling document-mutation reference found: "+e+" which points to "+o);H_(t.userId===c.userId,"Unexpected user '"+t.userId+"' for mutation batch "+o),h.push(c.serializer.Rw(t))});n.done()}).next(function(){return h})},XS.prototype.ac=function(r,t){var u=this,c=new _m(z_),i=[];return t.forEach(function(a){var t=NC.prefixForPath(u.userId,a.path),e=IDBKeyRange.lowerBound(t),n=eC(r).yw({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=uI(i);r===u.userId&&a.path.isEqual(s)?c=c.add(o):n.done()});i.push(n)}),sE.Vu(i).next(function(){return u.Sw(r,c)})},XS.prototype.wc=function(t,e){var a=this;H_(!e.Nn(),"Document queries shouldn't go down this path"),H_(!e.ui(),"CollectionGroup queries should be handled in LocalDocumentsView");var u=e.path,c=u.length+1,n=NC.prefixForPath(this.userId,u),r=IDBKeyRange.lowerBound(n),h=new _m(z_);return eC(t).yw({range:r},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=uI(i);r===a.userId&&u.Z(s)?s.length===c&&(h=h.add(o)):n.done()}).next(function(){return a.Sw(t,h)})},XS.prototype.Sw=function(t,e){var n=this,r=[],i=[];return e.forEach(function(e){i.push(tC(t).get(e).next(function(t){if(null===t)throw W_("Dangling document-mutation reference found, which points to "+e);H_(t.userId===n.userId,"Unexpected user '"+t.userId+"' for mutation batch "+e),r.push(n.serializer.Rw(t))}))}),sE.Vu(i).next(function(){return r})},XS.prototype.Io=function(e,n){var r=this;return ZS(e.Aw,this.userId,n).next(function(t){return e.ec(function(){r.th(n.batchId)}),sE.forEach(t,function(t){return r.Ks.Pc(e,t)})})},XS.prototype.th=function(t){delete this.Iw[t]},XS.prototype.po=function(n){var o=this;return this.Dc(n).next(function(t){if(!t)return sE.resolve();var e=IDBKeyRange.lowerBound(NC.prefixForUser(o.userId)),i=[];return eC(n).yw({range:e},function(t,e,n){if(t[0]===o.userId){var r=uI(t[1]);i.push(r)}else n.done()}).next(function(){H_(0===i.length,"Document leak -- detected dangling mutation references when queue is empty. Dangling keys: "+i.map(function(t){return t.it()}))})})},XS.prototype.Cs=function(t,e){return $S(t,this.userId,e)},XS.prototype.Ew=function(t){var e=this;return nC(t).get(this.userId).next(function(t){return t||new IC(e.userId,-1,"")})},XS);function XS(t,e,n,r){this.userId=t,this.serializer=e,this.sc=n,this.Ks=r,this.Iw={}}function $S(t,o,e){var n=NC.prefixForPath(o,e.path),s=n[1],r=IDBKeyRange.lowerBound(n),a=!1;return eC(t).yw({range:r,pw:!0},function(t,e,n){var r=t[0],i=t[1];t[2],r===o&&i===s&&(a=!0),n.done()}).next(function(){return a})}function ZS(t,e,n){var r=t.store(TC.store),i=t.store(NC.store),o=[],s=IDBKeyRange.only(n.batchId),a=0,u=r.yw({range:s},function(t,e,n){return a++,n.delete()});o.push(u.next(function(){H_(1===a,"Dangling document-mutation reference found: Missing batch "+n.batchId)}));for(var c=[],h=0,l=n.mutations;h<l.length;h++){var f=l[h],p=NC.key(e,f.key.path,n.batchId);o.push(i.delete(p)),c.push(f.key)}return sE.Vu(o).next(function(){return c})}function tC(t){return eN.ow(t,TC.store)}function eC(t){return eN.ow(t,NC.store)}function nC(t){return eN.ow(t,IC.store)}var rC=(iC.prototype.Go=function(e){var n=this;return this.Cw(e).next(function(t){return t.highestTargetId=n.Wc.after(t.highestTargetId),n.Pw(e,t).next(function(){return t.highestTargetId})})},iC.prototype.Ro=function(t){return this.Cw(t).next(function(t){return Zg.L(new $g(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},iC.prototype.zc=function(t){return aC(t.Aw)},iC.prototype.Fo=function(e,n,r){var i=this;return this.Cw(e).next(function(t){return t.highestListenSequenceNumber=n,r&&(t.lastRemoteSnapshotVersion=r.G()),n>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.Pw(e,t)})},iC.prototype.Wo=function(e,n){var r=this;return this.Kc(e,n).next(function(){return r.Cw(e).next(function(t){return t.targetCount+=1,r.kw(n,t),r.Pw(e,t)})})},iC.prototype.No=function(t,e){return this.Kc(t,e)},iC.prototype.Hc=function(e,t){var n=this;return this.Jc(e,t.targetId).next(function(){return oC(e).delete(t.targetId)}).next(function(){return n.Cw(e)}).next(function(t){return H_(0<t.targetCount,"Removing from an empty target cache"),t.targetCount-=1,n.Pw(e,t)})},iC.prototype.ds=function(r,i,o){var s=this,a=0,u=[];return oC(r).yw(function(t,e){var n=s.serializer.Nw(e);n.sequenceNumber<=i&&null===o.get(n.targetId)&&(a++,u.push(s.Hc(r,n)))}).next(function(){return sE.Vu(u)}).next(function(){return a})},iC.prototype.oe=function(t,r){var i=this;return oC(t).yw(function(t,e){var n=i.serializer.Nw(e);r(n)})},iC.prototype.Cw=function(t){return sC(t.Aw)},iC.prototype.Pw=function(t,e){return(n=t,eN.ow(n,FC.store)).put(FC.key,e);var n},iC.prototype.Kc=function(t,e){return oC(t).put(this.serializer.Ow(e))},iC.prototype.kw=function(t,e){var n=!1;return t.targetId>e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},iC.prototype.Yc=function(t){return this.Cw(t).next(function(t){return t.targetCount})},iC.prototype.Qo=function(t,i){var o=this,e=i.canonicalId(),n=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),s=null;return oC(t).yw({range:n,index:LC.queryTargetsIndexName},function(t,e,n){var r=o.serializer.Nw(e);i.isEqual(r.target)&&(s=r,n.done())}).next(function(){return s})},iC.prototype.Co=function(n,t,r){var i=this,o=[],s=uC(n);return t.forEach(function(t){var e=oI(t.path);o.push(s.put(new MC(r,e))),o.push(i.Ks._s(n,t))}),sE.Vu(o)},iC.prototype.Ao=function(n,t,r){var i=this,o=uC(n);return sE.forEach(t,function(t){var e=oI(t.path);return sE.Vu([o.delete([r,e]),i.Ks.Ts(n,t)])})},iC.prototype.Jc=function(t,e){var n=uC(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},iC.prototype.Ho=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=uC(t),o=i_();return r.yw({range:n,pw:!0},function(t,e,n){var r=uI(t[1]),i=new im(r);o=o.add(i)}).next(function(){return o})},iC.prototype.Cs=function(t,e){var n=oI(e.path),r=IDBKeyRange.bound([n],[Y_(n)],!1,!0),i=0;return uC(t).yw({index:MC.documentTargetsIndex,pw:!0,range:r},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0<i})},iC.prototype.be=function(t,e){var n=this;return oC(t).get(e).next(function(t){return t?n.serializer.Nw(t):null})},iC);function iC(t,e){this.Ks=t,this.serializer=e,this.Wc=bI.qc()}function oC(t){return eN.ow(t,LC.store)}function sC(t){return jS.ow(t,FC.store).get(FC.key).next(function(t){return H_(null!==t,"Missing metadata row."),t})}function aC(t){return sC(t).next(function(t){return t.highestListenSequenceNumber})}function uC(t){return eN.ow(t,MC.store)}var cC,hC=(lC.prototype.Fs=function(t,e,n){return dC(t).put(vC(e),n)},lC.prototype.Us=function(t,e){var n=dC(t),r=vC(e);return n.delete(r)},lC.prototype.updateMetadata=function(e,n){var r=this;return this.getMetadata(e).next(function(t){return t.byteSize+=n,r.Fw(e,t)})},lC.prototype.xs=function(t,e){var n=this;return dC(t).get(vC(e)).next(function(t){return n.Vw(t)})},lC.prototype.Uw=function(t,e){var n=this;return dC(t).get(vC(e)).next(function(t){var e=n.Vw(t);return e?{Nc:e,size:yC(t)}:null})},lC.prototype.getEntries=function(t,e){var r=this,i=$b();return this.xw(t,e,function(t,e){var n=r.Vw(e);i=i.dt(t,n)}).next(function(){return i})},lC.prototype.jw=function(t,e){var r=this,i=$b(),o=new om(im.W);return this.xw(t,e,function(t,e){var n=r.Vw(e);o=n?(i=i.dt(t,n),o.dt(t,yC(e))):(i=i.dt(t,null),o.dt(t,0))}).next(function(){return{Lw:i,qw:o}})},lC.prototype.xw=function(t,e,i){if(e.Y())return sE.resolve();var n=IDBKeyRange.bound(e.first().path.nt(),e.last().path.nt()),o=e.yt(),s=o.Rt();return dC(t).yw({range:n},function(t,e,n){for(var r=im.ft(t);s&&im.W(s,r)<0;)i(s,null),s=o.Rt();s&&s.isEqual(r)&&(i(s,e),s=o.St()?o.Rt():null),s?n.vw(s.path.nt()):n.done()}).next(function(){for(;s;)i(s,null),s=o.St()?o.Rt():null})},lC.prototype.Jo=function(t,i,e){var o=this;H_(!i.ui(),"CollectionGroup queries should be handled in LocalDocumentsView");var s=t_(),a=i.path.length+1,n={};if(e.isEqual(Zg.MIN)){var r=i.path.nt();n.range=IDBKeyRange.lowerBound(r)}else{var u=i.path.nt(),c=this.serializer.Bw(e);n.range=IDBKeyRange.lowerBound([u,c],!0),n.index=OC.collectionReadTimeIndex}return dC(t).yw(n,function(t,e,n){if(t.length===a){var r=o.serializer.Mw(e);i.path.Z(r.key.path)?r instanceof Ww&&i.matches(r)&&(s=s.dt(r.key,r)):n.done()}}).next(function(){return s})},lC.prototype.eh=function(t,e){var r=this,i=Xb(),o=this.serializer.Bw(e),n=dC(t),s=IDBKeyRange.lowerBound(o,!0);return n.yw({index:OC.readTimeIndex,range:s},function(t,e){var n=r.serializer.Mw(e);i=i.dt(n.key,n),o=e.readTime}).next(function(){return{rh:i,readTime:r.serializer.Qw(o)}})},lC.prototype.uh=function(t){var r=this,e=dC(t),i=Zg.MIN;return e.yw({index:OC.readTimeIndex,reverse:!0},function(t,e,n){e.readTime&&(i=r.serializer.Qw(e.readTime)),n.done()}).next(function(){return i})},lC.prototype.wo=function(t){return new lC.Fc(this,!!t&&t.mo)},lC.prototype.Vc=function(t){return this.getMetadata(t).next(function(t){return t.byteSize})},lC.prototype.getMetadata=function(t){return pC(t).get(DC.key).next(function(t){return H_(!!t,"Missing document cache metadata"),t})},lC.prototype.Fw=function(t,e){return pC(t).put(DC.key,e)},lC.prototype.Vw=function(t){if(t){var e=this.serializer.Mw(t);return e instanceof Hw&&e.version.isEqual(Zg.q())?null:e}return null},lC.Fc=(Es(fC,cC=TE),fC.prototype.qs=function(s){var a=this,u=[],c=0,h=new _m(function(t,e){return z_(t.it(),e.it())});return this.ks.forEach(function(t,e){var n=a.Gw.get(t);if(H_(void 0!==n,"Cannot modify a document that wasn't read (for "+t+")"),e){H_(!a.readTime.isEqual(Zg.MIN),"Cannot add a document with a read time of zero");var r=a.Uc.serializer.Ww(e,a.readTime);h=h.add(t.path.J());var i=yC(r);c+=i-n,u.push(a.Uc.Fs(s,t,r))}else if(c-=n,a.mo){var o=a.Uc.serializer.Ww(new Hw(t,Zg.q()),a.readTime);u.push(a.Uc.Fs(s,t,o))}else u.push(a.Uc.Us(s,t))}),h.forEach(function(t){u.push(a.Uc.sc.Ic(s,t))}),u.push(this.Uc.updateMetadata(s,c)),sE.Vu(u)},fC.prototype.js=function(t,e){var n=this;return this.Uc.Uw(t,e).next(function(t){return null===t?(n.Gw.set(e,0),null):(n.Gw.set(e,t.size),t.Nc)})},fC.prototype.Ls=function(t,e){var n=this;return this.Uc.jw(t,e).next(function(t){var e=t.Lw;return t.qw.forEach(function(t,e){n.Gw.set(t,e)}),e})},fC),lC);function lC(t,e){this.serializer=t,this.sc=e}function fC(t,e){var n=cC.call(this)||this;return n.Uc=t,n.mo=e,n.Gw=new eE(function(t){return t.toString()}),n}function pC(t){return eN.ow(t,DC.store)}function dC(t){return eN.ow(t,OC.store)}function vC(t){return t.path.nt()}function yC(t){var e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw W_("Unknown remote document type");e=t.noDocument}return JSON.stringify(e).length}var gC=9,mC=(wC.prototype.createOrUpgrade=function(n,r,t,e){var i=this;H_(t<e&&0<=t&&e<=gC,"Unexpected schema upgrade from v"+t+" to v{toVersion}.");var o,s=new VS(r);t<1&&1<=e&&(n.createObjectStore(_C.store),(o=n).createObjectStore(IC.store,{keyPath:IC.keyPath}),o.createObjectStore(TC.store,{keyPath:TC.keyPath,autoIncrement:!0}).createIndex(TC.userMutationsIndex,TC.userMutationsKeyPath,{unique:!0}),o.createObjectStore(NC.store),WC(n),n.createObjectStore(OC.store));var a,u=sE.resolve();return t<3&&3<=e&&(0!==t&&((a=n).deleteObjectStore(MC.store),a.deleteObjectStore(LC.store),a.deleteObjectStore(FC.store),WC(n)),u=u.next(function(){return t=s.store(FC.store),e=new FC(0,0,Zg.MIN.G(),0),t.put(FC.key,e);var t,e})),t<4&&4<=e&&(0!==t&&(u=u.next(function(){return r=n,(i=s).store(TC.store).mw().next(function(t){r.deleteObjectStore(TC.store),r.createObjectStore(TC.store,{keyPath:TC.keyPath,autoIncrement:!0}).createIndex(TC.userMutationsIndex,TC.userMutationsKeyPath,{unique:!0});var e=i.store(TC.store),n=t.map(function(t){return e.put(t)});return sE.Vu(n)});var r,i})),u=u.next(function(){n.createObjectStore(HC.store,{keyPath:HC.keyPath})})),t<5&&5<=e&&(u=u.next(function(){return i.removeAcknowledgedMutations(s)})),t<6&&6<=e&&(u=u.next(function(){return n.createObjectStore(DC.store),i.addDocumentGlobal(s)})),t<7&&7<=e&&(u=u.next(function(){return i.ensureSequenceNumbers(s)})),t<8&&8<=e&&(u=u.next(function(){return i.createCollectionParentIndex(n,s)})),t<9&&9<=e&&(u=u.next(function(){var t,e;(e=n).objectStoreNames.contains("remoteDocumentChanges")&&e.deleteObjectStore("remoteDocumentChanges"),(t=r.objectStore(OC.store)).createIndex(OC.readTimeIndex,OC.readTimeIndexPath,{unique:!1}),t.createIndex(OC.collectionReadTimeIndex,OC.collectionReadTimeIndexPath,{unique:!1})})),u},wC.prototype.addDocumentGlobal=function(e){var n=0;return e.store(OC.store).yw(function(t,e){n+=yC(e)}).next(function(){var t=new DC(n);return e.store(DC.store).put(DC.key,t)})},wC.prototype.removeAcknowledgedMutations=function(r){var i=this,t=r.store(IC.store),e=r.store(TC.store);return t.mw().next(function(t){return sE.forEach(t,function(n){var t=IDBKeyRange.bound([n.userId,-1],[n.userId,n.lastAcknowledgedBatchId]);return e.mw(TC.userMutationsIndex,t).next(function(t){return sE.forEach(t,function(t){H_(t.userId===n.userId,"Cannot process batch "+t.batchId+" from unexpected user");var e=i.serializer.Rw(t);return ZS(r,n.userId,e).next(function(){})})})})})},wC.prototype.ensureSequenceNumbers=function(t){var s=t.store(MC.store),e=t.store(OC.store);return aC(t).next(function(i){var o=[];return e.yw(function(t,e){var n=new em(t),r=[0,oI(n)];o.push(s.get(r).next(function(t){return t?sE.resolve():(e=n,s.put(new MC(0,oI(e),i)));var e}))}).next(function(){return sE.Vu(o)})})},wC.prototype.createCollectionParentIndex=function(t,e){function i(t){if(o.add(t)){var e=t.$(),n=t.J();return r.put({collectionId:e,parent:oI(n)})}}t.createObjectStore(UC.store,{keyPath:UC.keyPath});var r=e.store(UC.store),o=new hI;return e.store(OC.store).yw({pw:!0},function(t,e){var n=new em(t);return i(n.J())}).next(function(){return e.store(NC.store).yw({pw:!0},function(t,e){t[0];var n=t[1],r=(t[2],uI(n));return i(r.J())})})},wC);function wC(t){this.serializer=t}function bC(t,e){this.seconds=t,this.nanoseconds=e}var _C=(EC.store="owner",EC.key="owner",EC);function EC(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n}var IC=(CC.store="mutationQueues",CC.keyPath="userId",CC),TC=(SC.store="mutations",SC.keyPath="batchId",SC.userMutationsIndex="userMutationsIndex",SC.userMutationsKeyPath=["userId","batchId"],SC);function SC(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i}function CC(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n}var NC=(AC.prefixForUser=function(t){return[t]},AC.prefixForPath=function(t,e){return[t,oI(e)]},AC.key=function(t,e,n){return[t,oI(e),n]},AC.store="documentMutations",AC.PLACEHOLDER=new AC,AC);function AC(){}function kC(t,e){this.path=t,this.readTime=e}function RC(t,e){this.path=t,this.version=e}var OC=(xC.store="remoteDocuments",xC.readTimeIndex="readTimeIndex",xC.readTimeIndexPath="readTime",xC.collectionReadTimeIndex="collectionReadTimeIndex",xC.collectionReadTimeIndexPath=["parentPath","readTime"],xC),DC=(PC.store="remoteDocumentGlobal",PC.key="remoteDocumentGlobalKey",PC);function PC(t){this.byteSize=t}function xC(t,e,n,r,i,o){this.unknownDocument=t,this.noDocument=e,this.document=n,this.hasCommittedMutations=r,this.readTime=i,this.parentPath=o}var LC=(BC.store="targets",BC.keyPath="targetId",BC.queryTargetsIndexName="queryTargetsIndex",BC.queryTargetsKeyPath=["canonicalId","targetId"],BC),MC=(VC.store="targetDocuments",VC.keyPath=["targetId","path"],VC.documentTargetsIndex="documentTargetsIndex",VC.documentTargetsKeyPath=["path","targetId"],VC),FC=(qC.key="targetGlobalKey",qC.store="targetGlobal",qC),UC=(jC.store="collectionParents",jC.keyPath=["collectionId","parent"],jC);function jC(t,e){this.collectionId=t,this.parent=e}function qC(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r}function VC(t,e,n){this.targetId=t,this.path=e,H_(0===t==(void 0!==(this.sequenceNumber=n)),"A target-document row must either have targetId == 0 and a defined sequence number, or a non-zero targetId and no sequence number")}function BC(t,e,n,r,i,o,s){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.lastLimboFreeSnapshotVersion=o,this.query=s}function WC(t){t.createObjectStore(MC.store,{keyPath:MC.keyPath}).createIndex(MC.documentTargetsIndex,MC.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(LC.store,{keyPath:LC.keyPath}).createIndex(LC.queryTargetsIndexName,LC.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(FC.store)}var HC=(KC.store="clientMetadata",KC.keyPath="clientId",KC);function KC(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r}var GC=ks(ks(ks([IC.store,TC.store,NC.store,OC.store,LC.store,_C.store,FC.store,MC.store],[HC.store]),[DC.store]),[UC.store]),zC=(QC.prototype.Ic=function(t,e){var n=this;if(H_(e.length%2==1,"Expected a collection path."),this.zw.has(e))return sE.resolve();var r=e.$(),i=e.J();t.ec(function(){n.zw.add(e)});var o={collectionId:r,parent:oI(i)};return YC(t).put(o)},QC.prototype.vc=function(t,i){var o=[],e=IDBKeyRange.bound([i,""],[Y_(i),""],!1,!0);return YC(t).mw(e).next(function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];if(r.collectionId!==i)break;o.push(uI(r.parent))}return o})},QC);function QC(){this.zw=new hI}function YC(t){return eN.ow(t,UC.store)}var JC=(XC.prototype.Mw=function(t){if(t.document)return this.Kw.We(t.document,!!t.hasCommittedMutations);if(t.noDocument){var e=im.ft(t.noDocument.path),n=this.Hw(t.noDocument.readTime);return new Hw(e,n,{hasCommittedMutations:!!t.hasCommittedMutations})}return t.unknownDocument?(e=im.ft(t.unknownDocument.path),n=this.Hw(t.unknownDocument.version),new Kw(e,n)):W_("Unexpected DbRemoteDocument")},XC.prototype.Ww=function(t,e){var n=this.Bw(e),r=t.key.path.J().nt();if(t instanceof Ww){var i=t.proto?t.proto:this.Kw.Ge(t),o=t.hasCommittedMutations;return new OC(null,null,i,o,n,r)}if(t instanceof Hw){var s=t.key.path.nt(),a=this.Jw(t.version);return o=t.hasCommittedMutations,new OC(null,new kC(s,a),null,o,n,r)}if(t instanceof Kw){s=t.key.path.nt();var u=this.Jw(t.version);return new OC(new RC(s,u),null,null,!0,n,r)}return W_("Unexpected MaybeDocument")},XC.prototype.Bw=function(t){var e=t.G();return[e.seconds,e.nanoseconds]},XC.prototype.Qw=function(t){var e=new $g(t[0],t[1]);return Zg.L(e)},XC.prototype.Jw=function(t){var e=t.G();return new bC(e.seconds,e.nanoseconds)},XC.prototype.Hw=function(t){var e=new $g(t.seconds,t.nanoseconds);return Zg.L(e)},XC.prototype.Dw=function(t,e){var n=this,r=e.baseMutations.map(function(t){return n.Kw.tr(t)}),i=e.mutations.map(function(t){return n.Kw.tr(t)});return new TC(t,e.batchId,e.En.toMillis(),r,i)},XC.prototype.Rw=function(t){var e=this,n=(t.baseMutations||[]).map(function(t){return e.Kw.rr(t)}),r=t.mutations.map(function(t){return e.Kw.rr(t)}),i=$g.fromMillis(t.localWriteTimeMs);return new Z_(t.batchId,i,n,r)},XC.prototype.Yw=function(t){var e=[];return t.forEach(function(t){e.push(oI(t.path))}),e},XC.prototype.Xw=function(t){for(var e=i_(),n=0,r=t;n<r.length;n++){var i=r[n];e=e.add(new im(uI(i)))}return e},XC.prototype.Nw=function(t){var e,n=this.Hw(t.readTime),r=void 0!==t.lastLimboFreeSnapshotVersion?this.Hw(t.lastLimboFreeSnapshotVersion):Zg.MIN;return e=void 0!==t.query.documents?this.Kw.lr(t.query):this.Kw.gr(t.query),new Db(e,t.targetId,0,t.lastListenSequenceNumber,n,r,Vg.fromBase64String(t.resumeToken))},XC.prototype.Ow=function(t){H_(0===t.ci,"Only queries with purpose 0 may be stored, got "+t.ci);var e,n=this.Jw(t.ai),r=this.Jw(t.lastLimboFreeSnapshotVersion);e=t.target.Nn()?this.Kw.ar(t.target):this.Kw.dr(t.target);var i=t.resumeToken.toBase64();return new LC(t.targetId,t.target.canonicalId(),n,i,t.sequenceNumber,r,e)},XC);function XC(t){this.Kw=t}var $C,ZC="Another tab has exclusive access to the persistence layer. To allow shared access, make sure to invoke `enablePersistence()` with `synchronizeTabs:true` in all tabs.",tN=(Es(rN,$C=$E),rN),eN=(nN.ow=function(t,e){if(t instanceof tN)return jS.ow(t.Aw,e);throw W_("IndexedDbPersistence must use instances of IndexedDbTransaction")},nN.om=function(n){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:if(!nN.ph())throw new sg(og.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");return[4,(e=new nN(n.allowTabSynchronization,n.persistenceKey,n.clientId,n.platform,n.hm,n.fh,n.serializer,n.$w)).start()];case 1:return t.sent(),[2,e]}})})},nN.prototype.start=function(){var e=this;return H_(!this.ss,"IndexedDbPersistence double-started!"),H_(null!==this.window,"Expected 'window' to be defined"),jS.ew(this.rm,gC,new mC(this.serializer)).then(function(t){return e.cm=t,e.am()}).then(function(){return e.fm(),e.lm(),e.dm(),e.cm.runTransaction("readonly",[FC.store],function(t){return aC(t)})}).then(function(t){e.$c=new rE(t,e.$w)}).then(function(){e.Zc=!0}).catch(function(t){return e.cm&&e.cm.close(),Promise.reject(t)})},nN.prototype.na=function(n){var t=this;return this.em=function(e){return Ts(t,void 0,void 0,function(){return Ss(this,function(t){return this.ss?[2,n(e)]:[2]})})},n(this.isPrimary)},nN.prototype.ia=function(n){var t=this;this.cm.hw(function(e){return Ts(t,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return null!==e.newVersion?[3,2]:[4,n()];case 1:t.sent(),t.label=2;case 2:return[2]}})})})},nN.prototype.nh=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.fh.ou(function(){return Ts(e,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.ss?[4,this.am()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})}))},nN.prototype.am=function(){var n=this;return this.cm.runTransaction("readwrite",GC,function(e){return oN(e).put(new HC(n.clientId,Date.now(),n.networkEnabled,n.inForeground)).next(function(){if(n.isPrimary)return n.vm(e).next(function(t){t||(n.isPrimary=!1,n.fh.ou(function(){return n.em(!1)}))})}).next(function(){return n.wm(e)}).next(function(t){return n.isPrimary&&!t?n.mm(e).next(function(){return!1}):!!t&&n.gm(e).next(function(){return!0})})}).catch(function(t){if(!n.allowTabSynchronization)throw t;return q_("IndexedDbPersistence","Releasing owner lease after error during lease refresh",t),!1}).then(function(t){n.isPrimary!==t&&n.fh.ou(function(){return n.em(t)}),n.isPrimary=t})},nN.prototype.vm=function(t){var e=this;return iN(t).get(_C.key).next(function(t){return sE.resolve(e.bm(t))})},nN.prototype.pm=function(t){return oN(t).delete(this.clientId)},nN.prototype.ym=function(){return Ts(this,void 0,void 0,function(){var i=this;return Ss(this,function(t){switch(t.label){case 0:return!this.isPrimary||this._m(this.im,18e5)?[3,2]:(this.im=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(t){var r=nN.ow(t,HC.store);return r.mw().next(function(t){var e=i.Im(t,18e5),n=t.filter(function(t){return-1===e.indexOf(t)});return sE.forEach(n,function(t){return r.delete(t.clientId)}).next(function(){return n})})}).catch(function(){return[]})]);case 1:t.sent().forEach(function(t){i.window.localStorage.removeItem(i.Tm(t.clientId))}),t.label=2;case 2:return[2]}})})},nN.prototype.dm=function(){var t=this;this.nm=this.fh.yu("client_metadata_refresh",4e3,function(){return t.am().then(function(){return t.ym()}).then(function(){return t.dm()})})},nN.prototype.bm=function(t){return!!t&&t.ownerId===this.clientId},nN.prototype.wm=function(e){var i=this;return iN(e).get(_C.key).next(function(t){if(null!==t&&i._m(t.leaseTimestampMs,5e3)&&!i.Em(t.ownerId)){if(i.bm(t)&&i.networkEnabled)return!0;if(!i.bm(t)){if(!t.allowTabSynchronization)throw new sg(og.FAILED_PRECONDITION,ZC);return!1}}return!(!i.networkEnabled||!i.inForeground)||oN(e).mw().next(function(t){return void 0===i.Im(t,5e3).find(function(t){if(i.clientId!==t.clientId){var e=!i.networkEnabled&&t.networkEnabled,n=!i.inForeground&&t.inForeground,r=i.networkEnabled===t.networkEnabled;if(e||n&&r)return!0}return!1})})}).next(function(t){return i.isPrimary!==t&&q_("IndexedDbPersistence","Client "+(t?"is":"is not")+" eligible for a primary lease."),t})},nN.prototype.shutdown=function(){return Ts(this,void 0,void 0,function(){var e=this;return Ss(this,function(t){switch(t.label){case 0:return this.Zc=!1,this.Dm(),this.nm&&(this.nm.cancel(),this.nm=null),this.Rm(),this.Sm(),[4,this.cm.runTransaction("readwrite",[_C.store,HC.store],function(t){return e.mm(t).next(function(){return e.pm(t)})})];case 1:return t.sent(),this.cm.close(),this.Am(),[2]}})})},nN.prototype.Im=function(t,e){var n=this;return t.filter(function(t){return n._m(t.updateTimeMs,e)&&!n.Em(t.clientId)})},nN.prototype.$o=function(){var e=this;return this.cm.runTransaction("readonly",[HC.store],function(t){return oN(t).mw().next(function(t){return e.Im(t,18e5).map(function(t){return t.clientId})})})},nN.clearPersistence=function(n){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return nN.ph()?(e=n+nN.um,[4,jS.delete(e)]):[2,Promise.resolve()];case 1:return t.sent(),[2]}})})},Object.defineProperty(nN.prototype,"ss",{get:function(){return this.Zc},enumerable:!0,configurable:!0}),nN.prototype.Js=function(t){return H_(this.ss,"Cannot initialize MutationQueue before persistence is started."),JS.Tw(t,this.serializer,this.sc,this.Ks)},nN.prototype.Zs=function(){return H_(this.ss,"Cannot initialize TargetCache before persistence is started."),this.$s},nN.prototype.Xs=function(){return H_(this.ss,"Cannot initialize RemoteDocumentCache before persistence is started."),this.uc},nN.prototype.no=function(){return H_(this.ss,"Cannot initialize IndexManager before persistence is started."),this.sc},nN.prototype.runTransaction=function(n,t,r){var i=this;q_("IndexedDbPersistence","Starting transaction:",n);var o,e="readonly"===t?"readonly":"readwrite";return this.cm.runTransaction(e,GC,function(e){return o=new tN(e,i.$c.next()),"readwrite-primary"===t?i.vm(e).next(function(t){return!!t||i.wm(e)}).next(function(t){if(!t)throw V_("Failed to obtain primary lease for action '"+n+"'."),i.isPrimary=!1,i.fh.ou(function(){return i.em(!1)}),new sg(og.FAILED_PRECONDITION,XE);return r(o)}).next(function(t){return i.gm(e).next(function(){return t})}):i.Cm(e).next(function(){return r(o)})}).then(function(t){return o.rc(),t})},nN.prototype.Cm=function(t){var e=this;return iN(t).get(_C.key).next(function(t){if(null!==t&&e._m(t.leaseTimestampMs,5e3)&&!e.Em(t.ownerId)&&!e.bm(t)&&!t.allowTabSynchronization)throw new sg(og.FAILED_PRECONDITION,ZC)})},nN.prototype.gm=function(t){var e=new _C(this.clientId,this.allowTabSynchronization,Date.now());return iN(t).put(_C.key,e)},nN.ph=function(){return jS.ph()},nN.Pm=function(t){var e=t.Dn.projectId;return t.Dn.xr||(e+="."+t.Dn.database),"firestore/"+t.persistenceKey+"/"+e+"/"},nN.prototype.mm=function(t){var e=this,n=iN(t);return n.get(_C.key).next(function(t){return e.bm(t)?(q_("IndexedDbPersistence","Releasing primary lease."),n.delete(_C.key)):sE.resolve()})},nN.prototype._m=function(t,e){var n=Date.now();return!(t<n-e||n<t&&(V_("Detected an update time that is in the future: "+t+" > "+n),1))},nN.prototype.fm=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.tm=function(){t.fh.ou(function(){return t.inForeground="visible"===t.document.visibilityState,t.am()})},this.document.addEventListener("visibilitychange",this.tm),this.inForeground="visible"===this.document.visibilityState)},nN.prototype.Rm=function(){this.tm&&(H_(null!==this.document&&"function"==typeof this.document.addEventListener,"Expected 'document.addEventListener' to be a function"),this.document.removeEventListener("visibilitychange",this.tm),this.tm=null)},nN.prototype.lm=function(){var t=this;"function"==typeof this.window.addEventListener&&(this.Zw=function(){t.Dm(),t.fh.ou(function(){return t.shutdown()})},this.window.addEventListener("unload",this.Zw))},nN.prototype.Sm=function(){this.Zw&&(H_("function"==typeof this.window.removeEventListener,"Expected 'window.removeEventListener' to be a function"),this.window.removeEventListener("unload",this.Zw),this.Zw=null)},nN.prototype.Em=function(t){try{var e=null!==this.sm.getItem(this.Tm(t));return q_("IndexedDbPersistence","Client '"+t+"' "+(e?"is":"is not")+" zombied in LocalStorage"),e}catch(t){return V_("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},nN.prototype.Dm=function(){try{this.sm.setItem(this.Tm(this.clientId),String(Date.now()))}catch(t){V_("Failed to set zombie client id.",t)}},nN.prototype.Am=function(){try{this.sm.removeItem(this.Tm(this.clientId))}catch(t){}},nN.prototype.Tm=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},nN.um="main",nN);function nN(t,e,n,r,i,o,s,a){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.fh=o,this.$w=a,this.Zc=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Zw=null,this.inForeground=!1,this.tm=null,this.nm=null,this.im=Number.NEGATIVE_INFINITY,this.em=function(t){return Promise.resolve()},this.Ks=new sN(this,i),this.rm=e+nN.um,this.serializer=new JC(s),this.document=r.document,this.$s=new rC(this.Ks,this.serializer),this.sc=new zC,this.uc=new hC(this.serializer,this.sc),!r.window||!r.window.localStorage)throw new sg(og.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");this.window=r.window,this.sm=this.window.localStorage}function rN(t,e){var n=$C.call(this)||this;return n.Aw=t,n.Po=e,n}function iN(t){return t.store(_C.store)}function oN(t){return t.store(HC.store)}var sN=(aN.prototype.as=function(t){var n=this.km(t);return this.db.Zs().Yc(t).next(function(e){return n.next(function(t){return e+t})})},aN.prototype.km=function(t){var e=0;return this.ls(t,function(t){e++}).next(function(){return e})},aN.prototype.oe=function(t,e){return this.db.Zs().oe(t,e)},aN.prototype.ls=function(t,n){return this.Nm(t,function(t,e){return n(e)})},aN.prototype.zs=function(t){this.sa=t},aN.prototype._s=function(t,e){return uN(t,e)},aN.prototype.Ts=function(t,e){return uN(t,e)},aN.prototype.ds=function(t,e,n){return this.db.Zs().ds(t,e,n)},aN.prototype.Pc=function(t,e){return uN(t,e)},aN.prototype.Om=function(t,e){return this.sa.Cs(e)?sE.resolve(!0):(r=e,i=!1,nC(n=t)._w(function(t){return $S(n,t,r).next(function(t){return t&&(i=!0),sE.resolve(!t)})}).next(function(){return i}));var n,r,i},aN.prototype.vs=function(r,i){var o=this,s=this.db.Xs().wo(),a=[],u=0;return this.Nm(r,function(e,t){if(t<=i){var n=o.Om(r,e).next(function(t){if(!t)return u++,s.xs(r,e).next(function(){return s.Us(e),uC(r).delete([0,oI(e.path)])})});a.push(n)}}).next(function(){return sE.Vu(a)}).next(function(){return s.apply(r)}).next(function(){return u})},aN.prototype.removeTarget=function(t,e){var n=e.fi(t.Po);return this.db.Zs().No(t,n)},aN.prototype.Oo=function(t,e){return uN(t,e)},aN.prototype.Nm=function(t,o){var s,e=uC(t),a=rE.Xr;return e.yw({index:MC.documentTargetsIndex},function(t,e){var n=t[0],r=(t[1],e.path),i=e.sequenceNumber;0===n?(a!==rE.Xr&&o(new im(uI(s)),a),a=i,s=r):a=rE.Xr}).next(function(){a!==rE.Xr&&o(new im(uI(s)),a)})},aN.prototype.ms=function(t){return this.db.Xs().Vc(t)},aN);function aN(t,e){this.db=t,this.sa=null,this.ns=new _E(this,e)}function uN(t,e){return uC(t).put((n=e,r=t.Po,new MC(0,oI(n.path),r)));var n,r}var cN=(lN.prototype.initialize=function(o,s,a,u,c,h){return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:if(H_(h.aa,"IndexedDbPersistenceProvider can only provide durable persistence"),H_(!this.persistence,"configure() already called"),e=eN.Pm(s),n=new P_(s.Dn,{_e:!0}),!WE.ph(a))throw new sg(og.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");return this.td=h.synchronizeTabs?new WE(o,a,e,u,c):new JE,r=this,[4,eN.om({allowTabSynchronization:h.synchronizeTabs,persistenceKey:e,clientId:u,platform:a,fh:o,serializer:n,hm:wE.Hu(h.cacheSizeBytes),$w:this.td})];case 1:return r.persistence=t.sent(),i=this.persistence.Ks.ns,this.Yd=new bE(i,o),[2]}})})},lN.prototype.la=function(){return H_(!!this.persistence,"initialize() not called"),this.persistence},lN.prototype.da=function(){return H_(!!this.td,"initialize() not called"),this.td},lN.prototype.fa=function(){return H_(!!this.Yd,"initialize() not called"),this.Yd},lN.prototype.clearPersistence=function(t){var e=eN.Pm(t);return eN.clearPersistence(e)},lN),hN={Firestore:RS,GeoPoint:Xg,Timestamp:$g,Blob:Jg,Transaction:OS,WriteBatch:DS,DocumentReference:PS,DocumentSnapshot:xS,Query:MS,QueryDocumentSnapshot:LS,QuerySnapshot:FS,CollectionReference:US,FieldPath:DI,FieldValue:oT,setLogLevel:rS.setLogLevel,CACHE_SIZE_UNLIMITED:eS};function lN(){}var fN,pN,dN,vN=(CN.prototype.Xf=function(t){},CN.prototype.shutdown=function(){},CN),yN=(SN.prototype.Xf=function(t){this.jm.push(t)},SN.prototype.shutdown=function(){window.removeEventListener("online",this.Fm),window.removeEventListener("offline",this.Um)},SN.prototype.Lm=function(){window.addEventListener("online",this.Fm),window.addEventListener("offline",this.Um)},SN.prototype.Vm=function(){q_("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.jm;t<e.length;t++)(0,e[t])(0)},SN.prototype.xm=function(){q_("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.jm;t<e.length;t++)(0,e[t])(1)},SN.ph=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},SN),gN=(TN.prototype.Ma=function(t){H_(!this.Mm,"Called onOpen on stream twice!"),this.Mm=t},TN.prototype.xa=function(t){H_(!this.Qm,"Called onClose on stream twice!"),this.Qm=t},TN.prototype.onMessage=function(t){H_(!this.Gm,"Called onMessage on stream twice!"),this.Gm=t},TN.prototype.close=function(){this.Bm()},TN.prototype.send=function(t){this.qm(t)},TN.prototype.Wm=function(){H_(void 0!==this.Mm,"Cannot call onOpen because no callback was set"),this.Mm()},TN.prototype.zm=function(t){H_(void 0!==this.Qm,"Cannot call onClose because no callback was set"),this.Qm(t)},TN.prototype.Km=function(t){H_(void 0!==this.Gm,"Cannot call onMessage because no callback was set"),this.Gm(t)},TN),mN={BatchGetDocuments:"batchGet",Commit:"commit"},wN="gl-js/ fire/"+rg,bN=(IN.prototype.Jm=function(t,e){if(e)for(var n in e.o)e.o.hasOwnProperty(n)&&(t[n]=e.o[n]);t["X-Goog-Api-Client"]=wN},IN.prototype.tf=function(u,r,i){var c=this,h=this.Ym(u);return new Promise(function(o,s){var a=new ng;a.listenOnce(tg.COMPLETE,function(){try{switch(a.getLastErrorCode()){case Zy.NO_ERROR:var t=a.getResponseJson();q_("Connection","XHR received:",JSON.stringify(t)),o(t);break;case Zy.TIMEOUT:q_("Connection",'RPC "'+u+'" timed out'),s(new sg(og.DEADLINE_EXCEEDED,"Request time out"));break;case Zy.HTTP_ERROR:var e=a.getStatus();if(q_("Connection",'RPC "'+u+'" failed with status:',e,"response text:",a.getResponseText()),0<e){var n=a.getResponseJson().error;if(n&&n.status&&n.message){var r=(i=n.status.toLowerCase().replace("_","-"),0<=Object.values(og).indexOf(i)?i:og.UNKNOWN);s(new sg(r,n.message))}else s(new sg(og.UNKNOWN,"Server responded with status "+a.getStatus()))}else q_("Connection",'RPC "'+u+'" failed'),s(new sg(og.UNAVAILABLE,"Connection failed."));break;default:W_('RPC "'+u+'" failed with unanticipated webchannel error '+a.getLastErrorCode()+": "+a.getLastError()+", giving up.")}}finally{q_("Connection",'RPC "'+u+'" completed.')}var i});var t=Is({},r);delete t.database;var e=JSON.stringify(t);q_("Connection","XHR sending: ",h+" "+e);var n={"Content-Type":"text/plain"};c.Jm(n,i),a.send(h,"POST",e,n,15)})},IN.prototype.nf=function(t,e,n){return this.tf(t,e,n)},IN.prototype.Qa=function(t,e){var n=[this.Hm,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=$y(),i={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.Dn.projectId+"/databases/"+this.Dn.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling};this.Jm(i.initMessageHeaders,e),Vs()||Bs()||0<=qs().indexOf("Electron/")||function(){var t=qs();return 0<=t.indexOf("MSIE ")||0<=t.indexOf("Trident/")}()||0<=qs().indexOf("MSAppHost/")||function(){var t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()||(i.httpHeadersOverwriteParam="$httpHeaders");var o=n.join("");function s(t,e){u.listen(t,function(t){try{e(t)}catch(t){setTimeout(function(){throw t},0)}})}q_("Connection","Creating WebChannel: "+o+" "+i);var u=r.createWebChannel(o,i),a=!1,c=!1,h=new gN({qm:function(t){c?q_("Connection","Not sending because WebChannel is closed:",t):(a||(q_("Connection","Opening WebChannel transport."),u.open(),a=!0),q_("Connection","WebChannel sending:",t),u.send(t))},Bm:function(){return u.close()}});return s(eg.EventType.OPEN,function(){c||q_("Connection","WebChannel transport opened.")}),s(eg.EventType.CLOSE,function(){c||(c=!0,q_("Connection","WebChannel transport closed"),h.zm())}),s(eg.EventType.ERROR,function(t){c||(c=!0,q_("Connection","WebChannel transport errored:",t),h.zm(new sg(og.UNAVAILABLE,"The operation could not be completed")))}),s(eg.EventType.MESSAGE,function(t){var e;if(!c){var n=t.data[0];H_(!!n,"Got a webchannel message without data.");var r=n,i=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(i){q_("Connection","WebChannel received error:",i);var o=i.status,s=function(){var t=hb[o];if(void 0!==t)return Yb(t)}(),a=i.message;void 0===s&&(s=og.INTERNAL,a="Unknown error status: "+o+" with message "+i.message),c=!0,h.zm(new sg(s,a)),u.close()}else q_("Connection","WebChannel received:",n),h.Km(n)}}),setTimeout(function(){h.Wm()},0),h},IN.prototype.Ym=function(t){var e=mN[t];return H_(void 0!==e,"Unknown REST mapping for: "+t),this.Hm+"/v1/projects/"+this.Dn.projectId+"/databases/"+this.Dn.database+"/documents:"+e},IN),_N=(Object.defineProperty(EN.prototype,"document",{get:function(){return"undefined"!=typeof document?document:null},enumerable:!0,configurable:!0}),Object.defineProperty(EN.prototype,"window",{get:function(){return"undefined"!=typeof window?window:null},enumerable:!0,configurable:!0}),EN.prototype.$d=function(t){return Promise.resolve(new bN(t))},EN.prototype.Zd=function(){return yN.ph()?new yN:new vN},EN.prototype.tv=function(t){return new P_(t,{_e:!0})},EN.prototype.Vr=function(t){return JSON.stringify(t)},EN.prototype.atob=function(t){return atob(t)},EN.prototype.btoa=function(t){return btoa(t)},EN.prototype.randomBytes=function(t){if(t<=0)return new Uint8Array;var e=new Uint8Array(t);return crypto.getRandomValues(e),e},EN);function EN(){this.N="undefined"!=typeof atob}function IN(t){this.Dn=t.Dn;var e=t.ssl?"https":"http";this.Hm=e+"://"+t.host,this.forceLongPolling=t.forceLongPolling}function TN(t){this.qm=t.qm,this.Bm=t.Bm}function SN(){var t=this;this.Fm=function(){return t.Vm()},this.Um=function(){return t.xm()},this.jm=[],this.Lm()}function CN(){}x_.Fr(new _N),fN=function(t,e){return new rS(t,e,new cN)},(dN=Kl).INTERNAL.registerComponent(new da("firestore",function(t){var e=t.getProvider("app").getImmediate();return fN(e,t.getProvider("auth-internal"))},"PUBLIC").setServiceProps((H_((pN=hN)&&"object"==typeof pN,"shallowCopy() expects object parameter."),Is({},pN)))),dN.registerVersion("@firebase/firestore","1.13.0");var NN,AN={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"},kN=(Es(RN,NN=Error),RN);function RN(t,e,n){var r=NN.call(this,e)||this;return Object.setPrototypeOf(r,RN.prototype),r.code=t,r.details=n,r}function ON(t,e,n){var r=function(t){if(200<=t&&t<300)return"ok";switch(t){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}(t),i=r,o=void 0;try{var s=e&&e.error;if(s){var a=s.status;if("string"==typeof a){if(!AN[a])return new kN("internal","internal");r=AN[a],i=a}var u=s.message;"string"==typeof u&&(i=u),void 0!==(o=s.details)&&(o=n.decode(o))}}catch(t){}return"ok"===r?null:new kN(r,i,o)}var DN=(PN.prototype.getAuthToken=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:if(!this.auth)return[2,void 0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.auth.getToken()];case 2:return(e=t.sent())?[2,e.accessToken]:[2,void 0];case 3:return t.sent(),[2,void 0];case 4:return[2]}})})},PN.prototype.getInstanceIdToken=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){if(!(this.messaging&&"Notification"in self&&"granted"===Notification.permission))return[2,void 0];try{return[2,this.messaging.getToken()]}catch(t){return[2,void 0]}return[2]})})},PN.prototype.getContext=function(){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,this.getAuthToken()];case 1:return e=t.sent(),[4,this.getInstanceIdToken()];case 2:return n=t.sent(),[2,{authToken:e,instanceIdToken:n}]}})})},PN);function PN(t,e){var n=this;this.auth=null,this.messaging=null,this.auth=t.getImmediate({optional:!0}),this.messaging=e.getImmediate({optional:!0}),this.auth||t.get().then(function(t){return n.auth=t},function(){}),this.messaging||e.get().then(function(t){return n.messaging=t},function(){})}function xN(t,e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}var LN=(MN.prototype.encode=function(t){var e=this;if(null==t)return null;if(t instanceof Number&&(t=t.valueOf()),"number"==typeof t&&isFinite(t))return t;if(!0===t||!1===t)return t;if("[object String]"===Object.prototype.toString.call(t))return t;if(Array.isArray(t))return t.map(function(t){return e.encode(t)});if("function"==typeof t||"object"==typeof t)return xN(t,function(t){return e.encode(t)});throw new Error("Data cannot be encoded in JSON: "+t)},MN.prototype.decode=function(t){var e=this;if(null==t)return t;if(t["@type"])switch(t["@type"]){case"type.googleapis.com/google.protobuf.Int64Value":case"type.googleapis.com/google.protobuf.UInt64Value":var n=Number(t.value);if(isNaN(n))throw new Error("Data cannot be decoded from JSON: "+t);return n;default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map(function(t){return e.decode(t)}):"function"==typeof t||"object"==typeof t?xN(t,function(t){return e.decode(t)}):t},MN);function MN(){}var FN=(Object.defineProperty(UN.prototype,"app",{get:function(){return this.app_},enumerable:!0,configurable:!0}),UN.prototype._url=function(t){var e=this.app_.options.projectId,n=this.region_;return null===this.emulatorOrigin?"https://"+n+"-"+e+".cloudfunctions.net/"+t:this.emulatorOrigin+"/"+e+"/"+n+"/"+t},UN.prototype.useFunctionsEmulator=function(t){this.emulatorOrigin=t},UN.prototype.httpsCallable=function(e,n){var r=this;return function(t){return r.call(e,t,n||{})}},UN.prototype.postJSON=function(r,i,o){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:o.append("Content-Type","application/json"),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,fetch(r,{method:"POST",body:JSON.stringify(i),headers:o})];case 2:return e=t.sent(),[3,4];case 3:return t.sent(),[2,{status:0,json:null}];case 4:n=null,t.label=5;case 5:return t.trys.push([5,7,,8]),[4,e.json()];case 6:return n=t.sent(),[3,8];case 7:return t.sent(),[3,8];case 8:return[2,{status:e.status,json:n}]}})})},UN.prototype.call=function(c,h,l){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u;return Ss(this,function(t){switch(t.label){case 0:return e=this._url(c),h=this.serializer.encode(h),n={data:h},r=new Headers,[4,this.contextProvider.getContext()];case 1:return(i=t.sent()).authToken&&r.append("Authorization","Bearer "+i.authToken),i.instanceIdToken&&r.append("Firebase-Instance-ID-Token",i.instanceIdToken),o=l.timeout||7e4,[4,Promise.race([this.postJSON(e,n,r),function(n){return new Promise(function(t,e){setTimeout(function(){e(new kN("deadline-exceeded","deadline-exceeded"))},n)})}(o),this.cancelAllRequests])];case 2:if(!(s=t.sent()))throw new kN("cancelled","Firebase Functions instance was deleted.");if(a=ON(s.status,s.json,this.serializer))throw a;if(!s.json)throw new kN("internal","Response is not valid JSON object.");if(void 0===(u=s.json.data)&&(u=s.json.result),void 0===u)throw new kN("internal","Response is missing data field.");return[2,{data:this.serializer.decode(u)}]}})})},UN);function UN(t,e,n,r){var i=this;void 0===r&&(r="us-central1"),this.app_=t,this.region_=r,this.serializer=new LN,this.emulatorOrigin=null,this.INTERNAL={delete:function(){return i.deleteService()}},this.contextProvider=new DN(e,n),this.cancelAllRequests=new Promise(function(t){i.deleteService=function(){return t()}})}function jN(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),i=t.getProvider("messaging");return new FN(n,r,i,e)}var qN;function VN(n){return new Promise(function(t,e){n.onsuccess=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function BN(n,r,i){var o,t=new Promise(function(t,e){VN(o=n[r].apply(n,i)).then(t,e)});return t.request=o,t}function WN(t,n,e){e.forEach(function(e){Object.defineProperty(t.prototype,e,{get:function(){return this[n][e]},set:function(t){this[n][e]=t}})})}function HN(e,n,r,t){t.forEach(function(t){t in r.prototype&&(e.prototype[t]=function(){return BN(this[n],t,arguments)})})}function KN(e,n,r,t){t.forEach(function(t){t in r.prototype&&(e.prototype[t]=function(){return this[n][t].apply(this[n],arguments)})})}function GN(e,n,r,t){t.forEach(function(t){t in r.prototype&&(e.prototype[t]=function(){return function(t,e,n){var r=BN(t,e,n);return r.then(function(t){if(t)return new QN(t,r.request)})}(this[n],t,arguments)})})}function zN(t){this._index=t}function QN(t,e){this._cursor=t,this._request=e}function YN(t){this._store=t}function JN(n){this._tx=n,this.complete=new Promise(function(t,e){n.oncomplete=function(){t()},n.onerror=function(){e(n.error)},n.onabort=function(){e(n.error)}})}function XN(t,e,n){this._db=t,this.oldVersion=e,this.transaction=new JN(n)}function $N(t){this._db=t}function ZN(t,e,n){var r=BN(indexedDB,"open",[t,e]),i=r.request;return i&&(i.onupgradeneeded=function(t){n&&n(new XN(i.result,t.oldVersion,i.transaction))}),r.then(function(t){return new $N(t)})}function tA(t){return BN(indexedDB,"deleteDatabase",[t])}qN={Functions:FN},Kl.INTERNAL.registerComponent(new da("functions",jN,"PUBLIC").setServiceProps(qN).setMultipleInstances(!0)),Kl.registerVersion("@firebase/functions","0.4.38"),WN(zN,"_index",["name","keyPath","multiEntry","unique"]),HN(zN,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),GN(zN,"_index",IDBIndex,["openCursor","openKeyCursor"]),WN(QN,"_cursor",["direction","key","primaryKey","value"]),HN(QN,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(QN.prototype[n]=function(){var e=this,t=arguments;return Promise.resolve().then(function(){return e._cursor[n].apply(e._cursor,t),VN(e._request).then(function(t){if(t)return new QN(t,e._request)})})})}),YN.prototype.createIndex=function(){return new zN(this._store.createIndex.apply(this._store,arguments))},YN.prototype.index=function(){return new zN(this._store.index.apply(this._store,arguments))},WN(YN,"_store",["name","keyPath","indexNames","autoIncrement"]),HN(YN,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),GN(YN,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),KN(YN,"_store",IDBObjectStore,["deleteIndex"]),JN.prototype.objectStore=function(){return new YN(this._tx.objectStore.apply(this._tx,arguments))},WN(JN,"_tx",["objectStoreNames","mode"]),KN(JN,"_tx",IDBTransaction,["abort"]),XN.prototype.createObjectStore=function(){return new YN(this._db.createObjectStore.apply(this._db,arguments))},WN(XN,"_db",["name","version","objectStoreNames"]),KN(XN,"_db",IDBDatabase,["deleteObjectStore","close"]),$N.prototype.transaction=function(){return new JN(this._db.transaction.apply(this._db,arguments))},WN($N,"_db",["name","version","objectStoreNames"]),KN($N,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach(function(i){[YN,zN].forEach(function(t){i in t.prototype&&(t.prototype[i.replace("open","iterate")]=function(){var t=function(t){return Array.prototype.slice.call(t)}(arguments),e=t[t.length-1],n=this._store||this._index,r=n[i].apply(n,t.slice(0,-1));r.onsuccess=function(){e(r.result)}})})}),[zN,YN].forEach(function(t){t.prototype.getAll||(t.prototype.getAll=function(t,n){var r=this,i=[];return new Promise(function(e){r.iterateCursor(t,function(t){t?(i.push(t.value),void 0===n||i.length!=n?t.continue():e(i)):e(i)})})})});var eA,nA=1e4,rA="w:0.4.6",iA="FIS_v2",oA="https://firebaseinstallations.googleapis.com/v1",sA=36e5,aA=((eA={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',eA["not-registered"]="Firebase Installation is not registered.",eA["installation-not-found"]="Firebase Installation not found.",eA["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',eA["app-offline"]="Could not process request. Application offline.",eA["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",eA),uA=new zs("installations","Installations",aA);function cA(t){return t instanceof Ks&&t.code.includes("request-failed")}function hA(t){var e=t.projectId;return oA+"/projects/"+e+"/installations"}function lA(t){return{token:t.token,requestStatus:2,expiresIn:function(t){return Number(t.replace("s","000"))}(t.expiresIn),creationTime:Date.now()}}function fA(r,i){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,i.json()];case 1:return e=t.sent(),n=e.error,[2,uA.create("request-failed",{requestName:r,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})]}})})}function pA(t){var e=t.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function dA(t,e){var n=e.refreshToken,r=pA(t);return r.append("Authorization",function(t){return iA+" "+t}(n)),r}function vA(n){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,n()];case 1:return 500<=(e=t.sent()).status&&e.status<600?[2,n()]:[2,e]}})})}function yA(e){return new Promise(function(t){setTimeout(t,e)})}var gA=/^[cdef][\w-]{21}$/,mA="";function wA(){try{var t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;var e=function(t){return function(t){return btoa(String.fromCharCode.apply(String,As(t))).replace(/\+/g,"-").replace(/\//g,"_")}(t).substr(0,22)}(t);return gA.test(e)?e:mA}catch(t){return mA}}function bA(t){return t.appName+"!"+t.appId}var _A=new Map;function EA(t,e){var n=bA(t);IA(n,e),function(t,e){var n=SA();n&&n.postMessage({key:t,fid:e});CA()}(n,e)}function IA(t,e){var n,r,i=_A.get(t);if(i)try{for(var o=Cs(i),s=o.next();!s.done;s=o.next()){(0,s.value)(e)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}var TA=null;function SA(){return!TA&&"BroadcastChannel"in self&&((TA=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(t){IA(t.data.key,t.data.fid)}),TA}function CA(){0===_A.size&&TA&&(TA.close(),TA=null)}var NA,AA,kA="firebase-installations-database",RA=1,OA="firebase-installations-store",DA=null;function PA(){return DA=DA||ZN(kA,RA,function(t){switch(t.oldVersion){case 0:t.createObjectStore(OA)}})}function xA(s,a){return Ts(this,void 0,void 0,function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return e=bA(s),[4,PA()];case 1:return n=t.sent(),r=n.transaction(OA,"readwrite"),[4,(i=r.objectStore(OA)).get(e)];case 2:return o=t.sent(),[4,i.put(a,e)];case 3:return t.sent(),[4,r.complete];case 4:return t.sent(),o&&o.fid===a.fid||EA(s,a.fid),[2,a]}})})}function LA(i){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=bA(i),[4,PA()];case 1:return n=t.sent(),[4,(r=n.transaction(OA,"readwrite")).objectStore(OA).delete(e)];case 2:return t.sent(),[4,r.complete];case 3:return t.sent(),[2]}})})}function MA(a,u){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return e=bA(a),[4,PA()];case 1:return n=t.sent(),r=n.transaction(OA,"readwrite"),[4,(i=r.objectStore(OA)).get(e)];case 2:return o=t.sent(),void 0!==(s=u(o))?[3,4]:[4,i.delete(e)];case 3:return t.sent(),[3,6];case 4:return[4,i.put(s,e)];case 5:t.sent(),t.label=6;case 6:return[4,r.complete];case 7:return t.sent(),!s||o&&o.fid===s.fid||EA(a,s.fid),[2,s]}})})}function FA(i){return Ts(this,void 0,void 0,function(){var r,e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,MA(i,function(t){var e=function(t){return jA(t||{fid:wA(),registrationStatus:0})}(t),n=function(t,e){{if(0!==e.registrationStatus)return 1===e.registrationStatus?{installationEntry:e,registrationPromise:function(o){return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return[4,UA(o)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.registrationStatus?[3,5]:[4,yA(100)];case 3:return t.sent(),[4,UA(o)];case 4:return e=t.sent(),[3,2];case 5:return 0!==e.registrationStatus?[3,7]:[4,FA(o)];case 6:return n=t.sent(),r=n.installationEntry,(i=n.registrationPromise)?[2,i]:[2,r];case 7:return[2,e]}})})}(t)}:{installationEntry:e};if(!navigator.onLine){var n=Promise.reject(uA.create("app-offline"));return{installationEntry:e,registrationPromise:n}}var r={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},i=function(r,i){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,function(a,t){var u=t.fid;return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return e=hA(a),n=pA(a),r={fid:u,authVersion:iA,appId:a.appId,sdkVersion:rA},i={method:"POST",headers:n,body:JSON.stringify(r)},[4,vA(function(){return fetch(e,i)})];case 1:return(o=t.sent()).ok?[4,o.json()]:[3,3];case 2:return s=t.sent(),[2,{fid:s.fid||u,registrationStatus:2,refreshToken:s.refreshToken,authToken:lA(s.authToken)}];case 3:return[4,fA("Create Installation",o)];case 4:throw t.sent()}})})}(r,i)];case 1:return e=t.sent(),[2,xA(r,e)];case 2:return cA(n=t.sent())&&409===n.serverCode?[4,LA(r)]:[3,4];case 3:return t.sent(),[3,6];case 4:return[4,xA(r,{fid:i.fid,registrationStatus:0})];case 5:t.sent(),t.label=6;case 6:throw n;case 7:return[2]}})})}(t,r);return{installationEntry:r,registrationPromise:i}}}(i,e);return r=n.registrationPromise,n.installationEntry})];case 1:return(e=t.sent()).fid!==mA?[3,3]:(n={},[4,r]);case 2:return[2,(n.installationEntry=t.sent(),n)];case 3:return[2,{installationEntry:e,registrationPromise:r}]}})})}function UA(t){return MA(t,function(t){if(!t)throw uA.create("installation-not-found");return jA(t)})}function jA(t){return function(t){return 1===t.registrationStatus&&t.registrationTime+nA<Date.now()}(t)?{fid:t.fid,registrationStatus:0}:t}function qA(t,u){var c=t.appConfig,h=t.platformLoggerProvider;return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a;return Ss(this,function(t){switch(t.label){case 0:return e=function(t,e){var n=e.fid;return hA(t)+"/"+n+"/authTokens:generate"}(c,u),n=dA(c,u),(r=h.getImmediate({optional:!0}))&&n.append("x-firebase-client",r.getPlatformInfoString()),i={installation:{sdkVersion:rA}},o={method:"POST",headers:n,body:JSON.stringify(i)},[4,vA(function(){return fetch(e,o)})];case 1:return(s=t.sent()).ok?[4,s.json()]:[3,3];case 2:return a=t.sent(),[2,lA(a)];case 3:return[4,fA("Generate Auth Token",s)];case 4:throw t.sent()}})})}function VA(i,o){return void 0===o&&(o=!1),Ts(this,void 0,void 0,function(){var r,e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,MA(i.appConfig,function(t){if(!WA(t))throw uA.create("not-registered");var e=t.authToken;if(!o&&function(t){return 2===t.requestStatus&&!function(t){var e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+sA}(t)}(e))return t;if(1===e.requestStatus)return r=function(r,i){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,BA(r.appConfig)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.authToken.requestStatus?[3,5]:[4,yA(100)];case 3:return t.sent(),[4,BA(r.appConfig)];case 4:return e=t.sent(),[3,2];case 5:return 0===(n=e.authToken).requestStatus?[2,VA(r,i)]:[2,n]}})})}(i,o),t;if(!navigator.onLine)throw uA.create("app-offline");var n=function(t){var e={requestStatus:1,requestTime:Date.now()};return Is(Is({},t),{authToken:e})}(t);return r=function(i,o){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,8]),[4,qA(i,o)];case 1:return e=t.sent(),r=Is(Is({},o),{authToken:e}),[4,xA(i.appConfig,r)];case 2:return t.sent(),[2,e];case 3:return!cA(n=t.sent())||401!==n.serverCode&&404!==n.serverCode?[3,5]:[4,LA(i.appConfig)];case 4:return t.sent(),[3,7];case 5:return r=Is(Is({},o),{authToken:{requestStatus:0}}),[4,xA(i.appConfig,r)];case 6:t.sent(),t.label=7;case 7:throw n;case 8:return[2]}})})}(i,n),n})];case 1:return e=t.sent(),r?[4,r]:[3,3];case 2:return n=t.sent(),[3,4];case 3:n=e.authToken,t.label=4;case 4:return[2,n]}})})}function BA(t){return MA(t,function(t){if(!WA(t))throw uA.create("not-registered");return function(t){return 1===t.requestStatus&&t.requestTime+nA<Date.now()}(t.authToken)?Is(Is({},t),{authToken:{requestStatus:0}}):t})}function WA(t){return void 0!==t&&2===t.registrationStatus}function HA(e,n){return void 0===n&&(n=!1),Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,function(n){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,FA(n)];case 1:return(e=t.sent().registrationPromise)?[4,e]:[3,3];case 2:t.sent(),t.label=3;case 3:return[2]}})})}(e.appConfig)];case 1:return t.sent(),[4,VA(e,n)];case 2:return[2,t.sent().token]}})})}function KA(o,s){return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return e=function(t,e){var n=e.fid;return hA(t)+"/"+n}(o,s),n=dA(o,s),r={method:"DELETE",headers:n},[4,vA(function(){return fetch(e,r)})];case 1:return(i=t.sent()).ok?[3,3]:[4,fA("Delete Installation",i)];case 2:throw t.sent();case 3:return[2]}})})}function GA(t,e){var n=t.appConfig;return function(t,e){SA();var n=bA(t),r=_A.get(n);r||(r=new Set,_A.set(n,r)),r.add(e)}(n,e),function(){!function(t,e){var n=bA(t),r=_A.get(n);r&&(r.delete(e),0===r.size&&_A.delete(n),CA())}(n,e)}}function zA(t){return uA.create("missing-app-config-values",{valueName:t})}(NA=Kl).INTERNAL.registerComponent(new da("installations",function(t){var e=t.getProvider("app").getImmediate(),n={appConfig:function(t){var e,n;if(!t||!t.options)throw zA("App Configuration");if(!t.name)throw zA("App Name");try{for(var r=Cs(["projectId","apiKey","appId"]),i=r.next();!i.done;i=r.next()){var o=i.value;if(!t.options[o])throw zA(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(e),platformLoggerProvider:t.getProvider("platform-logger")};return{app:e,getId:function(){return function(i){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return[4,FA(i.appConfig)];case 1:return e=t.sent(),n=e.installationEntry,(r=e.registrationPromise)?r.catch(console.error):VA(i).catch(console.error),[2,n.fid]}})})}(n)},getToken:function(t){return HA(n,t)},delete:function(){return function(r){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,MA(e=r.appConfig,function(t){if(!t||0!==t.registrationStatus)return t})];case 1:if(!(n=t.sent()))return[3,6];if(1!==n.registrationStatus)return[3,2];throw uA.create("delete-pending-registration");case 2:if(2!==n.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw uA.create("app-offline");case 3:return[4,KA(e,n)];case 4:return t.sent(),[4,LA(e)];case 5:t.sent(),t.label=6;case 6:return[2]}})})}(n)},onIdChange:function(t){return GA(n,t)}}},"PUBLIC")),NA.registerVersion("@firebase/installations","0.4.6");var QA=((AA={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',AA["only-available-in-window"]="This method is available in a Window context.",AA["only-available-in-sw"]="This method is available in a service worker context.",AA["permission-default"]="The notification permission was not granted and dismissed instead.",AA["permission-blocked"]="The notification permission was not granted and blocked instead.",AA["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",AA["failed-service-worker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",AA["token-subscribe-failed"]="A problem occured while subscribing the user to FCM: {$errorInfo}",AA["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",AA["token-unsubscribe-failed"]="A problem occured while unsubscribing the user from FCM: {$errorInfo}",AA["token-update-failed"]="A problem occured while updating the user from FCM: {$errorInfo}",AA["token-update-no-token"]="FCM returned no token when updating the user to push.",AA["use-sw-after-get-token"]="The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.",AA["invalid-sw-registration"]="The input to useServiceWorker() must be a ServiceWorkerRegistration.",AA["invalid-bg-handler"]="The input to setBackgroundMessageHandler() must be a function.",AA["invalid-vapid-key"]="The public VAPID key must be a string.",AA["use-vapid-key-after-get-token"]="The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used.",AA),YA=new zs("messaging","Messaging",QA);function JA(t){return YA.create("missing-app-config-values",{valueName:t})}function XA(t){var e=new Uint8Array(t);return btoa(String.fromCharCode.apply(String,As(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var $A="fcm_token_details_db",ZA=5,tk="fcm_token_object_Store";function ek(a){return Ts(this,void 0,void 0,function(){var e,s,n=this;return Ss(this,function(t){switch(t.label){case 0:return"databases"in indexedDB?[4,indexedDB.databases()]:[3,2];case 1:if(e=t.sent(),!e.map(function(t){return t.name}).includes($A))return[2,null];t.label=2;case 2:return s=null,[4,ZN($A,ZA,function(o){return Ts(n,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return o.oldVersion<2?[2]:o.objectStoreNames.contains(tk)?[4,(e=o.transaction.objectStore(tk)).index("fcmSenderId").get(a)]:[2];case 1:return n=t.sent(),[4,e.clear()];case 2:if(t.sent(),!n)return[2];if(2===o.oldVersion){if(!(r=n).auth||!r.p256dh||!r.endpoint)return[2];s={token:r.fcmToken,createTime:null!==(i=r.createTime)&&void 0!==i?i:Date.now(),subscriptionOptions:{auth:r.auth,p256dh:r.p256dh,endpoint:r.endpoint,swScope:r.swScope,vapidKey:"string"==typeof r.vapidKey?r.vapidKey:XA(r.vapidKey)}}}else 3===o.oldVersion?s={token:(r=n).fcmToken,createTime:r.createTime,subscriptionOptions:{auth:XA(r.auth),p256dh:XA(r.p256dh),endpoint:r.endpoint,swScope:r.swScope,vapidKey:XA(r.vapidKey)}}:4===o.oldVersion&&(s={token:(r=n).fcmToken,createTime:r.createTime,subscriptionOptions:{auth:XA(r.auth),p256dh:XA(r.p256dh),endpoint:r.endpoint,swScope:r.swScope,vapidKey:XA(r.vapidKey)}});return[2]}})})})];case 3:return t.sent().close(),[4,tA($A)];case 4:return t.sent(),[4,tA("fcm_vapid_details_db")];case 5:return t.sent(),[4,tA("undefined")];case 6:return t.sent(),[2,function(t){if(!t||!t.subscriptionOptions)return!1;var e=t.subscriptionOptions;return"number"==typeof t.createTime&&0<t.createTime&&"string"==typeof t.token&&0<t.token.length&&"string"==typeof e.auth&&0<e.auth.length&&"string"==typeof e.p256dh&&0<e.p256dh.length&&"string"==typeof e.endpoint&&0<e.endpoint.length&&"string"==typeof e.swScope&&0<e.swScope.length&&"string"==typeof e.vapidKey&&0<e.vapidKey.length}(s)?s:null]}})})}var nk="firebase-messaging-database",rk=1,ik="firebase-messaging-store",ok=null;function sk(){return ok=ok||ZN(nk,rk,function(t){switch(t.oldVersion){case 0:t.createObjectStore(ik)}})}function ak(i){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=ck(i),[4,sk()];case 1:return[4,t.sent().transaction(ik).objectStore(ik).get(e)];case 2:return(n=t.sent())?[2,n]:[3,3];case 3:return[4,ek(i.appConfig.senderId)];case 4:return(r=t.sent())?[4,uk(i,r)]:[3,6];case 5:return t.sent(),[2,r];case 6:return[2]}})})}function uk(i,o){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=ck(i),[4,sk()];case 1:return n=t.sent(),[4,(r=n.transaction(ik,"readwrite")).objectStore(ik).put(o,e)];case 2:return t.sent(),[4,r.complete];case 3:return t.sent(),[2,o]}})})}function ck(t){return t.appConfig.appId}var hk="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",lk="https://fcmregistrations.googleapis.com/v1",fk="FCM_MSG",pk="google.c.a.c_id";function dk(s,a){return Ts(this,void 0,void 0,function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return[4,yk(s)];case 1:e=t.sent(),n={method:"DELETE",headers:e},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(vk(s.appConfig)+"/"+a,n)];case 3:return[4,t.sent().json()];case 4:if((r=t.sent()).error)throw i=r.error.message,YA.create("token-unsubscribe-failed",{errorInfo:i});return[3,6];case 5:throw o=t.sent(),YA.create("token-unsubscribe-failed",{errorInfo:o});case 6:return[2]}})})}function vk(t){var e=t.projectId;return lk+"/projects/"+e+"/registrations"}function yk(t){var n=t.appConfig,r=t.installations;return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,r.getToken()];case 1:return e=t.sent(),[2,new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":n.apiKey,"x-goog-firebase-installations-auth":"FIS "+e})]}})})}function gk(t){var e=t.p256dh,n=t.auth,r=t.endpoint,i=t.vapidKey,o={web:{endpoint:r,auth:n,p256dh:e}};return i!==hk&&(o.web.applicationPubKey=i),o}var mk,wk;function bk(o,s,a){return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:if("granted"!==Notification.permission)throw YA.create("permission-blocked");return[4,function(n,r){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,n.pushManager.getSubscription()];case 1:return(e=t.sent())?[2,e]:[2,n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:r})]}})})}(s,a)];case 1:return e=t.sent(),[4,ak(o)];case 2:return n=t.sent(),r={vapidKey:a,swScope:s.scope,endpoint:e.endpoint,auth:XA(e.getKey("auth")),p256dh:XA(e.getKey("p256dh"))},n?[3,3]:[2,Ek(o,r)];case 3:if(function(t,e){var n=e.vapidKey===t.vapidKey,r=e.endpoint===t.endpoint,i=e.auth===t.auth,o=e.p256dh===t.p256dh;return n&&r&&i&&o}(n.subscriptionOptions,r))return[3,8];t.label=4;case 4:return t.trys.push([4,6,,7]),[4,dk(o,n.token)];case 5:return t.sent(),[3,7];case 6:return i=t.sent(),console.warn(i),[3,7];case 7:return[2,Ek(o,r)];case 8:return Date.now()>=n.createTime+6048e5?[2,function(i,o,s){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,5]),[4,function(a,u){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return[4,yk(a)];case 1:e=t.sent(),n=gk(u.subscriptionOptions),r={method:"PATCH",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(vk(a.appConfig)+"/"+u.token,r)];case 3:return[4,t.sent().json()];case 4:return i=t.sent(),[3,6];case 5:throw o=t.sent(),YA.create("token-update-failed",{errorInfo:o});case 6:if(i.error)throw s=i.error.message,YA.create("token-update-failed",{errorInfo:s});if(!i.token)throw YA.create("token-update-no-token");return[2,i.token]}})})}(o,i)];case 1:return e=t.sent(),n=Is({token:e,createTime:Date.now()},i),[4,uk(o,n)];case 2:return t.sent(),[2,e];case 3:return r=t.sent(),[4,_k(o,s)];case 4:throw t.sent(),r;case 5:return[2]}})})}({token:n.token,createTime:Date.now(),subscriptionOptions:r},o,s)]:[2,n.token];case 9:return[2]}})})}function _k(r,i){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,ak(r)];case 1:return(e=t.sent())?[4,dk(r,e.token)]:[3,4];case 2:return t.sent(),[4,function(i){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=ck(i),[4,sk()];case 1:return n=t.sent(),[4,(r=n.transaction(ik,"readwrite")).objectStore(ik).delete(e)];case 2:return t.sent(),[4,r.complete];case 3:return t.sent(),[2]}})})}(r)];case 3:t.sent(),t.label=4;case 4:return[4,i.pushManager.getSubscription()];case 5:return(n=t.sent())?[2,n.unsubscribe()]:[2,!0]}})})}function Ek(r,i){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,function(a,u){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return[4,yk(a)];case 1:e=t.sent(),n=gk(u),r={method:"POST",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(vk(a.appConfig),r)];case 3:return[4,t.sent().json()];case 4:return i=t.sent(),[3,6];case 5:throw o=t.sent(),YA.create("token-subscribe-failed",{errorInfo:o});case 6:if(i.error)throw s=i.error.message,YA.create("token-subscribe-failed",{errorInfo:s});if(!i.token)throw YA.create("token-subscribe-no-token");return[2,i.token]}})})}(r,i)];case 1:return e=t.sent(),n={token:e,createTime:Date.now(),subscriptionOptions:i},[4,uk(r,n)];case 2:return t.sent(),[2,n.token]}})})}function Ik(t){return"object"==typeof t&&!!t&&pk in t}(wk=mk=mk||{}).PUSH_RECEIVED="push-received",wk.NOTIFICATION_CLICKED="notification-clicked";var Tk=(Object.defineProperty(Sk.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!0,configurable:!0}),Sk.prototype.getToken=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.vapidKey||(this.vapidKey=hk),[4,this.getServiceWorkerRegistration()];case 1:return e=t.sent(),"default"!==Notification.permission?[3,3]:[4,Notification.requestPermission()];case 2:t.sent(),t.label=3;case 3:if("granted"!==Notification.permission)throw YA.create("permission-blocked");return[2,bk(this.firebaseDependencies,e,this.vapidKey)]}})})},Sk.prototype.deleteToken=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return e=t.sent(),[2,_k(this.firebaseDependencies,e)]}})})},Sk.prototype.requestPermission=function(){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return"granted"===Notification.permission?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(e=t.sent()))return[2];throw"denied"===e?YA.create("permission-blocked"):YA.create("permission-default")}})})},Sk.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw YA.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw YA.create("invalid-vapid-key");this.vapidKey=t},Sk.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw YA.create("invalid-sw-registration");if(this.swRegistration)throw YA.create("use-sw-after-get-token");this.swRegistration=t},Sk.prototype.onMessage=function(t){var e=this;return this.onMessageCallback="function"==typeof t?t:t.next,function(){e.onMessageCallback=null}},Sk.prototype.setBackgroundMessageHandler=function(){throw YA.create("only-available-in-sw")},Sk.prototype.onTokenRefresh=function(){return function(){}},Sk.prototype.getServiceWorkerRegistration=function(){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:if(this.swRegistration)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),e=this,[4,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"})];case 2:return e.swRegistration=t.sent(),this.swRegistration.update().catch(function(){}),[3,4];case 3:throw n=t.sent(),YA.create("failed-service-worker-registration",{browserErrorMessage:n.message});case 4:return[2,this.swRegistration]}})})},Sk.prototype.messageEventListener=function(o){var s;return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return(null===(s=o.data)||void 0===s?void 0:s.firebaseMessaging)?(e=o.data.firebaseMessaging,n=e.type,r=e.payload,this.onMessageCallback&&n===mk.PUSH_RECEIVED&&this.onMessageCallback(r),Ik(i=r.data)&&"1"===i["google.c.a.e"]?[4,this.logEvent(n,i)]:[3,2]):[2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},Sk.prototype.logEvent=function(n,r){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return e=function(t){switch(t){case mk.NOTIFICATION_CLICKED:return"notification_open";case mk.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(n),[4,this.firebaseDependencies.analyticsProvider.get()];case 1:return t.sent().logEvent(e,{message_id:r[pk],message_name:r["google.c.a.c_l"],message_time:r["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}})})},Sk);function Sk(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",function(t){return e.messageEventListener(t)})}var Ck=(Object.defineProperty(Nk.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!0,configurable:!0}),Nk.prototype.setBackgroundMessageHandler=function(t){if(!t||"function"!=typeof t)throw YA.create("invalid-bg-handler");this.bgMessageHandler=t},Nk.prototype.getToken=function(){var n,r;return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.vapidKey?[3,2]:[4,ak(this.firebaseDependencies)];case 1:e=t.sent(),this.vapidKey=null!==(r=null===(n=null==e?void 0:e.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==r?r:hk,t.label=2;case 2:return[2,bk(this.firebaseDependencies,self.registration,this.vapidKey)]}})})},Nk.prototype.deleteToken=function(){return _k(this.firebaseDependencies,self.registration)},Nk.prototype.requestPermission=function(){throw YA.create("only-available-in-window")},Nk.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw YA.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw YA.create("invalid-vapid-key");this.vapidKey=t},Nk.prototype.useServiceWorker=function(){throw YA.create("only-available-in-window")},Nk.prototype.onMessage=function(){throw YA.create("only-available-in-window")},Nk.prototype.onTokenRefresh=function(){throw YA.create("only-available-in-window")},Nk.prototype.onPush=function(i){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return(e=function(t){var e=t.data;if(!e)return null;try{return e.json()}catch(t){return null}}(i))?[4,Ak()]:[2];case 1:return function(t){return t.some(function(t){return"visible"===t.visibilityState&&!t.url.startsWith("chrome-extension://")})}(n=t.sent())?[2,function(t,e){var n,r,i=kk(mk.PUSH_RECEIVED,e);try{for(var o=Cs(t),s=o.next();!s.done;s=o.next())s.value.postMessage(i)}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}(n,e)]:(r=function(t){var e;if(t&&"object"==typeof t.notification){var n=Is({},t.notification);return n.data=Is(Is({},t.notification.data),((e={})[fk]=t,e)),n}}(e))?[4,function(t){var e,n=null!==(e=t.title)&&void 0!==e?e:"",r=t.actions,i=Notification.maxActions;return r&&i&&r.length>i&&console.warn("This browser only supports "+i+" actions. The remaining actions will not be displayed."),self.registration.showNotification(n,t)}(r)]:[3,3];case 2:return t.sent(),[3,5];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(e)]:[3,5];case 4:t.sent(),t.label=5;case 5:return[2]}})})},Nk.prototype.onSubChange=function(n){var r,i;return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return n.newSubscription?[3,2]:[4,_k(this.firebaseDependencies,self.registration)];case 1:return t.sent(),[2];case 2:return[4,ak(this.firebaseDependencies)];case 3:return e=t.sent(),[4,_k(this.firebaseDependencies,self.registration)];case 4:return t.sent(),[4,bk(this.firebaseDependencies,self.registration,null!==(i=null===(r=null==e?void 0:e.subscriptionOptions)||void 0===r?void 0:r.vapidKey)&&void 0!==i?i:hk)];case 5:return t.sent(),[2]}})})},Nk.prototype.onNotificationClick=function(o){var s,a;return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return(e=null===(a=null===(s=o.notification)||void 0===s?void 0:s.data)||void 0===a?void 0:a[fk])?o.action?[2]:(o.stopImmediatePropagation(),o.notification.close(),(n=function(t){var e,n,r,i=null!==(n=null===(e=t.fcmOptions)||void 0===e?void 0:e.link)&&void 0!==n?n:null===(r=t.notification)||void 0===r?void 0:r.click_action;return i||(Ik(t.data)?self.location.origin:null)}(e))?[4,function(u){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a;return Ss(this,function(t){switch(t.label){case 0:return e=new URL(u,self.location.href).href,[4,Ak()];case 1:n=t.sent();try{for(r=Cs(n),i=r.next();!i.done;i=r.next())if(o=i.value,new URL(o.url,self.location.href).href===e)return[2,o]}catch(t){s={error:t}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}}return[2,null]}})})}(n)]:[2]):[2];case 1:return(r=t.sent())?[3,4]:[4,self.clients.openWindow(n)];case 2:return r=t.sent(),[4,function(e){return new Promise(function(t){setTimeout(t,e)})}(3e3)];case 3:return t.sent(),[3,6];case 4:return[4,r.focus()];case 5:r=t.sent(),t.label=6;case 6:return r?(i=kk(mk.NOTIFICATION_CLICKED,e),[2,r.postMessage(i)]):[2]}})})},Nk);function Nk(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.bgMessageHandler=null,self.addEventListener("push",function(t){t.waitUntil(e.onPush(t))}),self.addEventListener("pushsubscriptionchange",function(t){t.waitUntil(e.onSubChange(t))}),self.addEventListener("notificationclick",function(t){t.waitUntil(e.onNotificationClick(t))})}function Ak(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function kk(t,e){return{firebaseMessaging:{type:t,payload:e}}}var Rk={isSupported:Ok};function Ok(){return self&&"ServiceWorkerGlobalScope"in self?"indexedDB"in self&&null!==indexedDB&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey"):"indexedDB"in window&&null!==indexedDB&&navigator.cookieEnabled&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}Kl.INTERNAL.registerComponent(new da("messaging",function(t){var e=t.getProvider("app").getImmediate(),n={app:e,appConfig:function(t){var e,n;if(!t||!t.options)throw JA("App Configuration Object");if(!t.name)throw JA("App Name");var r=t.options;try{for(var i=Cs(["projectId","apiKey","appId","messagingSenderId"]),o=i.next();!o.done;o=i.next()){var s=o.value;if(!r[s])throw JA(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return{appName:t.name,projectId:r.projectId,apiKey:r.apiKey,appId:r.appId,senderId:r.messagingSenderId}}(e),installations:t.getProvider("installations").getImmediate(),analyticsProvider:t.getProvider("analytics-internal")};if(!Ok())throw YA.create("unsupported-browser");return self&&"ServiceWorkerGlobalScope"in self?new Ck(n):new Tk(n)},"PUBLIC").setServiceProps(Rk));var Dk="firebasestorage.googleapis.com",Pk="storageBucket",xk=(Lk.prototype.codeProp=function(){return this.code},Lk.prototype.codeEquals=function(t){return Fk(t)===this.codeProp()},Lk.prototype.serverResponseProp=function(){return this.serverResponse_},Lk.prototype.setServerResponseProp=function(t){this.serverResponse_=t},Object.defineProperty(Lk.prototype,"name",{get:function(){return this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(Lk.prototype,"code",{get:function(){return this.code_},enumerable:!0,configurable:!0}),Object.defineProperty(Lk.prototype,"message",{get:function(){return this.message_},enumerable:!0,configurable:!0}),Object.defineProperty(Lk.prototype,"serverResponse",{get:function(){return this.serverResponse_},enumerable:!0,configurable:!0}),Lk);function Lk(t,e){this.code_=Fk(t),this.message_="Firebase Storage: "+e,this.serverResponse_=null,this.name_="FirebaseError"}var Mk={UNKNOWN:"unknown",OBJECT_NOT_FOUND:"object-not-found",BUCKET_NOT_FOUND:"bucket-not-found",PROJECT_NOT_FOUND:"project-not-found",QUOTA_EXCEEDED:"quota-exceeded",UNAUTHENTICATED:"unauthenticated",UNAUTHORIZED:"unauthorized",RETRY_LIMIT_EXCEEDED:"retry-limit-exceeded",INVALID_CHECKSUM:"invalid-checksum",CANCELED:"canceled",INVALID_EVENT_NAME:"invalid-event-name",INVALID_URL:"invalid-url",INVALID_DEFAULT_BUCKET:"invalid-default-bucket",NO_DEFAULT_BUCKET:"no-default-bucket",CANNOT_SLICE_BLOB:"cannot-slice-blob",SERVER_FILE_WRONG_SIZE:"server-file-wrong-size",NO_DOWNLOAD_URL:"no-download-url",INVALID_ARGUMENT:"invalid-argument",INVALID_ARGUMENT_COUNT:"invalid-argument-count",APP_DELETED:"app-deleted",INVALID_ROOT_OPERATION:"invalid-root-operation",INVALID_FORMAT:"invalid-format",INTERNAL_ERROR:"internal-error"};function Fk(t){return"storage/"+t}function Uk(){return new xk(Mk.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function jk(){return new xk(Mk.CANCELED,"User canceled the upload/download.")}function qk(){return new xk(Mk.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Vk(t,e,n){return new xk(Mk.INVALID_ARGUMENT,"Invalid argument in `"+e+"` at index "+t+": "+n)}function Bk(){return new xk(Mk.APP_DELETED,"The Firebase app was deleted.")}function Wk(t,e){return new xk(Mk.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function Hk(t){throw new xk(Mk.INTERNAL_ERROR,"Internal error: "+t)}var Kk={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};function Gk(t){switch(t){case Kk.RAW:case Kk.BASE64:case Kk.BASE64URL:case Kk.DATA_URL:return;default:throw"Expected one of the event types: ["+Kk.RAW+", "+Kk.BASE64+", "+Kk.BASE64URL+", "+Kk.DATA_URL+"]."}}var zk=function(t,e){this.data=t,this.contentType=e||null};function Qk(t,e){switch(t){case Kk.RAW:return new zk(Yk(e));case Kk.BASE64:case Kk.BASE64URL:return new zk(Jk(t,e));case Kk.DATA_URL:return new zk(function(t){var e=new Xk(t);return e.base64?Jk(Kk.BASE64,e.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(t){throw Wk(Kk.DATA_URL,"Malformed data URL.")}return Yk(e)}(e.rest)}(e),function(t){return new Xk(t).contentType}(e))}throw Uk()}function Yk(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|63&r);else if(55296==(64512&r))if(n<t.length-1&&56320==(64512&t.charCodeAt(n+1)))r=65536|(1023&r)<<10|1023&t.charCodeAt(++n),e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r);else e.push(239,191,189);else 56320==(64512&r)?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|63&r)}return new Uint8Array(e)}function Jk(e,t){switch(e){case Kk.BASE64:var n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r)throw Wk(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case Kk.BASE64URL:var i=-1!==t.indexOf("+"),o=-1!==t.indexOf("/");if(i||o)throw Wk(e,"Invalid character '"+(i?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/")}var s;try{s=atob(t)}catch(t){throw Wk(e,"Invalid character found")}for(var a=new Uint8Array(s.length),u=0;u<s.length;u++)a[u]=s.charCodeAt(u);return a}var Xk=function(t){this.base64=!1,this.contentType=null;var e=t.match(/^data:([^,]+)?,/);if(null===e)throw Wk(Kk.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");var n=e[1]||null;null!=n&&(this.base64=function(t,e){return t.length>=e.length&&t.substring(t.length-e.length)===e}(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-";base64".length):n),this.rest=t.substring(t.indexOf(",")+1)};var $k,Zk,tR={STATE_CHANGED:"state_changed"},eR="running",nR="pausing",rR="paused",iR="success",oR="canceling",sR="canceled",aR="error",uR={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function cR(t){switch(t){case eR:case nR:case oR:return uR.RUNNING;case rR:return uR.PAUSED;case iR:return uR.SUCCESS;case sR:return uR.CANCELED;case aR:default:return uR.ERROR}}function hR(t){return null!=t}function lR(t){return void 0!==t}function fR(t){return"function"==typeof t}function pR(t){return"object"==typeof t}function dR(t){return"string"==typeof t||t instanceof String}function vR(t){return"number"==typeof t||t instanceof Number}function yR(t){return gR()&&t instanceof Blob}function gR(){return"undefined"!=typeof Blob}(Zk=$k=$k||{})[Zk.NO_ERROR=0]="NO_ERROR",Zk[Zk.NETWORK_ERROR=1]="NETWORK_ERROR",Zk[Zk.ABORT=2]="ABORT";var mR=(wR.prototype.send=function(t,e,n,r){if(this.sent_)throw Hk("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(e,t,!0),hR(r))for(var i in r)r.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,r[i].toString());return hR(n)?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},wR.prototype.getErrorCode=function(){if(!this.sent_)throw Hk("cannot .getErrorCode() before sending");return this.errorCode_},wR.prototype.getStatus=function(){if(!this.sent_)throw Hk("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},wR.prototype.getResponseText=function(){if(!this.sent_)throw Hk("cannot .getResponseText() before sending");return this.xhr_.responseText},wR.prototype.abort=function(){this.xhr_.abort()},wR.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},wR.prototype.addUploadProgressListener=function(t){hR(this.xhr_.upload)&&this.xhr_.upload.addEventListener("progress",t)},wR.prototype.removeUploadProgressListener=function(t){hR(this.xhr_.upload)&&this.xhr_.upload.removeEventListener("progress",t)},wR);function wR(){var e=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=$k.NO_ERROR,this.sendPromise_=new Promise(function(t){e.xhr_.addEventListener("abort",function(){e.errorCode_=$k.ABORT,t(e)}),e.xhr_.addEventListener("error",function(){e.errorCode_=$k.NETWORK_ERROR,t(e)}),e.xhr_.addEventListener("load",function(){t(e)})})}var bR=(_R.prototype.createXhrIo=function(){return new mR},_R);function _R(){}function ER(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0;if(void 0!==n){for(var r=new n,i=0;i<t.length;i++)r.append(t[i]);return r.getBlob()}if(gR())return new Blob(t);throw Error("This browser doesn't seem to support creating Blobs")}var IR=(TR.prototype.size=function(){return this.size_},TR.prototype.type=function(){return this.type_},TR.prototype.slice=function(t,e){if(yR(this.data_)){var n=function(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}(this.data_,t,e);return null===n?null:new TR(n)}return new TR(new Uint8Array(this.data_.buffer,t,e-t),!0)},TR.getBlob=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(gR()){var n=t.map(function(t){return t instanceof TR?t.data_:t});return new TR(ER.apply(null,n))}var r=t.map(function(t){return dR(t)?Qk(Kk.RAW,t).data:t.data_}),i=0;r.forEach(function(t){i+=t.byteLength});var o=new Uint8Array(i),s=0;return r.forEach(function(t){for(var e=0;e<t.length;e++)o[s++]=t[e]}),new TR(o,!0)},TR.prototype.uploadData=function(){return this.data_},TR);function TR(t,e){var n=0,r="";yR(t)?(n=(this.data_=t).size,r=t.type):t instanceof ArrayBuffer?(e?this.data_=new Uint8Array(t):(this.data_=new Uint8Array(t.byteLength),this.data_.set(new Uint8Array(t))),n=this.data_.length):t instanceof Uint8Array&&(e?this.data_=t:(this.data_=new Uint8Array(t.length),this.data_.set(t)),n=t.length),this.size_=n,this.type_=r}var SR=(Object.defineProperty(CR.prototype,"path",{get:function(){return this.path_},enumerable:!0,configurable:!0}),Object.defineProperty(CR.prototype,"isRoot",{get:function(){return 0===this.path.length},enumerable:!0,configurable:!0}),CR.prototype.fullServerUrl=function(){var t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)},CR.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},CR.makeFromBucketSpec=function(e){var t;try{t=CR.makeFromUrl(e)}catch(t){return new CR(e,"")}if(""===t.path)return t;throw function(t){return new xk(Mk.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}(e)},CR.makeFromUrl=function(t){for(var e=null,n="([A-Za-z0-9.\\-_]+)",r=new RegExp("^gs://"+n+"(/(.*))?$","i"),i=Dk.replace(/[.]/g,"\\."),o=[{regex:r,indices:{bucket:1,path:3},postModify:function(t){"/"===t.path.charAt(t.path.length-1)&&(t.path_=t.path_.slice(0,-1))}},{regex:new RegExp("^https?://"+i+"/v[A-Za-z0-9_]+/b/"+n+"/o(/([^?#]*).*)?$","i"),indices:{bucket:1,path:3},postModify:function(t){t.path_=decodeURIComponent(t.path)}}],s=0;s<o.length;s++){var a=o[s],u=a.regex.exec(t);if(u){var c=u[a.indices.bucket],h=u[a.indices.path];e=new CR(c,h=h||""),a.postModify(e);break}}if(null==e)throw function(t){return new xk(Mk.INVALID_URL,"Invalid URL '"+t+"'.")}(t);return e},CR);function CR(t,e){this.bucket=t,this.path_=e}function NR(t){var e;try{e=JSON.parse(t)}catch(t){return null}return function(t){return pR(t)&&!Array.isArray(t)}(e)?e:null}function AR(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function kR(t){return"https://"+Dk+"/v0"+t}function RR(t){var e=encodeURIComponent,n="?";for(var r in t){if(t.hasOwnProperty(r))n=n+(e(r)+"="+e(t[r]))+"&"}return n=n.slice(0,-1)}function OR(t,e){return e}var DR=function(t,e,n,r){this.server=t,this.local=e||t,this.writable=!!n,this.xform=r||OR},PR=null;function xR(){if(PR)return PR;var t=[];t.push(new DR("bucket")),t.push(new DR("generation")),t.push(new DR("metageneration")),t.push(new DR("name","fullPath",!0));var e=new DR("name");e.xform=function(t,e){return function(t){return!dR(t)||t.length<2?t:AR(t)}(e)},t.push(e);var n=new DR("size");return n.xform=function(t,e){return hR(e)?Number(e):e},t.push(n),t.push(new DR("timeCreated")),t.push(new DR("updated")),t.push(new DR("md5Hash",null,!0)),t.push(new DR("cacheControl",null,!0)),t.push(new DR("contentDisposition",null,!0)),t.push(new DR("contentEncoding",null,!0)),t.push(new DR("contentLanguage",null,!0)),t.push(new DR("contentType",null,!0)),t.push(new DR("metadata","customMetadata",!0)),PR=t}function LR(r,i){Object.defineProperty(r,"ref",{get:function(){var t=r.bucket,e=r.fullPath,n=new SR(t,e);return i.makeStorageReference(n)}})}function MR(t,e,n){var r=NR(e);return null===r?null:function(t,e,n){for(var r={type:"file"},i=n.length,o=0;o<i;o++){var s=n[o];r[s.local]=s.xform(r,e[s.server])}return LR(r,t),r}(t,r,n)}function FR(t,e){for(var n={},r=e.length,i=0;i<r;i++){var o=e[i];o.writable&&(n[o.server]=t[o.local])}return JSON.stringify(n)}function UR(t){if(!pR(t)||!t)throw"Expected Metadata object.";for(var e in t)if(t.hasOwnProperty(e)){var n=t[e];if("customMetadata"===e){if(!pR(n))throw"Expected object for 'customMetadata' mapping."}else if(pR(r=n)&&null!==r)throw"Mapping for '"+e+"' cannot be an object."}var r}var jR="maxResults",qR=1e3,VR="pageToken",BR="prefixes",WR="items";function HR(t,e){var n={prefixes:[],items:[],nextPageToken:e.nextPageToken},r=t.bucket();if(null===r)throw new xk(Mk.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+Pk+"' property when initializing the app?");if(e[BR])for(var i=0,o=e[BR];i<o.length;i++){var s=o[i].replace(/\/$/,""),a=t.makeStorageReference(new SR(r,s));n.prefixes.push(a)}if(e[WR])for(var u=0,c=e[WR];u<c.length;u++){var h=c[u];a=t.makeStorageReference(new SR(r,h.name));n.items.push(a)}return n}function KR(t){if(!pR(t)||!t)throw"Expected ListOptions object.";for(var e in t)if(e===jR){if(!vR(n=t[jR])||!Number.isInteger(n)||t[jR]<=0)throw"Expected maxResults to be a positive number.";if(1e3<t[jR])throw"Expected maxResults to be less than or equal to "+qR+"."}else{if(e!==VR)throw"Unknown option: "+e;if(t[VR]&&!dR(t[VR]))throw"Expected pageToken to be string."}var n}var GR=function(t,e,n,r){this.url=t,this.method=e,this.handler=n,this.timeout=r,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]};function zR(t){if(!t)throw Uk()}function QR(r,i){return function(t,e){var n=MR(r,e,i);return zR(null!==n),n}}function YR(r){return function(t,e){var n=function(t,e){var n=NR(e);return null===n?null:HR(t,n)}(r,e);return zR(null!==n),n}}function JR(r,i){return function(t,e){var n=MR(r,e,i);return zR(null!==n),function(r,t){var e=NR(t);if(null===e)return null;if(!dR(e.downloadTokens))return null;var n=e.downloadTokens;if(0===n.length)return null;var i=encodeURIComponent;return n.split(",").map(function(t){var e=r.bucket,n=r.fullPath;return kR("/b/"+i(e)+"/o/"+i(n))+RR({alt:"media",token:t})})[0]}(n,e)}}function XR(r){return function(t,e){var n;return(n=401===t.getStatus()?new xk(Mk.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?function(t){return new xk(Mk.QUOTA_EXCEEDED,"Quota for bucket '"+t+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}(r.bucket):403===t.getStatus()?function(t){return new xk(Mk.UNAUTHORIZED,"User does not have permission to access '"+t+"'.")}(r.path):e).setServerResponseProp(e.serverResponseProp()),n}}function $R(r){var i=XR(r);return function(t,e){var n=i(t,e);return 404===t.getStatus()&&(n=function(t){return new xk(Mk.OBJECT_NOT_FOUND,"Object '"+t+"' does not exist.")}(r.path)),n.setServerResponseProp(e.serverResponseProp()),n}}function ZR(t,e,n){var r=kR(e.fullServerUrl()),i=t.maxOperationRetryTime(),o=new GR(r,"GET",QR(t,n),i);return o.errorHandler=$R(e),o}function tO(t,e,n){var r=Object.assign({},n);return r.fullPath=t.path,r.size=e.size(),r.contentType||(r.contentType=function(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}(null,e)),r}function eO(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),s={"X-Goog-Upload-Protocol":"multipart"};var a=function(){for(var t="",e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();s["Content-Type"]="multipart/related; boundary="+a;var u=tO(e,r,i),c="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+FR(u,n)+"\r\n--"+a+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",h="\r\n--"+a+"--",l=IR.getBlob(c,r,h);if(null===l)throw qk();var f={name:u.fullPath},p=kR(o),d=t.maxUploadRetryTime(),v=new GR(p,"POST",QR(t,n),d);return v.urlParams=f,v.headers=s,v.body=l.uploadData(),v.errorHandler=XR(e),v}var nO=function(t,e,n,r){this.current=t,this.total=e,this.finalized=!!n,this.metadata=r||null};function rO(t,e){var n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){zR(!1)}return zR(!!n&&-1!==(e||["active"]).indexOf(n)),n}function iO(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),s=tO(e,r,i),a={name:s.fullPath},u=kR(o),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":r.size(),"X-Goog-Upload-Header-Content-Type":s.contentType,"Content-Type":"application/json; charset=utf-8"},h=FR(s,n),l=t.maxUploadRetryTime();var f=new GR(u,"POST",function(t){var e;rO(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){zR(!1)}return zR(dR(e)),e},l);return f.urlParams=a,f.headers=c,f.body=h,f.errorHandler=XR(e),f}function oO(t,e,n,i){var r=t.maxUploadRetryTime(),o=new GR(n,"POST",function(t){var e=rO(t,["active","final"]),n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){zR(!1)}n||zR(!1);var r=Number(n);return zR(!isNaN(r)),new nO(r,i.size(),"final"===e)},r);return o.headers={"X-Goog-Upload-Command":"query"},o.errorHandler=XR(e),o}function sO(t,s,e,a,n,u,r,i){var c=new nO(0,0);if(r?(c.current=r.current,c.total=r.total):(c.current=0,c.total=a.size()),a.size()!==c.total)throw new xk(Mk.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");var o=c.total-c.current,h=o;0<n&&(h=Math.min(h,n));var l=c.current,f=l+h,p={"X-Goog-Upload-Command":h===o?"upload, finalize":"upload","X-Goog-Upload-Offset":c.current},d=a.slice(l,f);if(null===d)throw qk();var v=s.maxUploadRetryTime(),y=new GR(e,"POST",function(t,e){var n,r=rO(t,["active","final"]),i=c.current+h,o=a.size();return n="final"===r?QR(s,u)(t,e):null,new nO(i,o,"final"===r,n)},v);return y.headers=p,y.body=d.uploadData(),y.progressCallback=i||null,y.errorHandler=XR(t),y}var aO=function(t,e,n){if(fR(t)||hR(e)||hR(n))this.next=t,this.error=e||null,this.complete=n||null;else{var r=t;this.next=r.next||null,this.error=r.error||null,this.complete=r.complete||null}},uO=function(t,e,n,r,i,o){this.bytesTransferred=t,this.totalBytes=e,this.state=n,this.metadata=r,this.task=i,this.ref=o};function cO(e,t,n){for(var r=t.length,i=t.length,o=0;o<t.length;o++)if(t[o].optional){r=o;break}if(!(r<=n.length&&n.length<=i))throw function(t,e,n,r){var i,o;return o=t===e?1===(i=t)?"argument":"arguments":(i="between "+t+" and "+e,"arguments"),new xk(Mk.INVALID_ARGUMENT_COUNT,"Invalid argument count in `"+n+"`: Expected "+i+" "+o+", received "+r+".")}(r,i,e,n.length);for(o=0;o<n.length;o++)try{t[o].validator(n[o])}catch(t){throw t instanceof Error?Vk(o,e,t.message):Vk(o,e,t)}}var hO=function(e,t){var n=this;this.validator=function(t){n.optional&&!lR(t)||e(t)},this.optional=!!t};function lO(t,e){function n(t){if(!dR(t))throw"Expected string."}var r;return r=t?function(e,n){return function(t){e(t),n(t)}}(n,t):n,new hO(r,e)}function fO(){return new hO(function(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer||gR()&&t instanceof Blob))throw"Expected Blob or File."})}function pO(t){return new hO(UR,t)}function dO(){return new hO(function(t){if(!(vR(t)&&0<=t))throw"Expected a number 0 or greater."})}function vO(e,t){return new hO(function(t){if(!(null===t||hR(t)&&t instanceof Object))throw"Expected an Object.";null!=e&&e(t)},t)}function yO(t){return new hO(function(t){if(!(null===t||fR(t)))throw"Expected a Function."},t)}function gO(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];Promise.resolve().then(function(){return n.apply(void 0,t)})}}var mO=(wO.prototype.makeProgressCallback_=function(){var e=this,n=this.transferred_;return function(t){return e.updateProgress_(n+t)}},wO.prototype.shouldDoResumable_=function(t){return 262144<t.size()},wO.prototype.start_=function(){this.state_===eR&&null===this.request_&&(this.resumable_?null===this.uploadUrl_?this.createResumable_():this.needToFetchStatus_?this.fetchStatus_():this.needToFetchMetadata_?this.fetchMetadata_():this.continueUpload_():this.oneShotUpload_())},wO.prototype.resolveToken_=function(e){var n=this;this.authWrapper_.getAuthToken().then(function(t){switch(n.state_){case eR:e(t);break;case oR:n.transition_(sR);break;case nR:n.transition_(rR)}})},wO.prototype.createResumable_=function(){var r=this;this.resolveToken_(function(t){var e=iO(r.authWrapper_,r.location_,r.mappings_,r.blob_,r.metadata_),n=r.authWrapper_.makeRequest(e,t);(r.request_=n).getPromise().then(function(t){r.request_=null,r.uploadUrl_=t,r.needToFetchStatus_=!1,r.completeTransitions_()},r.errorHandler_)})},wO.prototype.fetchStatus_=function(){var r=this,i=this.uploadUrl_;this.resolveToken_(function(t){var e=oO(r.authWrapper_,r.location_,i,r.blob_),n=r.authWrapper_.makeRequest(e,t);(r.request_=n).getPromise().then(function(t){t=t,r.request_=null,r.updateProgress_(t.current),r.needToFetchStatus_=!1,t.finalized&&(r.needToFetchMetadata_=!0),r.completeTransitions_()},r.errorHandler_)})},wO.prototype.continueUpload_=function(){var r=this,i=262144*this.chunkMultiplier_,o=new nO(this.transferred_,this.blob_.size()),s=this.uploadUrl_;this.resolveToken_(function(t){var e;try{e=sO(r.location_,r.authWrapper_,s,r.blob_,i,r.mappings_,o,r.makeProgressCallback_())}catch(t){return r.error_=t,void r.transition_(aR)}var n=r.authWrapper_.makeRequest(e,t);(r.request_=n).getPromise().then(function(t){r.increaseMultiplier_(),r.request_=null,r.updateProgress_(t.current),t.finalized?(r.metadata_=t.metadata,r.transition_(iR)):r.completeTransitions_()},r.errorHandler_)})},wO.prototype.increaseMultiplier_=function(){262144*this.chunkMultiplier_<33554432&&(this.chunkMultiplier_*=2)},wO.prototype.fetchMetadata_=function(){var r=this;this.resolveToken_(function(t){var e=ZR(r.authWrapper_,r.location_,r.mappings_),n=r.authWrapper_.makeRequest(e,t);(r.request_=n).getPromise().then(function(t){r.request_=null,r.metadata_=t,r.transition_(iR)},r.metadataErrorHandler_)})},wO.prototype.oneShotUpload_=function(){var r=this;this.resolveToken_(function(t){var e=eO(r.authWrapper_,r.location_,r.mappings_,r.blob_,r.metadata_),n=r.authWrapper_.makeRequest(e,t);(r.request_=n).getPromise().then(function(t){r.request_=null,r.metadata_=t,r.updateProgress_(r.blob_.size()),r.transition_(iR)},r.errorHandler_)})},wO.prototype.updateProgress_=function(t){var e=this.transferred_;this.transferred_=t,this.transferred_!==e&&this.notifyObservers_()},wO.prototype.transition_=function(t){if(this.state_!==t)switch(t){case oR:case nR:this.state_=t,null!==this.request_&&this.request_.cancel();break;case eR:var e=this.state_===rR;this.state_=t,e&&(this.notifyObservers_(),this.start_());break;case rR:this.state_=t,this.notifyObservers_();break;case sR:this.error_=jk(),this.state_=t,this.notifyObservers_();break;case aR:case iR:this.state_=t,this.notifyObservers_()}},wO.prototype.completeTransitions_=function(){switch(this.state_){case nR:this.transition_(rR);break;case oR:this.transition_(sR);break;case eR:this.start_()}},Object.defineProperty(wO.prototype,"snapshot",{get:function(){var t=cR(this.state_);return new uO(this.transferred_,this.blob_.size(),t,this.metadata_,this,this.ref_)},enumerable:!0,configurable:!0}),wO.prototype.on=function(t,e,n,o){var r="Expected a function or an Object with one of `next`, `error`, `complete` properties.",i=yO(!0).validator,s=vO(null,!0).validator;function a(t){try{return void i(t)}catch(t){}try{if(s(t),!(lR(t.next)||lR(t.error)||lR(t.complete)))throw"";return}catch(t){throw r}}cO("on",[lO(function(){if(t!==tR.STATE_CHANGED)throw"Expected one of the event types: ["+tR.STATE_CHANGED+"]."}),vO(a,!0),yO(!0),yO(!0)],arguments);var u=this;function c(i){return function(t,e,n){null!==i&&cO("on",i,arguments);var r=new aO(t,e,o);return u.addObserver_(r),function(){u.removeObserver_(r)}}}var h=[vO(function(t){if(null===t)throw r;a(t)}),yO(!0),yO(!0)];return lR(e)||lR(n)||lR(o)?c(null)(e,n,o):c(h)},wO.prototype.then=function(t,e){return this.promise_.then(t,e)},wO.prototype.catch=function(t){return this.then(null,t)},wO.prototype.addObserver_=function(t){this.observers_.push(t),this.notifyObserver_(t)},wO.prototype.removeObserver_=function(t){var e=this.observers_.indexOf(t);-1!==e&&this.observers_.splice(e,1)},wO.prototype.notifyObservers_=function(){var e=this;this.finishPromise_(),this.observers_.slice().forEach(function(t){e.notifyObserver_(t)})},wO.prototype.finishPromise_=function(){if(null!==this.resolve_){var t=!0;switch(cR(this.state_)){case uR.SUCCESS:gO(this.resolve_.bind(null,this.snapshot))();break;case uR.CANCELED:case uR.ERROR:gO(this.reject_.bind(null,this.error_))();break;default:t=!1}t&&(this.resolve_=null,this.reject_=null)}},wO.prototype.notifyObserver_=function(t){switch(cR(this.state_)){case uR.RUNNING:case uR.PAUSED:t.next&&gO(t.next.bind(t,this.snapshot))();break;case uR.SUCCESS:t.complete&&gO(t.complete.bind(t))();break;case uR.CANCELED:case uR.ERROR:t.error&&gO(t.error.bind(t,this.error_))();break;default:t.error&&gO(t.error.bind(t,this.error_))()}},wO.prototype.resume=function(){cO("resume",[],arguments);var t=this.state_===rR||this.state_===nR;return t&&this.transition_(eR),t},wO.prototype.pause=function(){cO("pause",[],arguments);var t=this.state_===eR;return t&&this.transition_(nR),t},wO.prototype.cancel=function(){cO("cancel",[],arguments);var t=this.state_===eR||this.state_===nR;return t&&this.transition_(oR),t},wO);function wO(t,e,n,r,i,o){var s=this;void 0===o&&(o=null),this.transferred_=0,this.needToFetchStatus_=!1,this.needToFetchMetadata_=!1,this.observers_=[],this.error_=null,this.uploadUrl_=null,this.request_=null,this.chunkMultiplier_=1,this.resolve_=null,this.reject_=null,this.ref_=t,this.authWrapper_=e,this.location_=n,this.blob_=i,this.metadata_=o,this.mappings_=r,this.resumable_=this.shouldDoResumable_(this.blob_),this.state_=eR,this.errorHandler_=function(t){s.request_=null,s.chunkMultiplier_=1,t.codeEquals(Mk.CANCELED)?(s.needToFetchStatus_=!0,s.completeTransitions_()):(s.error_=t,s.transition_(aR))},this.metadataErrorHandler_=function(t){s.request_=null,t.codeEquals(Mk.CANCELED)?s.completeTransitions_():(s.error_=t,s.transition_(aR))},this.promise_=new Promise(function(t,e){s.resolve_=t,s.reject_=e,s.start_()}),this.promise_.then(null,function(){})}var bO=(_O.prototype.toString=function(){return cO("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},_O.prototype.newRef=function(t,e){return new _O(t,e)},_O.prototype.mappings=function(){return xR()},_O.prototype.child=function(t){cO("child",[lO()],arguments);var e=function(t,e){var n=e.split("/").filter(function(t){return 0<t.length}).join("/");return 0===t.length?n:t+"/"+n}(this.location.path,t),n=new SR(this.location.bucket,e);return this.newRef(this.authWrapper,n)},Object.defineProperty(_O.prototype,"parent",{get:function(){var t=function(t){if(0===t.length)return null;var e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}(this.location.path);if(null===t)return null;var e=new SR(this.location.bucket,t);return this.newRef(this.authWrapper,e)},enumerable:!0,configurable:!0}),Object.defineProperty(_O.prototype,"root",{get:function(){var t=new SR(this.location.bucket,"");return this.newRef(this.authWrapper,t)},enumerable:!0,configurable:!0}),Object.defineProperty(_O.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!0,configurable:!0}),Object.defineProperty(_O.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!0,configurable:!0}),Object.defineProperty(_O.prototype,"name",{get:function(){return AR(this.location.path)},enumerable:!0,configurable:!0}),Object.defineProperty(_O.prototype,"storage",{get:function(){return this.authWrapper.service()},enumerable:!0,configurable:!0}),_O.prototype.put=function(t,e){return void 0===e&&(e=null),cO("put",[fO(),pO(!0)],arguments),this.throwIfRoot_("put"),new mO(this,this.authWrapper,this.location,this.mappings(),new IR(t),e)},_O.prototype.putString=function(t,e,n){void 0===e&&(e=Kk.RAW),cO("putString",[lO(),lO(Gk,!0),pO(!0)],arguments),this.throwIfRoot_("putString");var r=Qk(e,t),i=Object.assign({},n);return!hR(i.contentType)&&hR(r.contentType)&&(i.contentType=r.contentType),new mO(this,this.authWrapper,this.location,this.mappings(),new IR(r.data,!0),i)},_O.prototype.delete=function(){var n=this;return cO("delete",[],arguments),this.throwIfRoot_("delete"),this.authWrapper.getAuthToken().then(function(t){var e=function(t,e){var n=kR(e.fullServerUrl()),r=t.maxOperationRetryTime(),i=new GR(n,"DELETE",function(t,e){},r);return i.successCodes=[200,204],i.errorHandler=$R(e),i}(n.authWrapper,n.location);return n.authWrapper.makeRequest(e,t).getPromise()})},_O.prototype.listAll=function(){cO("listAll",[],arguments);var t={prefixes:[],items:[]};return this.listAllHelper(t).then(function(){return t})},_O.prototype.listAllHelper=function(o,s){return Ts(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return e={pageToken:s},[4,this.list(e)];case 1:return n=t.sent(),(r=o.prefixes).push.apply(r,n.prefixes),(i=o.items).push.apply(i,n.items),null==n.nextPageToken?[3,3]:[4,this.listAllHelper(o,n.nextPageToken)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},_O.prototype.list=function(r){cO("list",[function(t){return new hO(KR,t)}(!0)],arguments);var i=this;return this.authWrapper.getAuthToken().then(function(t){var e=r||{},n=function(t,e,n,r,i){var o={};e.isRoot?o.prefix="":o.prefix=e.path+"/",n&&0<n.length&&(o.delimiter=n),r&&(o.pageToken=r),i&&(o.maxResults=i);var s=kR(e.bucketOnlyServerUrl()),a=t.maxOperationRetryTime(),u=new GR(s,"GET",YR(t),a);return u.urlParams=o,u.errorHandler=XR(e),u}(i.authWrapper,i.location,"/",e.pageToken,e.maxResults);return i.authWrapper.makeRequest(n,t).getPromise()})},_O.prototype.getMetadata=function(){var n=this;return cO("getMetadata",[],arguments),this.throwIfRoot_("getMetadata"),this.authWrapper.getAuthToken().then(function(t){var e=ZR(n.authWrapper,n.location,n.mappings());return n.authWrapper.makeRequest(e,t).getPromise()})},_O.prototype.updateMetadata=function(n){var r=this;return cO("updateMetadata",[pO()],arguments),this.throwIfRoot_("updateMetadata"),this.authWrapper.getAuthToken().then(function(t){var e=function(t,e,n,r){var i=kR(e.fullServerUrl()),o=FR(n,r),s=t.maxOperationRetryTime(),a=new GR(i,"PATCH",QR(t,r),s);return a.headers={"Content-Type":"application/json; charset=utf-8"},a.body=o,a.errorHandler=$R(e),a}(r.authWrapper,r.location,n,r.mappings());return r.authWrapper.makeRequest(e,t).getPromise()})},_O.prototype.getDownloadURL=function(){var n=this;return cO("getDownloadURL",[],arguments),this.throwIfRoot_("getDownloadURL"),this.authWrapper.getAuthToken().then(function(t){var e=function(t,e,n){var r=kR(e.fullServerUrl()),i=t.maxOperationRetryTime(),o=new GR(r,"GET",JR(t,n),i);return o.errorHandler=$R(e),o}(n.authWrapper,n.location,n.mappings());return n.authWrapper.makeRequest(e,t).getPromise().then(function(t){if(null===t)throw new xk(Mk.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return t})})},_O.prototype.throwIfRoot_=function(t){if(""===this.location.path)throw function(t){return new xk(Mk.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(t)},_O);function _O(t,e){this.authWrapper=t,this.location=e instanceof SR?e:SR.makeFromUrl(e)}var EO=(IO.prototype.getPromise=function(){return this.promise_},IO.prototype.cancel=function(t){},IO);function IO(t){this.promise_=Promise.reject(t)}var TO=(SO.prototype.addRequest=function(t){var e=this,n=this.id;this.id++,this.map.set(n,t),t.getPromise().then(function(){return e.map.delete(n)},function(){return e.map.delete(n)})},SO.prototype.clear=function(){this.map.forEach(function(t){t&&t.cancel(!0)}),this.map.clear()},SO);function SO(){this.map=new Map,this.id=-9007199254740991}var CO=(NO.extractBucket_=function(t){var e=t[Pk]||null;return null==e?null:SR.makeFromBucketSpec(e).bucket},NO.prototype.getAuthToken=function(){var t=this.authProvider_.getImmediate({optional:!0});return t?t.getToken().then(function(t){return null!==t?t.accessToken:null},function(){return null}):Promise.resolve(null)},NO.prototype.bucket=function(){if(this.deleted_)throw Bk();return this.bucket_},NO.prototype.service=function(){return this.service_},NO.prototype.makeStorageReference=function(t){return this.storageRefMaker_(this,t)},NO.prototype.makeRequest=function(t,e){if(this.deleted_)return new EO(Bk());var n=this.requestMaker_(t,this.appId_,e,this.pool_);return this.requestMap_.addRequest(n),n},NO.prototype.deleteApp=function(){this.deleted_=!0,this.app_=null,this.requestMap_.clear()},NO.prototype.maxUploadRetryTime=function(){return this.maxUploadRetryTime_},NO.prototype.setMaxUploadRetryTime=function(t){this.maxUploadRetryTime_=t},NO.prototype.maxOperationRetryTime=function(){return this.maxOperationRetryTime_},NO.prototype.setMaxOperationRetryTime=function(t){this.maxOperationRetryTime_=t},NO);function NO(t,e,n,r,i,o){var s;if(this.bucket_=null,this.appId_=null,this.deleted_=!1,this.app_=t,null!==this.app_){var a=this.app_.options;hR(a)&&(this.bucket_=NO.extractBucket_(a),this.appId_=null!==(s=a.appId)&&void 0!==s?s:null)}this.authProvider_=e,this.storageRefMaker_=n,this.requestMaker_=r,this.pool_=o,this.service_=i,this.maxOperationRetryTime_=12e4,this.maxUploadRetryTime_=6e5,this.requestMap_=new TO}var AO=(kO.prototype.start_=function(){var a=this;function t(t,e){var n,r=a.resolve_,i=a.reject_,o=e.xhr;if(e.wasSuccessCode)try{var s=a.callback_(o,o.getResponseText());lR(s)?r(s):r()}catch(t){i(t)}else null!==o?((n=Uk()).setServerResponseProp(o.getResponseText()),a.errorCallback_?i(a.errorCallback_(o,n)):i(n)):e.canceled?i(n=a.appDelete_?Bk():jk()):i(n=new xk(Mk.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again."))}this.canceled_?t(0,new RO(!1,null,!0)):this.backoffId_=function(e,n,t){var r=1,i=null,o=!1,s=0;function a(){return 2===s}var u=!1;function c(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];u||(u=!0,n.apply(null,t))}function h(t){i=setTimeout(function(){i=null,e(l,a())},t)}function l(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];u||(t?c.call.apply(c,ks([null,t],e)):a()||o?c.call.apply(c,ks([null,t],e)):(r<64&&(r*=2),h(1===s?(s=2,0):1e3*(r+Math.random()))))}var f=!1;function p(t){f||(f=!0,u||(null!==i?(t||(s=2),clearTimeout(i),h(0)):t||(s=1)))}return h(0),setTimeout(function(){p(o=!0)},t),p}(function(o,t){if(t)o(!1,new RO(!1,null,!0));else{var e=a.pool_.createXhrIo();a.pendingXhr_=e,null!==a.progressCallback_&&e.addUploadProgressListener(s),e.send(a.url_,a.method_,a.body_,a.headers_).then(function(t){null!==a.progressCallback_&&t.removeUploadProgressListener(s),a.pendingXhr_=null;var e=(t=t).getErrorCode()===$k.NO_ERROR,n=t.getStatus();if(e&&!a.isRetryStatusCode_(n)){var r=-1!==a.successCodes_.indexOf(n);o(!0,new RO(r,t))}else{var i=t.getErrorCode()===$k.ABORT;o(!1,new RO(!1,null,i))}})}function s(t){var e=t.loaded,n=t.lengthComputable?t.total:-1;null!==a.progressCallback_&&a.progressCallback_(e,n)}},t,this.timeout_)},kO.prototype.getPromise=function(){return this.promise_},kO.prototype.cancel=function(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&function(t){t(!1)}(this.backoffId_),null!==this.pendingXhr_&&this.pendingXhr_.abort()},kO.prototype.isRetryStatusCode_=function(t){var e=500<=t&&t<600,n=-1!==[408,429].indexOf(t),r=-1!==this.additionalRetryCodes_.indexOf(t);return e||n||r},kO);function kO(t,e,n,r,i,o,s,a,u,c,h){var l=this;this.pendingXhr_=null,this.backoffId_=null,this.resolve_=null,this.reject_=null,this.canceled_=!1,this.appDelete_=!1,this.url_=t,this.method_=e,this.headers_=n,this.body_=r,this.successCodes_=i.slice(),this.additionalRetryCodes_=o.slice(),this.callback_=s,this.errorCallback_=a,this.progressCallback_=c,this.timeout_=u,this.pool_=h,this.promise_=new Promise(function(t,e){l.resolve_=t,l.reject_=e,l.start_()})}var RO=function(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n};function OO(t,e,n,r){var i=RR(t.urlParams),o=t.url+i,s=Object.assign({},t.headers);return function(t,e){e&&(t["X-Firebase-GMPID"]=e)}(s,e),function(t,e){null!==e&&0<e.length&&(t.Authorization="Firebase "+e)}(s,n),function(t){var e=void 0!==Kl?Kl.SDK_VERSION:"AppManager";t["X-Firebase-Storage-Version"]="webjs/"+e}(s),new AO(o,t.method,s,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,r)}var DO=(PO.prototype.ref=function(t){if(cO("ref",[lO(function(t){if("string"!=typeof t)throw"Path is not a string.";if(/^[A-Za-z]+:\/\//.test(t))throw"Expected child path but got a URL, use refFromURL instead."},!0)],arguments),null==this.bucket_)throw new Error("No Storage Bucket defined in Firebase Options.");var e=new bO(this.authWrapper_,this.bucket_);return null!=t?e.child(t):e},PO.prototype.refFromURL=function(t){return cO("refFromURL",[lO(function(t){if("string"!=typeof t)throw"Path is not a string.";if(!/^[A-Za-z]+:\/\//.test(t))throw"Expected full URL but got a child path, use ref instead.";try{SR.makeFromUrl(t)}catch(t){throw"Expected valid full URL but got an invalid one."}},!1)],arguments),new bO(this.authWrapper_,t)},Object.defineProperty(PO.prototype,"maxUploadRetryTime",{get:function(){return this.authWrapper_.maxUploadRetryTime()},enumerable:!0,configurable:!0}),PO.prototype.setMaxUploadRetryTime=function(t){cO("setMaxUploadRetryTime",[dO()],arguments),this.authWrapper_.setMaxUploadRetryTime(t)},PO.prototype.setMaxOperationRetryTime=function(t){cO("setMaxOperationRetryTime",[dO()],arguments),this.authWrapper_.setMaxOperationRetryTime(t)},Object.defineProperty(PO.prototype,"app",{get:function(){return this.app_},enumerable:!0,configurable:!0}),Object.defineProperty(PO.prototype,"INTERNAL",{get:function(){return this.internals_},enumerable:!0,configurable:!0}),PO);function PO(t,e,n,r){if(this.bucket_=null,this.authWrapper_=new CO(t,e,function(t,e){return new bO(t,e)},OO,this,n),this.app_=t,null!=r)this.bucket_=SR.makeFromBucketSpec(r);else{var i=this.authWrapper_.bucket();null!=i&&(this.bucket_=new SR(i,""))}this.internals_=new xO(this)}var xO=(LO.prototype.delete=function(){return this.service_.authWrapper_.deleteApp(),Promise.resolve()},LO);function LO(t){this.service_=t}var MO,FO;function UO(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal");return new DO(n,r,new bR,e)}FO={TaskState:uR,TaskEvent:tR,StringFormat:Kk,Storage:DO,Reference:bO},(MO=Kl).INTERNAL.registerComponent(new da("storage",UO,"PUBLIC").setServiceProps(FO).setMultipleInstances(!0)),MO.registerVersion("@firebase/storage","0.3.30");var jO,qO,VO,BO,WO="0.2.36",HO="FB-PERF-TRACE-MEASURE",KO="@firebase/performance/config",GO="@firebase/performance/configexpire",zO="Performance",QO=((jO={})["trace started"]="Trace {$traceName} was started before.",jO["trace stopped"]="Trace {$traceName} is not running.",jO["no window"]="Window is not available.",jO["no app id"]="App id is not available.",jO["no project id"]="Project id is not available.",jO["no api key"]="Api key is not available.",jO["invalid cc log"]="Attempted to queue invalid cc event",jO["FB not default"]="Performance can only start when Firebase app instance is the default one.",jO["RC response not ok"]="RC response is not ok",jO["invalid attribute name"]="Attribute name {$attributeName} is invalid.",jO["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",jO["invalide custom metric name"]="Custom metric name {$customMetricName} is invalid",jO),YO=new zs("performance",zO,QO),JO=(XO.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},XO.prototype.mark=function(t){this.performance&&this.performance.mark&&this.performance.mark(t)},XO.prototype.measure=function(t,e,n){this.performance&&this.performance.measure&&this.performance.measure(t,e,n)},XO.prototype.getEntriesByType=function(t){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(t):[]},XO.prototype.getEntriesByName=function(t){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(t):[]},XO.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},XO.prototype.requiredApisAvailable=function(){return!!(fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled)},XO.prototype.setupObserver=function(t,i){this.PerformanceObserver&&new this.PerformanceObserver(function(t){for(var e=0,n=t.getEntries();e<n.length;e++){var r=n[e];i(r)}}).observe({entryTypes:[t]})},XO.getInstance=function(){return void 0===qO&&(qO=new XO(VO)),qO},XO);function XO(t){if(!(this.window=t))throw YO.create("no window");this.performance=t.performance,this.PerformanceObserver=t.PerformanceObserver,this.windowLocation=t.location,this.navigator=t.navigator,this.document=t.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=t.localStorage),t.perfMetrics&&t.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=t.perfMetrics.onFirstInputDelay)}var $O,ZO,tD,eD=(nD.prototype.getAppId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!t)throw YO.create("no app id");return t},nD.prototype.getProjectId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!t)throw YO.create("no project id");return t},nD.prototype.getApiKey=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!t)throw YO.create("no api key");return t},nD.getInstance=function(){return void 0===BO&&(BO=new nD),BO},nD);function nD(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.tracesSamplingRate=1,this.networkRequestsSamplingRate=1,this.logEndPointUrl="https://firebaselogging.googleapis.com/v0cc/log?format=json_proto",this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}function rD(){return $O}(tD=ZO=ZO||{})[tD.UNKNOWN=0]="UNKNOWN",tD[tD.VISIBLE=1]="VISIBLE",tD[tD.HIDDEN=2]="HIDDEN";var iD=["firebase_","google_","ga_"],oD=new RegExp("^[a-zA-Z]\\w*$");function sD(){switch(JO.getInstance().document.visibilityState){case"visible":return ZO.VISIBLE;case"hidden":return ZO.HIDDEN;default:return ZO.UNKNOWN}}var aD=new Oa(zO);aD.logLevel=Ia.INFO;var uD="0.0.1",cD={loggingEnabled:!0},hD="FIREBASE_INSTALLATIONS_AUTH";function lD(t){var e=function(){var t=JO.getInstance().localStorage;if(!t)return;var e=t.getItem(GO);if(!e||!function(t){return Number(t)>Date.now()}(e))return;var n=t.getItem(KO);if(!n)return;try{return JSON.parse(n)}catch(t){return}}();return e?(pD(e),Promise.resolve()):function(r){return function(){var t=eD.getInstance().installationsService.getToken();return t.then(function(t){}),t}().then(function(t){var e="https://firebaseremoteconfig.googleapis.com/v1/projects/"+eD.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+eD.getInstance().getApiKey(),n=new Request(e,{method:"POST",headers:{Authorization:hD+" "+t},body:JSON.stringify({app_instance_id:r,app_instance_id_token:t,app_id:eD.getInstance().getAppId(),app_version:WO,sdk_version:uD})});return fetch(n).then(function(t){if(t.ok)return t.json();throw YO.create("RC response not ok")})}).catch(function(){aD.info(fD)})}(t).then(function(t){return pD(t)}).then(function(t){return function(t){var e=JO.getInstance().localStorage;if(!t||!e)return;e.setItem(KO,JSON.stringify(t)),e.setItem(GO,String(Date.now()+60*eD.getInstance().configTimeToLive*60*1e3))}(t)},function(){})}var fD="Could not fetch config, will use default configs";function pD(t){if(!t)return t;var e=eD.getInstance(),n=t.entries||{};return void 0!==n.fpr_enabled?e.loggingEnabled="true"===String(n.fpr_enabled):e.loggingEnabled=cD.loggingEnabled,n.fpr_log_source&&(e.logSource=Number(n.fpr_log_source)),n.fpr_log_endpoint_url&&(e.logEndPointUrl=n.fpr_log_endpoint_url),void 0!==n.fpr_vc_network_request_sampling_rate&&(e.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate)),void 0!==n.fpr_vc_trace_sampling_rate&&(e.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate)),e.logTraceAfterSampling=dD(e.tracesSamplingRate),e.logNetworkAfterSampling=dD(e.networkRequestsSamplingRate),t}function dD(t){return Math.random()<=t}var vD,yD=1;function gD(){return yD=2,vD=vD||function(){var n=JO.getInstance().document;return new Promise(function(t){if(n&&"complete"!==n.readyState){var e=function(){"complete"===n.readyState&&(n.removeEventListener("readystatechange",e),t())};n.addEventListener("readystatechange",e)}else t()})}().then(function(){return function(){var t=eD.getInstance().installationsService.getId();return t.then(function(t){$O=t}),t}()}).then(function(t){return lD(t)}).then(function(){return mD()},function(){return mD()})}function mD(){yD=3}var wD,bD=1e4,_D=5500,ED=3,ID=ED,TD=[],SD=!1;function CD(){SD||(!function r(t){setTimeout(function(){if(0!==ID){if(!TD.length)return r(bD);var t=ks(TD);TD=[];var e=t.map(function(t){return{source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)}}),n={request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:eD.getInstance().logSource,log_event:e};fetch(eD.getInstance().logEndPointUrl,{method:"POST",body:JSON.stringify(n)}).then(function(t){return t.ok||aD.info("Call to Firebase backend failed."),t.json()}).then(function(t){var e=Number(t.next_request_wait_millis),n=isNaN(e)?bD:Math.max(bD,e);ID=ED,r(n)}).catch(function(){TD=ks(t,TD),ID--,aD.info("Tries left: "+ID+"."),r(bD)})}},t)}(_D),SD=!0)}function ND(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];!function(t){if(!t.eventTime||!t.message)throw YO.create("invalid cc log");TD=ks(TD,[t])}({message:n.apply(void 0,t),eventTime:Date.now()})}}function AD(t,e){(wD=wD||ND(OD))(t,e)}function kD(t){var e=eD.getInstance();!e.instrumentationEnabled&&t.isAuto||(e.dataCollectionEnabled||t.isAuto)&&JO.getInstance().requiredApisAvailable()&&(t.isAuto&&sD()!==ZO.VISIBLE||e.loggingEnabled&&e.logTraceAfterSampling&&(3===yD?RD(t):gD().then(function(){return RD(t)},function(){return RD(t)})))}function RD(t){rD()&&setTimeout(function(){return AD(t,1)},0)}function OD(t,e){return 0===e?function(t){var e={url:t.url,http_method:t.httpMethod||0,http_response_code:200,response_payload_bytes:t.responsePayloadBytes,client_start_time_us:t.startTimeUs,time_to_response_initiated_us:t.timeToResponseInitiatedUs,time_to_response_completed_us:t.timeToResponseCompletedUs},n={application_info:DD(),network_request_metric:e};return JSON.stringify(n)}(t):function(t){var e={name:t.name,is_auto:t.isAuto,client_start_time_us:t.startTimeUs,duration_us:t.durationUs};0!==Object.keys(t.counters).length&&(e.counters=t.counters);var n=t.getAttributes();0!==Object.keys(n).length&&(e.custom_attributes=n);var r={application_info:DD(),trace_metric:e};return JSON.stringify(r)}(t)}function DD(){return{google_app_id:eD.getInstance().getAppId(),app_instance_id:rD(),web_app_info:{sdk_version:WO,page_url:JO.getInstance().getUrl(),service_worker_status:function(){var t=JO.getInstance().navigator;return"serviceWorker"in t?t.serviceWorker.controller?2:3:1}(),visibility_state:sD(),effective_connection_type:function(){var t=JO.getInstance().navigator.connection;switch(t&&t.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}()},application_process_state:0}}var PD=["_fp","_fcp","_fid"];var xD=(LD.prototype.start=function(){if(1!==this.state)throw YO.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},LD.prototype.stop=function(){if(2!==this.state)throw YO.create("trace stopped",{traceName:this.name});this.state=3,this.api.mark(this.traceStopMark),this.api.measure(this.traceMeasure,this.traceStartMark,this.traceStopMark),this.calculateTraceMetrics(),kD(this)},LD.prototype.record=function(t,e,n){if(this.durationUs=Math.floor(1e3*e),this.startTimeUs=Math.floor(1e3*t),n&&n.attributes&&(this.customAttributes=Is({},n.attributes)),n&&n.metrics)for(var r=0,i=Object.keys(n.metrics);r<i.length;r++){var o=i[r];isNaN(Number(n.metrics[o]))||(this.counters[o]=Number(Math.floor(n.metrics[o])))}kD(this)},LD.prototype.incrementMetric=function(t,e){void 0===e&&(e=1),void 0===this.counters[t]&&this.putMetric(t,0),this.counters[t]+=e},LD.prototype.putMetric=function(t,e){if(!function(t,e){return!(0===t.length||100<t.length)&&(e&&e.startsWith("_wt_")&&-1<PD.indexOf(t)||!t.startsWith("_"))}(t,this.name))throw YO.create("invalide custom metric name",{customMetricName:t});this.counters[t]=e},LD.prototype.getMetric=function(t){return this.counters[t]||0},LD.prototype.putAttribute=function(t,e){var n=function(e){return!(0===e.length||40<e.length||iD.some(function(t){return e.startsWith(t)})||!e.match(oD))}(t),r=function(t){return 0!==t.length&&t.length<=100}(e);if(n&&r)this.customAttributes[t]=e;else{if(!n)throw YO.create("invalid attribute name",{attributeName:t});if(!r)throw YO.create("invalid attribute value",{attributeValue:e})}},LD.prototype.getAttribute=function(t){return this.customAttributes[t]},LD.prototype.removeAttribute=function(t){void 0!==this.customAttributes[t]&&delete this.customAttributes[t]},LD.prototype.getAttributes=function(){return Is({},this.customAttributes)},LD.prototype.setStartTime=function(t){this.startTimeUs=t},LD.prototype.setDuration=function(t){this.durationUs=t},LD.prototype.calculateTraceMetrics=function(){var t=this.api.getEntriesByName(this.traceMeasure),e=t&&t[0];e&&(this.durationUs=Math.floor(1e3*e.duration),this.startTimeUs=Math.floor(1e3*(e.startTime+this.api.getTimeOrigin())))},LD.createOobTrace=function(t,e,n){var r=JO.getInstance().getUrl();if(r){var i=new LD("_wt_"+r,!0),o=Math.floor(1e3*JO.getInstance().getTimeOrigin());if(i.setStartTime(o),t&&t[0]&&(i.setDuration(Math.floor(1e3*t[0].duration)),i.putMetric("domInteractive",Math.floor(1e3*t[0].domInteractive)),i.putMetric("domContentLoadedEventEnd",Math.floor(1e3*t[0].domContentLoadedEventEnd)),i.putMetric("loadEventEnd",Math.floor(1e3*t[0].loadEventEnd))),e){var s=e.find(function(t){return"first-paint"===t.name});s&&s.startTime&&i.putMetric("_fp",Math.floor(1e3*s.startTime));var a=e.find(function(t){return"first-contentful-paint"===t.name});a&&a.startTime&&i.putMetric("_fcp",Math.floor(1e3*a.startTime)),n&&i.putMetric("_fid",Math.floor(1e3*n))}kD(i)}},LD.createUserTimingTrace=function(t){kD(new LD(t,!1,t))},LD);function LD(t,e,n){void 0===e&&(e=!1),this.name=t,this.isAuto=e,this.state=1,this.customAttributes={},this.counters={},this.api=JO.getInstance(),this.randomId=Math.floor(1e6*Math.random()),this.isAuto||(this.traceStartMark="FB-PERF-TRACE-START-"+this.randomId+"-"+this.name,this.traceStopMark="FB-PERF-TRACE-STOP-"+this.randomId+"-"+this.name,this.traceMeasure=n||HO+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}function MD(t){var e=t;if(e&&void 0!==e.responseStart){var n=JO.getInstance().getTimeOrigin(),r=Math.floor(1e3*(e.startTime+n)),i=e.responseStart?Math.floor(1e3*(e.responseStart-e.startTime)):void 0,o=Math.floor(1e3*(e.responseEnd-e.startTime));!function(t){var e=eD.getInstance();e.instrumentationEnabled&&t.url!==e.logEndPointUrl.split("?")[0]&&e.loggingEnabled&&e.logNetworkAfterSampling&&setTimeout(function(){return AD(t,0)},0)}({url:e.name&&e.name.split("?")[0],responsePayloadBytes:e.transferSize,startTimeUs:r,timeToResponseInitiatedUs:i,timeToResponseCompletedUs:o})}}var FD=5e3;function UD(){rD()&&(setTimeout(function(){return function(){var t=JO.getInstance(),e=t.getEntriesByType("navigation"),n=t.getEntriesByType("paint");if(t.onFirstInputDelay){var r=setTimeout(function(){xD.createOobTrace(e,n),r=void 0},FD);t.onFirstInputDelay(function(t){r&&(clearTimeout(r),xD.createOobTrace(e,n,t))})}else xD.createOobTrace(e,n)}()},0),setTimeout(function(){return function(){for(var t=JO.getInstance(),e=t.getEntriesByType("resource"),n=0,r=e;n<r.length;n++){MD(r[n])}t.setupObserver("resource",MD)}()},0),setTimeout(function(){return function(){for(var t=JO.getInstance(),e=t.getEntriesByType("measure"),n=0,r=e;n<r.length;n++){jD(r[n])}t.setupObserver("measure",jD)}()},0))}function jD(t){var e=t.name;e.substring(0,HO.length)!==HO&&xD.createUserTimingTrace(e)}var qD=(VD.prototype.trace=function(t){return new xD(t)},Object.defineProperty(VD.prototype,"instrumentationEnabled",{get:function(){return eD.getInstance().instrumentationEnabled},set:function(t){eD.getInstance().instrumentationEnabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(VD.prototype,"dataCollectionEnabled",{get:function(){return eD.getInstance().dataCollectionEnabled},set:function(t){eD.getInstance().dataCollectionEnabled=t},enumerable:!0,configurable:!0}),VD);function VD(t){this.app=t,JO.getInstance().requiredApisAvailable()?(CD(),gD().then(UD,UD)):aD.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled.")}var BD;function WD(t,e){if("[DEFAULT]"!==t.name)throw YO.create("FB not default");if("undefined"==typeof window)throw YO.create("no window");return function(t){VO=t}(window),eD.getInstance().firebaseAppInstance=t,eD.getInstance().installationsService=e,new qD(t)}(BD=Kl).INTERNAL.registerComponent(new da("performance",function(t){var e=t.getProvider("app").getImmediate(),n=t.getProvider("installations").getImmediate();return WD(e,n)},"PUBLIC")),BD.registerVersion("@firebase/performance","0.2.36");var HD,KD,GD,zD,QD="measurementId",YD="firebase_id",JD="origin",XD="https://www.googletagmanager.com/gtag/js";(KD=HD=HD||{}).EVENT="event",KD.SET="set",KD.CONFIG="config",(zD=GD=GD||{}).ADD_SHIPPING_INFO="add_shipping_info",zD.ADD_PAYMENT_INFO="add_payment_info",zD.ADD_TO_CART="add_to_cart",zD.ADD_TO_WISHLIST="add_to_wishlist",zD.BEGIN_CHECKOUT="begin_checkout",zD.CHECKOUT_PROGRESS="checkout_progress",zD.EXCEPTION="exception",zD.GENERATE_LEAD="generate_lead",zD.LOGIN="login",zD.PAGE_VIEW="page_view",zD.PURCHASE="purchase",zD.REFUND="refund",zD.REMOVE_FROM_CART="remove_from_cart",zD.SCREEN_VIEW="screen_view",zD.SEARCH="search",zD.SELECT_CONTENT="select_content",zD.SELECT_ITEM="select_item",zD.SELECT_PROMOTION="select_promotion",zD.SET_CHECKOUT_OPTION="set_checkout_option",zD.SHARE="share",zD.SIGN_UP="sign_up",zD.TIMING_COMPLETE="timing_complete",zD.VIEW_CART="view_cart",zD.VIEW_ITEM="view_item",zD.VIEW_ITEM_LIST="view_item_list",zD.VIEW_PROMOTION="view_promotion",zD.VIEW_SEARCH_RESULTS="view_search_results";var $D,ZD=new Oa("@firebase/analytics");function tP(t,n,e){var r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];window[n].push(arguments)};return window[e]&&"function"==typeof window[e]&&(r=window[e]),window[e]=function(f,p){return function(t,e,n){if(t===HD.EVENT){var r=[];if(n&&n.send_to){var i=n.send_to;Array.isArray(i)||(i=[i]);for(var o=0,s=i;o<s.length;o++){var a=s[o],u=p[a];if(!u){r=[];break}r.push(u)}}if(0===r.length)for(var c=0,h=Object.values(p);c<h.length;c++){var l=h[c];r.push(l)}Promise.all(r).then(function(){return f(HD.EVENT,e,n||{})}).catch(function(t){return ZD.error(t)})}else if(t===HD.CONFIG){(p[e]||Promise.resolve()).then(function(){f(HD.CONFIG,e,n)}).catch(function(t){return ZD.error(t)})}else f(HD.SET,e)}}(r,t),{gtagCore:r,wrappedGtag:window[e]}}var eP,nP,rP=(($D={})["no-ga-id"]='"'+QD+'" field is empty in Firebase config. Firebase Analytics requires this field to contain a valid measurement ID.',$D["already-exists"]="A Firebase Analytics instance with the measurement ID ${id} already exists. Only one Firebase Analytics instance can be created for each measurement ID.",$D["already-initialized"]="Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.",$D["interop-component-reg-failed"]="Firebase Analytics Interop Component failed to instantiate",$D),iP=new zs("analytics","Analytics",rP),oP={},sP="dataLayer",aP="gtag",uP=!1;function cP(t){if(uP)throw iP.create("already-initialized");t.dataLayerName&&(sP=t.dataLayerName),t.gtagName&&(aP=t.gtagName)}function hP(t,e){var r=t.options[QD];if(!r)throw iP.create("no-ga-id");if(null!=oP[r])throw iP.create("already-exists",{id:r});if(!uP){!function(){for(var t=window.document.getElementsByTagName("script"),e=0,n=Object.values(t);e<n.length;e++){var r=n[e];if(r.src&&r.src.includes(XD))return r}return null}()&&function(t){var e=document.createElement("script");e.src=XD+"?l="+t,e.async=!0,document.head.appendChild(e)}(sP),function(t){var e=[];Array.isArray(window[t])?e=window[t]:window[t]=e}(sP);var n=tP(oP,sP,aP),i=n.wrappedGtag,o=n.gtagCore;nP=i,eP=o,uP=!0}return oP[r]=function(r,i,o){return Ts(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,i.getId()];case 1:return e=t.sent(),o("js",new Date),o(HD.CONFIG,r.options[QD],((n={})[YD]=e,n[JD]="firebase",n.update=!0,n)),[2]}})})}(t,e,eP),{app:t,logEvent:function(t,e,n){return function(t,e,n,r,i){var o=r||{};i&&i.global||(o=Is(Is({},r),{send_to:e})),t(HD.EVENT,n,o||{})}(nP,r,t,e,n)},setCurrentScreen:function(t,e){return function(t,e,n,r){r&&r.global?t(HD.SET,{screen_name:n}):t(HD.CONFIG,e,{update:!0,screen_name:n})}(nP,r,t,e)},setUserId:function(t,e){return function(t,e,n,r){r&&r.global?t(HD.SET,{user_id:n}):t(HD.CONFIG,e,{update:!0,user_id:n})}(nP,r,t,e)},setUserProperties:function(t,e){return function(t,e,n,r){if(r&&r.global){for(var i={},o=0,s=Object.keys(n);o<s.length;o++){var a=s[o];i["user_properties."+a]=n[a]}t(HD.SET,i)}else t(HD.CONFIG,e,{update:!0,user_properties:n})}(nP,r,t,e)},setAnalyticsCollectionEnabled:function(t){return function(t,e){window["ga-disable-"+t]=!e}(r,t)}}}var lP,fP="analytics";(lP=Kl).INTERNAL.registerComponent(new da(fP,function(t){return hP(t.getProvider("app").getImmediate(),t.getProvider("installations").getImmediate())},"PUBLIC").setServiceProps({settings:cP,EventName:GD})),lP.INTERNAL.registerComponent(new da("analytics-internal",function(t){try{return{logEvent:t.getProvider(fP).getImmediate().logEvent}}catch(t){throw iP.create("interop-component-reg-failed",{reason:t})}},"PRIVATE")),lP.registerVersion("@firebase/analytics","0.3.0");var pP,dP=(vP.prototype.isCachedDataFresh=function(t,e){if(!e)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;var n=Date.now()-e,r=n<=t;return this.logger.debug("Config fetch cache check. Cache age millis: "+n+". Cache max age millis (minimumFetchIntervalMillis setting): "+t+". Is cache hit: "+r+"."),r},vP.prototype.fetch=function(s){return Ts(this,void 0,void 0,function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()])];case 1:return e=t.sent(),n=e[0],(r=e[1])&&this.isCachedDataFresh(s.cacheMaxAgeMillis,n)?[2,r]:(s.eTag=r&&r.eTag,[4,this.client.fetch(s)]);case 2:return i=t.sent(),o=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())],200===i.status&&o.push(this.storage.setLastSuccessfulFetchResponse(i)),[4,Promise.all(o)];case 3:return t.sent(),[2,i]}})})},vP);function vP(t,e,n,r){this.client=t,this.storage=e,this.storageCache=n,this.logger=r}var yP=((pP={})["registration-window"]="Undefined window object. This SDK only supports usage in a browser environment.",pP["registration-project-id"]="Undefined project identifier. Check Firebase app initialization.",pP["registration-api-key"]="Undefined API key. Check Firebase app initialization.",pP["registration-app-id"]="Undefined app identifier. Check Firebase app initialization.",pP["storage-open"]="Error thrown when opening storage. Original error: {$originalErrorMessage}.",pP["storage-get"]="Error thrown when reading from storage. Original error: {$originalErrorMessage}.",pP["storage-set"]="Error thrown when writing to storage. Original error: {$originalErrorMessage}.",pP["storage-delete"]="Error thrown when deleting from storage. Original error: {$originalErrorMessage}.",pP["fetch-client-network"]="Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.",pP["fetch-timeout"]='The config fetch request timed out. Configure timeout using "fetchTimeoutMillis" SDK setting.',pP["fetch-throttle"]='The config fetch request timed out while in an exponential backoff state. Configure timeout using "fetchTimeoutMillis" SDK setting. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.',pP["fetch-client-parse"]="Fetch client could not parse response. Original error: {$originalErrorMessage}.",pP["fetch-status"]="Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.",pP),gP=new zs("remoteconfig","Remote Config",yP);var mP=(wP.prototype.fetch=function(b){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l,f,p,d,v,y,g,m,w;return Ss(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()])];case 1:e=t.sent(),n=e[0],r=e[1],i=window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com",o=i+"/v1/projects/"+this.projectId+"/namespaces/"+this.namespace+":fetch?key="+this.apiKey,s={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":b.eTag||"*"},a={sdk_version:this.sdkVersion,app_instance_id:n,app_instance_id_token:r,app_id:this.appId,language_code:function(t){return void 0===t&&(t=navigator),t.languages&&t.languages[0]||t.language}()},u={method:"POST",headers:s,body:JSON.stringify(a)},c=fetch(o,u),h=new Promise(function(t,e){b.signal.addEventListener(function(){var t=new Error("The operation was aborted.");t.name="AbortError",e(t)})}),t.label=2;case 2:return t.trys.push([2,5,,6]),[4,Promise.race([c,h])];case 3:return t.sent(),[4,c];case 4:return l=t.sent(),[3,6];case 5:throw f=t.sent(),p="fetch-client-network","AbortError"===f.name&&(p="fetch-timeout"),gP.create(p,{originalErrorMessage:f.message});case 6:if(d=l.status,v=l.headers.get("ETag")||void 0,200!==l.status)return[3,11];m=void 0,t.label=7;case 7:return t.trys.push([7,9,,10]),[4,l.json()];case 8:return m=t.sent(),[3,10];case 9:throw w=t.sent(),gP.create("fetch-client-parse",{originalErrorMessage:w.message});case 10:y=m.entries,g=m.state,t.label=11;case 11:if("INSTANCE_STATE_UNSPECIFIED"===g?d=500:"NO_CHANGE"===g?d=304:"NO_TEMPLATE"!==g&&"EMPTY_CONFIG"!==g||(y={}),304!==d&&200!==d)throw gP.create("fetch-status",{httpStatus:d});return[2,{status:d,eTag:v,config:y}]}})})},wP);function wP(t,e,n,r,i,o){this.firebaseInstallations=t,this.sdkVersion=e,this.namespace=n,this.projectId=r,this.apiKey=i,this.appId=o}var bP=(_P.prototype.addEventListener=function(t){this.listeners.push(t)},_P.prototype.abort=function(){this.listeners.forEach(function(t){return t()})},_P);function _P(){this.listeners=[]}var EP=["1","true","t","yes","y","on"],IP=(TP.prototype.asString=function(){return this._value},TP.prototype.asBoolean=function(){return"static"!==this._source&&0<=EP.indexOf(this._value.toLowerCase())},TP.prototype.asNumber=function(){if("static"===this._source)return 0;var t=Number(this._value);return isNaN(t)&&(t=0),t},TP.prototype.getSource=function(){return this._source},TP);function TP(t,e){void 0===e&&(e=""),this._source=t,this._value=e}var SP=(CP.prototype.setLogLevel=function(t){switch(t){case"debug":this._logger.logLevel=Ia.DEBUG;break;case"silent":this._logger.logLevel=Ia.SILENT;break;default:this._logger.logLevel=Ia.ERROR}},Object.defineProperty(CP.prototype,"fetchTimeMillis",{get:function(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1},enumerable:!0,configurable:!0}),Object.defineProperty(CP.prototype,"lastFetchStatus",{get:function(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"},enumerable:!0,configurable:!0}),CP.prototype.activate=function(){return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return[4,Promise.all([this._storage.getLastSuccessfulFetchResponse(),this._storage.getActiveConfigEtag()])];case 1:return e=t.sent(),n=e[0],r=e[1],n&&n.config&&n.eTag&&n.eTag!==r?[4,Promise.all([this._storageCache.setActiveConfig(n.config),this._storage.setActiveConfigEtag(n.eTag)])]:[2,!1];case 2:return t.sent(),[2,!0]}})})},CP.prototype.ensureInitialized=function(){var t=this;return this._initializePromise||(this._initializePromise=this._storageCache.loadFromStorage().then(function(){t._isInitializationComplete=!0})),this._initializePromise},CP.prototype.fetch=function(){return Ts(this,void 0,void 0,function(){var e,n,r,i=this;return Ss(this,function(t){switch(t.label){case 0:e=new bP,setTimeout(function(){return Ts(i,void 0,void 0,function(){return Ss(this,function(t){return e.abort(),[2]})})},this.settings.fetchTimeoutMillis),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this._client.fetch({cacheMaxAgeMillis:this.settings.minimumFetchIntervalMillis,signal:e})];case 2:return t.sent(),[4,this._storageCache.setLastFetchStatus("success")];case 3:return t.sent(),[3,6];case 4:return n=t.sent(),r=function(t,e){return t instanceof Ks&&-1!==t.code.indexOf(e)}(n,"fetch-throttle")?"throttle":"failure",[4,this._storageCache.setLastFetchStatus(r)];case 5:throw t.sent(),n;case 6:return[2]}})})},CP.prototype.fetchAndActivate=function(){return Ts(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,this.fetch()];case 1:return t.sent(),[2,this.activate()]}})})},CP.prototype.getAll=function(){var n=this;return function(t,e){return void 0===t&&(t={}),void 0===e&&(e={}),Object.keys(Is(Is({},t),e))}(this._storageCache.getActiveConfig(),this.defaultConfig).reduce(function(t,e){return t[e]=n.getValue(e),t},{})},CP.prototype.getBoolean=function(t){return this.getValue(t).asBoolean()},CP.prototype.getNumber=function(t){return this.getValue(t).asNumber()},CP.prototype.getString=function(t){return this.getValue(t).asString()},CP.prototype.getValue=function(t){this._isInitializationComplete||this._logger.debug('A value was requested for key "'+t+'" before SDK initialization completed. Await on ensureInitialized if the intent was to get a previously activated value.');var e=this._storageCache.getActiveConfig();return e&&void 0!==e[t]?new IP("remote",e[t]):this.defaultConfig&&void 0!==this.defaultConfig[t]?new IP("default",String(this.defaultConfig[t])):(this._logger.debug('Returning static value for key "'+t+'". Define a default or remote value if this is unintentional.'),new IP("static"))},CP);function CP(t,e,n,r,i){this.app=t,this._client=e,this._storageCache=n,this._storage=r,this._logger=i,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:6e4,minimumFetchIntervalMillis:432e5},this.defaultConfig={}}function NP(t,e){var n=t.target.error||void 0;return gP.create(e,{originalErrorMessage:n&&n.message})}var AP="app_namespace_store",kP="firebase_remote_config",RP=1;var OP=(DP.prototype.getLastFetchStatus=function(){return this.get("last_fetch_status")},DP.prototype.setLastFetchStatus=function(t){return this.set("last_fetch_status",t)},DP.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.get("last_successful_fetch_timestamp_millis")},DP.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.set("last_successful_fetch_timestamp_millis",t)},DP.prototype.getLastSuccessfulFetchResponse=function(){return this.get("last_successful_fetch_response")},DP.prototype.setLastSuccessfulFetchResponse=function(t){return this.set("last_successful_fetch_response",t)},DP.prototype.getActiveConfig=function(){return this.get("active_config")},DP.prototype.setActiveConfig=function(t){return this.set("active_config",t)},DP.prototype.getActiveConfigEtag=function(){return this.get("active_config_etag")},DP.prototype.setActiveConfigEtag=function(t){return this.set("active_config_etag",t)},DP.prototype.getThrottleMetadata=function(){return this.get("throttle_metadata")},DP.prototype.setThrottleMetadata=function(t){return this.set("throttle_metadata",t)},DP.prototype.deleteThrottleMetadata=function(){return this.delete("throttle_metadata")},DP.prototype.get=function(a){return Ts(this,void 0,void 0,function(){var o,s=this;return Ss(this,function(t){switch(t.label){case 0:return[4,this.openDbPromise];case 1:return o=t.sent(),[2,new Promise(function(n,e){var t=o.transaction([AP],"readonly").objectStore(AP),r=s.createCompositeKey(a);try{var i=t.get(r);i.onerror=function(t){e(NP(t,"storage-get"))},i.onsuccess=function(t){var e=t.target.result;n(e?e.value:void 0)}}catch(t){e(gP.create("storage-get",{originalErrorMessage:t&&t.message}))}})]}})})},DP.prototype.set=function(a,u){return Ts(this,void 0,void 0,function(){var o,s=this;return Ss(this,function(t){switch(t.label){case 0:return[4,this.openDbPromise];case 1:return o=t.sent(),[2,new Promise(function(t,e){var n=o.transaction([AP],"readwrite").objectStore(AP),r=s.createCompositeKey(a);try{var i=n.put({compositeKey:r,value:u});i.onerror=function(t){e(NP(t,"storage-set"))},i.onsuccess=function(){t()}}catch(t){e(gP.create("storage-set",{originalErrorMessage:t&&t.message}))}})]}})})},DP.prototype.delete=function(a){return Ts(this,void 0,void 0,function(){var o,s=this;return Ss(this,function(t){switch(t.label){case 0:return[4,this.openDbPromise];case 1:return o=t.sent(),[2,new Promise(function(t,e){var n=o.transaction([AP],"readwrite").objectStore(AP),r=s.createCompositeKey(a);try{var i=n.delete(r);i.onerror=function(t){e(NP(t,"storage-delete"))},i.onsuccess=function(){t()}}catch(t){e(gP.create("storage-delete",{originalErrorMessage:t&&t.message}))}})]}})})},DP.prototype.createCompositeKey=function(t){return[this.appId,this.appName,this.namespace,t].join()},DP);function DP(t,e,n,r){void 0===r&&(r=new Promise(function(e,n){var t=indexedDB.open(kP,RP);t.onerror=function(t){n(NP(t,"storage-open"))},t.onsuccess=function(t){e(t.target.result)},t.onupgradeneeded=function(t){var e=t.target.result;switch(t.oldVersion){case 0:e.createObjectStore(AP,{keyPath:"compositeKey"})}}})),this.appId=t,this.appName=e,this.namespace=n,this.openDbPromise=r}var PP=(xP.prototype.getLastFetchStatus=function(){return this.lastFetchStatus},xP.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.lastSuccessfulFetchTimestampMillis},xP.prototype.getActiveConfig=function(){return this.activeConfig},xP.prototype.loadFromStorage=function(){return Ts(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return e=this.storage.getLastFetchStatus(),n=this.storage.getLastSuccessfulFetchTimestampMillis(),r=this.storage.getActiveConfig(),[4,e];case 1:return(i=t.sent())&&(this.lastFetchStatus=i),[4,n];case 2:return(o=t.sent())&&(this.lastSuccessfulFetchTimestampMillis=o),[4,r];case 3:return(s=t.sent())&&(this.activeConfig=s),[2]}})})},xP.prototype.setLastFetchStatus=function(t){return this.lastFetchStatus=t,this.storage.setLastFetchStatus(t)},xP.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.lastSuccessfulFetchTimestampMillis=t,this.storage.setLastSuccessfulFetchTimestampMillis(t)},xP.prototype.setActiveConfig=function(t){return this.activeConfig=t,this.storage.setActiveConfig(t)},xP);function xP(t){this.storage=t}var LP=(MP.prototype.fetch=function(n){return Ts(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,this.storage.getThrottleMetadata()];case 1:return e=t.sent()||{backoffCount:0,throttleEndTimeMillis:Date.now()},[2,this.attemptFetch(n,e)]}})})},MP.prototype.attemptFetch=function(i,t){var o=t.throttleEndTimeMillis,s=t.backoffCount;return Ts(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return[4,function(i,o){return new Promise(function(t,e){var n=Math.max(o-Date.now(),0),r=setTimeout(t,n);i.addEventListener(function(){clearTimeout(r),e(gP.create("fetch-throttle",{throttleEndTimeMillis:o}))})})}(i.signal,o)];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,5,,7]),[4,this.client.fetch(i)];case 3:return e=t.sent(),[4,this.storage.deleteThrottleMetadata()];case 4:return t.sent(),[2,e];case 5:if(!function(t){if(!(t instanceof Ks))return!1;var e=Number(t.httpStatus);return 429===e||500===e||503===e||504===e}(n=t.sent()))throw n;return r={throttleEndTimeMillis:Date.now()+function(t){var e=1e3*Math.pow(2,t),n=Math.round(.5*e*(Math.random()-.5)*2);return Math.min(144e5,e+n)}(s),backoffCount:s+1},[4,this.storage.setThrottleMetadata(r)];case 6:return t.sent(),[2,this.attemptFetch(i,r)];case 7:return[2]}})})},MP);function MP(t,e){this.client=t,this.storage=e}var FP,UP="@firebase/remote-config";return(FP=Kl).INTERNAL.registerComponent(new da("remoteConfig",function(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("installations").getImmediate();if("undefined"==typeof window)throw gP.create("registration-window");var i=n.options,o=i.projectId,s=i.apiKey,a=i.appId;if(!o)throw gP.create("registration-project-id");if(!s)throw gP.create("registration-api-key");if(!a)throw gP.create("registration-app-id");e=e||"firebase";var u=new OP(a,n.name,e),c=new PP(u),h=new Oa(UP);h.logLevel=Ia.ERROR;var l=new mP(r,FP.SDK_VERSION,e,o,s,a),f=new LP(l,u),p=new dP(f,u,c,h),d=new SP(n,p,c,u,h);return d.ensureInitialized(),d},"PUBLIC").setMultipleInstances(!0)),FP.registerVersion(UP,"0.1.17"),console.warn("\nIt looks like you're using the development build of the Firebase JS SDK.\nWhen deploying Firebase apps to production, it is advisable to only import\nthe individual SDK components you intend to use.\n\nFor the CDN builds, these are available in the following manner\n(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):\n\nhttps://www.gstatic.com/firebasejs/5.0.0/firebase-<PACKAGE>.js\n"),Kl.registerVersion("firebase","7.13.1","cdn"),Kl});
2//# sourceMappingURL=firebase.js.map