VUE_GabenParadise/node_modules/firebase/firebase.js

3 lines
803 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!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"];_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},b.call(_.prototype),b.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=_,t.Response=E,t.fetch=function(n,i){return new Promise(function(r,t){var e=new _(n,i),o=new XMLHttpRequest;o.onload=function(){var t,i,e={status:o.status,statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",i=new d,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)};e.url="responseURL"in o?o.responseURL:e.headers.get("X-Request-URL");var n="response"in o?o.response:o.responseText;r(new E(n,e))},o.onerror=function(){t(new TypeError("Network request failed"))},o.ontimeout=function(){t(new TypeError("Network request failed"))},o.open(e.method,e.url,!0),"include"===e.credentials?o.withCredentials=!0:"omit"===e.credentials&&(o.withCredentials=!1),"responseType"in o&&s&&(o.responseType="blob"),e.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.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 b(){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,e,n,r=v(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=y(e),e.readAsText(t),n;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(w)}),this.json=function(){return this.text().then(JSON.parse)},this}function _(t,e){var n,r,i=(e=e||{}).body;if(t instanceof _){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,i||null==t._bodyInit||(i=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=(n=e.method||this.method||"GET",r=n.toUpperCase(),-1<c.indexOf(r)?r:n),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(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 _(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}function h(e,n){try{w(m,e,n)}catch(t){m[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(O,t)||(A&&c(R,t)?O[t]=R[t]:O[t]=P("Symbol."+t)),O[t]}var m=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=m.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}},w=f?function(t,e,n){return b.f(t,e,_(1,n))}:function(t,e,n){return t[e]=n,t},E="__core-js_shared__",T=m[E]||h(E,{}),I=e(function(t){(t.exports=function(t,e){return T[t]||(T[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",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,O=I("wks"),R=m.Symbol,P=k?R:R&&R.withoutSetter||a,D={};D[i("toStringTag")]="z";var x="[object z]"===String(D),L=Function.toString;"function"!=typeof T.inspectSource&&(T.inspectSource=function(t){return L.call(t)});function M(t){return W[t]||(W[t]=a(t))}var F,U,j,V=T.inspectSource,q=m.WeakMap,B="function"==typeof q&&/native code/.test(V(q)),W=I("keys"),H={},G=m.WeakMap;if(B){var z=new G,K=z.get,Q=z.has,Y=z.set;F=function(t,e){return Y.call(z,t,e),e},U=function(t){return K.call(z,t)||{}},j=function(t){return Q.call(z,t)}}else{var X=M("state");H[X]=!0,F=function(t,e){return w(t,X,e),e},U=function(t){return c(t,X)?t[X]:{}},j=function(t){return c(t,X)}}function $(t){return tt.call(t).slice(8,-1)}var J={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=J.get,a=J.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")||w(n,"name",e),a(n).source=u.join("string"==typeof e?e:"")),t!==m?(i?!s&&t[e]&&(o=!0):delete t[e],o?t[e]=n:w(t,e,n)):o?t[e]=n:h(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||V(this)})}),tt={}.toString,et=i("toStringTag"),nt="Arguments"==$(function(){return arguments}()),rt=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?$(e):"Object"==(r=$(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:wt)(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(Rt[t])||ct(m[t]):Rt[t]&&Rt[t][e]||m[t]&&m[t][e]}function lt(t){return 0<t?Pt(ot(t),9007199254740991):0}function ft(c){return function(t,e,n){var r,i,o,s=ut(t),a=lt(s.length),u=(r=a,(i=ot(n))<0?Dt(i+r,0):xt(i,r));if(c&&e!=e){for(;u<a;)if((o=s[u++])!=o)return!0}else for(;u<a;u++)if((c||u in s)&&s[u]===e)return c||u||0;return!c&&-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=Vt(e),r=b.f,i=Ot.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==Gt||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?m:c?m[a]||h(a,{}):(m[a]||{}).prototype)for(r in e){if(o=e[r],i=t.noTargetGet?(s=Kt(n,r))&&s.value:n[r],!zt(u?r:a+(c?".":"#")+r,t.forced)&&void 0!==i){if(typeof o==typeof i)continue;dt(o,i)}(t.sham||i&&i.sham)&&w(o,"sham",!0),Z(n,r,o,t)}}function gt(t){return Object(st(t))}var mt,bt,_t,wt=Math.ceil,Et=Math.floor,Tt={codeAt:at(!1),charAt:at(!0)},It={}.propertyIsEnumerable,St=Object.getOwnPropertyDescriptor,Ct={f:St&&!It.call({1:2},1)?function(t){var e=St(this,t);return!!e&&e.enumerable}:It},Nt="".split,At=y(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==$(t)?Nt.call(t,""):Object(t)}:Object,kt=Object.getOwnPropertyDescriptor,Ot={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 _(!Ct.f.call(t,e),t[e])}},Rt=m,Pt=Math.min,Dt=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},Vt=ht("Reflect","ownKeys")||function(t){var e=Ut.f(d(t)),n=jt.f;return n?e.concat(n(t)):e},qt=/#|\.prototype\./,Bt=vt.normalize=function(t){return String(t).replace(qt,".").toLowerCase()},Wt=vt.data={},Ht=vt.NATIVE="N",Gt=vt.POLYFILL="P",zt=vt,Kt=Ot.f,Qt=!y(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Yt=M("IE_PROTO"),Xt=Object.prototype,$t=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?Xt:null},Jt=i("iterator"),Zt=!1;[].keys&&("next"in(_t=[].keys())?(bt=$t($t(_t)))!==Object.prototype&&(mt=bt):Zt=!0),null==mt&&(mt={}),c(mt,Jt)||w(mt,Jt,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){}var t,e;he=ne?function(t){t.write(ee("")),t.close();var e=t.parentWindow.Object;return t=null,e}(ne):((e=r("iframe")).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 n=Mt.length;n--;)delete he[ae][Mt[n]];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){var a,u,c;function h(t){if(t===i&&m)return m;if(!Ee&&t in y)return y[t];switch(t){case"keys":case Ie:case Se:return function(){return new n(this,t)}}return function(){return new n(this)}}u=r,c=e+" Iterator",(a=n).prototype=ve(be,{next:_(1,u)}),le(a,c,!1),me[c]=fe;var l,f,p,d=e+" Iterator",v=!1,y=t.prototype,g=y[Te]||y["@@iterator"]||i&&y[i],m=!Ee&&g||h(i),b="Array"==e&&y.entries||g;if(b&&(l=$t(b.call(new t)),we!==Object.prototype&&l.next&&($t(l)!==we&&(_e?_e(l,we):"function"!=typeof l[Te]&&w(l,Te,pe)),le(l,d,!0))),i==Ie&&g&&g.name!==Ie&&(v=!0,m=function(){return g.call(this)}),y[Te]!==m&&w(y,Te,m),me[e]=m,i)if(f={values:h(Ie),keys:o?m:h("keys"),entries:h(Se)},s)for(p in f)!Ee&&!v&&p in y||Z(y,p,f[p]);else yt({target:e,proto:!0,forced:Ee||v},f);return f}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={},be=re.IteratorPrototype,_e=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),we=re.IteratorPrototype,Ee=re.BUGGY_SAFARI_ITERATORS,Te=i("iterator"),Ie="values",Se="entries",Ce=Tt.charAt,Ne="String Iterator",Ae=J.set,ke=J.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 Oe={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},Re=i("unscopables"),Pe=Array.prototype;null==Pe[Re]&&b.f(Pe,Re,{configurable:!0,value:ve(null)});function De(t){Pe[Re][t]=!0}var xe="Array Iterator",Le=J.set,Me=J.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,De("keys"),De("values"),De("entries");var Ue=i("iterator"),je=i("toStringTag"),Ve=Fe.values;for(var qe in Oe){var Be=m[qe],We=Be&&Be.prototype;if(We){if(We[Ue]!==Ve)try{w(We,Ue,Ve)}catch(au){We[Ue]=Ve}if(We[je]||w(We,je,qe),Oe[qe])for(var He in Fe)if(We[He]!==Fe[He])try{w(We,He,Fe[He])}catch(au){We[He]=Fe[He]}}}function Ge(t,e,n){for(var r in e)Z(t,r,e[r],n);return t}function ze(t){var e=ht(t),n=b.f;f&&e&&!e[tn]&&n(e,tn,{configurable:!0,get:function(){return this}})}function Ke(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 Xe(r,i,t){if(Ke(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 $e(t){if(null!=t)return t[rn]||t["@@iterator"]||me[rt(t)]}function Je(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=m.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=Xe(e,n,r?2:1);if(i)o=t;else{if("function"!=typeof(s=$e(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=Je(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)[bn])?e:Ke(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){m.postMessage(t+"",En.protocol+"//"+En.host)}var yn,gn,mn,bn=i("species"),_n=ht("navigator","userAgent")||"",wn=/(iphone|ipod|ipad).*applewebkit/i.test(_n),En=m.location,Tn=m.setImmediate,In=m.clearImmediate,Sn=m.process,Cn=m.MessageChannel,Nn=m.Dispatch,An=0,kn={},On="onreadystatechange";Tn&&In||(Tn=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},In=function(t){delete kn[t]},"process"==$(Sn)?yn=function(t){Sn.nextTick(pn(t))}:Nn&&Nn.now?yn=function(t){Nn.now(pn(t))}:Cn&&!wn?(mn=(gn=new Cn).port2,gn.port1.onmessage=dn,yn=Xe(mn.postMessage,mn,1)):!m.addEventListener||"function"!=typeof postMessage||m.importScripts||y(vn)||"file:"===En.protocol?yn=On in r("script")?function(t){se.appendChild(r("script"))[On]=function(){se.removeChild(this),fn(t)}}:function(t){setTimeout(pn(t),0)}:(yn=vn,m.addEventListener("message",dn,!1)));var Rn,Pn,Dn,xn,Ln,Mn,Fn,Un,jn={set:Tn,clear:In},Vn=Ot.f,qn=jn.set,Bn=m.MutationObserver||m.WebKitMutationObserver,Wn=m.process,Hn=m.Promise,Gn="process"==$(Wn),zn=Vn(m,"queueMicrotask"),Kn=zn&&zn.value;Kn||(Rn=function(){var t,e;for(Gn&&(t=Wn.domain)&&t.exit();Pn;){e=Pn.fn,Pn=Pn.next;try{e()}catch(t){throw Pn?xn():Dn=void 0,t}}Dn=void 0,t&&t.enter()},xn=Gn?function(){Wn.nextTick(Rn)}:Bn&&!wn?(Ln=!0,Mn=document.createTextNode(""),new Bn(Rn).observe(Mn,{characterData:!0}),function(){Mn.data=Ln=!Ln}):Hn&&Hn.resolve?(Fn=Hn.resolve(void 0),Un=Fn.then,function(){Un.call(Fn,Rn)}):function(){qn.call(m,Rn)});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=Ke(n),this.reject=Ke(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 Xn(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}var $n,Jn,Zn=Kn||function(t){var e={fn:t,next:void 0};Dn&&(Dn.next=e),Pn||(Pn=e,xn()),Dn=e},tr={f:function(t){return new Qn(t)}},er=m.process,nr=er&&er.versions,rr=nr&&nr.v8;rr?Jn=($n=rr.split("."))[0]+$n[1]:_n&&(!($n=_n.match(/Edge\/(\d+)/))||74<=$n[1])&&($n=_n.match(/Chrome\/(\d+)/))&&(Jn=$n[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(wr("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&&Pr(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),m.dispatchEvent(r)):r={promise:e,reason:n},(i=m["on"+t])?i(r):t===kr&&function(t,e){var n=m.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=Jn&&+Jn,dr=jn.set,vr=i("species"),yr="Promise",gr=J.get,mr=J.set,br=J.getterFor(yr),_r=Ze,wr=m.TypeError,Er=m.document,Tr=m.process,Ir=ht("fetch"),Sr=tr.f,Cr=Sr,Nr="process"==$(Tr),Ar=!!(Er&&Er.createEvent&&m.dispatchEvent),kr="unhandledrejection",Or=zt(yr,function(){if(!(V(_r)!==String(_r))){if(66===pr)return!0;if(!Nr&&"function"!=typeof PromiseRejectionEvent)return!0}if(51<=pr&&/native code/.test(_r))return!1;function t(t){t(function(){},function(){})}var e=_r.resolve(1);return(e.constructor={})[vr]=t,!(e.then(function(){})instanceof t)}),Rr=Or||!hn(function(t){_r.all(t).catch(function(){})}),Pr=function(n,r){dr.call(m,function(){var t,e=r.value;if(Dr(r)&&(t=Xn(function(){Nr?Tr.emit("unhandledRejection",e,n):sr(kr,n,e)}),r.rejection=Nr||Dr(r)?2:1,t.error))throw t.value})},Dr=function(t){return 1!==t.rejection&&!t.parent},xr=function(t,e){dr.call(m,function(){Nr?Tr.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 wr("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)}}};Or&&(_r=function(t){Qe(this,_r,yr),Ke(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(){mr(this,{type:yr,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Ge(_r.prototype,{then:function(t,e){var n=br(this),r=Sr(ln(this,_r));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=Nr?Tr.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===_r||t===lr?new hr:Cr(t)},"function"==typeof Ze&&(fr=Ze.prototype.then,Z(Ze.prototype,"then",function(t,e){var n=this;return new _r(function(t,e){fr.call(n,t,e)}).then(t,e)},{unsafe:!0}),"function"==typeof Ir&&yt({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return Yn(_r,Ir.apply(m,arguments))}}))),yt({global:!0,wrap:!0,forced:Or},{Promise:_r}),le(_r,yr,!1),ze(yr),lr=ht(yr),yt({target:yr,stat:!0,forced:Or},{reject:function(t){var e=Sr(this);return e.reject.call(void 0,t),e.promise}}),yt({target:yr,stat:!0,forced:Or},{resolve:function(t){return Yn(this,t)}}),yt({target:yr,stat:!0,forced:Rr},{all:function(t){var a=this,e=Sr(a),u=e.resolve,c=e.reject,n=Xn(function(){var r=Ke(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=Xn(function(){var e=Ke(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=Xn(function(){var r=Ke(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);Rt.Promise;var Fr=J.set,Ur=J.getterFor("AggregateError"),jr=function(t,e){var n=this;if(!(n instanceof jr))return new jr(t,e);_e&&(n=_e(new Error(e),$t(n)));var r=[];return on(t,r.push,r),f?Fr(n,{errors:r,type:"AggregateError"}):n.errors=r,void 0!==e&&w(n,"message",String(e)),n};jr.prototype=ve(Error.prototype,{constructor:_(5,jr),message:_(5,""),name:_(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=Xn(t);return(n.error?e.reject:e.resolve)(n.value),e.promise}});var Vr="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=Xn(function(){var r=Ke(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,Vr)))})}),--s||h(new(ht("AggregateError"))(i,Vr))});return n.error&&h(n.value),e.promise}});function qr(t,e){var n;return Gr(t)&&("function"==typeof(n=t.constructor)&&(n===Array||Gr(n.prototype))||g(n)&&null===(n=n[zr]))&&(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,b=5==p||m;return function(t,e,n,r){for(var i,o,s=gt(t),a=At(s),u=Xe(e,n,3),c=lt(a.length),h=0,l=r||qr,f=d?l(t,c):v?l(t,0):void 0;h<c;h++)if((b||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:Kr.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(Xr,t))return Xr[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 Xr[t]=!!n&&!y(function(){if(r&&!f)return 1;var t={length:-1};r?Yr(t,1,{enumerable:!0,get:Wr}):t[1]=1,n.call(t,i,o)})}var Gr=Array.isArray||function(t){return"Array"==$(t)},zr=i("species"),Kr=[].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,Xr={},$r=Qr.find,Jr="find",Zr=!0,ti=Hr(Jr);Jr in[]&&Array(1)[Jr](function(){Zr=!1}),yt({target:"Array",proto:!0,forced:Zr||!ti},{find:function(t,e){return $r(this,t,1<arguments.length?e:void 0)}}),De(Jr);function ei(t,e,n){return Xe(ni,m[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)}}),De(ii);function ai(t,e,n){var r=o(e);r in t?b.f(t,r,_(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=$e(c),v=0;if(p&&(f=Xe(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?Je(s,f,[o.value,v],!0):o.value,ai(i,v,u);return i.length=v,i}});Rt.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=m.Int8Array,bi=mi&&mi.prototype,_i=m.Uint8ClampedArray,wi=_i&&_i.prototype,Ei=mi&&$t(mi),Ti=bi&&$t(bi),Ii=Object.prototype,Si=(Ii.isPrototypeOf,i("toStringTag")),Ci=a("TYPED_ARRAY_TAG"),Ni=yi&&!!_e&&"Opera"!==rt(m.opera),Ai={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8};for(vi in Ai)m[vi]||(Ni=!1);if((!Ni||"function"!=typeof Ei||Ei===Function.prototype)&&(Ei=function(){throw TypeError("Incorrect invocation")},Ni))for(vi in Ai)m[vi]&&_e(m[vi],Ei);if((!Ni||!Ti||Ti===Ii)&&(Ti=Ei.prototype,Ni))for(vi in Ai)m[vi]&&_e(m[vi].prototype,Ti);if(Ni&&$t(wi)!==Ti&&_e(wi,Ti),f&&!c(Ti,Si))for(vi in gi(Ti,Si,{get:function(){return g(this)?this[Ci]:void 0}}),Ai)m[vi]&&w(m[vi],Ci,vi);function ki(){return xi.call(Fi(this))}var Oi=function(t){if(di(t))return t;throw TypeError("Target is not a typed array")},Ri=function(t,e,n){if(f){if(n)for(var r in Ai){var i=m[r];i&&c(i.prototype,t)&&delete i.prototype[t]}Ti[t]&&!n||Z(Ti,t,!n&&Ni&&bi[t]||e)}},Pi=i("iterator"),Di=m.Uint8Array,xi=Fe.values,Li=Fe.keys,Mi=Fe.entries,Fi=Oi,Ui=Ri,ji=Di&&Di.prototype[Pi],Vi=!!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,!Vi),Ui(Pi,ki,!Vi);var qi=Object.assign,Bi=Object.defineProperty,Wi=!qi||y(function(){if(f&&1!==qi({b:1},qi(Bi({},"a",{enumerable:!0,get:function(){Bi(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return 1;var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=qi({},t)[n]||ie(qi({},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}:qi;yt({target:"Object",stat:!0,forced:Object.assign!==Wi},{assign:Wi});Rt.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&&!Gi.call(n,e)||s.push(a?[e,n[e]]:n[e]);return s}}var Gi=Ct.f,zi={entries:Hi(!0),values:Hi(!1)},Ki=zi.entries;yt({target:"Object",stat:!0},{entries:function(t){return Ki(t)}});Rt.Object.entries;var Qi=zi.values;yt({target:"Object",stat:!0},{values:function(t){return Qi(t)}});Rt.Object.values;function Yi(t){if(g(e=t)&&(void 0!==(n=e[$i])?n:"RegExp"==$(e)))throw TypeError("The method doesn't accept regular expressions");var e,n;return t}function Xi(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[Ji]=!1,"/./"[e](n)}catch(t){}}return!1}var $i=i("match"),Ji=i("match");yt({target:"String",proto:!0,forced:!Xi("includes")},{includes:function(t,e){return!!~String(st(this)).indexOf(Yi(t),1<arguments.length?e:void 0)}});ei("String","includes");var Zi,to=Ot.f,eo="".startsWith,no=Math.min,ro=Xi("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)){var e=t[uo];return void 0!==e?!!e:Gr(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=qr(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=Rt.Symbol||(Rt.Symbol={});c(e,t)||Io(e,t,{value:To.f(t)})}function vo(t,e){var n=jo[t]=ve(Do[Ao]);return Oo(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(Xo(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!==Po||!c(jo,r)||c(Vo,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 bo=Ut.f,_o={}.toString,wo="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Eo={f:function(t){return wo&&"[object Window]"==_o.call(t)?function(t){try{return bo(t)}catch(t){return wo.slice()}}(t):bo(ut(t))}},To={f:i},Io=b.f,So=Qr.forEach,Co=M("hidden"),No="Symbol",Ao="prototype",ko=i("toPrimitive"),Oo=J.set,Ro=J.getterFor(No),Po=Object[Ao],Do=m.Symbol,xo=ht("JSON","stringify"),Lo=Ot.f,Mo=b.f,Fo=Eo.f,Uo=Ct.f,jo=I("symbols"),Vo=I("op-symbols"),qo=I("string-to-symbol-registry"),Bo=I("symbol-to-string-registry"),Wo=I("wks"),Ho=m.QObject,Go=!Ho||!Ho[Ao]||!Ho[Ao].findChild,zo=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(Po,e);r&&delete Po[e],Mo(t,e,n),r&&t!==Po&&Mo(Po,e,r)}:Mo,Ko=k?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof Do},Qo=function(t,e,n){t===Po&&Qo(Vo,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:_(0,!1)})):(c(t,Co)||Mo(t,Co,_(1,{})),t[Co][r]=!0),zo(t,r,n)):Mo(t,r,n)},Yo=function(t){var e=o(t,!0),n=Uo.call(this,e);return!(this===Po&&c(jo,e)&&!c(Vo,e))&&(!(n||!c(this,e)||!c(jo,e)||c(this,Co)&&this[Co][e])||n)},Xo=function(t){var e=t===Po,n=Fo(e?Vo:ut(t)),r=[];return So(n,function(t){!c(jo,t)||e&&!c(Po,t)||r.push(jo[t])}),r};if(A||(Z((Do=function(t){if(this instanceof Do)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===Po&&r.call(Vo,t),c(this,Co)&&c(this[Co],n)&&(this[Co][n]=!1),zo(this,n,_(1,t))};return f&&Go&&zo(Po,n,{configurable:!0,set:r}),vo(n,e)})[Ao],"toString",function(){return Ro(this).tag}),Z(Do,"withoutSetter",function(t){return vo(a(t),t)}),Ct.f=Yo,b.f=Qo,Ot.f=go,Ut.f=Eo.f=mo,jt.f=Xo,To.f=function(t){return vo(i(t),t)},f&&(Mo(Do[Ao],"description",{configurable:!0,get:function(){return Ro(this).description}}),Z(Po,"propertyIsEnumerable",Yo,{unsafe:!0}))),yt({global:!0,wrap:!0,forced:!A,sham:!A},{Symbol:Do}),So(ie(Wo),function(t){po(t)}),yt({target:No,stat:!0,forced:!A},{for:function(t){var e=String(t);if(c(qo,e))return qo[e];var n=Do(e);return qo[e]=n,Bo[n]=e,n},keyFor:function(t){if(!Ko(t))throw TypeError(t+" is not a symbol");if(c(Bo,t))return Bo[t]},useSetter:function(){Go=!0},useSimple:function(){Go=!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:Xo}),yt({target:"Object",stat:!0,forced:y(function(){jt.f(1)})},{getOwnPropertySymbols:function(t){return jt.f(gt(t))}}),xo){var $o=!A||y(function(){var t=Do();return"[null]"!=xo([t])||"{}"!=xo({a:t})||"{}"!=xo(Object(t))});yt({target:"JSON",stat:!0,forced:$o},{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)&&!Ko(t))return Gr(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!Ko(e))return e}),i[1]=e,xo.apply(null,i)}})}Do[Ao][ko]||w(Do[Ao],ko,Do[Ao].valueOf),le(Do,No),H[Co]=!0,po("asyncIterator");var Jo=b.f,Zo=m.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\((.*)\)[^)]+$/;Jo(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(m.JSON,"JSON",!0);Rt.Symbol;po("asyncDispose"),po("dispose"),po("observable"),po("patternMatch"),po("replaceAll");To.f("iterator");function ss(u,t,e){function n(t){var n=i[t];Z(i,t,"add"==t?function(t){return n.call(this,0===t?0:t),this}:"delete"==t?function(t){return!(r&&!g(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return r&&!g(t)?void 0:n.call(this,0===t?0:t)}:"has"==t?function(t){return!(r&&!g(t))&&n.call(this,0===t?0:t)}:function(t,e){return n.call(this,0===t?0:t,e),this})}var c=-1!==u.indexOf("Map"),r=-1!==u.indexOf("Weak"),h=c?"set":"add",l=m[u],i=l&&l.prototype,f=l,o={};if(zt(u,"function"!=typeof l||!(r||i.forEach&&!y(function(){(new l).entries().next()}))))f=e.getConstructor(t,u,c,h),cs.REQUIRED=!0;else if(zt(u,!0)){var s=new f,a=s[h](r?{}:-0,1)!=s,p=y(function(){s.has(1)}),d=hn(function(t){new l(t)}),v=!r&&y(function(){for(var t=new l,e=5;e--;)t[h](e,e);return!t.has(-0)});d||(((f=t(function(t,e){Qe(t,f,u);var n,r,i,o,s,a=(n=new l,r=t,i=f,_e&&"function"==typeof(o=r.constructor)&&o!==i&&g(s=o.prototype)&&s!==i.prototype&&_e(n,s),n);return null!=e&&on(e,a[h],a,c),a})).prototype=i).constructor=f),(p||v)&&(n("delete"),n("has"),c&&n("get")),(v||a)&&n(h),r&&i.clear&&delete i.clear}return o[u]=f,yt({global:!0,forced:f!=l},o),le(f,u),r||e.setStrong(f,u,c),f}function as(t,e,n){var r,i,o,s,a=arguments.length,u=1<a?e:void 0;return Ke(this),(r=void 0!==u)&&Ke(u),null==t?new this:(i=[],r?(o=0,s=Xe(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=J.set,ps=J.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 Ge(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=Xe(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)}}),Ge(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),ze(e)}};ss("Map",function(e){return function(t){return e(this,arguments.length?t:void 0)}},ds),Rt.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=Ke(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=Xe(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=Xe(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Map"))),s=Ke(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=Xe(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=Xe(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;Ke(n);var i=Ke(r.has),o=Ke(r.get),s=Ke(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(i){return on(gs(d(this)),function(t,e){if((n=e)===(r=i)||n!=n&&r!=r)return on.stop();var n,r},void 0,!0,!0).stopped}}),yt({target:"Map",stat:!0},{keyBy:function(t,e){var n=new this;Ke(e);var r=Ke(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=Xe(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Map"))),s=Ke(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=Xe(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Map"))),s=Ke(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=Ke(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(Ke(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=Xe(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;Ke(e);var o=r.has(t);if(!o&&i<3)throw TypeError("Updating absent value");var s=o?r.get(t):Ke(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),Rt.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=Ke(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 bs(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=bs(n),i=Xe(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=Ke(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=bs(n),i=Xe(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Set"))),s=Ke(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=bs(n),i=Xe(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=Ke(e.has),i=Ke(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=Ke(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=$e(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=Ke(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=Ke(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=bs(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=bs(n),i=Xe(t,1<arguments.length?e:void 0,3),o=new(ln(n,ht("Set"))),s=Ke(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=bs(n),i=arguments.length<2,o=i?void 0:t;if(Ke(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=bs(n),i=Xe(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=Ke(n.delete),i=Ke(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,Ke(n.add),n),n}});var _s=Math.floor;yt({target:"Number",stat:!0},{isInteger:function(t){return!g(t)&&isFinite(t)&&_s(t)===t}});Rt.Number.isInteger;var ws=function(t,e){return(ws=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}ws(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Ts=function(){return(Ts=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 Is(t,s,a,u){return new(a=a||Promise)(function(n,e){function r(t){try{o(u.next(t))}catch(t){e(t)}}function i(t){try{o(u.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).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 Os(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 Rs(t){try{return Ls.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}var Ps={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},Ds=function(t,e){if(!t)throw xs(e)},xs=function(t){return new Error("Firebase Database ("+Ps.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(Os(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 Vs(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function qs(){return"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Vs())}function Bs(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function Ws(){return!0===Ps.NODE_ADMIN}var Hs,Gs=(Es(zs,Hs=Error),zs);function zs(t,e){var n=Hs.call(this,e)||this;return n.code=t,n.name="FirebaseError",Object.setPrototypeOf(n,zs.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,Ks.prototype.create),n}var Ks=(Qs.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r,i=e[0]||{},o=this.service+"/"+t,s=this.errors[t],a=s?(r=i,s.replace(Ys,function(t,e){var n=r[e];return null!=n?n.toString():"<"+e+"?>"})):"Error",u=this.serviceName+": "+a+" ("+o+").",c=new Gs(o,u),h=0,l=Object.keys(i);h<l.length;h++){var f=l[h];"_"!==f.slice(-1)&&(f in c&&console.warn('Overwriting FirebaseError base field "'+f+'" can cause unexpected behavior.'),c[f]=i[f])}return c},Qs);function Qs(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var Ys=/\{\$([^}]+)}/g;function Xs(t){return JSON.parse(t)}function $s(t){return JSON.stringify(t)}function Js(t){var e={},n={},r={},i="";try{var o=t.split(".");e=Xs(Rs(o[0])||""),n=Xs(Rs(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)for(var n=0,r=e;n<r.length;n++){var i=r[n];if(i in t&&"function"==typeof t[i])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,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=Ts({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("EAGER"===(this.component=t).instantiationMode)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 Is(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,n=this.instances.get(t);return!n&&this.component&&(n=this.component.instanceFactory(this.container,(e=t)===ya?void 0:e),this.instances.set(t,n)),n||null},ma.prototype.normalizeInstanceIdentifier=function(t){return!this.component||this.component.multipleInstances?t:ya},ma);function ma(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}var ba,_a=(wa.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)},wa.prototype.addOrOverwriteComponent=function(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)},wa.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},wa.prototype.getProviders=function(){return Array.from(this.providers.values())},wa);function wa(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 Ta,Ia,Sa=[];(Ia=Ta=Ta||{})[Ia.DEBUG=0]="DEBUG",Ia[Ia.VERBOSE=1]="VERBOSE",Ia[Ia.INFO=2]="INFO",Ia[Ia.WARN=3]="WARN",Ia[Ia.ERROR=4]="ERROR",Ia[Ia.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=Oa[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:Ta.DEBUG,verbose:Ta.VERBOSE,info:Ta.INFO,warn:Ta.WARN,error:Ta.ERROR,silent:Ta.SILENT},ka=Ta.INFO,Oa=((ba={})[Ta.DEBUG]="log",ba[Ta.VERBOSE]="log",ba[Ta.INFO]="info",ba[Ta.WARN]="warn",ba[Ta.ERROR]="error",ba),Ra=(Object.defineProperty(Pa.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in Ta))throw new TypeError("Invalid value assigned to `logLevel`");this._logLevel=t},enumerable:!0,configurable:!0}),Object.defineProperty(Pa.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(Pa.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!0,configurable:!0}),Pa.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Ea([this,Ta.DEBUG],t)),this._logHandler.apply(this,Ea([this,Ta.DEBUG],t))},Pa.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Ea([this,Ta.VERBOSE],t)),this._logHandler.apply(this,Ea([this,Ta.VERBOSE],t))},Pa.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Ea([this,Ta.INFO],t)),this._logHandler.apply(this,Ea([this,Ta.INFO],t))},Pa.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Ea([this,Ta.WARN],t)),this._logHandler.apply(this,Ea([this,Ta.WARN],t))},Pa.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Ea([this,Ta.ERROR],t)),this._logHandler.apply(this,Ea([this,Ta.ERROR],t))},Pa);function Pa(t){this.name=t,this._logLevel=ka,this._logHandler=Ca,this._userLogHandler=null,Sa.push(this)}function Da(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 Ks("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),Va=new Ra("@firebase/app"),qa=(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){Va.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 _a(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}}}qa.prototype.name&&qa.prototype.options||qa.prototype.delete||console.log("dc");var Wa="7.14.6";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 Va.warn(a.join(" "))}p(new da(i+"-version",function(){return{library:i,version:e}},"VERSION"))},setLogLevel:Da,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:Ta[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 Va.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 Ga=function t(){var e=Ha(qa);return e.INTERNAL=Ts(Ts({},e.INTERNAL),{createFirebaseNamespace:t,extendNamespace:function(t){Fs(e,t)},createSubscribe:oa,ErrorFactory:Ks,deepExtend:Fs}),e}(),za=(Ka.prototype.getPlatformInfoString=function(){return this.container.getProviders().map(function(t){if("VERSION"!==(null==(e=t.getComponent())?void 0:e.type))return null;var e,n=t.getImmediate();return n.library+"/"+n.version}).filter(function(t){return t}).join(" ")},Ka);function Ka(t){this.container=t}if("object"==typeof self&&self.self===self&&void 0!==self.firebase){Va.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")&&Va.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=Ga.initializeApp;Ga.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}}()&&Va.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 Xa,$a,Kl=Ga;(Xa=Kl).INTERNAL.registerComponent(new da("platform-logger",function(t){return new za(t)},"PRIVATE")),Xa.registerVersion(Fa,"0.6.4",$a),Xa.registerVersion("fire-js","");Kl.registerVersion("firebase","7.14.6","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,n,r="undefined"!=typeof Symbol&&Symbol.iterator&&t[Symbol.iterator];return r?r.call(t):{next:(e=t,n=0,function(){return n<e.length?{done:!1,value:e[n++]}:{done:!0}})}}!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,f=/^[\w+/_-]+[=]{0,2}$/,p=null;function a(){}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 h(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 r="closure_uid_"+(1e9*Math.random()>>>0),i=0;function y(t,e,n){return t.call.apply(t.bind,arguments)}function g(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 m(t,e,n){return(m=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?y:g).apply(null,arguments)}function b(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 _=Date.now||function(){return+new Date};function e(t,e){function n(){}n.prototype=e.prototype,t.Za=e.prototype,t.prototype=new n,t.prototype.constructor=t}function w(t,e,n){this.code=I+t,this.message=e||S[t]||"",this.a=n||null}function E(t){var e=t&&t.code;return e?new w(e.substring(I.length),t.message,t.serverResponse):null}e(w,Error),w.prototype.v=function(){var t={code:this.code,message:this.message};return this.a&&(t.serverResponse=this.a),t},w.prototype.toJSON=function(){return this.v()};var T,I="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)try{return t.$goog_Thenable}catch(t){return}}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 O(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 R(t,e){throw new O("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1))}function P(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function D(t,e){t.f(e),t.b<100&&(t.b++,e.next=t.a,t.a=e)}function x(){this.b=this.a=null}T=N("__EID__")?"__EID__":void 0,e(k,Error),k.prototype.name="CustomError",e(O,k),O.prototype.name="AssertionError",P.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 P(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},V=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},q=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 G(t){return Array.prototype.concat.apply([],arguments)}function z(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 K,Q=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]},Y=/&/g,X=/</g,$=/>/g,J=/"/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){K=ot;break t}}K=""}function st(t){return nt(K,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;return 1}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;R("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:(R("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===It&&e||"",this.b=Tt}function bt(t){return t instanceof mt&&t.constructor===mt&&t.b===Tt?t.a:(R("expected object of type TrustedResourceUrl, got '"+t+"' of type "+n(t)),"type_error:TrustedResourceUrl")}function _t(t,n){var r=dt(t);if(!Et.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return t=r.replace(wt,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(It,t)}mt.prototype.ra=!0,mt.prototype.qa=function(){return this.a.toString()},mt.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var wt=/%{(\w+)}/g,Et=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,Tt={},It={};function St(t,e){this.a=t===Ot&&e||"",this.b=kt}function Ct(t){return t instanceof St&&t.constructor===St&&t.b===kt?t.a:(R("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(Ot,t))}var kt={},Ot={};function Rt(){this.a="",this.b=Dt}function Pt(t){return t instanceof Rt&&t.constructor===Rt&&t.b===Dt?t.a:(R("expected object of type SafeHtml, got '"+t+"' of type "+n(t)),"type_error:SafeHtml")}Rt.prototype.ra=!0,Rt.prototype.qa=function(){return this.a.toString()},Rt.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Dt={};function xt(t){var e=new Rt;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(X,"&lt;")),-1!=t.indexOf(">")&&(t=t.replace($,"&gt;")),-1!=t.indexOf('"')&&(t=t.replace(J,"&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[" "]=a;var jt,Vt,qt=st("Opera"),Bt=st("Trident")||st("MSIE"),Wt=st("Edge"),Ht=Wt||Bt,Gt=st("Gecko")&&!(nt(K.toLowerCase(),"webkit")&&!st("Edge"))&&!(st("Trident")||st("MSIE"))&&!st("Edge"),zt=nt(K.toLowerCase(),"webkit")&&!st("Edge");function Kt(){var t=l.document;return t?t.documentMode:void 0}t:{var Qt="",Yt=(Vt=K,Gt?/rv:([^\);]+)(\)|;)/.exec(Vt):Wt?/Edge\/([\d\.]+)/.exec(Vt):Bt?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Vt):zt?/WebKit\/(\S+)/.exec(Vt):qt?/(?:Version)[ \/]?(\S+)/.exec(Vt):void 0);if(Yt&&(Qt=Yt?Yt[1]:""),Bt){var Xt=Kt();if(null!=Xt&&Xt>parseFloat(Qt)){jt=String(Xt);break t}}jt=Qt}var $t,Jt={};function Zt(a){return t=a,e=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},n=Jt,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}$t=l.document&&Bt?Kt():void 0;try{new self.OffscreenCanvas(0,0).getContext("2d")}catch(t){}var te=!Bt||9<=Number($t);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];!h(o)||v(o)&&0<o.nodeType?r(o):U(ue(o)?z(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}}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,e,n=ae(document,"IFRAME");n.style.display="none",t=n,e=new mt(It,dt(gt)),ft(t,"HTMLIFrameElement"),t.src=bt(e).toString(),document.documentElement.appendChild(n);var r=n.contentWindow;(n=r.document).open(),n.write(Pt(Lt)),n.close();var i="callImmediate"+Math.random(),o="file:"==r.location.protocol?"*":r.location.protocol+"//"+r.location.host;n=m(function(t){"*"!=o&&t.origin!=o||t.data!=i||this.port1.onmessage()},this),r.addEventListener("message",n,!1),this.port1={},this.port2={postMessage:function(){r.postMessage(i,o)}}}),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)}D(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!=a)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 be(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}be.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var _e=new P(function(){return new be},function(t){t.reset()});function we(t,e,n){var r=_e.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(a);return Ae(e,ge,t),e}function Te(n){return new ve(function(t,e){e(n)})}function Ie(t,e,n){ke(t,e,n,null)||le(b(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++)Ie(n[e],b(t,e,!0),b(t,e,!1));else r(o)})}function Ce(t,e){t.b||t.a!=ge&&t.a!=me||Oe(t),t.f?t.f.next=e:t.b=e,t.f=e}function Ne(t,i,o,s){var e=we(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){var r,i;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,Oe(t),e!=me||n instanceof Le||(i=n,(r=t).g=!0,le(function(){r.g&&xe.call(null,i)}))))}function ke(t,e,n,r){if(t instanceof ve)return Ce(t,we(e||a,n||null,r)),1;if(A(t))return t.then(e,n,r),1;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),1}catch(t){return n.call(r,t),1}}function Oe(t){t.h||(t.h=!0,le(t.ec,t))}function Re(t){var e=null;return t.b&&(e=t.b,t.b=e.next,e.next=null),t.b||(t.f=null),e}function Pe(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,De(e,n,r);else try{e.c?e.g.call(e.f):De(e,n,r)}catch(t){xe.call(null,t)}D(_e,e)}function De(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=we(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):Re(r),Pe(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=Re(this);)Pe(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}e(Le,k);var Fe=0;function Ue(t){if(!t.wa&&(t.wa=!0,t.Ba(),0!=Fe))e=t,Object.prototype.hasOwnProperty.call(e,r)&&e[r]||(e[r]=++i);var e}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},Ve=!Bt||9<=Number($t),qe=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",a,e),l.removeEventListener("test",a,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(Gt){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:Ge[t.pointerType]||"",(this.a=t).defaultPrevented&&this.preventDefault()}}We.prototype.preventDefault=function(){this.defaultPrevented=!0},e(He,We);var Ge=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,qe)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}},He.prototype.f=function(){return this.a};var ze="closure_listenable_"+(1e6*Math.random()|0),Ke=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=++Ke,this.ua=this.Na=!1}function Ye(t){t.ua=!0,t.listener=null,t.proxy=null,t.src=null,t.Ta=null}function Xe(t){this.src=t,this.a={},this.b=0}function $e(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 Je(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}Xe.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=Je(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[ze]?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,a,u=v(i)?!!i.capture:!!i,c=ln(t);if(c||(t[Ze]=c=new Xe(t)),!(n=c.add(e,n,r,u,o)).proxy)if(s=hn,r=a=Ve?function(t){return s.call(a.src,a.listener,t)}:function(t){if(!(t=s.call(a.src,a.listener,t)))return t},(n.proxy=r).src=t,r.listener=n,t.addEventListener)Be||(i=u),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[ze]?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[ze]?(t=t.u,(e=String(e).toString())in t.a&&(-1<(n=Je(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=Je(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[ze])$e(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))?($e(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(Ve)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 Xe?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 Xe(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&&$e(t.u,s),i=!1!==a.call(u,r)&&i}}return i&&!r.defaultPrevented}function mn(t,e,n){if(d(t))n&&(t=m(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=m(t.handleEvent,t)}return 2147483647<Number(e)?-1:l.setTimeout(t,e||0)}function bn(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 _n(t){if(t.V&&"function"==typeof t.V)return t.V();if("string"==typeof t)return t.split("");if(h(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 wn(t){if(t.X&&"function"==typeof t.X)return t.X();if(!t.V||"function"!=typeof t.V){if(h(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 Tn(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];In(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;)In(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function In(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e(dn,Me),dn.prototype[ze]=!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(){Tn(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},t.X=function(){return Tn(this),this.a.concat()},t.clear=function(){this.b={},this.c=this.a.length=0},t.get=function(t,e){return In(this.b,t)?this.b[t]:e},t.set=function(t,e){In(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){var r,i;e instanceof Bn?(t.a=e,r=t.a,(i=t.h)&&!r.f&&(Wn(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Gn(this,e),Kn(this,n,t))},r)),r.f=i):(n||(e=Ln(e,Vn)),t.a=new Bn(e,t.h))}function On(t,e,n){t.a.set(e,n)}function Rn(t,e){return t.a.get(e)}function Pn(t){return t instanceof Cn?new Cn(t):new Cn(t,void 0)}function Dn(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,qn)),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,Vn=/[#\?@]/g,qn=/#/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=wn(t);if(void 0===e)throw Error("Keys are undefined");var n=new Bn(null,void 0);t=_n(t);for(var r=0;r<e.length;r++){var i=e[r],o=t[r];Array.isArray(o)?Kn(n,i,o):n.add(i,o)}return n}function Gn(t,e){Wn(t),e=Yn(t,e),In(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,In((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&Tn(t)))}function zn(t,e){return Wn(t),e=Yn(t,e),In(t.a.b,e)}function Kn(t,e,n){Gn(t,e),0<n.length&&(t.c=null,t.a.set(Yn(t,e),z(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 Xn(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 $n,t,e),e.join("")}function $n(){}(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)zn(this,t)&&(e=G(e,this.a.get(Yn(this,t))));else{t=this.a.V();for(var n=0;n<t.length;n++)e=G(e,t[n])}return e},t.set=function(t,e){return Wn(this),this.c=null,zn(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 Jn={'"':'\\"',"\\":"\\\\","/":"\\/","\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=Jn[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),Jn[t]=e),e}),'"')}function er(){var t=_r();return Bt&&$t&&11==$t||/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||_r()).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=_r().toLowerCase(),r&&(e.target=r,nt(n,"crios/")&&(e.target="_blank")),gr(_r())==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(Ot,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(Pt(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||_r(),!("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}}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 br(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=_r()):"Worker"===r&&(r=gr(i=_r())+"-"+r),r+"/JsCore/"+t+"/"+e.join(",")}function _r(){return l.navigator&&l.navigator.userAgent||""}function wr(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=Or();if(t)return t.setItem(e,"1"),t.removeItem(e),!er()||!!l.indexedDB}catch(t){return fr()&&!!l.indexedDB}return!1}function Tr(){return(Ir()||"chrome-extension:"===Sr()||hr())&&!dr()&&Er()&&!fr()}function Ir(){return"http:"===Sr()||"https:"===Sr()}function Sr(){return l.location&&l.location.protocol||null}function Cr(t){return!ir(t=t||_r())&&gr(t)!=vr}function Nr(t){return void 0===t?null:Xn(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 Or(t){return t||Math.floor(1e9*Math.random()).toString()}function Rr(t){return"Safari"!=gr(t=t||_r())&&!t.toLowerCase().match(/iphone|ipad|ipod/)}function Pr(){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 Dr(t,e){if(e<t)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=_r(),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 wr("fireauth.oauthhelper",l)||wr("fireauth.iframe",l)}Dr.prototype.get=function(){var t=l.navigator;return!t||"boolean"!=typeof t.onLine||!Ir()&&"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 Vr={};Object.defineProperty(Vr,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(Vr,"abcd",{configurable:!0,enumerable:!0,value:2}),Fr=2==Vr.abcd}catch(t){Fr=!1}function qr(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)&&qr(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)qr(e,n,Hr(t[n]));return e}function Gr(t){var e=t&&(t[Xr]?"phone":null);if(!(e&&t&&t[Yr]))throw new w("internal-error","Internal assert: invalid MultiFactorInfo object");qr(this,"uid",t[Yr]),qr(this,"displayName",t[Kr]||null);var n=null;t[Qr]&&(n=new Date(t[Qr]).toUTCString()),qr(this,"enrollmentTime",n),qr(this,"factorId",e)}function zr(t){try{var e=new $r(t)}catch(t){e=null}return e}Gr.prototype.v=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};var Kr="displayName",Qr="enrolledAt",Yr="mfaEnrollmentId",Xr="phoneInfo";function $r(t){Gr.call(this,t),qr(this,"phoneNumber",t[Xr])}function Jr(t){var e={},n=t[ni],r=t[ii],i=t[oi];if(t=zr(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,qr(this,li,i),qr(this,hi,Hr(e))}e($r,Gr),$r.prototype.v=function(){var t=$r.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=Rn(t=Pn(t),pi)||null,n=Rn(t,di)||null,r=Rn(t,gi)||null;if(r=r&&bi[r]||null,!e||!n||!r)throw new w("argument-error",pi+", "+di+"and "+gi+" are required in a valid action code URL.");Br(this,{apiKey:e,operation:r,code:n,continueUrl:Rn(t,vi)||null,languageCode:Rn(t,yi)||null,tenantId:Rn(t,mi)||null})}var pi="apiKey",di="oobCode",vi="continueUrl",yi="languageCode",gi="mode",mi="tenantId",bi={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:Zr,signIn:ti,verifyAndChangeEmail:ei,verifyEmail:"VERIFY_EMAIL"};function _i(t){try{return new fi(t)}catch(t){return null}}function wi(t){var e=t[Ci];if(void 0===e)throw new w("missing-continue-uri");if("string"!=typeof e||"string"==typeof e&&!e.length)throw new w("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 w("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 w("argument-error",Ai+" property must be a non empty string when specified.");this.b=n||null}else{if(void 0!==e)throw new w("argument-error",ki+" property must be a non empty string when specified.");if(void 0!==r||void 0!==n)throw new w("missing-android-pkg-name")}}else if(void 0!==n)throw new w("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[Oi])&&e.length)this.f=e;else if(void 0!==e)throw new w("argument-error",Oi+" property must be a non empty string when specified.")}else if(void 0!==e)throw new w("argument-error",Si+" property must be a non null object when specified.");if(void 0!==(e=t[Ii])&&"boolean"!=typeof e)throw new w("argument-error",Ii+" property must be a boolean when specified.");if(this.c=!!e,void 0!==(t=t[Ti])&&("string"!=typeof t||"string"==typeof t&&!t.length))throw new w("argument-error",Ti+" property must be a non empty string when specified.");this.i=t||null}var Ei="android",Ti="dynamicLinkDomain",Ii="handleCodeInApp",Si="iOS",Ci="url",Ni="installApp",Ai="minimumVersion",ki="packageName",Oi="bundleId";function Ri(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 Pi=null;function Di(t){var e="";return function(r,t){function e(t){for(;i<r.length;){var e=r.charAt(i++),n=Pi[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return t}!function(){if(!Pi){Pi={};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===Pi[o]&&(Pi[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(Di(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:640,sa:600,ea:"apple.com",Va:[]}};function Vi(t){for(var e in ji)if(ji[e].ea==t)return ji[e];return null}function qi(t){var e={};e["facebook.com"]=zi,e["google.com"]=Qi,e["github.com"]=Ki,e["twitter.com"]=Yi;var n=t&&t[Wi];try{if(n)return e[n]?new e[n](t):new Gi(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),qr(this,"providerId",e),qr(this,"isNewUser",n)}function Gi(t){Hi.call(this,t),qr(this,"profile",Hr((t=kr(t.rawUserInfo||"{}"))||{}))}function zi(t){if(Gi.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function Ki(t){if(Gi.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");qr(this,"username",this.profile&&this.profile.login||null)}function Qi(t){if(Gi.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function Yi(t){if(Gi.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");qr(this,"username",t.screenName||null)}function Xi(t){var e=Pn(t),n=Rn(e,"link"),r=Rn(Pn(n),"link");return e=Rn(e,"deep_link_id"),Rn(Pn(e),"link")||e||r||n||t}function $i(t,e){if(!t&&!e)throw new w("internal-error","Internal assert: no raw session string available");if(t&&e)throw new w("internal-error","Internal assert: unable to determine the session type");this.a=t||null,this.b=e||null,this.type=this.a?Ji:Zi}e(Gi,Hi),e(zi,Gi),e(Ki,Gi),e(Qi,Gi),e(Yi,Gi);var Ji="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 w("user-mismatch");return t}throw new w("user-mismatch")}).o(function(t){throw t&&t.code&&t.code==I+"user-not-found"?new w("user-mismatch"):t})}function no(t,e){if(!e)throw new w("internal-error","failed to construct a credential");this.a=e,qr(this,"providerId",t),qr(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&&qr(this,"idToken",e.idToken),e.accessToken&&qr(this,"accessToken",e.accessToken),e.nonce&&!e.pendingToken&&qr(this,"nonce",e.nonce),e.pendingToken&&(this.a=e.pendingToken);else{if(!e.oauthToken||!e.oauthTokenSecret)throw new w("internal-error","failed to construct a credential");qr(this,"accessToken",e.oauthToken),qr(this,"secret",e.oauthTokenSecret)}qr(this,"providerId",t),qr(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=(Vi(t)||{}).Ha||null,this.kb=null}function co(t){if("string"!=typeof t||0!=t.indexOf("saml."))throw new w("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 w("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 w("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 bo(t,e){var n=t;if(v(n)||(n={oauthToken:t,oauthTokenSecret:e}),!n.oauthToken||!n.oauthTokenSecret)throw new w("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new oo("twitter.com",n,"twitter.com")}function _o(t,e,n){this.a=t,this.f=e,qr(this,"providerId","password"),qr(this,"signInMethod",n===Eo.EMAIL_LINK_SIGN_IN_METHOD?Eo.EMAIL_LINK_SIGN_IN_METHOD:Eo.EMAIL_PASSWORD_SIGN_IN_METHOD)}function wo(t){return t&&t.email&&t.password?new _o(t.email,t.password,t.signInMethod):null}function Eo(){Br(this,{providerId:"password",isOAuthProvider:!1})}function To(t,e){if(!(e=Io(e)))throw new w("argument-error","Invalid email link!");return new _o(t,e.code,Eo.EMAIL_LINK_SIGN_IN_METHOD)}function Io(t){return(t=_i(t=Xi(t)))&&t.operation===ti?t:null}function So(t){if(!(t.bb&&t.ab||t.Ja&&t.da))throw new w("internal-error");this.a=t,qr(this,"providerId","phone"),this.ea="phone",qr(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 w("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 w("missing-verification-id");if(!e)throw new w("missing-verification-code");return new So({bb:t,ab:e})}function Oo(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 bo(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 Ro(t){if(!t.isOAuthProvider)throw new w("invalid-oauth-provider")}function Po(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 w("invalid-auth-event");if(this.g&&this.a)throw new w("invalid-auth-event");if(this.g&&!this.f)throw new w("invalid-auth-event")}function Do(t){return(t=t||{}).type?new Po(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=[]}$i.prototype.Fa=function(){return this.a?Ee(this.a):Ee(this.b)},$i.prototype.v=function(){return this.type==Ji?{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},e(co,uo),e(ho,uo),ho.prototype.Aa=function(t){return B(this.a,t)||this.a.push(t),this},ho.prototype.Nb=function(){return z(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 w("argument-error","credential failed: must provide the ID token and/or the access token.");return new oo(this.providerId,n,this.providerId)},e(lo,ho),qr(lo,"PROVIDER_ID","facebook.com"),qr(lo,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),e(po,ho),qr(po,"PROVIDER_ID","github.com"),qr(po,"GITHUB_SIGN_IN_METHOD","github.com"),e(yo,ho),qr(yo,"PROVIDER_ID","google.com"),qr(yo,"GOOGLE_SIGN_IN_METHOD","google.com"),e(mo,uo),qr(mo,"PROVIDER_ID","twitter.com"),qr(mo,"TWITTER_SIGN_IN_METHOD","twitter.com"),_o.prototype.ia=function(t){return this.signInMethod==Eo.EMAIL_LINK_SIGN_IN_METHOD?Ka(t,_a,{email:this.a,oobCode:this.f}):Ka(t,Ba,{email:this.a,password:this.f})},_o.prototype.b=function(t,e){return this.signInMethod==Eo.EMAIL_LINK_SIGN_IN_METHOD?Ka(t,wa,{idToken:e,email:this.a,oobCode:this.f}):Ka(t,xa,{idToken:e,email:this.a,password:this.f})},_o.prototype.c=function(t,e){return eo(this.ia(t),e)},_o.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,Ka(t,Ha,n)},So.prototype.c=function(t,e){var n=No(this);return n.operation="REAUTH",eo(t=Ka(t,Ga,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(i,n){var o=this.a.b;return Ee(n.verify()).then(function(r){if("string"!=typeof r)throw new w("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(n.type){case"recaptcha":var t=v(i)?i.session:null,e=v(i)?i.phoneNumber:i;return(t&&t.type==Ji?t.Fa().then(function(t){return Ka(o,Ma,{idToken:t,phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:r}}).then(function(t){return t.phoneSessionInfo.sessionInfo})}):t&&t.type==Zi?t.Fa().then(function(t){return e=o,n={mfaPendingCredential:t,mfaEnrollmentId:i.multiFactorHint&&i.multiFactorHint.uid||i.multiFactorUid,phoneSignInInfo:{recaptchaToken:r}},Ka(e,Fa,n).then(function(t){return t.phoneResponseInfo.sessionInfo});var e,n}):Ka(o,Pa,{phoneNumber:e,recaptchaToken:r})).then(function(t){return"function"==typeof n.reset&&n.reset(),t},function(t){throw"function"==typeof n.reset&&n.reset(),t});default:throw new w("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}})},Br(Ao,{PROVIDER_ID:"phone"}),Br(Ao,{PHONE_SIGN_IN_METHOD:"phone"}),Po.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("-")},Po.prototype.S=function(){return this.h},Po.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=Pn(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",w.call(this,e,n)}function Uo(t,e,n){w.call(this,t,n),(t=e||{}).Gb&&qr(this,"email",t.Gb),t.da&&qr(this,"phoneNumber",t.da),t.credential&&qr(this,"credential",t.credential),t.Wb&&qr(this,"tenantId",t.Wb)}function jo(t){if(t.code){var e=t.code||"";0==e.indexOf(I)&&(e=e.substring(I.length));var n={credential:Oo(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 w(e,t.message||void 0);return new Uo(e,n,t.message)}return null}function Vo(){}function qo(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 Go(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseType=this.responseText=this.response="",this.status=-1,this.statusText="",this.a.onload=m(this.oc,this),this.a.onerror=m(this.Pb,this),this.a.onprogress=m(this.pc,this),this.a.ontimeout=m(this.tc,this)}function zo(t,e){t.readyState=e,t.onreadystatechange&&t.onreadystatechange()}function Ko(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}e(Fo,w),e(Uo,w),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()},Vo.prototype.c=null,e(Bo,Vo),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,e(Ho,Vo),Ho.prototype.a=function(){var t=new XMLHttpRequest;if("withCredentials"in t)return t;if("undefined"!=typeof XDomainRequest)return new Go;throw Error("Unsupported browser")},Ho.prototype.b=function(){return{}},(t=Go.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,zo(this,4)},t.Pb=function(){this.status=500,this.response=this.responseText="",zo(this,4)},t.tc=function(){this.Pb()},t.pc=function(){this.status=200,zo(this,1)},t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType},Ko.prototype.a=null,Ko.prototype.reset=function(t,e,n,r,i){delete this.a},Yo.prototype.toString=function(){return this.name};var Xo=new Yo("SEVERE",1e3),$o=new Yo("WARNING",900),Jo=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):(R("Root logger has no level set."),null)}(this).value)for(d(e)&&(e=e()),t=new Ko(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=Jo),!(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}e(os,Vo),os.prototype.a=function(){return new ss(this.f)},os.prototype.b=(ts={},function(){return ts}),e(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($o,"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($o,"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($o,"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")},e(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?qo(e.D):qo(Lo),e.a.onreadystatechange=m(e.Sb,e);try{is(e.b,Is(e,"Opening Xhr")),e.O=!0,e.a.open(n,String(t),!0),e.O=!1}catch(t){return is(e.b,Is(e,"Error opening Xhr: "+t.message)),void gs(e,t)}t=r||"";var o,s=new En(e.headers);i&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(h(t)||"string"==typeof t)U(t,e,void 0);else for(var n=wn(t),r=_n(t),i=r.length,o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}(i,function(t,e){s.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]}(s.X()),r=l.FormData&&t instanceof l.FormData,!B(ds,n)||i||r||s.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),s.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{ws(e),0<e.g&&(e.w=(o=e.a,Bt&&Zt(9)&&"number"==typeof o.timeout&&void 0!==o.ontimeout),is(e.b,Is(e,"Will abort after "+e.g+"ms if incomplete, xhr2 "+e.w)),e.w?(e.a.timeout=e.g,e.a.ontimeout=m(e.Ka,e)):e.s=mn(e.Ka,e.g,e)),is(e.b,Is(e,"Sending request")),e.i=!0,e.a.send(t),e.i=!1}catch(t){is(e.b,Is(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),_s(t)}function ms(t){t.N||(t.N=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function bs(e){if(e.c&&void 0!==u)if(e.B[1]&&4==Es(e)&&2==Ts(e))is(e.b,Is(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,Is(e,"Request complete")),e.c=!1;try{var t,n=Ts(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+" ["+Ts(e)+"]",ms(e)}}finally{_s(e)}}}function _s(e,t){if(e.a){ws(e);var n=e.a,r=e.B[0]?a:null;e.a=null,e.B=null,t||e.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){(e=e.b)&&e.log(Xo,"Problem encountered resetting onreadystatechange: "+t.message,void 0)}}}function ws(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 Ts(t){try{return 2<Es(t)?t.a.status:-1}catch(t){return-1}}function Is(t,e){return e+" ["+t.P+" "+t.l+" "+Ts(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,Os(t)}function Ns(t){if(t.a){if(!t.u)throw new Rs;t.u=!1}}function As(t,e,n,r){t.g.push([e,n,r]),t.a&&Os(t)}function ks(t){return q(t.g,function(t){return d(t[1])})}function Os(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=m(e.m,e,!0),t=m(e.m,e,!1),n instanceof Ss?(As(n,a,t),n.B=!0):n.then(a,t)),r&&(n=new Ds(n),xs[n.a]=n,e.h=n.a)}function Rs(){k.call(this)}function Ps(){k.call(this)}function Ds(t){this.a=l.setTimeout(m(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,Is(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},t.abort=function(){this.a&&this.c&&(is(this.b,Is(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),_s(this))},t.Ba=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),_s(this,!0)),ls.Za.Ba.call(this)},t.Sb=function(){this.wa||(this.O||this.i||this.f?bs(this):this.Hc())},t.Hc=function(){bs(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(Xo,"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 Ps,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 Ps?o.cancel():i(t)}),o.then(t,e,n)},Ss.prototype.$goog_Thenable=!0,e(Rs,k),Rs.prototype.message="Deferred has already fired",Rs.prototype.name="AlreadyCalledError",e(Ps,k),Ps.prototype.message="Deferred was canceled",Ps.prototype.name="CanceledError",Ds.prototype.c=function(){throw delete xs[this.a],this.b};var xs={};function Ls(t){var e,n,r,i,o,s=document,a=bt(t).toString(),u=ae(document,"SCRIPT"),c={Tb:u,Ka:void 0},h=new Ss(c);return e=window.setTimeout(function(){Fs(u,!0);var t=new Vs(js,"Timeout reached for loading script "+a);Ns(h),Cs(h,!1,t)},5e3),c.Ka=e,u.onload=u.onreadystatechange=function(){u.readyState&&"loaded"!=u.readyState&&"complete"!=u.readyState||(Fs(u,!1,e),Ns(h),Cs(h,!0,null))},u.onerror=function(){Fs(u,!0,e);var t=new Vs(Us,"Error while loading script "+a);Ns(h),Cs(h,!1,t)},lt(c={},{type:"text/javascript",charset:"UTF-8"}),ne(u,c),r=t,ft(n=u,"HTMLScriptElement"),n.src=bt(r),null===p&&(p=(r=(r=l.document).querySelector&&r.querySelector("script[nonce]"))&&(r=r.nonce||r.getAttribute("nonce"))&&f.test(r)?r:""),(r=p)&&n.setAttribute("nonce",r),((o=((i=s)||document).getElementsByTagName("HEAD"))&&0!=o.length?o[0]:i.documentElement).appendChild(u),h}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=a,t.onerror=a,t.onreadystatechange=a,e&&window.setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},0)}var Us=0,js=1;function Vs(t,e){var n="Jsloader error (code #"+t+")";e&&(n+=": "+e),k.call(this,n),this.code=t}function qs(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||Gs,this.g=ct(t.secureTokenHeaders||zs),this.h=t.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.l=t.identityPlatformEndpoint||"https://identitytoolkit.googleapis.com/v2/",this.i=t.firebaseTimeout||Ks,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 w("internal-error","The XMLHttpRequest compatibility library was not found.");this.f=void 0,fr()?this.f=new os(self):dr()?this.f=new qs(n):this.f=new Ho,this.b=null}e(Vs,k),e(qs,Vo),qs.prototype.a=function(){return new this.f},qs.prototype.b=function(){return{}};var Ws,Hs="idToken",Gs=new Dr(3e4,6e4),zs={"Content-Type":"application/x-www-form-urlencoded"},Ks=new Dr(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 Xs(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 $s(t,e,n,r,i,o,s){var a;(t=!((a=gr(a=_r())==yr&&(a=a.match(/\sChrome\/(\d+)/i))&&2==a.length?parseInt(a[1],10):null)&&a<30||Bt&&$t&&!(9<$t))||fr()?m(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(_t(Js,{onload:Zs})),function(){e(Error("CORS_UNSUPPORTED"))})}}(t,e)}),m(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 w("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 Js=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=Pn(e+n);On(a,"key",t.c),s&&On(a,"cb",_().toString());var u="GET"==r;if(u)for(var c in i)i.hasOwnProperty(c)&&On(a,c,i[c]);return new ve(function(e,n){$s(t,a.toString(),function(t){t?t.error?n(Ya(t,o||{})):e(t):n(new w("network-request-failed"))},r,u?void 0:Xn(Ar(i)),t.a,t.i.get())})}function ea(t){if("string"!=typeof(t=t.email)||!ur.test(t))throw new w("invalid-email")}function na(t){"email"in t&&ea(t)}function ra(t){if(!t[Hs]){if(t.mfaPendingCredential)throw new w("multi-factor-auth-required",null,ct(t));throw new w("internal-error")}}function ia(t){if(t.phoneNumber||t.temporaryProof){if(!t.phoneNumber||!t.temporaryProof)throw new w("internal-error")}else{if(!t.sessionInfo)throw new w("missing-verification-id");if(!t.code)throw new w("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 Ka(this,La,{})},Bs.prototype.xb=function(t,e){return Ka(this,Da,{idToken:t,email:e})},Bs.prototype.yb=function(t,e){return Ka(this,xa,{idToken:t,password:e})};var oa={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};function sa(t){if(!t.phoneVerificationInfo)throw new w("internal-error");if(!t.phoneVerificationInfo.sessionInfo)throw new w("missing-verification-id");if(!t.phoneVerificationInfo.code)throw new w("missing-verification-code")}function aa(t){if(!t.requestUri||!t.sessionId&&!t.postBody&&!t.pendingToken)throw new w("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&&(zn(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,Ka(t,Ua,e)}function la(t,e){return e.returnIdpCredential=!0,Ka(t,Va,e)}function fa(t,e){return e.returnIdpCredential=!0,e.autoCreate=!1,Ka(t,ja,e)}function pa(t){if(!t.oobCode)throw new w("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),Ka(this,Da,i)},t.rb=function(t,e){return lt(t={requestType:"PASSWORD_RESET",email:t},e),Ka(this,Aa,t)},t.sb=function(t,e){return lt(t={requestType:"EMAIL_SIGNIN",email:t},e),Ka(this,Sa,t)},t.qb=function(t,e){return lt(t={requestType:"VERIFY_EMAIL",idToken:t},e),Ka(this,Ca,t)},t.Ab=function(t,e,n){return lt(t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:t,newEmail:e},n),Ka(this,Na,t)},t.cb=function(t){return Ka(this,Wa,t)},t.jb=function(t,e){return Ka(this,Ra,{oobCode:t,newPassword:e})},t.Pa=function(t){return Ka(this,va,{oobCode:t})},t.fb=function(t){return Ka(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 w("internal-error")},C:!0},ya={endpoint:"signupNewUser",A:function(t){if(ea(t),!t.password)throw new w("weak-password")},G:ra,U:!0,C:!0},ga={endpoint:"createAuthUri",C:!0},ma={endpoint:"deleteAccount",M:["idToken"]},ba={endpoint:"setAccountInfo",M:["idToken","deleteProvider"],A:function(t){if("array"!=n(t.deleteProvider))throw new w("internal-error")}},_a={endpoint:"emailLinkSignin",M:["email","oobCode"],A:ea,G:ra,U:!0,C:!0},wa={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},Ta={endpoint:"accounts/mfaSignIn:finalize",M:["mfaPendingCredential","phoneVerificationInfo"],A:sa,G:ra,C:!0,La:!0},Ia={endpoint:"getAccountInfo"},Sa={endpoint:"getOobConfirmationCode",M:["requestType"],A:function(t){if("EMAIL_SIGNIN"!=t.requestType)throw new w("internal-error");ea(t)},Y:"email",C:!0},Ca={endpoint:"getOobConfirmationCode",M:["idToken","requestType"],A:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new w("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 w("internal-error")},Y:"email",C:!0},Aa={endpoint:"getOobConfirmationCode",M:["requestType"],A:function(t){if("PASSWORD_RESET"!=t.requestType)throw new w("internal-error");ea(t)},Y:"email",C:!0},ka={hb:!0,endpoint:"getProjectConfig",Rb:"GET"},Oa={hb:!0,endpoint:"getRecaptchaParam",Rb:"GET",G:function(t){if(!t.recaptchaSiteKey)throw new w("internal-error")}},Ra={endpoint:"resetPassword",A:pa,Y:"email",C:!0},Pa={endpoint:"sendVerificationCode",M:["phoneNumber","recaptchaToken"],Y:"sessionInfo",C:!0},Da={endpoint:"setAccountInfo",M:["idToken"],A:na,U:!0},xa={endpoint:"setAccountInfo",M:["idToken"],A:function(t){if(na(t),!t.password)throw new w("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 w("internal-error");if(!t.phoneEnrollmentInfo.phoneNumber)throw new w("missing-phone-number");if(!t.phoneEnrollmentInfo.recaptchaToken)throw new w("missing-app-credential")},G:function(t){if(!t.phoneSessionInfo||!t.phoneSessionInfo.sessionInfo)throw new w("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 w("missing-app-credential")},G:function(t){if(!t.phoneResponseInfo||!t.phoneResponseInfo.sessionInfo)throw new w("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 w("user-not-found");if(t.errorMessage)throw Qa(t.errorMessage);ra(t)},U:!0,C:!0},Va={endpoint:"verifyAssertion",A:function(t){if(aa(t),!t.idToken)throw new w("internal-error")},Wa:ua,G:ca,U:!0},qa={endpoint:"verifyCustomToken",A:function(t){if(!t.token)throw new w("invalid-custom-token")},G:ra,U:!0,C:!0},Ba={endpoint:"verifyPassword",A:function(t){if(ea(t),!t.password)throw new w("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 w("internal-error");ia(t)},G:function(t){if(t.temporaryProof)throw t.code="credential-already-in-use",jo(t);ra(t)}},Ga={Eb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:ia,G:ra,C:!0},za={endpoint:"accounts/mfaEnrollment:withdraw",M:["idToken","mfaEnrollmentId"],G:function(t){if(!!t[Hs]^!!t.refreshToken)throw new w("internal-error")},C:!0,La:!0};function Ka(t,e,n){if(!function(t,e){if(!e||!e.length)return 1;if(t){for(var n=0;n<e.length;n++){var r=t[e[n]];if(null==r||""===r)return}return 1}}(n,e.M))return Te(new w("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 w("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 w(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 w(r[i],e);return!e&&t&&(e=Nr(t)),new w("internal-error",e)}function Xa(t){var o;this.b=t,this.a=null,this.nb=(o=this,(tu=tu||new ve(function(t,e){function n(){Pr(),wr("gapi.load")("gapi.iframes",{callback:t,ontimeout:function(){Pr(),e(Error("Network Error"))},timeout:Ja.get()})}if(wr("gapi.iframes.Iframe"))t();else if(wr("gapi.load"))n();else{var r="__iframefcb"+Math.floor(1e6*Math.random()).toString();l[r]=function(){wr("gapi.load")?n():e(Error("Network Error"))},Ee(Ls(r=_t($a,{onload:r}))).o(function(){e(Error("Network Error"))})}}).o(function(t){throw tu=null,t})).then(function(){return new ve(function(r,i){wr("gapi.iframes.getContext")().open({where:document.body,url:o.b,messageHandlersFilter:wr("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"))})})})}))}var $a=new pt(yt,"https://apis.google.com/js/api.js?onload=%{onload}"),Ja=new Dr(3e4,6e4),Za=new Dr(5e3,15e3),tu=null;function eu(t,e,n){this.i=t,this.g=e,this.h=n,this.f=null,this.a=Dn(this.i,"/__/auth/iframe"),On(this.a,"apiKey",this.g),On(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 Ka(t,ka,{}).then(function(t){return t.authorizedDomains||[]}).then(function(t){t:{var e=Pn(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://")?Pn(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=z(n||[]),i.s=r.toString()}i.i=new Xa(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,wr("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}(r.i,function(t){var e={};if(t&&t.authEvent){var n=!1;for(t=Do(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?br(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 w("internal-error","The React Native compatibility library was not found.");this.type="asyncStorage"}function hu(t){this.b=t,this.a={},this.f=m(this.c,this)}eu.prototype.toString=function(){return this.f?On(this.a,"v",this.f):Gn(this.a.a,"v"),this.b?On(this.a,"eid",this.b):Gn(this.a.a,"eid"),this.c.length?On(this.a,"fw",this.c.join(",")):Gn(this.a.a,"fw"),this.a.toString()},nu.prototype.ub=function(t){return this.h=t,this},nu.prototype.toString=function(){var t=Dn(this.s,"/__/auth/handler");if(On(t,"apiKey",this.m),On(t,"appName",this.c),On(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,On(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)||On(t,"customParameters",Nr(n))}if("function"==typeof this.a.Nb&&((e=this.a.Nb()).length&&On(t,"scopes",e.join(","))),this.l?On(t,"redirectUrl",this.l):Gn(t.a,"redirectUrl"),this.g?On(t,"eventId",this.g):Gn(t.a,"eventId"),this.i?On(t,"v",this.i):Gn(t.a,"v"),this.b)for(var s in this.b)this.b.hasOwnProperty(s)&&!Rn(t,s)&&On(t,s,this.b[s]);return this.h?On(t,"tid",this.h):Gn(t.a,"tid"),this.f?On(t,"eid",this.f):Gn(t.a,"eid"),(s=ru(this.c)).length&&On(t,"fw",s.join(",")),t.toString()},(t=iu.prototype).Lb=function(e,n,t){var r=new w("popup-closed-by-user"),i=new w("web-storage-unsupported"),o=this,s=!1;return this.ka().then(function(){var t,r;r={type:"webStorageSupport"},su(t=o).then(function(){return e=t.i,n=r,e.nb.then(function(){return new ve(function(t){e.a.send(n.type,n,t,wr("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})});var e,n}).then(function(t){if(t&&t.length&&void 0!==t[0].webStorageSupport)return t[0].webStorageSupport;throw Error()}).then(function(t){t||(e&&or(e),n(i),s=!0)})}).o(function(){}).then(function(){if(!s)return n=e,new ve(function(e){return function t(){bn(2e3).then(function(){if(n&&!n.closed)return t();e()})}()});var n}).then(function(){if(!s)return bn(t).then(function(){n(r)})})},t.Ub=function(){var t=_r();return!Cr(t)&&!Rr(t)},t.Qb=function(){return!1},t.Jb=function(e,t,n,r,i,o,s,a){if(!e)return Te(new w("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(){Ro(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(){Ro(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 w("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 Te(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(!wu())throw new w("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 t,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"])})):((t=l.navigator)&&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 bu(i){return new ve(function(e,n){var t=i.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){var r;(t=t.target.result).objectStoreNames.contains("firebaseLocalStorage")?e(t):(r=i,new ve(function(t,e){var n=r.u.deleteDatabase("firebaseLocalStorageDb");n.onsuccess=function(){t()},n.onerror=function(t){e(Error(t.target.error))}}).then(function(){return bu(i)}).then(function(t){e(t)}).o(function(t){n(t)}))}})}function _u(t){return t.m||(t.m=bu(t)),t.m}function wu(){try{return l.indexedDB}catch(t){return}}function Eu(t){return t.objectStore("firebaseLocalStorage")}function Tu(t,e){return t.transaction(["firebaseLocalStorage"],e?"readwrite":"readonly")}function Iu(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&&((n=l.navigator)&&n.serviceWorker&&n.serviceWorker.controller||null)===t.h?yu(t.g,"keyChanged",{key:e},t.s).then(function(){}).o(function(){}):Ee();var n}function Cu(r){return _u(r).then(function(t){var i=Eu(Tu(t,!1));return i.getAll?Iu(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]?"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(wu()){var e=Or(),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 Ou(){if(!function(){var t="Node"==pr();if(!(t=Ru()||t&&Kl.INTERNAL.node&&Kl.INTERNAL.node.localStorage))return;try{return t.setItem("__sak","1"),t.removeItem("__sak"),1}catch(t){return}}()){if("Node"==pr())throw new w("internal-error","The LocalStorage compatibility library was not found.");throw new w("web-storage-unsupported")}this.a=Ru()||Kl.INTERNAL.node.localStorage,this.type="localStorage"}function Ru(){try{var t=l.localStorage,e=Or();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Pu(){this.type="nullStorage"}function Du(){if(!function(){var t="Node"==pr();if(!(t=xu()||t&&Kl.INTERNAL.node&&Kl.INTERNAL.node.sessionStorage))return;try{return t.setItem("__sak","1"),t.removeItem("__sak"),1}catch(t){return}}()){if("Node"==pr())throw new w("internal-error","The SessionStorage compatibility library was not found.");throw new w("web-storage-unsupported")}this.a=xu()||Kl.INTERNAL.node.sessionStorage,this.type="sessionStorage"}function xu(){try{var t=l.sessionStorage,e=Or();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=Vu,t.Worker=qu,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 _u(this).then(function(t){return Iu((t=Eu(Tu(i=t,!0))).get(n))}).then(function(t){var e=Eu(Tu(i,!0));return t?(t.value=r,Iu(e.put(t))):(s.b++,o=!0,(t={}).fbase_key=n,t.value=r,Iu(e.add(t)))}).then(function(){return s.c[n]=r,Su(s,n)}).ma(function(){o&&s.b--})},t.get=function(e){return _u(this).then(function(t){return Iu(Eu(Tu(t,!1)).get(e))}).then(function(t){return t&&t.value})},t.T=function(e){var n=!1,r=this;return _u(this).then(function(t){return n=!0,r.b++,Iu(Eu(Tu(t,!0)).delete(e))}).then(function(){return delete r.c[e],Su(r,e)}).ma(function(){n&&r.b--})},t.ba=function(t){var n;0==this.a.length&&(Nu(n=this),function e(){n.f=setTimeout(function(){n.i=Cu(n).then(function(e){0<e.length&&U(n.a,function(t){t(e)})}).then(function(){e()}).o(function(t){"STOP_EVENT"!=t.message&&e()})},800)}()),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=Ou.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=Pu.prototype).get=function(){return Ee(null)},t.set=function(){return Ee()},t.T=function(){return Ee()},t.ba=function(){},t.ha=function(){},(t=Du.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:Ou,$a:Du},ju={F:Ou,$a:Du},Vu={F:cu,$a:Pu},qu={F:Ou,$a:Pu},Bu={od:"local",NONE:"none",qd:"session"};function Wu(){var t=!(Rr(_r())||!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=m(this.Vb,this),this.b={}}function Hu(){return Fu=Fu||new Wu}function Gu(t,e){switch(e){case"session":return t.i;case"none":return t.u;default:return t.g}}function zu(t,e){return"firebase:"+t.name+(e?":"+e:"")}function Ku(t,e,n){return n=zu(e,n),"local"==e.F&&(t.b[n]=null),Gu(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 Gu(this,t.F).get(zu(t,e))},t.set=function(e,t,n){var r=zu(e,n),i=this,o=Gu(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){var r;t=zu(t,e),this.l&&(this.b[t]=l.localStorage.getItem(t)),ut(this.a)&&(Gu(this,"local").ba(this.f),this.h||(er()||!Mr())&&l.indexedDB||!this.l||(Qu(r=this),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.a[t]||(this.a[t]=[]),this.a[t].push(n)},t.removeListener=function(t,e,n){t=zu(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)&&(Gu(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?Gu(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&&$t&&10==$t&&l.localStorage.getItem(e)!==t.a.newValue&&t.a.newValue!==t.a.oldValue?setTimeout(n,10):n()}}else U(t,m(this.ib,this))},t.ib=function(t){this.a[t]&&U(this.a[t],function(t){t()})};var Xu,$u={name:"authEvent",F:"local"};function Ju(){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===Xu&&(Xu=l.Int32Array?new Int32Array(ac):ac),this.reset()}e(Zu,function(){this.b=-1});for(var tc=64,ec=tc-1,nc=[],rc=0;rc<ec;rc++)nc[rc]=0;var ic=G(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|Xu[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(!h(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):z(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)}e(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 Ju,this.g=new Yu(this.h),this.f=null,this.b=[],this.a=this.c=null}function lc(t){return new w("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 V(t,function(t){return 1<(t=t.toString(16)).length?t:"0"+t}).join("")}function pc(t,e){for(var n=0;n<t.b.length;n++)try{t.b[n](e)}catch(t){}}function dc(a){return a.f||(a.f=a.ka().then(function(){return new ve(function(n){function e(r){t=!0,s&&s.cancel(),vc(i).then(function(t){var e=o;if(t&&r&&r.url){var n=null;-1!=(e=Xi(r.url)).indexOf("/__/auth/callback")&&(n=(n="object"==typeof(n=kr(Rn(n=Pn(e),"firebaseError")||null))?E(n):null)?new Po(t.c,t.b,null,null,n,null,t.S()):new Po(t.c,t.b,e,t.f,null,null,t.S())),e=n||o}pc(i,e)})}var i,o,t,s,r;a.Ca(function t(e){return n(e),a.Qa(t),!1}),i=a,o=new Po("unknown",null,null,null,new w("no-auth-event")),t=!1,s=bn(500).then(function(){return vc(i).then(function(){t||pc(i,o)})}),r=l.handleOpenURL,l.handleOpenURL=function(t){if(0==t.toLowerCase().indexOf(wr("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=wr("universalLinks.subscribe",l))&&t(null,n.b))}(e)})})),a.f}function vc(e){var t,n=null;return(t=e.g).b.get($u,t.a).then(function(t){return Do(t)}).then(function(t){return n=t,Ku((t=e.g).b,$u,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)})}):Te(Error("Cordova must run in an Android or iOS file scheme."))).then(function(){if("function"!=typeof wr("universalLinks.subscribe",l))throw lc("cordova-universal-links-plugin-fix is not installed");if(void 0===wr("BuildInfo.packageName",l))throw lc("cordova-plugin-buildinfo is not installed");if("function"!=typeof wr("cordova.plugins.browsertab.openUrl",l))throw lc("cordova-plugin-browsertab is not installed");if("function"!=typeof wr("cordova.InAppBrowser.open",l))throw lc("cordova-plugin-inappbrowser is not installed")},function(){throw new w("cordova-not-ready")})},t.Lb=function(t,e){return e(new w("operation-not-supported-in-this-environment")),Ee()},t.Jb=function(){return Te(new w("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 Te(new w("redirect-operation-pending"));var i=this,o=l.document,s=null,a=null,u=null,c=null;return this.c=Ee().then(function(){return Ro(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 Po(t,r,null,o,new w("no-auth-event"),null,i),a=wr("BuildInfo.packageName",l);if("string"!=typeof a)throw new w("invalid-cordova-configuration");var u=wr("BuildInfo.displayName",l),c={};if(_r().toLowerCase().match(/iphone|ipad|ipod/))c.ibi=a;else{if(!_r().toLowerCase().match(/android/))return Te(new w("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($u,s.v(),t)}).then(function(){var t=wr("cordova.plugins.browsertab.isAvailable",l);if("function"!=typeof t)throw new w("invalid-cordova-configuration");var e=null;t(function(t){if(t){if("function"!=typeof(e=wr("cordova.plugins.browsertab.openUrl",l)))throw new w("invalid-cordova-configuration");e(h)}else{if("function"!=typeof(e=wr("cordova.InAppBrowser.open",l)))throw new w("invalid-cordova-configuration");t=_r(),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=wr("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||bn(2e3).then(function(){t(new w("redirect-cancelled-by-user"))})},c=function(){xr()&&u()},o.addEventListener("resume",u,!1),_r().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 Po("unknown",null,null,null,new w("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 Ku(t.b,gc,t.a)}function bc(t,e,n){this.i={},this.w=0,this.D=t,this.u=e,this.m=n,this.h=[],this.f=!1,this.l=m(this.s,this),this.b=new Dc,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=_c(this.D,this.u,this.m,T)}function _c(t,e,n,r){var i=Kl.SDK_VERSION||null;return new(hr()?hc:iu)(t,e,n,i,r)}function wc(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()&&wc(n).o(function(t){var e=new Po("unknown",null,null,null,new w("operation-not-supported-in-this-environment"));Ac(t)&&n.s(e)}),n.a.Qb()||xc(n.b)}function Tc(n,t){var e;B(n.h,t)||n.h.push(t),n.f||(e=n.g).b.get(gc,e.a).then(function(t){return"pending"==t}).then(function(t){t?mc(n.g).then(function(){wc(n).o(function(t){var e=new Po("unknown",null,null,null,new w("operation-not-supported-in-this-environment"));Ac(t)&&n.s(e)})}):Ec(n)}).o(function(){Ec(n)})}function Ic(t,e){H(t.h,function(t){return t==e})}bc.prototype.reset=function(){this.f=!1,this.a.Qa(this.l),this.a=_c(this.D,this.u,this.m),this.i={}},bc.prototype.s=function(t){if(!t)throw new w("invalid-auth-event");if(6e5<=_()-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=_())),e=!0;break}}return xc(this.b),e};var Sc=new Dr(2e3,1e4),Cc=new Dr(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,s;return(s=e.g).b.set(gc,"pending",s.a).then(function(){return e.a.Kb(t,n,r,i).o(function(t){if(Ac(t))throw new w("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 Oc(t,e,n,r,i){return t.a.Lb(r,function(t){e.la(n,null,t,i)},Sc.get())}bc.prototype.pa=function(){return this.b.pa()};var Rc={};function Pc(t,e,n){var r=e+":"+n;return Rc[r]||(Rc[r]=new bc(t,e,n)),Rc[r]}function Dc(){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 Te(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 Vc(t,e){this.a=e,qr(this,"verificationId",t)}function qc(t,e,n,r){return new Ao(t).cb(e,n).then(function(t){return new Vc(t,r)})}function Bc(t){var e=Mi(t);if(!(e&&e.exp&&e.auth_time&&e.iat))throw new w("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[Gc];if(!r)throw new w("argument-error","Internal assert: Invalid MultiFactorResolver");this.a=t,this.f=ct(e),this.g=n,this.c=new $i(null,r),this.b=[];var i=this;U(e[Hc]||[],function(t){(t=zr(t))&&i.b.push(t)}),qr(this,"auth",this.a),qr(this,"session",this.c),qr(this,"hints",this.b)}Dc.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},Dc.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):Te(new w("invalid-auth-event")):(Fc(this,!1,null,null),Ee())}else Te(new w("invalid-auth-event"))},Dc.prototype.pa=function(){var i=this;return new ve(function(t,e){var n,r;i.b?i.b().then(t,e):(i.f.push(t),i.c.push(e),n=i,r=new w("timeout"),n.a&&n.a.cancel(),n.a=bn(Cc.get()).then(function(){n.b||(n.g=!0,Fc(n,!0,null,r))}))})},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)?(o=e,s=(i=t).b,a=i.c,o.Da(a,s)(i.g,i.f,i.S(),i.i).then(function(t){o.la(a,t,null,s)}).o(function(t){o.la(a,null,t,s)})):Te(new w("invalid-auth-event"))}else Te(new w("invalid-auth-event"));var i,o,s,a},Vc.prototype.confirm=function(t){return t=ko(this.verificationId,t),this.a(t)};var Hc="mfaInfo",Gc="mfaPendingCredential";function zc(t,e,n,r){w.call(this,"multi-factor-auth-required",r,e),this.b=new Wc(t,e,n),qr(this,"resolver",this.b)}function Kc(t,e,n){if(t&&v(t.serverResponse)&&"auth/multi-factor-auth-required"===t.code)try{return new zc(e,t.serverResponse,n,t.message)}catch(t){}return null}function Qc(){}function Yc(t){qr(this,"factorId",t.ea),this.a=t}function Xc(t){if(Yc.call(this,t),this.a.ea!=Ao.PROVIDER_ID)throw new w("argument-error","firebase.auth.PhoneMultiFactorAssertion requires a valid firebase.auth.PhoneAuthCredential")}function $c(t,e){for(var n in We.call(this,t),e)this[n]=e[n]}function Jc(t,e){this.a=t,this.b=[],this.c=m(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[Kr]=t.displayName),t.enrollmentTime&&(n[Qr]=new Date(t.enrollmentTime).toISOString()),t.phoneNumber&&(n[Xr]=t.phoneNumber);try{e=new $r(n)}catch(t){}t=e}else t=null;t&&r.push(t)}),Zc(this,r)}function Zc(t,e){t.b=e,qr(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 r=e.c,i=t,new ve(function(e,n){"refresh_token"==i.grant_type&&i.refresh_token||"authorization_code"==i.grant_type&&i.code?$s(r,r.u+"?key="+encodeURIComponent(r.c),function(t){t?t.error?n(Ya(t)):t.access_token&&t.refresh_token?e(t):n(new w("internal-error")):n(new w("network-request-failed"))},"POST",Hn(i).toString(),r.g,r.m.get()):n(new w("internal-error"))}).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});var r,i}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){var r;this.N=[],this.l=t.apiKey,this.m=t.appName,this.s=t.authDomain||null,t=Kl.SDK_VERSION?br(Kl.SDK_VERSION):null,this.a=new Bs(this.l,N(T),t),this.b=new nh(this.a),vh(this,e[Hs]),ih(this.b,e),qr(this,"refreshToken",this.b.a),mh(this,n||{}),dn.call(this),this.P=!1,this.s&&Tr()&&(this.i=Pc(this.s,this.l,this.m)),this.R=[],this.h=null,this.B=(r=this,new th(function(){return r.I(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var t=rh(r.b)-_()-3e5;return 0<t?t:0})),this.Z=m(this.Ma,this);var i=this;this.oa=null,this.za=function(t){i.va(t.g)},this.aa=null,this.W=[],this.ya=function(t){hh(i,t.c)},this.$=null,this.O=new Jc(this,n),qr(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,Xs(t.a,Kl.SDK_VERSION?br(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 w("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,qr(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,Tc(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 bh(){}function _h(t){return Ee().then(function(){if(t.D)throw new w("app-deleted")})}function wh(t){return V(t.providerData,function(t){return t.providerId})}function Eh(t,e){e&&(Th(t,e.providerId),t.providerData.push(e))}function Th(t,e){H(t.providerData,function(t){return t.providerId==e})}function Ih(t,e,n){("uid"!=e||n)&&t.hasOwnProperty(e)&&qr(t,e,n)}function Sh(e,t){var n,r,i;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?qr(e,"metadata",new sh((i=t.metadata).a,i.b)):qr(e,"metadata",new sh),U(t.providerData,function(t){Eh(e,t)}),n=e.b,r=t.b,n.b=r.b,n.a=r.a,qr(e,"refreshToken",e.b.a),Zc(e.O,t.O.b))}function Ch(i){return i.I().then(function(t){var e,n,r=i.isAnonymous;return n=t,Ka((e=i).a,Ia,{idToken:n}).then(m(e.Ic,e)).then(function(){return r||Ih(i,"isAnonymous",!1),t})})}function Nh(t,e){e[Hs]&&t.xa!=e[Hs]&&(ih(t.b,e),t.dispatchEvent(new $c("tokenChanged")),vh(t,e[Hs]),Ih(t,"refreshToken",t.b.a))}function Ah(t,e){return Ch(t).then(function(){if(B(wh(t),e))return yh(t).then(function(){throw new w("provider-already-linked")})})}function kh(t,e,n){return Wr({user:t,credential:Oo(e),additionalUserInfo:e=qi(e),operationType:n})}function Oh(t,e){return Nh(t,e),t.reload().then(function(){return t})}function Rh(n,r,t,e,i){if(!Tr())return Te(new w("operation-not-supported-in-this-environment"));if(n.h&&!i)return Te(n.h);var o=Vi(t.providerId),s=Or(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(Dh(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 w("cancelled-popup-request"),n.g||null),n.f=t,n.w=e,n.g=s,n.c=Oc(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 Ph(e,t,n,r,i){if(!Tr())return Te(new w("operation-not-supported-in-this-environment"));if(e.h&&!i)return Te(e.h);var o=null,s=Or(e.uid+":::");return r=r().then(function(){if(Dh(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 Dh(t){if(!t.i||!t.P){if(t.i&&!t.P)throw new w("internal-error");throw new w("auth-domain-config-required")}}function xh(n,t,e){var r,i,o,s=(i=t,o=e,(r=n).h&&!o?(i.cancel(),Te(r.h)):i.o(function(t){throw!t||"auth/user-disabled"!=t.code&&"auth/user-token-expired"!=t.code||(r.h||r.dispatchEvent(new $c("userInvalidated")),r.h=t),t}));return n.N.push(s),s.ma(function(){W(n.N,s)}),s.o(function(t){var e=null;throw t&&"auth/multi-factor-auth-required"===t.code&&(e=Kc(t.v(),fh(n),m(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[Gc],lt(e,t),n.g(e)})},e(zc,w),Qc.prototype.ob=function(t,e,n){return e.type==Ji?(o=this,s=t,a=n,e.Fa().then(function(t){return t={idToken:t},void 0!==a&&(t.displayName=a),lt(t,{phoneVerificationInfo:No(o.a)}),Ka(s,Ea,t)})):(r=this,i=t,e.Fa().then(function(t){return lt(t={mfaPendingCredential:t},{phoneVerificationInfo:No(r.a)}),Ka(i,Ta,t)}));var r,i,o,s,a},e(Yc,Qc),e(Xc,Yc),e($c,We),(t=Jc.prototype).wc=function(t){var e,n;Zc(this,(e=t.ed,n=[],U(e.mfaInfo||[],function(t){(t=zr(t))&&n.push(t)}),n))},t.Ob=function(){return this.a.I().then(function(t){return new $i(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 Ka(e,za,{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:V(this.b,function(t){return t.v()})}}},th.prototype.start=function(){this.a=this.c,function e(n,t){n.stop();n.b=bn(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?Te(new w("user-token-expired")):t||!this.b||_()>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}},e(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 z(this.W)},uh.prototype.Ma=function(){this.B.b&&(this.B.stop(),this.B.start())},qr(uh.prototype,"providerId","firebase"),(t=uh.prototype).reload=function(){var t=this;return xh(this,_h(this).then(function(){return Ch(t).then(function(){return yh(t)}).then(bh)}))},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,_h(this).then(function(){return e.b.getToken(t)}).then(function(t){if(!t)throw new w("internal-error");return t.accessToken!=e.xa&&(vh(e,t.accessToken),e.dispatchEvent(new $c("tokenChanged"))),Ih(e,"refreshToken",t.refreshToken),t.accessToken}))},t.Ic=function(t){if(!(t=t.users)||!t.length)throw new w("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=(r=(r=t).providerUserInfo)&&r.length?V(r,function(t){return new ah(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[],n=0;n<e.length;n++)Eh(this,e[n]);var r;Ih(this,"isAnonymous",!(this.email&&t.passwordHash||this.providerData&&this.providerData.length)),this.dispatchEvent(new $c("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"),Oh(n,t)}).then(function(){return r}))},t.Bc=function(t,e){var n=this;return xh(this,Ah(this,"phone").then(function(){return qc(fh(n),t,e,m(n.mb,n))}))},t.Kc=function(t,e){var n=this;return xh(this,Ee().then(function(){return qc(fh(n),t,e,m(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 _h(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),Ih(n,"displayName",t.displayName||null),Ih(n,"photoURL",t.photoUrl||null),U(n.providerData,function(t){"password"===t.providerId&&(qr(t,"displayName",n.displayName),qr(t,"photoURL",n.photoURL))}),yh(n)}).then(bh))},t.ad=function(e){var n=this;return xh(this,Ch(this).then(function(t){return B(wh(n),e)?Ka(n.a,ba,{idToken:t,deleteProvider:[e]}).then(function(t){var e={};return U(t.providerUserInfo||[],function(t){e[t.providerId]=!0}),U(wh(n),function(t){e[t]||Th(n,t)}),e[Ao.PROVIDER_ID]||qr(n,"phoneNumber",null),yh(n)}):yh(n).then(function(){throw new w("no-such-provider")})}))},t.delete=function(){var e=this;return xh(this,this.I().then(function(t){return Ka(e.a,ma,{idToken:t})}).then(function(){e.dispatchEvent(new $c("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),qr(e,"refreshToken",null),e.i&&Ic(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)?m(this.Hb,this):"reauthViaPopup"==t&&e==(this.g||null)?m(this.Ib,this):"linkViaRedirect"==t&&(this.fa||null)==e?m(this.Hb,this):"reauthViaRedirect"==t&&(this.fa||null)==e?m(this.Ib,this):null},t.Cc=function(t){var e=this;return Rh(this,"linkViaPopup",t,function(){return Ah(e,t.providerId).then(function(){return yh(e)})},!1)},t.Lc=function(t){return Rh(this,"reauthViaPopup",t,function(){return Ee()},!0)},t.Dc=function(t){var e=this;return Ph(this,"linkViaRedirect",t,function(){return Ah(e,t.providerId)},!1)},t.Mc=function(t){return Ph(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"),Oh(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)?{}:Ri(new wi(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)?{}:Ri(new wi(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 Ku(t.b,Fh,t.a)}function jh(t){var e,n,r,i;this.a=t,this.b=Hu(),this.c=null,this.f=(n=Bh("local"),r=Bh("session"),i=Bh("none"),function(n,r,i){var o=zu(r,i),s=Gu(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=this).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(qh,e.a).then(function(t){return t?Bh(t):n})})})}).then(function(t){return e.c=t,Vh(e,t.F)}).o(function(){e.c||(e.c=n)})),this.b.addListener(Bh("local"),this.a,m(this.g,this))}function Vh(t,e){var n,a,r=[];for(n in Bu)Bu[n]!==e&&r.push(Ku(t.b,Bh(Bu[n]),t.a));return r.push(Ku(t.b,qh,t.a)),a=r,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++)Ie(a[s],b(t,s),o);else n(i)})}jh.prototype.g=function(){var e=this,n=Bh("local");zh(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 Vh(e,"local").then(function(){e.c=n})})})};var qh={name:"persistence",F:"session"};function Bh(t){return{name:"authUser",F:t}}function Wh(t,e){return zh(t,function(){return t.b.set(t.c,e.v(),t.a)})}function Hh(t){return zh(t,function(){return Ku(t.b,t.c,t.a)})}function Gh(t,e){return zh(t,function(){return t.b.get(t.c,t.a).then(function(t){return t&&e&&(t.authDomain=e),Lh(t||{})})})}function zh(t,e){return t.f=t.f.then(e,e),t.f}function Kh(t){if(this.l=!1,qr(this,"settings",new jc),qr(this,"app",t),!el(this).options||!el(this).options.apiKey)throw new w("invalid-api-key");var n,e,r,i,o,s,a,u;t=Kl.SDK_VERSION?br(Kl.SDK_VERSION):null,this.b=new Bs(el(this).options&&el(this).options.apiKey,N(T),t),this.P=[],this.m=[],this.O=[],this.$b=Kl.INTERNAL.createSubscribe(m(this.xc,this)),this.W=void 0,this.ac=Kl.INTERNAL.createSubscribe(m(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,(e=el(n=this).options.authDomain,r=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 Gh(n.i,e)}).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)}),ol(n,r))),this.h=ol(this,(i=this).Z.then(function(){return $h(i)}).o(function(){}).then(function(){if(!i.l)return i.oa()}).o(function(){}).then(function(){if(!i.l){i.aa=!0;var t=i.i;t.b.addListener(Bh("local"),t.a,i.oa)}})),this.aa=!1,this.oa=m(this.Xc,this),this.Ma=m(this.ca,this),this.xa=m(this.jc,this),this.ya=m(this.uc,this),this.za=m(this.vc,this),this.a=null,s=el(o=this).options.authDomain,a=el(o).options.apiKey,s&&Tr()&&(o.Zb=o.Z.then(function(){if(!o.l){if(o.a=Pc(s,a,el(o).name),Tc(o.a,o),nl(o)&&gh(nl(o)),o.D){gh(o.D);var t=o.D;t.va(o.ja()),ch(t,o),hh(t=o.D,o.N),lh(t,o),o.D=null}return o.a}})),this.INTERNAL={},this.INTERNAL.delete=m(this.delete,this),this.INTERNAL.logFramework=m(this.Ec,this),this.s=0,dn.call(this),u=this,Object.defineProperty(u,"lc",{get:function(){return this.ja()},set:function(t){this.va(t)},enumerable:!1}),u.$=null,Object.defineProperty(u,"ti",{get:function(){return this.S()},set:function(t){this.ub(t)},enumerable:!1}),u.R=null,this.N=[]}function Qh(t){We.call(this,"languageCodeChanged"),this.g=t}function Yh(t){We.call(this,"frameworkChanged"),this.c=t}function Xh(t){return t.Zb||Te(new w("auth-domain-config-required"))}function $h(t){if(!Tr())return Te(new w("operation-not-supported-in-this-environment"));var e=Xh(t).then(function(){return t.a.pa()}).then(function(t){return t?Wr(t):null});return ol(t,e)}function Jh(o,s){var a={};return a.apiKey=el(o).options.apiKey,a.authDomain=el(o).options.authDomain,a.appName=el(o).name,o.Z.then(function(){return t=a,e=s,n=o.B,r=o.Ea(),i=new uh(t,e),n&&(i.ga=n),r&&hh(i,r),i.reload().then(function(){return i});var t,e,n,r,i}).then(function(t){return nl(o)&&t.uid==nl(o).uid?Sh(nl(o),t):(Zh(o,t),gh(t)),o.ca(t)}).then(function(){il(o)})}function Zh(t,e){var n,r;nl(t)&&(n=nl(t),r=t.Ma,H(n.R,function(t){return t==r}),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)),qr(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=Oo(t),r=qi(t),Jh(n,t)},function(t){var e=null;throw t&&"auth/multi-factor-auth-required"===t.code&&(e=Kc(t.v(),n,m(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 w("invalid-persistence-type"),n=new w("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;case"Worker":if("session"===t||!wu()&&"none"!==t)throw n;break;default:if(!Er()&&"none"!==t)throw n}}(e),zh(this,function(){return e!=r.c.F?r.b.get(r.c,r.a).then(function(t){return n=t,Vh(r,e)}).then(function(){if(r.c=Bh(e),n)return r.b.set(r.c,n,r.a)}):Ee()})},e(Kh,dn),e(Qh,We),e(Yh,We),(t=Kh.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),Xs(this.b,Kl.SDK_VERSION?br(Kl.SDK_VERSION,this.N):null),this.dispatchEvent(new Yh(this.N))},t.Ea=function(){return z(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?m(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(!Tr())return Te(new w("operation-not-supported-in-this-environment"));var n=this,t=Vi(e.providerId),r=Or(),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=Xh(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 w("cancelled-popup-request"),n.g),n.f=t,n.w=e,n.g=r,n.c=Oc(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(!Tr())return Te(new w("operation-not-supported-in-this-environment"));var e=this;return ol(this,Xh(this).then(function(){return zh(t=e.i,function(){return t.b.set(qh,t.c.F,t.a)});var t}).then(function(){return kc(e.a,"signInViaRedirect",t,void 0,e.S())}))},t.pa=function(){var e=this;return $h(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 Te(new w("null-user"));if(this.R!=t.tenantId)return Te(new w("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,i,o,s,a,u,c=(r=t,i=n,o=e.B,s=e.Ea(),a=r.b,(u={})[Hs]=a.b&&a.b.toString(),u.refreshToken=a.a,i=new uh(i||{apiKey:r.l,authDomain:r.s,appName:r.m},u),o&&(i.ga=o),s&&hh(i,s),Sh(i,r),i);return ol(this,this.h.then(function(){if(el(e).options.apiKey!=t.l)return c.reload()}).then(function(){return nl(e)&&t.uid==nl(e).uid?(Sh(nl(e),t),e.ca(t)):(Zh(e,c),gh(c),e.ca(c))}).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 Gh(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&&Tc(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,n,r=this;n=function(){t.next(nl(r))},(e=this).O.push(n),ol(e,e.h.then(function(){!e.l&&B(e.O,n)&&e.W!==e.getUid()&&(e.W=e.getUid(),n(rl(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,Ka(n.b,qa,{token:t}))}).then(function(t){var e=t.user;return Ih(e,"isAnonymous",!1),n.ca(e),t})},t.Sc=function(t,e){var n=this;return this.h.then(function(){return tl(n,Ka(n.b,Ba,{email:t,password:e}))})},t.cc=function(t,e){var n=this;return this.h.then(function(){return tl(n,Ka(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);if(t&&t.isAnonymous){var e=Wr({providerId:null,isNewUser:!1});return Wr({user:t,credential:null,additionalUserInfo:e,operationType:"signIn"})}return tl(n,n.b.vb()).then(function(t){var e=t.user;return Ih(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&&(Ic(this.a,this),Lc(this.a.b)),Promise.resolve()},t.fc=function(t){return ol(this,Ka(this.b,ga,{identifier:t,continueUri:Ir()?nr():"http://localhost"}).then(function(t){return t.signinMethods||[]}))},t.zc=function(t){return!!Io(t)},t.sb=function(e,n){var r=this;return ol(this,Ee().then(function(){var t=new wi(n);if(!t.c)throw new w("argument-error",Ii+" must be true when sending sign in link to email");return Ri(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 Jr(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)?{}:Ri(new wi(t))}).then(function(t){return n.b.rb(e,t)}).then(function(){}))},t.Uc=function(t,e){return ol(this,qc(this,t,e,m(this.Ya,this)))},t.Tc=function(n,r){var i=this;return ol(this,Ee().then(function(){var t=r||nr(),e=To(n,t);if(!(t=Io(t)))throw new w("argument-error","Invalid email link!");if(t.tenantId!==i.S())throw new w("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)},qr(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 Dr(3e4,6e4);yl.prototype.g=function(i){var o=this;return new ve(function(t,e){var r=setTimeout(function(){e(new w("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 w("internal-error"));delete l[o.a]},Ee(Ls(_t(gl,{onload:o.a,hl:i||""}))).o(function(){clearTimeout(r),e(new w("internal-error","Unable to load external reCAPTCHA dependencies!"))})):(clearTimeout(r),t(l.grecaptcha))})},yl.prototype.c=function(){this.b--};var bl=null;function _l(t,e,n,r,i,o,s){if(qr(this,"type","recaptcha"),this.c=this.f=null,this.D=!1,this.u=e,this.g=null,s=s?vl=vl||new dl:bl=bl||new yl,this.m=s,this.a=n||{theme:"light",type:"image"},this.h=[],this.a[Tl])throw new w("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i="invisible"===this.a[Il],!l.document)throw new w("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 w("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[wl];this.a[wl]=function(t){if(Sl(a,t),"function"==typeof u)u(t);else if("string"==typeof u){var e=wr(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=wr(c,l);"function"==typeof t&&t()}}}var wl="callback",El="expired-callback",Tl="sitekey",Il="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 w("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 w("argument-error","No firebase.app.App instance is currently initialized.")}if(!this.b.options||!this.b.options.apiKey)throw new w("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?br(Kl.SDK_VERSION,o):null,_l.call(this,n,t,e,function(){try{var e=i.b.auth().ja()}catch(t){e=null}return e},o,N(T),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 w("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>=Ol.length)throw new w("internal-error","Argument validator received an unsupported number of arguments.");n=Ol[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.J+".";break t}r=null}}if(r)throw new w("argument-error",t+" failed: "+r)}(t=_l.prototype).Ga=function(){var e=this;return this.f?this.f:this.f=Cl(this,Ee().then(function(){if(Ir()&&!fr())return cr();throw new w("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,Ka(e.s,Oa,{})}).then(function(t){e.a[Tl]=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(e){return new ve(function(n){var t=i.g.getResponse(e);if(t)n(t);else{var r=function(t){var e;t&&(e=r,H(i.l,function(t){return t==e}),n(t))};i.l.push(r),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)}},e(Al,_l);var Ol="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function Rl(t,e){return{name:t||"",J:"a valid string",optional:!!e,K:function(t){return"string"==typeof t}}}function Pl(t,e){return{name:t||"",J:"a boolean",optional:!!e,K:function(t){return"boolean"==typeof t}}}function Dl(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(){return{name:"multiFactorAssertion",J:"a valid multiFactorAssertion",optional:!1,K:function(t){return!!t&&!!t.ob}}}function Ul(){return{name:"authProvider",J:"a valid Auth provider",optional:!1,K:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}}function jl(t,e){return v(t)&&"string"==typeof t.type&&t.type===e&&d(t.Fa)}function Vl(t){return v(t)&&"string"==typeof t.uid}function ql(){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 Bl(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 Wl(t,e){for(var n in e){var r=e[n].name;t[r]=zl(r,t[n],e[n].j)}}function Hl(t,e){for(var n in e){var r=e[n].name;r!==n&&Object.defineProperty(t,r,{get:b(function(t){return this[t]},n),set:b(function(t,e,n,r){kl(t,[n],[r],!0),this[e]=r},r,n,e[n].gb),enumerable:!0})}}function Gl(t,e,n,r){t[e]=zl(e,n,r)}function zl(t,e,n){function r(){var t=Array.prototype.slice.call(arguments);return kl(s,n,t),e.apply(this,t)}if(!n)return e;var i,o,s=(o=(o=t).split("."))[o.length-1];for(i in e)r[i]=e[i];for(i in e.prototype)r.prototype[i]=e.prototype[i];return r}Wl(Kh.prototype,{fb:{name:"applyActionCode",j:[Rl("code")]},Pa:{name:"checkActionCode",j:[Rl("code")]},jb:{name:"confirmPasswordReset",j:[Rl("code"),Rl("newPassword")]},cc:{name:"createUserWithEmailAndPassword",j:[Rl("email"),Rl("password")]},fc:{name:"fetchSignInMethodsForEmail",j:[Rl("email")]},pa:{name:"getRedirectResult",j:[]},zc:{name:"isSignInWithEmailLink",j:[Rl("emailLink")]},Fc:{name:"onAuthStateChanged",j:[Bl(Dl(),xl(),"nextOrObserver"),xl("opt_error",!0),xl("opt_completed",!0)]},Gc:{name:"onIdTokenChanged",j:[Bl(Dl(),xl(),"nextOrObserver"),xl("opt_error",!0),xl("opt_completed",!0)]},rb:{name:"sendPasswordResetEmail",j:[Rl("email"),Bl(Dl("opt_actionCodeSettings",!0),Ll(null,!0),"opt_actionCodeSettings",!0)]},sb:{name:"sendSignInLinkToEmail",j:[Rl("email"),Dl("actionCodeSettings")]},tb:{name:"setPersistence",j:[Rl("persistence")]},Qc:{name:"signInAndRetrieveDataWithCredential",j:[Ml()]},vb:{name:"signInAnonymously",j:[]},Ya:{name:"signInWithCredential",j:[Ml()]},Rc:{name:"signInWithCustomToken",j:[Rl("token")]},Sc:{name:"signInWithEmailAndPassword",j:[Rl("email"),Rl("password")]},Tc:{name:"signInWithEmailLink",j:[Rl("email"),Rl("emailLink",!0)]},Uc:{name:"signInWithPhoneNumber",j:[Rl("phoneNumber"),ql()]},Vc:{name:"signInWithPopup",j:[Ul()]},Wc:{name:"signInWithRedirect",j:[Ul()]},bd:{name:"updateCurrentUser",j:[Bl({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:[Rl(null,!0)]},dd:{name:"useDeviceLanguage",j:[]},fd:{name:"verifyPasswordResetCode",j:[Rl("code")]}}),Hl(Kh.prototype,{lc:{name:"languageCode",gb:Bl(Rl(),Ll(),"languageCode")},ti:{name:"tenantId",gb:Bl(Rl(),Ll(),"tenantId")}}),(Kh.Persistence=Bu).LOCAL="local",Kh.Persistence.SESSION="session",Kh.Persistence.NONE="none",Wl(uh.prototype,{delete:{name:"delete",j:[]},mc:{name:"getIdTokenResult",j:[Pl("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[Pl("opt_forceRefresh",!0)]},Ac:{name:"linkAndRetrieveDataWithCredential",j:[Ml()]},mb:{name:"linkWithCredential",j:[Ml()]},Bc:{name:"linkWithPhoneNumber",j:[Rl("phoneNumber"),ql()]},Cc:{name:"linkWithPopup",j:[Ul()]},Dc:{name:"linkWithRedirect",j:[Ul()]},Jc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[Ml()]},pb:{name:"reauthenticateWithCredential",j:[Ml()]},Kc:{name:"reauthenticateWithPhoneNumber",j:[Rl("phoneNumber"),ql()]},Lc:{name:"reauthenticateWithPopup",j:[Ul()]},Mc:{name:"reauthenticateWithRedirect",j:[Ul()]},reload:{name:"reload",j:[]},qb:{name:"sendEmailVerification",j:[Bl(Dl("opt_actionCodeSettings",!0),Ll(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[Rl(null,!0)]},ad:{name:"unlink",j:[Rl("provider")]},xb:{name:"updateEmail",j:[Rl("email")]},yb:{name:"updatePassword",j:[Rl("password")]},cd:{name:"updatePhoneNumber",j:[Ml("phone")]},zb:{name:"updateProfile",j:[Dl("profile")]},Ab:{name:"verifyBeforeUpdateEmail",j:[Rl("email"),Bl(Dl("opt_actionCodeSettings",!0),Ll(null,!0),"opt_actionCodeSettings",!0)]}}),Wl(al.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Wl(sl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Wl(ve.prototype,{ma:{name:"finally"},o:{name:"catch"},then:{name:"then"}}),Hl(jc.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",gb:Pl("appVerificationDisabledForTesting")}}),Wl(Vc.prototype,{confirm:{name:"confirm",j:[Rl("verificationCode")]}}),Gl(to,"fromJSON",function(t){t="string"==typeof t?JSON.parse(t):t;for(var e,n=[ao,wo,Co,io],r=0;r<n.length;r++)if(e=n[r](t))return e;return null},[Bl(Rl(),Dl(),"json")]),Gl(Eo,"credential",function(t,e){return new _o(t,e)},[Rl("email"),Rl("password")]),Wl(_o.prototype,{v:{name:"toJSON",j:[Rl(null,!0)]}}),Wl(lo.prototype,{Aa:{name:"addScope",j:[Rl("scope")]},Ia:{name:"setCustomParameters",j:[Dl("customOAuthParameters")]}}),Gl(lo,"credential",fo,[Bl(Rl(),Dl(),"token")]),Gl(Eo,"credentialWithLink",To,[Rl("email"),Rl("emailLink")]),Wl(po.prototype,{Aa:{name:"addScope",j:[Rl("scope")]},Ia:{name:"setCustomParameters",j:[Dl("customOAuthParameters")]}}),Gl(po,"credential",vo,[Bl(Rl(),Dl(),"token")]),Wl(yo.prototype,{Aa:{name:"addScope",j:[Rl("scope")]},Ia:{name:"setCustomParameters",j:[Dl("customOAuthParameters")]}}),Gl(yo,"credential",go,[Bl(Rl(),Bl(Dl(),Ll()),"idToken"),Bl(Rl(),Ll(),"accessToken",!0)]),Wl(mo.prototype,{Ia:{name:"setCustomParameters",j:[Dl("customOAuthParameters")]}}),Gl(mo,"credential",bo,[Bl(Rl(),Dl(),"token"),Rl("secret",!0)]),Wl(ho.prototype,{Aa:{name:"addScope",j:[Rl("scope")]},credential:{name:"credential",j:[Bl(Rl(),Bl(Dl(),Ll()),"optionsOrIdToken"),Bl(Rl(),Ll(),"accessToken",!0)]},Ia:{name:"setCustomParameters",j:[Dl("customOAuthParameters")]}}),Wl(oo.prototype,{v:{name:"toJSON",j:[Rl(null,!0)]}}),Wl(no.prototype,{v:{name:"toJSON",j:[Rl(null,!0)]}}),Gl(Ao,"credential",ko,[Rl("verificationId"),Rl("verificationCode")]),Wl(Ao.prototype,{cb:{name:"verifyPhoneNumber",j:[Bl(Rl(),{name:"phoneInfoOptions",J:"valid phone info options",optional:!1,K:function(t){return!!t&&(t.session&&t.phoneNumber?jl(t.session,Ji)&&"string"==typeof t.phoneNumber:t.session&&t.multiFactorHint?jl(t.session,Zi)&&Vl(t.multiFactorHint):t.session&&t.multiFactorUid?jl(t.session,Zi)&&"string"==typeof t.multiFactorUid:!!t.phoneNumber&&"string"==typeof t.phoneNumber)}},"phoneInfoOptions"),ql()]}}),Wl(So.prototype,{v:{name:"toJSON",j:[Rl(null,!0)]}}),Wl(w.prototype,{toJSON:{name:"toJSON",j:[Rl(null,!0)]}}),Wl(Uo.prototype,{toJSON:{name:"toJSON",j:[Rl(null,!0)]}}),Wl(Fo.prototype,{toJSON:{name:"toJSON",j:[Rl(null,!0)]}}),Wl(zc.prototype,{toJSON:{name:"toJSON",j:[Rl(null,!0)]}}),Wl(Wc.prototype,{Pc:{name:"resolveSignIn",j:[Fl()]}}),Wl(Jc.prototype,{Ob:{name:"getSession",j:[]},dc:{name:"enroll",j:[Fl(),Rl("displayName",!0)]},$c:{name:"unenroll",j:[Bl({name:"multiFactorInfo",J:"a valid multiFactorInfo",optional:!1,K:Vl},Rl(),"multiFactorInfoIdentifier")]}}),Wl(Al.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}),Gl(fi,"parseLink",_i,[Rl("link")]),Gl(pl,"assertion",function(t){return new Xc(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:Kh,AuthCredential:to,Error:w};Gl(t,"EmailAuthProvider",Eo,[]),Gl(t,"FacebookAuthProvider",lo,[]),Gl(t,"GithubAuthProvider",po,[]),Gl(t,"GoogleAuthProvider",yo,[]),Gl(t,"TwitterAuthProvider",mo,[]),Gl(t,"OAuthProvider",ho,[Rl("providerId")]),Gl(t,"SAMLAuthProvider",co,[Rl("providerId")]),Gl(t,"PhoneAuthProvider",Ao,[{name:"auth",J:"an instance of Firebase Auth",optional:!0,K:function(t){return!!(t&&t instanceof Kh)}}]),Gl(t,"RecaptchaVerifier",Al,[Bl(Rl(),{name:"",J:"an HTML element",optional:!1,K:function(t){return!!(t&&t instanceof Element)}},"recaptchaContainer"),Dl("recaptchaParameters",!0),{name:"app",J:"an instance of Firebase App",optional:!0,K:function(t){return!!(t&&t instanceof Kl.app.App)}}]),Gl(t,"ActionCodeURL",fi,[]),Gl(t,"PhoneMultiFactorGenerator",pl,[]),Kl.INTERNAL.registerComponent({name:"auth",instanceFactory:function(t){return new Kh(t=t.getProvider("app").getImmediate())},multipleInstances:!1,serviceProps:t,instantiationMode:"LAZY",type:"PUBLIC"}),Kl.INTERNAL.registerComponent({name:"auth-internal",instanceFactory:function(t){return{getUid:m((t=t.getProvider("auth").getImmediate()).getUid,t),getToken:m(t.kc,t),addAuthTokenListener:m(t.bc,t),removeAuthTokenListener:m(t.Nc,t)}},multipleInstances:!1,instantiationMode:"LAZY",type:"PRIVATE"}),Kl.registerVersion("@firebase/auth","0.14.6"),Kl.INTERNAL.extendNamespace({User:uh})}()}).apply("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Ja=(Za.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),$s(e))},Za.prototype.get=function(t){var e=this.domStorage_.getItem(this.prefixedName_(t));return null==e?null:Xs(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 Ja(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;Ds(++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){Ds(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(gu.logLevel=Ta.VERBOSE,_u=gu.log.bind(gu),e&&yu.set("logging_enabled",!0)):"function"==typeof t?_u=t:(_u=null,yu.remove("logging_enabled"))}function ou(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!0===wu&&(wu=!1,null===_u&&!0===yu.get("logging_enabled")&&iu(!0)),_u){var n=bu.apply(null,t);_u(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: "+bu.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: "+bu.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: "+bu.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: "+$s(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 Ra("@firebase/database"),mu=(du=1,function(){return du++}),bu=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+=bu.apply(null,i):n+="object"==typeof i?$s(i):i,n+=" "}return n},_u=null,wu=!0,Eu="[MIN_NAME]",Tu="[MAX_NAME]",Iu=function(t,e){if(t===e)return 0;if(t===Eu||e===Tu)return-1;if(e===Eu||t===Tu)return 1;var n=Ru(t),r=Ru(e);return null!==n?null!==r?n-r==0?t.length-e.length:n-r:-1:null===r&&t<e?-1:1},Su=function(t){if("object"!=typeof t||null===t)return $s(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+=$s(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;Ds(!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)s.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;--o)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 Ou=new RegExp("^-?(0*)\\d{1,10}$"),Ru=function(t){if(Ou.test(t)){var e=Number(t);if(-2147483648<=e&&e<=2147483647)return e}return null},Pu=(Object.defineProperty(Du,"Empty",{get:function(){return new Du("")},enumerable:!0,configurable:!0}),Du.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},Du.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},Du.prototype.popFront=function(){var t=this.pieceNum_;return t<this.pieces_.length&&t++,new Du(this.pieces_,t)},Du.prototype.getBack=function(){return this.pieceNum_<this.pieces_.length?this.pieces_[this.pieces_.length-1]:null},Du.prototype.toString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"},Du.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||"/"},Du.prototype.slice=function(t){return void 0===t&&(t=0),this.pieces_.slice(this.pieceNum_+t)},Du.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 Du(t,0)},Du.prototype.child=function(t){for(var e=[],n=this.pieceNum_;n<this.pieces_.length;n++)e.push(this.pieces_[n]);if(t instanceof Du)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 Du(e,0)},Du.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},Du.relativePath=function(t,e){var n=t.getFront(),r=e.getFront();if(null===n)return e;if(n===r)return Du.relativePath(t.popFront(),e.popFront());throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")},Du.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;i<n.length&&i<r.length;i++){var o=Iu(n[i],r[i]);if(0!==o)return o}return n.length===r.length?0:n.length<r.length?-1:1},Du.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},Du.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},Du);function Du(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_},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=(Vu.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()||this.includeNamespaceInQueryParams},Vu.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},Vu.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},Vu.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},Vu.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&vu.set("host:"+this.host,this.internalHost))},Vu.prototype.connectionURL=function(t,e){var n;if(Ds("string"==typeof t,"typeof type must == string"),Ds("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("&")},Vu.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},Vu.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},Vu);function Vu(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 qu(t){var e=Zu(t),n=e.namespace;"firebase.com"===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 Pu(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 Gu(t,e,n,r,i){i&&void 0===n||rc(ha(t,e,i),n,r)}function zu(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 Pu(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)&&!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(Pu.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 Ku(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 Xu(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 $u(t,e){if(".info"===e.getFront())throw new Error(t+" failed = Can't modify data under /.info/")}function Ju(t,e,n){var r,i=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!==i.length&&(r=(r=i)&&r.replace(/^\/*\.info(\/|$)/,"/"),!Wu(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=e.length;var p=e.slice(0,c);if("localhost"===p.toLowerCase())n="localhost";else if(p.split(".").length<=2)n=p;else{var d=e.indexOf(".");r=e.substring(0,d).toLowerCase(),n=e.substring(d+1),o=r}"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 Pu?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),$u("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),$u("OnDisconnect.set",this.path_),Gu("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),$u("OnDisconnect.setWithPriority",this.path_),Gu("OnDisconnect.setWithPriority",1,t,this.path_,!1),Ku("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),$u("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.")}zu("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);Ds(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 Ds(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(bc,gc=vc),Object.defineProperty(bc,"__EMPTY_NODE",{get:function(){return dc},set:function(t){dc=t},enumerable:!0,configurable:!0}),bc.prototype.compare=function(t,e){return Iu(t.name,e.name)},bc.prototype.isDefinedOn=function(t){throw xs("KeyIndex.isDefinedOn not expected to be called.")},bc.prototype.indexedValueChanged=function(t,e){return!1},bc.prototype.minPost=function(){return fc.MIN},bc.prototype.maxPost=function(){return new fc(Tu,dc)},bc.prototype.makePost=function(t,e){return Ds("string"==typeof t,"KeyIndex indexValue must always be a string."),new fc(t,dc)},bc.prototype.toString=function(){return".key"},bc);function bc(){return null!==gc&&gc.apply(this,arguments)||this}var _c,wc=new mc;function Ec(t){return"number"==typeof t?"number:"+Nu(t):"string:"+t}function Tc(t){if(t.isLeafNode()){var e=t.val();Ds("string"==typeof e||"number"==typeof e||"object"==typeof e&&Zs(e,".sv"),"Priority must be a string or number.")}else Ds(t===_c||t.isEmpty(),"priority of unexpected type.");Ds(t===_c||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")}var Ic,Sc,Cc,Nc,Ac=(Object.defineProperty(kc,"__childrenNodeConstructor",{get:function(){return Ic},set:function(t){Ic=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:(Ds(".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:(Ds(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 Ds(0<=r,"Unknown leaf type: "+e),Ds(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){return t===this||!!t.isLeafNode()&&(this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_))},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,Ds(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),Tc(this.priorityNode_)}function Oc(){return null!==Nc&&Nc.apply(this,arguments)||this}var Rc=new(Es(Oc,Nc=vc),Oc.prototype.compare=function(t,e){var n=t.node.getPriority(),r=e.node.getPriority(),i=n.compareTo(r);return 0===i?Iu(t.name,e.name):i},Oc.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},Oc.prototype.indexedValueChanged=function(t,e){return!t.getPriority().equals(e.getPriority())},Oc.prototype.minPost=function(){return fc.MIN},Oc.prototype.maxPost=function(){return new fc(Tu,new Ac("[PRIORITY-POST]",Cc))},Oc.prototype.makePost=function(t,e){var n=Sc(t);return new fc(e,new Ac("[PRIORITY-POST]",n))},Oc.prototype.toString=function(){return".priority"},Oc),Pc=(Dc.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},Dc.prototype.hasNext=function(){return 0<this.nodeStack_.length},Dc.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}},Dc);function Dc(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 Pc(this.root_,null,this.comparator_,!1,t)},jc.prototype.getIteratorFrom=function(t,e){return new Pc(this.root_,t,this.comparator_,!1,e)},jc.prototype.getReverseIteratorFrom=function(t,e){return new Pc(this.root_,t,this.comparator_,!0,e)},jc.prototype.getReverseIterator=function(t){return new Pc(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 Vc=Math.log(2),qc=(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)/Vc,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,Gc=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 qc(c.length));return new Uc(e||t,n)},zc={},Kc=(Object.defineProperty(Qc,"Default",{get:function(){return Ds(Rc,"ChildrenNode.ts has not been loaded"),Wc=Wc||new Qc({".priority":zc},{".priority":Rc})},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){Ds(t!==wc,"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?Gc(r,t.getCompare()):zc;var a=t.toString(),u=Ts({},this.indexSet_);u[a]=t;var c=Ts({},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(Ds(n,"Missing index implementation for "+e),t===zc){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),Gc(r,n.getCompare())}return zc}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===zc)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 Iu(t.name,e.name)}function Xc(t,e){return Iu(t,e)}var $c,Jc=(Object.defineProperty(Zc,"EMPTY_NODE",{get:function(){return Hc=Hc||new Zc(new Uc(Xc),null,Kc.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(Ds(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;Ds(".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(Rc,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(Rc,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===wc||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===wc||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(Rc),r=e.getIterator(Rc),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===wc?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_&&Tc(this.priorityNode_),this.children_.isEmpty()&&Ds(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}function th(){return $c.call(this,new Uc(Xc),Jc.EMPTY_NODE,Kc.Default)||this}var eh=new(Es(th,$c=Jc),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 Jc.EMPTY_NODE},th.prototype.isEmpty=function(){return!1},th);Object.defineProperties(fc,{MIN:{value:new fc(Eu,Jc.EMPTY_NODE)},MAX:{value:new fc(Tu,eh)}}),mc.__EMPTY_NODE=Jc.EMPTY_NODE,Ac.__childrenNodeConstructor=Jc,_c=eh,Cc=eh;var nh,rh=!0;function ih(r,t){if(void 0===t&&(t=null),null===r)return Jc.EMPTY_NODE;if("object"==typeof r&&".priority"in r&&(t=r[".priority"]),Ds(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=Jc.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 Jc.EMPTY_NODE;var e=Gc(o,Yc,function(t){return t.name},Xc);if(s){var n=Gc(o,Rc.getCompare());return new Jc(e,ih(t),new Kc({".priority":n},{".priority":Rc}))}return new Jc(e,ih(t),Kc.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?Iu(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?Iu(t.name,e.name):i},ch.prototype.makePost=function(t,e){var n=ih(t),r=Jc.EMPTY_NODE.updateChild(this.indexPath_,n);return new fc(e,r)},ch.prototype.maxPost=function(){var t=Jc.EMPTY_NODE.updateChild(this.indexPath_,eh);return new fc(Tu,t)},ch.prototype.toString=function(){return this.indexPath_.slice().join("/")},ch);function ch(t){var e=sh.call(this)||this;return e.indexPath_=t,Ds(!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),Xu("DataSnapshot.child",1,t,!1);var e=new Pu(t),n=this.ref_.child(e);return new lh(this.node_.getChild(e),n,Rc)},lh.prototype.hasChild=function(t){ca("DataSnapshot.hasChild",1,1,arguments.length),Xu("DataSnapshot.hasChild",1,t,!1);var e=new Pu(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),Rc))})},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+":"+$s(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()){Ds(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,bh=(_h.prototype.respondsTo=function(t){var e="children_added"===t?"child_added":t;return e="children_removed"===e?"child_removed":e,Zs(this.callbacks_,e)},_h.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new dh(this,t,e):null},_h.prototype.createEvent=function(t,e){Ds(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)},_h.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){Ds(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)}},_h.prototype.matches=function(e){var n=this;if(e instanceof _h){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},_h.prototype.hasAnyCallback=function(){return null!==this.callbacks_},_h);function _h(t,e,n){this.callbacks_=t,this.cancelCallback_=e,this.context_=n}var wh=(Object.defineProperty(Eh,"__referenceConstructor",{get:function(){return Ds(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()===wc){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()!==Tu)throw new Error(r);if("string"!=typeof n)throw new Error(i)}}else if(t.getIndex()===Rc){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(Ds(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 bh(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 bh(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.');Xu("Query.orderByChild",1,t,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");var e=new Pu(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(wc);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(Rc);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),Gu("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),Gu("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),Gu("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 Th=(Ih.prototype.getImmediateChild=function(t){return new Ih(this.node_.getImmediateChild(t))},Ih.prototype.node=function(){return this.node_},Ih);function Ih(t){this.node_=t}var Sh=(Ch.prototype.getImmediateChild=function(t){var e=this.path_.child(t);return new Ch(this.syncTree_,e)},Ch.prototype.node=function(){return this.syncTree_.calcCompleteEventCache(this.path_)},Ch);function Ch(t,e){this.syncTree_=t,this.path_=e}function Nh(t,e,n,r){return Ph(e,new Sh(n,t),r)}function Ah(t,e,n){return Ph(t,new Th(e),n)}var kh=function(t,e,n){return t&&"object"==typeof t?(Ds(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?Oh(t[".sv"],e,n):"object"==typeof t[".sv"]?Rh(t[".sv"],e):void Ds(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},Oh=function(t,e,n){switch(t){case"timestamp":return n.timestamp;default:Ds(!1,"Unexpected server value: "+t)}},Rh=function(t,e,n){t.hasOwnProperty("increment")||Ds(!1,"Unexpected server value: "+JSON.stringify(t,null,2));var r=t.increment;"number"!=typeof r&&Ds(!1,"Unexpected increment value: "+r);var i=e.node();if(Ds(null!=i,"Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return r;var o=i.getValue();return"number"!=typeof o?r:o+r};function Ph(t,r,i){var o,e=t.getPriority().val(),n=kh(e,r.getImmediateChild(".priority"),i);if(t.isLeafNode()){var s=t,a=kh(s.getValue(),r,i);return a!==s.getValue()||n!==s.getPriority().val()?new Ac(a,ih(n)):t}var u=t;return n!==(o=u).getPriority().val()&&(o=o.updatePriority(new Ac(n))),u.forEachChild(Rc,function(t,e){var n=Ph(e,r.getImmediateChild(t),i);n!==e&&(o=o.updateImmediateChild(t,n))}),o}var Dh,xh,Lh=(Mh.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},Mh.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 Mh);var r=this.children.get(n);t=t.popFront(),r.remember(t,e)}},Mh.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(Rc,function(t,e){n.remember(new Pu(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},Mh.prototype.forEachTree=function(r,i){null!==this.value?i(r,this.value):this.forEachChild(function(t,e){var n=new Pu(r.toString()+"/"+t);e.forEachTree(n,i)})},Mh.prototype.forEachChild=function(n){this.children.forEach(function(t,e){n(e,t)})},Mh);function Mh(){this.value=null,this.children=new Map}(xh=Dh=Dh||{})[xh.OVERWRITE=0]="OVERWRITE",xh[xh.MERGE=1]="MERGE",xh[xh.ACK_USER_WRITE=2]="ACK_USER_WRITE",xh[xh.LISTEN_COMPLETE=3]="LISTEN_COMPLETE";var Fh=(Uh.User=new Uh(!0,!1,null,!1),Uh.Server=new Uh(!1,!0,null,!1),Uh.forServerTaggedQuery=function(t){return new Uh(!1,!0,t,!0)},Uh);function Uh(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,Ds(!r||e,"Tagged queries must be from server.")}var jh,Vh=(qh.prototype.operationForChild=function(t){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return Ds(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var e=this.affectedTree.subtree(new Pu(t));return new qh(Pu.Empty,e,this.revert)}return Ds(this.path.getFront()===t,"operationForChild called for unrelated child."),new qh(this.path.popFront(),this.affectedTree,this.revert)},qh);function qh(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=Dh.ACK_USER_WRITE,this.source=Fh.User}var Bh=(Wh.fromObject=function(t){var n=Wh.Empty;return Cu(t,function(t,e){n=n.set(new Pu(t),e)}),n},Wh.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},Wh.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:Pu.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 Pu(n).child(i.path),value:i.value}},Wh.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},Wh.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()):Wh.Empty},Wh.prototype.set=function(t,e){if(t.isEmpty())return new Wh(e,this.children);var n=t.getFront(),r=(this.children.get(n)||Wh.Empty).set(t.popFront(),e),i=this.children.insert(n,r);return new Wh(this.value,i)},Wh.prototype.remove=function(t){if(t.isEmpty())return this.children.isEmpty()?Wh.Empty:new Wh(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()?Wh.Empty:new Wh(this.value,i)}return this},Wh.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},Wh.prototype.setTree=function(t,e){if(t.isEmpty())return e;var n=t.getFront(),r=(this.children.get(n)||Wh.Empty).setTree(t.popFront(),e),i=void 0;return i=r.isEmpty()?this.children.remove(n):this.children.insert(n,r),new Wh(this.value,i)},Wh.prototype.fold=function(t){return this.fold_(Pu.Empty,t)},Wh.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)},Wh.prototype.findOnPath=function(t,e){return this.findOnPath_(t,Pu.Empty,e)},Wh.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},Wh.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,Pu.Empty,e)},Wh.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):Wh.Empty},Wh.prototype.foreach=function(t){this.foreach_(Pu.Empty,t)},Wh.prototype.foreach_=function(n,r){this.children.inorderTraversal(function(t,e){e.foreach_(n.child(t),r)}),this.value&&r(n,this.value)},Wh.prototype.foreachChild=function(n){this.children.inorderTraversal(function(t,e){e.value&&n(t,e.value)})},Wh.Empty=new Wh(null),Wh);function Wh(t,e){void 0===e&&(e=jh=jh||new Uc(lu)),this.value=t,this.children=e}var Hh=(Gh.prototype.operationForChild=function(t){return this.path.isEmpty()?new Gh(this.source,Pu.Empty):new Gh(this.source,this.path.popFront())},Gh);function Gh(t,e){this.source=t,this.path=e,this.type=Dh.LISTEN_COMPLETE}var zh=(Kh.prototype.operationForChild=function(t){return this.path.isEmpty()?new Kh(this.source,Pu.Empty,this.snap.getImmediateChild(t)):new Kh(this.source,this.path.popFront(),this.snap)},Kh);function Kh(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=Dh.OVERWRITE}var Qh=(Yh.prototype.operationForChild=function(t){if(this.path.isEmpty()){var e=this.children.subtree(new Pu(t));return e.isEmpty()?null:e.value?new zh(this.source,Pu.Empty,e.value):new Yh(this.source,Pu.Empty,e)}return Ds(this.path.getFront()===t,"Can't get a merge for a child not on the path of the operation"),new Yh(this.source,this.path.popFront(),this.children)},Yh.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},Yh);function Yh(t,e,n){this.source=t,this.path=e,this.children=n,this.type=Dh.MERGE}var Xh=($h.prototype.isFullyInitialized=function(){return this.fullyInitialized_},$h.prototype.isFiltered=function(){return this.filtered_},$h.prototype.isCompleteForPath=function(t){if(t.isEmpty())return this.isFullyInitialized()&&!this.filtered_;var e=t.getFront();return this.isCompleteForChild(e)},$h.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},$h.prototype.getNode=function(){return this.node_},$h);function $h(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}var Jh=(Zh.prototype.updateEventSnap=function(t,e,n){return new Zh(new Xh(t,e,n),this.serverCache_)},Zh.prototype.updateServerSnap=function(t,e,n){return new Zh(this.eventCache_,new Xh(t,e,n))},Zh.prototype.getEventCache=function(){return this.eventCache_},Zh.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},Zh.prototype.getServerCache=function(){return this.serverCache_},Zh.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},Zh.Empty=new Zh(new Xh(Jc.EMPTY_NODE,!1,!1),new Xh(Jc.EMPTY_NODE,!1,!1)),Zh);function Zh(t,e){this.eventCache_=t,this.serverCache_=e}var tl=(el.valueChange=function(t){return new el(el.VALUE,t)},el.childAddedChange=function(t,e){return new el(el.CHILD_ADDED,e,t)},el.childRemovedChange=function(t,e){return new el(el.CHILD_REMOVED,e,t)},el.childChangedChange=function(t,e,n){return new el(el.CHILD_CHANGED,e,t,n)},el.childMovedChange=function(t,e){return new el(el.CHILD_MOVED,e,t)},el.CHILD_ADDED="child_added",el.CHILD_REMOVED="child_removed",el.CHILD_CHANGED="child_changed",el.CHILD_MOVED="child_moved",el.VALUE="value",el);function el(t,e,n,r,i){this.type=t,this.snapshotNode=e,this.childName=n,this.oldSnap=r,this.prevName=i}var nl=(rl.prototype.updateChild=function(t,e,n,r,i,o){Ds(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(tl.childRemovedChange(e,s)):Ds(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?o.trackChildChange(tl.childAddedChange(e,n)):o.trackChildChange(tl.childChangedChange(e,n,s))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},rl.prototype.updateFullNode=function(r,n,i){return null!=i&&(r.isLeafNode()||r.forEachChild(Rc,function(t,e){n.hasChild(t)||i.trackChildChange(tl.childRemovedChange(t,e))}),n.isLeafNode()||n.forEachChild(Rc,function(t,e){if(r.hasChild(t)){var n=r.getImmediateChild(t);n.equals(e)||i.trackChildChange(tl.childChangedChange(t,e,n))}else i.trackChildChange(tl.childAddedChange(t,e))})),n.withIndex(this.index_)},rl.prototype.updatePriority=function(t,e){return t.isEmpty()?Jc.EMPTY_NODE:t.updatePriority(e)},rl.prototype.filtersNodes=function(){return!1},rl.prototype.getIndexedFilter=function(){return this},rl.prototype.getIndex=function(){return this.index_},rl);function rl(t){this.index_=t}var il=(ol.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;Ds(e===tl.CHILD_ADDED||e===tl.CHILD_CHANGED||e===tl.CHILD_REMOVED,"Only child changes supported for tracking"),Ds(".priority"!==n,"Only non-priority child changes can be tracked.");var r=this.changeMap.get(n);if(r){var i=r.type;if(e===tl.CHILD_ADDED&&i===tl.CHILD_REMOVED)this.changeMap.set(n,tl.childChangedChange(n,t.snapshotNode,r.snapshotNode));else if(e===tl.CHILD_REMOVED&&i===tl.CHILD_ADDED)this.changeMap.delete(n);else if(e===tl.CHILD_REMOVED&&i===tl.CHILD_CHANGED)this.changeMap.set(n,tl.childRemovedChange(n,r.oldSnap));else if(e===tl.CHILD_CHANGED&&i===tl.CHILD_ADDED)this.changeMap.set(n,tl.childAddedChange(n,t.snapshotNode));else{if(e!==tl.CHILD_CHANGED||i!==tl.CHILD_CHANGED)throw xs("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap.set(n,tl.childChangedChange(n,t.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,t)},ol.prototype.getChanges=function(){return Array.from(this.changeMap.values())},ol);function ol(){this.changeMap=new Map}function sl(){}var al=new(sl.prototype.getCompleteChild=function(t){return null},sl.prototype.getChildAfterChild=function(t,e,n){return null},sl),ul=(cl.prototype.getCompleteChild=function(t){var e=this.viewCache_.getEventCache();if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);var n=null!=this.optCompleteServerCache_?new Xh(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(t,n)},cl.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]},cl);function cl(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}var hl=function(t,e){this.viewCache=t,this.changes=e},ll=(fl.prototype.assertIndexed=function(t){Ds(t.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),Ds(t.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},fl.prototype.applyOperation=function(t,e,n,r){var i,o,s=new il;if(e.type===Dh.OVERWRITE){var a=e;i=a.source.fromUser?this.applyUserOverwrite_(t,a.path,a.snap,n,r,s):(Ds(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===Dh.MERGE){var u=e;i=u.source.fromUser?this.applyUserMerge_(t,u.path,u.children,n,r,s):(Ds(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===Dh.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!==Dh.LISTEN_COMPLETE)throw xs("Unknown operation type: "+e.type);i=this.listenComplete_(t,e.path,n,s)}var h=s.getChanges();return fl.maybeAddValueEvent_(t,i,h),new hl(i,h)},fl.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(tl.valueChange(e.getCompleteEventSnap()))}},fl.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(Ds(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()){var u=t.getCompleteServerSnap(),c=u instanceof Jc?u:Jc.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){Ds(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())},fl.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,al,null)}var d=t.updateServerSnap(a,u.isFullyInitialized()||e.isEmpty(),c.filtersNodes()),v=new ul(r,d,i);return this.generateEventCacheAfterServerEvent_(d,e,r,v,s)},fl.prototype.applyUserOverwrite_=function(t,e,n,r,i,o){var s,a,u=t.getEventCache(),c=new ul(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):Jc.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},fl.cacheHasChild_=function(t,e){return t.getEventCache().isCompleteForChild(e)},fl.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);fl.cacheHasChild_(r,n.getFront())&&(c=u.applyUserOverwrite_(c,n,e,o,s,a))}),t.foreach(function(t,e){var n=i.child(t);fl.cacheHasChild_(r,n.getFront())||(c=u.applyUserOverwrite_(c,n,e,o,s,a))}),c},fl.prototype.applyMerge_=function(n,t){return t.foreach(function(t,e){n=n.updateChild(t,e)}),n},fl.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:Bh.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 Pu(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 Pu(t),i,s,a,u,c)}}),l},fl.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=Bh.Empty;return a.getNode().forEachChild(wc,function(t,e){u=u.set(new Pu(t),e)}),this.applyServerMerge_(t,r,u,n,i,s,o)}return t}var c=Bh.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)},fl.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,al,r)},fl.prototype.revertUserWrite_=function(t,e,n,r,i){var o;if(null!=n.shadowingWrite(e))return t;var s=new ul(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();Ds(h instanceof Jc,"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,Jc.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(Pu.Empty),t.updateEventSnap(u,o,this.filter_.filtersNodes())},fl);function fl(t){this.filter_=t}var pl=(dl.prototype.generateEventsForChanges=function(t,e,n){var r=this,i=[],o=[];return t.forEach(function(t){t.type===tl.CHILD_CHANGED&&r.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(tl.childMovedChange(t.childName,t.snapshotNode))}),this.generateEventsForType_(i,tl.CHILD_REMOVED,t,n,e),this.generateEventsForType_(i,tl.CHILD_ADDED,t,n,e),this.generateEventsForType_(i,tl.CHILD_MOVED,o,n,e),this.generateEventsForType_(i,tl.CHILD_CHANGED,t,n,e),this.generateEventsForType_(i,tl.VALUE,t,n,e),i},dl.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_))})})},dl.prototype.materializeSingleChange_=function(t,e){return"value"===t.type||"child_removed"===t.type||(t.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.index_)),t},dl.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)},dl);function dl(t){this.query_=t,this.index_=this.query_.getQueryParams().getIndex()}var vl,yl=(gl.prototype.getQuery=function(){return this.query_},gl.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},gl.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},gl.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},gl.prototype.addEventRegistration=function(t){this.eventRegistrations_.push(t)},gl.prototype.removeEventRegistration=function(t,n){var r=[];if(n){Ds(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},gl.prototype.applyOperation=function(t,e,n){t.type===Dh.MERGE&&null!==t.source.queryId&&(Ds(this.viewCache_.getCompleteServerSnap(),"We should always have a full cache before handling merges"),Ds(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),Ds(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)},gl.prototype.getInitialEvents=function(t){var e=this.viewCache_.getEventCache(),n=[];return e.getNode().isLeafNode()||e.getNode().forEachChild(Rc,function(t,e){n.push(tl.childAddedChange(t,e))}),e.isFullyInitialized()&&n.push(tl.valueChange(e.getNode())),this.generateEventsForChanges_(n,e.getNode(),t)},gl.prototype.generateEventsForChanges_=function(t,e,n){var r=n?[n]:this.eventRegistrations_;return this.eventGenerator_.generateEventsForChanges(t,e,r)},gl);function gl(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new nl(n.getIndex()),i=n.getNodeFilter();this.processor_=new ll(i);var o=e.getServerCache(),s=e.getEventCache(),a=r.updateFullNode(Jc.EMPTY_NODE,o.getNode(),null),u=i.updateFullNode(Jc.EMPTY_NODE,s.getNode(),null),c=new Xh(a,o.isFullyInitialized(),r.filtersNodes()),h=new Xh(u,s.isFullyInitialized(),i.filtersNodes());this.viewCache_=new Jh(h,c),this.eventGenerator_=new pl(this.query_)}var ml=(Object.defineProperty(bl,"__referenceConstructor",{get:function(){return Ds(vl,"Reference.ts has not been loaded"),vl},set:function(t){Ds(!vl,"__referenceConstructor has already been defined"),vl=t},enumerable:!0,configurable:!0}),bl.prototype.isEmpty=function(){return 0===this.views.size},bl.prototype.applyOperation=function(t,e,n){var r,i,o=t.source.queryId;if(null!==o){var s=this.views.get(o);return Ds(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},bl.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 Jc?n.calcCompleteEventChildren(r):Jc.EMPTY_NODE,!1);var c=new Jh(new Xh(a,u,!1),new Xh(r,i,!1));s=new yl(t,c),this.views.set(o,s)}return s.addEventRegistration(e),s.getInitialEvents(e)},bl.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 bl.__referenceConstructor(t.repo,t.path)),{removed:s,events:a}},bl.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},bl.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},bl.prototype.viewForQuery=function(t){if(t.getQueryParams().loadsAllData())return this.getCompleteView();var e=t.queryIdentifier();return this.views.get(e)},bl.prototype.viewExistsForQuery=function(t){return null!=this.viewForQuery(t)},bl.prototype.hasCompleteView=function(){return null!=this.getCompleteView()},bl.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},bl);function bl(){this.views=new Map}var _l=(wl.prototype.addWrite=function(t,e){if(t.isEmpty())return new wl(new Bh(e));var n=this.writeTree_.findRootMostValueAndPath(t);if(null!=n){var r=n.path,i=n.value,o=Pu.relativePath(r,t);return i=i.updateChild(o,e),new wl(this.writeTree_.set(r,i))}var s=new Bh(e);return new wl(this.writeTree_.setTree(t,s))},wl.prototype.addWrites=function(n,t){var r=this;return Cu(t,function(t,e){r=r.addWrite(n.child(t),e)}),r},wl.prototype.removeWrite=function(t){return t.isEmpty()?wl.Empty:new wl(this.writeTree_.setTree(t,Bh.Empty))},wl.prototype.hasCompleteWrite=function(t){return null!=this.getCompleteNode(t)},wl.prototype.getCompleteNode=function(t){var e=this.writeTree_.findRootMostValueAndPath(t);return null!=e?this.writeTree_.get(e.path).getChild(Pu.relativePath(e.path,t)):null},wl.prototype.getCompleteChildren=function(){var n=[],t=this.writeTree_.value;return null!=t?t.isLeafNode()||t.forEachChild(Rc,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},wl.prototype.childCompoundWrite=function(t){if(t.isEmpty())return this;var e=this.getCompleteNode(t);return new wl(null!=e?new Bh(e):this.writeTree_.subtree(t))},wl.prototype.isEmpty=function(){return this.writeTree_.isEmpty()},wl.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?(Ds(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}(Pu.Empty,this.writeTree_,t)},wl.Empty=new wl(new Bh(null)),wl);function wl(t){this.writeTree_=t}var El=(Tl.prototype.childWrites=function(t){return new Il(t,this)},Tl.prototype.addOverwrite=function(t,e,n,r){Ds(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},Tl.prototype.addMerge=function(t,e,n){Ds(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},Tl.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},Tl.prototype.removeWrite=function(e){var n=this,t=this.allWrites_.findIndex(function(t){return t.writeId===e});Ds(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)},Tl.prototype.getCompleteWriteData=function(t){return this.visibleWrites_.getCompleteNode(t)},Tl.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(Pu.Empty)){var o=Tl.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||Jc.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(Pu.Empty)){var u=t||Jc.EMPTY_NODE;return a.apply(u)}return null},Tl.prototype.calcCompleteEventChildren=function(t,e){var r=Jc.EMPTY_NODE,n=this.visibleWrites_.getCompleteNode(t);if(n)return n.isLeafNode()||n.forEachChild(Rc,function(t,e){r=r.updateImmediateChild(t,e)}),r;if(e){var i=this.visibleWrites_.childCompoundWrite(t);return e.forEachChild(Rc,function(t,e){var n=i.childCompoundWrite(new Pu(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},Tl.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n,r){Ds(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))},Tl.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},Tl.prototype.shadowingWrite=function(t){return this.visibleWrites_.getCompleteNode(t)},Tl.prototype.calcIndexedSlice=function(t,e,n,r,i,o){var s,a=this.visibleWrites_.childCompoundWrite(t),u=a.getCompleteNode(Pu.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},Tl.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},Tl.prototype.resetTree_=function(){this.visibleWrites_=Tl.layerTree_(this.allWrites_,Tl.DefaultFilter_,Pu.Empty),0<this.allWrites_.length?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},Tl.DefaultFilter_=function(t){return t.visible},Tl.layerTree_=function(t,e,n){for(var r=_l.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=Pu.relativePath(n,s),r=r.addWrite(a,o.snap)):s.contains(n)&&(a=Pu.relativePath(s,n),r=r.addWrite(Pu.Empty,o.snap.getChild(a)));else{if(!o.children)throw xs("WriteRecord should have .snap or .children");if(n.contains(s))a=Pu.relativePath(n,s),r=r.addWrites(a,o.children);else if(s.contains(n))if((a=Pu.relativePath(s,n)).isEmpty())r=r.addWrites(Pu.Empty,o.children);else{var u=ta(o.children,a.getFront());if(u){var c=u.getChild(a.popFront());r=r.addWrite(Pu.Empty,c)}}}}}return r},Tl);function Tl(){this.visibleWrites_=_l.Empty,this.allWrites_=[],this.lastWriteId_=-1}var Il=(Sl.prototype.calcCompleteEventCache=function(t,e,n){return this.writeTree_.calcCompleteEventCache(this.treePath_,t,e,n)},Sl.prototype.calcCompleteEventChildren=function(t){return this.writeTree_.calcCompleteEventChildren(this.treePath_,t)},Sl.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n){return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_,t,e,n)},Sl.prototype.shadowingWrite=function(t){return this.writeTree_.shadowingWrite(this.treePath_.child(t))},Sl.prototype.calcIndexedSlice=function(t,e,n,r,i){return this.writeTree_.calcIndexedSlice(this.treePath_,t,e,n,r,i)},Sl.prototype.calcCompleteChild=function(t,e){return this.writeTree_.calcCompleteChild(this.treePath_,t,e)},Sl.prototype.child=function(t){return new Sl(this.treePath_.child(t),this.writeTree_)},Sl);function Sl(t,e){this.treePath_=t,this.writeTree_=e}var Cl=(Nl.prototype.applyUserOverwrite=function(t,e,n,r){return this.pendingWriteTree_.addOverwrite(t,e,n,r),r?this.applyOperationToSyncPoints_(new zh(Fh.User,t,e)):[]},Nl.prototype.applyUserMerge=function(t,e,n){this.pendingWriteTree_.addMerge(t,e,n);var r=Bh.fromObject(e);return this.applyOperationToSyncPoints_(new Qh(Fh.User,t,r))},Nl.prototype.ackUserWrite=function(t,e){void 0===e&&(e=!1);var n=this.pendingWriteTree_.getWrite(t);if(this.pendingWriteTree_.removeWrite(t)){var r=Bh.Empty;return null!=n.snap?r=r.set(Pu.Empty,!0):Cu(n.children,function(t,e){r=r.set(new Pu(t),e)}),this.applyOperationToSyncPoints_(new Vh(n.path,r,e))}return[]},Nl.prototype.applyServerOverwrite=function(t,e){return this.applyOperationToSyncPoints_(new zh(Fh.Server,t,e))},Nl.prototype.applyServerMerge=function(t,e){var n=Bh.fromObject(e);return this.applyOperationToSyncPoints_(new Qh(Fh.Server,t,n))},Nl.prototype.applyListenComplete=function(t){return this.applyOperationToSyncPoints_(new Hh(Fh.Server,t))},Nl.prototype.applyTaggedQueryOverwrite=function(t,e,n){var r=this.queryKeyForTag_(n);if(null==r)return[];var i=Nl.parseQueryKey_(r),o=i.path,s=i.queryId,a=Pu.relativePath(o,t),u=new zh(Fh.forServerTaggedQuery(s),a,e);return this.applyTaggedOperation_(o,u)},Nl.prototype.applyTaggedQueryMerge=function(t,e,n){var r=this.queryKeyForTag_(n);if(r){var i=Nl.parseQueryKey_(r),o=i.path,s=i.queryId,a=Pu.relativePath(o,t),u=Bh.fromObject(e),c=new Qh(Fh.forServerTaggedQuery(s),a,u);return this.applyTaggedOperation_(o,c)}return[]},Nl.prototype.applyTaggedListenComplete=function(t,e){var n=this.queryKeyForTag_(e);if(n){var r=Nl.parseQueryKey_(n),i=r.path,o=r.queryId,s=Pu.relativePath(i,t),a=new Hh(Fh.forServerTaggedQuery(o),s);return this.applyTaggedOperation_(i,a)}return[]},Nl.prototype.addEventRegistration=function(t,e){var r=t.path,i=null,o=!1;this.syncPointTree_.foreachOnPath(r,function(t,e){var n=Pu.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(Pu.Empty)):(s=new ml,this.syncPointTree_=this.syncPointTree_.set(r,s)),null!=i?n=!0:(n=!1,i=Jc.EMPTY_NODE,this.syncPointTree_.subtree(r).foreachChild(function(t,e){var n=e.getCompleteServerCache(Pu.Empty);n&&(i=i.updateImmediateChild(t,n))}));var a=s.viewExistsForQuery(t);if(!a&&!t.getQueryParams().loadsAllData()){var u=Nl.makeQueryKey_(t);Ds(!this.queryToTagMap.has(u),"View does not exist, but we have a tag");var c=Nl.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},Nl.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(Nl.queryForListening_(v),this.tagForQuery_(v),y.hashFn,y.onComplete)}}!h&&0<u.length&&!n&&(c?this.listenProvider_.stopListening(Nl.queryForListening_(t),null):u.forEach(function(t){var e=r.queryToTagMap.get(Nl.makeQueryKey_(t));r.listenProvider_.stopListening(Nl.queryForListening_(t),e)})),this.removeTags_(u)}return s},Nl.prototype.calcCompleteEventCache=function(i,t){var e=this.pendingWriteTree_,n=this.syncPointTree_.findOnPath(i,function(t,e){var n=Pu.relativePath(t,i),r=e.getCompleteServerCache(n);if(r)return r});return e.calcCompleteEventCache(i,n,t,!0)},Nl.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})},Nl.prototype.removeTags_=function(t){for(var e=0;e<t.length;++e){var n=t[e];if(!n.getQueryParams().loadsAllData()){var r=Nl.makeQueryKey_(n),i=this.queryToTagMap.get(r);this.queryToTagMap.delete(r),this.tagToQueryMap.delete(i)}}},Nl.queryForListening_=function(t){return t.getQueryParams().loadsAllData()&&!t.getQueryParams().isDefault()?t.getRef():t},Nl.prototype.setupListener_=function(t,e){var n=t.path,r=this.tagForQuery_(t),i=this.createListenerForView_(e),o=this.listenProvider_.startListening(Nl.queryForListening_(t),r,i.hashFn,i.onComplete),s=this.syncPointTree_.subtree(n);if(r)Ds(!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(Nl.queryForListening_(c),this.tagForQuery_(c))}return o},Nl.prototype.createListenerForView_=function(t){var n=this,r=t.getQuery(),i=this.tagForQuery_(r);return{hashFn:function(){return(t.getServerCache()||Jc.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)}}},Nl.makeQueryKey_=function(t){return t.path.toString()+"$"+t.queryIdentifier()},Nl.parseQueryKey_=function(t){var e=t.indexOf("$");return Ds(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new Pu(t.substr(0,e))}},Nl.prototype.queryKeyForTag_=function(t){return this.tagToQueryMap.get(t)},Nl.prototype.tagForQuery_=function(t){var e=Nl.makeQueryKey_(t);return this.queryToTagMap.get(e)},Nl.getNextQueryTag_=function(){return Nl.nextQueryTag_++},Nl.prototype.applyTaggedOperation_=function(t,e){var n=this.syncPointTree_.get(t);Ds(n,"Missing sync point for query tag that we're tracking");var r=this.pendingWriteTree_.childWrites(t);return n.applyOperation(e,r,null)},Nl.prototype.applyOperationToSyncPoints_=function(t){return this.applyOperationHelper_(t,this.syncPointTree_,null,this.pendingWriteTree_.childWrites(Pu.Empty))},Nl.prototype.applyOperationHelper_=function(t,e,n,r){if(t.path.isEmpty())return this.applyOperationDescendantsHelper_(t,e,n,r);var i=e.get(Pu.Empty);null==n&&null!=i&&(n=i.getCompleteServerCache(Pu.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},Nl.prototype.applyOperationDescendantsHelper_=function(o,t,s,a){var u=this,e=t.get(Pu.Empty);null==s&&null!=e&&(s=e.getCompleteServerCache(Pu.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},Nl.nextQueryTag_=1,Nl);function Nl(t){this.listenProvider_=t,this.syncPointTree_=Bh.Empty,this.pendingWriteTree_=new El,this.tagToQueryMap=new Map,this.queryToTagMap=new Map}var Al=(kl.prototype.getNode=function(t){return this.rootNode_.getChild(t)},kl.prototype.updateSnapshot=function(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)},kl);function kl(){this.rootNode_=Jc.EMPTY_NODE}var Ol=(Rl.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)},Rl.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)}))},Rl.prototype.removeTokenChangeListener=function(e){this.authProvider_.get().then(function(t){return t.removeAuthTokenListener(e)})},Rl.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)},Rl);function Rl(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 Pl=(Dl.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),Zs(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},Dl.prototype.get=function(){return Ms(this.counters_)},Dl);function Dl(){this.counters_={}}var xl=(Ll.getCollection=function(t){var e=t.toString();return this.collections_[e]||(this.collections_[e]=new Pl),this.collections_[e]},Ll.getOrCreateReporter=function(t,e){var n=t.toString();return this.reporters_[n]||(this.reporters_[n]=e()),this.reporters_[n]},Ll.collections_={},Ll.reporters_={},Ll);function Ll(){}var Ml=(Fl.prototype.get=function(){var t=this.collection_.get(),n=Ts({},t);return this.last_&&Cu(this.last_,function(t,e){n[t]=n[t]-e}),this.last_=t,n},Fl);function Fl(t){this.collection_=t,this.last_=null}var Ul=(jl.prototype.includeStat=function(t){this.statsToReport_[t]=!0},jl.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))},jl);function jl(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new Ml(t);var n=1e4+2e4*Math.random();ku(this.reportStats_.bind(this),Math.floor(n))}var Vl=(ql.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 Bl(i)),e.add(r)}e&&this.eventLists_.push(e)},ql.prototype.raiseEventsAtPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_(function(t){return t.equals(e)})},ql.prototype.raiseEventsForChangedPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_(function(t){return t.contains(e)||e.contains(t)})},ql.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_--},ql);function ql(){this.eventLists_=[],this.recursionDepth_=0}var Bl=(Wl.prototype.add=function(t){this.events_.push(t)},Wl.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();_u&&ou("event: "+e.toString()),Au(n)}}},Wl.prototype.getPath=function(){return this.path_},Wl);function Wl(t){this.path_=t,this.events_=[]}var Hl=(Gl.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)},Gl.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)},Gl.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)},Gl.prototype.validateEventType_=function(e){Ds(this.allowedEvents_.find(function(t){return t===e}),"Unknown event: "+e)},Gl);function Gl(t){this.allowedEvents_=t,this.listeners_={},Ds(Array.isArray(t)&&0<t.length,"Requires a non-empty array")}var zl,Ql=(Es(Yl,zl=Hl),Yl.getInstance=function(){return new Yl},Yl.prototype.getInitialEvent=function(t){return Ds("visible"===t,"Unknown event type: "+t),[this.visible_]},Yl);function Yl(){var e,t,n=zl.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 Xl,$l=(Es(Jl,Xl=Hl),Jl.getInstance=function(){return new Jl},Jl.prototype.getInitialEvent=function(t){return Ds("online"===t,"Unknown event type: "+t),[this.online_]},Jl.prototype.currentlyOnline=function(){return this.online_},Jl);function Jl(){var t=Xl.call(this,["online"])||this;return t.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||qs()||(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 Zl=(tf.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},tf.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(););},tf);function tf(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}var ef=(nf.prototype.open=function(t,e){var s=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new Zl(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 rf(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(){})}})},nf.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},nf.forceAllow=function(){nf.forceAllow_=!0},nf.forceDisallow=function(){nf.forceDisallow_=!0},nf.isAvailable=function(){return!!nf.forceAllow_||!(nf.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)},nf.prototype.markConnectionHealthy=function(){},nf.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)},nf.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},nf.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},nf.prototype.send=function(t){var e=$s(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);for(var n,r=(n=Os(e),Ls.encodeByteArray(n,!0)),i=pu(r,1840),o=0;o<i.length;o++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,i.length,i[o]),this.curSegmentNum++},nf.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)},nf.prototype.incrementIncomingBytes_=function(t){var e=$s(t).length;this.bytesReceived+=e,this.stats_.incrementCounter("bytes_received",e)},nf);function nf(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_=xl.getCollection(e),this.urlFn=function(t){return e.connectionURL(Uu,t)}}var rf=(of.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},of.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())},of.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},of.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},of.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},of.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()})},of.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))},of);function of(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=of.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 sf="";var af=null;"undefined"!=typeof MozWebSocket?af=MozWebSocket:"undefined"!=typeof WebSocket&&(af=WebSocket);var uf=(cf.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)},cf.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=Ps.NODE_ADMIN?"AdminNode":"Node",i={headers:{"User-Agent":"Firebase/5/"+sf+"/"+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 af(this.connURL,[],i)}else this.mySock=new af(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_()}},cf.prototype.start=function(){},cf.forceDisallow=function(){cf.forceDisallow_=!0},cf.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!==af&&!cf.forceDisallow_},cf.previouslyFailed=function(){return vu.isInMemoryStorage||!0===vu.get("previous_websocket_failure")},cf.prototype.markConnectionHealthy=function(){vu.remove("previous_websocket_failure")},cf.prototype.appendFrame_=function(t){if(this.frames.push(t),this.frames.length===this.totalFrames){var e=this.frames.join("");this.frames=null;var n=Xs(e);this.onMessage(n)}},cf.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},cf.prototype.extractFrameCount_=function(t){if(Ds(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},cf.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)}}},cf.prototype.send=function(t){this.resetKeepAlive();var e=$s(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])},cf.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},cf.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},cf.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},cf.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(function(){t.mySock&&t.sendString_("0"),t.resetKeepAlive()},Math.floor(45e3))},cf.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)}},cf.responsesRequiredToBeHealthy=2,cf.healthyTimeout=3e4,cf);function cf(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_=xl.getCollection(e),this.connURL=cf.connectionURL_(e,n,r)}var hf=(Object.defineProperty(lf,"ALL_TRANSPORTS",{get:function(){return[ef,uf]},enumerable:!0,configurable:!0}),lf.prototype.initTransports_=function(t){var e,n,r=uf&&uf.isAvailable(),i=r&&!uf.previouslyFailed();if(t.webSocketOnly&&(r||cu("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)this.transports_=[uf];else{var o=this.transports_=[];try{for(var s=Cs(lf.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}}}},lf.prototype.initialTransport=function(){if(0<this.transports_.length)return this.transports_[0];throw new Error("No transports available")},lf.prototype.upgradeTransport=function(){return 1<this.transports_.length?this.transports_[1]:null},lf);function lf(t){this.initTransports_(t)}var ff=(pf.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)))},pf.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},pf.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")}},pf.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"))}},pf.prototype.sendRequest=function(t){var e={t:"d",d:t};this.sendData_(e)},pf.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)},pf.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_())}},pf.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)}},pf.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:{}}}))},pf.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()},pf.prototype.onPrimaryMessageReceived_=function(t){var e=fu("t",t),n=fu("d",t);"c"===e?this.onControl_(n):"d"===e&&this.onDataMessage_(n)},pf.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},pf.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},pf.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)}},pf.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_())},pf.prototype.tryStartUpgrade_=function(){var t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)},pf.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))},pf.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_())},pf.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))},pf.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},pf.prototype.onSecondaryConnectionLost_=function(){var t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()},pf.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()},pf.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()},pf.prototype.sendData_=function(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)},pf.prototype.close=function(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))},pf.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)},pf);function pf(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 hf(e),this.log_("Connection created"),this.start_()}var df=(vf.prototype.put=function(t,e,n,r){},vf.prototype.merge=function(t,e,n,r){},vf.prototype.refreshAuthToken=function(t){},vf.prototype.onDisconnectPut=function(t,e,n){},vf.prototype.onDisconnectMerge=function(t,e,n){},vf.prototype.onDisconnectCancel=function(t,e){},vf.prototype.reportStats=function(t){},vf);function vf(){}var yf,gf=(Es(mf,yf=df),mf.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,i={r:r,a:t,b:e};this.log_($s(i)),Ds(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),n&&(this.requestCBHash_[r]=n)},mf.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),Ds(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),Ds(!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)},mf.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;mf.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))})},mf.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.")}}},mf.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)},mf.prototype.reduceReconnectDelayIfAdminCredential_=function(t){var e;(t&&40===t.length||"object"==typeof(e=Js(t).claims)&&!0===e.admin)&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},mf.prototype.tryAuth=function(){var t,r=this;if(this.connected_&&this.authToken_){var i=this.authToken_,e=(t=Js(i).claims)&&"object"==typeof t&&t.hasOwnProperty("iat")?"auth":"gauth",n={cred:i};null===this.authOverride_?n.noauth=!0:"object"==typeof this.authOverride_&&(n.authvar=this.authOverride_),this.sendRequest(e,n,function(t){var e=t.s,n=t.d||"error";r.authToken_===i&&("ok"===e?r.invalidAuthTokenCount_=0:r.onAuthRevoked_(e,n))})}},mf.prototype.unlisten=function(t,e){var n=t.path.toString(),r=t.queryIdentifier();this.log_("Unlisten called for "+n+" "+r),Ds(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)},mf.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)},mf.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})},mf.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})},mf.prototype.onDisconnectCancel=function(t,e){this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},mf.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))})},mf.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},mf.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},mf.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)},mf.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)})},mf.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)}})}},mf.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+$s(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)}},mf.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: "+$s(t)+"\nAre you using the latest client?")},mf.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)},mf.prototype.scheduleConnect_=function(t){var e=this;Ds(!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))},mf.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},mf.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())},mf.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)},mf.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+":"+mf.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){Ds(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 ff(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()})}},mf.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_())},mf.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))},mf.prototype.handleTimestamp_=function(t){var e=t-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:e})},mf.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_=[])},mf.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")},mf.prototype.removeListen_=function(t,e){var n,r=new Pu(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},mf.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()))},mf.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},mf.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)}},mf.prototype.sendConnectStats_=function(){var t={};t["sdk.js."+sf.replace(/\./g,"-")]=1,qs()?t["framework.cordova"]=1:Bs()&&(t["framework.reactnative"]=1),this.reportStats(t)},mf.prototype.shouldReconnect_=function(){var t=$l.getInstance().currentlyOnline();return ea(this.interruptReasons_)&&t},mf.nextPersistentConnectionId_=0,mf.nextConnectionId_=0,mf);function mf(t,e,n,r,i,o){var s=yf.call(this)||this;if(s.repoInfo_=t,s.onDataUpdate_=e,s.onConnectStatus_=n,s.onServerInfoUpdate_=r,s.authTokenProvider_=i,s.authOverride_=o,s.id=mf.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),Ql.getInstance().on("visible",s.onVisible_,s),-1===t.host.indexOf("fblocal")&&$l.getInstance().on("online",s.onOnline_,s),s}var bf,_f=(Es(wf,bf=df),wf.prototype.reportStats=function(t){throw new Error("Method not implemented.")},wf.getListenId_=function(t,e){return void 0!==e?"tag$"+e:(Ds(t.getQueryParams().isDefault(),"should have a tag if it's not a default query."),t.path.toString())},wf.prototype.listen=function(t,e,r,i){var o=this,s=t.path.toString();this.log_("Listen called for "+s+" "+t.queryIdentifier());var a=wf.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)})},wf.prototype.unlisten=function(t,e){var n=wf.getListenId_(t,e);delete this.listens_[n]},wf.prototype.refreshAuthToken=function(t){},wf.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=Xs(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()})},wf);function wf(t,e,n){var r=bf.call(this)||this;return r.repoInfo_=t,r.onDataUpdate_=e,r.authTokenProvider_=n,r.log_=su("p:rest:"),r.listens_={},r}var Ef="repo_interrupt",Tf=(If.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},If.prototype.name=function(){return this.repoInfo_.namespace},If.prototype.serverTime=function(){var t=this.infoData_.getNode(new Pu(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t},If.prototype.generateServerValues=function(){return(t=t={timestamp:this.serverTime()}).timestamp=t.timestamp||(new Date).getTime(),t;var t},If.prototype.onDataUpdate_=function(t,e,n,r){this.dataUpdateCount++;var i=new Pu(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)},If.prototype.interceptServerData_=function(t){this.interceptServerDataCallback_=t},If.prototype.onConnectStatus_=function(t){this.updateInfo_("connected",t),!1===t&&this.runOnDisconnectEvents_()},If.prototype.onServerInfoUpdate_=function(t){var n=this;Cu(t,function(t,e){n.updateInfo_(t,e)})},If.prototype.updateInfo_=function(t,e){var n=new Pu("/.info/"+t),r=ih(e);this.infoData_.updateSnapshot(n,r);var i=this.infoSyncTree_.applyServerOverwrite(n,r);this.eventQueue_.raiseEventsForChangedPath(n,i)},If.prototype.getNextWriteId_=function(){return this.nextWriteId_++},If.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=this.serverSyncTree_.calcCompleteEventCache(i),u=Ah(r,a,n),c=this.getNextWriteId_(),h=this.serverSyncTree_.applyUserOverwrite(i,u,c,!0);this.eventQueue_.queueEvents(h),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(c,!n);s.eventQueue_.raiseEventsForChangedPath(i,r),s.callOnCompleteCallback(o,t,e)});var l=this.abortTransactions_(i);this.rerunTransactions_(l),this.eventQueue_.raiseEventsForChangedPath(l,[])},If.prototype.update=function(o,t,s){var a=this;this.log_("update",{path:o.toString(),value:t});var n=!0,r=this.generateServerValues(),i={};if(Cu(t,function(t,e){n=!1,i[t]=Nh(o.child(t),ih(e),a.serverSyncTree_,r)}),n)ou("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(s,"ok");else{var u=this.getNextWriteId_(),e=this.serverSyncTree_.applyUserMerge(o,i,u);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(u,!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,[])}},If.prototype.runOnDisconnectEvents_=function(){var r=this;this.log_("onDisconnectEvents");var i=this.generateServerValues(),o=new Lh;this.onDisconnect_.forEachTree(Pu.Empty,function(t,e){var n=Nh(t,e,r.serverSyncTree_,i);o.remember(t,n)});var s=[];o.forEachTree(Pu.Empty,function(t,e){s=s.concat(r.serverSyncTree_.applyServerOverwrite(t,e));var n=r.abortTransactions_(t);r.rerunTransactions_(n)}),this.onDisconnect_=new Lh,this.eventQueue_.raiseEventsForChangedPath(Pu.Empty,s)},If.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)})},If.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)})},If.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)})},If.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)})},If.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)},If.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)},If.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt(Ef)},If.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume(Ef)},If.prototype.stats=function(t){if(void 0===t&&(t=!1),"undefined"!=typeof console){var e;e=t?(this.statsListener_||(this.statsListener_=new Ml(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)})}},If.prototype.statsIncrementCounter=function(t){this.stats_.incrementCounter(t),this.statsReporter_.includeStat(t)},If.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))},If.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(If.prototype,"database",{get:function(){return this.__database||(this.__database=new Wf(this))},enumerable:!0,configurable:!0}),If);function If(t,e,n,r){var s=this;this.repoInfo_=t,this.app=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Vl,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new Lh,this.persistentConnection_=null;var i=new Ol(n,r);if(this.stats_=xl.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 _f(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{$s(o)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}this.persistentConnection_=new gf(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_=xl.getOrCreateReporter(t,function(){return new Ul(s.stats_,s.server_)}),this.transactionsInit_(),this.infoData_=new Al,this.infoSyncTree_=new Cl({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 Cl({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 Sf=(Cf.prototype.getStartPost=function(){return this.startPost_},Cf.prototype.getEndPost=function(){return this.endPost_},Cf.prototype.matches=function(t){return this.index_.compare(this.getStartPost(),t)<=0&&this.index_.compare(t,this.getEndPost())<=0},Cf.prototype.updateChild=function(t,e,n,r,i,o){return this.matches(new fc(e,n))||(n=Jc.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,r,i,o)},Cf.prototype.updateFullNode=function(t,e,n){e.isLeafNode()&&(e=Jc.EMPTY_NODE);var r=e.withIndex(this.index_);r=r.updatePriority(Jc.EMPTY_NODE);var i=this;return e.forEachChild(Rc,function(t,e){i.matches(new fc(t,e))||(r=r.updateImmediateChild(t,Jc.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,r,n)},Cf.prototype.updatePriority=function(t,e){return t},Cf.prototype.filtersNodes=function(){return!0},Cf.prototype.getIndexedFilter=function(){return this.indexedFilter_},Cf.prototype.getIndex=function(){return this.index_},Cf.getStartPost_=function(t){if(t.hasStart()){var e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()},Cf.getEndPost_=function(t){if(t.hasEnd()){var e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()},Cf);function Cf(t){this.indexedFilter_=new nl(t.getIndex()),this.index_=t.getIndex(),this.startPost_=Cf.getStartPost_(t),this.endPost_=Cf.getEndPost_(t)}var Nf=(Af.prototype.updateChild=function(t,e,n,r,i,o){return this.rangedFilter_.matches(new fc(e,n))||(n=Jc.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)},Af.prototype.updateFullNode=function(t,e,n){var r;if(e.isLeafNode()||e.isEmpty())r=Jc.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<e.numChildren()&&e.isIndexed(this.index_)){r=Jc.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(Jc.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,Jc.EMPTY_NODE)}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,r,n)},Af.prototype.updatePriority=function(t,e){return t},Af.prototype.filtersNodes=function(){return!0},Af.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},Af.prototype.getIndex=function(){return this.index_},Af.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;Ds(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(tl.childChangedChange(e,n,l)),a.updateImmediateChild(e,n);null!=i&&i.trackChildChange(tl.childRemovedChange(e,l));var d=a.updateImmediateChild(e,Jc.EMPTY_NODE);return null!=f&&this.rangedFilter_.matches(f)?(null!=i&&i.trackChildChange(tl.childAddedChange(f.name,f.node)),d.updateImmediateChild(f.name,f.node)):d}return!n.isEmpty()&&h&&0<=o(c,u)?(null!=i&&(i.trackChildChange(tl.childRemovedChange(c.name,c.node)),i.trackChildChange(tl.childAddedChange(e,n))),a.updateImmediateChild(e,n).updateImmediateChild(c.name,Jc.EMPTY_NODE)):t},Af);function Af(t){this.rangedFilter_=new Sf(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft()}var kf=(Of.prototype.hasStart=function(){return this.startSet_},Of.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===Of.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},Of.prototype.getIndexStartValue=function(){return Ds(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},Of.prototype.getIndexStartName=function(){return Ds(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Eu},Of.prototype.hasEnd=function(){return this.endSet_},Of.prototype.getIndexEndValue=function(){return Ds(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},Of.prototype.getIndexEndName=function(){return Ds(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Tu},Of.prototype.hasLimit=function(){return this.limitSet_},Of.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},Of.prototype.getLimit=function(){return Ds(this.limitSet_,"Only valid if limit has been set"),this.limit_},Of.prototype.getIndex=function(){return this.index_},Of.prototype.copy_=function(){var t=new Of;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},Of.prototype.limit=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_="",e},Of.prototype.limitToFirst=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_=Of.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,e},Of.prototype.limitToLast=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_=Of.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,e},Of.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},Of.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},Of.prototype.orderBy=function(t){var e=this.copy_();return e.index_=t,e},Of.prototype.getQueryObject=function(){var t=Of.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_!==Rc&&(e[t.INDEX]=this.index_.toString()),e},Of.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},Of.prototype.isDefault=function(){return this.loadsAllData()&&this.index_===Rc},Of.prototype.getNodeFilter=function(){return this.loadsAllData()?new nl(this.getIndex()):new(this.hasLimit()?Nf:Sf)(this)},Of.prototype.toRestQueryStringParameters=function(){var t,e=Of.REST_QUERY_CONSTANTS_,n={};return this.isDefault()||(t=this.index_===Rc?e.PRIORITY_INDEX:this.index_===ah?e.VALUE_INDEX:this.index_===wc?e.KEY_INDEX:(Ds(this.index_ instanceof uh,"Unrecognized index type!"),this.index_.toString()),n[e.ORDER_BY]=$s(t),this.startSet_&&(n[e.START_AT]=$s(this.indexStartValue_),this.startNameSet_&&(n[e.START_AT]+=","+$s(this.indexStartName_))),this.endSet_&&(n[e.END_AT]=$s(this.indexEndValue_),this.endNameSet_&&(n[e.END_AT]+=","+$s(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?n[e.LIMIT_TO_FIRST]=this.limit_:n[e.LIMIT_TO_LAST]=this.limit_)),n},Of.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"},Of.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"},Of.DEFAULT=new Of,Of);function Of(){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_=Rc}var Rf,Pf=(Es(Df,Rf=wh),Df.prototype.getKey=function(){return ca("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},Df.prototype.child=function(t){var e,n,r,i;return ca("Reference.child",1,1,arguments.length),"number"==typeof t?t=String(t):t instanceof Pu||(null===this.path.getFront()?(e="Reference.child",i=!(n=1),r=(r=t)&&r.replace(/^\/*\.info(\/|$)/,"/"),Xu(e,n,r,i)):Xu("Reference.child",1,t,!1)),new Df(this.repo,this.path.child(t))},Df.prototype.getParent=function(){ca("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new Df(this.repo,t)},Df.prototype.getRoot=function(){ca("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},Df.prototype.databaseProp=function(){return this.repo.database},Df.prototype.set=function(t,e){ca("Reference.set",1,2,arguments.length),$u("Reference.set",this.path),Gu("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},Df.prototype.update=function(t,e){if(ca("Reference.update",1,2,arguments.length),$u("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.")}zu("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},Df.prototype.setWithPriority=function(t,e,n){if(ca("Reference.setWithPriority",2,3,arguments.length),$u("Reference.setWithPriority",this.path),Gu("Reference.setWithPriority",1,t,this.path,!1),Ku("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},Df.prototype.remove=function(t){return ca("Reference.remove",0,1,arguments.length),$u("Reference.remove",this.path),la("Reference.remove",1,t,!0),this.set(null,t)},Df.prototype.transaction=function(t,r,e){if(ca("Reference.transaction",1,3,arguments.length),$u("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},Df.prototype.setPriority=function(t,e){ca("Reference.setPriority",1,2,arguments.length),$u("Reference.setPriority",this.path),Ku("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},Df.prototype.push=function(t,e){ca("Reference.push",0,2,arguments.length),$u("Reference.push",this.path),Gu("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},Df.prototype.onDisconnect=function(){return $u("Reference.onDisconnect",this.path),new ic(this.repo,this.path)},Object.defineProperty(Df.prototype,"database",{get:function(){return this.databaseProp()},enumerable:!0,configurable:!0}),Object.defineProperty(Df.prototype,"key",{get:function(){return this.getKey()},enumerable:!0,configurable:!0}),Object.defineProperty(Df.prototype,"parent",{get:function(){return this.getParent()},enumerable:!0,configurable:!0}),Object.defineProperty(Df.prototype,"root",{get:function(){return this.getRoot()},enumerable:!0,configurable:!0}),Df);function Df(t,e){if(!(t instanceof Tf))throw new Error("new Reference() no longer supported - use app.database().");return Rf.call(this,t,e,kf.DEFAULT,!1)||this}wh.__referenceConstructor=Pf,ml.__referenceConstructor=Pf;var xf,Lf,Mf=function(){this.children={},this.childCount=0,this.value=null},Ff=(Uf.prototype.subTree=function(t){for(var e=t instanceof Pu?t:new Pu(t),n=this,r=e.getFront();null!==r;)n=new Uf(r,n,ta(n.node_.children,r)||new Mf),r=(e=e.popFront()).getFront();return n},Uf.prototype.getValue=function(){return this.node_.value},Uf.prototype.setValue=function(t){Ds(void 0!==t,"Cannot set value to undefined"),this.node_.value=t,this.updateParents_()},Uf.prototype.clear=function(){this.node_.value=null,this.node_.children={},this.node_.childCount=0,this.updateParents_()},Uf.prototype.hasChildren=function(){return 0<this.node_.childCount},Uf.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},Uf.prototype.forEachChild=function(n){var r=this;Cu(this.node_.children,function(t,e){n(new Uf(t,r,e))})},Uf.prototype.forEachDescendant=function(e,t,n){t&&!n&&e(this),this.forEachChild(function(t){t.forEachDescendant(e,!0,n)}),t&&n&&e(this)},Uf.prototype.forEachAncestor=function(t,e){for(var n=e?this:this.parent();null!==n;){if(t(n))return!0;n=n.parent()}return!1},Uf.prototype.forEachImmediateDescendantWithValue=function(e){this.forEachChild(function(t){null!==t.getValue()?e(t):t.forEachImmediateDescendantWithValue(e)})},Uf.prototype.path=function(){return new Pu(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)},Uf.prototype.name=function(){return this.name_},Uf.prototype.parent=function(){return this.parent_},Uf.prototype.updateParents_=function(){null!==this.parent_&&this.parent_.updateChild_(this.name_,this)},Uf.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_())},Uf);function Uf(t,e,n){void 0===t&&(t=""),void 0===e&&(e=null),void 0===n&&(n=new Mf),this.name_=t,this.parent_=e,this.node_=n}(Lf=xf=xf||{})[Lf.RUN=0]="RUN",Lf[Lf.SENT=1]="SENT",Lf[Lf.COMPLETED=2]="COMPLETED",Lf[Lf.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",Lf[Lf.NEEDS_ABORT=4]="NEEDS_ABORT",Tf.MAX_TRANSACTION_RETRIES_=25,Tf.prototype.transactionsInit_=function(){this.transactionQueueTree_=new Ff},Tf.prototype.startTransaction=function(t,e,n,r){this.log_("transaction on "+t);function i(){}var o=new Pf(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 Pf(this,s.path),Rc);s.onComplete(null,!1,c)}}else{rc("transaction failed: Data returned ",u,s.path),s.status=xf.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"),Ds(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)||Jc.EMPTY_NODE).getPriority().val();f=f;var p=this.generateServerValues(),d=ih(u,f),v=Ah(d,a,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_()}},Tf.prototype.getLatestState_=function(t,e){return this.serverSyncTree_.calcCompleteEventCache(t,e)||Jc.EMPTY_NODE},Tf.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);Ds(0<n.length,"Sending zero length transaction queue"),n.every(function(t){return t.status===xf.RUN})&&this.sendTransactionQueue_(t.path(),n)}else t.hasChildren()&&t.forEachChild(function(t){e.sendReadyTransactions_(t)})},Tf.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];Ds(o.status===xf.RUN,"tryToSendTransactionQueue_: items in queue should all be run."),o.status=xf.SENT,o.retryCount++;var s=Pu.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=xf.COMPLETED,e=e.concat(c.serverSyncTree_.ackUserWrite(u[r].currentWriteId)),u[r].onComplete){var i=u[r].currentOutputSnapshotResolved,o=new Pf(c,u[r].path),s=new hh(i,o,Rc);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===xf.SENT_NEEDS_ABORT?u[r].status=xf.NEEDS_ABORT:u[r].status=xf.RUN;else{cu("transaction at "+l.toString()+" failed: "+t);for(r=0;r<u.length;r++)u[r].status=xf.NEEDS_ABORT,u[r].abortReason=t}c.rerunTransactions_(a)}},r)},Tf.prototype.rerunTransactions_=function(t){var e=this.getAncestorTransactionNode_(t),n=e.path(),r=this.buildTransactionQueue_(e);return this.rerunTransactionQueue_(r,n),n},Tf.prototype.rerunTransactionQueue_=function(t,e){if(0!==t.length){for(var n,r=[],i=[],o=t.filter(function(t){return t.status===xf.RUN}).map(function(t){return t.currentWriteId}),s=0;s<t.length;s++){var a=t[s],u=Pu.relativePath(e,a.path),c=!1,h=void 0;if(Ds(null!==u,"rerunTransactionsUnderNode_: relativePath should not be null."),a.status===xf.NEEDS_ABORT)c=!0,h=a.abortReason,i=i.concat(this.serverSyncTree_.ackUserWrite(a.currentWriteId,!0));else if(a.status===xf.RUN)if(a.retryCount>=Tf.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,l,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=xf.COMPLETED,n=t[s].unwatcher,setTimeout(n,Math.floor(0)),t[s].onComplete))if("nodata"===h){var g=new Pf(this,t[s].path),m=t[s].currentInputSnapshot,b=new hh(m,g,Rc);r.push(t[s].onComplete.bind(null,null,!1,b))}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_()}},Tf.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},Tf.prototype.buildTransactionQueue_=function(t){var e=[];return this.aggregateTransactionQueuesForNode_(t,e),e.sort(function(t,e){return t.order-e.order}),e},Tf.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)})},Tf.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!==xf.COMPLETED&&(n[r]=n[i],r++);n.length=r,t.setValue(0<n.length?n:null)}t.forEachChild(function(t){e.pruneCompletedTransactionsBelowNode_(t)})},Tf.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},Tf.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!==xf.SENT_NEEDS_ABORT)if(e[o].status===xf.SENT)Ds(i===o-1,"All SENT items should be at beginning of queue."),e[i=o].status=xf.SENT_NEEDS_ABORT,e[o].abortReason="set";else if(Ds(e[o].status===xf.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 jf,Vf="databaseURL",qf=(Bf.getInstance=function(){return jf=jf||new Bf},Bf.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}}},Bf.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}}},Bf.prototype.databaseFromApp=function(t,e,n){var r=n||t.options[Vf];void 0===r&&uu("Can't determine Firebase Database URL. Be sure to include "+Vf+" option when calling firebase.initializeApp().");var i=qu(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=qu(r)).repoInfo),Ju("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},Bf.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()]},Bf.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 Tf(t,this.useRestClient_,e,n),r[t.toURLString()]=i},Bf.prototype.forceRestClient=function(t){this.useRestClient_=t},Bf);function Bf(){this.repos_={},this.useRestClient_=!1}var Wf=(Object.defineProperty(Hf.prototype,"app",{get:function(){return this.repo_.app},enumerable:!0,configurable:!0}),Hf.prototype.ref=function(t){return this.checkDeleted_("ref"),ca("database.ref",0,1,arguments.length),t instanceof Pf?this.refFromURL(t.toString()):void 0!==t?this.root_.child(t):this.root_},Hf.prototype.refFromURL=function(t){var e="database.refFromURL";this.checkDeleted_(e),ca(e,1,1,arguments.length);var n=qu(t);Ju(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())},Hf.prototype.checkDeleted_=function(t){null===this.repo_&&uu("Cannot call "+t+" on a deleted database.")},Hf.prototype.goOffline=function(){ca("database.goOffline",0,0,arguments.length),this.checkDeleted_("goOffline"),this.repo_.interrupt()},Hf.prototype.goOnline=function(){ca("database.goOnline",0,0,arguments.length),this.checkDeleted_("goOnline"),this.repo_.resume()},Hf.ServerValue={TIMESTAMP:{".sv":"timestamp"},increment:function(t){return{".sv":{increment:t}}}},Hf);function Hf(t){(this.repo_=t)instanceof Tf||uu("Don't call new Database() directly - please use firebase.database()."),this.root_=new Pf(t,Pu.Empty),this.INTERNAL=new Gf(this)}var Gf=(zf.prototype.delete=function(){return Is(this,void 0,void 0,function(){return Ss(this,function(t){return this.database.checkDeleted_("delete"),qf.getInstance().deleteRepo(this.database.repo_),this.database.repo_=null,this.database.root_=null,this.database.INTERNAL=null,this.database=null,[2]})})},zf);function zf(t){this.database=t}var Kf=Object.freeze({__proto__:null,forceLongPolling:function(){uf.forceDisallow(),ef.forceAllow()},forceWebSockets:function(){ef.forceDisallow()},isWebSocketsAvailable:function(){return uf.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=gf;gf.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},gf.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};var Yf,Xf,$f=ff,Jf=ju,Zf=Object.freeze({__proto__:null,DataConnection:Qf,RealTimeConnection:$f,hijackHash:function(i){var o=gf.prototype.put;return gf.prototype.put=function(t,e,n,r){void 0!==r&&(r=i()),o.call(this,t,e,n,r)},function(){gf.prototype.put=o}},ConnectionTarget:Jf,queryIdentifier:function(t){return t.queryIdentifier()},forceRestClient:function(t){qf.getInstance().forceRestClient(t)}}),tp=Wf.ServerValue;function ep(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.")}Xf=(Yf=Kl).SDK_VERSION,sf=Xf,Yf.INTERNAL.registerComponent(new da("database",function(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal");return qf.getInstance().databaseFromApp(n,r,e)},"PUBLIC").setServiceProps({Reference:Pf,Query:wh,Database:Wf,DataSnapshot:hh,enableLogging:iu,INTERNAL:Kf,ServerValue:tp,TEST_ACCESS:Zf}).setMultipleInstances(!0)),Yf.registerVersion("@firebase/database","0.6.3");var np,rp="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ip=ip||{},op=rp||self;function sp(){}function ap(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 up(t){var e=ap(t);return"array"==e||"object"==e&&"number"==typeof t.length}function cp(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var hp="closure_uid_"+(1e9*Math.random()>>>0),lp=0;function fp(t,e,n){return t.call.apply(t.bind,arguments)}function pp(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 dp(t,e,n){return(dp=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?fp:pp).apply(null,arguments)}function vp(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 yp=Date.now||function(){return+new Date};function gp(t,e){function n(){}n.prototype=e.prototype,t.M=e.prototype,t.prototype=new n,t.prototype.constructor=t}function mp(){this.j=this.j,this.i=this.i}mp.prototype.j=!1,mp.prototype.da=function(){if(!this.j&&(this.j=!0,this.C(),0))t=this,Object.prototype.hasOwnProperty.call(t,hp)&&t[hp]||(t[hp]=++lp);var t},mp.prototype.C=function(){if(this.i)for(;this.i.length;)this.i.shift()()};var bp=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},_p=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)};function wp(){return Array.prototype.concat.apply([],arguments)}function Ep(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 Tp(t){return/^[\s\xa0]*$/.test(t)}var Ip,Sp=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Cp(t,e){return-1!=t.indexOf(e)}function Np(t,e){return t<e?-1:e<t?1:0}t:{var Ap=op.navigator;if(Ap){var kp=Ap.userAgent;if(kp){Ip=kp;break t}}Ip=""}function Op(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Rp(t){var e={};for(var n in t)e[n]=t[n];return e}var Pp="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Dp(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<Pp.length;i++)e=Pp[i],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function xp(t){return xp[" "](t),t}xp[" "]=sp;var Lp,Mp,Fp=Cp(Ip,"Opera"),Up=Cp(Ip,"Trident")||Cp(Ip,"MSIE"),jp=Cp(Ip,"Edge"),Vp=jp||Up,qp=Cp(Ip,"Gecko")&&!(Cp(Ip.toLowerCase(),"webkit")&&!Cp(Ip,"Edge"))&&!(Cp(Ip,"Trident")||Cp(Ip,"MSIE"))&&!Cp(Ip,"Edge"),Bp=Cp(Ip.toLowerCase(),"webkit")&&!Cp(Ip,"Edge");function Wp(){var t=op.document;return t?t.documentMode:void 0}t:{var Hp="",Gp=(Mp=Ip,qp?/rv:([^\);]+)(\)|;)/.exec(Mp):jp?/Edge\/([\d\.]+)/.exec(Mp):Up?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Mp):Bp?/WebKit\/(\S+)/.exec(Mp):Fp?/(?:Version)[ \/]?(\S+)/.exec(Mp):void 0);if(Gp&&(Hp=Gp?Gp[1]:""),Up){var zp=Wp();if(null!=zp&&zp>parseFloat(Hp)){Lp=String(zp);break t}}Lp=Hp}var Kp,Qp={};function Yp(a){return t=a,e=function(){for(var t=0,e=Sp(String(Lp)).split("."),n=Sp(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=Np(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||Np(0==o[2].length,0==s[2].length)||Np(o[2],s[2]),o=o[3],s=s[3]}while(0==t)}return 0<=t},n=Qp,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}if(op.document&&Up){var Xp=Wp();Kp=Xp||(parseInt(Lp,10)||void 0)}else Kp=void 0;var $p=Kp,Jp=!Up||9<=Number($p),Zp=Up&&!Yp("9"),td=function(){if(!op.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{op.addEventListener("test",sp,e),op.removeEventListener("test",sp,e)}catch(t){}return t}();function ed(t,e){this.type=t,this.a=this.target=e,this.defaultPrevented=!1}function nd(t,e){if(ed.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(qp){t:{try{xp(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:rd[t.pointerType]||"",(this.c=t).defaultPrevented&&this.b()}}ed.prototype.b=function(){this.defaultPrevented=!0},gp(nd,ed);var rd={2:"touch",3:"pen",4:"mouse"};nd.prototype.b=function(){nd.M.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 id="closure_listenable_"+(1e6*Math.random()|0),od=0;function sd(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.aa=i,this.key=++od,this.V=this.X=!1}function ad(t){t.V=!0,t.listener=null,t.proxy=null,t.src=null,t.aa=null}function ud(t){this.src=t,this.a={},this.b=0}function cd(t,e){var n=e.type;if(n in t.a){var r,i=t.a[n],o=bp(i,e);(r=0<=o)&&Array.prototype.splice.call(i,o,1),r&&(ad(e),0==t.a[n].length&&(delete t.a[n],t.b--))}}function hd(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.V&&o.listener==e&&o.capture==!!n&&o.aa==r)return i}return-1}ud.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=hd(t,e,r,i);return-1<s?(e=t[s],n||(e.X=!1)):((e=new sd(e,this.src,o,!!r,i)).X=n,t.push(e)),e};var ld="closure_lm_"+(1e6*Math.random()|0),fd={};function pd(t,e,n,r,i){if(r&&r.once)return function t(e,n,r,i,o){if(Array.isArray(n)){for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);return null}r=wd(r);return e&&e[id]?e.sa(n,r,cp(i)?!!i.capture:!!i,o):dd(e,n,r,!0,i,o)}(t,e,n,r,i);if(Array.isArray(e)){for(var o=0;o<e.length;o++)pd(t,e[o],n,r,i);return null}return n=wd(n),t&&t[id]?t.ra(e,n,cp(r)?!!r.capture:!!r,i):dd(t,e,n,!1,r,i)}function dd(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s=cp(i)?!!i.capture:!!i;if(s&&!Jp)return null;var a,u,c=bd(t);if(c||(t[ld]=c=new ud(t)),(n=c.add(e,n,r,s,o)).proxy)return n;if(a=md,r=u=Jp?function(t){return a.call(u.src,u.listener,t)}:function(t){if(!(t=a.call(u.src,u.listener,t)))return t},(n.proxy=r).src=t,r.listener=n,t.addEventListener)td||(i=s),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(yd(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function vd(t){if("number"!=typeof t&&t&&!t.V){var e=t.src;if(e&&e[id])cd(e.c,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(yd(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=bd(e))?(cd(n,t),0==n.b&&(n.src=null,e[ld]=null)):ad(t)}}}function yd(t){return t in fd?fd[t]:fd[t]="on"+t}function gd(t,e){var n=t.listener,r=t.aa||t.src;return t.X&&vd(t),n.call(r,e)}function md(t,e){if(t.V)return!0;if(Jp)return gd(t,new nd(e,this));if(!e)t:{e=["window","event"];for(var n=op,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}return gd(t,e=new nd(e,this))}function bd(t){return(t=t[ld])instanceof ud?t:null}var _d="__closure_events_fn_"+(1e9*Math.random()>>>0);function wd(e){return"function"==ap(e)?e:(e[_d]||(e[_d]=function(t){return e.handleEvent(t)}),e[_d])}function Ed(){mp.call(this),this.c=new ud(this),(this.J=this).A=null}function Td(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.V&&s.capture==n){var a=s.listener,u=s.aa||s.src;s.X&&cd(t.c,s),i=!1!==a.call(u,r)&&i}}return i&&!r.defaultPrevented}gp(Ed,mp),Ed.prototype[id]=!0,(np=Ed.prototype).addEventListener=function(t,e,n,r){pd(this,t,e,n,r)},np.removeEventListener=function(t,e,n,r){!function t(e,n,r,i,o){if(Array.isArray(n))for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);else i=cp(i)?!!i.capture:!!i,r=wd(r),e&&e[id]?(e=e.c,(n=String(n).toString())in e.a&&-1<(r=hd(s=e.a[n],r,i,o))&&(ad(s[r]),Array.prototype.splice.call(s,r,1),0==s.length&&(delete e.a[n],e.b--))):(e=e&&bd(e))&&(n=e.a[n.toString()],e=-1,n&&(e=hd(n,r,i,o)),(r=-1<e?n[e]:null)&&vd(r))}(this,t,e,n,r)},np.dispatchEvent=function(t){var e,n=this.A;if(n)for(e=[];n;n=n.A)e.push(n);n=this.J;var r=t.type||t;if("string"==typeof t)t=new ed(t,n);else if(t instanceof ed)t.target=t.target||n;else{var i=t;Dp(t=new ed(r,n),i)}if(i=!0,e)for(var o=e.length-1;0<=o;o--){var s=t.a=e[o];i=Td(s,r,!0,t)&&i}if(i=Td(s=t.a=n,r,!0,t)&&i,i=Td(s,r,!1,t)&&i,e)for(o=0;o<e.length;o++)i=Td(s=t.a=e[o],r,!1,t)&&i;return i},np.C=function(){if(Ed.M.C.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++)ad(n[r]);delete e.a[t],e.b--}}this.A=null},np.ra=function(t,e,n,r){return this.c.add(String(t),e,!1,n,r)},np.sa=function(t,e,n,r){return this.c.add(String(t),e,!0,n,r)};var Id=op.JSON.stringify;function Sd(){this.b=this.a=null}var Cd,Nd=(Ad.prototype.get=function(){var t;return 0<this.b?(this.b--,t=this.a,this.a=t.next,t.next=null):t=this.c(),t},new Ad(function(){return new kd},function(t){t.reset()},100));function Ad(t,e,n){this.f=n,this.c=t,this.g=e,this.b=0,this.a=null}function kd(){this.next=this.b=this.a=null}function Od(t){op.setTimeout(function(){throw t},0)}function Rd(t,e){var n;Cd||(n=op.Promise.resolve(void 0),Cd=function(){n.then(xd)}),Pd||(Cd(),Pd=!0),Dd.add(t,e)}Sd.prototype.add=function(t,e){var n=Nd.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},kd.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null};var Pd=!(kd.prototype.reset=function(){this.next=this.b=this.a=null}),Dd=new Sd;function xd(){for(var t;r=n=void 0,r=null,(n=Dd).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){Od(t)}var e=Nd;e.g(t),e.b<e.f&&(e.b++,t.next=e.a,e.a=t)}var n,r;Pd=!1}function Ld(t,e){Ed.call(this),this.b=t||1,this.a=e||op,this.f=dp(this.Ua,this),this.g=yp()}function Md(t){t.Z=!1,t.L&&(t.a.clearTimeout(t.L),t.L=null)}function Fd(t,e,n){if("function"==ap(t))n&&(t=dp(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=dp(t.handleEvent,t)}return 2147483647<Number(e)?-1:op.setTimeout(t,e||0)}function Ud(t,e,n){mp.call(this),this.f=null!=n?dp(t,n):t,this.c=e,this.b=dp(this.Pa,this),this.a=[]}function jd(t){t.T=Fd(t.b,t.c),t.f.apply(null,t.a)}function Vd(t){mp.call(this),this.b=t,this.a={}}gp(Ld,Ed),(np=Ld.prototype).Z=!1,np.L=null,np.Ua=function(){if(this.Z){var t=yp()-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.Z&&(Md(this),this.start()))}},np.start=function(){this.Z=!0,this.L||(this.L=this.a.setTimeout(this.f,this.b),this.g=yp())},np.C=function(){Ld.M.C.call(this),Md(this),delete this.a},gp(Ud,mp),(np=Ud.prototype).ba=!1,np.T=null,np.Ia=function(t){this.a=arguments,this.T?this.ba=!0:jd(this)},np.C=function(){Ud.M.C.call(this),this.T&&(op.clearTimeout(this.T),this.T=null,this.ba=!1,this.a=[])},np.Pa=function(){this.T=null,this.ba&&(this.ba=!1,jd(this))},gp(Vd,mp);var qd=[];function Bd(t,e,n,r){Array.isArray(n)||(n&&(qd[0]=n.toString()),n=qd);for(var i=0;i<n.length;i++){var o=pd(e,n[i],r||t.handleEvent,!1,t.b||t);if(!o)break;t.a[o.key]=o}}function Wd(t){Op(t.a,function(t,e){this.a.hasOwnProperty(e)&&vd(t)},t),t.a={}}function Hd(){}Vd.prototype.C=function(){Vd.M.C.call(this),Wd(this)},Vd.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Gd=null;function zd(){return Gd=Gd||new Ed}function Kd(t){ed.call(this,"serverreachability",t)}function Qd(t){var e=zd();e.dispatchEvent(new Kd(e))}function Yd(t){ed.call(this,"statevent",t)}function Xd(t){var e=zd();e.dispatchEvent(new Yd(e))}function $d(t){ed.call(this,"timingevent",t)}function Jd(t,e){if("function"!=ap(t))throw Error("Fn must not be null and must be a function");return op.setTimeout(function(){t()},e)}gp(Kd,ed),gp(Yd,ed),gp($d,ed);var Zd={NO_ERROR:0,Va:1,bb:2,ab:3,Ya:4,$a:5,cb:6,za:7,TIMEOUT:8,gb:9},tv={Xa:"complete",kb:"success",Aa:"error",za:"abort",ib:"ready",jb:"readystatechange",TIMEOUT:"timeout",eb:"incrementaldata",hb:"progress",Za:"downloadprogress",lb:"uploadprogress"};function ev(){}function nv(t){var e;return(e=t.a)||(e=t.a={}),e}function rv(){}ev.prototype.a=null;var iv,ov={OPEN:"a",Wa:"b",Aa:"c",fb:"d"};function sv(){ed.call(this,"d")}function av(){ed.call(this,"c")}function uv(){}function cv(t,e,n){this.g=t,this.W=e,this.U=n||1,this.G=new Vd(this),this.N=hv,t=Vp?125:void 0,this.O=new Ld(t),this.m=null,this.b=!1,this.j=this.A=this.f=this.B=this.s=this.P=this.h=null,this.i=[],this.a=null,this.w=0,this.c=this.v=null,this.H=-1,this.l=!1,this.J=0,this.D=null,this.o=this.R=this.F=!1}gp(sv,ed),gp(av,ed),gp(uv,ev),iv=new uv;var hv=45e3,lv={},fv={};function pv(t,e,n){t.B=1,t.f=Lv(kv(e)),t.j=n,t.F=!0,dv(t,null)}function dv(t,e){t.s=yp(),gv(t),t.A=kv(t.f);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),Qv(n.b,"t",r),t.w=0,t.a=jy(t.g,t.g.w?e:null),0<t.J&&(t.D=new Ud(dp(t.ya,t,t.a),t.J)),Bd(t.G,t.a,"readystatechange",t.Sa),e=t.m?Rp(t.m):{},t.j?(t.v||(t.v="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.a.$(t.A,t.v,t.j,e)):(t.v="GET",t.a.$(t.A,t.v,null,e)),Qd(1)}function vv(t,e,n){for(var r=!0;!t.l&&t.w<n.length;){var i=yv(t,n);if(i==fv){4==e&&(t.c=4,Xd(14),r=!1);break}if(i==lv){t.c=4,Xd(15),r=!1;break}Ev(t,i)}4==e&&0==n.length&&(t.c=1,Xd(16),r=!1),t.b=t.b&&r,r||(wv(t),_v(t))}function yv(t,e){var n=t.w,r=e.indexOf("\n",n);return-1==r?fv:(n=Number(e.substring(n,r)),isNaN(n)?lv:(r+=1)+n>e.length?fv:(e=e.substr(r,n),t.w=r+n,e))}function gv(t){t.P=yp()+t.N,mv(t,t.N)}function mv(t,e){if(null!=t.h)throw Error("WatchDog timer not null");t.h=Jd(dp(t.Qa,t),e)}function bv(t){t.h&&(op.clearTimeout(t.h),t.h=null)}function _v(t){0==t.g.u||t.l||xy(t.g,t)}function wv(t){bv(t);var e=t.D;e&&"function"==typeof e.da&&e.da(),t.D=null,Md(t.O),Wd(t.G),t.a&&(e=t.a,t.a=null,e.abort(),e.da())}function Ev(t,e){try{var n=t.g;if(0!=n.u&&(n.a==t||ey(n.b,t)))if(n.A=t.H,!t.o&&ey(n.b,t)&&3==n.u){try{var r=n.ja.a.parse(e)}catch(t){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.i){if(n.a){if(!(n.a.s+3e3<t.s))break t;Dy(n),n.a.cancel(),n.a=null}Py(n),Xd(18)}}else n.ia=i[1],0<n.ia-n.G&&i[2]<37500&&n.U&&0==n.m&&!n.l&&(n.l=Jd(dp(n.Na,n),6e3));if(ty(n.b)<=1&&n.O){try{n.O()}catch(t){}n.O=void 0}}else My(n,11)}else if(!t.o&&n.a!=t||Dy(n),!Tp(e))for(e=r=n.ja.a.parse(e),r=0;r<e.length;r++)if(i=e[r],n.G=i[0],i=i[1],2==n.u)if("c"==i[0]){n.B=i[1],n.R=i[2];var o=i[3];null!=o&&(n.oa=o);var s=i[5];null!=s&&"number"==typeof s&&0<s&&(n.D=1.5*s);var a=n,u=t.a;if(u){var c=u.a?u.a.getResponseHeader("X-Client-Wire-Protocol"):null;if(c){var h=a.b;!h.a&&(Cp(c,"spdy")||Cp(c,"quic")||Cp(c,"h2"))&&(h.f=h.g,h.a=new Set,h.b&&(ny(h,h.b),h.b=null))}if(a.s){var l=u.a?u.a.getResponseHeader("X-HTTP-Session-Id"):null;l&&(a.ha=l,xv(a.v,a.s,l))}}n.u=3,n.c&&n.c.na();var f=t;if((a=n).ea=Uy(a,a.w?a.R:null,a.P),f.o){ry(a.b,f);var p=f,d=a.D;d&&p.setTimeout(d),p.h&&(bv(p),gv(p)),a.a=f}else Ry(a);0<n.f.length&&Ny(n)}else"stop"!=i[0]&&"close"!=i[0]||My(n,7);else 3==n.u&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?My(n,7):Iy(n):"noop"!=i[0]&&n.c&&n.c.ma(i),n.m=0);Qd(4)}catch(t){}}function Tv(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(up(t)||"string"==typeof t)_p(t,e,void 0);else{if(t.K&&"function"==typeof t.K)var n=t.K();else if(t.I&&"function"==typeof t.I)n=void 0;else if(up(t)||"string"==typeof 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.I&&"function"==typeof t.I)return t.I();if("string"==typeof t)return t.split("");if(up(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 Iv(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 Iv)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 Sv(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];Cv(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;)Cv(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function Cv(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(np=cv.prototype).setTimeout=function(t){this.N=t},np.Sa=function(t){t=t.target;var e=this.D;e&&3==_y(t)?e.Ia():this.ya(t)},np.ya=function(t){try{if(t==this.a)t:{var e=_y(this.a),n=this.a.qa(),r=this.a.S();if(!(e<3||3==e&&!Vp&&!this.a.Y())){this.l||4!=e||7==n||Qd(8==n||r<=0?3:2),bv(this);var i=this.a.S();this.H=i;var o=this.a.Y();if(this.b=200==i){if(this.R&&!this.o){e:{if(this.a){var s,a=this.a;if((s=a.a?a.a.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Tp(s)){var u=s;break e}}u=null}if(!u){this.b=!1,this.c=3,Xd(12),wv(this),_v(this);break t}this.o=!0,Ev(this,u)}this.F?(vv(this,e,o),Vp&&this.b&&3==e&&(Bd(this.G,this.O,"tick",this.Ra),this.O.start())):Ev(this,o),4==e&&wv(this),this.b&&!this.l&&(4==e?xy(this.g,this):(this.b=!1,gv(this)))}else 400==i&&0<o.indexOf("Unknown SID")?(this.c=3,Xd(12)):(this.c=0,Xd(13)),wv(this),_v(this)}}}catch(t){}},np.Ra=function(){if(this.a){var t=_y(this.a),e=this.a.Y();this.w<e.length&&(bv(this),vv(this,t,e),this.b&&4!=t&&gv(this))}},np.cancel=function(){this.l=!0,wv(this)},np.Qa=function(){this.h=null;var t=yp();0<=t-this.P?(2!=this.B&&(Qd(3),Xd(17)),wv(this),this.c=2,_v(this)):mv(this,this.P-t)},(np=Iv.prototype).I=function(){Sv(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},np.K=function(){return Sv(this),this.a.concat()},np.get=function(t,e){return Cv(this.b,t)?this.b[t]:e},np.set=function(t,e){Cv(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},np.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 Nv=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Av(t,e){if(this.c=this.j=this.f="",this.h=null,this.i=this.g="",this.a=!1,t instanceof Av){this.a=void 0!==e?e:t.a,Ov(this,t.f),this.j=t.j,Rv(this,t.c),Pv(this,t.h),this.g=t.g,e=t.b;var n=new Hv;n.c=e.c,e.a&&(n.a=new Iv(e.a),n.b=e.b),Dv(this,n),this.i=t.i}else t&&(n=String(t).match(Nv))?(this.a=!!e,Ov(this,n[1]||"",!0),this.j=Mv(n[2]||""),Rv(this,n[3]||"",!0),Pv(this,n[4]),this.g=Mv(n[5]||"",!0),Dv(this,n[6]||"",!0),this.i=Mv(n[7]||"")):(this.a=!!e,this.b=new Hv(null,this.a))}function kv(t){return new Av(t)}function Ov(t,e,n){t.f=n?Mv(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function Rv(t,e,n){t.c=n?Mv(e,!0):e}function Pv(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.h=e}else t.h=null}function Dv(t,e,n){var r,i;e instanceof Hv?(t.b=e,r=t.b,(i=t.a)&&!r.f&&(Gv(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(zv(this,e),Qv(this,n,t))},r)),r.f=i):(n||(e=Fv(e,Bv)),t.b=new Hv(e,t.a))}function xv(t,e,n){t.b.set(e,n)}function Lv(t){return xv(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^yp()).toString(36)),t}function Mv(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Fv(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Uv),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Uv(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Av.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Fv(e,jv,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(Fv(e,jv,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.h)&&t.push(":",String(n))),(n=this.g)&&(this.c&&"/"!=n.charAt(0)&&t.push("/"),t.push(Fv(n,"/"==n.charAt(0)?qv:Vv,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",Fv(n,Wv)),t.join("")};var jv=/[#\/\?@]/g,Vv=/[#\?:]/g,qv=/[#\?]/g,Bv=/[#\?@]/g,Wv=/#/g;function Hv(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Gv(n){n.a||(n.a=new Iv,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 zv(t,e){Gv(t),e=Yv(t,e),Cv(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,Cv((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&Sv(t)))}function Kv(t,e){return Gv(t),e=Yv(t,e),Cv(t.a.b,e)}function Qv(t,e,n){zv(t,e),0<n.length&&(t.c=null,t.a.set(Yv(t,e),Ep(n)),t.b+=n.length)}function Yv(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function Xv(t,e){this.b=t,this.a=e}function $v(t){this.g=t||Jv,t=op.PerformanceNavigationTiming?0<(t=op.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(op.ca&&op.ca.ua&&op.ca.ua()&&op.ca.ua().mb),this.f=t?this.g:1,this.a=null,1<this.f&&(this.a=new Set),this.b=null,this.c=[]}(np=Hv.prototype).add=function(t,e){Gv(this),this.c=null,t=Yv(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},np.forEach=function(n,r){Gv(this),this.a.forEach(function(t,e){_p(t,function(t){n.call(r,t,e,this)},this)},this)},np.K=function(){Gv(this);for(var t=this.a.I(),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},np.I=function(t){Gv(this);var e=[];if("string"==typeof t)Kv(this,t)&&(e=wp(e,this.a.get(Yv(this,t))));else{t=this.a.I();for(var n=0;n<t.length;n++)e=wp(e,t[n])}return e},np.set=function(t,e){return Gv(this),this.c=null,Kv(this,t=Yv(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},np.get=function(t,e){return t&&0<(t=this.I(t)).length?String(t[0]):e},np.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.I(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 Jv=10;function Zv(t){return t.b||t.a&&t.a.size>=t.f}function ty(t){return t.b?1:t.a?t.a.size:0}function ey(t,e){return t.b?t.b==e:t.a&&t.a.has(e)}function ny(t,e){t.a?t.a.add(e):t.b=e}function ry(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function iy(t){var e,n;if(null!=t.b)return t.c.concat(t.b.i);if(null==t.a||0===t.a.size)return Ep(t.c);var r=t.c;try{for(var i=ep(t.a.values()),o=i.next();!o.done;o=i.next()){var s=o.value;r=r.concat(s.i)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function oy(){}function sy(){this.a=new oy}function ay(t,r,e){var i=e||"";try{Tv(t,function(t,e){var n=t;cp(t)&&(n=Id(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}function uy(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}$v.prototype.cancel=function(){var e,t;if(this.c=iy(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=ep(this.a.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.a.clear()}},oy.prototype.stringify=function(t){return op.JSON.stringify(t,void 0)},oy.prototype.parse=function(t){return op.JSON.parse(t,void 0)};var cy=op.JSON.parse;function hy(t){Ed.call(this),this.headers=new Iv,this.G=t||null,this.b=!1,this.s=this.a=null,this.D="",this.h=0,this.f="",this.g=this.w=this.l=this.v=!1,this.o=0,this.m=null,this.H=ly,this.B=this.F=!1}gp(hy,Ed);var ly="",fy=/^https?$/i,py=["POST","PUT"];function dy(t){return"content-type"==t.toLowerCase()}function vy(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,yy(t),my(t)}function yy(t){t.v||(t.v=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function gy(t){if(t.b&&void 0!==ip&&(!t.s[1]||4!=_y(t)||2!=t.S()))if(t.l&&4==_y(t))Fd(t.va,0,t);else if(t.dispatchEvent("readystatechange"),4==_y(t)){t.b=!1;try{var e,n=t.S();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.D).match(Nv)[1]||null;if(!o&&op.self&&op.self.location){var s=op.self.location.protocol;o=s.substr(0,s.length-1)}i=!fy.test(o?o.toLowerCase():"")}e=i}if(e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.h=6;try{var a=2<_y(t)?t.a.statusText:""}catch(t){a=""}t.f=a+" ["+t.S()+"]",yy(t)}}finally{my(t)}}}function my(t,e){if(t.a){by(t);var n=t.a,r=t.s[0]?sp:null;t.a=null,t.s=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){}}}function by(t){t.a&&t.B&&(t.a.ontimeout=null),t.m&&(op.clearTimeout(t.m),t.m=null)}function _y(t){return t.a?t.a.readyState:0}function wy(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}var i;r||(i="",Op(n,function(t,e){i+=e,i+=":",i+=t,i+="\r\n"}),n=i,"string"==typeof t?null!=n&&encodeURIComponent(String(n)):xv(t,e,n))}function Ey(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Ty(t){this.f=[],this.R=this.ea=this.v=this.P=this.a=this.ha=this.s=this.N=this.h=this.F=this.j=null,this.Fa=this.H=0,this.Ca=Ey("failFast",!1,t),this.U=this.l=this.i=this.g=this.c=null,this.W=!0,this.A=this.ia=this.G=-1,this.J=this.m=this.o=0,this.Ba=Ey("baseRetryDelayMs",5e3,t),this.Ga=Ey("retryDelaySeedMs",1e4,t),this.Da=Ey("forwardChannelMaxRetries",2,t),this.ga=Ey("forwardChannelRequestTimeoutMs",2e4,t),this.Ea=t&&t.nb||void 0,this.D=void 0,this.w=t&&t.supportsCrossDomainXhr||!1,this.B="",this.b=new $v(t&&t.concurrentRequestLimit),this.ja=new sy,this.fa=t&&t.fastHandshake||!1,t&&t.forceLongPolling&&(this.W=!1),this.O=void 0}function Iy(t){if(Sy(t),3==t.u){var e=t.H++,n=kv(t.v);xv(n,"SID",t.B),xv(n,"RID",e),xv(n,"TYPE","terminate"),ky(t,n),(e=new cv(t,e,void 0)).B=2,e.f=Lv(kv(n)),n=!1,op.navigator&&op.navigator.sendBeacon&&(n=op.navigator.sendBeacon(e.f.toString(),"")),!n&&op.Image&&((new Image).src=e.f,n=!0),n||(e.a=jy(e.g,null),e.a.$(e.f)),e.s=yp(),gv(e)}Fy(t)}function Sy(t){t.a&&(t.a.cancel(),t.a=null),t.i&&(op.clearTimeout(t.i),t.i=null),Dy(t),t.b.cancel(),t.g&&("number"==typeof t.g&&op.clearTimeout(t.g),t.g=null)}function Cy(t,e){t.f.push(new Xv(t.Fa++,e)),3==t.u&&Ny(t)}function Ny(t){Zv(t.b)||t.g||(t.g=!0,Rd(t.xa,t),t.o=0)}function Ay(t,e){var n;n=e?e.W:t.H++;var r=kv(t.v);xv(r,"SID",t.B),xv(r,"RID",n),xv(r,"AID",t.G),ky(t,r),t.h&&t.j&&wy(r,t.h,t.j),n=new cv(t,n,t.o+1),null===t.h&&(n.m=t.j),e&&(t.f=e.i.concat(t.f)),e=Oy(t,n,1e3),n.setTimeout(Math.round(.5*t.ga)+Math.round(.5*t.ga*Math.random())),ny(t.b,n),pv(n,r,e)}function ky(t,n){t.c&&Tv({},function(t,e){xv(n,e,t)})}function Oy(t,e,n){n=Math.min(t.f.length,n);var r=t.c?dp(t.c.Ha,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{ay(h,s,"req"+c+"_")}catch(t){r&&r(h)}}if(a){r=s.join("&");break t}}return t=t.f.splice(0,n),e.i=t,r}function Ry(t){t.a||t.i||(t.J=1,Rd(t.wa,t),t.m=0)}function Py(t){return!(t.a||t.i||3<=t.m)&&(t.J++,t.i=Jd(dp(t.wa,t),Ly(t,t.m)),t.m++,1)}function Dy(t){null!=t.l&&(op.clearTimeout(t.l),t.l=null)}function xy(t,e){var n=null;if(t.a==e){Dy(t),t.a=null;var r=2}else{if(!ey(t.b,e))return;n=e.i,ry(t.b,e),r=1}if(t.A=e.H,0!=t.u)if(e.b)if(1==r){n=e.j?e.j.length:0,e=yp()-e.s;var i=t.o;(r=zd()).dispatchEvent(new $d(r)),Ny(t)}else Ry(t);else if(3==(i=e.c)||0==i&&0<t.A||!(1==r&&function(t,e){if(!(ty(t.b)>=t.b.f-(t.g?1:0))){if(t.g)return t.f=e.i.concat(t.f),1;if(!(1==t.u||2==t.u||t.o>=(t.Ca?0:t.Da)))return t.g=Jd(dp(t.xa,t,e),Ly(t,t.o)),t.o++,1}}(t,e)||2==r&&Py(t)))switch(n&&0<n.length&&(e=t.b,e.c=e.c.concat(n)),i){case 1:My(t,5);break;case 4:My(t,10);break;case 3:My(t,6);break;default:My(t,2)}}function Ly(t,e){var n=t.Ba+Math.floor(Math.random()*t.Ga);return t.c||(n*=2),n*e}function My(t,e){if(2==e){var n=null;t.c&&(n=null);var r=dp(t.Ta,t);n||(n=new Av("//www.google.com/images/cleardot.gif"),op.location&&"http"==op.location.protocol||Ov(n,"https"),Lv(n)),function(t,e){var n=new Hd;if(op.Image){var r=new Image;r.onload=vp(uy,n,r,"TestLoadImage: loaded",!0,e),r.onerror=vp(uy,n,r,"TestLoadImage: error",!1,e),r.onabort=vp(uy,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=vp(uy,n,r,"TestLoadImage: timeout",!1,e),op.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=t}else e(!1)}(n.toString(),r)}else Xd(2);t.u=0,t.c&&t.c.la(e),Fy(t),Sy(t)}function Fy(t){t.u=0,t.A=-1,t.c&&(0==iy(t.b).length&&0==t.f.length||(t.b.c.length=0,Ep(t.f),t.f.length=0),t.c.ka())}function Uy(t,e,n){var r,i,o,s,a,u,c=(r=n)instanceof Av?kv(r):new Av(r,void 0);if(""!=c.c)e&&Rv(c,e+"."+c.c),Pv(c,c.h);else{var h=op.location;i=h.protocol,o=e?e+"."+h.hostname:h.hostname,s=+h.port,a=n,u=new Av(null,void 0),i&&Ov(u,i),o&&Rv(u,o),s&&Pv(u,s),a&&(u.g=a),c=u}return t.N&&Op(t.N,function(t,e){xv(c,e,t)}),e=t.s,n=t.ha,e&&n&&xv(c,e,n),xv(c,"VER",t.oa),ky(t,c),c}function jy(t,e){if(e&&!t.w)throw Error("Can't create secondary domain capable XhrIo object.");return(e=new hy(t.Ea)).F=t.w,e}function Vy(){}function qy(){if(Up&&!(10<=Number($p)))throw Error("Environmental error: no available transport.")}function By(t,e){Ed.call(this),this.a=new Ty(e),this.l=t,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.j=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.pa&&(t?t["X-WebChannel-Client-Profile"]=e.pa:t={"X-WebChannel-Client-Profile":e.pa}),this.a.F=t,(t=e&&e.httpHeadersOverwriteParam)&&!Tp(t)&&(this.a.h=t),this.h=e&&e.supportsCrossDomainXhr||!1,this.g=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Tp(e)&&(this.a.s=e,null!==(t=this.b)&&e in t&&(e in(t=this.b)&&delete t[e])),this.f=new Gy(this)}function Wy(t){sv.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 Hy(){av.call(this),this.status=1}function Gy(t){this.a=t}(np=hy.prototype).$=function(t,e,n,r){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+t);e=e?e.toUpperCase():"GET",this.D=t,this.f="",this.h=0,this.v=!1,this.b=!0,this.a=new XMLHttpRequest,this.s=this.G?nv(this.G):nv(iv),this.a.onreadystatechange=dp(this.va,this);try{this.w=!0,this.a.open(e,String(t),!0),this.w=!1}catch(t){return void vy(this,t)}t=n||"";var i,o=new Iv(this.headers);r&&Tv(r,function(t,e){o.set(e,t)}),r=function(t){t:{for(var e=dy,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.K()),n=op.FormData&&t instanceof op.FormData,0<=bp(py,e)&&!r&&!n&&o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach(function(t,e){this.a.setRequestHeader(e,t)},this),this.H&&(this.a.responseType=this.H),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{by(this),0<this.o&&((this.B=(i=this.a,Up&&Yp(9)&&"number"==typeof i.timeout&&void 0!==i.ontimeout))?(this.a.timeout=this.o,this.a.ontimeout=dp(this.ta,this)):this.m=Fd(this.ta,this.o,this)),this.l=!0,this.a.send(t),this.l=!1}catch(t){vy(this,t)}},np.ta=function(){void 0!==ip&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,this.dispatchEvent("timeout"),this.abort(8))},np.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"),my(this))},np.C=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),my(this,!0)),hy.M.C.call(this)},np.va=function(){this.j||(this.w||this.l||this.g?gy(this):this.Oa())},np.Oa=function(){gy(this)},np.S=function(){try{return 2<_y(this)?this.a.status:-1}catch(t){return-1}},np.Y=function(){try{return this.a?this.a.responseText:""}catch(t){return""}},np.Ja=function(t){if(this.a){var e=this.a.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),cy(e)}},np.qa=function(){return this.h},np.Ma=function(){return"string"==typeof this.f?this.f:String(this.f)},(np=Ty.prototype).oa=8,np.u=1,np.xa=function(t){if(this.g)if(this.g=null,1==this.u){if(!t){this.H=Math.floor(1e5*Math.random()),t=this.H++;var e,n=new cv(this,t,void 0),r=this.j;if(this.F&&(r?Dp(r=Rp(r),this.F):r=this.F),null===this.h&&(n.m=r),this.fa)t:{for(var i=e=0;i<this.f.length;i++){var o=this.f[i];if("__data__"in o.a&&"string"==typeof(o=o.a.__data__)?o=o.length:o=void 0,void 0===o)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=Oy(this,n,e),xv(i=kv(this.v),"RID",t),xv(i,"CVER",22),this.s&&xv(i,"X-HTTP-Session-Id",this.s),ky(this,i),this.h&&r&&wy(i,this.h,r),ny(this.b,n),this.fa?(xv(i,"$req",e),xv(i,"SID","null"),n.R=!0,pv(n,i,null)):pv(n,i,e),this.u=2}}else 3==this.u&&(t?Ay(this,t):0==this.f.length||Zv(this.b)||Ay(this))},np.wa=function(){this.i=null,this.a=new cv(this,"rpc",this.J),null===this.h&&(this.a.m=this.j),this.a.J=0;var t=kv(this.ea);xv(t,"RID","rpc"),xv(t,"SID",this.B),xv(t,"CI",this.U?"0":"1"),xv(t,"AID",this.G),ky(this,t),xv(t,"TYPE","xmlhttp"),this.h&&this.j&&wy(t,this.h,this.j),this.D&&this.a.setTimeout(this.D);var e=this.a,n=this.R;e.B=1,e.f=Lv(kv(t)),e.j=null,e.F=!0,dv(e,n)},np.Na=function(){null!=this.l&&(this.l=null,this.a.cancel(),this.a=null,Py(this),Xd(19))},np.Ta=function(t){Xd(t?2:1)},(np=Vy.prototype).na=function(){},np.ma=function(){},np.la=function(){},np.ka=function(){},np.Ha=function(){},qy.prototype.a=function(t,e){return new By(t,e)},gp(By,Ed),(np=By.prototype).addEventListener=function(t,e,n,r){By.M.addEventListener.call(this,t,e,n,r)},np.removeEventListener=function(t,e,n,r){By.M.removeEventListener.call(this,t,e,n,r)},np.Ka=function(){this.a.c=this.f,this.h&&(this.a.w=!0);var t=this.a,e=this.l,n=this.b||void 0;Xd(0),t.P=e,t.N=n||{},t.U=t.W,t.v=Uy(t,null,t.P),Ny(t)},np.close=function(){Iy(this.a)},np.La=function(t){if("string"==typeof t){var e={};e.__data__=t,Cy(this.a,e)}else this.g?((e={}).__data__=Id(t),Cy(this.a,e)):Cy(this.a,t)},np.C=function(){this.a.c=null,delete this.f,Iy(this.a),delete this.a,By.M.C.call(this)},gp(Wy,sv),gp(Hy,av),gp(Gy,Vy),Gy.prototype.na=function(){this.a.dispatchEvent("a")},Gy.prototype.ma=function(t){this.a.dispatchEvent(new Wy(t))},Gy.prototype.la=function(t){this.a.dispatchEvent(new Hy)},Gy.prototype.ka=function(){this.a.dispatchEvent("b")},qy.prototype.createWebChannel=qy.prototype.a,By.prototype.send=By.prototype.La,By.prototype.open=By.prototype.Ka,By.prototype.close=By.prototype.close,Zd.NO_ERROR=0,Zd.TIMEOUT=8,Zd.HTTP_ERROR=6,tv.COMPLETE="complete",(rv.EventType=ov).OPEN="a",ov.CLOSE="b",ov.ERROR="c",ov.MESSAGE="d",Ed.prototype.listen=Ed.prototype.ra,hy.prototype.listenOnce=hy.prototype.sa,hy.prototype.getLastError=hy.prototype.Ma,hy.prototype.getLastErrorCode=hy.prototype.qa,hy.prototype.getStatus=hy.prototype.S,hy.prototype.getResponseJson=hy.prototype.Ja,hy.prototype.getResponseText=hy.prototype.Y,hy.prototype.send=hy.prototype.$;var zy={createWebChannelTransport:function(){return new qy},ErrorCode:Zd,EventType:tv,WebChannel:rv,XhrIo:hy},Ky=zy.createWebChannelTransport,Qy=zy.ErrorCode,Yy=zy.EventType,Xy=zy.WebChannel,$y=zy.XhrIo,Jy=Kl.SDK_VERSION,Zy=(tg.prototype.t=function(){return null!=this.uid},tg.prototype.s=function(){return this.t()?"uid:"+this.uid:"anonymous-user"},tg.prototype.isEqual=function(t){return t.uid===this.uid},tg);function tg(t){this.uid=t}Zy.UNAUTHENTICATED=new Zy(null),Zy.i=new Zy("google-credentials-uid"),Zy.h=new Zy("first-party-uid");function eg(t,e){this.user=e,this.type="OAuth",this.o={},this.o.Authorization="Bearer "+t}var ng,rg,ig={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"},og=(Es(Eg,rg=Error),Eg),sg=(wg.prototype.getToken=function(){return Promise.resolve(null)},wg.prototype._=function(){},wg.prototype.l=function(t){(this.u=t)(Zy.UNAUTHENTICATED)},wg.prototype.T=function(){this.u=null},wg),ag=(_g.prototype.getToken=function(){var e=this,n=this.A,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(function(t){if(e.A!==n)throw new og(ig.ABORTED,"getToken aborted due to token change.");return t?(k_("string"==typeof t.accessToken),new eg(t.accessToken,e.currentUser)):null}):Promise.resolve(null)},_g.prototype._=function(){this.forceRefresh=!0},_g.prototype.l=function(t){this.u=t,this.R&&t(this.currentUser)},_g.prototype.T=function(){this.auth&&this.auth.removeAuthTokenListener(this.I),this.I=null,this.u=null},_g.prototype.m=function(){var t=this.auth&&this.auth.getUid();return k_(null===t||"string"==typeof t),new Zy(t)},_g),ug=(Object.defineProperty(bg.prototype,"o",{get:function(){var t={"X-Goog-AuthUser":this.V},e=this.P.auth.g([]);return e&&(t.Authorization=e),t},enumerable:!0,configurable:!0}),bg),cg=(mg.prototype.getToken=function(){return Promise.resolve(new ug(this.P,this.V))},mg.prototype.l=function(t){t(Zy.h)},mg.prototype.T=function(){},mg.prototype._=function(){},mg),hg=(gg.now=function(){return gg.fromMillis(Date.now())},gg.fromDate=function(t){return gg.fromMillis(t.getTime())},gg.fromMillis=function(t){var e=Math.floor(t/1e3);return new gg(e,1e6*(t-1e3*e))},gg.prototype.toDate=function(){return new Date(this.toMillis())},gg.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},gg.prototype.p=function(t){return this.seconds===t.seconds?D_(this.nanoseconds,t.nanoseconds):D_(this.seconds,t.seconds)},gg.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},gg.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},gg.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},gg),lg=(yg.v=function(t){return new yg(t)},yg.min=function(){return new yg(new hg(0,0))},yg.prototype.S=function(t){return this.timestamp.p(t.timestamp)},yg.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},yg.prototype.D=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},yg.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},yg.prototype.C=function(){return this.timestamp},yg),fg=(Object.defineProperty(vg.prototype,"length",{get:function(){return this.F},enumerable:!0,configurable:!0}),vg.prototype.isEqual=function(t){return 0===vg.N(this,t)},vg.prototype.child=function(t){var e=this.segments.slice(this.offset,this.limit());return t instanceof vg?t.forEach(function(t){e.push(t)}):e.push(t),this.$(e)},vg.prototype.limit=function(){return this.offset+this.length},vg.prototype.k=function(t){return t=void 0===t?1:t,this.$(this.segments,this.offset+t,this.length-t)},vg.prototype.L=function(){return this.$(this.segments,this.offset,this.length-1)},vg.prototype.M=function(){return this.segments[this.offset]},vg.prototype.O=function(){return this.get(this.length-1)},vg.prototype.get=function(t){return this.segments[this.offset+t]},vg.prototype.B=function(){return 0===this.length},vg.prototype.q=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},vg.prototype.U=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},vg.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},vg.prototype.W=function(){return this.segments.slice(this.offset,this.limit())},vg.N=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},vg),pg=(Es(dg,ng=fg),dg.prototype.$=function(t,e,n){return new dg(t,e,n)},dg.prototype.j=function(){return this.W().join("/")},dg.prototype.toString=function(){return this.j()},dg.K=function(t){if(0<=t.indexOf("//"))throw new og(ig.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new dg(t.split("/").filter(function(t){return 0<t.length}))},dg);function dg(){return null!==ng&&ng.apply(this,arguments)||this}function vg(t,e,n){void 0===e?e=0:e>t.length&&A_(),void 0===n?n=t.length-e:n>t.length-e&&A_(),this.segments=t,this.offset=e,this.F=n}function yg(t){this.timestamp=t}function gg(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new og(ig.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new og(ig.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new og(ig.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new og(ig.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function mg(t,e){this.P=t,this.V=e}function bg(t,e){this.P=t,this.V=e,this.type="FirstParty",this.user=Zy.h}function _g(t){var e=this;this.I=null,this.currentUser=Zy.UNAUTHENTICATED,this.R=!1,this.A=0,this.u=null,this.forceRefresh=!1,this.I=function(){e.A++,e.currentUser=e.m(),e.R=!0,e.u&&e.u(e.currentUser)},this.A=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.I):(this.I(null),t.get().then(function(t){e.auth=t,e.I&&e.auth.addAuthTokenListener(e.I)},function(){}))}function wg(){this.u=null}function Eg(t,e){var n=this;return(n=rg.call(this,e)||this).code=t,n.message=e,n.name="FirebaseError",n.toString=function(){return n.name+": [code="+n.code+"]: "+n.message},n}pg.G=new pg([]);var Tg,Ig=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Sg=(Es(Cg,Tg=fg),Cg.prototype.$=function(t,e,n){return new Cg(t,e,n)},Cg.H=function(t){return Ig.test(t)},Cg.prototype.j=function(){return this.W().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),Cg.H(t)||(t="`"+t+"`"),t}).join(".")},Cg.prototype.toString=function(){return this.j()},Cg.prototype.Y=function(){return 1===this.length&&"__name__"===this.get(0)},Cg.J=function(){return new Cg(["__name__"])},Cg.X=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new og(ig.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 og(ig.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var a=t[r+1];if("\\"!==a&&"."!==a&&"`"!==a)throw new og(ig.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 og(ig.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new Cg(e)},Cg);function Cg(){return null!==Tg&&Tg.apply(this,arguments)||this}Sg.G=new Sg([]);var Ng=(Ag.Z=function(t){return new Ag(pg.K(t).k(5))},Ag.prototype.tt=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},Ag.prototype.isEqual=function(t){return null!==t&&0===pg.N(this.path,t.path)},Ag.prototype.toString=function(){return this.path.toString()},Ag.N=function(t,e){return pg.N(t.path,e.path)},Ag.et=function(t){return t.length%2==0},Ag.st=function(t){return new Ag(new pg(t.slice()))},Ag);function Ag(t){this.path=t}function kg(t){var e=0;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function Og(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Rg(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}Ng.EMPTY=new Ng(new pg([]));var Pg=(Dg.fromBase64String=function(t){return new Dg(__.nt().atob(t))},Dg.fromUint8Array=function(t){return new Dg(function(t){for(var e="",n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t))},Dg.prototype.toBase64=function(){return __.nt().btoa(this.it)},Dg.prototype.toUint8Array=function(){return function(t){for(var e=new Uint8Array(t.length),n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(this.it)},Dg.prototype.rt=function(){return 2*this.it.length},Dg.prototype.S=function(t){return D_(this.it,t.it)},Dg.prototype.isEqual=function(t){return this.it===t.it},Dg);function Dg(t){this.it=t}function xg(t){return null==t}function Lg(t){return-0===t&&1/t==-1/0}function Mg(t){return"number"==typeof t&&Number.isInteger(t)&&!Lg(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}function Fg(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function Ug(t){var e=zg(t.mapValue.fields.__local_write_time__.timestampValue);return new hg(e.seconds,e.nanos)}Pg.ht=new Pg("");var jg=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Vg(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?Fg(t)?4:10:A_()}function qg(i,t){var e,n,r,o=Vg(i);if(o!==Vg(t))return!1;switch(o){case 0:return!0;case 1:return i.booleanValue===t.booleanValue;case 4:return Ug(i).isEqual(Ug(t));case 3:return function(t){if("string"==typeof i.timestampValue&&"string"==typeof t.timestampValue&&i.timestampValue.length===t.timestampValue.length)return i.timestampValue===t.timestampValue;var e=zg(i.timestampValue),n=zg(t.timestampValue);return e.seconds===n.seconds&&e.nanos===n.nanos}(t);case 5:return i.stringValue===t.stringValue;case 6:return r=t,Qg(i.bytesValue).isEqual(Qg(r.bytesValue));case 7:return i.referenceValue===t.referenceValue;case 8:return n=t,Kg((e=i).geoPointValue.latitude)===Kg(n.geoPointValue.latitude)&&Kg(e.geoPointValue.longitude)===Kg(n.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Kg(t.integerValue)===Kg(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){var n=Kg(t.doubleValue),r=Kg(e.doubleValue);return n===r?Lg(n)===Lg(r):isNaN(n)&&isNaN(r)}return!1}(i,t);case 9:return x_(i.arrayValue.values||[],t.arrayValue.values||[],qg);case 10:return function(t){var e=i.mapValue.fields||{},n=t.mapValue.fields||{};if(kg(e)!==kg(n))return!1;for(var r in e)if(e.hasOwnProperty(r)&&(void 0===n[r]||!qg(e[r],n[r])))return!1;return!0}(t);default:return A_()}}function Bg(t,e){return void 0!==(t.values||[]).find(function(t){return qg(t,e)})}function Wg(t,e){var n,r,i,o,s,a,u,c,h,l,f=Vg(t),p=Vg(e);if(f!==p)return D_(f,p);switch(f){case 0:return 0;case 1:return D_(t.booleanValue,e.booleanValue);case 2:return c=e,h=Kg(t.integerValue||t.doubleValue),l=Kg(c.integerValue||c.doubleValue),h<l?-1:l<h?1:h===l?0:isNaN(h)?isNaN(l)?0:-1:1;case 3:return Hg(t.timestampValue,e.timestampValue);case 4:return Hg(Ug(t),Ug(e));case 5:return D_(t.stringValue,e.stringValue);case 6:return o=t.bytesValue,s=e.bytesValue,a=Qg(o),u=Qg(s),a.S(u);case 7:return function(t,e){for(var n=t.split("/"),r=e.split("/"),i=0;i<n.length&&i<r.length;i++){var o=D_(n[i],r[i]);if(0!==o)return o}return D_(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return n=t.geoPointValue,r=e.geoPointValue,0!==(i=D_(Kg(n.latitude),Kg(r.latitude)))?i:D_(Kg(n.longitude),Kg(r.longitude));case 9:return function(t,e){for(var n=t.values||[],r=e.values||[],i=0;i<n.length&&i<r.length;++i){var o=Wg(n[i],r[i]);if(o)return o}return D_(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){var n=t.fields||{},r=Object.keys(n),i=e.fields||{},o=Object.keys(i);r.sort(),o.sort();for(var s=0;s<r.length&&s<o.length;++s){var a=D_(r[s],o[s]);if(0!==a)return a;var u=Wg(n[r[s]],i[o[s]]);if(0!==u)return u}return D_(r.length,o.length)}(t.mapValue,e.mapValue);default:throw A_()}}function Hg(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return D_(t,e);var n=zg(t),r=zg(e),i=D_(n.seconds,r.seconds);return 0!==i?i:D_(n.nanos,r.nanos)}function Gg(t){return function s(i){return"nullValue"in i?"null":"booleanValue"in i?""+i.booleanValue:"integerValue"in i?""+i.integerValue:"doubleValue"in i?""+i.doubleValue:"timestampValue"in i?"time("+(t=zg(i.timestampValue)).seconds+","+t.nanos+")":"stringValue"in i?i.stringValue:"bytesValue"in i?Qg(i.bytesValue).toBase64():"referenceValue"in i?(n=i.referenceValue,Ng.Z(n).toString()):"geoPointValue"in i?"geo("+(e=i.geoPointValue).latitude+","+e.longitude+")":"arrayValue"in i?function(){for(var t="[",e=!0,n=0,r=i.arrayValue.values||[];n<r.length;n++){e?e=!1:t+=",",t+=s(r[n])}return t+"]"}():"mapValue"in i?function(t){for(var e="{",n=!0,r=0,i=Object.keys(t.fields||{}).sort();r<i.length;r++){var o=i[r];n?n=!1:e+=",",e+=o+":"+s(t.fields[o])}return e+"}"}(i.mapValue):A_();var t,e,n}(t)}function zg(t){if(k_(!!t),"string"!=typeof t)return{seconds:Kg(t.seconds),nanos:Kg(t.nanos)};var e=0,n=jg.exec(t);if(k_(!!n),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),e=Number(r)}var i=new Date(t);return{seconds:Math.floor(i.getTime()/1e3),nanos:e}}function Kg(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Qg(t){return"string"==typeof t?Pg.fromBase64String(t):Pg.fromUint8Array(t)}function Yg(t,e){return{referenceValue:"projects/"+t.projectId+"/databases/"+t.database+"/documents/"+e.path.j()}}function Xg(t){return t&&"integerValue"in t}function $g(t){return!!t&&"arrayValue"in t}function Jg(t){return t&&"nullValue"in t}function Zg(t){return t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function tm(t){return t&&"mapValue"in t}var em=(nm.prototype.ot=function(t,e){return n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}},t&&(n.fields.__previous_value__=t),{mapValue:n};var n},nm.prototype.at=function(t,e){return e},nm.prototype.ut=function(t){return null},nm.prototype.isEqual=function(t){return t instanceof nm},nm);function nm(){}em.instance=new em;var rm=(um.prototype.ot=function(t,e){return this.apply(t)},um.prototype.at=function(t,e){return this.apply(t)},um.prototype.apply=function(t){for(var n=cm(t),e=function(e){n.some(function(t){return qg(t,e)})||n.push(e)},r=0,i=this.elements;r<i.length;r++)e(i[r]);return{arrayValue:{values:n}}},um.prototype.ut=function(t){return null},um.prototype.isEqual=function(t){return t instanceof um&&x_(this.elements,t.elements,qg)},um),im=(am.prototype.ot=function(t,e){return this.apply(t)},am.prototype.at=function(t,e){return this.apply(t)},am.prototype.apply=function(t){for(var n=cm(t),e=function(e){n=n.filter(function(t){return!qg(t,e)})},r=0,i=this.elements;r<i.length;r++)e(i[r]);return{arrayValue:{values:n}}},am.prototype.ut=function(t){return null},am.prototype.isEqual=function(t){return t instanceof am&&x_(this.elements,t.elements,qg)},am),om=(sm.prototype.ot=function(t,e){var n=this.ut(t),r=this.asNumber(n)+this.asNumber(this.ct);return Xg(n)&&Xg(this.ct)?this.serializer._t(r):this.serializer.lt(r)},sm.prototype.at=function(t,e){return e},sm.prototype.ut=function(t){return Xg(e=t)||e&&"doubleValue"in e?t:{integerValue:0};var e},sm.prototype.isEqual=function(t){return t instanceof sm&&qg(this.ct,t.ct)},sm.prototype.asNumber=function(t){return Kg(t.integerValue||t.doubleValue)},sm);function sm(t,e){this.serializer=t,this.ct=e}function am(t){this.elements=t}function um(t){this.elements=t}function cm(t){return $g(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function hm(t,e){this.version=t,this.transformResults=e}var lm,fm,pm,dm,vm,ym=(Fm.prototype.dt=function(t){for(var e=0,n=this.fields;e<n.length;e++)if(n[e].q(t))return!0;return!1},Fm.prototype.isEqual=function(t){return x_(this.fields,t.fields,function(t,e){return t.isEqual(e)})},Fm),gm=(Mm.prototype.isEqual=function(t){return this.field.isEqual(t.field)&&this.transform.isEqual(t.transform)},Mm),mm=(Lm.ft=function(){return new Lm},Lm.exists=function(t){return new Lm(void 0,t)},Lm.updateTime=function(t){return new Lm(t)},Object.defineProperty(Lm.prototype,"Tt",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!0,configurable:!0}),Lm.prototype.Et=function(t){return void 0!==this.updateTime?t instanceof Jm&&t.version.isEqual(this.updateTime):void 0===this.exists||this.exists===t instanceof Jm},Lm.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},Lm),bm=(xm.prototype.It=function(t){},xm.wt=function(t){return t instanceof Jm?t.version:lg.min()},xm),_m=(Es(Dm,vm=bm),Dm.prototype.at=function(t,e){this.It(t);var n=e.version;return new Jm(this.key,n,this.value,{hasCommittedMutations:!0})},Dm.prototype.ot=function(t,e,n){if(this.It(t),!this.Rt.Et(t))return t;var r=bm.wt(t);return new Jm(this.key,r,this.value,{At:!0})},Dm.prototype.Pt=function(t){return null},Dm.prototype.isEqual=function(t){return t instanceof Dm&&this.key.isEqual(t.key)&&this.value.isEqual(t.value)&&this.Rt.isEqual(t.Rt)},Dm),wm=(Es(Pm,dm=bm),Pm.prototype.at=function(t,e){if(this.It(t),!this.Rt.Et(t))return new tb(this.key,e.version);var n=this.gt(t);return new Jm(this.key,e.version,n,{hasCommittedMutations:!0})},Pm.prototype.ot=function(t,e,n){if(this.It(t),!this.Rt.Et(t))return t;var r=bm.wt(t),i=this.gt(t);return new Jm(this.key,r,i,{At:!0})},Pm.prototype.Pt=function(t){return null},Pm.prototype.isEqual=function(t){return t instanceof Pm&&this.key.isEqual(t.key)&&this.Vt.isEqual(t.Vt)&&this.Rt.isEqual(t.Rt)},Pm.prototype.gt=function(t){var e;return e=t instanceof Jm?t.data():Sm.empty(),this.pt(e)},Pm.prototype.pt=function(t){var n=this,r=new Cm(t);return this.Vt.fields.forEach(function(t){if(!t.B()){var e=n.data.field(t);null!==e?r.set(t,e):r.delete(t)}}),r.yt()},Pm),Em=(Es(Rm,pm=bm),Rm.prototype.at=function(t,e){if(this.It(t),k_(null!=e.transformResults),!this.Rt.Et(t))return new tb(this.key,e.version);var n=this.bt(t),r=this.vt(t,e.transformResults),i=e.version,o=this.St(n.data(),r);return new Jm(this.key,i,o,{hasCommittedMutations:!0})},Rm.prototype.ot=function(t,e,n){if(this.It(t),!this.Rt.Et(t))return t;var r=this.bt(t),i=this.Dt(n,t,e),o=this.St(r.data(),i);return new Jm(this.key,r.version,o,{At:!0})},Rm.prototype.Pt=function(t){for(var e=null,n=0,r=this.fieldTransforms;n<r.length;n++){var i=r[n],o=t instanceof Jm?t.field(i.field):void 0,s=i.transform.ut(o||null);null!=s&&(e=null==e?(new Cm).set(i.field,s):e.set(i.field,s))}return e?e.yt():null},Rm.prototype.isEqual=function(t){return t instanceof Rm&&this.key.isEqual(t.key)&&x_(this.fieldTransforms,t.fieldTransforms,function(t,e){return t.isEqual(e)})&&this.Rt.isEqual(t.Rt)},Rm.prototype.bt=function(t){return t},Rm.prototype.vt=function(t,e){var n=[];k_(this.fieldTransforms.length===e.length);for(var r=0;r<e.length;r++){var i=this.fieldTransforms[r],o=i.transform,s=null;t instanceof Jm&&(s=t.field(i.field)),n.push(o.at(s,e[r]))}return n},Rm.prototype.Dt=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 Jm&&(u=e.field(s.field)),null===u&&n instanceof Jm&&(u=n.field(s.field)),r.push(a.ot(u,t))}return r},Rm.prototype.St=function(t,e){for(var n=new Cm(t),r=0;r<this.fieldTransforms.length;r++){var i=this.fieldTransforms[r].field;n.set(i,e[r])}return n.yt()},Rm),Tm=(Es(Om,fm=bm),Om.prototype.at=function(t,e){return this.It(t),new Zm(this.key,e.version,{hasCommittedMutations:!0})},Om.prototype.ot=function(t,e,n){return this.It(t),this.Rt.Et(t)?new Zm(this.key,lg.min()):t},Om.prototype.Pt=function(t){return null},Om.prototype.isEqual=function(t){return t instanceof Om&&this.key.isEqual(t.key)&&this.Rt.isEqual(t.Rt)},Om),Im=(Es(km,lm=bm),km.prototype.at=function(t,e){A_()},km.prototype.ot=function(t,e,n){A_()},km.prototype.Pt=function(t){A_()},km.prototype.isEqual=function(t){return t instanceof km&&this.key.isEqual(t.key)&&this.Rt.isEqual(t.Rt)},km),Sm=(Am.empty=function(){return new Am({mapValue:{}})},Am.prototype.field=function(t){if(t.B())return this.proto;for(var e=this.proto,n=0;n<t.length-1;++n){if(!e.mapValue.fields)return null;if(!tm(e=e.mapValue.fields[t.get(n)]))return null}return(e=(e.mapValue.fields||{})[t.O()])||null},Am.prototype.isEqual=function(t){return qg(this.proto,t.proto)},Am),Cm=(Nm.prototype.set=function(t,e){return this.Nt(t,e),this},Nm.prototype.delete=function(t){return this.Nt(t,null),this},Nm.prototype.Nt=function(t,e){for(var n=this.Ft,r=0;r<t.length-1;++r){var i=t.get(r),o=n.get(i);o instanceof Map||(o=o&&10===Vg(o)?new Map(Object.entries(o.mapValue.fields||{})):new Map,n.set(i,o)),n=o}n.set(t.O(),e)},Nm.prototype.yt=function(){var t=this.$t(Sg.G,this.Ft);return null!=t?new Sm(t):this.Ct},Nm.prototype.$t=function(r,t){var i=this,o=!1,e=this.Ct.field(r),s=tm(e)?Object.assign({},e.mapValue.fields):{};return t.forEach(function(t,e){if(t instanceof Map){var n=i.$t(r.child(e),t);null!=n&&(s[e]=n,o=!0)}else null!==t?(s[e]=t,o=!0):s.hasOwnProperty(e)&&(delete s[e],o=!0)}),o?{mapValue:{fields:s}}:null},Nm);function Nm(t){void 0===t&&(t=Sm.empty()),this.Ct=t,this.Ft=new Map}function Am(t){this.proto=t}function km(t,e){var n=this;return(n=lm.call(this)||this).key=t,n.Rt=e,n.type=4,n}function Om(t,e){var n=this;return(n=fm.call(this)||this).key=t,n.Rt=e,n.type=3,n}function Rm(t,e){var n=this;return(n=pm.call(this)||this).key=t,n.fieldTransforms=e,n.type=2,n.Rt=mm.exists(!0),n}function Pm(t,e,n,r){var i=this;return(i=dm.call(this)||this).key=t,i.data=e,i.Vt=n,i.Rt=r,i.type=1,i}function Dm(t,e,n){var r=this;return(r=vm.call(this)||this).key=t,r.value=e,r.Rt=n,r.type=0,r}function xm(){}function Lm(t,e){this.updateTime=t,this.exists=e}function Mm(t,e){this.field=t,this.transform=e}function Fm(t){(this.fields=t).sort(Sg.N)}function Um(t){var a=[];return Og(t.fields||{},function(t,e){var n=new Sg([t]);if(tm(e)){var r=Um(e.mapValue).fields;if(0===r.length)a.push(n);else for(var i=0,o=r;i<o.length;i++){var s=o[i];a.push(n.child(s))}}else a.push(n)}),new ym(a)}function jm(t,e){this.key=t,this.version=e}function Vm(t){this.count=t}var qm,Bm,Wm,Hm,Gm,zm,Km,Qm,Ym,Xm,$m,Jm=(Es(Sb,$m=jm),Sb.prototype.field=function(t){return this.kt.field(t)},Sb.prototype.data=function(){return this.kt},Sb.prototype.Lt=function(){return this.kt.proto},Sb.prototype.isEqual=function(t){return t instanceof Sb&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.At===t.At&&this.hasCommittedMutations===t.hasCommittedMutations&&this.kt.isEqual(t.kt)},Sb.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.kt.toString()+", {hasLocalMutations: "+this.At+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(Sb.prototype,"hasPendingWrites",{get:function(){return this.At||this.hasCommittedMutations},enumerable:!0,configurable:!0}),Sb),Zm=(Es(Ib,Xm=jm),Ib.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(Ib.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!0,configurable:!0}),Ib.prototype.isEqual=function(t){return t instanceof Ib&&t.hasCommittedMutations===this.hasCommittedMutations&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Ib),tb=(Es(Tb,Ym=jm),Tb.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(Tb.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!0,configurable:!0}),Tb.prototype.isEqual=function(t){return t instanceof Tb&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Tb),eb=(Eb.prototype.canonicalId=function(){if(null===this.Mt){var t=this.path.j();null!==this.collectionGroup&&(t+="|cg:"+this.collectionGroup),t+="|f:",t+=this.filters.map(function(t){return t.canonicalId()}).join(","),t+="|ob:",t+=this.orderBy.map(function(t){return t.canonicalId()}).join(","),xg(this.limit)||(t+="|l:",t+=this.limit),this.startAt&&(t+="|lb:",t+=this.startAt.canonicalId()),this.endAt&&(t+="|ub:",t+=this.endAt.canonicalId()),this.Mt=t}return this.Mt},Eb.prototype.toString=function(){var t=this.path.j();return null!==this.collectionGroup&&(t+=" collectionGroup="+this.collectionGroup),0<this.filters.length&&(t+=", filters: ["+this.filters.join(", ")+"]"),xg(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+")"},Eb.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(var n=0;n<this.filters.length;n++)if(!this.filters[n].isEqual(t.filters[n]))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)},Eb.prototype.Ot=function(){return Ng.et(this.path)&&null===this.collectionGroup&&0===this.filters.length},Eb),nb=(wb.Wt=function(t){return new wb(t)},Object.defineProperty(wb.prototype,"orderBy",{get:function(){if(null===this.qt){this.qt=[];var t=this.jt(),e=this.Kt();if(null!==t&&null===e)t.Y()||this.qt.push(new hb(t)),this.qt.push(new hb(Sg.J(),"asc"));else{for(var n=!1,r=0,i=this.xt;r<i.length;r++){var o=i[r];this.qt.push(o),o.field.Y()&&(n=!0)}if(!n){var s=0<this.xt.length?this.xt[this.xt.length-1].dir:"asc";this.qt.push(new hb(Sg.J(),s))}}}return this.qt},enumerable:!0,configurable:!0}),wb.prototype.Gt=function(t){var e=this.filters.concat([t]);return new wb(this.path,this.collectionGroup,this.xt.slice(),e,this.limit,this.Bt,this.startAt,this.endAt)},wb.prototype.zt=function(t){var e=this.xt.concat([t]);return new wb(this.path,this.collectionGroup,e,this.filters.slice(),this.limit,this.Bt,this.startAt,this.endAt)},wb.prototype.Ht=function(t){return new wb(this.path,this.collectionGroup,this.xt.slice(),this.filters.slice(),t,"F",this.startAt,this.endAt)},wb.prototype.Yt=function(t){return new wb(this.path,this.collectionGroup,this.xt.slice(),this.filters.slice(),t,"L",this.startAt,this.endAt)},wb.prototype.Jt=function(t){return new wb(this.path,this.collectionGroup,this.xt.slice(),this.filters.slice(),this.limit,this.Bt,t,this.endAt)},wb.prototype.Xt=function(t){return new wb(this.path,this.collectionGroup,this.xt.slice(),this.filters.slice(),this.limit,this.Bt,this.startAt,t)},wb.prototype.Zt=function(t){return new wb(t,null,this.xt.slice(),this.filters.slice(),this.limit,this.Bt,this.startAt,this.endAt)},wb.prototype.te=function(){return 0===this.filters.length&&null===this.limit&&null==this.startAt&&null==this.endAt&&(0===this.xt.length||1===this.xt.length&&this.xt[0].field.Y())},wb.prototype.canonicalId=function(){return this.ee().canonicalId()+"|lt:"+this.Bt},wb.prototype.toString=function(){return"Query(target="+this.ee().toString()+"; limitType="+this.Bt+")"},wb.prototype.isEqual=function(t){return this.ee().isEqual(t.ee())&&this.Bt===t.Bt},wb.prototype.se=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.Y()}return 0},wb.prototype.matches=function(t){return this.ie(t)&&this.ne(t)&&this.re(t)&&this.he(t)},wb.prototype.oe=function(){return!xg(this.limit)&&"F"===this.Bt},wb.prototype.ae=function(){return!xg(this.limit)&&"L"===this.Bt},wb.prototype.Kt=function(){return 0<this.xt.length?this.xt[0].field:null},wb.prototype.jt=function(){for(var t=0,e=this.filters;t<e.length;t++){var n=e[t];if(n instanceof rb&&n.ue())return n.field}return null},wb.prototype.ce=function(t){for(var e=0,n=this.filters;e<n.length;e++){var r=n[e];if(r instanceof rb&&0<=t.indexOf(r.op))return r.op}return null},wb.prototype.Ot=function(){return this.ee().Ot()},wb.prototype._e=function(){return null!==this.collectionGroup},wb.prototype.ee=function(){if(!this.Ut)if("F"===this.Bt)this.Ut=new eb(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="desc"===r.dir?"asc":"desc";t.push(new hb(r.field,i))}var o=this.endAt?new cb(this.endAt.position,!this.endAt.before):null,s=this.startAt?new cb(this.startAt.position,!this.startAt.before):null;this.Ut=new eb(this.path,this.collectionGroup,t,this.filters,this.limit,o,s)}return this.Ut},wb.prototype.ie=function(t){var e=t.key.path;return null!==this.collectionGroup?t.key.tt(this.collectionGroup)&&this.path.q(e):Ng.et(this.path)?this.path.isEqual(e):this.path.U(e)},wb.prototype.ne=function(t){for(var e=0,n=this.xt;e<n.length;e++){var r=n[e];if(!r.field.Y()&&null===t.field(r.field))return!1}return!0},wb.prototype.re=function(t){for(var e=0,n=this.filters;e<n.length;e++)if(!n[e].matches(t))return!1;return!0},wb.prototype.he=function(t){return!(this.startAt&&!this.startAt.le(this.orderBy,t)||this.endAt&&this.endAt.le(this.orderBy,t))},wb.prototype.Qt=function(t){},wb),rb=(Es(_b,Qm=function(){}),_b.create=function(t,e,n){if(t.Y())return"in"===e?new ob(t,n):new ib(t,e,n);if(Jg(n)){if("=="!==e)throw new og(ig.INVALID_ARGUMENT,"Invalid query. Null supports only equality comparisons.");return new _b(t,e,n)}if(Zg(n)){if("=="!==e)throw new og(ig.INVALID_ARGUMENT,"Invalid query. NaN supports only equality comparisons.");return new _b(t,e,n)}return"array-contains"===e?new sb(t,n):"in"===e?new ab(t,n):"array-contains-any"===e?new ub(t,n):new _b(t,e,n)},_b.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&Vg(this.value)===Vg(e)&&this.de(Wg(e,this.value))},_b.prototype.de=function(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case">":return 0<t;case">=":return 0<=t;default:return A_()}},_b.prototype.ue=function(){return 0<=["<","<=",">",">="].indexOf(this.op)},_b.prototype.canonicalId=function(){return this.field.j()+this.op.toString()+Gg(this.value)},_b.prototype.isEqual=function(t){return t instanceof _b&&this.op===t.op&&this.field.isEqual(t.field)&&qg(this.value,t.value)},_b.prototype.toString=function(){return this.field.j()+" "+this.op+" "+Gg(this.value)},_b),ib=(Es(bb,Km=rb),bb.prototype.matches=function(t){var e=Ng.N(t.key,this.key);return this.de(e)},bb),ob=(Es(mb,zm=rb),mb.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},mb),sb=(Es(gb,Gm=rb),gb.prototype.matches=function(t){var e=t.field(this.field);return $g(e)&&Bg(e.arrayValue,this.value)},gb),ab=(Es(yb,Hm=rb),yb.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&Bg(this.value.arrayValue,e)},yb),ub=(Es(vb,Wm=rb),vb.prototype.matches=function(t){var e=this,n=t.field(this.field);return!(!$g(n)||!n.arrayValue.values)&&n.arrayValue.values.some(function(t){return Bg(e.value.arrayValue,t)})},vb),cb=(db.prototype.canonicalId=function(){return(this.before?"b":"a")+":"+this.position.map(function(t){return Gg(t)}).join(",")},db.prototype.le=function(t,e){for(var n=0,r=0;r<this.position.length;r++){var i=t[r],o=this.position[r];if(n=i.field.Y()?Ng.N(Ng.Z(o.referenceValue),e.key):Wg(o,e.field(i.field)),"desc"===i.dir&&(n*=-1),0!==n)break}return this.before?n<=0:n<0},db.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++)if(!qg(this.position[e],t.position[e]))return!1;return!0},db),hb=(pb.prototype.compare=function(t,e){var n,r,i,o,s=this.fe?Ng.N(t.key,e.key):(n=this.field,r=e,i=t.field(n),o=r.field(n),null!==i&&null!==o?Wg(i,o):A_());switch(this.dir){case"asc":return s;case"desc":return-1*s;default:return A_()}},pb.prototype.canonicalId=function(){return this.field.j()+this.dir.toString()},pb.prototype.toString=function(){return this.field.j()+" ("+this.dir+")"},pb.prototype.isEqual=function(t){return this.dir===t.dir&&this.field.isEqual(t.field)},pb),lb=(fb.prototype.Ie=function(t){return new fb(this.target,this.targetId,this.Te,t,this.Ee,this.lastLimboFreeSnapshotVersion,this.resumeToken)},fb.prototype.we=function(t,e){return new fb(this.target,this.targetId,this.Te,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)},fb.prototype.Re=function(t){return new fb(this.target,this.targetId,this.Te,this.sequenceNumber,this.Ee,t,this.resumeToken)},fb);function fb(t,e,n,r,i,o,s){void 0===i&&(i=lg.min()),void 0===o&&(o=lg.min()),void 0===s&&(s=Pg.ht),this.target=t,this.targetId=e,this.Te=n,this.sequenceNumber=r,this.Ee=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s}function pb(t,e){this.field=t,void 0===e&&(e="asc"),this.dir=e,this.fe=t.Y()}function db(t,e){this.position=t,this.before=e}function vb(t,e){return Wm.call(this,t,"array-contains-any",e)||this}function yb(t,e){return Hm.call(this,t,"in",e)||this}function gb(t,e){return Gm.call(this,t,"array-contains",e)||this}function mb(t,e){var n=this;return(n=zm.call(this,t,"in",e)||this).keys=(e.arrayValue.values||[]).map(function(t){return Ng.Z(t.referenceValue)}),n}function bb(t,e,n){var r=this;return(r=Km.call(this,t,e,n)||this).key=Ng.Z(n.referenceValue),r}function _b(t,e,n){var r=this;return(r=Qm.call(this)||this).field=t,r.op=e,r.value=n,r}function wb(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.xt=n,this.filters=r,this.limit=i,this.Bt=o,this.startAt=s,this.endAt=a,this.qt=null,this.Ut=null,this.startAt&&this.Qt(this.startAt),this.endAt&&this.Qt(this.endAt)}function Eb(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.Mt=null}function Tb(){return null!==Ym&&Ym.apply(this,arguments)||this}function Ib(t,e,n){var r=this;return(r=Xm.call(this,t,e)||this).hasCommittedMutations=!(!n||!n.hasCommittedMutations),r}function Sb(t,e,n,r){var i=this;return(i=$m.call(this,t,e)||this).kt=n,i.At=!!r.At,i.hasCommittedMutations=!!r.hasCommittedMutations,i}function Cb(t){switch(t){case ig.OK:return A_();case ig.CANCELLED:case ig.UNKNOWN:case ig.DEADLINE_EXCEEDED:case ig.RESOURCE_EXHAUSTED:case ig.INTERNAL:case ig.UNAVAILABLE:case ig.UNAUTHENTICATED:return;case ig.INVALID_ARGUMENT:case ig.NOT_FOUND:case ig.ALREADY_EXISTS:case ig.PERMISSION_DENIED:case ig.FAILED_PRECONDITION:case ig.ABORTED:case ig.OUT_OF_RANGE:case ig.UNIMPLEMENTED:case ig.DATA_LOSS:return 1;default:return A_()}}function Nb(t){if(void 0===t)return C_("GRPC error has no .code"),ig.UNKNOWN;switch(t){case qm.OK:return ig.OK;case qm.CANCELLED:return ig.CANCELLED;case qm.UNKNOWN:return ig.UNKNOWN;case qm.DEADLINE_EXCEEDED:return ig.DEADLINE_EXCEEDED;case qm.RESOURCE_EXHAUSTED:return ig.RESOURCE_EXHAUSTED;case qm.INTERNAL:return ig.INTERNAL;case qm.UNAVAILABLE:return ig.UNAVAILABLE;case qm.UNAUTHENTICATED:return ig.UNAUTHENTICATED;case qm.INVALID_ARGUMENT:return ig.INVALID_ARGUMENT;case qm.NOT_FOUND:return ig.NOT_FOUND;case qm.ALREADY_EXISTS:return ig.ALREADY_EXISTS;case qm.PERMISSION_DENIED:return ig.PERMISSION_DENIED;case qm.FAILED_PRECONDITION:return ig.FAILED_PRECONDITION;case qm.ABORTED:return ig.ABORTED;case qm.OUT_OF_RANGE:return ig.OUT_OF_RANGE;case qm.UNIMPLEMENTED:return ig.UNIMPLEMENTED;case qm.DATA_LOSS:return ig.DATA_LOSS;default:return A_()}}(Bm=qm=qm||{})[Bm.OK=0]="OK",Bm[Bm.CANCELLED=1]="CANCELLED",Bm[Bm.UNKNOWN=2]="UNKNOWN",Bm[Bm.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Bm[Bm.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Bm[Bm.NOT_FOUND=5]="NOT_FOUND",Bm[Bm.ALREADY_EXISTS=6]="ALREADY_EXISTS",Bm[Bm.PERMISSION_DENIED=7]="PERMISSION_DENIED",Bm[Bm.UNAUTHENTICATED=16]="UNAUTHENTICATED",Bm[Bm.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Bm[Bm.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Bm[Bm.ABORTED=10]="ABORTED",Bm[Bm.OUT_OF_RANGE=11]="OUT_OF_RANGE",Bm[Bm.UNIMPLEMENTED=12]="UNIMPLEMENTED",Bm[Bm.INTERNAL=13]="INTERNAL",Bm[Bm.UNAVAILABLE=14]="UNAVAILABLE",Bm[Bm.DATA_LOSS=15]="DATA_LOSS";var Ab=(Db.prototype.Ae=function(t,e){return new Db(this.N,this.root.Ae(t,e,this.N).me(null,null,Ob.Pe,null,null))},Db.prototype.remove=function(t){return new Db(this.N,this.root.remove(t,this.N).me(null,null,Ob.Pe,null,null))},Db.prototype.get=function(t){for(var e=this.root;!e.B();){var n=this.N(t,e.key);if(0===n)return e.value;n<0?e=e.left:0<n&&(e=e.right)}return null},Db.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.B();){var r=this.N(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},Db.prototype.B=function(){return this.root.B()},Object.defineProperty(Db.prototype,"size",{get:function(){return this.root.size},enumerable:!0,configurable:!0}),Db.prototype.Ve=function(){return this.root.Ve()},Db.prototype.ge=function(){return this.root.ge()},Db.prototype.pe=function(t){return this.root.pe(t)},Db.prototype.forEach=function(n){this.pe(function(t,e){return n(t,e),!1})},Db.prototype.toString=function(){var n=[];return this.pe(function(t,e){return n.push(t+":"+e),!1}),"{"+n.join(", ")+"}"},Db.prototype.ye=function(t){return this.root.ye(t)},Db.prototype.be=function(){return new kb(this.root,null,this.N,!1)},Db.prototype.ve=function(t){return new kb(this.root,t,this.N,!1)},Db.prototype.Se=function(){return new kb(this.root,null,this.N,!0)},Db.prototype.De=function(t){return new kb(this.root,t,this.N,!0)},Db),kb=(Pb.prototype.Ne=function(){var t=this.Fe.pop(),e={key:t.key,value:t.value};if(this.Ce)for(t=t.left;!t.B();)this.Fe.push(t),t=t.right;else for(t=t.right;!t.B();)this.Fe.push(t),t=t.left;return e},Pb.prototype.$e=function(){return 0<this.Fe.length},Pb.prototype.ke=function(){if(0===this.Fe.length)return null;var t=this.Fe[this.Fe.length-1];return{key:t.key,value:t.value}},Pb),Ob=(Rb.prototype.me=function(t,e,n,r,i){return new Rb(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)},Rb.prototype.B=function(){return!1},Rb.prototype.pe=function(t){return this.left.pe(t)||t(this.key,this.value)||this.right.pe(t)},Rb.prototype.ye=function(t){return this.right.ye(t)||t(this.key,this.value)||this.left.ye(t)},Rb.prototype.min=function(){return this.left.B()?this:this.left.min()},Rb.prototype.Ve=function(){return this.min().key},Rb.prototype.ge=function(){return this.right.B()?this.key:this.right.ge()},Rb.prototype.Ae=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.me(null,null,null,r.left.Ae(t,e,n),null):0===i?r.me(null,e,null,null,null):r.me(null,null,null,null,r.right.Ae(t,e,n))).Le()},Rb.prototype.Me=function(){if(this.left.B())return Rb.EMPTY;var t=this;return t.left.Oe()||t.left.left.Oe()||(t=t.xe()),(t=t.me(null,null,null,t.left.Me(),null)).Le()},Rb.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r.left.B()||r.left.Oe()||r.left.left.Oe()||(r=r.xe()),r=r.me(null,null,null,r.left.remove(t,e),null);else{if(r.left.Oe()&&(r=r.Be()),r.right.B()||r.right.Oe()||r.right.left.Oe()||(r=r.qe()),0===e(t,r.key)){if(r.right.B())return Rb.EMPTY;n=r.right.min(),r=r.me(n.key,n.value,null,null,r.right.Me())}r=r.me(null,null,null,null,r.right.remove(t,e))}return r.Le()},Rb.prototype.Oe=function(){return this.color},Rb.prototype.Le=function(){var t=this;return t.right.Oe()&&!t.left.Oe()&&(t=t.Ue()),t.left.Oe()&&t.left.left.Oe()&&(t=t.Be()),t.left.Oe()&&t.right.Oe()&&(t=t.Qe()),t},Rb.prototype.xe=function(){var t=this.Qe();return t.right.left.Oe()&&(t=(t=(t=t.me(null,null,null,null,t.right.Be())).Ue()).Qe()),t},Rb.prototype.qe=function(){var t=this.Qe();return t.left.left.Oe()&&(t=(t=t.Be()).Qe()),t},Rb.prototype.Ue=function(){var t=this.me(null,null,Rb.RED,null,this.right.left);return this.right.me(null,null,this.color,t,null)},Rb.prototype.Be=function(){var t=this.me(null,null,Rb.RED,this.left.right,null);return this.left.me(null,null,this.color,null,t)},Rb.prototype.Qe=function(){var t=this.left.me(null,null,!this.left.color,null,null),e=this.right.me(null,null,!this.right.color,null,null);return this.me(null,null,!this.color,t,e)},Rb.prototype.We=function(){var t=this.je();return Math.pow(2,t)<=this.size+1},Rb.prototype.je=function(){if(this.Oe()&&this.left.Oe())throw A_();if(this.right.Oe())throw A_();var t=this.left.je();if(t!==this.right.je())throw A_();return t+(this.Oe()?0:1)},Rb);function Rb(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:Rb.RED,this.left=null!=r?r:Rb.EMPTY,this.right=null!=i?i:Rb.EMPTY,this.size=this.left.size+1+this.right.size}function Pb(t,e,n,r){this.Ce=r,this.Fe=[];for(var i=1;!t.B();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.Ce?t.left:t.right;else{if(0===i){this.Fe.push(t);break}this.Fe.push(t),t=this.Ce?t.right:t.left}}function Db(t,e){this.N=t,this.root=e||Ob.EMPTY}function xb(){this.size=0}Ob.EMPTY=null,Ob.RED=!0,Ob.Pe=!1,Ob.EMPTY=(Object.defineProperty(xb.prototype,"key",{get:function(){throw A_()},enumerable:!0,configurable:!0}),Object.defineProperty(xb.prototype,"value",{get:function(){throw A_()},enumerable:!0,configurable:!0}),Object.defineProperty(xb.prototype,"color",{get:function(){throw A_()},enumerable:!0,configurable:!0}),Object.defineProperty(xb.prototype,"left",{get:function(){throw A_()},enumerable:!0,configurable:!0}),Object.defineProperty(xb.prototype,"right",{get:function(){throw A_()},enumerable:!0,configurable:!0}),xb.prototype.me=function(t,e,n,r,i){return this},xb.prototype.Ae=function(t,e,n){return new Ob(t,e)},xb.prototype.remove=function(t,e){return this},xb.prototype.B=function(){return!0},xb.prototype.pe=function(t){return!1},xb.prototype.ye=function(t){return!1},xb.prototype.Ve=function(){return null},xb.prototype.ge=function(){return null},xb.prototype.Oe=function(){return!1},xb.prototype.We=function(){return!0},xb.prototype.je=function(){return 0},new xb);var Lb=(jb.prototype.has=function(t){return null!==this.data.get(t)},jb.prototype.first=function(){return this.data.Ve()},jb.prototype.last=function(){return this.data.ge()},Object.defineProperty(jb.prototype,"size",{get:function(){return this.data.size},enumerable:!0,configurable:!0}),jb.prototype.indexOf=function(t){return this.data.indexOf(t)},jb.prototype.forEach=function(n){this.data.pe(function(t,e){return n(t),!1})},jb.prototype.Ke=function(t,e){for(var n=this.data.ve(t[0]);n.$e();){var r=n.Ne();if(0<=this.N(r.key,t[1]))return;e(r.key)}},jb.prototype.Ge=function(t,e){var n;for(n=void 0!==e?this.data.ve(e):this.data.be();n.$e();)if(!t(n.Ne().key))return},jb.prototype.ze=function(t){var e=this.data.ve(t);return e.$e()?e.Ne().key:null},jb.prototype.be=function(){return new Mb(this.data.be())},jb.prototype.ve=function(t){return new Mb(this.data.ve(t))},jb.prototype.add=function(t){return this.me(this.data.remove(t).Ae(t,!0))},jb.prototype.delete=function(t){return this.has(t)?this.me(this.data.remove(t)):this},jb.prototype.B=function(){return this.data.B()},jb.prototype.He=function(t){var e=this;return e.size<t.size&&(e=t,t=this),t.forEach(function(t){e=e.add(t)}),e},jb.prototype.isEqual=function(t){if(!(t instanceof jb))return!1;if(this.size!==t.size)return!1;for(var e=this.data.be(),n=t.data.be();e.$e();){var r=e.Ne().key,i=n.Ne().key;if(0!==this.N(r,i))return!1}return!0},jb.prototype.W=function(){var e=[];return this.forEach(function(t){e.push(t)}),e},jb.prototype.toString=function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"},jb.prototype.me=function(t){var e=new jb(this.N);return e.data=t,e},jb),Mb=(Ub.prototype.Ne=function(){return this.Ye.Ne().key},Ub.prototype.$e=function(){return this.Ye.$e()},Ub),Fb=new Ab(Ng.N);function Ub(t){this.Ye=t}function jb(t){this.N=t,this.data=new Ab(this.N)}function Vb(){return Fb}function qb(){return Vb()}var Bb=new Ab(Ng.N);function Wb(){return Bb}var Hb=new Ab(Ng.N);function Gb(){return Hb}var zb=new Lb(Ng.N);function Kb(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=zb,r=0,i=t;r<i.length;r++){var o=i[r];n=n.add(o)}return n}var Qb=new Lb(D_);function Yb(){return Qb}function Xb(t,e,n,r){this.ws=t,this.removedTargetIds=e,this.key=n,this.Rs=r}function $b(t,e){this.targetId=t,this.As=e}function Jb(t,e,n,r){void 0===n&&(n=Pg.ht),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}var Zb=(f_.Ze=function(t){return new f_(t.N)},f_.prototype.has=function(t){return null!=this.Je.get(t)},f_.prototype.get=function(t){return this.Je.get(t)},f_.prototype.first=function(){return this.Xe.Ve()},f_.prototype.last=function(){return this.Xe.ge()},f_.prototype.B=function(){return this.Xe.B()},f_.prototype.indexOf=function(t){var e=this.Je.get(t);return e?this.Xe.indexOf(e):-1},Object.defineProperty(f_.prototype,"size",{get:function(){return this.Xe.size},enumerable:!0,configurable:!0}),f_.prototype.forEach=function(n){this.Xe.pe(function(t,e){return n(t),!1})},f_.prototype.add=function(t){var e=this.delete(t.key);return e.me(e.Je.Ae(t.key,t),e.Xe.Ae(t,null))},f_.prototype.delete=function(t){var e=this.get(t);return e?this.me(this.Je.remove(t),this.Xe.remove(e)):this},f_.prototype.isEqual=function(t){if(!(t instanceof f_))return!1;if(this.size!==t.size)return!1;for(var e=this.Xe.be(),n=t.Xe.be();e.$e();){var r=e.Ne().key,i=n.Ne().key;if(!r.isEqual(i))return!1}return!0},f_.prototype.toString=function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"},f_.prototype.me=function(t,e){var n=new f_;return n.N=this.N,n.Je=t,n.Xe=e,n},f_),t_=(l_.prototype.track=function(t){var e=t.doc.key,n=this.ts.get(e);!n||0!==t.type&&3===n.type?this.ts=this.ts.Ae(e,t):3===t.type&&1!==n.type?this.ts=this.ts.Ae(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.ts=this.ts.Ae(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.ts=this.ts.Ae(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.ts=this.ts.remove(e):1===t.type&&2===n.type?this.ts=this.ts.Ae(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.ts=this.ts.Ae(e,{type:2,doc:t.doc}):A_()},l_.prototype.es=function(){var n=[];return this.ts.pe(function(t,e){n.push(e)}),n},l_),e_=(h_.os=function(t,e,n,r){var i=[];return e.forEach(function(t){i.push({type:0,doc:t})}),new h_(t,e,Zb.Ze(e),i,n,r,!0,!1)},Object.defineProperty(h_.prototype,"hasPendingWrites",{get:function(){return!this.ns.B()},enumerable:!0,configurable:!0}),h_.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.rs===t.rs&&this.ns.isEqual(t.ns)&&this.query.isEqual(t.query)&&this.docs.isEqual(t.docs)&&this.ss.isEqual(t.ss)))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},h_),n_=(c_.ls=function(t,e){var n=new Map;return n.set(t,r_.ds(t,e)),new c_(lg.min(),n,Yb(),Vb(),Kb())},c_),r_=(u_.ds=function(t,e){return new u_(Pg.ht,e,Kb(),Kb(),Kb())},u_),i_=(Object.defineProperty(a_.prototype,"fs",{get:function(){return this.gs},enumerable:!0,configurable:!0}),Object.defineProperty(a_.prototype,"resumeToken",{get:function(){return this.Vs},enumerable:!0,configurable:!0}),Object.defineProperty(a_.prototype,"ys",{get:function(){return 0!==this.ms},enumerable:!0,configurable:!0}),Object.defineProperty(a_.prototype,"bs",{get:function(){return this.ps},enumerable:!0,configurable:!0}),a_.prototype.vs=function(t){0<t.rt()&&(this.ps=!0,this.Vs=t)},a_.prototype.Ss=function(){var n=Kb(),r=Kb(),i=Kb();return this.Ps.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:A_()}}),new r_(this.Vs,this.gs,n,r,i)},a_.prototype.Ds=function(){this.ps=!1,this.Ps=d_()},a_.prototype.Cs=function(t,e){this.ps=!0,this.Ps=this.Ps.Ae(t,e)},a_.prototype.Fs=function(t){this.ps=!0,this.Ps=this.Ps.remove(t)},a_.prototype.Ns=function(){this.ms+=1},a_.prototype.$s=function(){--this.ms},a_.prototype.ks=function(){this.ps=!0,this.gs=!0},a_),o_=(s_.prototype.qs=function(t){for(var e=0,n=t.ws;e<n.length;e++){var r=n[e];t.Rs instanceof Jm?this.Us(r,t.Rs):t.Rs instanceof Zm&&this.Qs(r,t.key,t.Rs)}for(var i=0,o=t.removedTargetIds;i<o.length;i++){var s=o[i];this.Qs(s,t.key,t.Rs)}},s_.prototype.Ws=function(n){var r=this;this.js(n,function(t){var e=r.Ks(t);switch(n.state){case 0:r.Gs(t)&&e.vs(n.resumeToken);break;case 1:e.$s(),e.ys||e.Ds(),e.vs(n.resumeToken);break;case 2:e.$s(),e.ys||r.removeTarget(t);break;case 3:r.Gs(t)&&(e.ks(),e.vs(n.resumeToken));break;case 4:r.Gs(t)&&(r.zs(t),e.vs(n.resumeToken));break;default:A_()}})},s_.prototype.js=function(t,n){var r=this;0<t.targetIds.length?t.targetIds.forEach(n):this.Ms.forEach(function(t,e){r.Gs(e)&&n(e)})},s_.prototype.Hs=function(t){var e=t.targetId,n=t.As.count,r=this.Ys(e);if(r){var i=r.target;if(i.Ot())if(0===n){var o=new Ng(i.path);this.Qs(e,o,new Zm(o,lg.min()))}else k_(1===n);else this.Js(e)!==n&&(this.zs(e),this.Bs=this.Bs.add(e))}},s_.prototype.Xs=function(i){var o=this,s=new Map;this.Ms.forEach(function(t,e){var n=o.Ys(e);if(n){if(t.fs&&n.target.Ot()){var r=new Ng(n.target.path);null!==o.Os.get(r)||o.Zs(e,r)||o.Qs(e,r,new Zm(r,i))}t.bs&&(s.set(e,t.Ss()),t.Ds())}});var r=Kb();this.xs.forEach(function(t,e){var n=!0;e.Ge(function(t){var e=o.Ys(t);return!e||2===e.Te||(n=!1)}),n&&(r=r.add(t))});var t=new n_(i,s,this.Bs,this.Os,r);return this.Os=Vb(),this.xs=p_(),this.Bs=new Lb(D_),t},s_.prototype.Us=function(t,e){if(this.Gs(t)){var n=this.Zs(t,e.key)?2:0;this.Ks(t).Cs(e.key,n),this.Os=this.Os.Ae(e.key,e),this.xs=this.xs.Ae(e.key,this.ti(e.key).add(t))}},s_.prototype.Qs=function(t,e,n){if(this.Gs(t)){var r=this.Ks(t);this.Zs(t,e)?r.Cs(e,1):r.Fs(e),this.xs=this.xs.Ae(e,this.ti(e).delete(t)),n&&(this.Os=this.Os.Ae(e,n))}},s_.prototype.removeTarget=function(t){this.Ms.delete(t)},s_.prototype.Js=function(t){var e=this.Ks(t).Ss();return this.Ls.ei(t).size+e.Ts.size-e.Is.size},s_.prototype.Ns=function(t){this.Ks(t).Ns()},s_.prototype.Ks=function(t){var e=this.Ms.get(t);return e||(e=new i_,this.Ms.set(t,e)),e},s_.prototype.ti=function(t){var e=this.xs.get(t);return e||(e=new Lb(D_),this.xs=this.xs.Ae(t,e)),e},s_.prototype.Gs=function(t){var e=null!==this.Ys(t);return e||S_("WatchChangeAggregator","Detected inactive target",t),e},s_.prototype.Ys=function(t){var e=this.Ms.get(t);return e&&e.ys?null:this.Ls.si(t)},s_.prototype.zs=function(e){var n=this;this.Ms.set(e,new i_),this.Ls.ei(e).forEach(function(t){n.Qs(e,t,null)})},s_.prototype.Zs=function(t,e){return this.Ls.ei(t).has(e)},s_);function s_(t){this.Ls=t,this.Ms=new Map,this.Os=Vb(),this.xs=p_(),this.Bs=new Lb(D_)}function a_(){this.ms=0,this.Ps=d_(),this.Vs=Pg.ht,this.gs=!1,this.ps=!0}function u_(t,e,n,r,i){this.resumeToken=t,this.fs=e,this.Ts=n,this.Es=r,this.Is=i}function c_(t,e,n,r,i){this.Ee=t,this.as=e,this.us=n,this.cs=r,this._s=i}function h_(t,e,n,r,i,o,s,a){this.query=t,this.docs=e,this.ss=n,this.docChanges=r,this.ns=i,this.fromCache=o,this.rs=s,this.hs=a}function l_(){this.ts=new Ab(Ng.N)}function f_(n){this.N=n?function(t,e){return n(t,e)||Ng.N(t.key,e.key)}:function(t,e){return Ng.N(t.key,e.key)},this.Je=Wb(),this.Xe=new Ab(this.N)}function p_(){return new Ab(Ng.N)}function d_(){return new Ab(Ng.N)}var v_={asc:"ASCENDING",desc:"DESCENDING"},y_={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","array-contains-any":"ARRAY_CONTAINS_ANY"},g_=(m_.prototype.ni=function(t){var e=void 0===t.code?ig.UNKNOWN:Nb(t.code);return new og(e,t.message||"")},m_.prototype.ri=function(t){return this.options.hi||xg(t)?t:{value:t}},m_.prototype.oi=function(t){var e;return xg(e="object"==typeof t?t.value:t)?null:e},m_.prototype._t=function(t){return{integerValue:""+t}},m_.prototype.lt=function(t){if(this.options.hi){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Lg(t)?"-0":t}},m_.prototype.ai=function(t){return Mg(t)?this._t(t):this.lt(t)},m_.prototype.C=function(t){return this.options.hi?new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+t.nanoseconds).slice(-9)+"Z":{seconds:""+t.seconds,nanos:t.nanoseconds}},m_.prototype.v=function(t){var e=zg(t);return new hg(e.seconds,e.nanos)},m_.prototype.ui=function(t){return this.options.hi?t.toBase64():t.toUint8Array()},m_.prototype.ci=function(t){return this.options.hi?(k_(void 0===t||"string"==typeof t),Pg.fromBase64String(t||"")):(k_(void 0===t||t instanceof Uint8Array),Pg.fromUint8Array(t||new Uint8Array))},m_.prototype.toVersion=function(t){return this.C(t.C())},m_.prototype.fromVersion=function(t){return k_(!!t),lg.v(this.v(t))},m_.prototype._i=function(t,e){return this.li(e||this.ii).child("documents").child(t).j()},m_.prototype.di=function(t){var e=pg.K(t);return k_(b_(e)),e},m_.prototype.fi=function(t){return this._i(t.path)},m_.prototype.Z=function(t){var e=this.di(t);return k_(e.get(1)===this.ii.projectId),k_(!e.get(3)&&!this.ii.database||e.get(3)===this.ii.database),new Ng(this.Ti(e))},m_.prototype.Ei=function(t){return this._i(t)},m_.prototype.Ii=function(t){var e=this.di(t);return 4===e.length?pg.G:this.Ti(e)},Object.defineProperty(m_.prototype,"wi",{get:function(){return new pg(["projects",this.ii.projectId,"databases",this.ii.database]).j()},enumerable:!0,configurable:!0}),m_.prototype.li=function(t){return new pg(["projects",t.projectId,"databases",t.database])},m_.prototype.Ti=function(t){return k_(4<t.length&&"documents"===t.get(4)),t.k(5)},m_.prototype.Ri=function(t,e){return{name:this.fi(t),fields:e.proto.mapValue.fields}},m_.prototype.Ai=function(t){return{name:this.fi(t.key),fields:t.Lt().mapValue.fields,updateTime:this.C(t.version.C())}},m_.prototype.mi=function(t,e){var n=this.Z(t.name),r=this.fromVersion(t.updateTime),i=new Sm({mapValue:{fields:t.fields}});return new Jm(n,r,i,{hasCommittedMutations:!!e})},m_.prototype.Pi=function(t){k_(!!t.found),t.found.name,t.found.updateTime;var e=this.Z(t.found.name),n=this.fromVersion(t.found.updateTime),r=new Sm({mapValue:{fields:t.found.fields}});return new Jm(e,n,r,{})},m_.prototype.Vi=function(t){k_(!!t.missing),k_(!!t.readTime);var e=this.Z(t.missing),n=this.fromVersion(t.readTime);return new Zm(e,n)},m_.prototype.gi=function(t){return"found"in t?this.Pi(t):"missing"in t?this.Vi(t):A_()},m_.prototype.pi=function(t){var e;if("targetChange"in t){t.targetChange;var n=this.yi(t.targetChange.targetChangeType||"NO_CHANGE"),r=t.targetChange.targetIds||[],i=this.ci(t.targetChange.resumeToken),o=t.targetChange.cause,s=o&&this.ni(o);e=new Jb(n,r,i,s||null)}else if("documentChange"in t){t.documentChange;var a=t.documentChange;a.document,a.document.name,a.document.updateTime;var u=this.Z(a.document.name),c=this.fromVersion(a.document.updateTime),h=new Sm({mapValue:{fields:a.document.fields}}),l=new Jm(u,c,h,{}),f=a.targetIds||[],p=a.removedTargetIds||[];e=new Xb(f,p,l.key,l)}else if("documentDelete"in t){t.documentDelete;var d=t.documentDelete;d.document;var v=this.Z(d.document),y=d.readTime?this.fromVersion(d.readTime):lg.min(),g=new Zm(v,y),m=d.removedTargetIds||[];e=new Xb([],m,g.key,g)}else if("documentRemove"in t){t.documentRemove;var b=t.documentRemove;b.document;var _=this.Z(b.document),w=b.removedTargetIds||[];e=new Xb([],w,_,null)}else{if(!("filter"in t))return A_();t.filter;var E=t.filter;E.targetId;var T=E.count||0,I=new Vm(T),S=E.targetId;e=new $b(S,I)}return e},m_.prototype.yi=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:A_()},m_.prototype.bi=function(t){if(!("targetChange"in t))return lg.min();var e=t.targetChange;return e.targetIds&&e.targetIds.length||!e.readTime?lg.min():this.fromVersion(e.readTime)},m_.prototype.vi=function(t){var e,n=this;if(t instanceof _m)e={update:this.Ri(t.key,t.value)};else if(t instanceof Tm)e={delete:this.fi(t.key)};else if(t instanceof wm)e={update:this.Ri(t.key,t.data),updateMask:this.Si(t.Vt)};else if(t instanceof Em)e={transform:{document:this.fi(t.key),fieldTransforms:t.fieldTransforms.map(function(t){return n.Di(t)})}};else{if(!(t instanceof Im))return A_();e={verify:this.fi(t.key)}}return t.Rt.Tt||(e.currentDocument=this.Ci(t.Rt)),e},m_.prototype.Fi=function(t){var e=this,n=t.currentDocument?this.Ni(t.currentDocument):mm.ft();if(t.update){t.update.name;var r=this.Z(t.update.name),i=new Sm({mapValue:{fields:t.update.fields}});if(t.updateMask){var o=this.$i(t.updateMask);return new wm(r,i,o,n)}return new _m(r,i,n)}if(t.delete){var s=this.Z(t.delete);return new Tm(s,n)}if(t.transform){var a=this.Z(t.transform.document),u=t.transform.fieldTransforms.map(function(t){return e.ki(t)});return k_(!0===n.exists),new Em(a,u)}if(t.verify){var c=this.Z(t.verify);return new Im(c,n)}return A_()},m_.prototype.Ci=function(t){return void 0!==t.updateTime?{updateTime:this.toVersion(t.updateTime)}:void 0!==t.exists?{exists:t.exists}:A_()},m_.prototype.Ni=function(t){return void 0!==t.updateTime?mm.updateTime(this.fromVersion(t.updateTime)):void 0!==t.exists?mm.exists(t.exists):mm.ft()},m_.prototype.Li=function(t,e){var n=t.updateTime?this.fromVersion(t.updateTime):this.fromVersion(e);n.isEqual(lg.min())&&(n=this.fromVersion(e));var r=null;return t.transformResults&&0<t.transformResults.length&&(r=t.transformResults),new hm(n,r)},m_.prototype.Mi=function(t,e){var n=this;return t&&0<t.length?(k_(void 0!==e),t.map(function(t){return n.Li(t,e)})):[]},m_.prototype.Di=function(t){var e=t.transform;if(e instanceof em)return{fieldPath:t.field.j(),setToServerValue:"REQUEST_TIME"};if(e instanceof rm)return{fieldPath:t.field.j(),appendMissingElements:{values:e.elements}};if(e instanceof im)return{fieldPath:t.field.j(),removeAllFromArray:{values:e.elements}};if(e instanceof om)return{fieldPath:t.field.j(),increment:e.ct};throw A_()},m_.prototype.ki=function(t){var e=null;if("setToServerValue"in t)k_("REQUEST_TIME"===t.setToServerValue),e=em.instance;else if("appendMissingElements"in t){var n=t.appendMissingElements.values||[];e=new rm(n)}else if("removeAllFromArray"in t){var r=t.removeAllFromArray.values||[];e=new im(r)}else"increment"in t?e=new om(this,t.increment):A_();var i=Sg.X(t.fieldPath);return new gm(i,e)},m_.prototype.Oi=function(t){return{documents:[this.Ei(t.path)]}},m_.prototype.xi=function(t){k_(1===t.documents.length);var e=t.documents[0];return nb.Wt(this.Ii(e)).ee()},m_.prototype.Bi=function(t){var e={structuredQuery:{}},n=t.path;null!==t.collectionGroup?(e.parent=this.Ei(n),e.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(e.parent=this.Ei(n.L()),e.structuredQuery.from=[{collectionId:n.O()}]);var r=this.qi(t.filters);r&&(e.structuredQuery.where=r);var i=this.Ui(t.orderBy);i&&(e.structuredQuery.orderBy=i);var o=this.ri(t.limit);return null!==o&&(e.structuredQuery.limit=o),t.startAt&&(e.structuredQuery.startAt=this.Qi(t.startAt)),t.endAt&&(e.structuredQuery.endAt=this.Qi(t.endAt)),e},m_.prototype.Wi=function(t){var e=this.Ii(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;if(0<r){k_(1===r);var o=n.from[0];o.allDescendants?i=o.collectionId:e=e.child(o.collectionId)}var s=[];n.where&&(s=this.ji(n.where));var a=[];n.orderBy&&(a=this.Ki(n.orderBy));var u=null;n.limit&&(u=this.oi(n.limit));var c=null;n.startAt&&(c=this.Gi(n.startAt));var h=null;return n.endAt&&(h=this.Gi(n.endAt)),new nb(e,i,a,s,u,"F",c,h).ee()},m_.prototype.zi=function(t){var e=this.Hi(t.Te);return null==e?null:{"goog-listen-tags":e}},m_.prototype.Hi=function(t){switch(t){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return A_()}},m_.prototype.ee=function(t){var e,n=t.target;return(e=n.Ot()?{documents:this.Oi(n)}:{query:this.Bi(n)}).targetId=t.targetId,0<t.resumeToken.rt()&&(e.resumeToken=this.ui(t.resumeToken)),e},m_.prototype.qi=function(t){var e=this;if(0!==t.length){var n=t.map(function(t){return t instanceof rb?e.Yi(t):A_()});return 1===n.length?n[0]:{compositeFilter:{op:"AND",filters:n}}}},m_.prototype.ji=function(t){var e=this;return t?void 0!==t.unaryFilter?[this.Ji(t)]:void 0!==t.fieldFilter?[this.Xi(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map(function(t){return e.ji(t)}).reduce(function(t,e){return t.concat(e)}):A_():[]},m_.prototype.Ui=function(t){var e=this;if(0!==t.length)return t.map(function(t){return e.Zi(t)})},m_.prototype.Ki=function(t){var e=this;return t.map(function(t){return e.tn(t)})},m_.prototype.Qi=function(t){return{before:t.before,values:t.position}},m_.prototype.Gi=function(t){var e=!!t.before,n=t.values||[];return new cb(n,e)},m_.prototype.en=function(t){return v_[t]},m_.prototype.sn=function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}},m_.prototype.nn=function(t){return y_[t]},m_.prototype.rn=function(t){switch(t){case"EQUAL":return"==";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return A_()}},m_.prototype.hn=function(t){return{fieldPath:t.j()}},m_.prototype.on=function(t){return Sg.X(t.fieldPath)},m_.prototype.Zi=function(t){return{field:this.hn(t.field),direction:this.en(t.dir)}},m_.prototype.tn=function(t){return new hb(this.on(t.field),this.sn(t.direction))},m_.prototype.Xi=function(t){return rb.create(this.on(t.fieldFilter.field),this.rn(t.fieldFilter.op),t.fieldFilter.value)},m_.prototype.Yi=function(t){if("=="===t.op){if(Zg(t.value))return{unaryFilter:{field:this.hn(t.field),op:"IS_NAN"}};if(Jg(t.value))return{unaryFilter:{field:this.hn(t.field),op:"IS_NULL"}}}return{fieldFilter:{field:this.hn(t.field),op:this.nn(t.op),value:t.value}}},m_.prototype.Ji=function(t){switch(t.unaryFilter.op){case"IS_NAN":var e=this.on(t.unaryFilter.field);return rb.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=this.on(t.unaryFilter.field);return rb.create(n,"==",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return A_()}},m_.prototype.Si=function(t){var e=[];return t.fields.forEach(function(t){return e.push(t.j())}),{fieldPaths:e}},m_.prototype.$i=function(t){var e=t.fieldPaths||[];return new ym(e.map(function(t){return Sg.X(t)}))},m_);function m_(t,e){this.ii=t,this.options=e}function b_(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}var __=(E_.an=function(t){E_.platform&&A_(),E_.platform=t},E_.nt=function(){return E_.platform||A_(),E_.platform},E_),w_=new Ra("@firebase/firestore");function E_(){}function T_(){return w_.logLevel}function I_(t){w_.logLevel=t}function S_(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(w_.logLevel<=Ta.DEBUG){var r=e.map(N_);w_.debug.apply(w_,ks(["Firestore ("+Jy+"): "+t],r))}}function C_(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(w_.logLevel<=Ta.ERROR){var r=e.map(N_);w_.error.apply(w_,ks(["Firestore ("+Jy+"): "+t],r))}}function N_(t){if("string"==typeof t)return t;var e=__.nt();try{return e.un(t)}catch(e){return t}}function A_(t){void 0===t&&(t="Unexpected state");var e="FIRESTORE ("+Jy+") INTERNAL ASSERTION FAILED: "+t;throw C_(e),new Error(e)}function k_(t){t||A_()}function O_(t){return t}var R_=(P_.cn=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length,n="";n.length<20;)for(var r=__.nt()._n(40),i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%t.length));return n},P_);function P_(){}function D_(t,e){return t<e?-1:e<t?1:0}function x_(t,n,r){return t.length===n.length&&t.every(function(t,e){return r(t,n[e])})}function L_(t){return t+"\0"}function M_(t,e,n,r,i){this.ii=t,this.persistenceKey=e,this.host=n,this.ssl=r,this.forceLongPolling=i}var F_=(Object.defineProperty(rw.prototype,"ln",{get:function(){return"(default)"===this.database},enumerable:!0,configurable:!0}),rw.prototype.isEqual=function(t){return t instanceof rw&&t.projectId===this.projectId&&t.database===this.database},rw.prototype.S=function(t){return D_(this.projectId,t.projectId)||D_(this.database,t.database)},rw),U_=(nw.prototype.get=function(t){var e=this.dn(t),n=this.fn[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}},nw.prototype.has=function(t){return void 0!==this.get(t)},nw.prototype.set=function(t,e){var n=this.dn(t),r=this.fn[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.fn[n]=[[t,e]]},nw.prototype.delete=function(t){var e=this.dn(t),n=this.fn[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.fn[e]:n.splice(r,1),!0;return!1},nw.prototype.forEach=function(a){Og(this.fn,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)}})},nw.prototype.B=function(){return Rg(this.fn)},nw),j_=(ew.prototype.at=function(t,e,n){for(var r=n.En,i=0;i<this.mutations.length;i++){var o=this.mutations[i];if(o.key.isEqual(t)){var s=r[i];e=o.at(e,s)}}return e},ew.prototype.ot=function(t,e){for(var n=0,r=this.baseMutations;n<r.length;n++){var i=r[n];i.key.isEqual(t)&&(e=i.ot(e,e,this.Tn))}for(var o=e,s=0,a=this.mutations;s<a.length;s++){var u=a[s];u.key.isEqual(t)&&(e=u.ot(e,o,this.Tn))}return e},ew.prototype.In=function(n){var r=this,i=n;return this.mutations.forEach(function(t){var e=r.ot(t.key,n.get(t.key));e&&(i=i.Ae(t.key,e))}),i},ew.prototype.keys=function(){return this.mutations.reduce(function(t,e){return t.add(e.key)},Kb())},ew.prototype.isEqual=function(t){return this.batchId===t.batchId&&x_(this.mutations,t.mutations,function(t,e){return t.isEqual(e)})&&x_(this.baseMutations,t.baseMutations,function(t,e){return t.isEqual(e)})},ew),V_=(tw.from=function(t,e,n,r){k_(t.mutations.length===n.length);for(var i=Gb(),o=t.mutations,s=0;s<o.length;s++)i=i.Ae(o[s].key,n[s].version);return new tw(t,e,n,r,i)},tw),q_=(Z_.prototype.catch=function(t){return this.next(void 0,t)},Z_.prototype.next=function(r,i){var o=this;return this.Vn&&A_(),this.Vn=!0,this.Pn?this.error?this.gn(i,this.error):this.pn(r,this.result):new Z_(function(e,n){o.An=function(t){o.pn(r,t).next(e,n)},o.mn=function(t){o.gn(i,t).next(e,n)}})},Z_.prototype.yn=function(){var n=this;return new Promise(function(t,e){n.next(t,e)})},Z_.prototype.bn=function(t){try{var e=t();return e instanceof Z_?e:Z_.resolve(e)}catch(t){return Z_.reject(t)}},Z_.prototype.pn=function(t,e){return t?this.bn(function(){return t(e)}):Z_.resolve(e)},Z_.prototype.gn=function(t,e){return t?this.bn(function(){return t(e)}):Z_.reject(e)},Z_.resolve=function(n){return new Z_(function(t,e){t(n)})},Z_.reject=function(n){return new Z_(function(t,e){e(n)})},Z_.vn=function(t){return new Z_(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()})},Z_.Sn=function(t){for(var n=Z_.resolve(!1),e=function(e){n=n.next(function(t){return t?Z_.resolve(t):e()})},r=0,i=t;r<i.length;r++)e(i[r]);return n},Z_.forEach=function(t,n){var r=this,i=[];return t.forEach(function(t,e){i.push(n.call(r,t,e))}),this.vn(i)},Z_),B_=(Object.defineProperty(J_.prototype,"readTime",{get:function(){return this.Fn},set:function(t){this.Fn=t},enumerable:!0,configurable:!0}),J_.prototype.Nn=function(t,e){this.$n(),this.readTime=e,this.Dn.set(t.key,t)},J_.prototype.kn=function(t,e){this.$n(),e&&(this.readTime=e),this.Dn.set(t,null)},J_.prototype.Ln=function(t,e){this.$n();var n=this.Dn.get(e);return void 0!==n?q_.resolve(n):this.Mn(t,e)},J_.prototype.getEntries=function(t,e){return this.On(t,e)},J_.prototype.apply=function(t){return this.$n(),this.Cn=!0,this.xn(t)},J_.prototype.$n=function(){},J_),W_="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",H_=($_.prototype.qn=function(t){this.Bn.push(t)},$_.prototype.Un=function(){this.Bn.forEach(function(t){return t()})},$_),G_=(X_.prototype.Kn=function(e,n){var r=this;return this.Wn.Gn(e,n).next(function(t){return r.zn(e,n,t)})},X_.prototype.zn=function(t,r,i){return this.Qn.Ln(t,r).next(function(t){for(var e=0,n=i;e<n.length;e++)t=n[e].ot(r,t);return t})},X_.prototype.Hn=function(t,e,i){var o=qb();return e.forEach(function(t,e){for(var n=0,r=i;n<r.length;n++)e=r[n].ot(t,e);o=o.Ae(t,e)}),o},X_.prototype.Yn=function(e,t){var n=this;return this.Qn.getEntries(e,t).next(function(t){return n.Jn(e,t)})},X_.prototype.Jn=function(r,i){var o=this;return this.Wn.Xn(r,i).next(function(t){var e=o.Hn(r,i,t),n=Vb();return e.forEach(function(t,e){e=e||new Zm(t,lg.min()),n=n.Ae(t,e)}),n})},X_.prototype.Zn=function(t,e,n){return e.Ot()?this.tr(t,e.path):e._e()?this.er(t,e,n):this.sr(t,e,n)},X_.prototype.tr=function(t,e){return this.Kn(t,new Ng(e)).next(function(t){var e=Wb();return t instanceof Jm&&(e=e.Ae(t.key,t)),e})},X_.prototype.er=function(n,r,i){var o=this,s=r.collectionGroup,a=Wb();return this.jn.ir(n,s).next(function(t){return q_.forEach(t,function(t){var e=r.Zt(t.child(s));return o.sr(n,e,i).next(function(t){t.forEach(function(t,e){a=a.Ae(t,e)})})}).next(function(){return a})})},X_.prototype.sr=function(e,n,t){var h,l,r=this;return this.Qn.Zn(e,n,t).next(function(t){return h=t,r.Wn.nr(e,n)}).next(function(t){return l=t,r.rr(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.ot(u,u,r.Tn);h=c instanceof Jm?h.Ae(a,c):h.remove(a)}})}).next(function(){return h.forEach(function(t,e){n.matches(e)||(h=h.remove(t))}),h})},X_.prototype.rr=function(t,e,n){for(var r=Kb(),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 wm&&null===n.get(u.key)&&(r=r.add(u.key))}var c=n;return this.Qn.getEntries(t,r).next(function(t){return t.forEach(function(t,e){null!==e&&e instanceof Jm&&(c=c.Ae(t,e))}),c})},X_),z_=(Y_.ar=function(t,e){for(var n=Kb(),r=Kb(),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 Y_(t,e.fromCache,n,r)},Y_),K_=(Q_.prototype.cr=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},Q_.prototype.next=function(){var t=++this.previousValue;return this._r&&this._r(t),t},Q_);function Q_(t,e){var n=this;this.previousValue=t,e&&(e.ur=function(t){return n.cr(t)},this._r=function(t){return e.lr(t)})}function Y_(t,e,n,r){this.targetId=t,this.fromCache=e,this.hr=n,this.or=r}function X_(t,e,n){this.Qn=t,this.Wn=e,this.jn=n}function $_(){this.Bn=[]}function J_(){this.Dn=new U_(function(t){return t.toString()}),this.Cn=!1}function Z_(t){var e=this;this.An=null,this.mn=null,this.result=void 0,this.error=void 0,this.Pn=!1,this.Vn=!1,t(function(t){e.Pn=!0,e.result=t,e.An&&e.An(t)},function(t){e.Pn=!0,e.error=t,e.mn&&e.mn(t)})}function tw(t,e,n,r,i){this.batch=t,this.wn=e,this.En=n,this.streamToken=r,this.Rn=i}function ew(t,e,n,r){this.batchId=t,this.Tn=e,this.baseMutations=n,this.mutations=r}function nw(t){this.dn=t,this.fn={}}function rw(t,e){this.projectId=t,this.database=e||"(default)"}K_.dr=-1;function iw(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}var ow=(sw.prototype.reset=function(){this.Ar=0},sw.prototype.Vr=function(){this.Ar=this.Rr},sw.prototype.gr=function(t){var e=this;this.cancel();var n=Math.floor(this.Ar+this.pr()),r=Math.max(0,Date.now()-this.Pr),i=Math.max(0,n-r);0<i&&S_("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.Ar+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.mr=this.Tr.yr(this.Er,i,function(){return e.Pr=Date.now(),t()}),this.Ar*=this.wr,this.Ar<this.Ir&&(this.Ar=this.Ir),this.Ar>this.Rr&&(this.Ar=this.Rr)},sw.prototype.br=function(){null!==this.mr&&(this.mr.vr(),this.mr=null)},sw.prototype.cancel=function(){null!==this.mr&&(this.mr.cancel(),this.mr=null)},sw.prototype.pr=function(){return(Math.random()-.5)*this.Ar},sw);function sw(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.Tr=t,this.Er=e,this.Ir=n,this.wr=r,this.Rr=i,this.Ar=0,this.mr=null,this.Pr=Date.now(),this.reset()}function aw(t){for(var e="",n=0;n<t.length;n++)0<e.length&&(e=cw(e)),e=uw(t.get(n),e);return cw(e)}function uw(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 cw(t){return t+""}function hw(t){var e=t.length;if(k_(2<=e),2===e)return k_(""===t.charAt(0)&&""===t.charAt(1)),pg.G;for(var n=e-2,r=[],i="",o=0;o<e;){var s=t.indexOf("",o);switch((s<0||n<s)&&A_(),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:A_()}o=s+2}return new pg(r)}var lw=(yw.prototype.Dr=function(t,e){return this.Sr.add(e),q_.resolve()},yw.prototype.ir=function(t,e){return q_.resolve(this.Sr.getEntries(e))},yw),fw=(vw.prototype.add=function(t){var e=t.O(),n=t.L(),r=this.index[e]||new Lb(pg.N),i=!r.has(n);return this.index[e]=r.add(n),i},vw.prototype.has=function(t){var e=t.O(),n=t.L(),r=this.index[e];return r&&r.has(n)},vw.prototype.getEntries=function(t){return(this.index[t]||new Lb(pg.N)).W()},vw),pw=(dw.prototype.Dr=function(t,e){var n=this;if(this.Cr.has(e))return q_.resolve();var r=e.O(),i=e.L();t.qn(function(){n.Cr.add(e)});var o={collectionId:r,parent:aw(i)};return gw(t).put(o)},dw.prototype.ir=function(t,i){var o=[],e=IDBKeyRange.bound([i,""],[L_(i),""],!1,!0);return gw(t).Fr(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(hw(r.parent))}return o})},dw);function dw(){this.Cr=new fw}function vw(){this.index={}}function yw(){this.Sr=new fw}function gw(t){return Fw.Nr(t,vE.store)}var mw,bw=(_w.prototype.Nn=function(t,e,n){return Ew(t).put(Tw(e),n)},_w.prototype.kn=function(t,e){var n=Ew(t),r=Tw(e);return n.delete(r)},_w.prototype.updateMetadata=function(e,n){var r=this;return this.getMetadata(e).next(function(t){return t.byteSize+=n,r.$r(e,t)})},_w.prototype.Ln=function(t,e){var n=this;return Ew(t).get(Tw(e)).next(function(t){return n.kr(t)})},_w.prototype.Lr=function(t,e){var n=this;return Ew(t).get(Tw(e)).next(function(t){var e=n.kr(t);return e?{Mr:e,size:Iw(t)}:null})},_w.prototype.getEntries=function(t,e){var r=this,i=qb();return this.Or(t,e,function(t,e){var n=r.kr(e);i=i.Ae(t,n)}).next(function(){return i})},_w.prototype.xr=function(t,e){var r=this,i=qb(),o=new Ab(Ng.N);return this.Or(t,e,function(t,e){var n=r.kr(e);o=n?(i=i.Ae(t,n),o.Ae(t,Iw(e))):(i=i.Ae(t,null),o.Ae(t,0))}).next(function(){return{Br:i,qr:o}})},_w.prototype.Or=function(t,e,i){if(e.B())return q_.resolve();var n=IDBKeyRange.bound(e.first().path.W(),e.last().path.W()),o=e.be(),s=o.Ne();return Ew(t).Ur({range:n},function(t,e,n){for(var r=Ng.st(t);s&&Ng.N(s,r)<0;)i(s,null),s=o.Ne();s&&s.isEqual(r)&&(i(s,e),s=o.$e()?o.Ne():null),s?n.Qr(s.path.W()):n.done()}).next(function(){for(;s;)i(s,null),s=o.$e()?o.Ne():null})},_w.prototype.Zn=function(t,i,e){var o=this,s=Wb(),a=i.path.length+1,n={};if(e.isEqual(lg.min())){var r=i.path.W();n.range=IDBKeyRange.lowerBound(r)}else{var u=i.path.W(),c=this.serializer.Wr(e);n.range=IDBKeyRange.lowerBound([u,c],!0),n.index=hE.collectionReadTimeIndex}return Ew(t).Ur(n,function(t,e,n){if(t.length===a){var r=o.serializer.jr(e);i.path.q(r.key.path)?r instanceof Jm&&i.matches(r)&&(s=s.Ae(r.key,r)):n.done()}}).next(function(){return s})},_w.prototype.Kr=function(t,e){var r=this,i=Vb(),o=this.serializer.Wr(e),n=Ew(t),s=IDBKeyRange.lowerBound(o,!0);return n.Ur({index:hE.readTimeIndex,range:s},function(t,e){var n=r.serializer.jr(e);i=i.Ae(n.key,n),o=e.readTime}).next(function(){return{Gr:i,readTime:r.serializer.zr(o)}})},_w.prototype.Hr=function(t){var r=this,e=Ew(t),i=lg.min();return e.Ur({index:hE.readTimeIndex,reverse:!0},function(t,e,n){e.readTime&&(i=r.serializer.zr(e.readTime)),n.done()}).next(function(){return i})},_w.prototype.Yr=function(t){return new _w.Jr(this,!!t&&t.Xr)},_w.prototype.Zr=function(t){return this.getMetadata(t).next(function(t){return t.byteSize})},_w.prototype.getMetadata=function(t){return ww(t).get(lE.key).next(function(t){return k_(!!t),t})},_w.prototype.$r=function(t,e){return ww(t).put(lE.key,e)},_w.prototype.kr=function(t){if(t){var e=this.serializer.jr(t);return e instanceof Zm&&e.version.isEqual(lg.min())?null:e}return null},_w);function _w(t,e){this.serializer=t,this.jn=e}function ww(t){return Fw.Nr(t,lE.store)}function Ew(t){return Fw.Nr(t,hE.store)}function Tw(t){return t.path.W()}function Iw(t){var e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw A_();e=t.noDocument}return JSON.stringify(e).length}function Sw(t,e){var n=this;return(n=mw.call(this)||this).th=t,n.Xr=e,n.eh=new U_(function(t){return t.toString()}),n}bw.Jr=(Es(Sw,mw=B_),Sw.prototype.xn=function(s){var a=this,u=[],c=0,h=new Lb(function(t,e){return D_(t.j(),e.j())});return this.Dn.forEach(function(t,e){var n=a.eh.get(t);if(e){var r=a.th.serializer.sh(e,a.readTime);h=h.add(t.path.L());var i=Iw(r);c+=i-n,u.push(a.th.Nn(s,t,r))}else if(c-=n,a.Xr){var o=a.th.serializer.sh(new Zm(t,lg.min()),a.readTime);u.push(a.th.Nn(s,t,o))}else u.push(a.th.kn(s,t))}),h.forEach(function(t){u.push(a.th.jn.Dr(s,t))}),u.push(this.th.updateMetadata(s,c)),q_.vn(u)},Sw.prototype.Mn=function(t,e){var n=this;return this.th.Lr(t,e).next(function(t){return null===t?(n.eh.set(e,0),null):(n.eh.set(e,t.size),t.Mr)})},Sw.prototype.On=function(t,e){var n=this;return this.th.xr(t,e).next(function(t){var e=t.Br;return t.qr.forEach(function(t,e){n.eh.set(t,e)}),e})},Sw);var Cw=(kw.prototype.next=function(){return this.ih+=2,this.ih},kw.nh=function(){return new kw(0)},kw.rh=function(){return new kw(-1)},kw),Nw=(Aw.prototype.oh=function(n){var r=this;return this.ah(n).next(function(t){var e=new Cw(t.highestTargetId);return t.highestTargetId=e.next(),r.uh(n,t).next(function(){return t.highestTargetId})})},Aw.prototype._h=function(t){return this.ah(t).next(function(t){return lg.v(new hg(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},Aw.prototype.lh=function(t){return this.ah(t).next(function(t){return t.highestListenSequenceNumber})},Aw.prototype.dh=function(e,n,r){var i=this;return this.ah(e).next(function(t){return t.highestListenSequenceNumber=n,r&&(t.lastRemoteSnapshotVersion=r.C()),n>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.uh(e,t)})},Aw.prototype.fh=function(e,n){var r=this;return this.Th(e,n).next(function(){return r.ah(e).next(function(t){return t.targetCount+=1,r.Eh(n,t),r.uh(e,t)})})},Aw.prototype.Ih=function(t,e){return this.Th(t,e)},Aw.prototype.wh=function(e,t){var n=this;return this.Rh(e,t.targetId).next(function(){return Ow(e).delete(t.targetId)}).next(function(){return n.ah(e)}).next(function(t){return k_(0<t.targetCount),--t.targetCount,n.uh(e,t)})},Aw.prototype.Ah=function(r,i,o){var s=this,a=0,u=[];return Ow(r).Ur(function(t,e){var n=s.serializer.mh(e);n.sequenceNumber<=i&&null===o.get(n.targetId)&&(a++,u.push(s.wh(r,n)))}).next(function(){return q_.vn(u)}).next(function(){return a})},Aw.prototype.js=function(t,r){var i=this;return Ow(t).Ur(function(t,e){var n=i.serializer.mh(e);r(n)})},Aw.prototype.ah=function(t){return Rw(t).get(dE.key).next(function(t){return k_(null!==t),t})},Aw.prototype.uh=function(t,e){return Rw(t).put(dE.key,e)},Aw.prototype.Th=function(t,e){return Ow(t).put(this.serializer.Ph(e))},Aw.prototype.Eh=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},Aw.prototype.Vh=function(t){return this.ah(t).next(function(t){return t.targetCount})},Aw.prototype.gh=function(t,i){var o=this,e=i.canonicalId(),n=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),s=null;return Ow(t).Ur({range:n,index:fE.queryTargetsIndexName},function(t,e,n){var r=o.serializer.mh(e);i.isEqual(r.target)&&(s=r,n.done())}).next(function(){return s})},Aw.prototype.ph=function(n,t,r){var i=this,o=[],s=Pw(n);return t.forEach(function(t){var e=aw(t.path);o.push(s.put(new pE(r,e))),o.push(i.hh.yh(n,r,t))}),q_.vn(o)},Aw.prototype.bh=function(n,t,r){var i=this,o=Pw(n);return q_.forEach(t,function(t){var e=aw(t.path);return q_.vn([o.delete([r,e]),i.hh.vh(n,r,t)])})},Aw.prototype.Rh=function(t,e){var n=Pw(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},Aw.prototype.Sh=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=Pw(t),o=Kb();return r.Ur({range:n,Dh:!0},function(t,e,n){var r=hw(t[1]),i=new Ng(r);o=o.add(i)}).next(function(){return o})},Aw.prototype.Ch=function(t,e){var n=aw(e.path),r=IDBKeyRange.bound([n],[L_(n)],!1,!0),i=0;return Pw(t).Ur({index:pE.documentTargetsIndex,Dh:!0,range:r},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0<i})},Aw.prototype.si=function(t,e){var n=this;return Ow(t).get(e).next(function(t){return t?n.serializer.mh(t):null})},Aw);function Aw(t,e){this.hh=t,this.serializer=e}function kw(t){this.ih=t}function Ow(t){return Fw.Nr(t,fE.store)}function Rw(t){return Fw.Nr(t,dE.store)}function Pw(t){return Fw.Nr(t,pE.store)}var Dw,xw=(Vw.prototype.jr=function(t){if(t.document)return this.Fh.mi(t.document,!!t.hasCommittedMutations);if(t.noDocument){var e=Ng.st(t.noDocument.path),n=this.Nh(t.noDocument.readTime);return new Zm(e,n,{hasCommittedMutations:!!t.hasCommittedMutations})}if(t.unknownDocument){var r=Ng.st(t.unknownDocument.path),i=this.Nh(t.unknownDocument.version);return new tb(r,i)}return A_()},Vw.prototype.sh=function(t,e){var n=this.Wr(e),r=t.key.path.L().W();if(t instanceof Jm){var i=this.Fh.Ai(t),o=t.hasCommittedMutations;return new hE(null,null,i,o,n,r)}if(t instanceof Zm){var s=t.key.path.W(),a=this.$h(t.version),u=t.hasCommittedMutations;return new hE(null,new uE(s,a),null,u,n,r)}if(t instanceof tb){var c=t.key.path.W(),h=this.$h(t.version);return new hE(new cE(c,h),null,null,!0,n,r)}return A_()},Vw.prototype.Wr=function(t){var e=t.C();return[e.seconds,e.nanoseconds]},Vw.prototype.zr=function(t){var e=new hg(t[0],t[1]);return lg.v(e)},Vw.prototype.$h=function(t){var e=t.C();return new eE(e.seconds,e.nanoseconds)},Vw.prototype.Nh=function(t){var e=new hg(t.seconds,t.nanoseconds);return lg.v(e)},Vw.prototype.kh=function(t,e){var n=this,r=e.baseMutations.map(function(t){return n.Fh.vi(t)}),i=e.mutations.map(function(t){return n.Fh.vi(t)});return new oE(t,e.batchId,e.Tn.toMillis(),r,i)},Vw.prototype.Lh=function(t){var e=this,n=(t.baseMutations||[]).map(function(t){return e.Fh.Fi(t)}),r=t.mutations.map(function(t){return e.Fh.Fi(t)}),i=hg.fromMillis(t.localWriteTimeMs);return new j_(t.batchId,i,n,r)},Vw.prototype.mh=function(t){var e,n=this.Nh(t.readTime),r=void 0!==t.lastLimboFreeSnapshotVersion?this.Nh(t.lastLimboFreeSnapshotVersion):lg.min();return e=void 0!==t.query.documents?this.Fh.xi(t.query):this.Fh.Wi(t.query),new lb(e,t.targetId,0,t.lastListenSequenceNumber,n,r,Pg.fromBase64String(t.resumeToken))},Vw.prototype.Ph=function(t){var e,n=this.$h(t.Ee),r=this.$h(t.lastLimboFreeSnapshotVersion);e=t.target.Ot()?this.Fh.Oi(t.target):this.Fh.Bi(t.target);var i=t.resumeToken.toBase64();return new fE(t.targetId,t.target.canonicalId(),n,i,t.sequenceNumber,r,e)},Vw),Lw="Failed to obtain exclusive access to the persistence layer. To allow shared access, make sure to invoke `enablePersistence()` with `synchronizeTabs:true` in all tabs.",Mw=(Es(jw,Dw=H_),jw),Fw=(Uw.Nr=function(t,e){if(t instanceof Mw)return _E.Nr(t.Mh,e);throw A_()},Uw.prototype.start=function(){var e=this;return _E.Xh(this.zh,Zw,new tE(this.serializer)).then(function(t){return e.Zh=t,e.to()}).then(function(){if(!e.isPrimary&&!e.allowTabSynchronization)throw new og(ig.FAILED_PRECONDITION,Lw);return e.eo(),e.so(),e.io(),e.runTransaction("getHighestListenSequenceNumber","readonly",function(t){return e.Yh.lh(t)})}).then(function(t){e.Bh=new K_(t,e.xh)}).then(function(){e.qh=!0}).catch(function(t){return e.Zh&&e.Zh.close(),Promise.reject(t)})},Uw.prototype.no=function(n){var t=this;return this.Kh=function(e){return Is(t,void 0,void 0,function(){return Ss(this,function(t){return this.ro?[2,n(e)]:[2]})})},n(this.isPrimary)},Uw.prototype.ho=function(n){var t=this;this.Zh.oo(function(e){return Is(t,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return null===e.newVersion?[4,n()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})},Uw.prototype.ao=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.Tr.uo(function(){return Is(e,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.ro?[4,this.to()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})}))},Uw.prototype.to=function(){var n=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",function(e){return Bw(e).put(new gE(n.clientId,Date.now(),n.networkEnabled,n.inForeground)).next(function(){if(n.isPrimary)return n.co(e).next(function(t){t||(n.isPrimary=!1,n.Tr.uo(function(){return n.Kh(!1)}))})}).next(function(){return n._o(e)}).next(function(t){return n.isPrimary&&!t?n.lo(e).next(function(){return!1}):!!t&&n.do(e).next(function(){return!0})})}).catch(function(t){if(n.allowTabSynchronization)return S_("IndexedDbPersistence","Releasing owner lease after error during lease refresh",t),!1;if(CE(t))return S_("IndexedDbPersistence","Failed to extend owner lease: ",t),n.isPrimary;throw t}).then(function(t){n.isPrimary!==t&&n.Tr.uo(function(){return n.Kh(t)}),n.isPrimary=t})},Uw.prototype.co=function(t){var e=this;return qw(t).get(nE.key).next(function(t){return q_.resolve(e.fo(t))})},Uw.prototype.To=function(t){return Bw(t).delete(this.clientId)},Uw.prototype.Eo=function(){return Is(this,void 0,void 0,function(){var i=this;return Ss(this,function(t){switch(t.label){case 0:return!this.isPrimary||this.Io(this.jh,18e5)?[3,2]:(this.jh=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(t){var r=Uw.Nr(t,gE.store);return r.Fr().next(function(t){var e=i.wo(t,18e5),n=t.filter(function(t){return-1===e.indexOf(t)});return q_.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.Ro(t.clientId))}),t.label=2;case 2:return[2]}})})},Uw.prototype.io=function(){var t=this;this.Wh=this.Tr.yr("client_metadata_refresh",4e3,function(){return t.to().then(function(){return t.Eo()}).then(function(){return t.io()})})},Uw.prototype.fo=function(t){return!!t&&t.ownerId===this.clientId},Uw.prototype._o=function(e){var i=this;return qw(e).get(nE.key).next(function(t){if(null!==t&&i.Io(t.leaseTimestampMs,5e3)&&!i.Ao(t.ownerId)){if(i.fo(t)&&i.networkEnabled)return!0;if(!i.fo(t)){if(!t.allowTabSynchronization)throw new og(ig.FAILED_PRECONDITION,Lw);return!1}}return!(!i.networkEnabled||!i.inForeground)||Bw(e).Fr().next(function(t){return void 0===i.wo(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&&S_("IndexedDbPersistence","Client "+(t?"is":"is not")+" eligible for a primary lease."),t})},Uw.prototype.mo=function(){return Is(this,void 0,void 0,function(){var e=this;return Ss(this,function(t){switch(t.label){case 0:return this.qh=!1,this.Po(),this.Wh&&(this.Wh.cancel(),this.Wh=null),this.Vo(),this.po(),[4,this.runTransaction("shutdown","readwrite",function(t){return e.lo(t).next(function(){return e.To(t)})}).catch(function(t){S_("IndexedDbPersistence","Proceeding with shutdown despite failure: ",t)})];case 1:return t.sent(),this.Zh.close(),this.yo(),[2]}})})},Uw.prototype.wo=function(t,e){var n=this;return t.filter(function(t){return n.Io(t.updateTimeMs,e)&&!n.Ao(t.clientId)})},Uw.prototype.bo=function(){var e=this;return this.runTransaction("getActiveClients","readonly",function(t){return Bw(t).Fr().next(function(t){return e.wo(t,18e5).map(function(t){return t.clientId})})})},Uw.clearPersistence=function(n){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return Uw.Gh()?(e=n+Uw.Hh,[4,_E.delete(e)]):[2,Promise.resolve()];case 1:return t.sent(),[2]}})})},Object.defineProperty(Uw.prototype,"ro",{get:function(){return this.qh},enumerable:!0,configurable:!0}),Uw.prototype.vo=function(t){return zw.So(t,this.serializer,this.jn,this.hh)},Uw.prototype.Do=function(){return this.Yh},Uw.prototype.Co=function(){return this.Qn},Uw.prototype.Fo=function(){return this.jn},Uw.prototype.runTransaction=function(e,n,r){var i=this;S_("IndexedDbPersistence","Starting transaction:",e);var o,t="readonly"===n?"readonly":"readwrite";return this.Zh.runTransaction(t,bE,function(t){return o=new Mw(t,i.Bh?i.Bh.next():K_.dr),"readwrite-primary"===n?i.co(o).next(function(t){return!!t||i._o(o)}).next(function(t){if(!t)throw C_("Failed to obtain primary lease for action '"+e+"'."),i.isPrimary=!1,i.Tr.uo(function(){return i.Kh(!1)}),new og(ig.FAILED_PRECONDITION,W_);return r(o)}).next(function(t){return i.do(o).next(function(){return t})}):i.No(o).next(function(){return r(o)})}).then(function(t){return o.Un(),t})},Uw.prototype.No=function(t){var e=this;return qw(t).get(nE.key).next(function(t){if(null!==t&&e.Io(t.leaseTimestampMs,5e3)&&!e.Ao(t.ownerId)&&!e.fo(t)&&(!e.allowTabSynchronization||!t.allowTabSynchronization))throw new og(ig.FAILED_PRECONDITION,Lw)})},Uw.prototype.do=function(t){var e=new nE(this.clientId,this.allowTabSynchronization,Date.now());return qw(t).put(nE.key,e)},Uw.Gh=function(){return _E.Gh()},Uw.$o=function(t){var e=t.ii.projectId;return t.ii.ln||(e+="."+t.ii.database),"firestore/"+t.persistenceKey+"/"+e+"/"},Uw.prototype.lo=function(t){var e=this,n=qw(t);return n.get(nE.key).next(function(t){return e.fo(t)?(S_("IndexedDbPersistence","Releasing primary lease."),n.delete(nE.key)):q_.resolve()})},Uw.prototype.Io=function(t,e){var n=Date.now();return!(t<n-e||n<t&&(C_("Detected an update time that is in the future: "+t+" > "+n),1))},Uw.prototype.eo=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.Qh=function(){t.Tr.uo(function(){return t.inForeground="visible"===t.document.visibilityState,t.to()})},this.document.addEventListener("visibilitychange",this.Qh),this.inForeground="visible"===this.document.visibilityState)},Uw.prototype.Vo=function(){this.Qh&&(this.document.removeEventListener("visibilitychange",this.Qh),this.Qh=null)},Uw.prototype.so=function(){var t=this;"function"==typeof this.window.addEventListener&&(this.Uh=function(){t.Po(),t.Tr.uo(function(){return t.mo()})},this.window.addEventListener("unload",this.Uh))},Uw.prototype.po=function(){this.Uh&&(this.window.removeEventListener("unload",this.Uh),this.Uh=null)},Uw.prototype.Ao=function(t){try{var e=null!==this.Jh.getItem(this.Ro(t));return S_("IndexedDbPersistence","Client '"+t+"' "+(e?"is":"is not")+" zombied in LocalStorage"),e}catch(t){return C_("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},Uw.prototype.Po=function(){try{this.Jh.setItem(this.Ro(this.clientId),String(Date.now()))}catch(t){C_("Failed to set zombie client id.",t)}},Uw.prototype.yo=function(){try{this.Jh.removeItem(this.Ro(this.clientId))}catch(t){}},Uw.prototype.Ro=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},Uw);function Uw(t,e,n,r,i,o,s,a){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.Tr=o,this.xh=a,this.Bh=null,this.qh=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Uh=null,this.inForeground=!1,this.Qh=null,this.Wh=null,this.jh=Number.NEGATIVE_INFINITY,this.Kh=function(t){return Promise.resolve()},!Uw.Gh())throw new og(ig.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");if(this.hh=new Ww(this,i),this.zh=e+Uw.Hh,this.serializer=new xw(s),this.document=r.document,this.Yh=new Nw(this.hh,this.serializer),this.jn=new pw,this.Qn=new bw(this.serializer,this.jn),!r.window||!r.window.localStorage)throw new og(ig.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");this.window=r.window,this.Jh=this.window.localStorage}function jw(t,e){var n=this;return(n=Dw.call(this)||this).Mh=t,n.Oh=e,n}function Vw(t){this.Fh=t}function qw(t){return Fw.Nr(t,nE.store)}function Bw(t){return Fw.Nr(t,gE.store)}Fw.Hh="main";var Ww=(Hw.prototype.Lo=function(t){var n=this.Mo(t);return this.db.Do().Vh(t).next(function(e){return n.next(function(t){return e+t})})},Hw.prototype.Mo=function(t){var e=0;return this.Oo(t,function(t){e++}).next(function(){return e})},Hw.prototype.js=function(t,e){return this.db.Do().js(t,e)},Hw.prototype.Oo=function(t,n){return this.xo(t,function(t,e){return n(e)})},Hw.prototype.yh=function(t,e,n){return Gw(t,n)},Hw.prototype.vh=function(t,e,n){return Gw(t,n)},Hw.prototype.Ah=function(t,e,n){return this.db.Do().Ah(t,e,n)},Hw.prototype.Bo=function(t,e){return Gw(t,e)},Hw.prototype.qo=function(t,e){return r=e,i=!1,Jw(n=t).Uo(function(t){return Qw(n,t,r).next(function(t){return t&&(i=!0),q_.resolve(!t)})}).next(function(){return i});var n,r,i},Hw.prototype.Qo=function(r,i){var o=this,s=this.db.Co().Yr(),a=[],u=0;return this.xo(r,function(e,t){if(t<=i){var n=o.qo(r,e).next(function(t){if(!t)return u++,s.Ln(r,e).next(function(){return s.kn(e),Pw(r).delete([0,aw(e.path)])})});a.push(n)}}).next(function(){return q_.vn(a)}).next(function(){return s.apply(r)}).next(function(){return u})},Hw.prototype.removeTarget=function(t,e){var n=e.Ie(t.Oh);return this.db.Do().Ih(t,n)},Hw.prototype.Wo=function(t,e){return Gw(t,e)},Hw.prototype.xo=function(t,o){var s,e=Pw(t),a=K_.dr;return e.Ur({index:pE.documentTargetsIndex},function(t,e){var n=t[0],r=(t[1],e.path),i=e.sequenceNumber;0===n?(a!==K_.dr&&o(new Ng(hw(s)),a),a=i,s=r):a=K_.dr}).next(function(){a!==K_.dr&&o(new Ng(hw(s)),a)})},Hw.prototype.jo=function(t){return this.db.Co().Zr(t)},Hw);function Hw(t,e){this.db=t,this.ko=new zE(this,e)}function Gw(t,e){return Pw(t).put((n=e,r=t.Oh,new pE(0,aw(n.path),r)));var n,r}var zw=(Kw.So=function(t,e,n,r){return k_(""!==t.uid),new Kw(t.t()?t.uid:"",e,n,r)},Kw.prototype.Go=function(t){var r=!0,e=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return Xw(t).Ur({index:oE.userMutationsIndex,range:e},function(t,e,n){r=!1,n.done()}).next(function(){return r})},Kw.prototype.zo=function(e,t,n){return this.Ho(e).next(function(t){return t.lastStreamToken=n.toBase64(),Jw(e).put(t)})},Kw.prototype.Yo=function(t){return this.Ho(t).next(function(t){return Pg.fromBase64String(t.lastStreamToken)})},Kw.prototype.Jo=function(e,n){return this.Ho(e).next(function(t){return t.lastStreamToken=n.toBase64(),Jw(e).put(t)})},Kw.prototype.Xo=function(c,h,l,f){var p=this,d=$w(c),v=Xw(c);return v.add({}).next(function(t){k_("number"==typeof t);for(var e=new j_(t,h,l,f),n=p.serializer.kh(p.userId,e),r=[],i=new Lb(function(t,e){return D_(t.j(),e.j())}),o=0,s=f;o<s.length;o++){var a=s[o],u=sE.key(p.userId,a.key.path,t);i=i.add(a.key.path.L()),r.push(v.put(n)),r.push(d.put(u,sE.PLACEHOLDER))}return i.forEach(function(t){r.push(p.jn.Dr(c,t))}),c.qn(function(){p.Ko[t]=e.keys()}),q_.vn(r).next(function(){return e})})},Kw.prototype.Zo=function(t,e){var n=this;return Xw(t).get(e).next(function(t){return t?(k_(t.userId===n.userId),n.serializer.Lh(t)):null})},Kw.prototype.ta=function(t,n){var r=this;return this.Ko[n]?q_.resolve(this.Ko[n]):this.Zo(t,n).next(function(t){if(t){var e=t.keys();return r.Ko[n]=e}return null})},Kw.prototype.ea=function(t,e){var r=this,i=e+1,n=IDBKeyRange.lowerBound([this.userId,i]),o=null;return Xw(t).Ur({index:oE.userMutationsIndex,range:n},function(t,e,n){e.userId===r.userId&&(k_(e.batchId>=i),o=r.serializer.Lh(e)),n.done()}).next(function(){return o})},Kw.prototype.sa=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return Xw(t).Ur({index:oE.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},Kw.prototype.ia=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return Xw(t).Fr(oE.userMutationsIndex,n).next(function(t){return t.map(function(t){return e.serializer.Lh(t)})})},Kw.prototype.Gn=function(a,u){var c=this,t=sE.prefixForPath(this.userId,u.path),e=IDBKeyRange.lowerBound(t),h=[];return $w(a).Ur({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=hw(i);if(r===c.userId&&u.path.isEqual(s))return Xw(a).get(o).next(function(t){if(!t)throw A_();k_(t.userId===c.userId),h.push(c.serializer.Lh(t))});n.done()}).next(function(){return h})},Kw.prototype.Xn=function(r,t){var u=this,c=new Lb(D_),i=[];return t.forEach(function(a){var t=sE.prefixForPath(u.userId,a.path),e=IDBKeyRange.lowerBound(t),n=$w(r).Ur({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=hw(i);r===u.userId&&a.path.isEqual(s)?c=c.add(o):n.done()});i.push(n)}),q_.vn(i).next(function(){return u.na(r,c)})},Kw.prototype.nr=function(t,e){var a=this,u=e.path,c=u.length+1,n=sE.prefixForPath(this.userId,u),r=IDBKeyRange.lowerBound(n),h=new Lb(D_);return $w(t).Ur({range:r},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=hw(i);r===a.userId&&u.q(s)?s.length===c&&(h=h.add(o)):n.done()}).next(function(){return a.na(t,h)})},Kw.prototype.na=function(e,t){var n=this,r=[],i=[];return t.forEach(function(t){i.push(Xw(e).get(t).next(function(t){if(null===t)throw A_();k_(t.userId===n.userId),r.push(n.serializer.Lh(t))}))}),q_.vn(i).next(function(){return r})},Kw.prototype.ra=function(e,n){var r=this;return Yw(e.Mh,this.userId,n).next(function(t){return e.qn(function(){r.ha(n.batchId)}),q_.forEach(t,function(t){return r.hh.Bo(e,t)})})},Kw.prototype.ha=function(t){delete this.Ko[t]},Kw.prototype.oa=function(n){var o=this;return this.Go(n).next(function(t){if(!t)return q_.resolve();var e=IDBKeyRange.lowerBound(sE.prefixForUser(o.userId)),i=[];return $w(n).Ur({range:e},function(t,e,n){if(t[0]===o.userId){var r=hw(t[1]);i.push(r)}else n.done()}).next(function(){k_(0===i.length)})})},Kw.prototype.Ch=function(t,e){return Qw(t,this.userId,e)},Kw.prototype.Ho=function(t){var e=this;return Jw(t).get(this.userId).next(function(t){return t||new iE(e.userId,-1,"")})},Kw);function Kw(t,e,n,r){this.userId=t,this.serializer=e,this.jn=n,this.hh=r,this.Ko={}}function Qw(t,o,e){var n=sE.prefixForPath(o,e.path),s=n[1],r=IDBKeyRange.lowerBound(n),a=!1;return $w(t).Ur({range:r,Dh:!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 Yw(t,e,n){var r=t.store(oE.store),i=t.store(sE.store),o=[],s=IDBKeyRange.only(n.batchId),a=0,u=r.Ur({range:s},function(t,e,n){return a++,n.delete()});o.push(u.next(function(){k_(1===a)}));for(var c=[],h=0,l=n.mutations;h<l.length;h++){var f=l[h],p=sE.key(e,f.key.path,n.batchId);o.push(i.delete(p)),c.push(f.key)}return q_.vn(o).next(function(){return c})}function Xw(t){return Fw.Nr(t,oE.store)}function $w(t){return Fw.Nr(t,sE.store)}function Jw(t){return Fw.Nr(t,iE.store)}var Zw=10,tE=(rE.prototype.createOrUpgrade=function(n,r,t,e){var i=this;k_(t<e&&0<=t&&e<=Zw);var o,s=new NE(r);t<1&&1<=e&&(n.createObjectStore(nE.store),(o=n).createObjectStore(iE.store,{keyPath:iE.keyPath}),o.createObjectStore(oE.store,{keyPath:oE.keyPath,autoIncrement:!0}).createIndex(oE.userMutationsIndex,oE.userMutationsKeyPath,{unique:!0}),o.createObjectStore(sE.store),yE(n),n.createObjectStore(hE.store));var a,u=q_.resolve();return t<3&&3<=e&&(0!==t&&((a=n).deleteObjectStore(pE.store),a.deleteObjectStore(fE.store),a.deleteObjectStore(dE.store),yE(n)),u=u.next(function(){return t=s.store(dE.store),e=new dE(0,0,lg.min().C(),0),t.put(dE.key,e);var t,e})),t<4&&4<=e&&(0!==t&&(u=u.next(function(){return r=n,(i=s).store(oE.store).Fr().next(function(t){r.deleteObjectStore(oE.store),r.createObjectStore(oE.store,{keyPath:oE.keyPath,autoIncrement:!0}).createIndex(oE.userMutationsIndex,oE.userMutationsKeyPath,{unique:!0});var e=i.store(oE.store),n=t.map(function(t){return e.put(t)});return q_.vn(n)});var r,i})),u=u.next(function(){n.createObjectStore(gE.store,{keyPath:gE.keyPath})})),t<5&&5<=e&&(u=u.next(function(){return i.removeAcknowledgedMutations(s)})),t<6&&6<=e&&(u=u.next(function(){return n.createObjectStore(lE.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(hE.store)).createIndex(hE.readTimeIndex,hE.readTimeIndexPath,{unique:!1}),t.createIndex(hE.collectionReadTimeIndex,hE.collectionReadTimeIndexPath,{unique:!1})})),t<10&&10<=e&&(u=u.next(function(){return i.rewriteCanonicalIds(s)})),u},rE.prototype.addDocumentGlobal=function(e){var n=0;return e.store(hE.store).Ur(function(t,e){n+=Iw(e)}).next(function(){var t=new lE(n);return e.store(lE.store).put(lE.key,t)})},rE.prototype.removeAcknowledgedMutations=function(r){var i=this,t=r.store(iE.store),e=r.store(oE.store);return t.Fr().next(function(t){return q_.forEach(t,function(n){var t=IDBKeyRange.bound([n.userId,-1],[n.userId,n.lastAcknowledgedBatchId]);return e.Fr(oE.userMutationsIndex,t).next(function(t){return q_.forEach(t,function(t){k_(t.userId===n.userId);var e=i.serializer.Lh(t);return Yw(r,n.userId,e).next(function(){})})})})})},rE.prototype.ensureSequenceNumbers=function(t){var s=t.store(pE.store),e=t.store(hE.store);return t.store(dE.store).get(dE.key).next(function(i){var o=[];return e.Ur(function(t,e){var n=new pg(t),r=[0,aw(n)];o.push(s.get(r).next(function(t){return t?q_.resolve():(e=n,s.put(new pE(0,aw(e),i.highestListenSequenceNumber)));var e}))}).next(function(){return q_.vn(o)})})},rE.prototype.createCollectionParentIndex=function(t,e){function i(t){if(o.add(t)){var e=t.O(),n=t.L();return r.put({collectionId:e,parent:aw(n)})}}t.createObjectStore(vE.store,{keyPath:vE.keyPath});var r=e.store(vE.store),o=new fw;return e.store(hE.store).Ur({Dh:!0},function(t,e){var n=new pg(t);return i(n.L())}).next(function(){return e.store(sE.store).Ur({Dh:!0},function(t,e){t[0];var n=t[1],r=(t[2],hw(n));return i(r.L())})})},rE.prototype.rewriteCanonicalIds=function(t){var i=this,o=t.store(fE.store);return o.Ur(function(t,e){var n=i.serializer.mh(e),r=i.serializer.Ph(n);return o.put(r)})},rE),eE=function(t,e){this.seconds=t,this.nanoseconds=e},nE=function(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n};function rE(t){this.serializer=t}nE.store="owner",nE.key="owner";var iE=function(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n};iE.store="mutationQueues",iE.keyPath="userId";var oE=function(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i};oE.store="mutations",oE.keyPath="batchId",oE.userMutationsIndex="userMutationsIndex",oE.userMutationsKeyPath=["userId","batchId"];var sE=(aE.prefixForUser=function(t){return[t]},aE.prefixForPath=function(t,e){return[t,aw(e)]},aE.key=function(t,e,n){return[t,aw(e),n]},aE);function aE(){}sE.store="documentMutations",sE.PLACEHOLDER=new sE;var uE=function(t,e){this.path=t,this.readTime=e},cE=function(t,e){this.path=t,this.version=e},hE=function(t,e,n,r,i,o){this.unknownDocument=t,this.noDocument=e,this.document=n,this.hasCommittedMutations=r,this.readTime=i,this.parentPath=o};hE.store="remoteDocuments",hE.readTimeIndex="readTimeIndex",hE.readTimeIndexPath="readTime",hE.collectionReadTimeIndex="collectionReadTimeIndex",hE.collectionReadTimeIndexPath=["parentPath","readTime"];var lE=function(t){this.byteSize=t};lE.store="remoteDocumentGlobal",lE.key="remoteDocumentGlobalKey";var fE=function(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};fE.store="targets",fE.keyPath="targetId",fE.queryTargetsIndexName="queryTargetsIndex",fE.queryTargetsKeyPath=["canonicalId","targetId"];var pE=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};pE.store="targetDocuments",pE.keyPath=["targetId","path"],pE.documentTargetsIndex="documentTargetsIndex",pE.documentTargetsKeyPath=["path","targetId"];var dE=function(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r};dE.key="targetGlobalKey",dE.store="targetGlobal";var vE=function(t,e){this.collectionId=t,this.parent=e};function yE(t){t.createObjectStore(pE.store,{keyPath:pE.keyPath}).createIndex(pE.documentTargetsIndex,pE.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(fE.store,{keyPath:fE.keyPath}).createIndex(fE.queryTargetsIndexName,fE.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(dE.store)}vE.store="collectionParents",vE.keyPath=["collectionId","parent"];var gE=function(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r};gE.store="clientMetadata",gE.keyPath="clientId";var mE,bE=ks(ks(ks([iE.store,oE.store,sE.store,hE.store,fE.store,nE.store,dE.store,pE.store],[gE.store]),[lE.store]),[vE.store]),_E=(SE.Xh=function(o,t,s){return S_("SimpleDb","Opening database:",o),new q_(function(n,r){var i=window.indexedDB.open(o,t);i.onsuccess=function(t){var e=t.target.result;n(new SE(e))},i.onblocked=function(){r(new og(ig.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 og(ig.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){S_("SimpleDb",'Database "'+o+'" requires upgrade from version:',t.oldVersion);var e=t.target.result;s.createOrUpgrade(e,i.transaction,t.oldVersion,Zw).next(function(){S_("SimpleDb","Database upgrade to version "+Zw+" complete")})}}).yn()},SE.delete=function(t){return S_("SimpleDb","Removing database:",t),RE(window.indexedDB.deleteDatabase(t)).yn()},SE.Gh=function(){if("undefined"==typeof window||null==window.indexedDB)return!1;if(SE.ua())return!0;if(void 0===window.navigator)return!1;var t=Vs(),e=SE.aa(t),n=0<e&&e<10,r=SE.ca(t),i=0<r&&r<4.5;return!(0<t.indexOf("MSIE ")||0<t.indexOf("Trident/")||0<t.indexOf("Edge/")||n||i)},SE.ua=function(){var t;return"undefined"!=typeof __PRIVATE_process&&"YES"===(null===(t=__PRIVATE_process.__PRIVATE_env)||void 0===t?void 0:t._a)},SE.Nr=function(t,e){return t.store(e)},SE.aa=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)},SE.ca=function(t){var e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)},SE.prototype.oo=function(e){this.db.onversionchange=function(t){return e(t)}},SE.prototype.runTransaction=function(r,c,h){return Is(this,void 0,void 0,function(){var s,a,e,u,n;return Ss(this,function(t){switch(t.label){case 0:s="readonly"===r,a=0,e=function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:++a,e=NE.open(u.db,s?"readonly":"readwrite",c),t.label=1;case 1:return t.trys.push([1,3,,4]),n=h(e).catch(function(t){return e.abort(t),q_.reject(t)}).yn(),r={},n.catch(function(){}),[4,e.la];case 2:return[2,(r.value=(t.sent(),n),r)];case 3:return i=t.sent(),o="FirebaseError"!==i.name&&a<3,S_("SimpleDb","Transaction failed with error: %s. Retrying: %s.",i.message,o),o?[3,4]:[2,{value:Promise.reject(i)}];case 4:return[2]}})},u=this,t.label=1;case 1:return[5,e()];case 2:if("object"==typeof(n=t.sent()))return[2,n.value];t.label=3;case 3:return[3,1];case 4:return[2]}})})},SE.prototype.close=function(){this.db.close()},SE),wE=(Object.defineProperty(IE.prototype,"Pn",{get:function(){return this.fa},enumerable:!0,configurable:!0}),Object.defineProperty(IE.prototype,"Ea",{get:function(){return this.Ta},enumerable:!0,configurable:!0}),Object.defineProperty(IE.prototype,"cursor",{set:function(t){this.da=t},enumerable:!0,configurable:!0}),IE.prototype.done=function(){this.fa=!0},IE.prototype.Qr=function(t){this.Ta=t},IE.prototype.delete=function(){return RE(this.da.delete())},IE),EE=(Es(TE,mE=og),TE);function TE(t){var e=this;return(e=mE.call(this,ig.UNAVAILABLE,"IndexedDB transaction failed: "+t)||this).name="IndexedDbTransactionError",e}function IE(t){this.da=t,this.fa=!1,this.Ta=null}function SE(t){this.db=t,12.2===SE.aa(Vs())&&C_("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 CE(t){return"IndexedDbTransactionError"===t.name}var NE=(OE.open=function(t,e,n){return new OE(t.transaction(n,e))},Object.defineProperty(OE.prototype,"la",{get:function(){return this.Ia.promise},enumerable:!0,configurable:!0}),OE.prototype.abort=function(t){t&&this.Ia.reject(t),this.aborted||(S_("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},OE.prototype.store=function(t){var e=this.transaction.objectStore(t);return new AE(e)},OE),AE=(kE.prototype.put=function(t,e){return RE(void 0!==e?(S_("SimpleDb","PUT",this.store.name,t,e),this.store.put(e,t)):(S_("SimpleDb","PUT",this.store.name,"<auto-key>",t),this.store.put(t)))},kE.prototype.add=function(t){return S_("SimpleDb","ADD",this.store.name,t,t),RE(this.store.add(t))},kE.prototype.get=function(e){var n=this;return RE(this.store.get(e)).next(function(t){return void 0===t&&(t=null),S_("SimpleDb","GET",n.store.name,e,t),t})},kE.prototype.delete=function(t){return S_("SimpleDb","DELETE",this.store.name,t),RE(this.store.delete(t))},kE.prototype.count=function(){return S_("SimpleDb","COUNT",this.store.name),RE(this.store.count())},kE.prototype.Fr=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.wa(n,function(t,e){r.push(e)}).next(function(){return r})},kE.prototype.Ra=function(t,e){S_("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.Dh=!1;var r=this.cursor(n);return this.wa(r,function(t,e,n){return n.delete()})},kE.prototype.Ur=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.wa(r,e)},kE.prototype.Uo=function(i){var t=this.cursor({});return new q_(function(n,r){t.onerror=function(t){var e=DE(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()}})},kE.prototype.wa=function(t,s){var a=[];return new q_(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 wE(e),r=s(e.primaryKey,e.value,n);if(r instanceof q_){var i=r.catch(function(t){return n.done(),q_.reject(t)});a.push(i)}n.Pn?o():null===n.Ea?e.continue():e.continue(n.Ea)}else o()}}).next(function(){return q_.vn(a)})},kE.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},kE.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.Dh?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},kE);function kE(t){this.store=t}function OE(t){var n=this;this.transaction=t,this.aborted=!1,this.Ia=new iw,this.transaction.oncomplete=function(){n.Ia.resolve()},this.transaction.onabort=function(){t.error?n.Ia.reject(new EE(t.error)):n.Ia.resolve()},this.transaction.onerror=function(t){var e=DE(t.target.error);n.Ia.reject(new EE(e))}}function RE(t){return new q_(function(n,r){t.onsuccess=function(t){var e=t.target.result;n(e)},t.onerror=function(t){var e=DE(t.target.error);r(e)}})}var PE=!1;function DE(t){var e=_E.aa(Vs());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 og("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 PE||(PE=!0,setTimeout(function(){throw r},0)),r}}return t}var xE=(FE.ga=function(t,e,n,r,i){var o=new FE(t,e,Date.now()+n,r,i);return o.start(n),o},FE.prototype.start=function(t){var e=this;this.pa=setTimeout(function(){return e.ya()},t)},FE.prototype.vr=function(){return this.ya()},FE.prototype.cancel=function(t){null!==this.pa&&(this.clearTimeout(),this.Va.reject(new og(ig.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},FE.prototype.ya=function(){var e=this;this.Aa.uo(function(){return null!==e.pa?(e.clearTimeout(),e.op().then(function(t){return e.Va.resolve(t)})):Promise.resolve()})},FE.prototype.clearTimeout=function(){null!==this.pa&&(this.Pa(this),clearTimeout(this.pa),this.pa=null)},FE),LE=(Object.defineProperty(ME.prototype,"La",{get:function(){return this.Sa},enumerable:!0,configurable:!0}),ME.prototype.uo=function(t){this.enqueue(t)},ME.prototype.Ma=function(t){this.Oa(),this.xa(t)},ME.prototype.Ba=function(t){return this.Oa(),this.xa(t)},ME.prototype.qa=function(n){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.Oa(),this.Sa?[3,2]:(this.Sa=!0,(e=__.nt().window)&&e.removeEventListener("visibilitychange",this.ka),[4,this.Ba(n)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},ME.prototype.enqueue=function(t){return this.Oa(),this.Sa?new Promise(function(t){}):this.xa(t)},ME.prototype.Ua=function(i){var t=this;this.Oa(),this.Sa||(this.va=this.va.then(function(){var n=new iw,r=function(){return Is(t,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,i()];case 1:return t.sent(),n.resolve(),this.$a.reset(),[3,3];case 2:if(!CE(e=t.sent()))throw n.resolve(),e;return S_("AsyncQueue","Operation failed with retryable error: "+e),this.$a.gr(r),[3,3];case 3:return[2]}})})};return t.uo(r),n.promise}))},ME.prototype.xa=function(t){var e=this,n=this.ba.then(function(){return e.Fa=!0,t().catch(function(t){throw e.Ca=t,e.Fa=!1,C_("INTERNAL UNHANDLED ERROR: ",t.stack||t.message||""),t}).then(function(t){return e.Fa=!1,t})});return this.ba=n},ME.prototype.yr=function(t,e,n){var r=this;this.Oa(),-1<this.Na.indexOf(t)&&(e=0);var i=xE.ga(this,t,e,n,function(t){return r.Qa(t)});return this.Da.push(i),i},ME.prototype.Oa=function(){this.Ca&&A_()},ME.prototype.Wa=function(){},ME.prototype.ja=function(){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,e=this.ba];case 1:t.sent(),t.label=2;case 2:if(e!==this.ba)return[3,0];t.label=3;case 3:return[2]}})})},ME.prototype.Ka=function(t){for(var e=0,n=this.Da;e<n.length;e++)if(n[e].Er===t)return!0;return!1},ME.prototype.Ga=function(r){var i=this;return this.ja().then(function(){i.Da.sort(function(t,e){return t.ma-e.ma});for(var t=0,e=i.Da;t<e.length;t++){var n=e[t];if(n.vr(),"all"!==r&&n.Er===r)break}return i.ja()})},ME.prototype.za=function(t){this.Na.push(t)},ME.prototype.Qa=function(t){var e=this.Da.indexOf(t);this.Da.splice(e,1)},ME);function ME(){var t=this;this.ba=Promise.resolve(),this.va=Promise.resolve(),this.Sa=!1,this.Da=[],this.Ca=null,this.Fa=!1,this.Na=[],this.$a=new ow(this,"async_queue_retry"),this.ka=function(){return t.$a.br()};var e=__.nt().window;e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.ka)}function FE(t,e,n,r,i){this.Aa=t,this.Er=e,this.ma=n,this.op=r,this.Pa=i,this.Va=new iw,this.then=this.Va.promise.then.bind(this.Va.promise),this.Va.promise.catch(function(t){})}function UE(t,e){if(C_("AsyncQueue",e+": "+t),CE(t))return new og(ig.UNAVAILABLE,e+": "+t);throw t}function jE(t,e){var n=t[0],r=t[1],i=e[0],o=e[1],s=D_(n,i);return 0===s?D_(r,o):s}var VE=(HE.prototype.Ja=function(){return++this.Ya},HE.prototype.Xa=function(t){var e=[t,this.Ja()];if(this.buffer.size<this.Ha)this.buffer=this.buffer.add(e);else{var n=this.buffer.last();jE(e,n)<0&&(this.buffer=this.buffer.delete(n).add(e))}},Object.defineProperty(HE.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!0,configurable:!0}),HE),qE={Za:!1,tu:0,eu:0,su:0},BE=(WE.hu=function(t){return new WE(t,WE.ou,WE.au)},WE);function WE(t,e,n){this.iu=t,this.nu=e,this.ru=n}function HE(t){this.Ha=t,this.buffer=new Lb(jE),this.Ya=0}BE.uu=-1,BE.cu=1048576,BE._u=41943040,BE.ou=10,BE.au=1e3,BE.lu=new BE(BE._u,BE.ou,BE.au),BE.DISABLED=new BE(BE.uu,0,0);var GE=(XE.prototype.start=function(t){this.ko.Tu.iu!==BE.uu&&this.Eu(t)},XE.prototype.stop=function(){this.fu&&(this.fu.cancel(),this.fu=null)},Object.defineProperty(XE.prototype,"ro",{get:function(){return null!==this.fu},enumerable:!0,configurable:!0}),XE.prototype.Eu=function(n){var t=this,e=this.du?3e5:6e4;S_("LruGarbageCollector","Garbage collection scheduled in "+e+"ms"),this.fu=this.Aa.yr("lru_garbage_collection",e,function(){return Is(t,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:this.fu=null,this.du=!0,t.label=1;case 1:return t.trys.push([1,3,,7]),[4,n.Iu(this.ko)];case 2:return t.sent(),[3,7];case 3:return CE(e=t.sent())?(S_("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",e),[3,6]):[3,4];case 4:return[4,tT(e)];case 5:t.sent(),t.label=6;case 6:return[3,7];case 7:return[4,this.Eu(n)];case 8:return t.sent(),[2]}})})})},XE),zE=(YE.prototype.Ru=function(t,e){return this.wu.Lo(t).next(function(t){return Math.floor(e/100*t)})},YE.prototype.Au=function(t,e){var n=this;if(0===e)return q_.resolve(K_.dr);var r=new VE(e);return this.wu.js(t,function(t){return r.Xa(t.sequenceNumber)}).next(function(){return n.wu.Oo(t,function(t){return r.Xa(t)})}).next(function(){return r.maxValue})},YE.prototype.Ah=function(t,e,n){return this.wu.Ah(t,e,n)},YE.prototype.Qo=function(t,e){return this.wu.Qo(t,e)},YE.prototype.mu=function(e,n){var r=this;return this.Tu.iu===BE.uu?(S_("LruGarbageCollector","Garbage collection skipped; disabled"),q_.resolve(qE)):this.jo(e).next(function(t){return t<r.Tu.iu?(S_("LruGarbageCollector","Garbage collection skipped; Cache size "+t+" is lower than threshold "+r.Tu.iu),qE):r.Pu(e,n)})},YE.prototype.jo=function(t){return this.wu.jo(t)},YE.prototype.Pu=function(e,n){var r,i,o,s,a,u,c,h=this,l=Date.now();return this.Ru(e,this.Tu.nu).next(function(t){return i=t>h.Tu.ru?(S_("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.Tu.ru+" from "+t),h.Tu.ru):t,s=Date.now(),h.Au(e,i)}).next(function(t){return r=t,a=Date.now(),h.Ah(e,r,n)}).next(function(t){return o=t,u=Date.now(),h.Qo(e,r)}).next(function(t){return c=Date.now(),T_()<=Ta.DEBUG&&S_("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"),q_.resolve({Za:!0,tu:i,eu:o,su:t})})},YE),KE=(QE.prototype.start=function(){return Promise.resolve()},QE.prototype.Du=function(i){return Is(this,void 0,void 0,function(){var e,m,n,r=this;return Ss(this,function(t){switch(t.label){case 0:return e=this.Wn,m=this.vu,[4,this.persistence.runTransaction("Handle user change","readonly",function(y){var g;return r.Wn.ia(y).next(function(t){return g=t,e=r.persistence.vo(i),m=new G_(r.bu,e,r.persistence.Fo()),e.ia(y)}).next(function(t){for(var e=[],n=[],r=Kb(),i=0,o=g;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++){var f=l[h];n.push(f.batchId);for(var p=0,d=f.mutations;p<d.length;p++){var v=d[p];r=r.add(v.key)}}return m.Yn(y,r).next(function(t){return{Cu:t,Fu:e,Nu:n}})})})];case 1:return n=t.sent(),[2,(this.Wn=e,this.vu=m,this.Vu.Su(this.vu),n)]}})})},QE.prototype.$u=function(a){var u,c=this,h=hg.now(),t=a.reduce(function(t,e){return t.add(e.key)},Kb());return this.persistence.runTransaction("Locally write mutations","readwrite",function(s){return c.vu.Yn(s,t).next(function(t){u=t;for(var e=[],n=0,r=a;n<r.length;n++){var i=r[n],o=i.Pt(u.get(i.key));null!=o&&e.push(new wm(i.key,o,Um(o.proto.mapValue),mm.exists(!0)))}return c.Wn.Xo(s,h,e,a)})}).then(function(t){var e=t.In(u);return{batchId:t.batchId,Dn:e}})},QE.prototype.zo=function(r){var i=this;return this.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(t){var e=r.batch.keys(),n=i.bu.Yr({Xr:!0});return i.Wn.zo(t,r.batch,r.streamToken).next(function(){return i.ku(t,r,n)}).next(function(){return n.apply(t)}).next(function(){return i.Wn.oa(t)}).next(function(){return i.vu.Yn(t,e)})})},QE.prototype.Lu=function(t){var r=this;return this.persistence.runTransaction("Reject batch","readwrite-primary",function(e){var n;return r.Wn.Zo(e,t).next(function(t){return k_(null!==t),n=t.keys(),r.Wn.ra(e,t)}).next(function(){return r.Wn.oa(e)}).next(function(){return r.vu.Yn(e,n)})})},QE.prototype.sa=function(){var e=this;return this.persistence.runTransaction("Get highest unacknowledged batch id","readonly",function(t){return e.Wn.sa(t)})},QE.prototype.Yo=function(){var e=this;return this.persistence.runTransaction("Get last stream token","readonly",function(t){return e.Wn.Yo(t)})},QE.prototype.Jo=function(e){var n=this;return this.persistence.runTransaction("Set last stream token","readwrite-primary",function(t){return n.Wn.Jo(t,e)})},QE.prototype._h=function(){var e=this;return this.persistence.runTransaction("Get last remote snapshot version","readonly",function(t){return e.Yh._h(t)})},QE.prototype.Mu=function(u){var c=this,h=u.Ee,l=this.gu;return this.persistence.runTransaction("Apply remote event","readwrite-primary",function(o){var i=c.bu.Yr({Xr:!0});l=c.gu;var s=[];u.as.forEach(function(t,e){var n=l.get(e);if(n){s.push(c.Yh.bh(o,t.Is,e).next(function(){return c.Yh.ph(o,t.Ts,e)}));var r=t.resumeToken;if(0<r.rt()){var i=n.we(r,h).Ie(o.Oh);l=l.Ae(e,i),QE.Ou(n,i,t)&&s.push(c.Yh.Ih(o,i))}}});var a=Vb(),n=Kb();if(u.cs.forEach(function(t,e){n=n.add(t)}),s.push(i.getEntries(o,n).next(function(r){u.cs.forEach(function(t,e){var n=r.get(t);e instanceof Zm&&e.version.isEqual(lg.min())?(i.kn(t,h),a=a.Ae(t,e)):null==n||0<e.version.S(n.version)||0===e.version.S(n.version)&&n.hasPendingWrites?(i.Nn(e,h),a=a.Ae(t,e)):S_("LocalStore","Ignoring outdated watch update for ",t,". Current version:",n.version," Watch version:",e.version),u._s.has(t)&&s.push(c.persistence.hh.Wo(o,t))})})),!h.isEqual(lg.min())){var t=c.Yh._h(o).next(function(t){return c.Yh.dh(o,o.Oh,h)});s.push(t)}return q_.vn(s).next(function(){return i.apply(o)}).next(function(){return c.vu.Jn(o,a)})}).then(function(t){return c.gu=l,t})},QE.Ou=function(t,e,n){return k_(0<e.resumeToken.rt()),0===t.resumeToken.rt()||e.Ee.D()-t.Ee.D()>=this.xu||0<n.Ts.size+n.Es.size+n.Is.size},QE.prototype.Bu=function(h){return Is(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c=this;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(n){return q_.forEach(h,function(e){return q_.forEach(e.hr,function(t){return c.persistence.hh.yh(n,e.targetId,t)}).next(function(){return q_.forEach(e.or,function(t){return c.persistence.hh.vh(n,e.targetId,t)})})})})];case 1:return t.sent(),[3,3];case 2:if(!CE(e=t.sent()))throw e;return S_("LocalStore","Failed to update sequence numbers: "+e),[3,3];case 3:for(n=0,r=h;n<r.length;n++)i=r[n],o=i.targetId,i.fromCache||(s=this.gu.get(o),a=s.Ee,u=s.Re(a),this.gu=this.gu.Ae(o,u));return[2]}})})},QE.prototype.qu=function(e){var n=this;return this.persistence.runTransaction("Get next mutation batch","readonly",function(t){return void 0===e&&(e=-1),n.Wn.ea(t,e)})},QE.prototype.Uu=function(e){var n=this;return this.persistence.runTransaction("read document","readonly",function(t){return n.vu.Kn(t,e)})},QE.prototype.Qu=function(r){var i=this;return this.persistence.runTransaction("Allocate target","readwrite",function(e){var n;return i.Yh.gh(e,r).next(function(t){return t?(n=t,q_.resolve(n)):i.Yh.oh(e).next(function(t){return n=new lb(r,t,0,e.Oh),i.Yh.fh(e,n).next(function(){return n})})})}).then(function(t){return null===i.gu.get(t.targetId)&&(i.gu=i.gu.Ae(t.targetId,t),i.pu.set(r,t.targetId)),t})},QE.prototype.gh=function(t,e){var n=this.pu.get(e);return void 0!==n?q_.resolve(this.gu.get(n)):this.Yh.gh(t,e)},QE.prototype.Wu=function(t,e){var n=this,r=this.gu.get(t),i=e?"readwrite":"readwrite-primary";return this.persistence.runTransaction("Release target",i,function(t){return e?q_.resolve():n.persistence.hh.removeTarget(t,r)}).then(function(){n.gu=n.gu.remove(t),n.pu.delete(r.target)})},QE.prototype.ju=function(t,n){var r=this,i=lg.min(),o=Kb();return this.persistence.runTransaction("Execute query","readonly",function(e){return r.gh(e,t.ee()).next(function(t){if(t)return i=t.lastLimboFreeSnapshotVersion,r.Yh.Sh(e,t.targetId).next(function(t){o=t})}).next(function(){return r.Vu.Zn(e,t,n?i:lg.min(),n?o:Kb())}).next(function(t){return{documents:t,Ku:o}})})},QE.prototype.ku=function(t,i,o){var e=this,s=i.batch,n=s.keys(),a=q_.resolve();return n.forEach(function(r){a=a.next(function(){return o.Ln(t,r)}).next(function(t){var e=t,n=i.Rn.get(r);k_(null!==n),(!e||e.version.S(n)<0)&&(e=s.at(r,e,i))&&o.Nn(e,i.wn)})}),a.next(function(){return e.Wn.ra(t,s)})},QE.prototype.Iu=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(t){return e.mu(t,n.gu)})},QE);function QE(t,e,n){this.persistence=t,this.Vu=e,this.gu=new Ab(D_),this.pu=new U_(function(t){return t.canonicalId()}),this.yu=lg.min(),this.Wn=t.vo(n),this.bu=t.Co(),this.Yh=t.Do(),this.vu=new G_(this.bu,this.Wn,this.persistence.Fo()),this.Vu.Su(this.vu)}function YE(t,e){this.wu=t,this.Tu=e}function XE(t,e){this.ko=t,this.Aa=e,this.du=!1,this.fu=null}KE.xu=3e8;var $E,JE=(Es(ZE,$E=KE),ZE.prototype.start=function(){return this.Gu()},ZE.prototype.zu=function(t){var n=this;return this.persistence.runTransaction("Lookup mutation documents","readonly",function(e){return n.Wn.ta(e,t).next(function(t){return t?n.vu.Yn(e,t):q_.resolve(null)})})},ZE.prototype.Hu=function(t){this.Wn.ha(t)},ZE.prototype.ao=function(t){this.persistence.ao(t)},ZE.prototype.bo=function(){return this.persistence.bo()},ZE.prototype.Yu=function(e){var n=this,t=this.gu.get(e);return t?Promise.resolve(t.target):this.persistence.runTransaction("Get target data","readonly",function(t){return n.Yh.si(t,e).next(function(t){return t?t.target:null})})},ZE.prototype.Kr=function(){var r=this;return this.persistence.runTransaction("Get new document changes","readonly",function(t){return r.bu.Kr(t,r.yu)}).then(function(t){var e=t.Gr,n=t.readTime;return r.yu=n,e})},ZE.prototype.Gu=function(){return Is(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.bu.Hr(t)})];case 1:return e.yu=t.sent(),[2]}})})},ZE);function ZE(t,e,n){var r=this;return(r=$E.call(this,t,e,n)||this).persistence=t,r.Wn=t.vo(n),r.bu=t.Co(),r.Yh=t.Do(),r}function tT(e){return Is(this,void 0,void 0,function(){return Ss(this,function(t){if(e.code!==ig.FAILED_PRECONDITION||e.message!==W_)throw e;return S_("LocalStore","Unexpectedly lost primary lease"),[2]})})}var eT=(iT.prototype.B=function(){return this.Ju.B()},iT.prototype.yh=function(t,e){var n=new nT(t,e);this.Ju=this.Ju.add(n),this.Zu=this.Zu.add(n)},iT.prototype.ec=function(t,e){var n=this;t.forEach(function(t){return n.yh(t,e)})},iT.prototype.vh=function(t,e){this.sc(new nT(t,e))},iT.prototype.ic=function(t,e){var n=this;t.forEach(function(t){return n.vh(t,e)})},iT.prototype.nc=function(t){var e=this,n=Ng.EMPTY,r=new nT(n,t),i=new nT(n,t+1),o=[];return this.Zu.Ke([r,i],function(t){e.sc(t),o.push(t.key)}),o},iT.prototype.rc=function(){var e=this;this.Ju.forEach(function(t){return e.sc(t)})},iT.prototype.sc=function(t){this.Ju=this.Ju.delete(t),this.Zu=this.Zu.delete(t)},iT.prototype.hc=function(t){var e=Ng.EMPTY,n=new nT(e,t),r=new nT(e,t+1),i=Kb();return this.Zu.Ke([n,r],function(t){i=i.add(t.key)}),i},iT.prototype.Ch=function(t){var e=new nT(t,0),n=this.Ju.ze(e);return null!==n&&t.isEqual(n.key)},iT),nT=(rT.Xu=function(t,e){return Ng.N(t.key,e.key)||D_(t.oc,e.oc)},rT.tc=function(t,e){return D_(t.oc,e.oc)||Ng.N(t.key,e.key)},rT);function rT(t,e){this.key=t,this.oc=e}function iT(){this.Ju=new Lb(nT.Xu),this.Zu=new Lb(nT.tc)}function oT(t,e){if(0!==e.length)throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() does not support arguments, but was called with "+ET(e.length,"argument")+".")}function sT(t,e,n){if(e.length!==n)throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() requires "+ET(n,"argument")+", but was called with "+ET(e.length,"argument")+".")}function aT(t,e,n){if(e.length<n)throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() requires at least "+ET(n,"argument")+", but was called with "+ET(e.length,"argument")+".")}function uT(t,e,n,r){if(e.length<n||e.length>r)throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+ET(e.length,"argument")+".")}function cT(t,e,n,r){dT(t,e,wT(n)+" argument",r)}function hT(t,e,n,r){void 0!==r&&cT(t,e,n,r)}function lT(t,e,n,r){dT(t,e,n+" option",r)}function fT(t,e,n,r){void 0!==r&&lT(t,e,n,r)}function pT(t,e,n,r,u){void 0!==r&&function(t,e,n){for(var r=[],i=0,o=u;i<o.length;i++){var s=o[i];if(s===n)return;r.push(yT(s))}var a=yT(n);throw new og(ig.INVALID_ARGUMENT,"Invalid value "+a+" provided to function "+t+'() for option "'+e+'". Acceptable values: '+r.join(", "))}(t,n,r)}function dT(t,e,n,r){if(!("object"===e?vT(r):"non-empty string"===e?"string"==typeof r&&""!==r:typeof r===e)){var i=yT(r);throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() requires its "+n+" to be of type "+e+", but it was: "+i)}}function vT(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}function yT(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return 20<e.length&&(e=e.substring(0,20)+"..."),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"!=typeof e)return"function"==typeof e?"a function":A_();if(e instanceof Array)return"an array";var t=function(){if(e.constructor){var t=/function\s+([^\s(]+)\s*\(/.exec(e.constructor.toString());if(t&&1<t.length)return t[1]}return null}();return t?"a custom "+t+" object":"an object"}function gT(t,e,n){if(void 0===n)throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() requires a valid "+wT(e)+" argument, but it was undefined.")}function mT(n,t,r){Og(t,function(t,e){if(r.indexOf(t)<0)throw new og(ig.INVALID_ARGUMENT,"Unknown option '"+t+"' passed to function "+n+"(). Available options: "+r.join(", "))})}function bT(t,e,n,r){var i=yT(r);return new og(ig.INVALID_ARGUMENT,"Function "+t+"() requires its "+wT(n)+" argument to be a "+e+", but it was: "+i)}function _T(t,e,n){if(n<=0)throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() requires its "+wT(e)+" argument to be a positive number, but it was: "+n+".")}function wT(t){switch(t){case 1:return"first";case 2:return"second";case 3:return"third";default:return t+"th"}}function ET(t,e){return t+" "+e+(1===t?"":"s")}function TT(){if("undefined"==typeof Uint8Array)throw new og(ig.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function IT(){if(!__.nt().ac)throw new og(ig.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var ST=(AT.fromBase64String=function(t){sT("Blob.fromBase64String",arguments,1),cT("Blob.fromBase64String","string",1,t),IT();try{return new AT(Pg.fromBase64String(t))}catch(t){throw new og(ig.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+t)}},AT.fromUint8Array=function(t){if(sT("Blob.fromUint8Array",arguments,1),TT(),!(t instanceof Uint8Array))throw bT("Blob.fromUint8Array","Uint8Array",1,t);return new AT(Pg.fromUint8Array(t))},AT.prototype.toBase64=function(){return sT("Blob.toBase64",arguments,0),IT(),this.uc.toBase64()},AT.prototype.toUint8Array=function(){return sT("Blob.toUint8Array",arguments,0),TT(),this.uc.toUint8Array()},AT.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},AT.prototype.isEqual=function(t){return this.uc.isEqual(t.uc)},AT),CT=(NT.documentId=function(){return NT._c},NT.prototype.isEqual=function(t){if(!(t instanceof NT))throw bT("isEqual","FieldPath",1,t);return this.cc.isEqual(t.cc)},NT);function NT(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];!function(){if(!(t instanceof Array)||t.length<1)throw new og(ig.INVALID_ARGUMENT,"Function FieldPath() requires its fieldNames argument to be an array with at least 1 element.")}();for(var n=0;n<t.length;++n)if(cT("FieldPath","string",n,t[n]),0===t[n].length)throw new og(ig.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this.cc=new Sg(t)}function AT(t){IT(),this.uc=t}CT._c=new CT(Sg.J().j());var kT,OT,RT,PT,DT,xT=new RegExp("[~\\*/\\[\\]]"),LT=function(t){this.lc=t},MT=(Es(JT,DT=LT),JT.prototype.Di=function(t){if(2!==t.dc)throw 1===t.dc?t.fc("FieldValue.delete() can only appear at the top level of your update data"):t.fc("FieldValue.delete() cannot be used with set() unless you pass {merge:true}");return t.Vt.push(t.path),null},JT.prototype.isEqual=function(t){return t instanceof JT},JT),FT=(Es($T,PT=LT),$T.prototype.Di=function(t){return new gm(t.path,em.instance)},$T.prototype.isEqual=function(t){return t instanceof $T},$T),UT=(Es(XT,RT=LT),XT.prototype.Di=function(t){var e=new tI({dc:3,methodName:this.lc,Ec:!0},t.ii,t.serializer,t.ignoreUndefinedProperties),n=this.Tc.map(function(t){return iI(t,e)}),r=new rm(n);return new gm(t.path,r)},XT.prototype.isEqual=function(t){return this===t},XT),jT=(Es(YT,OT=LT),YT.prototype.Di=function(t){var e=new tI({dc:3,methodName:this.lc,Ec:!0},t.ii,t.serializer,t.ignoreUndefinedProperties),n=this.Tc.map(function(t){return iI(t,e)}),r=new im(n);return new gm(t.path,r)},YT.prototype.isEqual=function(t){return this===t},YT),VT=(Es(QT,kT=LT),QT.prototype.Di=function(t){var e=new tI({dc:3,methodName:this.lc},t.ii,t.serializer,t.ignoreUndefinedProperties),n=iI(this.Ic,e),r=new om(t.serializer,n);return new gm(t.path,r)},QT.prototype.isEqual=function(t){return this===t},QT),qT=(Object.defineProperty(KT.prototype,"latitude",{get:function(){return this.wc},enumerable:!0,configurable:!0}),Object.defineProperty(KT.prototype,"longitude",{get:function(){return this.Rc},enumerable:!0,configurable:!0}),KT.prototype.isEqual=function(t){return this.wc===t.wc&&this.Rc===t.Rc},KT.prototype.p=function(t){return D_(this.wc,t.wc)||D_(this.Rc,t.Rc)},KT),BT=/^__.*__$/,WT=(zT.prototype.Ac=function(t,e){var n=[];return null!==this.Vt?n.push(new wm(t,this.data,this.Vt,e)):n.push(new _m(t,this.data,e)),0<this.fieldTransforms.length&&n.push(new Em(t,this.fieldTransforms)),n},zT),HT=(GT.prototype.Ac=function(t,e){var n=[new wm(t,this.data,this.Vt,e)];return 0<this.fieldTransforms.length&&n.push(new Em(t,this.fieldTransforms)),n},GT);function GT(t,e,n){this.data=t,this.Vt=e,this.fieldTransforms=n}function zT(t,e,n){this.data=t,this.Vt=e,this.fieldTransforms=n}function KT(t,e){if(sT("GeoPoint",arguments,2),cT("GeoPoint","number",1,t),cT("GeoPoint","number",2,e),!isFinite(t)||t<-90||90<t)throw new og(ig.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||180<e)throw new og(ig.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this.wc=t,this.Rc=e}function QT(t){var e=this;return(e=kT.call(this,"FieldValue.increment")||this).Ic=t,e}function YT(t){var e=this;return(e=OT.call(this,"FieldValue.arrayRemove")||this).Tc=t,e}function XT(t){var e=this;return(e=RT.call(this,"FieldValue.arrayUnion")||this).Tc=t,e}function $T(){return PT.call(this,"FieldValue.serverTimestamp")||this}function JT(){return DT.call(this,"FieldValue.delete")||this}function ZT(t){switch(t){case 0:case 2:case 1:return 1;case 3:case 4:return;default:throw A_()}}var tI=(Object.defineProperty(rI.prototype,"path",{get:function(){return this.settings.path},enumerable:!0,configurable:!0}),Object.defineProperty(rI.prototype,"dc",{get:function(){return this.settings.dc},enumerable:!0,configurable:!0}),rI.prototype.Pc=function(t){return new rI(Object.assign(Object.assign({},this.settings),t),this.ii,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.Vt)},rI.prototype.Vc=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.Pc({path:n,Ec:!1});return r.gc(t),r},rI.prototype.pc=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.Pc({path:n,Ec:!1});return r.mc(),r},rI.prototype.yc=function(t){return this.Pc({path:void 0,Ec:!0})},rI.prototype.fc=function(t){var e=!this.path||this.path.B()?"":" (found in field "+this.path.toString()+")";return new og(ig.INVALID_ARGUMENT,"Function "+this.settings.methodName+"() called with invalid data. "+t+e)},rI.prototype.contains=function(e){return void 0!==this.Vt.find(function(t){return e.q(t)})||void 0!==this.fieldTransforms.find(function(t){return e.q(t.field)})},rI.prototype.mc=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.gc(this.path.get(t))},rI.prototype.gc=function(t){if(0===t.length)throw this.fc("Document fields must not be empty");if(ZT(this.dc)&&BT.test(t))throw this.fc('Document fields cannot begin and end with "__"')},rI),eI=(nI.prototype.vc=function(t,e){var n=this.Sc(0,t);aI("Data must be an object, but it was:",n,e);var r=oI(e,n);return new WT(new Sm(r),null,n.fieldTransforms)},nI.prototype.Dc=function(t,e,n){var r=this.Sc(2,t);aI("Data must be an object, but it was:",r,e);var i,o,s=oI(e,r);if(n){for(var a=[],u=0,c=n;u<c.length;u++){var h=c[u],l=void 0;if(h instanceof CT)l=h.cc;else{if("string"!=typeof h)throw A_();l=cI(t,h)}if(!r.contains(l))throw new og(ig.INVALID_ARGUMENT,"Field '"+l+"' is specified in your field mask but missing from your input data.");hI(a,l)||a.push(l)}i=new ym(a),o=r.fieldTransforms.filter(function(t){return i.dt(t.field)})}else i=new ym(r.Vt),o=r.fieldTransforms;return new WT(new Sm(s),i,o)},nI.prototype.Cc=function(o,t){var s=this.Sc(1,o);aI("Data must be an object, but it was:",s,t);var a=[],u=new Cm;Og(t,function(t,e){var n=cI(o,t),r=s.pc(n);if(e instanceof MT)a.push(n);else{var i=iI(e,r);null!=i&&(a.push(n),u.set(n,i))}});var e=new ym(a);return new HT(u.yt(),e,s.fieldTransforms)},nI.prototype.Fc=function(t,e,n,r){var i=this.Sc(1,t),o=[uI(t,e)],s=[n];if(r.length%2!=0)throw new og(ig.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(uI(t,r[a])),s.push(r[a+1]);for(var u=[],c=new Cm,h=o.length-1;0<=h;--h)if(!hI(u,o[h])){var l=o[h],f=s[h],p=i.pc(l);if(f instanceof MT)u.push(l);else{var d=iI(f,p);null!=d&&(u.push(l),c.set(l,d))}}var v=new ym(u);return new HT(c.yt(),v,i.fieldTransforms)},nI.prototype.Sc=function(t,e){return new tI({dc:t,methodName:e,path:Sg.G,Ec:!1},this.ii,this.serializer,this.ignoreUndefinedProperties)},nI.prototype.Nc=function(t,e,n){return void 0===n&&(n=!1),iI(e,this.Sc(n?4:3,t))},nI);function nI(t,e,n){this.ii=t,this.ignoreUndefinedProperties=e,this.serializer=n||__.nt().bc(t)}function rI(t,e,n,r,i,o){this.settings=t,this.ii=e,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this.mc(),this.fieldTransforms=i||[],this.Vt=o||[]}function iI(s,t){if(sI(s))return aI("Unsupported field value:",t,s),oI(s,t);if(s instanceof LT)return function(t,e){if(!ZT(e.dc))throw e.fc(t.lc+"() can only be used with update() and set()");if(null===e.path)throw e.fc(t.lc+"() is not currently supported inside arrays");var n=t.Di(e);n&&e.fieldTransforms.push(n)}(s,t),null;if(t.path&&t.Vt.push(t.path),s instanceof Array){if(t.settings.Ec&&4!==t.dc)throw t.fc("Nested arrays are not supported");return function(t){for(var e=[],n=0,r=0,i=s;r<i.length;r++){var o=iI(i[r],t.yc(n));null==o&&(o={nullValue:"NULL_VALUE"}),e.push(o),n++}return{arrayValue:{values:e}}}(t)}return function(t,e){if(null===t)return{nullValue:"NULL_VALUE"};if("number"==typeof t)return e.serializer.ai(t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){var n=hg.fromDate(t);return{timestampValue:e.serializer.C(n)}}if(t instanceof hg){var r=new hg(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:e.serializer.C(r)}}if(t instanceof qT)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof ST)return{bytesValue:e.serializer.ui(t)};if(t instanceof HS){var i=e.ii,o=t.firestore.$c;if(!o.isEqual(i))throw e.fc("Document reference is for database "+o.projectId+"/"+o.database+" but should be for database "+i.projectId+"/"+i.database);return{referenceValue:e.serializer._i(t.kc.path,t.firestore.$c)}}if(void 0===t&&e.ignoreUndefinedProperties)return null;throw e.fc("Unsupported field value: "+yT(t))}(s,t)}function oI(t,r){var i={};return Rg(t)?r.path&&0<r.path.length&&r.Vt.push(r.path):Og(t,function(t,e){var n=iI(e,r.Vc(t));null!=n&&(i[t]=n)}),{mapValue:{fields:i}}}function sI(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof hg||t instanceof qT||t instanceof ST||t instanceof HS||t instanceof LT)}function aI(t,e,n){if(!sI(n)||!vT(n)){var r=yT(n);throw"an object"===r?e.fc(t+" a custom object"):e.fc(t+" "+r)}}function uI(t,e){if(e instanceof CT)return e.cc;if("string"==typeof e)return cI(t,e);throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() called with invalid data. Field path arguments must be of type string or FieldPath.")}function cI(t,e){try{return function(e){if(0<=e.search(xT))throw new og(ig.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(CT.bind.apply(CT,ks([void 0],e.split("."))))}catch(t){throw new og(ig.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(e).cc}catch(e){var n=e instanceof Error?e.message:e.toString();throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() called with invalid data. "+n)}}function hI(t,e){return t.some(function(t){return t.isEqual(e)})}var lI,fI,pI,dI=(NI.prototype.qc=function(){return 1===this.state||2===this.state||4===this.state},NI.prototype.Uc=function(){return 2===this.state},NI.prototype.start=function(){3!==this.state?this.auth():this.Qc()},NI.prototype.stop=function(){return Is(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.qc()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},NI.prototype.Wc=function(){this.state=0,this.$a.reset()},NI.prototype.jc=function(){var t=this;this.Uc()&&null===this.Bc&&(this.Bc=this.Tr.yr(this.Lc,6e4,function(){return t.Kc()}))},NI.prototype.Gc=function(t){this.zc(),this.stream.send(t)},NI.prototype.Kc=function(){return Is(this,void 0,void 0,function(){return Ss(this,function(t){return this.Uc()?[2,this.close(0)]:[2]})})},NI.prototype.zc=function(){this.Bc&&(this.Bc.cancel(),this.Bc=null)},NI.prototype.close=function(e,n){return Is(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.zc(),this.$a.cancel(),this.xc++,3!==e?this.$a.reset():n&&n.code===ig.RESOURCE_EXHAUSTED?(C_(n.toString()),C_("Using maximum backoff delay to prevent overloading the backend."),this.$a.Vr()):n&&n.code===ig.UNAUTHENTICATED&&this.Oc._(),null!==this.stream&&(this.Hc(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.Yc(n)];case 1:return t.sent(),[2]}})})},NI.prototype.Hc=function(){},NI.prototype.auth=function(){var n=this;this.state=1;var t=this.Jc(this.xc),e=this.xc;this.Oc.getToken().then(function(t){n.xc===e&&n.Xc(t)},function(e){t(function(){var t=new og(ig.UNKNOWN,"Fetching auth token failed: "+e.message);return n.Zc(t)})})},NI.prototype.Xc=function(t){var e=this,n=this.Jc(this.xc);this.stream=this.t_(t),this.stream.e_(function(){n(function(){return e.state=2,e.listener.e_()})}),this.stream.Yc(function(t){n(function(){return e.Zc(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},NI.prototype.Qc=function(){var t=this;this.state=4,this.$a.gr(function(){return Is(t,void 0,void 0,function(){return Ss(this,function(t){return this.state=0,this.start(),[2]})})})},NI.prototype.Zc=function(t){return S_("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},NI.prototype.Jc=function(e){var n=this;return function(t){n.Tr.uo(function(){return n.xc===e?t():(S_("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},NI),vI=(Es(CI,pI=dI),CI.prototype.t_=function(t){return this.Mc.s_("Listen",t)},CI.prototype.onMessage=function(t){this.$a.reset();var e=this.serializer.pi(t),n=this.serializer.bi(t);return this.listener.i_(e,n)},CI.prototype.n_=function(t){var e={};e.database=this.serializer.wi,e.addTarget=this.serializer.ee(t);var n=this.serializer.zi(t);n&&(e.labels=n),this.Gc(e)},CI.prototype.r_=function(t){var e={};e.database=this.serializer.wi,e.removeTarget=t,this.Gc(e)},CI),yI=(Es(SI,fI=dI),Object.defineProperty(SI.prototype,"o_",{get:function(){return this.h_},enumerable:!0,configurable:!0}),SI.prototype.start=function(){this.h_=!1,fI.prototype.start.call(this)},SI.prototype.Hc=function(){this.h_&&this.a_([])},SI.prototype.t_=function(t){return this.Mc.s_("Write",t)},SI.prototype.onMessage=function(t){if(k_(!!t.streamToken),this.lastStreamToken=this.serializer.ci(t.streamToken),this.h_){this.$a.reset();var e=this.serializer.Mi(t.writeResults,t.commitTime),n=this.serializer.fromVersion(t.commitTime);return this.listener.u_(n,e)}return k_(!t.writeResults||0===t.writeResults.length),this.h_=!0,this.listener.c_()},SI.prototype.__=function(){var t={};t.database=this.serializer.wi,this.Gc(t)},SI.prototype.a_=function(t){var e=this,n={streamToken:this.serializer.ui(this.lastStreamToken),writes:t.map(function(t){return e.serializer.vi(t)})};this.Gc(n)},SI),gI=(Es(II,lI=function(){this.l_=void 0}),II.prototype.d_=function(e,n){var r=this;return this.credentials.getToken().then(function(t){return r.Mc.d_(e,n,t)}).catch(function(t){throw t.code===ig.UNAUTHENTICATED&&r.credentials._(),t})},II.prototype.f_=function(e,n){var r=this;return this.credentials.getToken().then(function(t){return r.Mc.f_(e,n,t)}).catch(function(t){throw t.code===ig.UNAUTHENTICATED&&r.credentials._(),t})},II),mI=(TI.prototype.A_=function(r){return Is(this,void 0,void 0,function(){var e,n=this;return Ss(this,function(t){switch(t.label){case 0:if(this.m_(),0<this.mutations.length)throw new og(ig.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(s,a){return Is(this,void 0,void 0,function(){var n,e,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return n=O_(s),e={database:n.serializer.wi,documents:a.map(function(t){return n.serializer.fi(t)})},[4,n.f_("BatchGetDocuments",e)];case 1:return r=t.sent(),i=new Map,r.forEach(function(t){var e=n.serializer.gi(t);i.set(e.key.toString(),e)}),o=[],[2,(a.forEach(function(t){var e=i.get(t.toString());k_(!!e),o.push(e)}),o)]}})})}(this.T_,r)];case 1:return[2,((e=t.sent()).forEach(function(t){t instanceof Zm||t instanceof Jm?n.P_(t):A_()}),e)]}})})},TI.prototype.set=function(t,e){this.write(e.Ac(t,this.Rt(t))),this.R_.add(t)},TI.prototype.update=function(t,e){try{this.write(e.Ac(t,this.V_(t)))}catch(t){this.w_=t}this.R_.add(t)},TI.prototype.delete=function(t){this.write([new Tm(t,this.Rt(t))]),this.R_.add(t)},TI.prototype.commit=function(){return Is(this,void 0,void 0,function(){var e,n=this;return Ss(this,function(t){switch(t.label){case 0:if(this.m_(),this.w_)throw this.w_;return e=this.E_,this.mutations.forEach(function(t){e=e.remove(t.key)}),e.forEach(function(t,e){n.mutations.push(new Im(t,n.Rt(t)))}),[4,function(i,o){return Is(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=O_(i),n={database:e.serializer.wi,writes:o.map(function(t){return e.serializer.vi(t)})},[4,e.d_("Commit",n)];case 1:return r=t.sent(),[2,e.serializer.Mi(r.writeResults,r.commitTime)]}})})}(this.T_,this.mutations)];case 1:return t.sent(),this.I_=!0,[2]}})})},TI.prototype.P_=function(t){var e;if(t instanceof Jm)e=t.version;else{if(!(t instanceof Zm))throw A_();e=lg.min()}var n=this.E_.get(t.key);if(null!==n){if(!e.isEqual(n))throw new og(ig.ABORTED,"Document version changed between two reads.")}else this.E_=this.E_.Ae(t.key,e)},TI.prototype.Rt=function(t){var e=this.E_.get(t);return!this.R_.has(t)&&e?mm.updateTime(e):mm.ft()},TI.prototype.V_=function(t){var e=this.E_.get(t);if(this.R_.has(t)||!e)return mm.exists(!0);if(e.isEqual(lg.min()))throw new og(ig.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return mm.updateTime(e)},TI.prototype.write=function(t){this.m_(),this.mutations=this.mutations.concat(t)},TI.prototype.m_=function(){},TI),bI=(EI.prototype.v_=function(){var t=this;0===this.p_&&(this.S_("Unknown"),this.y_=this.Aa.yr("online_state_timeout",1e4,function(){return t.y_=null,t.D_("Backend didn't respond within 10 seconds."),t.S_("Offline"),Promise.resolve()}))},EI.prototype.C_=function(t){"Online"===this.state?this.S_("Unknown"):(this.p_++,1<=this.p_&&(this.F_(),this.D_("Connection failed 1 times. Most recent error: "+t.toString()),this.S_("Offline")))},EI.prototype.set=function(t){this.F_(),this.p_=0,"Online"===t&&(this.b_=!1),this.S_(t)},EI.prototype.S_=function(t){t!==this.state&&(this.state=t,this.g_(t))},EI.prototype.D_=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.b_?(C_(e),this.b_=!1):S_("OnlineStateTracker",e)},EI.prototype.F_=function(){null!==this.y_&&(this.y_.cancel(),this.y_=null)},EI),_I=(wI.prototype.start=function(){return this.enableNetwork()},wI.prototype.enableNetwork=function(){return this.networkEnabled=!0,this.X_()},wI.prototype.X_=function(){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.q_()?(e=this.z_,[4,this.N_.Yo()]):[3,3];case 1:return e.lastStreamToken=t.sent(),this.Z_()?this.tl():this.Q_.set("Unknown"),[4,this.el()];case 2:t.sent(),t.label=3;case 3:return[2]}})})},wI.prototype.disableNetwork=function(){return Is(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.networkEnabled=!1,[4,this.sl()];case 1:return t.sent(),this.Q_.set("Offline"),[2]}})})},wI.prototype.sl=function(){return Is(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,this.z_.stop()];case 1:return t.sent(),[4,this.W_.stop()];case 2:return t.sent(),0<this.k_.length&&(S_("RemoteStore","Stopping write stream with "+this.k_.length+" pending writes"),this.k_=[]),this.il(),[2]}})})},wI.prototype.mo=function(){return Is(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return S_("RemoteStore","RemoteStore shutting down."),this.networkEnabled=!1,[4,this.sl()];case 1:return t.sent(),this.x_.mo(),this.Q_.set("Unknown"),[2]}})})},wI.prototype.listen=function(t){this.L_.has(t.targetId)||(this.L_.set(t.targetId,t),this.Z_()?this.tl():this.W_.Uc()&&this.nl(t))},wI.prototype.rl=function(t){this.L_.delete(t),this.W_.Uc()&&this.hl(t),0===this.L_.size&&(this.W_.Uc()?this.W_.jc():this.q_()&&this.Q_.set("Unknown"))},wI.prototype.si=function(t){return this.L_.get(t)||null},wI.prototype.ei=function(t){return this.ol.ei(t)},wI.prototype.nl=function(t){this.M_.Ns(t.targetId),this.W_.n_(t)},wI.prototype.hl=function(t){this.M_.Ns(t),this.W_.r_(t)},wI.prototype.tl=function(){this.M_=new o_(this),this.W_.start(),this.Q_.v_()},wI.prototype.Z_=function(){return this.q_()&&!this.W_.qc()&&0<this.L_.size},wI.prototype.q_=function(){return!this.O_&&this.isPrimary&&this.networkEnabled},wI.prototype.il=function(){this.M_=null},wI.prototype.j_=function(){return Is(this,void 0,void 0,function(){var n=this;return Ss(this,function(t){return this.L_.forEach(function(t,e){n.nl(t)}),[2]})})},wI.prototype.K_=function(e){return Is(this,void 0,void 0,function(){return Ss(this,function(t){return this.il(),this.Z_()?(this.Q_.C_(e),this.tl()):this.Q_.set("Unknown"),[2]})})},wI.prototype.G_=function(i,o){return Is(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:if(this.Q_.set("Online"),!(i instanceof Jb&&2===i.state&&i.cause))return[3,6];t.label=1;case 1:return t.trys.push([1,3,,5]),[4,this.al(i)];case 2:return t.sent(),[3,5];case 3:return e=t.sent(),S_("RemoteStore","Failed to remove targets %s: %s ",i.targetIds.join(","),e),[4,this.ul(e)];case 4:return t.sent(),[3,5];case 5:return[3,13];case 6:if(i instanceof Xb?this.M_.qs(i):i instanceof $b?this.M_.Hs(i):this.M_.Ws(i),o.isEqual(lg.min()))return[3,13];t.label=7;case 7:return t.trys.push([7,11,,13]),[4,this.N_._h()];case 8:return n=t.sent(),0<=o.S(n)?[4,this.cl(o)]:[3,10];case 9:t.sent(),t.label=10;case 10:return[3,13];case 11:return S_("RemoteStore","Failed to raise snapshot:",r=t.sent()),[4,this.ul(r)];case 12:return t.sent(),[3,13];case 13:return[2]}})})},wI.prototype.ul=function(n){return Is(this,void 0,void 0,function(){var e=this;return Ss(this,function(t){switch(t.label){case 0:if(!CE(n))throw n;return this.O_=!0,[4,this.sl()];case 1:return t.sent(),this.Q_.set("Offline"),this.Aa.Ua(function(){return Is(e,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return S_("RemoteStore","Retrying IndexedDB access"),[4,this.N_._h()];case 1:return t.sent(),this.O_=!1,[4,this.X_()];case 2:return t.sent(),[2]}})})}),[2]}})})},wI.prototype.cl=function(r){var i=this,t=this.M_.Xs(r);return t.as.forEach(function(t,e){if(0<t.resumeToken.rt()){var n=i.L_.get(e);n&&i.L_.set(e,n.we(t.resumeToken,r))}}),t.us.forEach(function(t){var e=i.L_.get(t);if(e){i.L_.set(t,e.we(Pg.ht,e.Ee)),i.hl(t);var n=new lb(e.target,t,1,e.sequenceNumber);i.nl(n)}}),this.ol.Mu(t)},wI.prototype.al=function(o){return Is(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:e=o.cause,n=0,r=o.targetIds,t.label=1;case 1:return n<r.length?(i=r[n],this.L_.has(i)?[4,this.ol._l(i,e)]:[3,3]):[3,5];case 2:t.sent(),this.L_.delete(i),this.M_.removeTarget(i),t.label=3;case 3:t.label=4;case 4:return n++,[3,1];case 5:return[2]}})})},wI.prototype.el=function(){return Is(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return this.ll()?(e=0<this.k_.length?this.k_[this.k_.length-1].batchId:-1,[4,this.N_.qu(e)]):[3,5];case 1:return null!==(n=t.sent())?[3,2]:(0===this.k_.length&&this.z_.jc(),[3,4]);case 2:return this.dl(n),[4,this.el()];case 3:t.sent(),t.label=4;case 4:t.label=5;case 5:return this.fl()&&this.Tl(),[2]}})})},wI.prototype.ll=function(){return this.q_()&&this.k_.length<10},wI.prototype.El=function(){return this.k_.length},wI.prototype.dl=function(t){this.k_.push(t),this.z_.Uc()&&this.z_.o_&&this.z_.a_(t.mutations)},wI.prototype.fl=function(){return this.q_()&&!this.z_.qc()&&0<this.k_.length},wI.prototype.Tl=function(){this.z_.start()},wI.prototype.H_=function(){return Is(this,void 0,void 0,function(){return Ss(this,function(t){return this.z_.__(),[2]})})},wI.prototype.J_=function(){var r=this;return this.N_.Jo(this.z_.lastStreamToken).then(function(){for(var t=0,e=r.k_;t<e.length;t++){var n=e[t];r.z_.a_(n.mutations)}}).catch(tT)},wI.prototype.u_=function(t,e){var n=this,r=this.k_.shift(),i=V_.from(r,t,e,this.z_.lastStreamToken);return this.ol.Il(i).then(function(){return n.el()})},wI.prototype.Y_=function(e){return Is(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return e&&0<this.k_.length?this.z_.o_?[4,this.wl(e)]:[3,2]:[3,5];case 1:return t.sent(),[3,4];case 2:return[4,this.Rl(e)];case 3:t.sent(),t.label=4;case 4:this.fl()&&this.Tl(),t.label=5;case 5:return[2]}})})},wI.prototype.Rl=function(e){return Is(this,void 0,void 0,function(){return Ss(this,function(t){return Cb(e.code)?[2,(S_("RemoteStore","RemoteStore error before completed handshake; resetting stream token: ",this.z_.lastStreamToken),this.z_.lastStreamToken=Pg.ht,this.N_.Jo(Pg.ht).catch(tT))]:[2]})})},wI.prototype.wl=function(i){return Is(this,void 0,void 0,function(){var e,n,r=this;return Ss(this,function(t){return Cb(n=i.code)&&n!==ig.ABORTED?(e=this.k_.shift(),[2,(this.z_.Wc(),this.ol.Al(e.batchId,i).then(function(){return r.el()}))]):[2]})})},wI.prototype.ml=function(){return new mI(this.T_)},wI.prototype.U_=function(){return Is(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.networkEnabled=!1,[4,this.sl()];case 1:return t.sent(),this.Q_.set("Unknown"),[4,this.enableNetwork()];case 2:return t.sent(),[2]}})})},wI.prototype.Pl=function(){return Is(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.q_()?(S_("RemoteStore","RemoteStore restarting streams for new credential"),[4,this.U_()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},wI.prototype.Vl=function(e){return Is(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,5];case 2:return e?[3,4]:[4,this.sl()];case 3:t.sent(),this.Q_.set("Unknown"),t.label=4;case 4:t.label=5;case 5:return[2]}})})},wI);function wI(t,e,n,r,i){var o,s,a,u,c,h,l,f,p=this;this.N_=t,this.T_=e,this.Aa=n,this.k_=[],this.L_=new Map,this.M_=null,this.networkEnabled=!1,this.isPrimary=!1,this.O_=!1,this.x_=i,this.x_.B_(function(t){n.uo(function(){return Is(p,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.q_()?(S_("RemoteStore","Restarting streams for network reachability change."),[4,this.U_()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}),this.Q_=new bI(n,r),this.W_=(c=this.T_,h=n,l={e_:this.j_.bind(this),Yc:this.K_.bind(this),i_:this.G_.bind(this)},f=O_(c),new vI(h,f.Mc,f.credentials,f.serializer,l)),this.z_=(o=this.T_,s=n,a={e_:this.H_.bind(this),Yc:this.Y_.bind(this),c_:this.J_.bind(this),u_:this.u_.bind(this)},u=O_(o),new yI(s,u.Mc,u.credentials,u.serializer,a))}function EI(t,e){this.Aa=t,this.g_=e,this.state="Unknown",this.p_=0,this.y_=null,this.b_=!0}function TI(t){this.T_=t,this.E_=Gb(),this.mutations=[],this.I_=!1,this.w_=null,this.R_=new Set}function II(t,e,n){var r=this;return(r=lI.call(this)||this).Mc=t,r.credentials=e,r.serializer=n,r}function SI(t,e,n,r,i){var o=this;return(o=fI.call(this,t,"write_stream_connection_backoff","write_stream_idle",e,n,i)||this).serializer=r,o.h_=!1,o.lastStreamToken=Pg.ht,o}function CI(t,e,n,r,i){var o=this;return(o=pI.call(this,t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i)||this).serializer=r,o}function NI(t,e,n,r,i,o){this.Tr=t,this.Lc=n,this.Mc=r,this.Oc=i,this.listener=o,this.state=0,this.xc=0,this.Bc=null,this.stream=null,this.$a=new ow(t,e)}function AI(t,e){return"firestore_clients_"+t+"_"+e}function kI(t,e,n){var r="firestore_mutations_"+t+"_"+n;return e.t()&&(r+="_"+e.uid),r}function OI(t,e){return"firestore_targets_"+t+"_"+e}function RI(t){this.key=t}function PI(t){this.key=t}function DI(t,e,n){this.query=t,this.targetId=e,this.view=n}function xI(t){this.key=t,this.qd=!1}function LI(){this.gf=void 0,this.pf=[]}var MI,FI,UI=(vS.gl=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 og(r.error.code,r.error.message)),i?new vS(t,e,r.state,o):(C_("SharedClientState","Failed to parse mutation state for ID '"+e+"': "+n),null)},vS.prototype.pl=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)},vS),jI=(dS.gl=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 og(n.error.code,n.error.message)),r?new dS(t,n.state,i):(C_("SharedClientState","Failed to parse target state for ID '"+t+"': "+e),null)},dS.prototype.pl=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)},dS),VI=(pS.gl=function(t,e){for(var n=JSON.parse(e),r="object"==typeof n&&n.activeTargetIds instanceof Array,i=Yb(),o=0;r&&o<n.activeTargetIds.length;++o)r=Mg(n.activeTargetIds[o]),i=i.add(n.activeTargetIds[o]);return r?new pS(t,i):(C_("SharedClientState","Failed to parse client data for instance '"+t+"': "+e),null)},pS),qI=(fS.gl=function(t){var e=JSON.parse(t);return"object"==typeof e&&-1!==["Unknown","Online","Offline"].indexOf(e.onlineState)&&"string"==typeof e.clientId?new fS(e.clientId,e.onlineState):(C_("SharedClientState","Failed to parse online state: "+t),null)},fS),BI=(lS.prototype.yl=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},lS.prototype.bl=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},lS.prototype.pl=function(){var t={activeTargetIds:this.activeTargetIds.W(),updateTimeMs:Date.now()};return JSON.stringify(t)},lS),WI=(hS.Gh=function(t){return!(!t.window||null==t.window.localStorage)},hS.prototype.start=function(){return Is(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[4,this.ol.bo()];case 1:for(e=t.sent(),n=0,r=e;n<r.length;n++)(i=r[n])!==this.vl&&(o=this.getItem(AI(this.persistenceKey,i)))&&(s=VI.gl(i,o))&&(this.Cl=this.Cl.Ae(s.clientId,s));for(this.xl(),(a=this.storage.getItem(this.Ol))&&(u=this.Bl(a))&&this.ql(u),c=0,h=this.Fl;c<h.length;c++)l=h[c],this.Dl(l);return this.Fl=[],this.platform.window.addEventListener("unload",function(){return f.mo()}),this.ro=!0,[2]}})})},hS.prototype.lr=function(t){this.setItem(this.$l,JSON.stringify(t))},hS.prototype.Ul=function(){return this.Ql(this.Cl)},hS.prototype.Wl=function(n){var r=!1;return this.Cl.forEach(function(t,e){e.activeTargetIds.has(n)&&(r=!0)}),r},hS.prototype.jl=function(t){this.Kl(t,"pending")},hS.prototype.Gl=function(t,e,n){this.Kl(t,e,n),this.zl(t)},hS.prototype.Hl=function(t){var e="not-current";if(this.Wl(t)){var n=this.storage.getItem(OI(this.persistenceKey,t));if(n){var r=jI.gl(t,n);r&&(e=r.state)}}return this.Yl.yl(t),this.xl(),e},hS.prototype.Jl=function(t){this.Yl.bl(t),this.xl()},hS.prototype.Xl=function(t){return this.Yl.activeTargetIds.has(t)},hS.prototype.Zl=function(t){this.removeItem(OI(this.persistenceKey,t))},hS.prototype.td=function(t,e,n){this.ed(t,e,n)},hS.prototype.Du=function(t,e,n){var r=this;e.forEach(function(t){r.zl(t)}),this.currentUser=t,n.forEach(function(t){r.jl(t)})},hS.prototype.sd=function(t){this.nd(t)},hS.prototype.mo=function(){this.ro&&(this.platform.window.removeEventListener("storage",this.Sl),this.removeItem(this.Nl),this.ro=!1)},hS.prototype.getItem=function(t){var e=this.storage.getItem(t);return S_("SharedClientState","READ",t,e),e},hS.prototype.setItem=function(t,e){S_("SharedClientState","SET",t,e),this.storage.setItem(t,e)},hS.prototype.removeItem=function(t){S_("SharedClientState","REMOVE",t),this.storage.removeItem(t)},hS.prototype.Dl=function(a){var t=this;if(a.storageArea===this.storage){if(S_("SharedClientState","EVENT",a.key,a.newValue),a.key===this.Nl)return void C_("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.Tr.Ua(function(){return Is(t,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){if(this.ro){if(null!==a.key)if(this.kl.test(a.key)){if(null==a.newValue)return e=this.rd(a.key),[2,this.hd(e,null)];if(n=this.od(a.key,a.newValue))return[2,this.hd(n.clientId,n)]}else if(this.Ll.test(a.key)){if(null!==a.newValue&&(r=this.ad(a.key,a.newValue)))return[2,this.ud(r)]}else if(this.Ml.test(a.key)){if(null!==a.newValue&&(i=this._d(a.key,a.newValue)))return[2,this.ld(i)]}else if(a.key===this.Ol){if(null!==a.newValue&&(o=this.Bl(a.newValue)))return[2,this.ql(o)]}else a.key===this.$l&&(s=function(t){var e=K_.dr;if(null!=t)try{var n=JSON.parse(t);k_("number"==typeof n),e=n}catch(t){C_("SharedClientState","Failed to read sequence number from WebStorage",t)}return e}(a.newValue))!==K_.dr&&this.ur(s)}else this.Fl.push(a);return[2]})})})}},Object.defineProperty(hS.prototype,"Yl",{get:function(){return this.Cl.get(this.vl)},enumerable:!0,configurable:!0}),hS.prototype.xl=function(){this.setItem(this.Nl,this.Yl.pl())},hS.prototype.Kl=function(t,e,n){var r=new UI(this.currentUser,t,e,n),i=kI(this.persistenceKey,this.currentUser,t);this.setItem(i,r.pl())},hS.prototype.zl=function(t){var e=kI(this.persistenceKey,this.currentUser,t);this.removeItem(e)},hS.prototype.nd=function(t){var e={clientId:this.vl,onlineState:t};this.storage.setItem(this.Ol,JSON.stringify(e))},hS.prototype.ed=function(t,e,n){var r=OI(this.persistenceKey,t),i=new jI(t,e,n);this.setItem(r,i.pl())},hS.prototype.rd=function(t){var e=this.kl.exec(t);return e?e[1]:null},hS.prototype.od=function(t,e){var n=this.rd(t);return VI.gl(n,e)},hS.prototype.ad=function(t,e){var n=this.Ll.exec(t),r=Number(n[1]),i=void 0!==n[2]?n[2]:null;return UI.gl(new Zy(i),r,e)},hS.prototype._d=function(t,e){var n=this.Ml.exec(t),r=Number(n[1]);return jI.gl(r,e)},hS.prototype.Bl=function(t){return qI.gl(t)},hS.prototype.ud=function(e){return Is(this,void 0,void 0,function(){return Ss(this,function(t){return e.user.uid===this.currentUser.uid?[2,this.ol.dd(e.batchId,e.state,e.error)]:(S_("SharedClientState","Ignoring mutation for non-active user "+e.user.uid),[2])})})},hS.prototype.ld=function(t){return this.ol.fd(t.targetId,t.state,t.error)},hS.prototype.hd=function(t,e){var n=this,r=e?this.Cl.Ae(t,e):this.Cl.remove(t),i=this.Ql(this.Cl),o=this.Ql(r),s=[],a=[];return o.forEach(function(t){i.has(t)||s.push(t)}),i.forEach(function(t){o.has(t)||a.push(t)}),this.ol.Td(s,a).then(function(){n.Cl=r})},hS.prototype.ql=function(t){this.Cl.get(t.clientId)&&this.g_(t.onlineState)},hS.prototype.Ql=function(t){var n=Yb();return t.forEach(function(t,e){n=n.He(e.activeTargetIds)}),n},hS),HI=(cS.prototype.jl=function(t){},cS.prototype.Gl=function(t,e,n){},cS.prototype.Hl=function(t){return this.Ed.yl(t),this.Id[t]||"not-current"},cS.prototype.td=function(t,e,n){this.Id[t]=e},cS.prototype.Jl=function(t){this.Ed.bl(t)},cS.prototype.Xl=function(t){return this.Ed.activeTargetIds.has(t)},cS.prototype.Zl=function(t){delete this.Id[t]},cS.prototype.Ul=function(){return this.Ed.activeTargetIds},cS.prototype.Wl=function(t){return this.Ed.activeTargetIds.has(t)},cS.prototype.start=function(){return this.Ed=new BI,Promise.resolve()},cS.prototype.Du=function(t,e,n){},cS.prototype.sd=function(t){},cS.prototype.mo=function(){},cS.prototype.lr=function(t){},cS),GI=(Object.defineProperty(uS.prototype,"Pd",{get:function(){return this.wd},enumerable:!0,configurable:!0}),uS.prototype.Vd=function(t,e){var a=this,u=e?e.gd:new t_,c=e?e.md:this.md,h=e?e.ns:this.ns,l=c,f=!1,p=this.query.oe()&&c.size===this.query.limit?c.last():null,d=this.query.ae()&&c.size===this.query.limit?c.first():null;if(t.pe(function(t,e){var n=c.get(t),r=e instanceof Jm?e:null;r=r&&(a.query.matches(r)?r:null);var i=!!n&&a.ns.has(n.key),o=!!r&&(r.At||a.ns.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.pd(n,r)||(u.track({type:2,doc:r}),s=!0,(p&&0<a.query.se(r,p)||d&&a.query.se(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.oe()||this.query.ae())for(;l.size>this.query.limit;){var n=this.query.oe()?l.last():l.first();l=l.delete(n.key),h=h.delete(n.key),u.track({type:1,doc:n})}return{md:l,gd:u,yd:f,ns:h}},uS.prototype.pd=function(t,e){return t.At&&e.hasCommittedMutations&&!e.At},uS.prototype.xn=function(t,e,n){var o=this,r=this.md;this.md=t.md,this.ns=t.ns;var i=t.gd.es();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.query.se(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 A_()}}var r,i}),this.bd(n);var s=e?this.vd():[],a=0===this.Ad.size&&this.fs?1:0,u=a!==this.Rd;return this.Rd=a,0!==i.length||u?{snapshot:new e_(this.query,t.md,r,i,t.ns,0==a,u,!1),Sd:s}:{Sd:s}},uS.prototype.Dd=function(t){return this.fs&&"Offline"===t?(this.fs=!1,this.xn({md:this.md,gd:new t_,ns:this.ns,yd:!1},!1)):{Sd:[]}},uS.prototype.Cd=function(t){return!this.wd.has(t)&&!!this.md.has(t)&&!this.md.get(t).At},uS.prototype.bd=function(t){var e=this;t&&(t.Ts.forEach(function(t){return e.wd=e.wd.add(t)}),t.Es.forEach(function(t){}),t.Is.forEach(function(t){return e.wd=e.wd.delete(t)}),this.fs=t.fs)},uS.prototype.vd=function(){var e=this;if(!this.fs)return[];var n=this.Ad;this.Ad=Kb(),this.md.forEach(function(t){e.Cd(t.key)&&(e.Ad=e.Ad.add(t.key))});var r=[];return n.forEach(function(t){e.Ad.has(t)||r.push(new PI(t))}),this.Ad.forEach(function(t){n.has(t)||r.push(new RI(t))}),r},uS.prototype.Fd=function(t){this.wd=t.Ku,this.Ad=Kb();var e=this.Vd(t.documents);return this.xn(e,!0)},uS.prototype.Nd=function(){return e_.os(this.query,this.md,this.ns,0===this.Rd)},uS),zI=(aS.prototype.Ld=function(){this.Md()},aS.prototype.Md=function(){var t=this;this.$a.gr(function(){return Is(t,void 0,void 0,function(){var e,n,r=this;return Ss(this,function(t){return e=this.$d.ml(),(n=this.Od(e))&&n.then(function(t){r.Aa.uo(function(){return e.commit().then(function(){r.Va.resolve(t)}).catch(function(t){r.xd(t)})})}).catch(function(t){r.xd(t)}),[2]})})})},aS.prototype.Od=function(t){try{var e=this.updateFunction(t);return!xg(e)&&e.catch&&e.then?e:(this.Va.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.Va.reject(t),null}},aS.prototype.xd=function(t){var e=this;0<this.kd&&this.Bd(t)?(--this.kd,this.Aa.uo(function(){return e.Md(),Promise.resolve()})):this.Va.reject(t)},aS.prototype.Bd=function(t){if("FirebaseError"!==t.name)return!1;var e=t.code;return"aborted"===e||"failed-precondition"===e||!Cb(e)},aS),KI=(Object.defineProperty(sS.prototype,"tf",{get:function(){return!0},enumerable:!0,configurable:!0}),sS.prototype.subscribe=function(t){this.Wd=t},sS.prototype.listen=function(s){return Is(this,void 0,void 0,function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return this.ef("listen()"),(r=this.jd.get(s))?(e=r.targetId,this.Ud.Hl(e),n=r.view.Nd(),[3,4]):[3,1];case 1:return[4,this.N_.Qu(s.ee())];case 2:return i=t.sent(),o=this.Ud.Hl(i.targetId),e=i.targetId,[4,this.sf(s,e,"current"===o)];case 3:n=t.sent(),this.tf&&this.$d.listen(i),t.label=4;case 4:return[2,n]}})})},sS.prototype.sf=function(a,u,c){return Is(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.N_.ju(a,!0)];case 1:return e=t.sent(),n=new GI(a,e.Ku),r=n.Vd(e.documents),i=r_.ds(u,c&&"Offline"!==this.onlineState),o=n.xn(r,this.tf,i),this.if(u,o.Sd),s=new DI(a,u,n),[2,(this.jd.set(a,s),this.Kd.has(u)?this.Kd.get(u).push(a):this.Kd.set(u,[a]),o.snapshot)]}})})},sS.prototype.rl=function(i){return Is(this,void 0,void 0,function(){var e,n,r=this;return Ss(this,function(t){switch(t.label){case 0:return this.ef("unlisten()"),e=this.jd.get(i),1<(n=this.Kd.get(e.targetId)).length?[2,(this.Kd.set(e.targetId,n.filter(function(t){return!t.isEqual(i)})),void this.jd.delete(i))]:this.tf?(this.Ud.Jl(e.targetId),this.Ud.Wl(e.targetId)?[3,2]:[4,this.N_.Wu(e.targetId,!1).then(function(){r.Ud.Zl(e.targetId),r.$d.rl(e.targetId),r.nf(e.targetId)}).catch(tT)]):[3,3];case 1:t.sent(),t.label=2;case 2:return[3,5];case 3:return this.nf(e.targetId),[4,this.N_.Wu(e.targetId,!0)];case 4:t.sent(),t.label=5;case 5:return[2]}})})},sS.prototype.write=function(i,o){return Is(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:this.ef("write()"),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.N_.$u(i)];case 2:return e=t.sent(),this.Ud.jl(e.batchId),this.rf(e.batchId,o),[4,this.hf(e.Dn)];case 3:return t.sent(),[4,this.$d.el()];case 4:return t.sent(),[3,6];case 5:return n=t.sent(),r=UE(n,"Failed to persist write"),o.reject(r),[3,6];case 6:return[2]}})})},sS.prototype.runTransaction=function(t,e,n){new zI(t,this.$d,e,n).Ld()},sS.prototype.Mu=function(n){return Is(this,void 0,void 0,function(){var e,r=this;return Ss(this,function(t){switch(t.label){case 0:this.ef("applyRemoteEvent()"),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.N_.Mu(n)];case 2:return e=t.sent(),n.as.forEach(function(t,e){var n=r.Hd.get(e);n&&(k_(t.Ts.size+t.Es.size+t.Is.size<=1),0<t.Ts.size?n.qd=!0:0<t.Es.size?k_(n.qd):0<t.Is.size&&(k_(n.qd),n.qd=!1))}),[4,this.hf(e,n)];case 3:return t.sent(),[3,6];case 4:return[4,tT(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},sS.prototype.Dd=function(r,t){this.ef("applyOnlineStateChange()");var i=[];this.jd.forEach(function(t,e){var n=e.view.Dd(r);n.snapshot&&i.push(n.snapshot)}),this.Wd.af(r),this.Wd.i_(i),this.onlineState=r},sS.prototype._l=function(a,u){return Is(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.ef("rejectListens()"),this.Ud.td(a,"rejected",u),e=this.Hd.get(a),(n=e&&e.key)?(r=(r=new Ab(Ng.N)).Ae(n,new Zm(n,lg.min())),i=Kb().add(n),o=new n_(lg.min(),new Map,new Lb(D_),r,i),[4,this.Mu(o)]):[3,2];case 1:return t.sent(),this.zd=this.zd.remove(n),this.Hd.delete(a),this.uf(),[3,4];case 2:return[4,this.N_.Wu(a,!1).then(function(){return s.nf(a,u)}).catch(tT)];case 3:t.sent(),t.label=4;case 4:return[2]}})})},sS.prototype.Il=function(r){return Is(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:this.ef("applySuccessfulWrite()"),e=r.batch.batchId,this.cf(e,null),this._f(e),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.N_.zo(r)];case 2:return n=t.sent(),this.Ud.Gl(e,"acknowledged"),[4,this.hf(n)];case 3:return t.sent(),[3,6];case 4:return[4,tT(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},sS.prototype.Al=function(n,r){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:this.ef("rejectFailedWrite()"),this.cf(n,r),this._f(n),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.N_.Lu(n)];case 2:return e=t.sent(),this.Ud.Gl(n,"rejected",r),[4,this.hf(e)];case 3:return t.sent(),[3,6];case 4:return[4,tT(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},sS.prototype.lf=function(o){return Is(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:this.$d.q_()||S_("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.N_.sa()];case 2:return-1===(e=t.sent())?[2,void o.resolve()]:((n=this.Xd.get(e)||[]).push(o),this.Xd.set(e,n),[3,4]);case 3:return r=t.sent(),i=UE(r,"Initialization of waitForPendingWrites() operation failed"),o.reject(i),[3,4];case 4:return[2]}})})},sS.prototype._f=function(t){(this.Xd.get(t)||[]).forEach(function(t){t.resolve()}),this.Xd.delete(t)},sS.prototype.df=function(e){this.Xd.forEach(function(t){t.forEach(function(t){t.reject(new og(ig.CANCELLED,e))})}),this.Xd.clear()},sS.prototype.rf=function(t,e){var n=this.Jd[this.currentUser.s()];n=(n=n||new Ab(D_)).Ae(t,e),this.Jd[this.currentUser.s()]=n},sS.prototype.cf=function(t,e){var n=this.Jd[this.currentUser.s()];if(n){var r=n.get(t);r&&(e?r.reject(e):r.resolve(),n=n.remove(t)),this.Jd[this.currentUser.s()]=n}},sS.prototype.nf=function(t,e){var n=this;void 0===e&&(e=null),this.Ud.Jl(t);for(var r=0,i=this.Kd.get(t);r<i.length;r++){var o=i[r];this.jd.delete(o),e&&this.Wd.ff(o,e)}this.Kd.delete(t),this.tf&&this.Yd.nc(t).forEach(function(t){n.Yd.Ch(t)||n.Tf(t)})},sS.prototype.Tf=function(t){var e=this.zd.get(t);null!==e&&(this.$d.rl(e),this.zd=this.zd.remove(t),this.Hd.delete(e),this.uf())},sS.prototype.if=function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n];i instanceof RI?(this.Yd.yh(i.key,t),this.Ef(i)):i instanceof PI?(S_("SyncEngine","Document no longer in limbo: "+i.key),this.Yd.vh(i.key,t),this.Yd.Ch(i.key)||this.Tf(i.key)):A_()}},sS.prototype.Ef=function(t){var e=t.key;this.zd.get(e)||(S_("SyncEngine","New document in limbo: "+e),this.Gd.push(e),this.uf())},sS.prototype.uf=function(){for(;0<this.Gd.length&&this.zd.size<this.Qd;){var t=this.Gd.shift(),e=this.Zd.next();this.Hd.set(e,new xI(t)),this.zd=this.zd.Ae(t,e),this.$d.listen(new lb(nb.Wt(t.path).ee(),e,2,K_.dr))}},sS.prototype.If=function(){return this.zd},sS.prototype.wf=function(){return this.Gd},sS.prototype.hf=function(r,u){return Is(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.jd.forEach(function(t,i){e.push(Promise.resolve().then(function(){var n=i.view.Vd(r);return n.yd?a.N_.ju(i.query,!1).then(function(t){var e=t.documents;return i.view.Vd(e,n)}):n}).then(function(t){var e=u&&u.as.get(i.targetId),n=i.view.xn(t,a.tf,e);if(a.if(i.targetId,n.Sd),n.snapshot){a.tf&&a.Ud.td(i.targetId,n.snapshot.fromCache?"not-current":"current"),o.push(n.snapshot);var r=z_.ar(i.targetId,n.snapshot);s.push(r)}}))}),[4,Promise.all(e)];case 1:return t.sent(),this.Wd.i_(o),[4,this.N_.Bu(s)];case 2:return t.sent(),[2]}})})},sS.prototype.ef=function(t){},sS.prototype.Pl=function(n){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.currentUser.isEqual(n)?[3,3]:[4,this.N_.Du(n)];case 1:return e=t.sent(),this.currentUser=n,this.df("'waitForPendingWrites' promise is rejected due to a user change."),this.Ud.Du(n,e.Fu,e.Nu),[4,this.hf(e.Cu)];case 2:t.sent(),t.label=3;case 3:return[4,this.$d.Pl()];case 4:return t.sent(),[2]}})})},sS.prototype.enableNetwork=function(){return this.$d.enableNetwork()},sS.prototype.disableNetwork=function(){return this.$d.disableNetwork()},sS.prototype.ei=function(t){var e=this.Hd.get(t);if(e&&e.qd)return Kb().add(e.key);var n=Kb(),r=this.Kd.get(t);if(!r)return n;for(var i=0,o=r;i<o.length;i++){var s=o[i],a=this.jd.get(s);n=n.He(a.view.Pd)}return n},sS),QI=(Es(oS,MI=KI),Object.defineProperty(oS.prototype,"tf",{get:function(){return!0===this.Rf},enumerable:!0,configurable:!0}),oS.prototype.enableNetwork=function(){return this.N_.ao(!0),MI.prototype.enableNetwork.call(this)},oS.prototype.disableNetwork=function(){return this.N_.ao(!1),MI.prototype.disableNetwork.call(this)},oS.prototype.Af=function(r){return Is(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,this.N_.ju(r.query,!0)];case 1:return e=t.sent(),n=r.view.Fd(e),[2,(this.Rf&&this.if(r.targetId,n.Sd),n)]}})})},oS.prototype.Dd=function(t,e){this.tf&&0===e&&(MI.prototype.Dd.call(this,t,e),this.Ud.sd(t)),this.tf||1!==e||MI.prototype.Dd.call(this,t,e)},oS.prototype.dd=function(n,r,i){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.ef("applyBatchState()"),[4,this.N_.zu(n)];case 1:return null===(e=t.sent())?[3,6]:"pending"!==r?[3,3]:[4,this.$d.el()];case 2:return t.sent(),[3,4];case 3:"acknowledged"===r||"rejected"===r?(this.cf(n,i||null),this.N_.Hu(n)):A_(),t.label=4;case 4:return[4,this.hf(e)];case 5:return t.sent(),[3,7];case 6:S_("SyncEngine","Cannot apply mutation batch with id: "+n),t.label=7;case 7:return[2]}})})},oS.prototype.Vl=function(c){return Is(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u=this;return Ss(this,function(t){switch(t.label){case 0:return!0!==c||!0===this.Rf?[3,3]:(e=this.Ud.Ul(),[4,this.mf(e.W(),!0)]);case 1:return n=t.sent(),this.Rf=!0,[4,this.$d.Vl(!0)];case 2:for(t.sent(),r=0,i=n;r<i.length;r++)o=i[r],this.$d.listen(o);return[3,7];case 3:return!1!==c||!1===this.Rf?[3,7]:(s=[],a=Promise.resolve(),this.Kd.forEach(function(t,e){u.Ud.Xl(e)?s.push(e):a=a.then(function(){return u.nf(e),u.N_.Wu(e,!0)}),u.$d.rl(e)}),[4,a]);case 4:return t.sent(),[4,this.mf(s,!1)];case 5:return t.sent(),this.Pf(),this.Rf=!1,[4,this.$d.Vl(!1)];case 6:t.sent(),t.label=7;case 7:return[2]}})})},oS.prototype.Pf=function(){var n=this;this.Hd.forEach(function(t,e){n.$d.rl(e)}),this.Yd.rc(),this.Hd=new Map,this.zd=new Ab(Ng.N)},oS.prototype.mf=function(d,t){return Is(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.Kd.get(o))&&0!==a.length?[4,this.N_.Wu(o,!0)]:[3,8]):[3,14];case 2:return t.sent(),[4,this.N_.Qu(a[0].ee())];case 3:s=t.sent(),u=0,c=a,t.label=4;case 4:return u<c.length?(h=c[u],l=this.jd.get(h),[4,this.Af(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[4,this.N_.Yu(o)];case 9:return p=t.sent(),[4,this.N_.Qu(p)];case 10:return s=t.sent(),[4,this.sf(this.Vf(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[2,(this.Wd.i_(n),e)]}})})},oS.prototype.Vf=function(t){return new nb(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)},oS.prototype.bo=function(){return this.N_.bo()},oS.prototype.fd=function(r,i,o){return Is(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return this.Rf?(S_("SyncEngine","Ignoring unexpected query state notification."),[3,8]):[3,1];case 1:if(!this.Kd.has(r))return[3,8];switch(i){case"current":case"not-current":return[3,2];case"rejected":return[3,5]}return[3,7];case 2:return[4,this.N_.Kr()];case 3:return e=t.sent(),n=n_.ls(r,"current"===i),[4,this.hf(e,n)];case 4:return t.sent(),[3,8];case 5:return[4,this.N_.Wu(r,!0)];case 6:return t.sent(),this.nf(r,o),[3,8];case 7:A_(),t.label=8;case 8:return[2]}})})},oS.prototype.Td=function(f,p){return Is(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l=this;return Ss(this,function(t){switch(t.label){case 0:if(!this.Rf)return[3,10];e=0,n=f,t.label=1;case 1:return e<n.length?(r=n[e],this.Kd.has(r)?(S_("SyncEngine","Adding an already active target "+r),[3,5]):[4,this.N_.Yu(r)]):[3,6];case 2:return i=t.sent(),[4,this.N_.Qu(i)];case 3:return o=t.sent(),[4,this.sf(this.Vf(i),o.targetId,!1)];case 4:t.sent(),this.$d.listen(o),t.label=5;case 5:return e++,[3,1];case 6:s=function(e){return Ss(this,function(t){switch(t.label){case 0:return a.Kd.has(e)?[4,a.N_.Wu(e,!1).then(function(){l.$d.rl(e),l.nf(e)}).catch(tT)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})},a=this,u=0,c=p,t.label=7;case 7:return u<c.length?(h=c[u],[5,s(h)]):[3,10];case 8:t.sent(),t.label=9;case 9:return u++,[3,7];case 10:return[2]}})})},oS),YI=(iS.prototype.listen=function(a){return Is(this,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:if(e=a.query,n=!1,(r=this.yf.get(e))||(n=!0,r=new LI),!n)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),i=r,[4,this.ol.listen(e)];case 2:return i.gf=t.sent(),[3,4];case 3:return o=t.sent(),s=UE(o,"Initialization of query '"+a.query+"' failed"),[2,void a.onError(s)];case 4:return this.yf.set(e,r),r.pf.push(a),a.Dd(this.onlineState),r.gf&&a.vf(r.gf)&&this.Sf(),[2]}})})},iS.prototype.rl=function(o){return Is(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){return e=o.query,n=!1,(r=this.yf.get(e))&&0<=(i=r.pf.indexOf(o))&&(r.pf.splice(i,1),n=0===r.pf.length),n?[2,(this.yf.delete(e),this.ol.rl(e))]:[2]})})},iS.prototype.i_=function(t){for(var e=!1,n=0,r=t;n<r.length;n++){var i=r[n],o=i.query,s=this.yf.get(o);if(s){for(var a=0,u=s.pf;a<u.length;a++)u[a].vf(i)&&(e=!0);s.gf=i}}e&&this.Sf()},iS.prototype.ff=function(t,e){var n=this.yf.get(t);if(n)for(var r=0,i=n.pf;r<i.length;r++)i[r].onError(e);this.yf.delete(t)},iS.prototype.af=function(i){this.onlineState=i;var o=!1;this.yf.forEach(function(t,e){for(var n=0,r=e.pf;n<r.length;n++)r[n].Dd(i)&&(o=!0)}),o&&this.Sf()},iS.prototype.Df=function(t){this.bf.add(t),t.next()},iS.prototype.Cf=function(t){this.bf.delete(t)},iS.prototype.Sf=function(){this.bf.forEach(function(t){t.next()})},iS),XI=(rS.prototype.vf=function(t){if(!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 e_(t.query,t.docs,t.ss,e,t.ns,t.fromCache,t.rs,!0)}var o=!1;return this.Nf?this.kf(t)&&(this.Ff.next(t),o=!0):this.Lf(t,this.onlineState)&&(this.Mf(t),o=!0),this.$f=t,o},rS.prototype.onError=function(t){this.Ff.error(t)},rS.prototype.Dd=function(t){this.onlineState=t;var e=!1;return this.$f&&!this.Nf&&this.Lf(this.$f,t)&&(this.Mf(this.$f),e=!0),e},rS.prototype.Lf=function(t,e){if(!t.fromCache)return!0;var n="Offline"!==e;return!(this.options.Of&&n||t.docs.B()&&"Offline"!==e)},rS.prototype.kf=function(t){if(0<t.docChanges.length)return!0;var e=this.$f&&this.$f.hasPendingWrites!==t.hasPendingWrites;return!(!t.rs&&!e)&&!0===this.options.includeMetadataChanges},rS.prototype.Mf=function(t){t=e_.os(t.query,t.docs,t.ns,t.fromCache),this.Nf=!0,this.Ff.next(t)},rS),$I=(nS.prototype.Su=function(t){this.xf=t},nS.prototype.Zn=function(e,r,i,o){var s=this;return r.te()||i.isEqual(lg.min())?this.Bf(e,r):this.xf.Yn(e,o).next(function(t){var n=s.qf(r,t);return(r.oe()||r.ae())&&s.yd(r.Bt,n,o,i)?s.Bf(e,r):(T_()<=Ta.DEBUG&&S_("IndexFreeQueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),r.toString()),s.xf.Zn(e,r,i).next(function(e){return n.forEach(function(t){e=e.Ae(t.key,t)}),e}))})},nS.prototype.qf=function(n,t){var r=new Lb(function(t,e){return n.se(t,e)});return t.forEach(function(t,e){e instanceof Jm&&n.matches(e)&&(r=r.add(e))}),r},nS.prototype.yd=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.S(r))},nS.prototype.Bf=function(t,e){return T_()<=Ta.DEBUG&&S_("IndexFreeQueryEngine","Using full collection scan to execute query:",e.toString()),this.xf.Zn(t,e,lg.min())},nS),JI=(eS.prototype.Go=function(t){return q_.resolve(0===this.Wn.length)},eS.prototype.zo=function(t,e,n){var r=e.batchId,i=this.Wf(r,"acknowledged");return k_(0===i),this.Wn[i],this.lastStreamToken=n,q_.resolve()},eS.prototype.Yo=function(t){return q_.resolve(this.lastStreamToken)},eS.prototype.Jo=function(t,e){return this.lastStreamToken=e,q_.resolve()},eS.prototype.Xo=function(t,e,n,r){var i=this.Uf;this.Uf++,0<this.Wn.length&&this.Wn[this.Wn.length-1];var o=new j_(i,e,n,r);this.Wn.push(o);for(var s=0,a=r;s<a.length;s++){var u=a[s];this.Qf=this.Qf.add(new nT(u.key,i)),this.jn.Dr(t,u.key.path.L())}return q_.resolve(o)},eS.prototype.Zo=function(t,e){return q_.resolve(this.jf(e))},eS.prototype.ea=function(t,e){var n=e+1,r=this.Kf(n),i=r<0?0:r;return q_.resolve(this.Wn.length>i?this.Wn[i]:null)},eS.prototype.sa=function(){return q_.resolve(0===this.Wn.length?-1:this.Uf-1)},eS.prototype.ia=function(t){return q_.resolve(this.Wn.slice())},eS.prototype.Gn=function(t,e){var n=this,r=new nT(e,0),i=new nT(e,Number.POSITIVE_INFINITY),o=[];return this.Qf.Ke([r,i],function(t){var e=n.jf(t.oc);o.push(e)}),q_.resolve(o)},eS.prototype.Xn=function(t,e){var r=this,i=new Lb(D_);return e.forEach(function(t){var e=new nT(t,0),n=new nT(t,Number.POSITIVE_INFINITY);r.Qf.Ke([e,n],function(t){i=i.add(t.oc)})}),q_.resolve(this.Gf(i))},eS.prototype.nr=function(t,e){var n=e.path,r=n.length+1,i=n;Ng.et(i)||(i=i.child(""));var o=new nT(new Ng(i),0),s=new Lb(D_);return this.Qf.Ge(function(t){var e=t.key.path;return!!n.q(e)&&(e.length===r&&(s=s.add(t.oc)),!0)},o),q_.resolve(this.Gf(s))},eS.prototype.Gf=function(t){var n=this,r=[];return t.forEach(function(t){var e=n.jf(t);null!==e&&r.push(e)}),r},eS.prototype.ra=function(n,r){var i=this;k_(0===this.Wf(r.batchId,"removed")),this.Wn.shift();var o=this.Qf;return q_.forEach(r.mutations,function(t){var e=new nT(t.key,r.batchId);return o=o.delete(e),i.hh.Bo(n,t.key)}).next(function(){i.Qf=o})},eS.prototype.ha=function(t){},eS.prototype.Ch=function(t,e){var n=new nT(e,0),r=this.Qf.ze(n);return q_.resolve(e.isEqual(r&&r.key))},eS.prototype.oa=function(t){return this.Wn.length,q_.resolve()},eS.prototype.Wf=function(t,e){return this.Kf(t)},eS.prototype.Kf=function(t){return 0===this.Wn.length?0:t-this.Wn[0].batchId},eS.prototype.jf=function(t){var e=this.Kf(t);return e<0||e>=this.Wn.length?null:this.Wn[e]},eS),ZI=(tS.prototype.Nn=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,s=this.zf(e);return this.docs=this.docs.Ae(r,{Mr:e,size:s,readTime:n}),this.size+=s-o,this.jn.Dr(t,r.path.L())},tS.prototype.kn=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},tS.prototype.Ln=function(t,e){var n=this.docs.get(e);return q_.resolve(n?n.Mr:null)},tS.prototype.getEntries=function(t,e){var n=this,r=qb();return e.forEach(function(t){var e=n.docs.get(t);r=r.Ae(t,e?e.Mr:null)}),q_.resolve(r)},tS.prototype.Zn=function(t,e,n){for(var r=Wb(),i=new Ng(e.path.child("")),o=this.docs.ve(i);o.$e();){var s=o.Ne(),a=s.key,u=s.value,c=u.Mr,h=u.readTime;if(!e.path.q(a.path))break;h.S(n)<=0||c instanceof Jm&&e.matches(c)&&(r=r.Ae(c.key,c))}return q_.resolve(r)},tS.prototype.Hf=function(t,e){return q_.forEach(this.docs,function(t){return e(t)})},tS.prototype.Yr=function(t){return new tS.Jr(this)},tS.prototype.Zr=function(t){return q_.resolve(this.size)},tS);function tS(t,e){this.jn=t,this.zf=e,this.docs=new Ab(Ng.N),this.size=0}function eS(t,e){this.jn=t,this.hh=e,this.Wn=[],this.Uf=1,this.lastStreamToken=Pg.ht,this.Qf=new Lb(nT.Xu)}function nS(){}function rS(t,e,n){this.query=t,this.Ff=e,this.Nf=!1,this.$f=null,this.onlineState="Unknown",this.options=n||{}}function iS(t){this.ol=t,this.yf=new U_(function(t){return t.canonicalId()}),this.onlineState="Unknown",this.bf=new Set,this.ol.subscribe(this)}function oS(t,e,n,r,i){var o=this;return(o=MI.call(this,t,e,n,r,i)||this).N_=t,o.Rf=void 0,o}function sS(t,e,n,r,i){this.N_=t,this.$d=e,this.Ud=n,this.currentUser=r,this.Qd=i,this.Wd=null,this.jd=new U_(function(t){return t.canonicalId()}),this.Kd=new Map,this.Gd=[],this.zd=new Ab(Ng.N),this.Hd=new Map,this.Yd=new eT,this.Jd={},this.Xd=new Map,this.Zd=Cw.rh(),this.onlineState="Unknown"}function aS(t,e,n,r){this.Aa=t,this.$d=e,this.updateFunction=n,this.Va=r,this.kd=5,this.$a=new ow(this.Aa,"transaction_retry")}function uS(t,e){this.query=t,this.wd=e,this.Rd=null,this.fs=!1,this.Ad=Kb(),this.ns=Kb(),this.md=new Zb(t.se.bind(t))}function cS(){this.Ed=new BI,this.Id={},this.ol=null,this.g_=null,this.ur=null}function hS(t,e,n,r,i){if(this.Tr=t,this.platform=e,this.persistenceKey=n,this.vl=r,this.ol=null,this.g_=null,this.ur=null,this.Sl=this.Dl.bind(this),this.Cl=new Ab(D_),this.ro=!1,this.Fl=[],!hS.Gh(this.platform))throw new og(ig.UNIMPLEMENTED,"LocalStorage is not available on this platform.");var o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.platform.window.localStorage,this.currentUser=i,this.Nl=AI(this.persistenceKey,this.vl),this.$l="firestore_sequence_number_"+this.persistenceKey,this.Cl=this.Cl.Ae(this.vl,new BI),this.kl=new RegExp("^firestore_clients_"+o+"_([^_]*)$"),this.Ll=new RegExp("^firestore_mutations_"+o+"_(\\d+)(?:_(.*))?$"),this.Ml=new RegExp("^firestore_targets_"+o+"_(\\d+)$"),this.Ol="firestore_online_state_"+this.persistenceKey,this.platform.window.addEventListener("storage",this.Sl)}function lS(){this.activeTargetIds=Yb()}function fS(t,e){this.clientId=t,this.onlineState=e}function pS(t,e){this.clientId=t,this.activeTargetIds=e}function dS(t,e,n){this.targetId=t,this.state=e,this.error=n}function vS(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}function yS(t){var e=this;return(e=FI.call(this)||this).th=t,e}ZI.Jr=(Es(yS,FI=B_),yS.prototype.xn=function(n){var r=this,i=[];return this.Dn.forEach(function(t,e){e?i.push(r.th.Nn(n,e,r.readTime)):r.th.kn(t)}),q_.vn(i)},yS.prototype.Mn=function(t,e){return this.th.Ln(t,e)},yS.prototype.On=function(t,e){return this.th.getEntries(t,e)},yS);var gS,mS,bS=(xS.prototype.js=function(t,n){return this.Yf.forEach(function(t,e){return n(e)}),q_.resolve()},xS.prototype._h=function(t){return q_.resolve(this.lastRemoteSnapshotVersion)},xS.prototype.lh=function(t){return q_.resolve(this.Jf)},xS.prototype.oh=function(t){return this.highestTargetId=this.Zf.next(),q_.resolve(this.highestTargetId)},xS.prototype.dh=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.Jf&&(this.Jf=e),q_.resolve()},xS.prototype.Th=function(t){this.Yf.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.Zf=new Cw(e),this.highestTargetId=e),t.sequenceNumber>this.Jf&&(this.Jf=t.sequenceNumber)},xS.prototype.fh=function(t,e){return this.Th(e),this.targetCount+=1,q_.resolve()},xS.prototype.Ih=function(t,e){return this.Th(e),q_.resolve()},xS.prototype.wh=function(t,e){return this.Yf.delete(e.target),this.Xf.nc(e.targetId),--this.targetCount,q_.resolve()},xS.prototype.Ah=function(n,r,i){var o=this,s=0,a=[];return this.Yf.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.Yf.delete(t),a.push(o.Rh(n,e.targetId)),s++)}),q_.vn(a).next(function(){return s})},xS.prototype.Vh=function(t){return q_.resolve(this.targetCount)},xS.prototype.gh=function(t,e){var n=this.Yf.get(e)||null;return q_.resolve(n)},xS.prototype.ph=function(t,e,n){return this.Xf.ec(e,n),q_.resolve()},xS.prototype.bh=function(e,t,n){this.Xf.ic(t,n);var r=this.persistence.hh,i=[];return r&&t.forEach(function(t){i.push(r.Bo(e,t))}),q_.vn(i)},xS.prototype.Rh=function(t,e){return this.Xf.nc(e),q_.resolve()},xS.prototype.Sh=function(t,e){var n=this.Xf.hc(e);return q_.resolve(n)},xS.prototype.Ch=function(t,e){return q_.resolve(this.Xf.Ch(e))},xS),_S=(DS.prototype.start=function(){return Promise.resolve()},DS.prototype.mo=function(){return this.qh=!1,Promise.resolve()},Object.defineProperty(DS.prototype,"ro",{get:function(){return this.qh},enumerable:!0,configurable:!0}),DS.prototype.ho=function(){},DS.prototype.Fo=function(){return this.jn},DS.prototype.vo=function(t){var e=this.tT[t.s()];return e||(e=new JI(this.jn,this.hh),this.tT[t.s()]=e),e},DS.prototype.Do=function(){return this.Yh},DS.prototype.Co=function(){return this.Qn},DS.prototype.runTransaction=function(t,e,n){var r=this;S_("MemoryPersistence","Starting transaction:",t);var i=new wS(this.Bh.next());return this.hh.sT(),n(i).next(function(t){return r.hh.iT(i).next(function(){return t})}).yn().then(function(t){return i.Un(),t})},DS.prototype.nT=function(e,n){return q_.Sn(Object.values(this.tT).map(function(t){return function(){return t.Ch(e,n)}}))},DS),wS=(Es(PS,mS=H_),PS),ES=(RS.oT=function(t){return new RS(t)},Object.defineProperty(RS.prototype,"aT",{get:function(){if(this.hT)return this.hT;throw A_()},enumerable:!0,configurable:!0}),RS.prototype.yh=function(t,e,n){return this.rT.yh(n,e),this.aT.delete(n),q_.resolve()},RS.prototype.vh=function(t,e,n){return this.rT.vh(n,e),this.aT.add(n),q_.resolve()},RS.prototype.Bo=function(t,e){return this.aT.add(e),q_.resolve()},RS.prototype.removeTarget=function(t,e){var n=this;this.rT.nc(e.targetId).forEach(function(t){return n.aT.add(t)});var r=this.persistence.Do();return r.Sh(t,e.targetId).next(function(t){t.forEach(function(t){return n.aT.add(t)})}).next(function(){return r.wh(t,e)})},RS.prototype.sT=function(){this.hT=new Set},RS.prototype.iT=function(t){var n=this,r=this.persistence.Co().Yr();return q_.forEach(this.aT,function(e){return n.uT(t,e).next(function(t){t||r.kn(e)})}).next(function(){return n.hT=null,r.apply(t)})},RS.prototype.Wo=function(t,e){var n=this;return this.uT(t,e).next(function(t){t?n.aT.delete(e):n.aT.add(e)})},RS.prototype.eT=function(t){return 0},RS.prototype.uT=function(t,e){var n=this;return q_.Sn([function(){return q_.resolve(n.rT.Ch(e))},function(){return n.persistence.Do().Ch(t,e)},function(){return n.persistence.nT(t,e)}])},RS),TS=(OS.prototype.initialize=function(n){return Is(this,void 0,void 0,function(){var e=this;return Ss(this,function(t){switch(t.label){case 0:return this.Ud=this.cT(n),this.persistence=this._T(n),[4,this.persistence.start()];case 1:return t.sent(),this.lT=this.dT(n),this.N_=this.fT(n),this.$d=this.TT(n),this.ol=this.ET(n),this.IT=this.wT(n),this.Ud.g_=function(t){return e.ol.Dd(t,1)},this.$d.ol=this.ol,[4,this.N_.start()];case 2:return t.sent(),[4,this.Ud.start()];case 3:return t.sent(),[4,this.$d.start()];case 4:return t.sent(),[4,this.$d.Vl(this.ol.tf)];case 5:return t.sent(),[2]}})})},OS.prototype.wT=function(t){return new YI(this.ol)},OS.prototype.dT=function(t){return null},OS.prototype.fT=function(t){return new KE(this.persistence,new $I,t.RT)},OS.prototype._T=function(t){return new _S(ES.oT)},OS.prototype.TT=function(t){var e=this;return new _I(this.N_,t.T_,t.Aa,function(t){return e.ol.Dd(t,0)},t.platform.AT())},OS.prototype.cT=function(t){return new HI},OS.prototype.ET=function(t){return new KI(this.N_,this.$d,this.Ud,t.RT,t.Qd)},OS.prototype.clearPersistence=function(t){throw new og(ig.FAILED_PRECONDITION,"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.")},OS),IS=(Es(kS,gS=TS),kS.prototype.initialize=function(e){return Is(this,void 0,void 0,function(){var n=this;return Ss(this,function(t){switch(t.label){case 0:return[4,gS.prototype.initialize.call(this,e)];case 1:return t.sent(),[4,this.persistence.no(function(e){return Is(n,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,this.ol.Vl(e)];case 1:return t.sent(),this.lT&&(e&&!this.lT.ro?this.lT.start(this.N_):e||this.lT.stop()),[2]}})})})];case 2:return t.sent(),[2]}})})},kS.prototype.fT=function(t){return new JE(this.persistence,new $I,t.RT)},kS.prototype.ET=function(t){var e=new QI(this.N_,this.$d,this.Ud,t.RT,t.Qd);return this.Ud instanceof WI&&(this.Ud.ol=e),e},kS.prototype.dT=function(t){var e=this.persistence.hh.ko;return new GE(e,t.Aa)},kS.prototype._T=function(t){var e=Fw.$o(t.mT),n=t.platform.bc(t.mT.ii);return new Fw(t.PT.synchronizeTabs,e,t.clientId,t.platform,BE.hu(t.PT.cacheSizeBytes),t.Aa,n,this.Ud)},kS.prototype.cT=function(t){if(t.PT.VT&&t.PT.synchronizeTabs){if(!WI.Gh(t.platform))throw new og(ig.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var e=Fw.$o(t.mT);return new WI(t.Aa,t.platform,e,t.clientId,t.RT)}return new HI},kS.prototype.clearPersistence=function(t){var e=Fw.$o(t);return Fw.clearPersistence(e)},kS),SS=(AS.prototype.start=function(e,n){var r=this;this.gT();var i=new iw,o=new iw,s=!1;return this.credentials.l(function(t){if(!s)return s=!0,S_("FirestoreClient","Initializing. user=",t.uid),r.pT(e,n,t,o).then(i.resolve,i.reject);r.Aa.Ua(function(){return r.Pl(t)})}),this.Aa.uo(function(){return i.promise}),o.promise},AS.prototype.enableNetwork=function(){var t=this;return this.gT(),this.Aa.enqueue(function(){return t.ol.enableNetwork()})},AS.prototype.pT=function(u,c,h,l){return Is(this,void 0,void 0,function(){var r,i,o,s,a=this;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,this.platform.yT(this.mT)];case 1:return r=t.sent(),i=this.platform.bc(this.mT.ii),e=r,n=this.credentials,o=new gI(e,n,i),[4,u.initialize({Aa:this.Aa,mT:this.mT,platform:this.platform,T_:o,clientId:this.clientId,RT:h,Qd:100,PT:c})];case 2:return t.sent(),this.persistence=u.persistence,this.Ud=u.Ud,this.N_=u.N_,this.$d=u.$d,this.ol=u.ol,this.lT=u.lT,this.bT=u.IT,this.persistence.ho(function(){return Is(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]}})})}),l.resolve(),[3,4];case 3:if(s=t.sent(),l.reject(s),!this.vT(s))throw s;return[2,(console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+s),this.pT(new TS,{VT:!1},h,l))];case 4:return[2]}var e,n})})},AS.prototype.vT=function(t){return"FirebaseError"===t.name?t.code===ig.FAILED_PRECONDITION||t.code===ig.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code},AS.prototype.gT=function(){if(this.Aa.La)throw new og(ig.FAILED_PRECONDITION,"The client has already been terminated.")},AS.prototype.Pl=function(t){return this.Aa.Wa(),S_("FirestoreClient","Credential Changed. Current user: "+t.uid),this.ol.Pl(t)},AS.prototype.disableNetwork=function(){var t=this;return this.gT(),this.Aa.enqueue(function(){return t.ol.disableNetwork()})},AS.prototype.terminate=function(){var t=this;return this.Aa.qa(function(){return Is(t,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.lT&&this.lT.stop(),[4,this.$d.mo()];case 1:return t.sent(),[4,this.Ud.mo()];case 2:return t.sent(),[4,this.persistence.mo()];case 3:return t.sent(),this.credentials.T(),[2]}})})})},AS.prototype.waitForPendingWrites=function(){var t=this;this.gT();var e=new iw;return this.Aa.uo(function(){return t.ol.lf(e)}),e.promise},AS.prototype.listen=function(t,e,n){var r=this;this.gT();var i=new XI(t,e,n);return this.Aa.uo(function(){return r.bT.listen(i)}),i},AS.prototype.rl=function(t){var e=this;this.ST||this.Aa.uo(function(){return e.bT.rl(t)})},AS.prototype.DT=function(o){return Is(this,void 0,void 0,function(){var i,e=this;return Ss(this,function(t){switch(t.label){case 0:return this.gT(),i=new iw,[4,this.Aa.enqueue(function(){return Is(e,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.N_.Uu(o)];case 1:return(e=t.sent())instanceof Jm?i.resolve(e):e instanceof Zm?i.resolve(null):i.reject(new og(ig.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.)")),[3,3];case 2:return n=t.sent(),r=UE(n,"Failed to get document '"+o+" from cache"),i.reject(r),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),i.promise)]}})})},AS.prototype.CT=function(u){return Is(this,void 0,void 0,function(){var a,e=this;return Ss(this,function(t){switch(t.label){case 0:return this.gT(),a=new iw,[4,this.Aa.enqueue(function(){return Is(e,void 0,void 0,function(){var e,n,r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.N_.ju(u,!0)];case 1:return e=t.sent(),n=new GI(u,e.Ku),r=n.Vd(e.documents),i=n.xn(r,!1),a.resolve(i.snapshot),[3,3];case 2:return o=t.sent(),s=UE(o,"Failed to execute query '"+u+" against cache"),a.reject(s),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),a.promise)]}})})},AS.prototype.write=function(t){var e=this;this.gT();var n=new iw;return this.Aa.uo(function(){return e.ol.write(t,n)}),n.promise},AS.prototype.ii=function(){return this.mT.ii},AS.prototype.Df=function(t){var e=this;this.gT(),this.Aa.uo(function(){return e.bT.Df(t),Promise.resolve()})},AS.prototype.Cf=function(t){var e=this;this.ST||this.Aa.uo(function(){return e.bT.Cf(t),Promise.resolve()})},Object.defineProperty(AS.prototype,"ST",{get:function(){return this.Aa.La},enumerable:!0,configurable:!0}),AS.prototype.transaction=function(t){var e=this;this.gT();var n=new iw;return this.Aa.uo(function(){return e.ol.runTransaction(e.Aa,t,n),Promise.resolve()}),n.promise},AS),CS=(NS.prototype.next=function(t){this.FT(this.observer.next,t)},NS.prototype.error=function(t){this.FT(this.observer.error,t)},NS.prototype.NT=function(){this.muted=!0},NS.prototype.FT=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},NS);function NS(t){this.observer=t,this.muted=!1}function AS(t,e,n,r){this.platform=t,this.mT=e,this.credentials=n,this.Aa=r,this.clientId=R_.cn()}function kS(){return null!==gS&&gS.apply(this,arguments)||this}function OS(){}function RS(t){this.persistence=t,this.rT=new eT,this.hT=null}function PS(t){var e=this;return(e=mS.call(this)||this).Oh=t,e}function DS(t){var e=this;this.tT={},this.Bh=new K_(0),this.qh=!1,this.qh=!0,this.hh=t(this),this.Yh=new bS(this),this.jn=new lw,this.Qn=new ZI(this.jn,function(t){return e.hh.eT(t)})}function xS(t){this.persistence=t,this.Yf=new U_(function(t){return t.canonicalId()}),this.lastRemoteSnapshotVersion=lg.min(),this.highestTargetId=0,this.Jf=0,this.Xf=new eT,this.targetCount=0,this.Zf=Cw.nh()}function LS(i){return function(){if("object"==typeof i&&null!==i)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 1}}()}var MS,FS,US=(uC.prototype.kT=function(t){switch(Vg(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Kg(t.integerValue||t.doubleValue);case 3:return this.LT(t.timestampValue);case 4:return this.MT(t);case 5:return t.stringValue;case 6:return new ST(Qg(t.bytesValue));case 7:return this.OT(t.referenceValue);case 8:return this.xT(t.geoPointValue);case 9:return this.BT(t.arrayValue);case 10:return this.qT(t.mapValue);default:throw A_()}},uC.prototype.qT=function(t){var n=this,r={};return Og(t.fields||{},function(t,e){r[t]=n.kT(e)}),r},uC.prototype.xT=function(t){return new qT(Kg(t.latitude),Kg(t.longitude))},uC.prototype.BT=function(t){var e=this;return(t.values||[]).map(function(t){return e.kT(t)})},uC.prototype.MT=function(t){switch(this.$T){case"previous":var e=function t(e){var n=e.mapValue.fields.__previous_value__;return Fg(n)?t(n):n}(t);return null==e?null:this.kT(e);case"estimate":return this.LT(Ug(t));default:return null}},uC.prototype.LT=function(t){var e=zg(t),n=new hg(e.seconds,e.nanos);return this.timestampsInSnapshots?n:n.toDate()},uC.prototype.OT=function(t){var e=pg.K(t);k_(b_(e));var n=new F_(e.get(1),e.get(3)),r=new Ng(e.k(5));return n.isEqual(this.firestore.$c)||C_("Document "+r+" contains a document reference within a different database ("+n.projectId+"/"+n.database+") which is not supported. It will be treated as a reference in the current database ("+this.firestore.$c.projectId+"/"+this.firestore.$c.database+") instead."),new HS(r,this.firestore,this.converter)},uC),jS=BE.uu,VS=(aC.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&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},aC),qS=(Object.defineProperty(sC.prototype,"JT",{get:function(){return this.XT||(this.XT=new eI(this.$c,this.YT.ignoreUndefinedProperties)),this.XT},enumerable:!0,configurable:!0}),sC.prototype.settings=function(t){sT("Firestore.settings",arguments,1),cT("Firestore.settings","object",1,t);var e=new VS(t);if(this.jT&&!this.YT.isEqual(e))throw new og(ig.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.YT=e).credentials&&(this.zT=function(t){if(!t)return new sg;switch(t.type){case"gapi":var e=t.ZT;return k_(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new cg(e,t.V||"0");case"provider":return t.ZT;default:throw new og(ig.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(e.credentials))},sC.prototype.enableNetwork=function(){return this.WT(),this.jT.enableNetwork()},sC.prototype.disableNetwork=function(){return this.WT(),this.jT.disableNetwork()},sC.prototype.enablePersistence=function(t){var e,n;if(this.jT)throw new og(ig.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 r=!1;return t&&(void 0!==t.experimentalTabSynchronization&&C_("The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead."),r=null!==(n=null!==(e=t.synchronizeTabs)&&void 0!==e?e:t.experimentalTabSynchronization)&&void 0!==n&&n),this.tE(this.HT,{VT:!0,cacheSizeBytes:this.YT.cacheSizeBytes,synchronizeTabs:r})},sC.prototype.clearPersistence=function(){return Is(this,void 0,void 0,function(){var r,e=this;return Ss(this,function(t){if(void 0!==this.jT&&!this.jT.ST)throw new og(ig.FAILED_PRECONDITION,"Persistence cannot be cleared after this Firestore instance is initialized.");return r=new iw,[2,(this.QT.Ma(function(){return Is(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.eE(),[4,this.HT.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]}})})}),r.promise)]})})},sC.prototype.terminate=function(){return this.app._removeServiceInstance("firestore"),this.INTERNAL.delete()},Object.defineProperty(sC.prototype,"sE",{get:function(){return this.WT(),this.jT.ST},enumerable:!0,configurable:!0}),sC.prototype.waitForPendingWrites=function(){return this.WT(),this.jT.waitForPendingWrites()},sC.prototype.onSnapshotsInSync=function(t){if(this.WT(),LS(t))return this.iE(t);cT("Firestore.onSnapshotsInSync","function",1,t);var e={next:t};return this.iE(e)},sC.prototype.iE=function(t){var e=this,n=new CS({next:function(){t.next&&t.next()},error:function(t){throw A_()}});return this.jT.Df(n),function(){n.NT(),e.jT.Cf(n)}},sC.prototype.WT=function(){return this.jT||this.tE(new TS,{VT:!1}),this.jT},sC.prototype.eE=function(){return new M_(this.$c,this.GT,this.YT.host,this.YT.ssl,this.YT.forceLongPolling)},sC.prototype.tE=function(t,e){var n=this.eE();return this.jT=new SS(__.nt(),n,this.zT,this.QT),this.jT.start(t,e)},sC.KT=function(t){if(e=t.options,!Object.prototype.hasOwnProperty.call(e,"projectId"))throw new og(ig.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');var e,n=t.options.projectId;if(!n||"string"!=typeof n)throw new og(ig.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new F_(n)},Object.defineProperty(sC.prototype,"app",{get:function(){if(!this.UT)throw new og(ig.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.UT},enumerable:!0,configurable:!0}),sC.prototype.collection=function(t){return sT("Firestore.collection",arguments,1),cT("Firestore.collection","non-empty string",1,t),this.WT(),new XS(pg.K(t),this)},sC.prototype.doc=function(t){return sT("Firestore.doc",arguments,1),cT("Firestore.doc","non-empty string",1,t),this.WT(),HS.nE(pg.K(t),this)},sC.prototype.collectionGroup=function(t){if(sT("Firestore.collectionGroup",arguments,1),cT("Firestore.collectionGroup","non-empty string",1,t),0<=t.indexOf("/"))throw new og(ig.INVALID_ARGUMENT,"Invalid collection ID '"+t+"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.");return this.WT(),new QS(new nb(pg.G,t),this)},sC.prototype.runTransaction=function(e){var n=this;return sT("Firestore.runTransaction",arguments,1),cT("Firestore.runTransaction","function",1,e),this.WT().transaction(function(t){return e(new BS(n,t))})},sC.prototype.batch=function(){return this.WT(),new WS(this)},Object.defineProperty(sC,"logLevel",{get:function(){switch(T_()){case Ta.DEBUG:return"debug";case Ta.SILENT:return"silent";default:return"error"}},enumerable:!0,configurable:!0}),sC.setLogLevel=function(t){switch(sT("Firestore.setLogLevel",arguments,1),cT("Firestore.setLogLevel","non-empty string",1,t),t){case"debug":I_(Ta.DEBUG);break;case"error":I_(Ta.ERROR);break;case"silent":I_(Ta.SILENT);break;default:throw new og(ig.INVALID_ARGUMENT,"Invalid log level: "+t)}},sC.prototype.rE=function(){return this.YT.timestampsInSnapshots},sC),BS=(oC.prototype.get=function(t){var n=this;sT("Transaction.get",arguments,1);var r=fC("Transaction.get",t,this.hE);return this.oE.A_([r.kc]).then(function(t){if(!t||1!==t.length)return A_();var e=t[0];if(e instanceof Zm)return new zS(n.hE,r.kc,null,!1,!1,r.aE);if(e instanceof Jm)return new zS(n.hE,r.kc,e,!1,!1,r.aE);throw A_()})},oC.prototype.set=function(t,e,n){uT("Transaction.set",arguments,2,3);var r=fC("Transaction.set",t,this.hE);n=cC("Transaction.set",n);var i=pC(r.aE,e,"Transaction.set"),o=i[0],s=i[1],a=n.merge||n.mergeFields?this.hE.JT.Dc(s,o,n.mergeFields):this.hE.JT.vc(s,o);return this.oE.set(r.kc,a),this},oC.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 CT?(aT("Transaction.update",arguments,3),r=fC("Transaction.update",t,this.hE),this.hE.JT.Fc("Transaction.update",e,n,o)):(sT("Transaction.update",arguments,2),r=fC("Transaction.update",t,this.hE),this.hE.JT.Cc("Transaction.update",e)),this.oE.update(r.kc,i),this},oC.prototype.delete=function(t){sT("Transaction.delete",arguments,1);var e=fC("Transaction.delete",t,this.hE);return this.oE.delete(e.kc),this},oC),WS=(iC.prototype.set=function(t,e,n){uT("WriteBatch.set",arguments,2,3),this._E();var r=fC("WriteBatch.set",t,this.hE);n=cC("WriteBatch.set",n);var i=pC(r.aE,e,"WriteBatch.set"),o=i[0],s=i[1],a=n.merge||n.mergeFields?this.hE.JT.Dc(s,o,n.mergeFields):this.hE.JT.vc(s,o);return this.uE=this.uE.concat(a.Ac(r.kc,mm.ft())),this},iC.prototype.update=function(t,e,n){for(var r,i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return this._E(),i="string"==typeof e||e instanceof CT?(aT("WriteBatch.update",arguments,3),r=fC("WriteBatch.update",t,this.hE),this.hE.JT.Fc("WriteBatch.update",e,n,o)):(sT("WriteBatch.update",arguments,2),r=fC("WriteBatch.update",t,this.hE),this.hE.JT.Cc("WriteBatch.update",e)),this.uE=this.uE.concat(i.Ac(r.kc,mm.exists(!0))),this},iC.prototype.delete=function(t){sT("WriteBatch.delete",arguments,1),this._E();var e=fC("WriteBatch.delete",t,this.hE);return this.uE=this.uE.concat(new Tm(e.kc,mm.ft())),this},iC.prototype.commit=function(){return this._E(),this.cE=!0,0<this.uE.length?this.hE.WT().write(this.uE):Promise.resolve()},iC.prototype._E=function(){if(this.cE)throw new og(ig.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},iC),HS=(rC.nE=function(t,e,n){if(t.length%2!=0)throw new og(ig.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.j()+" has "+t.length);return new rC(new Ng(t),e,n)},Object.defineProperty(rC.prototype,"id",{get:function(){return this.kc.path.O()},enumerable:!0,configurable:!0}),Object.defineProperty(rC.prototype,"parent",{get:function(){return new XS(this.kc.path.L(),this.firestore,this.aE)},enumerable:!0,configurable:!0}),Object.defineProperty(rC.prototype,"path",{get:function(){return this.kc.path.j()},enumerable:!0,configurable:!0}),rC.prototype.collection=function(t){if(sT("DocumentReference.collection",arguments,1),cT("DocumentReference.collection","non-empty string",1,t),!t)throw new og(ig.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var e=pg.K(t);return new XS(this.kc.path.child(e),this.firestore)},rC.prototype.isEqual=function(t){if(!(t instanceof rC))throw bT("isEqual","DocumentReference",1,t);return this.firestore===t.firestore&&this.kc.isEqual(t.kc)&&this.aE===t.aE},rC.prototype.set=function(t,e){uT("DocumentReference.set",arguments,1,2),e=cC("DocumentReference.set",e);var n=pC(this.aE,t,"DocumentReference.set"),r=n[0],i=n[1],o=e.merge||e.mergeFields?this.firestore.JT.Dc(i,r,e.mergeFields):this.firestore.JT.vc(i,r);return this.jT.write(o.Ac(this.kc,mm.ft()))},rC.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 CT?(aT("DocumentReference.update",arguments,2),this.firestore.JT.Fc("DocumentReference.update",t,e,r)):(sT("DocumentReference.update",arguments,1),this.firestore.JT.Cc("DocumentReference.update",t)),this.jT.write(n.Ac(this.kc,mm.exists(!0)))},rC.prototype.delete=function(){return sT("DocumentReference.delete",arguments,0),this.jT.write([new Tm(this.kc,mm.ft())])},rC.prototype.onSnapshot=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];uT("DocumentReference.onSnapshot",arguments,1,4);var n,r={includeMetadataChanges:!1},i=0;"object"!=typeof t[i]||LS(t[i])||(mT("DocumentReference.onSnapshot",r=t[i],["includeMetadataChanges"]),fT("DocumentReference.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++);var o={includeMetadataChanges:r.includeMetadataChanges};return n=LS(t[i])?t[i]:(cT("DocumentReference.onSnapshot","function",i,t[i]),hT("DocumentReference.onSnapshot","function",i+1,t[i+1]),hT("DocumentReference.onSnapshot","function",i+2,t[i+2]),{next:t[i],error:t[i+1],complete:t[i+2]}),this.lE(o,n)},rC.prototype.lE=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 CS({next:function(t){if(n.next){var e=t.docs.get(r.kc);n.next(new zS(r.firestore,r.kc,e,t.fromCache,t.hasPendingWrites,r.aE))}},error:e}),o=this.jT.listen(nb.Wt(this.kc.path),i,t);return function(){i.NT(),r.jT.rl(o)}},rC.prototype.get=function(n){var r=this;return uT("DocumentReference.get",arguments,0,1),lC("DocumentReference.get",n),new Promise(function(e,t){n&&"cache"===n.source?r.firestore.WT().DT(r.kc).then(function(t){e(new zS(r.firestore,r.kc,t,!0,t instanceof Jm&&t.At,r.aE))},t):r.dE(e,t,n)})},rC.prototype.dE=function(e,n,r){var i=this.lE({includeMetadataChanges:!0,Of:!0},{next:function(t){i(),!t.exists&&t.metadata.fromCache?n(new og(ig.UNAVAILABLE,"Failed to get document because the client is offline.")):t.exists&&t.metadata.fromCache&&r&&"server"===r.source?n(new og(ig.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})},rC.prototype.withConverter=function(t){return new rC(this.kc,this.firestore,t)},rC),GS=(nC.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},nC),zS=(eC.prototype.data=function(t){if(uT("DocumentSnapshot.data",arguments,0,1),t=hC("DocumentSnapshot.data",t),this.fE){if(this.aE){var e=new KS(this.hE,this.kc,this.fE,this.TE,this.EE);return this.aE.fromFirestore(e,t)}return new US(this.hE,this.hE.rE(),t.serverTimestamps,void 0).kT(this.fE.Lt())}},eC.prototype.get=function(t,e){if(uT("DocumentSnapshot.get",arguments,1,2),e=hC("DocumentSnapshot.get",e),this.fE){var n=this.fE.data().field(uI("DocumentSnapshot.get",t));if(null!==n)return new US(this.hE,this.hE.rE(),e.serverTimestamps,this.aE).kT(n)}},Object.defineProperty(eC.prototype,"id",{get:function(){return this.kc.path.O()},enumerable:!0,configurable:!0}),Object.defineProperty(eC.prototype,"ref",{get:function(){return new HS(this.kc,this.hE,this.aE)},enumerable:!0,configurable:!0}),Object.defineProperty(eC.prototype,"exists",{get:function(){return null!==this.fE},enumerable:!0,configurable:!0}),Object.defineProperty(eC.prototype,"metadata",{get:function(){return new GS(this.EE,this.TE)},enumerable:!0,configurable:!0}),eC.prototype.isEqual=function(t){if(!(t instanceof eC))throw bT("isEqual","DocumentSnapshot",1,t);return this.hE===t.hE&&this.TE===t.TE&&this.kc.isEqual(t.kc)&&(null===this.fE?null===t.fE:this.fE.isEqual(t.fE))&&this.aE===t.aE},eC),KS=(Es(tC,FS=zS),tC.prototype.data=function(t){return FS.prototype.data.call(this,t)},tC),QS=(ZS.prototype.where=function(t,e,n){sT("Query.where",arguments,3),gT("Query.where",3,n);var r,i=function(t,e){if(!t.some(function(t){return t===e}))throw new og(ig.INVALID_ARGUMENT,"Invalid value "+yT(e)+" provided to function Query.where() for its "+wT(2)+" argument. Acceptable values: "+t.join(", "));return e}(["<","<=","==",">=",">","array-contains","in","array-contains-any"],e),o=uI("Query.where",t);if(o.Y()){if("array-contains"===i||"array-contains-any"===i)throw new og(ig.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+i+"' queries on FieldPath.documentId().");if("in"===i){this.wE(n,i);for(var s=[],a=0,u=n;a<u.length;a++){var c=u[a];s.push(this.RE(c))}r={arrayValue:{values:s}}}else r=this.RE(n)}else"in"!==i&&"array-contains-any"!==i||this.wE(n,i),r=this.firestore.JT.Nc("Query.where",n,"in"===i);var h=rb.create(o,i,r);return this.AE(h),new ZS(this.IE.Gt(h),this.firestore,this.aE)},ZS.prototype.orderBy=function(t,e){var n;if(uT("Query.orderBy",arguments,1,2),hT("Query.orderBy","non-empty string",2,e),void 0===e||"asc"===e)n="asc";else{if("desc"!==e)throw new og(ig.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+e+"', expected 'asc' or 'desc'.");n="desc"}if(null!==this.IE.startAt)throw new og(ig.INVALID_ARGUMENT,"Invalid query. You must not call Query.startAt() or Query.startAfter() before calling Query.orderBy().");if(null!==this.IE.endAt)throw new og(ig.INVALID_ARGUMENT,"Invalid query. You must not call Query.endAt() or Query.endBefore() before calling Query.orderBy().");var r=uI("Query.orderBy",t),i=new hb(r,n);return this.mE(i),new ZS(this.IE.zt(i),this.firestore,this.aE)},ZS.prototype.limit=function(t){return sT("Query.limit",arguments,1),cT("Query.limit","number",1,t),_T("Query.limit",1,t),new ZS(this.IE.Ht(t),this.firestore,this.aE)},ZS.prototype.limitToLast=function(t){return sT("Query.limitToLast",arguments,1),cT("Query.limitToLast","number",1,t),_T("Query.limitToLast",1,t),new ZS(this.IE.Yt(t),this.firestore,this.aE)},ZS.prototype.startAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];aT("Query.startAt",arguments,1);var r=this.PE("Query.startAt",t,e,!0);return new ZS(this.IE.Jt(r),this.firestore,this.aE)},ZS.prototype.startAfter=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];aT("Query.startAfter",arguments,1);var r=this.PE("Query.startAfter",t,e,!1);return new ZS(this.IE.Jt(r),this.firestore,this.aE)},ZS.prototype.endBefore=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];aT("Query.endBefore",arguments,1);var r=this.PE("Query.endBefore",t,e,!0);return new ZS(this.IE.Xt(r),this.firestore,this.aE)},ZS.prototype.endAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];aT("Query.endAt",arguments,1);var r=this.PE("Query.endAt",t,e,!1);return new ZS(this.IE.Xt(r),this.firestore,this.aE)},ZS.prototype.isEqual=function(t){if(!(t instanceof ZS))throw bT("isEqual","Query",1,t);return this.firestore===t.firestore&&this.IE.isEqual(t.IE)},ZS.prototype.withConverter=function(t){return new ZS(this.IE,this.firestore,t)},ZS.prototype.PE=function(t,e,n,r){if(gT(t,1,e),e instanceof zS){if(0<n.length)throw new og(ig.INVALID_ARGUMENT,"Too many arguments provided to "+t+"().");var i=e;if(!i.exists)throw new og(ig.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+t+"().");return this.VE(i.fE,r)}var o=[e].concat(n);return this.gE(t,o,r)},ZS.prototype.VE=function(t,e){for(var n=[],r=0,i=this.IE.orderBy;r<i.length;r++){var o=i[r];if(o.field.Y())n.push(Yg(this.firestore.$c,t.key));else{var s=t.field(o.field);if(Fg(s))throw new og(ig.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+o.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===s){var a=o.field.j();throw new og(ig.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+a+"' (used as the orderBy) does not exist.")}n.push(s)}}return new cb(n,e)},ZS.prototype.gE=function(t,e,n){var r=this.IE.xt;if(e.length>r.length)throw new og(ig.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.Y()){if("string"!=typeof s)throw new og(ig.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+t+"(), but got a "+typeof s);if(!this.IE._e()&&-1!==s.indexOf("/"))throw new og(ig.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.IE.path.child(pg.K(s));if(!Ng.et(a))throw new og(ig.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 Ng(a);i.push(Yg(this.firestore.$c,u))}else{var c=this.firestore.JT.Nc(t,s);i.push(c)}}return new cb(i,n)},ZS.prototype.onSnapshot=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];uT("Query.onSnapshot",arguments,1,4);var n,r={},i=0;return"object"!=typeof t[i]||LS(t[i])||(mT("Query.onSnapshot",r=t[i],["includeMetadataChanges"]),fT("Query.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++),n=LS(t[i])?t[i]:(cT("Query.onSnapshot","function",i,t[i]),hT("Query.onSnapshot","function",i+1,t[i+1]),hT("Query.onSnapshot","function",i+2,t[i+2]),{next:t[i],error:t[i+1],complete:t[i+2]}),this.pE(this.IE),this.lE(r,n)},ZS.prototype.lE=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 CS({next:function(t){e.next&&e.next(new YS(n.firestore,n.IE,t,n.aE))},error:r}),o=this.firestore.WT(),s=o.listen(this.IE,i,t);return function(){i.NT(),o.rl(s)}},ZS.prototype.pE=function(t){if(t.ae()&&0===t.xt.length)throw new og(ig.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")},ZS.prototype.get=function(n){var r=this;return uT("Query.get",arguments,0,1),lC("Query.get",n),this.pE(this.IE),new Promise(function(e,t){n&&"cache"===n.source?r.firestore.WT().CT(r.IE).then(function(t){e(new YS(r.firestore,r.IE,t,r.aE))},t):r.dE(e,t,n)})},ZS.prototype.dE=function(e,n,r){var i=this.lE({includeMetadataChanges:!0,Of:!0},{next:function(t){i(),t.metadata.fromCache&&r&&"server"===r.source?n(new og(ig.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})},ZS.prototype.RE=function(t){if("string"==typeof t){if(""===t)throw new og(ig.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!this.IE._e()&&-1!==t.indexOf("/"))throw new og(ig.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.IE.path.child(pg.K(t));if(!Ng.et(e))throw new og(ig.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 Yg(this.firestore.$c,new Ng(e))}if(t instanceof HS){var n=t;return Yg(this.firestore.$c,n.kc)}throw new og(ig.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+yT(t)+".")},ZS.prototype.wE=function(t,e){if(!Array.isArray(t)||0===t.length)throw new og(ig.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(10<t.length)throw new og(ig.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.");if(0<=t.indexOf(null))throw new og(ig.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 og(ig.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'NaN' in the value array.")},ZS.prototype.AE=function(t){if(t instanceof rb){var e=["array-contains","array-contains-any"],n=["in","array-contains-any"],r=0<=e.indexOf(t.op),i=0<=n.indexOf(t.op);if(t.ue()){var o=this.IE.jt();if(null!==o&&!o.isEqual(t.field))throw new og(ig.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.IE.Kt();null!==s&&this.yE(t.field,s)}else if(i||r){var a=null;if(i&&(a=this.IE.ce(n)),null===a&&r&&(a=this.IE.ce(e)),null!=a)throw a===t.op?new og(ig.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+t.op.toString()+"' filter."):new og(ig.INVALID_ARGUMENT,"Invalid query. You cannot use '"+t.op.toString()+"' filters with '"+a.toString()+"' filters.")}}},ZS.prototype.mE=function(t){if(null===this.IE.Kt()){var e=this.IE.jt();null!==e&&this.yE(e,t.field)}},ZS.prototype.yE=function(t,e){if(!e.isEqual(t))throw new og(ig.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.")},ZS),YS=(Object.defineProperty(JS.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!0,configurable:!0}),Object.defineProperty(JS.prototype,"empty",{get:function(){return this.vE.docs.B()},enumerable:!0,configurable:!0}),Object.defineProperty(JS.prototype,"size",{get:function(){return this.vE.docs.size},enumerable:!0,configurable:!0}),JS.prototype.forEach=function(e,n){var r=this;uT("QuerySnapshot.forEach",arguments,1,2),cT("QuerySnapshot.forEach","function",1,e),this.vE.docs.forEach(function(t){e.call(n,r.CE(t))})},Object.defineProperty(JS.prototype,"query",{get:function(){return new QS(this.bE,this.hE,this.aE)},enumerable:!0,configurable:!0}),JS.prototype.docChanges=function(t){t&&(mT("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),fT("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var e=!(!t||!t.includeMetadataChanges);if(e&&this.vE.hs)throw new og(ig.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.SE&&this.DE===e||(this.SE=function(i,e,o,s){if(o.ss.B()){var n=0;return o.docChanges.map(function(t){var e=new KS(i,t.doc.key,t.doc,o.fromCache,o.ns.has(t.doc.key),s);return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var a=o.ss;return o.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=new KS(i,t.doc.key,t.doc,o.fromCache,o.ns.has(t.doc.key),s),n=-1,r=-1;return 0!==t.type&&(n=a.indexOf(t.doc.key),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 A_()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this.hE,e,this.vE,this.aE),this.DE=e),this.SE},JS.prototype.isEqual=function(t){if(!(t instanceof JS))throw bT("isEqual","QuerySnapshot",1,t);return this.hE===t.hE&&this.bE.isEqual(t.bE)&&this.vE.isEqual(t.vE)&&this.aE===t.aE},JS.prototype.CE=function(t){return new KS(this.hE,t.key,t,this.metadata.fromCache,this.vE.ns.has(t.key),this.aE)},JS),XS=(Es($S,MS=QS),Object.defineProperty($S.prototype,"id",{get:function(){return this.IE.path.O()},enumerable:!0,configurable:!0}),Object.defineProperty($S.prototype,"parent",{get:function(){var t=this.IE.path.L();return t.B()?null:new HS(new Ng(t),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty($S.prototype,"path",{get:function(){return this.IE.path.j()},enumerable:!0,configurable:!0}),$S.prototype.doc=function(t){if(uT("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=R_.cn()),cT("CollectionReference.doc","non-empty string",1,t),""===t)throw new og(ig.INVALID_ARGUMENT,"Document path must be a non-empty string");var e=pg.K(t);return HS.nE(this.IE.path.child(e),this.firestore,this.aE)},$S.prototype.add=function(t){sT("CollectionReference.add",arguments,1),cT("CollectionReference.add","object",1,this.aE?this.aE.toFirestore(t):t);var e=this.doc();return e.set(t).then(function(){return e})},$S.prototype.withConverter=function(t){return new $S(this.FE,this.firestore,t)},$S);function $S(t,e,n){var r=this;if(((r=MS.call(this,nb.Wt(t),e,n)||this).FE=t).length%2!=1)throw new og(ig.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.j()+" has "+t.length);return r}function JS(t,e,n,r){this.hE=t,this.bE=e,this.vE=n,this.aE=r,this.SE=null,this.DE=null,this.metadata=new GS(n.hasPendingWrites,n.fromCache)}function ZS(t,e,n){this.IE=t,this.firestore=e,this.aE=n}function tC(){return null!==FS&&FS.apply(this,arguments)||this}function eC(t,e,n,r,i,o){this.hE=t,this.kc=e,this.fE=n,this.TE=r,this.EE=i,this.aE=o}function nC(t,e){this.hasPendingWrites=t,this.fromCache=e}function rC(t,e,n){this.kc=t,this.firestore=e,this.aE=n,this.jT=this.firestore.WT()}function iC(t){this.hE=t,this.uE=[],this.cE=!1}function oC(t,e){this.hE=t,this.oE=e}function sC(t,e,n){var r=this;if(void 0===n&&(n=new TS),this.UT=null,this.QT=new LE,this.INTERNAL={delete:function(){return Is(r,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return this.WT(),[4,this.jT.terminate()];case 1:return t.sent(),[2]}})})}},"object"==typeof t.options){var i=t;this.UT=i,this.$c=sC.KT(i),this.GT=i.name,this.zT=new ag(e)}else{var o=t;if(!o.projectId)throw new og(ig.INVALID_ARGUMENT,"Must provide projectId");this.$c=new F_(o.projectId,o.database),this.GT="[DEFAULT]",this.zT=new sg}this.HT=n,this.YT=new VS({})}function aC(t){var e,n,r,i;if(void 0===t.host){if(void 0!==t.ssl)throw new og(ig.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else lT("settings","non-empty string","host",t.host),this.host=t.host,fT("settings","boolean","ssl",t.ssl),this.ssl=null===(e=t.ssl)||void 0===e||e;if(mT("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling","ignoreUndefinedProperties"]),fT("settings","object","credentials",t.credentials),this.credentials=t.credentials,fT("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),fT("settings","boolean","ignoreUndefinedProperties",t.ignoreUndefinedProperties),!0===t.timestampsInSnapshots?C_("The setting 'timestampsInSnapshots: true' is no longer required and should be removed."):!1===t.timestampsInSnapshots&&C_("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),this.timestampsInSnapshots=null===(n=t.timestampsInSnapshots)||void 0===n||n,this.ignoreUndefinedProperties=null!==(r=t.ignoreUndefinedProperties)&&void 0!==r&&r,fT("settings","number","cacheSizeBytes",t.cacheSizeBytes),void 0===t.cacheSizeBytes)this.cacheSizeBytes=BE._u;else{if(t.cacheSizeBytes!==jS&&t.cacheSizeBytes<BE.cu)throw new og(ig.INVALID_ARGUMENT,"cacheSizeBytes must be at least "+BE.cu);this.cacheSizeBytes=t.cacheSizeBytes}fT("settings","boolean","experimentalForceLongPolling",t.experimentalForceLongPolling),this.forceLongPolling=null!==(i=t.experimentalForceLongPolling)&&void 0!==i&&i}function uC(t,e,n,r){this.firestore=t,this.timestampsInSnapshots=e,this.$T=n,this.converter=r}function cC(t,e){if(void 0===e)return{merge:!1};if(mT(t,e,["merge","mergeFields"]),fT(t,"boolean","merge",e.merge),n=t,void 0!==(r=e.mergeFields)&&function(t,e,n,r){if(!(n instanceof Array))throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() requires its "+e+" option to be an array, but it was: "+yT(n));for(var i=0;i<n.length;++i)if(!r(n[i]))throw new og(ig.INVALID_ARGUMENT,"Function "+t+"() requires all "+e+" elements to be a string or a FieldPath, but the value at index "+i+" was: "+yT(n[i]))}(n,"mergeFields",r,function(t){return"string"==typeof t||t instanceof CT}),void 0!==e.mergeFields&&void 0!==e.merge)throw new og(ig.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');var n,r;return e}function hC(t,e){return void 0===e?{}:(mT(t,e,["serverTimestamps"]),pT(t,0,"serverTimestamps",e.serverTimestamps,["estimate","previous","none"]),e)}function lC(t,e){hT(t,"object",1,e),e&&(mT(t,e,["source"]),pT(t,0,"source",e.source,["default","server","cache"]))}function fC(t,e,n){if(e instanceof HS){if(e.firestore!==n)throw new og(ig.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}throw bT(t,"DocumentReference",1,e)}function pC(t,e,n){var r;return t?(r=t.toFirestore(e),n="toFirestore() in "+n):r=e,[r,n]}function dC(t,e){function n(){var t="This constructor is private.";throw e&&(t+=" ",t+=e),new og(ig.INVALID_ARGUMENT,t)}return n.prototype=t.prototype,Object.assign(n,t),n}var vC,yC=dC(qS,"Use firebase.firestore() instead."),gC=dC(BS,"Use firebase.firestore().runTransaction() instead."),mC=dC(WS,"Use firebase.firestore().batch() instead."),bC=dC(HS,"Use firebase.firestore().doc() instead."),_C=dC(zS),wC=dC(KS),EC=dC(QS),TC=dC(YS),IC=dC(XS,"Use firebase.firestore().collection() instead."),SC=dC((UC.delete=function(){return oT("FieldValue.delete",arguments),new MT},UC.serverTimestamp=function(){return oT("FieldValue.serverTimestamp",arguments),new FT},UC.arrayUnion=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return aT("FieldValue.arrayUnion",arguments,1),new UT(t)},UC.arrayRemove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return aT("FieldValue.arrayRemove",arguments,1),new jT(t)},UC.increment=function(t){return cT("FieldValue.increment","number",1,t),sT("FieldValue.increment",arguments,1),new VT(t)},UC.prototype.isEqual=function(t){return this===t},UC),"Use FieldValue.<field>() instead."),CC=dC(ST,"Use Blob.fromUint8Array() or Blob.fromBase64String() instead."),NC={Firestore:yC,GeoPoint:qT,Timestamp:hg,Blob:CC,Transaction:gC,WriteBatch:mC,DocumentReference:bC,DocumentSnapshot:_C,Query:EC,QueryDocumentSnapshot:wC,QuerySnapshot:TC,CollectionReference:IC,FieldPath:CT,FieldValue:SC,setLogLevel:qS.setLogLevel,CACHE_SIZE_UNLIMITED:jS},AC=(FC.prototype.B_=function(t){},FC.prototype.mo=function(){},FC),kC=(MC.prototype.B_=function(t){this.ME.push(t)},MC.prototype.mo=function(){window.removeEventListener("online",this.NE),window.removeEventListener("offline",this.kE)},MC.prototype.OE=function(){window.addEventListener("online",this.NE),window.addEventListener("offline",this.kE)},MC.prototype.$E=function(){S_("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.ME;t<e.length;t++)(0,e[t])(0)},MC.prototype.LE=function(){S_("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.ME;t<e.length;t++)(0,e[t])(1)},MC.Gh=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},MC),OC=(LC.prototype.e_=function(t){this.qE=t},LC.prototype.Yc=function(t){this.UE=t},LC.prototype.onMessage=function(t){this.QE=t},LC.prototype.close=function(){this.BE()},LC.prototype.send=function(t){this.xE(t)},LC.prototype.WE=function(){this.qE()},LC.prototype.jE=function(t){this.UE(t)},LC.prototype.KE=function(t){this.QE(t)},LC),RC={BatchGetDocuments:"batchGet",Commit:"commit"},PC="gl-js/ fire/"+Jy,DC=(xC.prototype.zE=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"]=PC},xC.prototype.d_=function(u,r,i){var c=this,h=this.HE(u);return new Promise(function(o,s){var a=new $y;a.listenOnce(Yy.COMPLETE,function(){try{switch(a.getLastErrorCode()){case Qy.NO_ERROR:var t=a.getResponseJson();S_("Connection","XHR received:",JSON.stringify(t)),o(t);break;case Qy.TIMEOUT:S_("Connection",'RPC "'+u+'" timed out'),s(new og(ig.DEADLINE_EXCEEDED,"Request time out"));break;case Qy.HTTP_ERROR:var e=a.getStatus();if(S_("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(ig).indexOf(i)?i:ig.UNKNOWN);s(new og(r,n.message))}else s(new og(ig.UNKNOWN,"Server responded with status "+a.getStatus()))}else S_("Connection",'RPC "'+u+'" failed'),s(new og(ig.UNAVAILABLE,"Connection failed."));break;default:A_()}}finally{S_("Connection",'RPC "'+u+'" completed.')}var i});var t=Object.assign({},r);delete t.database;var e=JSON.stringify(t);S_("Connection","XHR sending: ",h+" "+e);var n={"Content-Type":"text/plain"};c.zE(n,i),a.send(h,"POST",e,n,15)})},xC.prototype.f_=function(t,e,n){return this.d_(t,e,n)},xC.prototype.s_=function(t,e){var n,r,i=[this.GE,"/","google.firestore.v1.Firestore","/",t,"/channel"],o=Ky(),s={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.ii.projectId+"/databases/"+this.ii.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling};this.zE(s.initMessageHeaders,e),qs()||Bs()||0<=Vs().indexOf("Electron/")||0<=(r=Vs()).indexOf("MSIE ")||0<=r.indexOf("Trident/")||0<=Vs().indexOf("MSAppHost/")||"object"==typeof(n="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0)&&void 0!==n.id||(s.httpHeadersOverwriteParam="$httpHeaders");var a=i.join("");function u(t,e){c.listen(t,function(t){try{e(t)}catch(t){setTimeout(function(){throw t},0)}})}S_("Connection","Creating WebChannel: "+a+" "+s);var c=o.createWebChannel(a,s),h=!1,l=!1,f=new OC({xE:function(t){l?S_("Connection","Not sending because WebChannel is closed:",t):(h||(S_("Connection","Opening WebChannel transport."),c.open(),h=!0),S_("Connection","WebChannel sending:",t),c.send(t))},BE:function(){return c.close()}});return u(Xy.EventType.OPEN,function(){l||S_("Connection","WebChannel transport opened.")}),u(Xy.EventType.CLOSE,function(){l||(l=!0,S_("Connection","WebChannel transport closed"),f.jE())}),u(Xy.EventType.ERROR,function(t){l||(l=!0,S_("Connection","WebChannel transport errored:",t),f.jE(new og(ig.UNAVAILABLE,"The operation could not be completed")))}),u(Xy.EventType.MESSAGE,function(t){var e;if(!l){var n=t.data[0];k_(!!n);var r=n.error||(null===(e=n[0])||void 0===e?void 0:e.error);if(r){S_("Connection","WebChannel received error:",r);var i=r.status,o=function(){var t=qm[i];if(void 0!==t)return Nb(t)}(),s=r.message;void 0===o&&(o=ig.INTERNAL,s="Unknown error status: "+i+" with message "+r.message),l=!0,f.jE(new og(o,s)),c.close()}else S_("Connection","WebChannel received:",n),f.KE(n)}}),setTimeout(function(){f.WE()},0),f},xC.prototype.HE=function(t){var e=RC[t];return this.GE+"/v1/projects/"+this.ii.projectId+"/databases/"+this.ii.database+"/documents:"+e},xC);function xC(t){this.ii=t.ii;var e=t.ssl?"https":"http";this.GE=e+"://"+t.host,this.forceLongPolling=t.forceLongPolling}function LC(t){this.xE=t.xE,this.BE=t.BE}function MC(){var t=this;this.NE=function(){return t.$E()},this.kE=function(){return t.LE()},this.ME=[],this.OE()}function FC(){}function UC(){}function jC(){this.ac="undefined"!=typeof atob}__.an((Object.defineProperty(jC.prototype,"document",{get:function(){return"undefined"!=typeof document?document:null},enumerable:!0,configurable:!0}),Object.defineProperty(jC.prototype,"window",{get:function(){return"undefined"!=typeof window?window:null},enumerable:!0,configurable:!0}),jC.prototype.yT=function(t){return Promise.resolve(new DC(t))},jC.prototype.AT=function(){return new(kC.Gh()?kC:AC)},jC.prototype.bc=function(t){return new g_(t,{hi:!0})},jC.prototype.un=function(t){return JSON.stringify(t)},jC.prototype.atob=function(t){return atob(t)},jC.prototype.btoa=function(t){return btoa(t)},jC.prototype._n=function(t){var e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e)e.getRandomValues(n);else for(var r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n},new jC)),(vC=Kl).INTERNAL.registerComponent(new da("firestore",function(t){return e=t.getProvider("app").getImmediate(),n=t.getProvider("auth-internal"),new qS(e,n,new IS);var e,n},"PUBLIC").setServiceProps(Object.assign({},NC))),vC.registerVersion("@firebase/firestore","1.14.6");var VC,qC={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"},BC=(Es(WC,VC=Error),WC);function WC(t,e,n){var r=VC.call(this,e)||this;return Object.setPrototypeOf(r,WC.prototype),r.code=t,r.details=n,r}function HC(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(!qC[a])return new BC("internal","internal");r=qC[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 BC(r,i,o)}var GC=(zC.prototype.getAuthToken=function(){return Is(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]}})})},zC.prototype.getInstanceIdToken=function(){return Is(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]})})},zC.prototype.getContext=function(){return Is(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}]}})})},zC);function zC(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 KC(t,e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}var QC=(YC.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 KC(t,function(t){return e.encode(t)});throw new Error("Data cannot be encoded in JSON: "+t)},YC.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?KC(t,function(t){return e.decode(t)}):t},YC);function YC(){}var XC=(Object.defineProperty($C.prototype,"app",{get:function(){return this.app_},enumerable:!0,configurable:!0}),$C.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},$C.prototype.useFunctionsEmulator=function(t){this.emulatorOrigin=t},$C.prototype.httpsCallable=function(e,n){var r=this;return function(t){return r.call(e,t,n||{})}},$C.prototype.postJSON=function(r,i,o){return Is(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}]}})})},$C.prototype.call=function(h,l,f){return Is(this,void 0,void 0,function(){var e,r,i,o,s,a,u,c;return Ss(this,function(t){switch(t.label){case 0:return e=this._url(h),l=this.serializer.encode(l),r={data:l},i=new Headers,[4,this.contextProvider.getContext()];case 1:return(o=t.sent()).authToken&&i.append("Authorization","Bearer "+o.authToken),o.instanceIdToken&&i.append("Firebase-Instance-ID-Token",o.instanceIdToken),s=f.timeout||7e4,[4,Promise.race([this.postJSON(e,r,i),(n=s,new Promise(function(t,e){setTimeout(function(){e(new BC("deadline-exceeded","deadline-exceeded"))},n)})),this.cancelAllRequests])];case 2:if(!(a=t.sent()))throw new BC("cancelled","Firebase Functions instance was deleted.");if(u=HC(a.status,a.json,this.serializer))throw u;if(!a.json)throw new BC("internal","Response is not valid JSON object.");if(void 0===(c=a.json.data)&&(c=a.json.result),void 0===c)throw new BC("internal","Response is missing data field.");return[2,{data:this.serializer.decode(c)}]}var n})})},$C);function $C(t,e,n,r){var i=this;void 0===r&&(r="us-central1"),this.app_=t,this.region_=r,this.serializer=new QC,this.emulatorOrigin=null,this.INTERNAL={delete:function(){return i.deleteService()}},this.contextProvider=new GC(e,n),this.cancelAllRequests=new Promise(function(t){i.deleteService=function(){return t()}})}function JC(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),i=t.getProvider("messaging");return new XC(n,r,i,e)}var ZC;function tN(n){return new Promise(function(t,e){n.onsuccess=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function eN(n,r,i){var o,t=new Promise(function(t,e){tN(o=n[r].apply(n,i)).then(t,e)});return t.request=o,t}function nN(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 rN(e,n,r,t){t.forEach(function(t){t in r.prototype&&(e.prototype[t]=function(){return eN(this[n],t,arguments)})})}function iN(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 oN(t,r,e,n){n.forEach(function(n){n in e.prototype&&(t.prototype[n]=function(){return t=this[r],(e=eN(t,n,arguments)).then(function(t){if(t)return new aN(t,e.request)});var t,e})})}function sN(t){this._index=t}function aN(t,e){this._cursor=t,this._request=e}function uN(t){this._store=t}function cN(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 hN(t,e,n){this._db=t,this.oldVersion=e,this.transaction=new cN(n)}function lN(t){this._db=t}function fN(t,e,n){var r=eN(indexedDB,"open",[t,e]),i=r.request;return i&&(i.onupgradeneeded=function(t){n&&n(new hN(i.result,t.oldVersion,i.transaction))}),r.then(function(t){return new lN(t)})}function pN(t){return eN(indexedDB,"deleteDatabase",[t])}ZC={Functions:XC},Kl.INTERNAL.registerComponent(new da("functions",JC,"PUBLIC").setServiceProps(ZC).setMultipleInstances(!0)),Kl.registerVersion("@firebase/functions","0.4.44"),nN(sN,"_index",["name","keyPath","multiEntry","unique"]),rN(sN,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),oN(sN,"_index",IDBIndex,["openCursor","openKeyCursor"]),nN(aN,"_cursor",["direction","key","primaryKey","value"]),rN(aN,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(aN.prototype[n]=function(){var e=this,t=arguments;return Promise.resolve().then(function(){return e._cursor[n].apply(e._cursor,t),tN(e._request).then(function(t){if(t)return new aN(t,e._request)})})})}),uN.prototype.createIndex=function(){return new sN(this._store.createIndex.apply(this._store,arguments))},uN.prototype.index=function(){return new sN(this._store.index.apply(this._store,arguments))},nN(uN,"_store",["name","keyPath","indexNames","autoIncrement"]),rN(uN,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),oN(uN,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),iN(uN,"_store",IDBObjectStore,["deleteIndex"]),cN.prototype.objectStore=function(){return new uN(this._tx.objectStore.apply(this._tx,arguments))},nN(cN,"_tx",["objectStoreNames","mode"]),iN(cN,"_tx",IDBTransaction,["abort"]),hN.prototype.createObjectStore=function(){return new uN(this._db.createObjectStore.apply(this._db,arguments))},nN(hN,"_db",["name","version","objectStoreNames"]),iN(hN,"_db",IDBDatabase,["deleteObjectStore","close"]),lN.prototype.transaction=function(){return new cN(this._db.transaction.apply(this._db,arguments))},nN(lN,"_db",["name","version","objectStoreNames"]),iN(lN,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach(function(o){[uN,sN].forEach(function(t){o in t.prototype&&(t.prototype[o.replace("open","iterate")]=function(){var t,e=(t=arguments,Array.prototype.slice.call(t)),n=e[e.length-1],r=this._store||this._index,i=r[o].apply(r,e.slice(0,-1));i.onsuccess=function(){n(i.result)}})})}),[sN,uN].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 dN,vN=1e4,yN="w:0.4.10",gN="FIS_v2",mN="https://firebaseinstallations.googleapis.com/v1",bN=36e5,_N=((dN={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',dN["not-registered"]="Firebase Installation is not registered.",dN["installation-not-found"]="Firebase Installation not found.",dN["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',dN["app-offline"]="Could not process request. Application offline.",dN["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",dN),wN=new Ks("installations","Installations",_N);function EN(t){return t instanceof Gs&&t.code.includes("request-failed")}function TN(t){var e=t.projectId;return mN+"/projects/"+e+"/installations"}function IN(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}function SN(r,i){return Is(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,wN.create("request-failed",{requestName:r,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})]}})})}function CN(t){var e=t.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function NN(t,e){var n=e.refreshToken,r=CN(t);return r.append("Authorization",gN+" "+n),r}function AN(n){return Is(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 kN(e){return new Promise(function(t){setTimeout(t,e)})}var ON=/^[cdef][\w-]{21}$/,RN="";function PN(){try{var t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;var e=function(t){return btoa(String.fromCharCode.apply(String,As(t))).replace(/\+/g,"-").replace(/\//g,"_")}(t).substr(0,22);return ON.test(e)?e:RN}catch(t){return RN}}function DN(t){return t.appName+"!"+t.appId}var xN=new Map;function LN(t,e){var n=DN(t);MN(n,e),function(t,e){var n=UN();n&&n.postMessage({key:t,fid:e});jN()}(n,e)}function MN(t,e){var n,r,i=xN.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 FN=null;function UN(){return!FN&&"BroadcastChannel"in self&&((FN=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(t){MN(t.data.key,t.data.fid)}),FN}function jN(){0===xN.size&&FN&&(FN.close(),FN=null)}var VN,qN,BN="firebase-installations-database",WN=1,HN="firebase-installations-store",GN=null;function zN(){return GN=GN||fN(BN,WN,function(t){switch(t.oldVersion){case 0:t.createObjectStore(HN)}})}function KN(s,a){return Is(this,void 0,void 0,function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return e=DN(s),[4,zN()];case 1:return n=t.sent(),r=n.transaction(HN,"readwrite"),[4,(i=r.objectStore(HN)).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||LN(s,a.fid),[2,a]}})})}function QN(i){return Is(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=DN(i),[4,zN()];case 1:return n=t.sent(),[4,(r=n.transaction(HN,"readwrite")).objectStore(HN).delete(e)];case 2:return t.sent(),[4,r.complete];case 3:return t.sent(),[2]}})})}function YN(a,u){return Is(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=DN(a),[4,zN()];case 1:return n=t.sent(),r=n.transaction(HN,"readwrite"),[4,(i=r.objectStore(HN)).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||LN(a,s.fid),[2,s]}})})}function XN(i){return Is(this,void 0,void 0,function(){var r,e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,YN(i,function(t){var e=JN(t||{fid:PN(),registrationStatus:0}),n=function(t,e){{if(0!==e.registrationStatus)return 1===e.registrationStatus?{installationEntry:e,registrationPromise:function(o){return Is(this,void 0,void 0,function(){var e,n,r,i;return Ss(this,function(t){switch(t.label){case 0:return[4,$N(o)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.registrationStatus?[3,5]:[4,kN(100)];case 3:return t.sent(),[4,$N(o)];case 4:return e=t.sent(),[3,2];case 5:return 0!==e.registrationStatus?[3,7]:[4,XN(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(wN.create("app-offline"));return{installationEntry:e,registrationPromise:n}}var r={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},i=function(r,i){return Is(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 Is(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=TN(a),n=CN(a),r={fid:u,authVersion:gN,appId:a.appId,sdkVersion:yN},i={method:"POST",headers:n,body:JSON.stringify(r)},[4,AN(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:IN(s.authToken)}];case 3:return[4,SN("Create Installation",o)];case 4:throw t.sent()}})})}(r,i)];case 1:return e=t.sent(),[2,KN(r,e)];case 2:return EN(n=t.sent())&&409===n.serverCode?[4,QN(r)]:[3,4];case 3:return t.sent(),[3,6];case 4:return[4,KN(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!==RN?[3,3]:(n={},[4,r]);case 2:return[2,(n.installationEntry=t.sent(),n)];case 3:return[2,{installationEntry:e,registrationPromise:r}]}})})}function $N(t){return YN(t,function(t){if(!t)throw wN.create("installation-not-found");return JN(t)})}function JN(t){return 1===(e=t).registrationStatus&&e.registrationTime+vN<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}function ZN(t,h){var l=t.appConfig,f=t.platformLoggerProvider;return Is(this,void 0,void 0,function(){var r,i,o,s,a,u,c;return Ss(this,function(t){switch(t.label){case 0:return e=l,n=h.fid,r=TN(e)+"/"+n+"/authTokens:generate",i=NN(l,h),(o=f.getImmediate({optional:!0}))&&i.append("x-firebase-client",o.getPlatformInfoString()),s={installation:{sdkVersion:yN}},a={method:"POST",headers:i,body:JSON.stringify(s)},[4,AN(function(){return fetch(r,a)})];case 1:return(u=t.sent()).ok?[4,u.json()]:[3,3];case 2:return c=t.sent(),[2,IN(c)];case 3:return[4,SN("Generate Auth Token",u)];case 4:throw t.sent()}var e,n})})}function tA(a,u){return void 0===u&&(u=!1),Is(this,void 0,void 0,function(){var s,e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,YN(a.appConfig,function(t){if(!nA(t))throw wN.create("not-registered");var e,n,r,i=t.authToken;if(u||2!==(r=i).requestStatus||function(t){var e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+bN}(r)){if(1===i.requestStatus)return s=function(r,i){return Is(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,eA(r.appConfig)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.authToken.requestStatus?[3,5]:[4,kN(100)];case 3:return t.sent(),[4,eA(r.appConfig)];case 4:return e=t.sent(),[3,2];case 5:return 0===(n=e.authToken).requestStatus?[2,tA(r,i)]:[2,n]}})})}(a,u),t;if(!navigator.onLine)throw wN.create("app-offline");var o=(e=t,n={requestStatus:1,requestTime:Date.now()},Ts(Ts({},e),{authToken:n}));return s=function(i,o){return Is(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,ZN(i,o)];case 1:return e=t.sent(),r=Ts(Ts({},o),{authToken:e}),[4,KN(i.appConfig,r)];case 2:return t.sent(),[2,e];case 3:return!EN(n=t.sent())||401!==n.serverCode&&404!==n.serverCode?[3,5]:[4,QN(i.appConfig)];case 4:return t.sent(),[3,7];case 5:return r=Ts(Ts({},o),{authToken:{requestStatus:0}}),[4,KN(i.appConfig,r)];case 6:t.sent(),t.label=7;case 7:throw n;case 8:return[2]}})})}(a,o),o}return t})];case 1:return e=t.sent(),s?[4,s]:[3,3];case 2:return n=t.sent(),[3,4];case 3:n=e.authToken,t.label=4;case 4:return[2,n]}})})}function eA(t){return YN(t,function(t){if(!nA(t))throw wN.create("not-registered");var e,n=t.authToken;return 1===(e=n).requestStatus&&e.requestTime+vN<Date.now()?Ts(Ts({},t),{authToken:{requestStatus:0}}):t})}function nA(t){return void 0!==t&&2===t.registrationStatus}function rA(e,n){return void 0===n&&(n=!1),Is(this,void 0,void 0,function(){return Ss(this,function(t){switch(t.label){case 0:return[4,function(n){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return[4,XN(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,tA(e,n)];case 2:return[2,t.sent().token]}})})}function iA(a,u){return Is(this,void 0,void 0,function(){var r,i,o,s;return Ss(this,function(t){switch(t.label){case 0:return e=a,n=u.fid,r=TN(e)+"/"+n,i=NN(a,u),o={method:"DELETE",headers:i},[4,AN(function(){return fetch(r,o)})];case 1:return(s=t.sent()).ok?[3,3]:[4,SN("Delete Installation",s)];case 2:throw t.sent();case 3:return[2]}var e,n})})}function oA(t,r){var i=t.appConfig;return function(t,e){UN();var n=DN(t),r=xN.get(n);r||(r=new Set,xN.set(n,r)),r.add(e)}(i,r),function(){var t,e,n;t=r,e=DN(i),(n=xN.get(e))&&(n.delete(t),0===n.size&&xN.delete(e),jN())}}function sA(t){return wN.create("missing-app-config-values",{valueName:t})}(VN=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 sA("App Configuration");if(!t.name)throw sA("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 sA(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 Is(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return[4,XN(i.appConfig)];case 1:return e=t.sent(),n=e.installationEntry,(r=e.registrationPromise)?r.catch(console.error):tA(i).catch(console.error),[2,n.fid]}})})}(n)},getToken:function(t){return rA(n,t)},delete:function(){return function(r){return Is(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,YN(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 wN.create("delete-pending-registration");case 2:if(2!==n.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw wN.create("app-offline");case 3:return[4,iA(e,n)];case 4:return t.sent(),[4,QN(e)];case 5:t.sent(),t.label=6;case 6:return[2]}})})}(n)},onIdChange:function(t){return oA(n,t)}}},"PUBLIC")),VN.registerVersion("@firebase/installations","0.4.10");var aA=((qN={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',qN["only-available-in-window"]="This method is available in a Window context.",qN["only-available-in-sw"]="This method is available in a service worker context.",qN["permission-default"]="The notification permission was not granted and dismissed instead.",qN["permission-blocked"]="The notification permission was not granted and blocked instead.",qN["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",qN["failed-service-worker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",qN["token-subscribe-failed"]="A problem occured while subscribing the user to FCM: {$errorInfo}",qN["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",qN["token-unsubscribe-failed"]="A problem occured while unsubscribing the user from FCM: {$errorInfo}",qN["token-update-failed"]="A problem occured while updating the user from FCM: {$errorInfo}",qN["token-update-no-token"]="FCM returned no token when updating the user to push.",qN["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.",qN["invalid-sw-registration"]="The input to useServiceWorker() must be a ServiceWorkerRegistration.",qN["invalid-bg-handler"]="The input to setBackgroundMessageHandler() must be a function.",qN["invalid-vapid-key"]="The public VAPID key must be a string.",qN["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.",qN),uA=new Ks("messaging","Messaging",aA);function cA(t){return uA.create("missing-app-config-values",{valueName:t})}function hA(t){var e=new Uint8Array(t);return btoa(String.fromCharCode.apply(String,As(e))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var lA="fcm_token_details_db",fA=5,pA="fcm_token_object_Store";function dA(a){return Is(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(lA))return[2,null];t.label=2;case 2:return s=null,[4,fN(lA,fA,function(o){return Is(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(pA)?[4,(e=o.transaction.objectStore(pA)).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:hA(r.vapidKey)}}}else(3===o.oldVersion||4===o.oldVersion)&&(s={token:(r=n).fcmToken,createTime:r.createTime,subscriptionOptions:{auth:hA(r.auth),p256dh:hA(r.p256dh),endpoint:r.endpoint,swScope:r.swScope,vapidKey:hA(r.vapidKey)}});return[2]}})})})];case 3:return t.sent().close(),[4,pN(lA)];case 4:return t.sent(),[4,pN("fcm_vapid_details_db")];case 5:return t.sent(),[4,pN("undefined")];case 6:return t.sent(),[2,function(t){if(!t||!t.subscriptionOptions)return;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 vA="firebase-messaging-database",yA=1,gA="firebase-messaging-store",mA=null;function bA(){return mA=mA||fN(vA,yA,function(t){switch(t.oldVersion){case 0:t.createObjectStore(gA)}})}function _A(i){return Is(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=EA(i),[4,bA()];case 1:return[4,t.sent().transaction(gA).objectStore(gA).get(e)];case 2:return(n=t.sent())?[2,n]:[3,3];case 3:return[4,dA(i.appConfig.senderId)];case 4:return(r=t.sent())?[4,wA(i,r)]:[3,6];case 5:return t.sent(),[2,r];case 6:return[2]}})})}function wA(i,o){return Is(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=EA(i),[4,bA()];case 1:return n=t.sent(),[4,(r=n.transaction(gA,"readwrite")).objectStore(gA).put(o,e)];case 2:return t.sent(),[4,r.complete];case 3:return t.sent(),[2,o]}})})}function EA(t){return t.appConfig.appId}var TA="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",IA="https://fcmregistrations.googleapis.com/v1",SA="FCM_MSG",CA="google.c.a.c_id";function NA(s,a){return Is(this,void 0,void 0,function(){var e,n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return[4,kA(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(AA(s.appConfig)+"/"+a,n)];case 3:return[4,t.sent().json()];case 4:if((r=t.sent()).error)throw i=r.error.message,uA.create("token-unsubscribe-failed",{errorInfo:i});return[3,6];case 5:throw o=t.sent(),uA.create("token-unsubscribe-failed",{errorInfo:o});case 6:return[2]}})})}function AA(t){var e=t.projectId;return IA+"/projects/"+e+"/registrations"}function kA(t){var n=t.appConfig,r=t.installations;return Is(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 OA(t){var e=t.p256dh,n=t.auth,r=t.endpoint,i=t.vapidKey,o={web:{endpoint:r,auth:n,p256dh:e}};return i!==TA&&(o.web.applicationPubKey=i),o}var RA,PA;function DA(l,f,p){return Is(this,void 0,void 0,function(){var a,u,c,h;return Ss(this,function(t){switch(t.label){case 0:if("granted"!==Notification.permission)throw uA.create("permission-blocked");return[4,function(n,r){return Is(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:function(t){for(var e=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(e),r=new Uint8Array(n.length),i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}(r)})]}})})}(f,p)];case 1:return a=t.sent(),[4,_A(l)];case 2:return u=t.sent(),c={vapidKey:p,swScope:f.scope,endpoint:a.endpoint,auth:hA(a.getKey("auth")),p256dh:hA(a.getKey("p256dh"))},u?[3,3]:[2,LA(l,c)];case 3:if(e=u.subscriptionOptions,r=(n=c).vapidKey===e.vapidKey,i=n.endpoint===e.endpoint,o=n.auth===e.auth,s=n.p256dh===e.p256dh,r&&i&&o&&s)return[3,8];t.label=4;case 4:return t.trys.push([4,6,,7]),[4,NA(l,u.token)];case 5:return t.sent(),[3,7];case 6:return h=t.sent(),console.warn(h),[3,7];case 7:return[2,LA(l,c)];case 8:return Date.now()>=u.createTime+6048e5?[2,function(i,o,s){return Is(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 Is(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,kA(a)];case 1:e=t.sent(),n=OA(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(AA(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(),uA.create("token-update-failed",{errorInfo:o});case 6:if(i.error)throw s=i.error.message,uA.create("token-update-failed",{errorInfo:s});if(!i.token)throw uA.create("token-update-no-token");return[2,i.token]}})})}(o,i)];case 1:return e=t.sent(),n=Ts({token:e,createTime:Date.now()},i),[4,wA(o,n)];case 2:return t.sent(),[2,e];case 3:return r=t.sent(),[4,xA(o,s)];case 4:throw t.sent(),r;case 5:return[2]}})})}({token:u.token,createTime:Date.now(),subscriptionOptions:c},l,f)]:[2,u.token];case 9:return[2]}var e,n,r,i,o,s})})}function xA(r,i){return Is(this,void 0,void 0,function(){var e,n;return Ss(this,function(t){switch(t.label){case 0:return[4,_A(r)];case 1:return(e=t.sent())?[4,NA(r,e.token)]:[3,4];case 2:return t.sent(),[4,function(i){return Is(this,void 0,void 0,function(){var e,n,r;return Ss(this,function(t){switch(t.label){case 0:return e=EA(i),[4,bA()];case 1:return n=t.sent(),[4,(r=n.transaction(gA,"readwrite")).objectStore(gA).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 LA(r,i){return Is(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 Is(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,kA(a)];case 1:e=t.sent(),n=OA(u),r={method:"POST",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(AA(a.appConfig),r)];case 3:return[4,t.sent().json()];case 4:return i=t.sent(),[3,6];case 5:throw o=t.sent(),uA.create("token-subscribe-failed",{errorInfo:o});case 6:if(i.error)throw s=i.error.message,uA.create("token-subscribe-failed",{errorInfo:s});if(!i.token)throw uA.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,wA(r,n)];case 2:return t.sent(),[2,n.token]}})})}function MA(t){return"object"==typeof t&&t&&CA in t}(PA=RA=RA||{}).PUSH_RECEIVED="push-received",PA.NOTIFICATION_CLICKED="notification-clicked";var FA=(Object.defineProperty(UA.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!0,configurable:!0}),UA.prototype.getToken=function(){return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.vapidKey||(this.vapidKey=TA),[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 uA.create("permission-blocked");return[2,DA(this.firebaseDependencies,e,this.vapidKey)]}})})},UA.prototype.deleteToken=function(){return Is(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,xA(this.firebaseDependencies,e)]}})})},UA.prototype.requestPermission=function(){return Is(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?uA.create("permission-blocked"):uA.create("permission-default")}})})},UA.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw uA.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw uA.create("invalid-vapid-key");this.vapidKey=t},UA.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw uA.create("invalid-sw-registration");if(this.swRegistration)throw uA.create("use-sw-after-get-token");this.swRegistration=t},UA.prototype.onMessage=function(t){var e=this;return this.onMessageCallback="function"==typeof t?t:t.next,function(){e.onMessageCallback=null}},UA.prototype.setBackgroundMessageHandler=function(){throw uA.create("only-available-in-sw")},UA.prototype.onTokenRefresh=function(){return function(){}},UA.prototype.getServiceWorkerRegistration=function(){return Is(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(),uA.create("failed-service-worker-registration",{browserErrorMessage:n.message});case 4:return[2,this.swRegistration]}})})},UA.prototype.messageEventListener=function(o){var s;return Is(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&&s.firebaseMessaging?(e=o.data.firebaseMessaging,n=e.type,r=e.payload,this.onMessageCallback&&n===RA.PUSH_RECEIVED&&this.onMessageCallback(r),MA(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]}})})},UA.prototype.logEvent=function(n,r){return Is(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 RA.NOTIFICATION_CLICKED:return"notification_open";case RA.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[CA],message_name:r["google.c.a.c_l"],message_time:r["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}})})},UA);function UA(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",function(t){return e.messageEventListener(t)})}var jA=(Object.defineProperty(VA.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!0,configurable:!0}),VA.prototype.setBackgroundMessageHandler=function(t){if(!t||"function"!=typeof t)throw uA.create("invalid-bg-handler");this.bgMessageHandler=t},VA.prototype.getToken=function(){var n,r;return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return this.vapidKey?[3,2]:[4,_A(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:TA,t.label=2;case 2:return[2,DA(this.firebaseDependencies,self.registration,this.vapidKey)]}})})},VA.prototype.deleteToken=function(){return xA(this.firebaseDependencies,self.registration)},VA.prototype.requestPermission=function(){throw uA.create("only-available-in-window")},VA.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw uA.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw uA.create("invalid-vapid-key");this.vapidKey=t},VA.prototype.useServiceWorker=function(){throw uA.create("only-available-in-window")},VA.prototype.onMessage=function(){throw uA.create("only-available-in-window")},VA.prototype.onTokenRefresh=function(){throw uA.create("only-available-in-window")},VA.prototype.onPush=function(i){return Is(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,qA()]:[2];case 1:return(n=t.sent()).some(function(t){return"visible"===t.visibilityState&&!t.url.startsWith("chrome-extension://")})?[2,function(t,e){var n,r,i=BA(RA.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=Ts({},t.notification);return n.data=Ts(Ts({},t.notification.data),((e={})[SA]=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]}})})},VA.prototype.onSubChange=function(n){var r,i;return Is(this,void 0,void 0,function(){var e;return Ss(this,function(t){switch(t.label){case 0:return n.newSubscription?[3,2]:[4,xA(this.firebaseDependencies,self.registration)];case 1:return t.sent(),[2];case 2:return[4,_A(this.firebaseDependencies)];case 3:return e=t.sent(),[4,xA(this.firebaseDependencies,self.registration)];case 4:return t.sent(),[4,DA(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:TA)];case 5:return t.sent(),[2]}})})},VA.prototype.onNotificationClick=function(s){var a,u;return Is(this,void 0,void 0,function(){var n,r,i,o;return Ss(this,function(t){switch(t.label){case 0:return!(n=null===(u=null===(a=s.notification)||void 0===a?void 0:a.data)||void 0===u?void 0:u[SA])||s.action?[2]:(s.stopImmediatePropagation(),s.notification.close(),(r=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||(MA(t.data)?self.location.origin:null)}(n))?[4,function(u){return Is(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),[4,qA()];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).host===e.host)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]}})})}(r)]:[2]);case 1:return(i=t.sent())?[3,4]:[4,self.clients.openWindow(r)];case 2:return i=t.sent(),[4,(e=3e3,new Promise(function(t){setTimeout(t,e)}))];case 3:return t.sent(),[3,6];case 4:return[4,i.focus()];case 5:i=t.sent(),t.label=6;case 6:return i?(o=BA(RA.NOTIFICATION_CLICKED,n),[2,i.postMessage(o)]):[2]}var e})})},VA);function VA(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 qA(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function BA(t,e){return{firebaseMessaging:{type:t,payload:e}}}var WA={isSupported:HA};function HA(){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 cA("App Configuration Object");if(!t.name)throw cA("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 cA(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(!HA())throw uA.create("unsupported-browser");return new(self&&"ServiceWorkerGlobalScope"in self?jA:FA)(n)},"PUBLIC").setServiceProps(WA));var GA="firebasestorage.googleapis.com",zA=(KA.prototype.codeProp=function(){return this.code},KA.prototype.codeEquals=function(t){return YA(t)===this.codeProp()},KA.prototype.serverResponseProp=function(){return this.serverResponse_},KA.prototype.setServerResponseProp=function(t){this.serverResponse_=t},Object.defineProperty(KA.prototype,"name",{get:function(){return this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(KA.prototype,"code",{get:function(){return this.code_},enumerable:!0,configurable:!0}),Object.defineProperty(KA.prototype,"message",{get:function(){return this.message_},enumerable:!0,configurable:!0}),Object.defineProperty(KA.prototype,"serverResponse",{get:function(){return this.serverResponse_},enumerable:!0,configurable:!0}),KA);function KA(t,e){this.code_=YA(t),this.message_="Firebase Storage: "+e,this.serverResponse_=null,this.name_="FirebaseError"}var QA={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 YA(t){return"storage/"+t}function XA(){return new zA(QA.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function $A(){return new zA(QA.CANCELED,"User canceled the upload/download.")}function JA(){return new zA(QA.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function ZA(t,e,n){return new zA(QA.INVALID_ARGUMENT,"Invalid argument in `"+e+"` at index "+t+": "+n)}function tk(){return new zA(QA.APP_DELETED,"The Firebase app was deleted.")}function ek(t,e){return new zA(QA.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function nk(t){throw new zA(QA.INTERNAL_ERROR,"Internal error: "+t)}var rk={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};function ik(t){switch(t){case rk.RAW:case rk.BASE64:case rk.BASE64URL:case rk.DATA_URL:return;default:throw"Expected one of the event types: ["+rk.RAW+", "+rk.BASE64+", "+rk.BASE64URL+", "+rk.DATA_URL+"]."}}var ok=function(t,e){this.data=t,this.contentType=e||null};function sk(t,e){switch(t){case rk.RAW:return new ok(ak(e));case rk.BASE64:case rk.BASE64URL:return new ok(uk(t,e));case rk.DATA_URL:return new ok((n=new ck(e)).base64?uk(rk.BASE64,n.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(t){throw ek(rk.DATA_URL,"Malformed data URL.")}return ak(e)}(n.rest),new ck(e).contentType)}var n;throw XA()}function ak(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 uk(e,t){switch(e){case rk.BASE64:var n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r)throw ek(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case rk.BASE64URL:var i=-1!==t.indexOf("+"),o=-1!==t.indexOf("/");if(i||o)throw ek(e,"Invalid character '"+(i?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/")}var s;try{s=atob(t)}catch(t){throw ek(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 ck=function(t){this.base64=!1,this.contentType=null;var e=t.match(/^data:([^,]+)?,/);if(null===e)throw ek(rk.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");var n,r,i=e[1]||null;null!=i&&(this.base64=(r=";base64",(n=i).length>=r.length&&n.substring(n.length-r.length)===r),this.contentType=this.base64?i.substring(0,i.length-";base64".length):i),this.rest=t.substring(t.indexOf(",")+1)};var hk,lk,fk={STATE_CHANGED:"state_changed"},pk="running",dk="pausing",vk="paused",yk="success",gk="canceling",mk="canceled",bk="error",_k={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function wk(t){switch(t){case pk:case dk:case gk:return _k.RUNNING;case vk:return _k.PAUSED;case yk:return _k.SUCCESS;case mk:return _k.CANCELED;case bk:default:return _k.ERROR}}function Ek(t){return null!=t}function Tk(t){return void 0!==t}function Ik(t){return"function"==typeof t}function Sk(t){return"object"==typeof t}function Ck(t){return"string"==typeof t||t instanceof String}function Nk(t){return"number"==typeof t||t instanceof Number}function Ak(t){return kk()&&t instanceof Blob}function kk(){return"undefined"!=typeof Blob}(lk=hk=hk||{})[lk.NO_ERROR=0]="NO_ERROR",lk[lk.NETWORK_ERROR=1]="NETWORK_ERROR",lk[lk.ABORT=2]="ABORT";var Ok=(Rk.prototype.send=function(t,e,n,r){if(this.sent_)throw nk("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(e,t,!0),Ek(r))for(var i in r)r.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,r[i].toString());return Ek(n)?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},Rk.prototype.getErrorCode=function(){if(!this.sent_)throw nk("cannot .getErrorCode() before sending");return this.errorCode_},Rk.prototype.getStatus=function(){if(!this.sent_)throw nk("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},Rk.prototype.getResponseText=function(){if(!this.sent_)throw nk("cannot .getResponseText() before sending");return this.xhr_.responseText},Rk.prototype.abort=function(){this.xhr_.abort()},Rk.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},Rk.prototype.addUploadProgressListener=function(t){Ek(this.xhr_.upload)&&this.xhr_.upload.addEventListener("progress",t)},Rk.prototype.removeUploadProgressListener=function(t){Ek(this.xhr_.upload)&&this.xhr_.upload.removeEventListener("progress",t)},Rk);function Rk(){var e=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=hk.NO_ERROR,this.sendPromise_=new Promise(function(t){e.xhr_.addEventListener("abort",function(){e.errorCode_=hk.ABORT,t(e)}),e.xhr_.addEventListener("error",function(){e.errorCode_=hk.NETWORK_ERROR,t(e)}),e.xhr_.addEventListener("load",function(){t(e)})})}var Pk=(Dk.prototype.createXhrIo=function(){return new Ok},Dk);function Dk(){}function xk(){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(kk())return new Blob(t);throw Error("This browser doesn't seem to support creating Blobs")}var Lk=(Mk.prototype.size=function(){return this.size_},Mk.prototype.type=function(){return this.type_},Mk.prototype.slice=function(t,e){if(Ak(this.data_)){var n=this.data_,r=(o=t,s=e,(i=n).webkitSlice?i.webkitSlice(o,s):i.mozSlice?i.mozSlice(o,s):i.slice?i.slice(o,s):null);return null===r?null:new Mk(r)}var i,o,s;return new Mk(new Uint8Array(this.data_.buffer,t,e-t),!0)},Mk.getBlob=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(kk()){var n=t.map(function(t){return t instanceof Mk?t.data_:t});return new Mk(xk.apply(null,n))}var r=t.map(function(t){return Ck(t)?sk(rk.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 Mk(o,!0)},Mk.prototype.uploadData=function(){return this.data_},Mk);function Mk(t,e){var n=0,r="";Ak(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 Fk=(Object.defineProperty(Uk.prototype,"path",{get:function(){return this.path_},enumerable:!0,configurable:!0}),Object.defineProperty(Uk.prototype,"isRoot",{get:function(){return 0===this.path.length},enumerable:!0,configurable:!0}),Uk.prototype.fullServerUrl=function(){var t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)},Uk.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},Uk.makeFromBucketSpec=function(e){var t,n;try{t=Uk.makeFromUrl(e)}catch(t){return new Uk(e,"")}if(""===t.path)return t;throw n=e,new zA(QA.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")},Uk.makeFromUrl=function(t){var e=null,n="([A-Za-z0-9.\\-_]+)",r=new RegExp("^gs://"+n+"(/(.*))?$","i");function i(t){t.path_=decodeURIComponent(t.path)}for(var o,s=GA.replace(/[.]/g,"\\."),a=[{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?://"+s+"/v[A-Za-z0-9_]+/b/"+n+"/o(/([^?#]*).*)?$","i"),indices:{bucket:1,path:3},postModify:i},{regex:new RegExp("^https?://(?:storage.googleapis.com|storage.cloud.google.com)/"+n+"/([^?#]*)","i"),indices:{bucket:1,path:2},postModify:i}],u=0;u<a.length;u++){var c=a[u],h=c.regex.exec(t);if(h){var l=h[c.indices.bucket],f=h[c.indices.path];e=new Uk(l,f=f||""),c.postModify(e);break}}if(null==e)throw o=t,new zA(QA.INVALID_URL,"Invalid URL '"+o+"'.");return e},Uk);function Uk(t,e){this.bucket=t,this.path_=e}function jk(t){var e,n;try{e=JSON.parse(t)}catch(t){return null}return Sk(n=e)&&!Array.isArray(n)?e:null}function Vk(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function qk(t){return"https://"+GA+"/v0"+t}function Bk(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 Wk(t,e){return e}var Hk=function(t,e,n,r){this.server=t,this.local=e||t,this.writable=!!n,this.xform=r||Wk},Gk=null;function zk(){if(Gk)return Gk;var t=[];t.push(new Hk("bucket")),t.push(new Hk("generation")),t.push(new Hk("metageneration")),t.push(new Hk("name","fullPath",!0));var e=new Hk("name");e.xform=function(t,e){return!Ck(n=e)||n.length<2?n:Vk(n);var n},t.push(e);var n=new Hk("size");return n.xform=function(t,e){return Ek(e)?Number(e):e},t.push(n),t.push(new Hk("timeCreated")),t.push(new Hk("updated")),t.push(new Hk("md5Hash",null,!0)),t.push(new Hk("cacheControl",null,!0)),t.push(new Hk("contentDisposition",null,!0)),t.push(new Hk("contentEncoding",null,!0)),t.push(new Hk("contentLanguage",null,!0)),t.push(new Hk("contentType",null,!0)),t.push(new Hk("metadata","customMetadata",!0)),Gk=t}function Kk(r,i){Object.defineProperty(r,"ref",{get:function(){var t=r.bucket,e=r.fullPath,n=new Fk(t,e);return i.makeStorageReference(n)}})}function Qk(t,e,n){var r=jk(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 Kk(r,t),r}(t,r,n)}function Yk(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 Xk(t){if(!Sk(t)||!t)throw"Expected Metadata object.";for(var e in t)if(t.hasOwnProperty(e)){var n=t[e];if("customMetadata"===e){if(!Sk(n))throw"Expected object for 'customMetadata' mapping."}else if(Sk(r=n)&&null!==r)throw"Mapping for '"+e+"' cannot be an object."}var r}var $k="maxResults",Jk=1e3,Zk="pageToken",tO="prefixes",eO="items";function nO(t,e,n){var r=jk(n);return null===r?null:function(t,e,n){var r={prefixes:[],items:[],nextPageToken:n.nextPageToken};if(n[tO])for(var i=0,o=n[tO];i<o.length;i++){var s=o[i].replace(/\/$/,""),a=t.makeStorageReference(new Fk(e,s));r.prefixes.push(a)}if(n[eO])for(var u=0,c=n[eO];u<c.length;u++){var h=c[u];a=t.makeStorageReference(new Fk(e,h.name));r.items.push(a)}return r}(t,e,r)}function rO(t){if(!Sk(t)||!t)throw"Expected ListOptions object.";for(var e in t)if(e===$k){if(!Nk(n=t[$k])||!Number.isInteger(n)||t[$k]<=0)throw"Expected maxResults to be a positive number.";if(1e3<t[$k])throw"Expected maxResults to be less than or equal to "+Jk+"."}else{if(e!==Zk)throw"Unknown option: "+e;if(t[Zk]&&!Ck(t[Zk]))throw"Expected pageToken to be string."}var n}var iO=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 oO(t){if(!t)throw XA()}function sO(r,i){return function(t,e){var n=Qk(r,e,i);return oO(null!==n),n}}function aO(r,i){return function(t,e){var n=nO(r,i,e);return oO(null!==n),n}}function uO(r,i){return function(t,e){var n=Qk(r,e,i);return oO(null!==n),function(r,t){var e=jk(t);if(null===e)return null;if(!Ck(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 qk("/b/"+i(e)+"/o/"+i(n))+Bk({alt:"media",token:t})})[0]}(n,e)}}function cO(o){return function(t,e){var n,r,i;return(n=401===t.getStatus()?new zA(QA.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(i=o.bucket,new zA(QA.QUOTA_EXCEEDED,"Quota for bucket '"+i+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(r=o.path,new zA(QA.UNAUTHORIZED,"User does not have permission to access '"+r+"'.")):e).setServerResponseProp(e.serverResponseProp()),n}}function hO(i){var o=cO(i);return function(t,e){var n,r=o(t,e);return 404===t.getStatus()&&(n=i.path,r=new zA(QA.OBJECT_NOT_FOUND,"Object '"+n+"' does not exist.")),r.setServerResponseProp(e.serverResponseProp()),r}}function lO(t,e,n){var r=qk(e.fullServerUrl()),i=t.maxOperationRetryTime(),o=new iO(r,"GET",sO(t,n),i);return o.errorHandler=hO(e),o}function fO(t,e,n){var r,i,o=Object.assign({},n);return o.fullPath=t.path,o.size=e.size(),o.contentType||(o.contentType=(i=e,(r=null)&&r.contentType||i&&i.type()||"application/octet-stream")),o}function pO(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=fO(e,r,i),c="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+Yk(u,n)+"\r\n--"+a+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",h="\r\n--"+a+"--",l=Lk.getBlob(c,r,h);if(null===l)throw JA();var f={name:u.fullPath},p=qk(o),d=t.maxUploadRetryTime(),v=new iO(p,"POST",sO(t,n),d);return v.urlParams=f,v.headers=s,v.body=l.uploadData(),v.errorHandler=cO(e),v}var dO=function(t,e,n,r){this.current=t,this.total=e,this.finalized=!!n,this.metadata=r||null};function vO(t,e){var n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){oO(!1)}return oO(!!n&&-1!==(e||["active"]).indexOf(n)),n}function yO(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),s=fO(e,r,i),a={name:s.fullPath},u=qk(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=Yk(s,n),l=t.maxUploadRetryTime();var f=new iO(u,"POST",function(t){var e;vO(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){oO(!1)}return oO(Ck(e)),e},l);return f.urlParams=a,f.headers=c,f.body=h,f.errorHandler=cO(e),f}function gO(t,e,n,i){var r=t.maxUploadRetryTime(),o=new iO(n,"POST",function(t){var e=vO(t,["active","final"]),n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){oO(!1)}n||oO(!1);var r=Number(n);return oO(!isNaN(r)),new dO(r,i.size(),"final"===e)},r);return o.headers={"X-Goog-Upload-Command":"query"},o.errorHandler=cO(e),o}function mO(t,s,e,a,n,u,r,i){var c=new dO(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 zA(QA.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 JA();var v=s.maxUploadRetryTime(),y=new iO(e,"POST",function(t,e){var n,r=vO(t,["active","final"]),i=c.current+h,o=a.size();return n="final"===r?sO(s,u)(t,e):null,new dO(i,o,"final"===r,n)},v);return y.headers=p,y.body=d.uploadData(),y.progressCallback=i||null,y.errorHandler=cO(t),y}var bO=function(t,e,n){if(Ik(t)||Ek(e)||Ek(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}},_O=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 wO(e,t,n){for(var r=t.length,i=t.length,o=0;o<t.length;o++)if(t[o].optional){r=o;break}var s,a,u,c,h,l;if(!(r<=n.length&&n.length<=i))throw s=r,a=i,u=e,c=n.length,l=s===a?1===(h=s)?"argument":"arguments":(h="between "+s+" and "+a,"arguments"),new zA(QA.INVALID_ARGUMENT_COUNT,"Invalid argument count in `"+u+"`: Expected "+h+" "+l+", received "+c+".");for(o=0;o<n.length;o++)try{t[o].validator(n[o])}catch(t){throw t instanceof Error?ZA(o,e,t.message):ZA(o,e,t)}}var EO=function(e,t){var n=this;this.validator=function(t){n.optional&&!Tk(t)||e(t)},this.optional=!!t};function TO(t,e){function n(t){if(!Ck(t))throw"Expected string."}var r,i,o;return r=t?(i=n,o=t,function(t){i(t),o(t)}):n,new EO(r,e)}function IO(){return new EO(function(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer||kk()&&t instanceof Blob))throw"Expected Blob or File."})}function SO(t){return new EO(Xk,t)}function CO(){return new EO(function(t){if(!(Nk(t)&&0<=t))throw"Expected a number 0 or greater."})}function NO(e,t){return new EO(function(t){if(!(null===t||Ek(t)&&t instanceof Object))throw"Expected an Object.";null!=e&&e(t)},t)}function AO(t){return new EO(function(t){if(!(null===t||Ik(t)))throw"Expected a Function."},t)}function kO(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 OO=(RO.prototype.makeProgressCallback_=function(){var e=this,n=this.transferred_;return function(t){return e.updateProgress_(n+t)}},RO.prototype.shouldDoResumable_=function(t){return 262144<t.size()},RO.prototype.start_=function(){this.state_===pk&&null===this.request_&&(this.resumable_?null===this.uploadUrl_?this.createResumable_():this.needToFetchStatus_?this.fetchStatus_():this.needToFetchMetadata_?this.fetchMetadata_():this.continueUpload_():this.oneShotUpload_())},RO.prototype.resolveToken_=function(e){var n=this;this.authWrapper_.getAuthToken().then(function(t){switch(n.state_){case pk:e(t);break;case gk:n.transition_(mk);break;case dk:n.transition_(vk)}})},RO.prototype.createResumable_=function(){var r=this;this.resolveToken_(function(t){var e=yO(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_)})},RO.prototype.fetchStatus_=function(){var r=this,i=this.uploadUrl_;this.resolveToken_(function(t){var e=gO(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_)})},RO.prototype.continueUpload_=function(){var r=this,i=262144*this.chunkMultiplier_,o=new dO(this.transferred_,this.blob_.size()),s=this.uploadUrl_;this.resolveToken_(function(t){var e;try{e=mO(r.location_,r.authWrapper_,s,r.blob_,i,r.mappings_,o,r.makeProgressCallback_())}catch(t){return r.error_=t,void r.transition_(bk)}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_(yk)):r.completeTransitions_()},r.errorHandler_)})},RO.prototype.increaseMultiplier_=function(){262144*this.chunkMultiplier_<33554432&&(this.chunkMultiplier_*=2)},RO.prototype.fetchMetadata_=function(){var r=this;this.resolveToken_(function(t){var e=lO(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_(yk)},r.metadataErrorHandler_)})},RO.prototype.oneShotUpload_=function(){var r=this;this.resolveToken_(function(t){var e=pO(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_(yk)},r.errorHandler_)})},RO.prototype.updateProgress_=function(t){var e=this.transferred_;this.transferred_=t,this.transferred_!==e&&this.notifyObservers_()},RO.prototype.transition_=function(t){if(this.state_!==t)switch(t){case gk:case dk:this.state_=t,null!==this.request_&&this.request_.cancel();break;case pk:var e=this.state_===vk;this.state_=t,e&&(this.notifyObservers_(),this.start_());break;case vk:this.state_=t,this.notifyObservers_();break;case mk:this.error_=$A(),this.state_=t,this.notifyObservers_();break;case bk:case yk:this.state_=t,this.notifyObservers_()}},RO.prototype.completeTransitions_=function(){switch(this.state_){case dk:this.transition_(vk);break;case gk:this.transition_(mk);break;case pk:this.start_()}},Object.defineProperty(RO.prototype,"snapshot",{get:function(){var t=wk(this.state_);return new _O(this.transferred_,this.blob_.size(),t,this.metadata_,this,this.ref_)},enumerable:!0,configurable:!0}),RO.prototype.on=function(t,e,n,o){var r="Expected a function or an Object with one of `next`, `error`, `complete` properties.",i=AO(!0).validator,s=NO(null,!0).validator;function a(t){try{return void i(t)}catch(t){}try{if(s(t),!(Tk(t.next)||Tk(t.error)||Tk(t.complete)))throw"";return}catch(t){throw r}}wO("on",[TO(function(){if(t!==fk.STATE_CHANGED)throw"Expected one of the event types: ["+fk.STATE_CHANGED+"]."}),NO(a,!0),AO(!0),AO(!0)],arguments);var u=this;function c(i){return function(t,e,n){null!==i&&wO("on",i,arguments);var r=new bO(t,e,o);return u.addObserver_(r),function(){u.removeObserver_(r)}}}var h=[NO(function(t){if(null===t)throw r;a(t)}),AO(!0),AO(!0)];return Tk(e)||Tk(n)||Tk(o)?c(null)(e,n,o):c(h)},RO.prototype.then=function(t,e){return this.promise_.then(t,e)},RO.prototype.catch=function(t){return this.then(null,t)},RO.prototype.addObserver_=function(t){this.observers_.push(t),this.notifyObserver_(t)},RO.prototype.removeObserver_=function(t){var e=this.observers_.indexOf(t);-1!==e&&this.observers_.splice(e,1)},RO.prototype.notifyObservers_=function(){var e=this;this.finishPromise_(),this.observers_.slice().forEach(function(t){e.notifyObserver_(t)})},RO.prototype.finishPromise_=function(){if(null!==this.resolve_){var t=!0;switch(wk(this.state_)){case _k.SUCCESS:kO(this.resolve_.bind(null,this.snapshot))();break;case _k.CANCELED:case _k.ERROR:kO(this.reject_.bind(null,this.error_))();break;default:t=!1}t&&(this.resolve_=null,this.reject_=null)}},RO.prototype.notifyObserver_=function(t){switch(wk(this.state_)){case _k.RUNNING:case _k.PAUSED:t.next&&kO(t.next.bind(t,this.snapshot))();break;case _k.SUCCESS:t.complete&&kO(t.complete.bind(t))();break;case _k.CANCELED:case _k.ERROR:t.error&&kO(t.error.bind(t,this.error_))();break;default:t.error&&kO(t.error.bind(t,this.error_))()}},RO.prototype.resume=function(){wO("resume",[],arguments);var t=this.state_===vk||this.state_===dk;return t&&this.transition_(pk),t},RO.prototype.pause=function(){wO("pause",[],arguments);var t=this.state_===pk;return t&&this.transition_(dk),t},RO.prototype.cancel=function(){wO("cancel",[],arguments);var t=this.state_===pk||this.state_===dk;return t&&this.transition_(gk),t},RO);function RO(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_=pk,this.errorHandler_=function(t){s.request_=null,s.chunkMultiplier_=1,t.codeEquals(QA.CANCELED)?(s.needToFetchStatus_=!0,s.completeTransitions_()):(s.error_=t,s.transition_(bk))},this.metadataErrorHandler_=function(t){s.request_=null,t.codeEquals(QA.CANCELED)?s.completeTransitions_():(s.error_=t,s.transition_(bk))},this.promise_=new Promise(function(t,e){s.resolve_=t,s.reject_=e,s.start_()}),this.promise_.then(null,function(){})}var PO=(DO.prototype.toString=function(){return wO("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},DO.prototype.newRef=function(t,e){return new DO(t,e)},DO.prototype.mappings=function(){return zk()},DO.prototype.child=function(t){wO("child",[TO()],arguments);var e,n,r=(e=this.location.path,n=t.split("/").filter(function(t){return 0<t.length}).join("/"),0===e.length?n:e+"/"+n),i=new Fk(this.location.bucket,r);return this.newRef(this.authWrapper,i)},Object.defineProperty(DO.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 Fk(this.location.bucket,t);return this.newRef(this.authWrapper,e)},enumerable:!0,configurable:!0}),Object.defineProperty(DO.prototype,"root",{get:function(){var t=new Fk(this.location.bucket,"");return this.newRef(this.authWrapper,t)},enumerable:!0,configurable:!0}),Object.defineProperty(DO.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!0,configurable:!0}),Object.defineProperty(DO.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!0,configurable:!0}),Object.defineProperty(DO.prototype,"name",{get:function(){return Vk(this.location.path)},enumerable:!0,configurable:!0}),Object.defineProperty(DO.prototype,"storage",{get:function(){return this.authWrapper.service()},enumerable:!0,configurable:!0}),DO.prototype.put=function(t,e){return void 0===e&&(e=null),wO("put",[IO(),SO(!0)],arguments),this.throwIfRoot_("put"),new OO(this,this.authWrapper,this.location,this.mappings(),new Lk(t),e)},DO.prototype.putString=function(t,e,n){void 0===e&&(e=rk.RAW),wO("putString",[TO(),TO(ik,!0),SO(!0)],arguments),this.throwIfRoot_("putString");var r=sk(e,t),i=Object.assign({},n);return!Ek(i.contentType)&&Ek(r.contentType)&&(i.contentType=r.contentType),new OO(this,this.authWrapper,this.location,this.mappings(),new Lk(r.data,!0),i)},DO.prototype.delete=function(){var a=this;return wO("delete",[],arguments),this.throwIfRoot_("delete"),this.authWrapper.getAuthToken().then(function(t){var e,n,r,i,o,s=(e=a.authWrapper,n=a.location,r=qk(n.fullServerUrl()),i=e.maxOperationRetryTime(),(o=new iO(r,"DELETE",function(t,e){},i)).successCodes=[200,204],o.errorHandler=hO(n),o);return a.authWrapper.makeRequest(s,t).getPromise()})},DO.prototype.listAll=function(){wO("listAll",[],arguments);var t={prefixes:[],items:[]};return this.listAllHelper(t).then(function(){return t})},DO.prototype.listAllHelper=function(o,s){return Is(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]}})})},DO.prototype.list=function(r){wO("list",[new EO(rO,!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=qk(e.bucketOnlyServerUrl()),a=t.maxOperationRetryTime(),u=new iO(s,"GET",aO(t,e.bucket),a);return u.urlParams=o,u.errorHandler=cO(e),u}(i.authWrapper,i.location,"/",e.pageToken,e.maxResults);return i.authWrapper.makeRequest(n,t).getPromise()})},DO.prototype.getMetadata=function(){var n=this;return wO("getMetadata",[],arguments),this.throwIfRoot_("getMetadata"),this.authWrapper.getAuthToken().then(function(t){var e=lO(n.authWrapper,n.location,n.mappings());return n.authWrapper.makeRequest(e,t).getPromise()})},DO.prototype.updateMetadata=function(h){var l=this;return wO("updateMetadata",[SO()],arguments),this.throwIfRoot_("updateMetadata"),this.authWrapper.getAuthToken().then(function(t){var e,n,r,i,o,s,a,u,c=(e=l.authWrapper,n=l.location,r=h,i=l.mappings(),o=qk(n.fullServerUrl()),s=Yk(r,i),a=e.maxOperationRetryTime(),(u=new iO(o,"PATCH",sO(e,i),a)).headers={"Content-Type":"application/json; charset=utf-8"},u.body=s,u.errorHandler=hO(n),u);return l.authWrapper.makeRequest(c,t).getPromise()})},DO.prototype.getDownloadURL=function(){var u=this;return wO("getDownloadURL",[],arguments),this.throwIfRoot_("getDownloadURL"),this.authWrapper.getAuthToken().then(function(t){var e,n,r,i,o,s,a=(e=u.authWrapper,n=u.location,r=u.mappings(),i=qk(n.fullServerUrl()),o=e.maxOperationRetryTime(),(s=new iO(i,"GET",uO(e,r),o)).errorHandler=hO(n),s);return u.authWrapper.makeRequest(a,t).getPromise().then(function(t){if(null===t)throw new zA(QA.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return t})})},DO.prototype.throwIfRoot_=function(t){if(""===this.location.path)throw e=t,new zA(QA.INVALID_ROOT_OPERATION,"The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').");var e},DO);function DO(t,e){this.authWrapper=t,this.location=e instanceof Fk?e:Fk.makeFromUrl(e)}var xO=(LO.prototype.getPromise=function(){return this.promise_},LO.prototype.cancel=function(t){},LO);function LO(t){this.promise_=Promise.reject(t)}var MO=(FO.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)})},FO.prototype.clear=function(){this.map.forEach(function(t){t&&t.cancel(!0)}),this.map.clear()},FO);function FO(){this.map=new Map,this.id=-9007199254740991}var UO=(jO.extractBucket_=function(t){var e=t.storageBucket||null;return null==e?null:Fk.makeFromBucketSpec(e).bucket},jO.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)},jO.prototype.bucket=function(){if(this.deleted_)throw tk();return this.bucket_},jO.prototype.service=function(){return this.service_},jO.prototype.makeStorageReference=function(t){return this.storageRefMaker_(this,t)},jO.prototype.makeRequest=function(t,e){if(this.deleted_)return new xO(tk());var n=this.requestMaker_(t,this.appId_,e,this.pool_);return this.requestMap_.addRequest(n),n},jO.prototype.deleteApp=function(){this.deleted_=!0,this.app_=null,this.requestMap_.clear()},jO.prototype.maxUploadRetryTime=function(){return this.maxUploadRetryTime_},jO.prototype.setMaxUploadRetryTime=function(t){this.maxUploadRetryTime_=t},jO.prototype.maxOperationRetryTime=function(){return this.maxOperationRetryTime_},jO.prototype.setMaxOperationRetryTime=function(t){this.maxOperationRetryTime_=t},jO);function jO(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;Ek(a)&&(this.bucket_=jO.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 MO}var VO=(qO.prototype.start_=function(){var e,n,t,r,i,o,s,a,u,c=this;function h(t,e){var n,r=c.resolve_,i=c.reject_,o=e.xhr;if(e.wasSuccessCode)try{var s=c.callback_(o,o.getResponseText());Tk(s)?r(s):r()}catch(t){i(t)}else null!==o?((n=XA()).setServerResponseProp(o.getResponseText()),c.errorCallback_?i(c.errorCallback_(o,n)):i(n)):e.canceled?i(n=(c.appDelete_?tk:$A)()):i(n=new zA(QA.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again."))}function l(){return 2===s}function f(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];a||(a=!0,n.apply(null,t))}function p(t){i=setTimeout(function(){i=null,e(d,l())},t)}function d(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];a||(t||l()||o?f.call.apply(f,ks([null,t],e)):(r<64&&(r*=2),p(1===s?(s=2,0):1e3*(r+Math.random()))))}function v(t){u||(u=!0,a||(null!==i?(t||(s=2),clearTimeout(i),p(0)):t||(s=1)))}this.canceled_?h(0,new BO(!1,null,!0)):this.backoffId_=(e=function(o,t){if(t)o(!1,new BO(!1,null,!0));else{var e=c.pool_.createXhrIo();c.pendingXhr_=e,null!==c.progressCallback_&&e.addUploadProgressListener(s),e.send(c.url_,c.method_,c.body_,c.headers_).then(function(t){null!==c.progressCallback_&&t.removeUploadProgressListener(s),c.pendingXhr_=null;var e=(t=t).getErrorCode()===hk.NO_ERROR,n=t.getStatus();if(e&&!c.isRetryStatusCode_(n)){var r=-1!==c.successCodes_.indexOf(n);o(!0,new BO(r,t))}else{var i=t.getErrorCode()===hk.ABORT;o(!1,new BO(!1,null,i))}})}function s(t){var e=t.loaded,n=t.lengthComputable?t.total:-1;null!==c.progressCallback_&&c.progressCallback_(e,n)}},n=h,t=this.timeout_,i=null,u=a=o=!(r=1),p(s=0),setTimeout(function(){v(o=!0)},t),v)},qO.prototype.getPromise=function(){return this.promise_},qO.prototype.cancel=function(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingXhr_&&this.pendingXhr_.abort()},qO.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},qO);function qO(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 BO=function(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n};function WO(t,e,n,r){var i,o,s,a,u,c,h=Bk(t.urlParams),l=t.url+h,f=Object.assign({},t.headers);return i=f,(o=e)&&(i["X-Firebase-GMPID"]=o),s=f,null!==(a=n)&&0<a.length&&(s.Authorization="Firebase "+a),u=f,c=void 0!==Kl?Kl.SDK_VERSION:"AppManager",u["X-Firebase-Storage-Version"]="webjs/"+c,new VO(l,t.method,f,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,r)}var HO=(GO.prototype.ref=function(t){if(wO("ref",[TO(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 PO(this.authWrapper_,this.bucket_);return null!=t?e.child(t):e},GO.prototype.refFromURL=function(t){return wO("refFromURL",[TO(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{Fk.makeFromUrl(t)}catch(t){throw"Expected valid full URL but got an invalid one."}},!1)],arguments),new PO(this.authWrapper_,t)},Object.defineProperty(GO.prototype,"maxUploadRetryTime",{get:function(){return this.authWrapper_.maxUploadRetryTime()},enumerable:!0,configurable:!0}),GO.prototype.setMaxUploadRetryTime=function(t){wO("setMaxUploadRetryTime",[CO()],arguments),this.authWrapper_.setMaxUploadRetryTime(t)},GO.prototype.setMaxOperationRetryTime=function(t){wO("setMaxOperationRetryTime",[CO()],arguments),this.authWrapper_.setMaxOperationRetryTime(t)},Object.defineProperty(GO.prototype,"app",{get:function(){return this.app_},enumerable:!0,configurable:!0}),Object.defineProperty(GO.prototype,"INTERNAL",{get:function(){return this.internals_},enumerable:!0,configurable:!0}),GO);function GO(t,e,n,r){if(this.bucket_=null,this.authWrapper_=new UO(t,e,function(t,e){return new PO(t,e)},WO,this,n),this.app_=t,null!=r)this.bucket_=Fk.makeFromBucketSpec(r);else{var i=this.authWrapper_.bucket();null!=i&&(this.bucket_=new Fk(i,""))}this.internals_=new zO(this)}var zO=(KO.prototype.delete=function(){return this.service_.authWrapper_.deleteApp(),Promise.resolve()},KO);function KO(t){this.service_=t}var QO,YO;function XO(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal");return new HO(n,r,new Pk,e)}YO={TaskState:_k,TaskEvent:fk,StringFormat:rk,Storage:HO,Reference:PO},(QO=Kl).INTERNAL.registerComponent(new da("storage",XO,"PUBLIC").setServiceProps(YO).setMultipleInstances(!0)),QO.registerVersion("@firebase/storage","0.3.34");var $O,JO,ZO,tR,eR="0.3.5",nR="FB-PERF-TRACE-MEASURE",rR="@firebase/performance/config",iR="@firebase/performance/configexpire",oR="Performance",sR=(($O={})["trace started"]="Trace {$traceName} was started before.",$O["trace stopped"]="Trace {$traceName} is not running.",$O["no window"]="Window is not available.",$O["no app id"]="App id is not available.",$O["no project id"]="Project id is not available.",$O["no api key"]="Api key is not available.",$O["invalid cc log"]="Attempted to queue invalid cc event",$O["FB not default"]="Performance can only start when Firebase app instance is the default one.",$O["RC response not ok"]="RC response is not ok",$O["invalid attribute name"]="Attribute name {$attributeName} is invalid.",$O["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",$O["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",$O["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",$O),aR=new Ks("performance",oR,sR),uR=(cR.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},cR.prototype.mark=function(t){this.performance&&this.performance.mark&&this.performance.mark(t)},cR.prototype.measure=function(t,e,n){this.performance&&this.performance.measure&&this.performance.measure(t,e,n)},cR.prototype.getEntriesByType=function(t){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(t):[]},cR.prototype.getEntriesByName=function(t){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(t):[]},cR.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},cR.prototype.requiredApisAvailable=function(){return!!(fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled)},cR.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]})},cR.getInstance=function(){return void 0===JO&&(JO=new cR(ZO)),JO},cR);function cR(t){if(!(this.window=t))throw aR.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)}function hR(t,e){var n=t.length-e.length;if(n<0||1<n)throw aR.create("invalid String merger input");for(var r=[],i=0;i<t.length;i++)r.push(t.charAt(i)),e.length>i&&r.push(e.charAt(i));return r.join("")}var lR,fR,pR,dR=(vR.prototype.getAppId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!t)throw aR.create("no app id");return t},vR.prototype.getProjectId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!t)throw aR.create("no project id");return t},vR.prototype.getApiKey=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!t)throw aR.create("no api key");return t},vR.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},vR.getInstance=function(){return void 0===tR&&(tR=new vR),tR},vR);function vR(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.tracesSamplingRate=1,this.networkRequestsSamplingRate=1,this.logEndPointUrl="https://firebaselogging.googleapis.com/v0cc/log?format=json_proto",this.flTransportEndpointUrl=hR("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=hR("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}function yR(){return lR}(pR=fR=fR||{})[pR.UNKNOWN=0]="UNKNOWN",pR[pR.VISIBLE=1]="VISIBLE",pR[pR.HIDDEN=2]="HIDDEN";var gR=["firebase_","google_","ga_"],mR=new RegExp("^[a-zA-Z]\\w*$");function bR(){switch(uR.getInstance().document.visibilityState){case"visible":return fR.VISIBLE;case"hidden":return fR.HIDDEN;default:return fR.UNKNOWN}}var _R=new Ra(oR);_R.logLevel=Ta.INFO;var wR="0.0.1",ER={loggingEnabled:!0},TR="FIREBASE_INSTALLATIONS_AUTH";function IR(t){var r,e=function(){var t=uR.getInstance().localStorage;if(!t)return;var e=t.getItem(iR);if(!e||!function(t){return Number(t)>Date.now()}(e))return;var n=t.getItem(rR);if(!n)return;try{return JSON.parse(n)}catch(t){return}}();return e?(CR(e),Promise.resolve()):(r=t,function(){var t=dR.getInstance().installationsService.getToken();return t.then(function(t){}),t}().then(function(t){var e="https://firebaseremoteconfig.googleapis.com/v1/projects/"+dR.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+dR.getInstance().getApiKey(),n=new Request(e,{method:"POST",headers:{Authorization:TR+" "+t},body:JSON.stringify({app_instance_id:r,app_instance_id_token:t,app_id:dR.getInstance().getAppId(),app_version:eR,sdk_version:wR})});return fetch(n).then(function(t){if(t.ok)return t.json();throw aR.create("RC response not ok")})}).catch(function(){_R.info(SR)}).then(CR).then(function(t){return function(t){var e=uR.getInstance().localStorage;if(!t||!e)return;e.setItem(rR,JSON.stringify(t)),e.setItem(iR,String(Date.now()+60*dR.getInstance().configTimeToLive*60*1e3))}(t)},function(){}))}var SR="Could not fetch config, will use default configs";function CR(t){if(!t)return t;var e=dR.getInstance(),n=t.entries||{};return e.loggingEnabled=void 0!==n.fpr_enabled?"true"===String(n.fpr_enabled):ER.loggingEnabled,n.fpr_log_source&&(e.logSource=Number(n.fpr_log_source)),n.fpr_log_endpoint_url&&(e.logEndPointUrl=n.fpr_log_endpoint_url),n.fpr_log_transport_key&&(e.transportKey=n.fpr_log_transport_key),void 0!==n.fpr_vc_network_request_sampling_rate&&(e.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate)),void 0!==n.fpr_vc_trace_sampling_rate&&(e.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate)),e.logTraceAfterSampling=NR(e.tracesSamplingRate),e.logNetworkAfterSampling=NR(e.networkRequestsSamplingRate),t}function NR(t){return Math.random()<=t}var AR,kR=1;function OR(){return kR=2,AR=AR||function(){var n=uR.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(t=dR.getInstance().installationsService.getId()).then(function(t){lR=t}),t;var t}).then(function(t){return IR(t)}).then(function(){return RR()},function(){return RR()})}function RR(){kR=3}var PR,DR=1e4,xR=5500,LR=3,MR=LR,FR=[],UR=!1;function jR(t){setTimeout(function(){if(0!==MR)return FR.length?void function(){var t=ks(FR);FR=[];var e=t.map(function(t){return{source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)}});(function(t,i){return function(t){var e=dR.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then(function(t){return t.ok||_R.info("Call to Firebase backend failed."),t.json()}).then(function(t){var e=Number(t.nextRequestWaitMillis),n=DR;isNaN(e)||(n=Math.max(e,n));var r=t.logResponseDetails;Array.isArray(r)&&0<r.length&&"RETRY_REQUEST_LATER"===r[0].responseAction&&(FR=ks(i,FR),_R.info("Retry transport request later.")),MR=LR,jR(n)})})({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:dR.getInstance().logSource,log_event:e},t).catch(function(){FR=ks(t,FR),MR--,_R.info("Tries left: "+MR+"."),jR(DR)})}():jR(DR)},t)}function VR(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];!function(t){if(!t.eventTime||!t.message)throw aR.create("invalid cc log");FR=ks(FR,[t])}({message:n.apply(void 0,t),eventTime:Date.now()})}}function qR(t,e){(PR=PR||VR(HR))(t,e)}function BR(t){var e=dR.getInstance();!e.instrumentationEnabled&&t.isAuto||(e.dataCollectionEnabled||t.isAuto)&&uR.getInstance().requiredApisAvailable()&&(t.isAuto&&bR()!==fR.VISIBLE||e.loggingEnabled&&e.logTraceAfterSampling&&(3===kR?WR(t):OR().then(function(){return WR(t)},function(){return WR(t)})))}function WR(t){yR()&&setTimeout(function(){return qR(t,1)},0)}function HR(t,e){return 0===e?(r={url:(n=t).url,http_method:n.httpMethod||0,http_response_code:200,response_payload_bytes:n.responsePayloadBytes,client_start_time_us:n.startTimeUs,time_to_response_initiated_us:n.timeToResponseInitiatedUs,time_to_response_completed_us:n.timeToResponseCompletedUs},i={application_info:GR(),network_request_metric:r},JSON.stringify(i)):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:GR(),trace_metric:e};return JSON.stringify(r)}(t);var n,r,i}function GR(){return{google_app_id:dR.getInstance().getAppId(),app_instance_id:yR(),web_app_info:{sdk_version:eR,page_url:uR.getInstance().getUrl(),service_worker_status:"serviceWorker"in(t=uR.getInstance().navigator)?t.serviceWorker.controller?2:3:1,visibility_state:bR(),effective_connection_type:function(){var t=uR.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 t}var zR=["_fp","_fcp","_fid"];var KR=(QR.prototype.start=function(){if(1!==this.state)throw aR.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},QR.prototype.stop=function(){if(2!==this.state)throw aR.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(),BR(this)},QR.prototype.record=function(t,e,n){if(this.durationUs=Math.floor(1e3*e),this.startTimeUs=Math.floor(1e3*t),n&&n.attributes&&(this.customAttributes=Ts({},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])))}BR(this)},QR.prototype.incrementMetric=function(t,e){void 0===e&&(e=1),void 0===this.counters[t]&&this.putMetric(t,0),this.counters[t]+=e},QR.prototype.putMetric=function(t,e){if(n=t,r=this.name,0===n.length||100<n.length||!(r&&r.startsWith("_wt_")&&-1<zR.indexOf(n))&&n.startsWith("_"))throw aR.create("invalid custom metric name",{customMetricName:t});var n,r;this.counters[t]=e},QR.prototype.getMetric=function(t){return this.counters[t]||0},QR.prototype.putAttribute=function(t,e){var n,r,i=!(0===(n=t).length||40<n.length||gR.some(function(t){return n.startsWith(t)})||!n.match(mR)),o=0!==(r=e).length&&r.length<=100;if(i&&o)this.customAttributes[t]=e;else{if(!i)throw aR.create("invalid attribute name",{attributeName:t});if(!o)throw aR.create("invalid attribute value",{attributeValue:e})}},QR.prototype.getAttribute=function(t){return this.customAttributes[t]},QR.prototype.removeAttribute=function(t){void 0!==this.customAttributes[t]&&delete this.customAttributes[t]},QR.prototype.getAttributes=function(){return Ts({},this.customAttributes)},QR.prototype.setStartTime=function(t){this.startTimeUs=t},QR.prototype.setDuration=function(t){this.durationUs=t},QR.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())))},QR.createOobTrace=function(t,e,n){var r=uR.getInstance().getUrl();if(r){var i=new QR("_wt_"+r,!0),o=Math.floor(1e3*uR.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))}BR(i)}},QR.createUserTimingTrace=function(t){BR(new QR(t,!1,t))},QR);function QR(t,e,n){void 0===e&&(e=!1),this.name=t,this.isAuto=e,this.state=1,this.customAttributes={},this.counters={},this.api=uR.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||nR+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}function YR(t){var e=t;if(e&&void 0!==e.responseStart){var n=uR.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=dR.getInstance();if(e.instrumentationEnabled){var n=t.url,r=e.logEndPointUrl.split("?")[0],i=e.flTransportEndpointUrl.split("?")[0];n!==r&&n!==i&&e.loggingEnabled&&e.logNetworkAfterSampling&&setTimeout(function(){return qR(t,0)},0)}}({url:e.name&&e.name.split("?")[0],responsePayloadBytes:e.transferSize,startTimeUs:r,timeToResponseInitiatedUs:i,timeToResponseCompletedUs:o})}}var XR=5e3;function $R(){yR()&&(setTimeout(function(){return function(){var t=uR.getInstance(),e=t.getEntriesByType("navigation"),n=t.getEntriesByType("paint");if(t.onFirstInputDelay){var r=setTimeout(function(){KR.createOobTrace(e,n),r=void 0},XR);t.onFirstInputDelay(function(t){r&&(clearTimeout(r),KR.createOobTrace(e,n,t))})}else KR.createOobTrace(e,n)}()},0),setTimeout(function(){return function(){for(var t=uR.getInstance(),e=t.getEntriesByType("resource"),n=0,r=e;n<r.length;n++){YR(r[n])}t.setupObserver("resource",YR)}()},0),setTimeout(function(){return function(){for(var t=uR.getInstance(),e=t.getEntriesByType("measure"),n=0,r=e;n<r.length;n++){JR(r[n])}t.setupObserver("measure",JR)}()},0))}function JR(t){var e=t.name;e.substring(0,nR.length)!==nR&&KR.createUserTimingTrace(e)}var ZR=(tP.prototype.trace=function(t){return new KR(t)},Object.defineProperty(tP.prototype,"instrumentationEnabled",{get:function(){return dR.getInstance().instrumentationEnabled},set:function(t){dR.getInstance().instrumentationEnabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(tP.prototype,"dataCollectionEnabled",{get:function(){return dR.getInstance().dataCollectionEnabled},set:function(t){dR.getInstance().dataCollectionEnabled=t},enumerable:!0,configurable:!0}),tP);function tP(t){this.app=t,uR.getInstance().requiredApisAvailable()?(UR||(jR(xR),UR=!0),OR().then($R,$R)):_R.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled.")}var eP;function nP(t,e){if("[DEFAULT]"!==t.name)throw aR.create("FB not default");if("undefined"==typeof window)throw aR.create("no window");return ZO=window,dR.getInstance().firebaseAppInstance=t,dR.getInstance().installationsService=e,new ZR(t)}(eP=Kl).INTERNAL.registerComponent(new da("performance",function(t){var e=t.getProvider("app").getImmediate(),n=t.getProvider("installations").getImmediate();return nP(e,n)},"PUBLIC")),eP.registerVersion("@firebase/performance","0.3.5");var rP,iP,oP,sP,aP="measurementId",uP="firebase_id",cP="origin",hP="https://www.googletagmanager.com/gtag/js";(iP=rP=rP||{}).EVENT="event",iP.SET="set",iP.CONFIG="config",(sP=oP=oP||{}).ADD_SHIPPING_INFO="add_shipping_info",sP.ADD_PAYMENT_INFO="add_payment_info",sP.ADD_TO_CART="add_to_cart",sP.ADD_TO_WISHLIST="add_to_wishlist",sP.BEGIN_CHECKOUT="begin_checkout",sP.CHECKOUT_PROGRESS="checkout_progress",sP.EXCEPTION="exception",sP.GENERATE_LEAD="generate_lead",sP.LOGIN="login",sP.PAGE_VIEW="page_view",sP.PURCHASE="purchase",sP.REFUND="refund",sP.REMOVE_FROM_CART="remove_from_cart",sP.SCREEN_VIEW="screen_view",sP.SEARCH="search",sP.SELECT_CONTENT="select_content",sP.SELECT_ITEM="select_item",sP.SELECT_PROMOTION="select_promotion",sP.SET_CHECKOUT_OPTION="set_checkout_option",sP.SHARE="share",sP.SIGN_UP="sign_up",sP.TIMING_COMPLETE="timing_complete",sP.VIEW_CART="view_cart",sP.VIEW_ITEM="view_item",sP.VIEW_ITEM_LIST="view_item_list",sP.VIEW_PROMOTION="view_promotion",sP.VIEW_SEARCH_RESULTS="view_search_results";var lP,fP=new Ra("@firebase/analytics");function pP(t,n,e){var f,p,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]=(f=r,p=t,function(t,e,n){if(t===rP.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(rP.EVENT,e,n||{})}).catch(function(t){return fP.error(t)})}else t===rP.CONFIG?(p[e]||Promise.resolve()).then(function(){f(rP.CONFIG,e,n)}).catch(function(t){return fP.error(t)}):f(rP.SET,e)}),{gtagCore:r,wrappedGtag:window[e]}}var dP,vP,yP=((lP={})["no-ga-id"]='"'+aP+'" field is empty in Firebase config. Firebase Analytics requires this field to contain a valid measurement ID.',lP["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.",lP["already-initialized"]="Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.",lP["interop-component-reg-failed"]="Firebase Analytics Interop Component failed to instantiate",lP),gP=new Ks("analytics","Analytics",yP),mP={},bP="dataLayer",_P="gtag",wP=!1;function EP(t){if(wP)throw gP.create("already-initialized");t.dataLayerName&&(bP=t.dataLayerName),t.gtagName&&(_P=t.gtagName)}function TP(t,e){var n,r,i,o,c=t.options[aP];if(!c)throw gP.create("no-ga-id");if(null!=mP[c])throw gP.create("already-exists",{id:c});if(!wP){!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(hP))return r}}()&&(i=bP,(o=document.createElement("script")).src=hP+"?l="+i,o.async=!0,document.head.appendChild(o)),n=bP,r=[],Array.isArray(window[n])?r=window[n]:window[n]=r;var s=pP(mP,bP,_P),a=s.wrappedGtag,u=s.gtagCore;vP=a,dP=u,wP=!0}return mP[c]=function(r,i,o){return Is(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(rP.CONFIG,r.options[aP],((n={})[uP]=e,n[cP]="firebase",n.update=!0,n)),[2]}})})}(t,e,dP),{app:t,logEvent:function(t,e,n){return r=vP,i=c,o=t,u=(s=e)||{},(a=n)&&a.global||(u=Ts(Ts({},s),{send_to:i})),void r(rP.EVENT,o,u||{});var r,i,o,s,a,u},setCurrentScreen:function(t,e){return n=vP,r=c,i=t,void((o=e)&&o.global?n(rP.SET,{screen_name:i}):n(rP.CONFIG,r,{update:!0,screen_name:i}));var n,r,i,o},setUserId:function(t,e){return n=vP,r=c,i=t,void((o=e)&&o.global?n(rP.SET,{user_id:i}):n(rP.CONFIG,r,{update:!0,user_id:i}));var n,r,i,o},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(rP.SET,i)}else t(rP.CONFIG,e,{update:!0,user_properties:n})}(vP,c,t,e)},setAnalyticsCollectionEnabled:function(t){return e=t,void(window["ga-disable-"+c]=!e);var e}}}var IP,SP="analytics";(IP=Kl).INTERNAL.registerComponent(new da(SP,function(t){return TP(t.getProvider("app").getImmediate(),t.getProvider("installations").getImmediate())},"PUBLIC").setServiceProps({settings:EP,EventName:oP})),IP.INTERNAL.registerComponent(new da("analytics-internal",function(t){try{return{logEvent:t.getProvider(SP).getImmediate().logEvent}}catch(t){throw gP.create("interop-component-reg-failed",{reason:t})}},"PRIVATE")),IP.registerVersion("@firebase/analytics","0.3.5");var CP,NP=(AP.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},AP.prototype.fetch=function(s){return Is(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]}})})},AP);function AP(t,e,n,r){this.client=t,this.storage=e,this.storageCache=n,this.logger=r}var kP=((CP={})["registration-window"]="Undefined window object. This SDK only supports usage in a browser environment.",CP["registration-project-id"]="Undefined project identifier. Check Firebase app initialization.",CP["registration-api-key"]="Undefined API key. Check Firebase app initialization.",CP["registration-app-id"]="Undefined app identifier. Check Firebase app initialization.",CP["storage-open"]="Error thrown when opening storage. Original error: {$originalErrorMessage}.",CP["storage-get"]="Error thrown when reading from storage. Original error: {$originalErrorMessage}.",CP["storage-set"]="Error thrown when writing to storage. Original error: {$originalErrorMessage}.",CP["storage-delete"]="Error thrown when deleting from storage. Original error: {$originalErrorMessage}.",CP["fetch-client-network"]="Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.",CP["fetch-timeout"]='The config fetch request timed out. Configure timeout using "fetchTimeoutMillis" SDK setting.',CP["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}.',CP["fetch-client-parse"]="Fetch client could not parse response. Original error: {$originalErrorMessage}.",CP["fetch-status"]="Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.",CP),OP=new Ks("remoteconfig","Remote Config",kP);var RP=(PP.prototype.fetch=function(w){return Is(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,h,l,f,p,d,v,y,g,m,b,_;return Ss(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()])];case 1:n=t.sent(),r=n[0],i=n[1],o=window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com",s=o+"/v1/projects/"+this.projectId+"/namespaces/"+this.namespace+":fetch?key="+this.apiKey,a={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":w.eTag||"*"},u={sdk_version:this.sdkVersion,app_instance_id:r,app_instance_id_token:i,app_id:this.appId,language_code:(void 0===e&&(e=navigator),e.languages&&e.languages[0]||e.language)},c={method:"POST",headers:a,body:JSON.stringify(u)},h=fetch(s,c),l=new Promise(function(t,e){w.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([h,l])];case 3:return t.sent(),[4,h];case 4:return f=t.sent(),[3,6];case 5:throw p=t.sent(),d="fetch-client-network","AbortError"===p.name&&(d="fetch-timeout"),OP.create(d,{originalErrorMessage:p.message});case 6:if(v=f.status,y=f.headers.get("ETag")||void 0,200!==f.status)return[3,11];b=void 0,t.label=7;case 7:return t.trys.push([7,9,,10]),[4,f.json()];case 8:return b=t.sent(),[3,10];case 9:throw _=t.sent(),OP.create("fetch-client-parse",{originalErrorMessage:_.message});case 10:g=b.entries,m=b.state,t.label=11;case 11:if("INSTANCE_STATE_UNSPECIFIED"===m?v=500:"NO_CHANGE"===m?v=304:"NO_TEMPLATE"!==m&&"EMPTY_CONFIG"!==m||(g={}),304!==v&&200!==v)throw OP.create("fetch-status",{httpStatus:v});return[2,{status:v,eTag:y,config:g}]}var e})})},PP);function PP(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 DP=(xP.prototype.addEventListener=function(t){this.listeners.push(t)},xP.prototype.abort=function(){this.listeners.forEach(function(t){return t()})},xP);function xP(){this.listeners=[]}var LP=["1","true","t","yes","y","on"],MP=(FP.prototype.asString=function(){return this._value},FP.prototype.asBoolean=function(){return"static"!==this._source&&0<=LP.indexOf(this._value.toLowerCase())},FP.prototype.asNumber=function(){if("static"===this._source)return 0;var t=Number(this._value);return isNaN(t)&&(t=0),t},FP.prototype.getSource=function(){return this._source},FP);function FP(t,e){void 0===e&&(e=""),this._source=t,this._value=e}var UP=(jP.prototype.setLogLevel=function(t){switch(t){case"debug":this._logger.logLevel=Ta.DEBUG;break;case"silent":this._logger.logLevel=Ta.SILENT;break;default:this._logger.logLevel=Ta.ERROR}},Object.defineProperty(jP.prototype,"fetchTimeMillis",{get:function(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1},enumerable:!0,configurable:!0}),Object.defineProperty(jP.prototype,"lastFetchStatus",{get:function(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"},enumerable:!0,configurable:!0}),jP.prototype.activate=function(){return Is(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]}})})},jP.prototype.ensureInitialized=function(){var t=this;return this._initializePromise||(this._initializePromise=this._storageCache.loadFromStorage().then(function(){t._isInitializationComplete=!0})),this._initializePromise},jP.prototype.fetch=function(){return Is(this,void 0,void 0,function(){var r,i,o,s=this;return Ss(this,function(t){switch(t.label){case 0:r=new DP,setTimeout(function(){return Is(s,void 0,void 0,function(){return Ss(this,function(t){return r.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:r})];case 2:return t.sent(),[4,this._storageCache.setLastFetchStatus("success")];case 3:return t.sent(),[3,6];case 4:return i=t.sent(),n="fetch-throttle",o=(e=i)instanceof Gs&&-1!==e.code.indexOf(n)?"throttle":"failure",[4,this._storageCache.setLastFetchStatus(o)];case 5:throw t.sent(),i;case 6:return[2]}var e,n})})},jP.prototype.fetchAndActivate=function(){return Is(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()]}})})},jP.prototype.getAll=function(){var n=this;return function(t,e){return void 0===t&&(t={}),void 0===e&&(e={}),Object.keys(Ts(Ts({},t),e))}(this._storageCache.getActiveConfig(),this.defaultConfig).reduce(function(t,e){return t[e]=n.getValue(e),t},{})},jP.prototype.getBoolean=function(t){return this.getValue(t).asBoolean()},jP.prototype.getNumber=function(t){return this.getValue(t).asNumber()},jP.prototype.getString=function(t){return this.getValue(t).asString()},jP.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 MP("remote",e[t]):this.defaultConfig&&void 0!==this.defaultConfig[t]?new MP("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 MP("static"))},jP);function jP(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 VP(t,e){var n=t.target.error||void 0;return OP.create(e,{originalErrorMessage:n&&n.message})}var qP="app_namespace_store",BP="firebase_remote_config",WP=1;var HP=(GP.prototype.getLastFetchStatus=function(){return this.get("last_fetch_status")},GP.prototype.setLastFetchStatus=function(t){return this.set("last_fetch_status",t)},GP.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.get("last_successful_fetch_timestamp_millis")},GP.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.set("last_successful_fetch_timestamp_millis",t)},GP.prototype.getLastSuccessfulFetchResponse=function(){return this.get("last_successful_fetch_response")},GP.prototype.setLastSuccessfulFetchResponse=function(t){return this.set("last_successful_fetch_response",t)},GP.prototype.getActiveConfig=function(){return this.get("active_config")},GP.prototype.setActiveConfig=function(t){return this.set("active_config",t)},GP.prototype.getActiveConfigEtag=function(){return this.get("active_config_etag")},GP.prototype.setActiveConfigEtag=function(t){return this.set("active_config_etag",t)},GP.prototype.getThrottleMetadata=function(){return this.get("throttle_metadata")},GP.prototype.setThrottleMetadata=function(t){return this.set("throttle_metadata",t)},GP.prototype.deleteThrottleMetadata=function(){return this.delete("throttle_metadata")},GP.prototype.get=function(a){return Is(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([qP],"readonly").objectStore(qP),r=s.createCompositeKey(a);try{var i=t.get(r);i.onerror=function(t){e(VP(t,"storage-get"))},i.onsuccess=function(t){var e=t.target.result;n(e?e.value:void 0)}}catch(t){e(OP.create("storage-get",{originalErrorMessage:t&&t.message}))}})]}})})},GP.prototype.set=function(a,u){return Is(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([qP],"readwrite").objectStore(qP),r=s.createCompositeKey(a);try{var i=n.put({compositeKey:r,value:u});i.onerror=function(t){e(VP(t,"storage-set"))},i.onsuccess=function(){t()}}catch(t){e(OP.create("storage-set",{originalErrorMessage:t&&t.message}))}})]}})})},GP.prototype.delete=function(a){return Is(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([qP],"readwrite").objectStore(qP),r=s.createCompositeKey(a);try{var i=n.delete(r);i.onerror=function(t){e(VP(t,"storage-delete"))},i.onsuccess=function(){t()}}catch(t){e(OP.create("storage-delete",{originalErrorMessage:t&&t.message}))}})]}})})},GP.prototype.createCompositeKey=function(t){return[this.appId,this.appName,this.namespace,t].join()},GP);function GP(t,e,n,r){void 0===r&&(r=new Promise(function(e,n){var t=indexedDB.open(BP,WP);t.onerror=function(t){n(VP(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(qP,{keyPath:"compositeKey"})}}})),this.appId=t,this.appName=e,this.namespace=n,this.openDbPromise=r}var zP=(KP.prototype.getLastFetchStatus=function(){return this.lastFetchStatus},KP.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.lastSuccessfulFetchTimestampMillis},KP.prototype.getActiveConfig=function(){return this.activeConfig},KP.prototype.loadFromStorage=function(){return Is(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]}})})},KP.prototype.setLastFetchStatus=function(t){return this.lastFetchStatus=t,this.storage.setLastFetchStatus(t)},KP.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.lastSuccessfulFetchTimestampMillis=t,this.storage.setLastSuccessfulFetchTimestampMillis(t)},KP.prototype.setActiveConfig=function(t){return this.activeConfig=t,this.storage.setActiveConfig(t)},KP);function KP(t){this.storage=t}var QP=(YP.prototype.fetch=function(n){return Is(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)]}})})},YP.prototype.attemptFetch=function(c,t){var h=t.throttleEndTimeMillis,l=t.backoffCount;return Is(this,void 0,void 0,function(){var s,a,u;return Ss(this,function(t){switch(t.label){case 0:return[4,(i=c.signal,o=h,new Promise(function(t,e){var n=Math.max(o-Date.now(),0),r=setTimeout(t,n);i.addEventListener(function(){clearTimeout(r),e(OP.create("fetch-throttle",{throttleEndTimeMillis:o}))})}))];case 1:t.sent(),t.label=2;case 2:return t.trys.push([2,5,,7]),[4,this.client.fetch(c)];case 3:return s=t.sent(),[4,this.storage.deleteThrottleMetadata()];case 4:return t.sent(),[2,s];case 5:if(!function(t){if(t instanceof Gs){var e=Number(t.httpStatus);return 429===e||500===e||503===e||504===e}}(a=t.sent()))throw a;return u={throttleEndTimeMillis:Date.now()+(e=l,n=1e3*Math.pow(2,e),r=Math.round(.5*n*(Math.random()-.5)*2),Math.min(144e5,n+r)),backoffCount:l+1},[4,this.storage.setThrottleMetadata(u)];case 6:return t.sent(),[2,this.attemptFetch(c,u)];case 7:return[2]}var e,n,r,i,o})})},YP);function YP(t,e){this.client=t,this.storage=e}var XP,$P="@firebase/remote-config";return(XP=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 OP.create("registration-window");var i=n.options,o=i.projectId,s=i.apiKey,a=i.appId;if(!o)throw OP.create("registration-project-id");if(!s)throw OP.create("registration-api-key");if(!a)throw OP.create("registration-app-id");e=e||"firebase";var u=new HP(a,n.name,e),c=new zP(u),h=new Ra($P);h.logLevel=Ta.ERROR;var l=new RP(r,XP.SDK_VERSION,e,o,s,a),f=new QP(l,u),p=new NP(f,u,c,h),d=new UP(n,p,c,u,h);return d.ensureInitialized(),d},"PUBLIC").setMultipleInstances(!0)),XP.registerVersion($P,"0.1.21"),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.14.6","cdn"),Kl});
//# sourceMappingURL=firebase.js.map