���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
.trash
/
js
/
Viewing: firebase.js
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).firebase=e()}(this,function(){"use strict";function r(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 i(t){return"string"!=typeof t&&(t=String(t)),t}function t(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return p&&(t[Symbol.iterator]=function(){return t}),t}function s(e){this.map={},e instanceof s?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 o(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function a(n){return new Promise(function(t,e){n.onload=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function e(t){var e=new FileReader,n=a(e);return e.readAsArrayBuffer(t),n}function n(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function u(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t)if("string"==typeof t)this._bodyText=t;else if(d&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(v&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(f&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(y&&d&&m(t))this._bodyArrayBuffer=n(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!y||!ArrayBuffer.prototype.isPrototypeOf(t)&&!b(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=n(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):f&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},d&&(this.blob=function(){var t=o(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?o(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(e)}),this.text=function(){var t,e,n=o(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=a(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)},v&&(this.formData=function(){return this.text().then(h)}),this.json=function(){return this.text().then(JSON.parse)},this}function c(t,e){var n,r=(e=e||{}).body;if(t instanceof c){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new s(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=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 s(e.headers)),this.method=(n=e.method||this.method||"GET",t=n.toUpperCase(),-1<_.indexOf(t)?t:n),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function h(t){var n=new FormData;return t.trim().split("&").forEach(function(t){var e;t&&(t=(e=t.split("=")).shift().replace(/\+/g," "),e=e.join("=").replace(/\+/g," "),n.append(decodeURIComponent(t),decodeURIComponent(e)))}),n}function l(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 s(e.headers),this.url=e.url||"",this._initBody(t)}var f,p,d,v,y,g,m,b,_,w;(dt="undefined"!=typeof self?self:void 0).fetch||(f="URLSearchParams"in dt,p="Symbol"in dt&&"iterator"in Symbol,d="FileReader"in dt&&"Blob"in dt&&function(){try{return new Blob,!0}catch(t){return!1}}(),v="FormData"in dt,(y="ArrayBuffer"in dt)&&(g=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=function(t){return t&&DataView.prototype.isPrototypeOf(t)},b=ArrayBuffer.isView||function(t){return t&&-1<g.indexOf(Object.prototype.toString.call(t))}),s.prototype.append=function(t,e){t=r(t),e=i(e);var n=this.map[t];this.map[t]=n?n+","+e:e},s.prototype.delete=function(t){delete this.map[r(t)]},s.prototype.get=function(t){return t=r(t),this.has(t)?this.map[t]:null},s.prototype.has=function(t){return this.map.hasOwnProperty(r(t))},s.prototype.set=function(t,e){this.map[r(t)]=i(e)},s.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},s.prototype.keys=function(){var n=[];return this.forEach(function(t,e){n.push(e)}),t(n)},s.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),t(e)},s.prototype.entries=function(){var n=[];return this.forEach(function(t,e){n.push([e,t])}),t(n)},p&&(s.prototype[Symbol.iterator]=s.prototype.entries),_=["DELETE","GET","HEAD","OPTIONS","POST","PUT"],c.prototype.clone=function(){return new c(this,{body:this._bodyInit})},u.call(c.prototype),u.call(l.prototype),l.prototype.clone=function(){return new l(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new s(this.headers),url:this.url})},l.error=function(){var t=new l(null,{status:0,statusText:""});return t.type="error",t},w=[301,302,303,307,308],l.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new l(null,{status:e,headers:{location:t}})},dt.Headers=s,dt.Request=c,dt.Response=l,dt.fetch=function(n,o){return new Promise(function(r,t){var e=new c(n,o),i=new XMLHttpRequest;i.onload=function(){var n,t={status:i.status,statusText:i.statusText,headers:(e=i.getAllResponseHeaders()||"",n=new s,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var e=t.split(":"),t=e.shift().trim();t&&(e=e.join(":").trim(),n.append(t,e))}),n)};t.url="responseURL"in i?i.responseURL:t.headers.get("X-Request-URL");var e="response"in i?i.response:i.responseText;r(new l(e,t))},i.onerror=function(){t(new TypeError("Network request failed"))},i.ontimeout=function(){t(new TypeError("Network request failed"))},i.open(e.method,e.url,!0),"include"===e.credentials?i.withCredentials=!0:"omit"===e.credentials&&(i.withCredentials=!1),"responseType"in i&&d&&(i.responseType="blob"),e.headers.forEach(function(t,e){i.setRequestHeader(e,t)}),i.send(void 0===e._bodyInit?null:e._bodyInit)})},dt.fetch.polyfill=!0);var E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function I(t,e){return t(e={exports:{}},e.exports),e.exports}function T(t){try{return!!t()}catch(t){return!0}}function S(t){return"object"==typeof t?null!==t:"function"==typeof t}function C(t){return j?U.createElement(t):{}}function N(t){if(!S(t))throw TypeError(String(t)+" is not an object");return t}function A(t,e){if(!S(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!S(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!S(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!S(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}function k(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}function O(e,n){try{W(L,e,n)}catch(t){L[e]=n}return n}function R(t,e){return z.call(t,e)}function P(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++Q+Y).toString(36)}function D(t){return R(J,t)||(X&&R(Z,t)?J[t]=Z[t]:J[t]=tt("Symbol."+t)),J[t]}var x=function(t){return t&&t.Math==Math&&t},L=x("object"==typeof globalThis&&globalThis)||x("object"==typeof window&&window)||x("object"==typeof self&&self)||x("object"==typeof E&&E)||Function("return this")(),M=!1,F=!T(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}),U=L.document,j=S(U)&&S(U.createElement),V=!F&&!T(function(){return 7!=Object.defineProperty(C("div"),"a",{get:function(){return 7}}).a}),q=Object.defineProperty,B={f:F?q:function(t,e,n){if(N(t),e=A(e,!0),N(n),V)try{return q(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,k(1,n))}:function(t,e,n){return t[e]=n,t},H="__core-js_shared__",G=L[H]||O(H,{}),K=I(function(t){(t.exports=function(t,e){return G[t]||(G[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})}),z={}.hasOwnProperty,Q=0,Y=Math.random(),X=!!Object.getOwnPropertySymbols&&!T(function(){return!String(Symbol())}),$=X&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,J=K("wks"),Z=L.Symbol,tt=$?Z:Z&&Z.withoutSetter||P,et={};et[D("toStringTag")]="z";var nt="[object z]"===String(et),rt=Function.toString;"function"!=typeof G.inspectSource&&(G.inspectSource=function(t){return rt.call(t)});var it,ot,st,at,ut,ct,ht,lt,ft=G.inspectSource,pt=L.WeakMap,dt="function"==typeof pt&&/native code/.test(ft(pt)),vt=K("keys"),x=function(t){return vt[t]||(vt[t]=P(t))},yt={},E=L.WeakMap;ht=dt?(it=new E,ot=it.get,st=it.has,at=it.set,ut=function(t,e){return at.call(it,t,e),e},ct=function(t){return ot.call(it,t)||{}},function(t){return st.call(it,t)}):(lt=x("state"),yt[lt]=!0,ut=function(t,e){return W(t,lt,e),e},ct=function(t){return R(t,lt)?t[lt]:{}},function(t){return R(t,lt)});function gt(t){return _t.call(t).slice(8,-1)}var mt={set:ut,get:ct,has:ht,enforce:function(t){return ht(t)?ct(t):ut(t,{})},getterFor:function(n){return function(t){var e;if(!S(t)||(e=ct(t)).type!==n)throw TypeError("Incompatible receiver, "+n+" required");return e}}},bt=I(function(t){var e=mt.get,s=mt.enforce,a=String(String).split("String");(t.exports=function(t,e,n,r){var i=!!r&&!!r.unsafe,o=!!r&&!!r.enumerable,r=!!r&&!!r.noTargetGet;"function"==typeof n&&("string"!=typeof e||R(n,"name")||W(n,"name",e),s(n).source=a.join("string"==typeof e?e:"")),t!==L?(i?!r&&t[e]&&(o=!0):delete t[e],o?t[e]=n:W(t,e,n)):o?t[e]=n:O(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||ft(this)})}),_t={}.toString,wt=D("toStringTag"),Et="Arguments"==gt(function(){return arguments}()),It=nt?gt:function(t){var e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(t=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),wt))?t:Et?gt(e):"Object"==(t=gt(e))&&"function"==typeof e.callee?"Arguments":t},H=nt?{}.toString:function(){return"[object "+It(this)+"]"};nt||bt(Object.prototype,"toString",H,{unsafe:!0});function Tt(t){return isNaN(t=+t)?0:(0<t?Lt:xt)(t)}function St(t){if(null==t)throw TypeError("Can't call method on "+t);return t}function Ct(t){return jt(St(t))}function Nt(t){return"function"==typeof t?t:void 0}function At(t,e){return arguments.length<2?Nt(Bt[t])||Nt(L[t]):Bt[t]&&Bt[t][e]||L[t]&&L[t][e]}function kt(t){return 0<t?Wt(Tt(t),9007199254740991):0}function Ot(t,e){var n,r=Ct(t),i=0,o=[];for(n in r)!R(yt,n)&&R(r,n)&&o.push(n);for(;e.length>i;)R(r,n=e[i++])&&(~Kt(o,n)||o.push(n));return o}function Rt(t,e){for(var n=$t(e),r=B.f,i=qt.f,o=0;o<n.length;o++){var s=n[o];R(t,s)||r(t,s,i(e,s))}}function Pt(t,e){var n,r,i,o=t.target,s=t.global,a=t.stat,u=s?L:a?L[o]||O(o,{}):(L[o]||{}).prototype;if(u)for(n in e){if(r=e[n],i=t.noTargetGet?(i=ie(u,n))&&i.value:u[n],!re(s?n:o+(a?".":"#")+n,t.forced)&&void 0!==i){if(typeof r==typeof i)continue;Rt(r,i)}(t.sham||i&&i.sham)&&W(r,"sham",!0),bt(u,n,r,t)}}function Dt(t){return Object(St(t))}var xt=Math.ceil,Lt=Math.floor,et=function(o){return function(t,e){var n,r=String(St(t)),i=Tt(e),t=r.length;return i<0||t<=i?o?"":void 0:(e=r.charCodeAt(i))<55296||56319<e||i+1===t||(n=r.charCodeAt(i+1))<56320||57343<n?o?r.charAt(i):e:o?r.slice(i,i+2):n-56320+(e-55296<<10)+65536}},pt={codeAt:et(!1),charAt:et(!0)},dt={}.propertyIsEnumerable,Mt=Object.getOwnPropertyDescriptor,Ft={f:Mt&&!dt.call({1:2},1)?function(t){t=Mt(this,t);return!!t&&t.enumerable}:dt},Ut="".split,jt=T(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==gt(t)?Ut.call(t,""):Object(t)}:Object,Vt=Object.getOwnPropertyDescriptor,qt={f:F?Vt:function(t,e){if(t=Ct(t),e=A(e,!0),V)try{return Vt(t,e)}catch(t){}if(R(t,e))return k(!Ft.f.call(t,e),t[e])}},Bt=L,Wt=Math.min,Ht=Math.max,Gt=Math.min,E=function(a){return function(t,e,n){var r,i=Ct(t),o=kt(i.length),s=function(t,e){t=Tt(t);return t<0?Ht(t+e,0):Gt(t,e)}(n,o);if(a&&e!=e){for(;s<o;)if((r=i[s++])!=r)return!0}else for(;s<o;s++)if((a||s in i)&&i[s]===e)return a||s||0;return!a&&-1}},Kt={includes:E(!0),indexOf:E(!1)}.indexOf,zt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Qt=zt.concat("length","prototype"),Yt={f:Object.getOwnPropertyNames||function(t){return Ot(t,Qt)}},Xt={f:Object.getOwnPropertySymbols},$t=At("Reflect","ownKeys")||function(t){var e=Yt.f(N(t)),n=Xt.f;return n?e.concat(n(t)):e},Jt=/#|\.prototype\./,nt=function(t,e){t=te[Zt(t)];return t==ne||t!=ee&&("function"==typeof e?T(e):!!e)},Zt=nt.normalize=function(t){return String(t).replace(Jt,".").toLowerCase()},te=nt.data={},ee=nt.NATIVE="N",ne=nt.POLYFILL="P",re=nt,ie=qt.f,H=!T(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),oe=x("IE_PROTO"),se=Object.prototype,ae=H?Object.getPrototypeOf:function(t){return t=Dt(t),R(t,oe)?t[oe]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?se:null},et=D("iterator"),dt=!1;[].keys&&("next"in(En=[].keys())?(Tn=ae(ae(En)))!==Object.prototype&&(Cn=Tn):dt=!0),null==Cn&&(Cn={}),R(Cn,et)||W(Cn,et,function(){return this});function ue(){}function ce(t){return"<script>"+t+"</"+ve+">"}var he,E={IteratorPrototype:Cn,BUGGY_SAFARI_ITERATORS:dt},le=Object.keys||function(t){return Ot(t,zt)},fe=F?Object.defineProperties:function(t,e){N(t);for(var n,r=le(e),i=r.length,o=0;o<i;)B.f(t,n=r[o++],e[n]);return t},pe=At("document","documentElement"),de="prototype",ve="script",ye=x("IE_PROTO"),ge=function(){try{he=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t;ge=he?function(t){t.write(ce("")),t.close();var e=t.parentWindow.Object;return t=null,e}(he):((t=C("iframe")).style.display="none",pe.appendChild(t),t.src=String("javascript:"),(t=t.contentWindow.document).open(),t.write(ce("document.F=Object")),t.close(),t.F);for(var e=zt.length;e--;)delete ge[de][zt[e]];return ge()};yt[ye]=!0;function me(t,e,n){t&&!R(t=n?t:t.prototype,Te)&&Ie(t,Te,{configurable:!0,value:e})}function be(){return this}function _e(){return this}function we(t,e,n,r,i,o,s){function a(t){if(t===i&&d)return d;if(!ke&&t in f)return f[t];switch(t){case"keys":case Re:case Pe:return function(){return new n(this,t)}}return function(){return new n(this)}}!function(t,e,n){e+=" Iterator";t.prototype=Ee(Ce,{next:k(1,n)}),me(t,e,!1),Se[e]=be}(n,e,r);var u,c,h=e+" Iterator",l=!1,f=t.prototype,p=f[Oe]||f["@@iterator"]||i&&f[i],d=!ke&&p||a(i);if((r="Array"==e&&f.entries||p)&&(t=ae(r.call(new t)),Ae!==Object.prototype&&t.next&&(ae(t)!==Ae&&(Ne?Ne(t,Ae):"function"!=typeof t[Oe]&&W(t,Oe,_e)),me(t,h,!0))),i==Re&&p&&p.name!==Re&&(l=!0,d=function(){return p.call(this)}),f[Oe]!==d&&W(f,Oe,d),Se[e]=d,i)if(u={values:a(Re),keys:o?d:a("keys"),entries:a(Pe)},s)for(c in u)!ke&&!l&&c in f||bt(f,c,u[c]);else Pt({target:e,proto:!0,forced:ke||l},u);return u}var Ee=Object.create||function(t,e){var n;return null!==t?(ue[de]=N(t),n=new ue,ue[de]=null,n[ye]=t):n=ge(),void 0===e?n:fe(n,e)},Ie=B.f,Te=D("toStringTag"),Se={},Ce=E.IteratorPrototype,Ne=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 N(t),function(t){if(!S(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),Ae=E.IteratorPrototype,ke=E.BUGGY_SAFARI_ITERATORS,Oe=D("iterator"),Re="values",Pe="entries",De=pt.charAt,xe="String Iterator",Le=mt.set,Me=mt.getterFor(xe);we(String,"String",function(t){Le(this,{type:xe,string:String(t),index:0})},function(){var t=Me(this),e=t.string,n=t.index;return n>=e.length?{value:void 0,done:!0}:(n=De(e,n),t.index+=n.length,{value:n,done:!1})});var Fe={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},Ue=D("unscopables"),je=Array.prototype;null==je[Ue]&&B.f(je,Ue,{configurable:!0,value:Ee(null)});var nt=function(t){je[Ue][t]=!0},Ve="Array Iterator",qe=mt.set,Be=mt.getterFor(Ve),We=we(Array,"Array",function(t,e){qe(this,{type:Ve,target:Ct(t),index:0,kind:e})},function(){var t=Be(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");Se.Arguments=Se.Array,nt("keys"),nt("values"),nt("entries");var He,Ge=D("iterator"),Ke=D("toStringTag"),ze=We.values;for(He in Fe){var Qe=L[He],Ye=Qe&&Qe.prototype;if(Ye){if(Ye[Ge]!==ze)try{W(Ye,Ge,ze)}catch(na){Ye[Ge]=ze}if(Ye[Ke]||W(Ye,Ke,He),Fe[He])for(var Xe in We)if(Ye[Xe]!==We[Xe])try{W(Ye,Xe,We[Xe])}catch(na){Ye[Xe]=We[Xe]}}}function $e(t,e,n){for(var r in e)bt(t,r,e[r],n);return t}function Je(t){var e=At(t),t=B.f;F&&e&&!e[an]&&t(e,an,{configurable:!0,get:function(){return this}})}function Ze(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}function tn(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}function en(t){return void 0!==t&&(Se.Array===t||cn[un]===t)}function nn(r,i,t){if(Ze(r),void 0===i)return r;switch(t){case 0:return function(){return r.call(i)};case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}}function rn(t){if(null!=t)return t[hn]||t["@@iterator"]||Se[It(t)]}function on(e,t,n,r){try{return r?t(N(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&N(i.call(e)),t}}var sn=L.Promise,an=D("species"),un=D("iterator"),cn=Array.prototype,hn=D("iterator"),ln=I(function(t){function f(t,e){this.stopped=t,this.result=e}(t.exports=function(t,e,n,r,i){var o,s,a,u,c,h,l=nn(e,n,r?2:1);if(i)o=t;else{if("function"!=typeof(i=rn(t)))throw TypeError("Target is not iterable");if(en(i)){for(s=0,a=kt(t.length);s<a;s++)if((u=r?l(N(h=t[s])[0],h[1]):l(t[s]))&&u instanceof f)return u;return new f(!1)}o=i.call(t)}for(c=o.next;!(h=c.call(o)).done;)if("object"==typeof(u=on(o,l,h.value,r))&&u&&u instanceof f)return u;return new f(!1)}).stop=function(t){return new f(!0,t)}}),fn=D("iterator"),pn=!1;try{var dn=0,vn={next:function(){return{done:!!dn++}},return:function(){pn=!0}};vn[fn]=function(){return this},Array.from(vn,function(){throw 2})}catch(na){}function yn(t,e){if(!e&&!pn)return!1;var n=!1;try{var r={};r[fn]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n}function gn(t,e){var n;return void 0===(t=N(t).constructor)||null==(n=N(t)[wn])?e:Ze(n)}function mn(t){var e;kn.hasOwnProperty(t)&&(e=kn[t],delete kn[t],e())}function bn(t){return function(){mn(t)}}var _n,wn=D("species"),H=At("navigator","userAgent")||"",En=/(iphone|ipod|ipad).*applewebkit/i.test(H),In=L.location,Tn=L.setImmediate,et=L.clearImmediate,Sn=L.process,Cn=L.MessageChannel,Nn=L.Dispatch,An=0,kn={},On="onreadystatechange",dt=function(t){mn(t.data)},E=function(t){L.postMessage(t+"",In.protocol+"//"+In.host)};Tn&&et||(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)},_n(An),An},et=function(t){delete kn[t]},"process"==gt(Sn)?_n=function(t){Sn.nextTick(bn(t))}:Nn&&Nn.now?_n=function(t){Nn.now(bn(t))}:Cn&&!En?(Cn=(pt=new Cn).port2,pt.port1.onmessage=dt,_n=nn(Cn.postMessage,Cn,1)):!L.addEventListener||"function"!=typeof postMessage||L.importScripts||T(E)||"file:"===In.protocol?_n=On in C("script")?function(t){pe.appendChild(C("script"))[On]=function(){pe.removeChild(this),mn(t)}}:function(t){setTimeout(bn(t),0)}:(_n=E,L.addEventListener("message",dt,!1)));var Rn,Pn,Dn,xn,Ln,Mn,Fn,Un,E={set:Tn,clear:et},dt=qt.f,jn=E.set,Tn=L.MutationObserver||L.WebKitMutationObserver,Vn=L.process,et=L.Promise,qn="process"==gt(Vn),dt=dt(L,"queueMicrotask"),dt=dt&&dt.value;dt||(Rn=function(){var t,e;for(qn&&(t=Vn.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=qn?function(){Vn.nextTick(Rn)}:Tn&&!En?(Ln=!0,Mn=document.createTextNode(""),new Tn(Rn).observe(Mn,{characterData:!0}),function(){Mn.data=Ln=!Ln}):et&&et.resolve?(Fn=et.resolve(void 0),Un=Fn.then,function(){Un.call(Fn,Rn)}):function(){jn.call(L,Rn)});function Bn(t){var n,r;this.promise=new t(function(t,e){if(void 0!==n||void 0!==r)throw TypeError("Bad Promise constructor");n=t,r=e}),this.resolve=Ze(n),this.reject=Ze(r)}function Wn(t,e){return N(t),S(e)&&e.constructor===t?e:((0,(t=Kn.f(t)).resolve)(e),t.promise)}function Hn(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}var Gn=dt||function(t){t={fn:t,next:void 0};Dn&&(Dn.next=t),Pn||(Pn=t,xn()),Dn=t},Kn={f:function(t){return new Bn(t)}},et=L.process,dt=et&&et.versions,et=dt&&dt.v8;et?Dr=(Pr=et.split("."))[0]+Pr[1]:H&&(!(Pr=H.match(/Edge\/(\d+)/))||74<=Pr[1])&&(Pr=H.match(/Chrome\/(\d+)/))&&(Dr=Pr[1]);function zn(t){var e;return!(!S(t)||"function"!=typeof(e=t.then))&&e}function Qn(l,f,p){var d;f.notified||(f.notified=!0,d=f.reactions,Gn(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&&wr(l,f),f.rejection=1),!0===a?r=t:(h&&h.enter(),r=a(t),h&&(h.exit(),o=!0)),r===s.promise?c(hr("Promise-chain cycle")):(i=zn(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&&br(l,f)}))}function Yn(t,e,n){var r;gr?((r=lr.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),L.dispatchEvent(r)):r={promise:e,reason:n},(e=L["on"+t])?e(r):t===mr&&function(t,e){var n=L.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,e))}("Unhandled promise rejection",n)}function Xn(e,n,r,i){return function(t){e(n,r,t,i)}}function $n(t,e,n,r){e.done||(e.done=!0,r&&(e=r),e.value=n,e.state=2,Qn(t,e,!0))}var Jn,Zn,tr,er,nr=Dr&&+Dr,rr=E.set,ir=D("species"),or="Promise",sr=mt.get,ar=mt.set,ur=mt.getterFor(or),cr=sn,hr=L.TypeError,lr=L.document,fr=L.process,pr=At("fetch"),dr=Kn.f,vr=dr,yr="process"==gt(fr),gr=!!(lr&&lr.createEvent&&L.dispatchEvent),mr="unhandledrejection",dt=re(or,function(){if(!(ft(cr)!==String(cr))){if(66===nr)return!0;if(!yr&&"function"!=typeof PromiseRejectionEvent)return!0}if(51<=nr&&/native code/.test(cr))return!1;function t(t){t(function(){},function(){})}var e=cr.resolve(1);return(e.constructor={})[ir]=t,!(e.then(function(){})instanceof t)}),et=dt||!yn(function(t){cr.all(t).catch(function(){})}),br=function(n,r){rr.call(L,function(){var t,e=r.value;if(_r(r)&&(t=Hn(function(){yr?fr.emit("unhandledRejection",e,n):Yn(mr,n,e)}),r.rejection=yr||_r(r)?2:1,t.error))throw t.value})},_r=function(t){return 1!==t.rejection&&!t.parent},wr=function(t,e){rr.call(L,function(){yr?fr.emit("rejectionHandled",t):Yn("rejectionhandled",t,e.value)})},Er=function(n,r,t,e){if(!r.done){r.done=!0,e&&(r=e);try{if(n===t)throw hr("Promise can't be resolved itself");var i=zn(t);i?Gn(function(){var e={done:!1};try{i.call(t,Xn(Er,n,e,r),Xn($n,n,e,r))}catch(t){$n(n,e,t,r)}}):(r.value=t,r.state=1,Qn(n,r,!1))}catch(t){$n(n,{done:!1},t,r)}}};dt&&(cr=function(t){tn(this,cr,or),Ze(t),Jn.call(this);var e=sr(this);try{t(Xn(Er,this,e),Xn($n,this,e))}catch(t){$n(this,e,t)}},(Jn=function(){ar(this,{type:or,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=$e(cr.prototype,{then:function(t,e){var n=ur(this),r=dr(gn(this,cr));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=yr?fr.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Qn(this,n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),Zn=function(){var t=new Jn,e=sr(t);this.promise=t,this.resolve=Xn(Er,t,e),this.reject=Xn($n,t,e)},Kn.f=dr=function(t){return t===cr||t===tr?new Zn:vr(t)},"function"==typeof sn&&(er=sn.prototype.then,bt(sn.prototype,"then",function(t,e){var n=this;return new cr(function(t,e){er.call(n,t,e)}).then(t,e)},{unsafe:!0}),"function"==typeof pr&&Pt({global:!0,enumerable:!0,forced:!0},{fetch:function(){return Wn(cr,pr.apply(L,arguments))}}))),Pt({global:!0,wrap:!0,forced:dt},{Promise:cr}),me(cr,or,!1),Je(or),tr=At(or),Pt({target:or,stat:!0,forced:dt},{reject:function(t){var e=dr(this);return e.reject.call(void 0,t),e.promise}}),Pt({target:or,stat:!0,forced:dt},{resolve:function(t){return Wn(this,t)}}),Pt({target:or,stat:!0,forced:et},{all:function(t){var a=this,e=dr(a),u=e.resolve,c=e.reject,n=Hn(function(){var r=Ze(a.resolve),i=[],o=0,s=1;ln(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=dr(n),i=r.reject,e=Hn(function(){var e=Ze(n.resolve);ln(t,function(t){e.call(n,t).then(r.resolve,i)})});return e.error&&i(e.value),r.promise}}),Pt({target:"Promise",stat:!0},{allSettled:function(t){var a=this,e=Kn.f(a),u=e.resolve,n=e.reject,r=Hn(function(){var r=Ze(a.resolve),i=[],o=0,s=1;ln(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}});H=!!sn&&T(function(){sn.prototype.finally.call({then:function(){}},function(){})});Pt({target:"Promise",proto:!0,real:!0,forced:H},{finally:function(e){var n=gn(this,At("Promise")),t="function"==typeof e;return this.then(t?function(t){return Wn(n,e()).then(function(){return t})}:e,t?function(t){return Wn(n,e()).then(function(){throw t})}:e)}}),"function"!=typeof sn||sn.prototype.finally||bt(sn.prototype,"finally",At("Promise").prototype.finally);Bt.Promise;var Ir=mt.set,Tr=mt.getterFor("AggregateError"),Sr=function(t,e){var n=this;if(!(n instanceof Sr))return new Sr(t,e);Ne&&(n=Ne(new Error(e),ae(n)));var r=[];return ln(t,r.push,r),F?Ir(n,{errors:r,type:"AggregateError"}):n.errors=r,void 0!==e&&W(n,"message",String(e)),n};Sr.prototype=Ee(Error.prototype,{constructor:k(5,Sr),message:k(5,""),name:k(5,"AggregateError")}),F&&B.f(Sr.prototype,"errors",{get:function(){return Tr(this).errors},configurable:!0}),Pt({global:!0},{AggregateError:Sr}),Pt({target:"Promise",stat:!0},{try:function(t){var e=Kn.f(this),t=Hn(t);return(t.error?e.reject:e.resolve)(t.value),e.promise}});var Cr="No one promise resolved";Pt({target:"Promise",stat:!0},{any:function(t){var u=this,e=Kn.f(u),c=e.resolve,h=e.reject,n=Hn(function(){var r=Ze(u.resolve),i=[],o=0,s=1,a=!1;ln(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(At("AggregateError"))(i,Cr)))})}),--s||h(new(At("AggregateError"))(i,Cr))});return n.error&&h(n.value),e.promise}});function Nr(t,e){var n;return kr(t)&&("function"==typeof(n=t.constructor)&&(n===Array||kr(n.prototype))||S(n)&&null===(n=n[Or]))&&(n=void 0),new(void 0===n?Array:n)(0===e?0:e)}function Ar(t){throw t}var kr=Array.isArray||function(t){return"Array"==gt(t)},Or=D("species"),Rr=[].push,Pr=function(f){var p=1==f,d=2==f,v=3==f,y=4==f,g=6==f,m=5==f||g;return function(t,e,n,r){for(var i,o,s=Dt(t),a=jt(s),u=nn(e,n,3),c=kt(a.length),h=0,r=r||Nr,l=p?r(t,c):d?r(t,0):void 0;h<c;h++)if((m||h in a)&&(o=u(i=a[h],h,s),f))if(p)l[h]=o;else if(o)switch(f){case 3:return!0;case 5:return i;case 6:return h;case 2:Rr.call(l,i)}else if(y)return!1;return g?-1:v||y?y:l}},Dr={forEach:Pr(0),map:Pr(1),filter:Pr(2),some:Pr(3),every:Pr(4),find:Pr(5),findIndex:Pr(6)},xr=Object.defineProperty,Lr={},E=function(t,e){if(R(Lr,t))return Lr[t];var n=[][t],r=!!R(e=e||{},"ACCESSORS")&&e.ACCESSORS,i=R(e,0)?e[0]:Ar,o=R(e,1)?e[1]:void 0;return Lr[t]=!!n&&!T(function(){if(r&&!F)return 1;var t={length:-1};r?xr(t,1,{enumerable:!0,get:Ar}):t[1]=1,n.call(t,i,o)})},Mr=Dr.find,dt="find",Fr=!0,et=E(dt);dt in[]&&Array(1)[dt](function(){Fr=!1}),Pt({target:"Array",proto:!0,forced:Fr||!et},{find:function(t,e){return Mr(this,t,1<arguments.length?e:void 0)}}),nt(dt);var Ur=Function.call,H=function(t,e,n){return nn(Ur,L[t].prototype[e],n)},jr=(H("Array","find"),Dr.findIndex),Pr="findIndex",Vr=!0,et=E(Pr);Pr in[]&&Array(1)[Pr](function(){Vr=!1}),Pt({target:"Array",proto:!0,forced:Vr||!et},{findIndex:function(t,e){return jr(this,t,1<arguments.length?e:void 0)}}),nt(Pr);function qr(t,e,n){(e=A(e))in t?B.f(t,e,k(0,n)):t[e]=n}H("Array","findIndex");dt=!yn(function(t){Array.from(t)});Pt({target:"Array",stat:!0,forced:dt},{from:function(t,e,n){var r,i,o,s,a,u,c=Dt(t),h="function"==typeof this?this:Array,t=arguments.length,l=1<t?e:void 0,f=void 0!==l,e=rn(c),p=0;if(f&&(l=nn(l,2<t?n:void 0,2)),null==e||h==Array&&en(e))for(i=new h(r=kt(c.length));p<r;p++)u=f?l(c[p],p):c[p],qr(i,p,u);else for(a=(s=e.call(c)).next,i=new h;!(o=a.call(s)).done;p++)u=f?on(s,l,[o.value,p],!0):o.value,qr(i,p,u);return i.length=p,i}});Bt.Array.from;var Br,Wr,Hr=Dr.some,et=!!(Wr=[]["some"])&&T(function(){Wr.call(null,Br||function(){throw 1},1)}),nt=E("some");Pt({target:"Array",proto:!0,forced:!et||!nt},{some:function(t,e){return Hr(this,t,1<arguments.length?e:void 0)}});H("Array","some");function Gr(t){return S(t)&&R(Zr,It(t))}var Kr,Pr="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,dt=B.f,zr=L.Int8Array,Qr=zr&&zr.prototype,E=L.Uint8ClampedArray,et=E&&E.prototype,Yr=zr&&ae(zr),Xr=Qr&&ae(Qr),nt=Object.prototype,E=(nt.isPrototypeOf,D("toStringTag")),$r=P("TYPED_ARRAY_TAG"),Jr=Pr&&!!Ne&&"Opera"!==It(L.opera),Pr=!1,Zr={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8};for(Kr in Zr)L[Kr]||(Jr=!1);if((!Jr||"function"!=typeof Yr||Yr===Function.prototype)&&(Yr=function(){throw TypeError("Incorrect invocation")},Jr))for(Kr in Zr)L[Kr]&&Ne(L[Kr],Yr);if((!Jr||!Xr||Xr===nt)&&(Xr=Yr.prototype,Jr))for(Kr in Zr)L[Kr]&&Ne(L[Kr].prototype,Xr);if(Jr&&ae(et)!==Xr&&Ne(et,Xr),F&&!R(Xr,E))for(Kr in Pr=!0,dt(Xr,E,{get:function(){return S(this)?this[$r]:void 0}}),Zr)L[Kr]&&W(L[Kr],$r,Kr);var et=function(t){if(Gr(t))return t;throw TypeError("Target is not a typed array")},dt=function(t,e,n){if(F){if(n)for(var r in Zr){var i=L[r];i&&R(i.prototype,t)&&delete i.prototype[t]}Xr[t]&&!n||bt(Xr,t,!n&&Jr&&Qr[t]||e)}},E=D("iterator"),Pr=L.Uint8Array,ti=We.values,ei=We.keys,ni=We.entries,ri=et,et=dt,dt=Pr&&Pr.prototype[E],Pr=!!dt&&("values"==dt.name||null==dt.name),dt=function(){return ti.call(ri(this))};et("entries",function(){return ni.call(ri(this))}),et("keys",function(){return ei.call(ri(this))}),et("values",dt,!Pr),et(E,dt,!Pr);var ii=Object.assign,oi=Object.defineProperty,dt=!ii||T(function(){if(F&&1!==ii({b:1},ii(oi({},"a",{enumerable:!0,get:function(){oi(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!=ii({},t)[n]||le(ii({},e)).join("")!=r})?function(t){for(var e=Dt(t),n=arguments.length,r=1,i=Xt.f,o=Ft.f;r<n;)for(var s,a=jt(arguments[r++]),u=i?le(a).concat(i(a)):le(a),c=u.length,h=0;h<c;)s=u[h++],F&&!o.call(a,s)||(e[s]=a[s]);return e}:ii;Pt({target:"Object",stat:!0,forced:Object.assign!==dt},{assign:dt});Bt.Object.assign;var si=Ft.f,Pr=function(a){return function(t){for(var e,n=Ct(t),r=le(n),i=r.length,o=0,s=[];o<i;)e=r[o++],F&&!si.call(n,e)||s.push(a?[e,n[e]]:n[e]);return s}},dt={entries:Pr(!0),values:Pr(!1)},ai=dt.entries;Pt({target:"Object",stat:!0},{entries:function(t){return ai(t)}});Bt.Object.entries;var ui=dt.values;Pt({target:"Object",stat:!0},{values:function(t){return ui(t)}});Bt.Object.values;function ci(t){if(S(e=t)&&(void 0!==(n=e[hi])?!!n:"RegExp"==gt(e)))throw TypeError("The method doesn't accept regular expressions");var e,n;return t}var hi=D("match"),li=D("match"),Pr=function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[li]=!1,"/./"[e](n)}catch(t){}}return!1};Pt({target:"String",proto:!0,forced:!Pr("includes")},{includes:function(t,e){return!!~String(St(this)).indexOf(ci(t),1<arguments.length?e:void 0)}});H("String","includes");var fi,dt=qt.f,pi="".startsWith,di=Math.min,Pr=Pr("startsWith"),fi=!(Pr||(!(fi=dt(String.prototype,"startsWith"))||fi.writable));Pt({target:"String",proto:!0,forced:!fi&&!Pr},{startsWith:function(t,e){var n=String(St(this));ci(t);e=kt(di(1<arguments.length?e:void 0,n.length)),t=String(t);return pi?pi.call(n,t,e):n.slice(e,e+t.length)===t}});H("String","startsWith");Pt({target:"String",proto:!0},{repeat:"".repeat||function(t){var e=String(St(this)),n="",r=Tt(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}});H("String","repeat");var vi,yi=D("species"),gi=D("isConcatSpreadable"),mi=9007199254740991,bi="Maximum allowed index exceeded",Pr=51<=nr||!T(function(){var t=[];return t[gi]=!1,t.concat()[0]!==t}),H=(vi="concat",51<=nr||!T(function(){var t=[];return(t.constructor={})[yi]=function(){return{foo:1}},1!==t[vi](Boolean).foo}));Pt({target:"Array",proto:!0,forced:!Pr||!H},{concat:function(){for(var t,e,n,r=Dt(this),i=Nr(r,0),o=0,s=-1,a=arguments.length;s<a;s++)if(function(t){if(!S(t))return!1;var e=t[gi];return void 0!==e?!!e:kr(t)}(n=-1===s?r:arguments[s])){if(e=kt(n.length),mi<o+e)throw TypeError(bi);for(t=0;t<e;t++,o++)t in n&&qr(i,o,n[t])}else{if(mi<=o)throw TypeError(bi);qr(i,o++,n)}return i.length=o,i}});function _i(t){var e=Bt.Symbol||(Bt.Symbol={});R(e,t)||Ni(e,t,{value:Ci.f(t)})}function wi(t,e){var n=qi[t]=Ee(Li[Ri]);return Pi(n,{type:Oi,tag:t,description:e}),F||(n.description=e),n}function Ei(e,t){N(e);var n=Ct(t),t=le(n).concat(Xi(n));return Ai(t,function(t){F&&!Yi.call(n,t)||Qi(e,t,n[t])}),e}var Ii=Yt.f,Ti={}.toString,Si="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],H={f:function(t){return Si&&"[object Window]"==Ti.call(t)?function(t){try{return Ii(t)}catch(t){return Si.slice()}}(t):Ii(Ct(t))}},Ci={f:D},Ni=B.f,Ai=Dr.forEach,ki=x("hidden"),Oi="Symbol",Ri="prototype",Dr=D("toPrimitive"),Pi=mt.set,Di=mt.getterFor(Oi),xi=Object[Ri],Li=L.Symbol,Mi=At("JSON","stringify"),Fi=qt.f,Ui=B.f,ji=H.f,Vi=Ft.f,qi=K("symbols"),Bi=K("op-symbols"),Wi=K("string-to-symbol-registry"),Hi=K("symbol-to-string-registry"),x=K("wks"),K=L.QObject,Gi=!K||!K[Ri]||!K[Ri].findChild,Ki=F&&T(function(){return 7!=Ee(Ui({},"a",{get:function(){return Ui(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=Fi(xi,e);r&&delete xi[e],Ui(t,e,n),r&&t!==xi&&Ui(xi,e,r)}:Ui,zi=$?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof Li},Qi=function(t,e,n){t===xi&&Qi(Bi,e,n),N(t);e=A(e,!0);return N(n),R(qi,e)?(n.enumerable?(R(t,ki)&&t[ki][e]&&(t[ki][e]=!1),n=Ee(n,{enumerable:k(0,!1)})):(R(t,ki)||Ui(t,ki,k(1,{})),t[ki][e]=!0),Ki(t,e,n)):Ui(t,e,n)},Yi=function(t){var e=A(t,!0),t=Vi.call(this,e);return!(this===xi&&R(qi,e)&&!R(Bi,e))&&(!(t||!R(this,e)||!R(qi,e)||R(this,ki)&&this[ki][e])||t)},K=function(t,e){var n=Ct(t),t=A(e,!0);if(n!==xi||!R(qi,t)||R(Bi,t)){e=Fi(n,t);return!e||!R(qi,t)||R(n,ki)&&n[ki][t]||(e.enumerable=!0),e}},$=function(t){var t=ji(Ct(t)),e=[];return Ai(t,function(t){R(qi,t)||R(yt,t)||e.push(t)}),e},Xi=function(t){var e=t===xi,t=ji(e?Bi:Ct(t)),n=[];return Ai(t,function(t){!R(qi,t)||e&&!R(xi,t)||n.push(qi[t])}),n};X||(bt((Li=function(t){if(this instanceof Li)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==t?String(t):void 0,e=P(t),n=function(t){this===xi&&n.call(Bi,t),R(this,ki)&&R(this[ki],e)&&(this[ki][e]=!1),Ki(this,e,k(1,t))};return F&&Gi&&Ki(xi,e,{configurable:!0,set:n}),wi(e,t)})[Ri],"toString",function(){return Di(this).tag}),bt(Li,"withoutSetter",function(t){return wi(P(t),t)}),Ft.f=Yi,B.f=Qi,qt.f=K,Yt.f=H.f=$,Xt.f=Xi,Ci.f=function(t){return wi(D(t),t)},F&&(Ui(Li[Ri],"description",{configurable:!0,get:function(){return Di(this).description}}),bt(xi,"propertyIsEnumerable",Yi,{unsafe:!0}))),Pt({global:!0,wrap:!0,forced:!X,sham:!X},{Symbol:Li}),Ai(le(x),function(t){_i(t)}),Pt({target:Oi,stat:!0,forced:!X},{for:function(t){var e=String(t);if(R(Wi,e))return Wi[e];t=Li(e);return Wi[e]=t,Hi[t]=e,t},keyFor:function(t){if(!zi(t))throw TypeError(t+" is not a symbol");if(R(Hi,t))return Hi[t]},useSetter:function(){Gi=!0},useSimple:function(){Gi=!1}}),Pt({target:"Object",stat:!0,forced:!X,sham:!F},{create:function(t,e){return void 0===e?Ee(t):Ei(Ee(t),e)},defineProperty:Qi,defineProperties:Ei,getOwnPropertyDescriptor:K}),Pt({target:"Object",stat:!0,forced:!X},{getOwnPropertyNames:$,getOwnPropertySymbols:Xi}),Pt({target:"Object",stat:!0,forced:T(function(){Xt.f(1)})},{getOwnPropertySymbols:function(t){return Xt.f(Dt(t))}}),Mi&&(co=!X||T(function(){var t=Li();return"[null]"!=Mi([t])||"{}"!=Mi({a:t})||"{}"!=Mi(Object(t))}),Pt({target:"JSON",stat:!0,forced:co},{stringify:function(t,e){for(var n,r=[t],i=1;i<arguments.length;)r.push(arguments[i++]);if((S(n=e)||void 0!==t)&&!zi(t))return kr(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!zi(e))return e}),r[1]=e,Mi.apply(null,r)}})),Li[Ri][Dr]||W(Li[Ri],Dr,Li[Ri].valueOf),me(Li,Oi),yt[ki]=!0,_i("asyncIterator");var $i,Ji,Zi,to,eo,K=B.f,no=L.Symbol;!F||"function"!=typeof no||"description"in no.prototype&&void 0===no().description||($i={},Rt(Ji=function(t){var e=arguments.length<1||void 0===t?void 0:String(t),t=this instanceof Ji?new no(e):void 0===e?no():no(e);return""===e&&($i[t]=!0),t},no),(fo=Ji.prototype=no.prototype).constructor=Ji,Zi=fo.toString,to="Symbol(test)"==String(no("test")),eo=/^Symbol\((.*)\)[^)]+$/,K(fo,"description",{configurable:!0,get:function(){var t=S(this)?this.valueOf():this,e=Zi.call(t);if(R($i,t))return"";e=to?e.slice(7,-1):e.replace(eo,"$1");return""===e?void 0:e}}),Pt({global:!0,forced:!0},{Symbol:Ji})),_i("hasInstance"),_i("isConcatSpreadable"),_i("iterator"),_i("match"),_i("matchAll"),_i("replace"),_i("search"),_i("species"),_i("split"),_i("toPrimitive"),_i("toStringTag"),_i("unscopables"),me(Math,"Math",!0),me(L.JSON,"JSON",!0);Bt.Symbol;_i("asyncDispose"),_i("dispose"),_i("observable"),_i("patternMatch"),_i("replaceAll");Ci.f("iterator");var ro=!T(function(){return Object.isExtensible(Object.preventExtensions({}))}),io=I(function(t){function n(t){e(t,r,{value:{objectID:"O"+ ++i,weakData:{}}})}var e=B.f,r=P("meta"),i=0,o=Object.isExtensible||function(){return!0},s=t.exports={REQUIRED:!1,fastKey:function(t,e){if(!S(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!R(t,r)){if(!o(t))return"F";if(!e)return"E";n(t)}return t[r].objectID},getWeakData:function(t,e){if(!R(t,r)){if(!o(t))return!0;if(!e)return!1;n(t)}return t[r].weakData},onFreeze:function(t){return ro&&s.REQUIRED&&o(t)&&!R(t,r)&&n(t),t}};yt[r]=!0}),$=(io.REQUIRED,io.fastKey,io.getWeakData,io.onFreeze,function(s,t,e){function n(t){var n=p[t];bt(p,t,"add"==t?function(t){return n.call(this,0===t?0:t),this}:"delete"==t?function(t){return!(h&&!S(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return h&&!S(t)?void 0:n.call(this,0===t?0:t)}:"has"==t?function(t){return!(h&&!S(t))&&n.call(this,0===t?0:t)}:function(t,e){return n.call(this,0===t?0:t,e),this})}var r,i,o,a,u,c=-1!==s.indexOf("Map"),h=-1!==s.indexOf("Weak"),l=c?"set":"add",f=L[s],p=f&&f.prototype,d=f,v={};return re(s,"function"!=typeof f||!(h||p.forEach&&!T(function(){(new f).entries().next()})))?(d=e.getConstructor(t,s,c,l),io.REQUIRED=!0):re(s,!0)&&(i=(r=new d)[l](h?{}:-0,1)!=r,o=T(function(){r.has(1)}),a=yn(function(t){new f(t)}),u=!h&&T(function(){for(var t=new f,e=5;e--;)t[l](e,e);return!t.has(-0)}),a||(((d=t(function(t,e){tn(t,d,s);var n,r,i,o,n=(n=new f,r=t,t=d,Ne&&"function"==typeof(i=r.constructor)&&i!==t&&S(o=i.prototype)&&o!==t.prototype&&Ne(n,o),n);return null!=e&&ln(e,n[l],n,c),n})).prototype=p).constructor=d),(o||u)&&(n("delete"),n("has"),c&&n("get")),(u||i)&&n(l),h&&p.clear&&delete p.clear),v[s]=d,Pt({global:!0,forced:d!=f},v),me(d,s),h||e.setStrong(d,s,c),d}),oo=B.f,so=io.fastKey,ao=mt.set,uo=mt.getterFor,co={getConstructor:function(t,n,r,i){function o(t,e,n){var r,i=a(t),o=u(t,e);return o?o.value=n:(i.last=o={index:r=so(e,!0),key:e,value:n,previous:n=i.last,next:void 0,removed:!1},i.first||(i.first=o),n&&(n.next=o),F?i.size++:t.size++,"F"!==r&&(i.index[r]=o)),t}var s=t(function(t,e){tn(t,s,n),ao(t,{type:n,index:Ee(null),first:void 0,last:void 0,size:0}),F||(t.size=0),null!=e&&ln(e,t[i],t,r)}),a=uo(n),u=function(t,e){var n,r=a(t),t=so(e);if("F"!==t)return r.index[t];for(n=r.first;n;n=n.next)if(n.key==e)return n};return $e(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,n=a(this),r=u(this,t);return r&&(e=r.next,t=r.previous,delete n.index[r.index],r.removed=!0,t&&(t.next=e),e&&(e.previous=t),n.first==r&&(n.first=e),n.last==r&&(n.last=t),F?n.size--:this.size--),!!r},forEach:function(t,e){for(var n,r=a(this),i=nn(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)}}),$e(s.prototype,r?{get:function(t){t=u(this,t);return t&&t.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&&oo(s.prototype,"size",{get:function(){return a(this).size}}),s},setStrong:function(t,e,n){var r=e+" Iterator",i=uo(e),o=uo(r);we(t,e,function(t,e){ao(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),Je(e)}},Dr=($("Map",function(e){return function(t){return e(this,arguments.length?t:void 0)}},co),Bt.Map,function(t,e,n){var r,i,o,s=arguments.length,a=1<s?e:void 0;return Ze(this),(e=void 0!==a)&&Ze(a),null==t?new this:(r=[],e?(i=0,o=nn(a,2<s?n:void 0,2),ln(t,function(t){r.push(o(t,i++))})):ln(t,r.push,r),new this(r))});Pt({target:"Map",stat:!0},{from:Dr});K=function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)};Pt({target:"Map",stat:!0},{of:K});function ho(){for(var t,e=N(this),n=Ze(e.delete),r=!0,i=0,o=arguments.length;i<o;i++)t=n.call(e,arguments[i]),r=r&&t;return!!r}Pt({target:"Map",proto:!0,real:!0,forced:M},{deleteAll:function(){return ho.apply(this,arguments)}});function lo(t){return Map.prototype.entries.call(t)}Pt({target:"Map",proto:!0,real:!0,forced:M},{every:function(t,e){var n=N(this),r=lo(n),i=nn(t,1<arguments.length?e:void 0,3);return!ln(r,function(t,e){if(!i(e,t,n))return ln.stop()},void 0,!0,!0).stopped}}),Pt({target:"Map",proto:!0,real:!0,forced:M},{filter:function(t,e){var n=N(this),r=lo(n),i=nn(t,1<arguments.length?e:void 0,3),o=new(gn(n,At("Map"))),s=Ze(o.set);return ln(r,function(t,e){i(e,t,n)&&s.call(o,t,e)},void 0,!0,!0),o}}),Pt({target:"Map",proto:!0,real:!0,forced:M},{find:function(t,e){var n=N(this),r=lo(n),i=nn(t,1<arguments.length?e:void 0,3);return ln(r,function(t,e){if(i(e,t,n))return ln.stop(e)},void 0,!0,!0).result}}),Pt({target:"Map",proto:!0,real:!0,forced:M},{findKey:function(t,e){var n=N(this),r=lo(n),i=nn(t,1<arguments.length?e:void 0,3);return ln(r,function(t,e){if(i(e,t,n))return ln.stop(t)},void 0,!0,!0).result}}),Pt({target:"Map",stat:!0},{groupBy:function(t,n){var r=new this;Ze(n);var i=Ze(r.has),o=Ze(r.get),s=Ze(r.set);return ln(t,function(t){var e=n(t);i.call(r,e)?o.call(r,e).push(t):s.call(r,e,[t])}),r}});Pt({target:"Map",proto:!0,real:!0,forced:M},{includes:function(r){return ln(lo(N(this)),function(t,e){if((n=e)===(e=r)||n!=n&&e!=e)return ln.stop();var n},void 0,!0,!0).stopped}}),Pt({target:"Map",stat:!0},{keyBy:function(t,e){var n=new this;Ze(e);var r=Ze(n.set);return ln(t,function(t){r.call(n,e(t),t)}),n}}),Pt({target:"Map",proto:!0,real:!0,forced:M},{keyOf:function(n){return ln(lo(N(this)),function(t,e){if(e===n)return ln.stop(t)},void 0,!0,!0).result}}),Pt({target:"Map",proto:!0,real:!0,forced:M},{mapKeys:function(t,e){var n=N(this),r=lo(n),i=nn(t,1<arguments.length?e:void 0,3),o=new(gn(n,At("Map"))),s=Ze(o.set);return ln(r,function(t,e){s.call(o,i(e,t,n),e)},void 0,!0,!0),o}}),Pt({target:"Map",proto:!0,real:!0,forced:M},{mapValues:function(t,e){var n=N(this),r=lo(n),i=nn(t,1<arguments.length?e:void 0,3),o=new(gn(n,At("Map"))),s=Ze(o.set);return ln(r,function(t,e){s.call(o,t,i(e,t,n))},void 0,!0,!0),o}}),Pt({target:"Map",proto:!0,real:!0,forced:M},{merge:function(){for(var t=N(this),e=Ze(t.set),n=0;n<arguments.length;)ln(arguments[n++],e,t,!0);return t}}),Pt({target:"Map",proto:!0,real:!0,forced:M},{reduce:function(n,t){var r=N(this),e=lo(r),i=arguments.length<2,o=i?void 0:t;if(Ze(n),ln(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}}),Pt({target:"Map",proto:!0,real:!0,forced:M},{some:function(t,e){var n=N(this),r=lo(n),i=nn(t,1<arguments.length?e:void 0,3);return ln(r,function(t,e){if(i(e,t,n))return ln.stop()},void 0,!0,!0).stopped}}),Pt({target:"Map",proto:!0,real:!0,forced:M},{update:function(t,e,n){var r=N(this),i=arguments.length;Ze(e);var o=r.has(t);if(!o&&i<3)throw TypeError("Updating absent value");n=o?r.get(t):Ze(2<i?n:void 0)(t,r);return r.set(t,e(n,t,r)),r}});var fo=function(t,e,n){var r,i=N(this),n=2<arguments.length?n:void 0;if("function"!=typeof e&&"function"!=typeof n)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 n&&(r=n(),i.set(t,r)),r};Pt({target:"Map",proto:!0,real:!0,forced:M},{upsert:fo}),Pt({target:"Map",proto:!0,real:!0,forced:M},{updateOrInsert:fo});$("Set",function(e){return function(t){return e(this,arguments.length?t:void 0)}},co),Bt.Set;Pt({target:"Set",stat:!0},{from:Dr}),Pt({target:"Set",stat:!0},{of:K});Pt({target:"Set",proto:!0,real:!0,forced:M},{addAll:function(){return function(){for(var t=N(this),e=Ze(t.add),n=0,r=arguments.length;n<r;n++)e.call(t,arguments[n]);return t}.apply(this,arguments)}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{deleteAll:function(){return ho.apply(this,arguments)}});function po(t){return Set.prototype.values.call(t)}Pt({target:"Set",proto:!0,real:!0,forced:M},{every:function(t,e){var n=N(this),r=po(n),i=nn(t,1<arguments.length?e:void 0,3);return!ln(r,function(t){if(!i(t,t,n))return ln.stop()},void 0,!1,!0).stopped}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{difference:function(t){var e=N(this),n=new(gn(e,At("Set")))(e),r=Ze(n.delete);return ln(t,function(t){r.call(n,t)}),n}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{filter:function(t,e){var n=N(this),r=po(n),i=nn(t,1<arguments.length?e:void 0,3),o=new(gn(n,At("Set"))),s=Ze(o.add);return ln(r,function(t){i(t,t,n)&&s.call(o,t)},void 0,!1,!0),o}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{find:function(t,e){var n=N(this),r=po(n),i=nn(t,1<arguments.length?e:void 0,3);return ln(r,function(t){if(i(t,t,n))return ln.stop(t)},void 0,!1,!0).result}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{intersection:function(t){var e=N(this),n=new(gn(e,At("Set"))),r=Ze(e.has),i=Ze(n.add);return ln(t,function(t){r.call(e,t)&&i.call(n,t)}),n}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{isDisjointFrom:function(t){var e=N(this),n=Ze(e.has);return!ln(t,function(t){if(!0===n.call(e,t))return ln.stop()}).stopped}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{isSubsetOf:function(t){var e=function(t){var e=rn(t);if("function"!=typeof e)throw TypeError(String(t)+" is not iterable");return N(e.call(t))}(this),n=N(t),r=n.has;return"function"!=typeof r&&(n=new(At("Set"))(t),r=Ze(n.has)),!ln(e,function(t){if(!1===r.call(n,t))return ln.stop()},void 0,!1,!0).stopped}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{isSupersetOf:function(t){var e=N(this),n=Ze(e.has);return!ln(t,function(t){if(!1===n.call(e,t))return ln.stop()}).stopped}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{join:function(t){var e=N(this),n=po(e),e=void 0===t?",":String(t),t=[];return ln(n,t.push,t,!1,!0),t.join(e)}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{map:function(t,e){var n=N(this),r=po(n),i=nn(t,1<arguments.length?e:void 0,3),o=new(gn(n,At("Set"))),s=Ze(o.add);return ln(r,function(t){s.call(o,i(t,t,n))},void 0,!1,!0),o}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{reduce:function(e,t){var n=N(this),r=po(n),i=arguments.length<2,o=i?void 0:t;if(Ze(e),ln(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}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{some:function(t,e){var n=N(this),r=po(n),i=nn(t,1<arguments.length?e:void 0,3);return ln(r,function(t){if(i(t,t,n))return ln.stop()},void 0,!1,!0).stopped}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{symmetricDifference:function(t){var e=N(this),n=new(gn(e,At("Set")))(e),r=Ze(n.delete),i=Ze(n.add);return ln(t,function(t){r.call(n,t)||i.call(n,t)}),n}}),Pt({target:"Set",proto:!0,real:!0,forced:M},{union:function(t){var e=N(this),e=new(gn(e,At("Set")))(e);return ln(t,Ze(e.add),e),e}});var vo=Math.floor;Pt({target:"Number",stat:!0},{isInteger:function(t){return!S(t)&&isFinite(t)&&vo(t)===t}});Bt.Number.isInteger;Pt({target:"Number",stat:!0},{isNaN:function(t){return t!=t}});Bt.Number.isNaN;var yo=function(t,e){return(yo=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 go(t,e){function n(){this.constructor=t}yo(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var mo=function(){return(mo=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 bo(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 _o(n,r){var i,o,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"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 wo(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 Eo(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 Io(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Eo(arguments[e]));return t}function To(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,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 So(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 Co(t){try{return Oo.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}var No={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},Ao=function(t,e){if(!t)throw ko(e)},ko=function(t){return new Error("Firebase Database ("+No.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},Oo={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,o=(3&o)<<4|a>>4,a=(15&a)<<2|c>>6,c=63&c;u||(c=64,s||(a=64)),r.push(n[h],n[o],n[a],n[c])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(So(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,o,s,a=t[n++];a<128?e[r++]=String.fromCharCode(a):191<a&&a<224?(o=t[n++],e[r++]=String.fromCharCode((31&a)<<6|63&o)):239<a&&a<365?(i=((7&a)<<18|(63&(o=t[n++]))<<12|(63&(s=t[n++]))<<6|63&t[n++])-65536,e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))):(o=t[n++],s=t[n++],e[r++]=String.fromCharCode((15&a)<<12|(63&o)<<6|63&s))}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();o=o<<2|s>>4;r.push(o),64!==a&&(s=s<<4&240|a>>2,r.push(s),64!==u&&(u=a<<6&192|u,r.push(u)))}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 Ro(t){return Po(void 0,t)}function Po(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]=Po(t[n],e[n]));return t}var Do=(xo.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))}},xo);function xo(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}function Lo(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function Mo(){return"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Lo())}function Fo(){var t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}function Uo(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function jo(){return!0===No.NODE_ADMIN}function Vo(){return"indexedDB"in self&&null!=indexedDB}function qo(){return new Promise(function(t,e){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=window.indexedDB.open(r);i.onsuccess=function(){i.result.close(),n||window.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=function(){n=!1},i.onerror=function(){var t;e((null===(t=i.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})}function Bo(){return!(!navigator||!navigator.cookieEnabled)}var Wo,Ho="FirebaseError",Go=(go(Ko,Wo=Error),Ko);function Ko(t,e){e=Wo.call(this,e)||this;return e.code=t,e.name=Ho,Object.setPrototypeOf(e,Ko.prototype),Error.captureStackTrace&&Error.captureStackTrace(e,zo.prototype.create),e}var zo=(Qo.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,t=this.errors[t],t=t?(r=i,t.replace(Yo,function(t,e){var n=r[e];return null!=n?String(n):"<"+e+"?>"})):"Error",t=this.serviceName+": "+t+" ("+o+").",s=new Go(o,t),a=0,u=Object.keys(i);a<u.length;a++){var c=u[a];"_"!==c.slice(-1)&&(c in s&&console.warn('Overwriting FirebaseError base field "'+c+'" can cause unexpected behavior.'),s[c]=i[c])}return s},Qo);function Qo(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var Yo=/\{\$([^}]+)}/g;function Xo(t){return JSON.parse(t)}function $o(t){return JSON.stringify(t)}function Jo(t){var e={},n={},r={},i="";try{var o=t.split("."),e=Xo(Co(o[0])||""),n=Xo(Co(o[1])||""),i=o[2],r=n.d||{};delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}}function Zo(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ts(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function es(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function ns(t,e,n){var r,i={};for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=e.call(n,t[r],r,t));return i}var rs=(is.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},is.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)}for(var o,s,a=this.chain_[0],u=this.chain_[1],c=this.chain_[2],h=this.chain_[3],l=this.chain_[4],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},is.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}},is.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_);for(var r=0,n=0;n<5;n++)for(var i=24;0<=i;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t},is);function is(){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 os(t,e){e=new ss(t,e);return e.subscribe.bind(e)}var ss=(as.prototype.next=function(e){this.forEachObserver(function(t){t.next(e)})},as.prototype.error=function(e){this.forEachObserver(function(t){t.error(e)}),this.close(e)},as.prototype.complete=function(){this.forEachObserver(function(t){t.complete()}),this.close()},as.prototype.subscribe=function(t,e,n){var r,i=this;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(t,e){if("object"!=typeof t||null===t)return!1;for(var n=0,r=e;n<r.length;n++){var i=r[n];if(i in t&&"function"==typeof t[i])return!0}return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n}).next&&(r.next=us),void 0===r.error&&(r.error=us),void 0===r.complete&&(r.complete=us);n=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),n},as.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))},as.prototype.forEachObserver=function(t){if(!this.finalized)for(var e=0;e<this.observers.length;e++)this.sendOne(e,t)},as.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)}})},as.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}))},as);function as(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 us(){}function cs(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 hs(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?")}t+=" failed: ";return t+=r+" argument "}function ls(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(hs(t,e,r)+"must be a valid function.")}function fs(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(hs(t,e,r)+"must be a valid context object.")}function ps(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 ds=1e3,vs=2,ys=144e5,gs=.5;function ms(t,e,n){void 0===e&&(e=ds),void 0===n&&(n=vs);n=e*Math.pow(n,t),t=Math.round(gs*n*(Math.random()-.5)*2);return Math.min(ys,n+t)}var bs=(_s.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},_s.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},_s.prototype.setServiceProps=function(t){return this.serviceProps=t,this},_s);function _s(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var ws="[DEFAULT]",Es=(Is.prototype.get=function(t){void 0===t&&(t=ws);var e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){var n=new Do;this.instancesDeferred.set(e,n);try{var r=this.getOrInitializeService(e);r&&n.resolve(r)}catch(t){}}return this.instancesDeferred.get(e).promise},Is.prototype.getImmediate=function(t){var e=mo({identifier:ws,optional:!1},t),t=e.identifier,n=e.optional,r=this.normalizeInstanceIdentifier(t);try{var i=this.getOrInitializeService(r);if(i)return i;if(n)return null;throw Error("Service "+this.name+" is not available")}catch(t){if(n)return null;throw t}},Is.prototype.getComponent=function(){return this.component},Is.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(ws)}catch(t){}try{for(var r=wo(this.instancesDeferred.entries()),i=r.next();!i.done;i=r.next()){var o=Eo(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}}},Is.prototype.clearInstance=function(t){void 0===t&&(t=ws),this.instancesDeferred.delete(t),this.instances.delete(t)},Is.prototype.delete=function(){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return e=Array.from(this.instances.values()),[4,Promise.all(Io(e.filter(function(t){return"INTERNAL"in t}).map(function(t){return t.INTERNAL.delete()}),e.filter(function(t){return"_delete"in t}).map(function(t){return t._delete()})))];case 1:return t.sent(),[2]}})})},Is.prototype.isComponentSet=function(){return null!=this.component},Is.prototype.getOrInitializeService=function(t){var e,n=this.instances.get(t);return!n&&this.component&&(n=this.component.instanceFactory(this.container,(e=t)===ws?void 0:e),this.instances.set(t,n)),n||null},Is.prototype.normalizeInstanceIdentifier=function(t){return!this.component||this.component.multipleInstances?t:ws},Is);function Is(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}var Ts=(Ss.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)},Ss.prototype.addOrOverwriteComponent=function(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)},Ss.prototype.getProvider=function(t){if(this.providers.has(t))return this.providers.get(t);var e=new Es(t,this);return this.providers.set(t,e),e},Ss.prototype.getProviders=function(){return Array.from(this.providers.values())},Ss);function Ss(t){this.name=t,this.providers=new Map}function Cs(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,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 Ns,As=[];(Dr=Ns=Ns||{})[Dr.DEBUG=0]="DEBUG",Dr[Dr.VERBOSE=1]="VERBOSE",Dr[Dr.INFO=2]="INFO",Dr[Dr.WARN=3]="WARN",Dr[Dr.ERROR=4]="ERROR",Dr[Dr.SILENT=5]="SILENT";function ks(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=Ps[e];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+e+")");console[o].apply(console,Cs(["["+i+"] "+t.name+":"],n))}}var Os={debug:Ns.DEBUG,verbose:Ns.VERBOSE,info:Ns.INFO,warn:Ns.WARN,error:Ns.ERROR,silent:Ns.SILENT},Rs=Ns.INFO,Ps=((K={})[Ns.DEBUG]="log",K[Ns.VERBOSE]="log",K[Ns.INFO]="info",K[Ns.WARN]="warn",K[Ns.ERROR]="error",K),Ds=(Object.defineProperty(xs.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in Ns))throw new TypeError('Invalid value "'+t+'" assigned to `logLevel`');this._logLevel=t},enumerable:!1,configurable:!0}),xs.prototype.setLogLevel=function(t){this._logLevel="string"==typeof t?Os[t]:t},Object.defineProperty(xs.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:!1,configurable:!0}),Object.defineProperty(xs.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!1,configurable:!0}),xs.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Cs([this,Ns.DEBUG],t)),this._logHandler.apply(this,Cs([this,Ns.DEBUG],t))},xs.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Cs([this,Ns.VERBOSE],t)),this._logHandler.apply(this,Cs([this,Ns.VERBOSE],t))},xs.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Cs([this,Ns.INFO],t)),this._logHandler.apply(this,Cs([this,Ns.INFO],t))},xs.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Cs([this,Ns.WARN],t)),this._logHandler.apply(this,Cs([this,Ns.WARN],t))},xs.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Cs([this,Ns.ERROR],t)),this._logHandler.apply(this,Cs([this,Ns.ERROR],t))},xs);function xs(t){this.name=t,this._logLevel=Rs,this._logHandler=ks,this._userLogHandler=null,As.push(this)}function Ls(e){As.forEach(function(t){t.setLogLevel(e)})}var Dr=((M={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",M["bad-app-name"]="Illegal App name: '{$appName}",M["duplicate-app"]="Firebase App named '{$appName}' already exists",M["app-deleted"]="Firebase App named '{$appName}' already deleted",M["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",M["invalid-log-argument"]="First argument to `onLog` must be null or a function.",M),Ms=new zo("app","Firebase",Dr),Fs="@firebase/app",Us="[DEFAULT]",js=((K={})[Fs]="fire-core",K["@firebase/analytics"]="fire-analytics",K["@firebase/auth"]="fire-auth",K["@firebase/database"]="fire-rtdb",K["@firebase/functions"]="fire-fn",K["@firebase/installations"]="fire-iid",K["@firebase/messaging"]="fire-fcm",K["@firebase/performance"]="fire-perf",K["@firebase/remote-config"]="fire-rc",K["@firebase/storage"]="fire-gcs",K["@firebase/firestore"]="fire-fst",K["fire-js"]="fire-js",K["firebase-wrapper"]="fire-js-all",K),Vs=new Ds("@firebase/app"),qs=(Object.defineProperty(Bs.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(t){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=t},enumerable:!1,configurable:!0}),Object.defineProperty(Bs.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(Bs.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),Bs.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})},Bs.prototype._getService=function(t,e){return void 0===e&&(e=Us),this.checkDestroyed_(),this.container.getProvider(t).getImmediate({identifier:e})},Bs.prototype._removeServiceInstance=function(t,e){void 0===e&&(e=Us),this.container.getProvider(t).clearInstance(e)},Bs.prototype._addComponent=function(e){try{this.container.addComponent(e)}catch(t){Vs.debug("Component "+e.name+" failed to register with FirebaseApp "+this.name,t)}},Bs.prototype._addOrOverwriteComponent=function(t){this.container.addOrOverwriteComponent(t)},Bs.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw Ms.create("app-deleted",{appName:this.name_})},Bs);function Bs(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_=Ro(t),this.container=new Ts(e.name),this._addComponent(new bs("app",function(){return o},"PUBLIC"));try{for(var s=wo(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}}}qs.prototype.name&&qs.prototype.options||qs.prototype.delete||console.log("dc");var Ws="7.23.0";function Hs(u){var c={},h=new Map,l={__esModule:!0,initializeApp:function(t,e){void 0===e&&(e={});{"object"==typeof e&&null!==e||(e={name:e})}var n=e;void 0===n.name&&(n.name=Us);e=n.name;if("string"!=typeof e||!e)throw Ms.create("bad-app-name",{appName:String(e)});if(Zo(c,e))throw Ms.create("duplicate-app",{appName:e});n=new u(t,n,l);return c[e]=n},app:f,registerVersion:function(t,e,n){var r=null!==(i=js[t])&&void 0!==i?i:t;n&&(r+="-"+n);var i=r.match(/\s|\//),t=e.match(/\s|\//);if(i||t){n=['Unable to register library "'+r+'" with version "'+e+'":'];return i&&n.push('library name "'+r+'" contains illegal characters (whitespace or "/")'),i&&t&&n.push("and"),t&&n.push('version name "'+e+'" contains illegal characters (whitespace or "/")'),void Vs.warn(n.join(" "))}o(new bs(r+"-version",function(){return{library:r,version:e}},"VERSION"))},setLogLevel:Ls,onLog:function(t,e){if(null!==t&&"function"!=typeof t)throw Ms.create("invalid-log-argument",{appName:name});!function(s,e){for(var t=0,n=As;t<n.length;t++){!function(t){var o=null;e&&e.level&&(o=Os[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:Ns[e].toLowerCase(),message:i,args:n,type:t.name})}}(n[t])}}(t,e)},apps:null,SDK_VERSION:Ws,INTERNAL:{registerComponent:o,removeApp:function(t){delete c[t]},components:h,useAsService:function(t,e){if("serverAuth"===e)return null;return e}}};function f(t){if(!Zo(c,t=t||Us))throw Ms.create("no-app",{appName:t});return c[t]}function o(n){var e,t,r,i=n.name;if(h.has(i))return Vs.debug("There were multiple attempts to register component "+i+"."),"PUBLIC"===n.type?l[i]:null;h.set(i,n),"PUBLIC"===n.type&&(r=function(t){if(void 0===t&&(t=f()),"function"!=typeof t[i])throw Ms.create("invalid-app-argument",{appName:i});return t[i]()},void 0!==n.serviceProps&&Po(r,n.serviceProps),l[i]=r,u.prototype[i]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._getService.bind(this,i).apply(this,n.multipleInstances?t:[])});try{for(var o=wo(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[i]: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 M=function t(){var e=Hs(qs);return e.INTERNAL=mo(mo({},e.INTERNAL),{createFirebaseNamespace:t,extendNamespace:function(t){Po(e,t)},createSubscribe:os,ErrorFactory:zo,deepExtend:Po}),e}(),Gs=(Ks.prototype.getPlatformInfoString=function(){return this.container.getProviders().map(function(t){if(function(t){t=t.getComponent();return"VERSION"===(null==t?void 0:t.type)}(t)){t=t.getImmediate();return t.library+"/"+t.version}return null}).filter(function(t){return t}).join(" ")},Ks);function Ks(t){this.container=t}"object"==typeof self&&self.self===self&&void 0!==self.firebase&&(Vs.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n "),(du=self.firebase.SDK_VERSION)&&0<=du.indexOf("LITE")&&Vs.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 zs=M.initializeApp;M.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}}()&&Vs.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 '),zs.apply(void 0,t)};var Qs,Ys,Bl=M;(Qs=Bl).INTERNAL.registerComponent(new bs("platform-logger",function(t){return new Gs(t)},"PRIVATE")),Qs.registerVersion(Fs,"0.6.11",Ys),Qs.registerVersion("fire-js","");Bl.registerVersion("firebase","7.23.0","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 u=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=u;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 s(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 a(e){return e instanceof s?e:new s(function(t){t(e)})}if(t)return t;e.prototype.b=function(t){var e;null==this.a&&(this.a=[],(e=this).c(function(){e.g()})),this.a.push(t)};var n=u.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})},s.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)}},s.prototype.m=function(t){if(t===this)this.g(new TypeError("A Promise cannot resolve to itself"));else if(t instanceof s)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)}},s.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)},s.prototype.g=function(t){this.i(2,t)},s.prototype.h=function(t){this.i(1,t)},s.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()},s.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 s.prototype.s=function(t){var e=this.f();t.Oa(e.resolve,e.reject)},s.prototype.w=function(t,e){var n=this.f();try{t.call(e,n.resolve,n.reject)}catch(t){n.reject(t)}},s.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 s(function(t,e){r=t,i=e});return this.Oa(n(t,r),n(e,i)),o},s.prototype.catch=function(t){return this.then(void 0,t)},s.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)},s.resolve=a,s.reject=function(n){return new s(function(t,e){e(n)})},s.race=function(i){return new s(function(t,e){for(var n=c(i),r=n.next();!r.done;r=n.next())a(r.value).Oa(t,e)})},s.all=function(t){var e=c(t),o=e.next();return o.done?a([]):new s(function(n,t){for(var r=[],i=0;r.push(void 0),i++,a(o.value).Oa(function(e){return function(t){r[e]=t,0==--i&&n(r)}}(r.length-1),t),!(o=e.next()).done;);})},s});var h=h||{},l=this||self,a=/^[\w+/_-]+[=]{0,2}$/,f=null;function s(){}function n(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}function p(t){var e=n(t);return"array"==e||"object"==e&&"number"==typeof t.length}function d(t){return"function"==n(t)}function v(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var e="closure_uid_"+(1e9*Math.random()>>>0),r=0;function i(t,e,n){return t.call.apply(t.bind,arguments)}function y(e,n,t){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var t=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(t,r),e.apply(n,t)}}return function(){return e.apply(n,arguments)}}function g(t,e,n){return(g=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?i:y).apply(null,arguments)}function m(e){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 b=Date.now||function(){return+new Date};function _(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=T+t,this.message=e||S[t]||"",this.a=n||null}function E(t){var e=t&&t.code;return e?new w(e.substring(T.length),t.message,t.serverResponse):null}_(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 I,T="auth/",S={"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","expired-action-code":"The action code has expired. ","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal error has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registed for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal error has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal error has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-or-invalid-nonce":"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network error (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal error has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled."},C={hd:{Ra:"https://staging-identitytoolkit.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",Xa:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Ua:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"b"},pd:{Ra:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",Xa:"https://securetoken.googleapis.com/v1/token",Ua:"https://identitytoolkit.googleapis.com/v2/",id:"p"},rd:{Ra:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",Xa:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Ua:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"s"},sd:{Ra:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",Xa:"https://test-securetoken.sandbox.googleapis.com/v1/token",Ua:"https://test-identitytoolkit.sandbox.googleapis.com/v2/",id:"t"}};function N(t){for(var e in C)if(C[e].id===t)return t=C[e],{firebaseEndpoint:t.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){var e;Error.captureStackTrace?Error.captureStackTrace(this,k):(e=Error().stack)&&(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){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}I=N("__EID__")?"__EID__":void 0,_(k,Error),k.prototype.name="CustomError",_(O,k),O.prototype.name="AssertionError",P.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};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,r=t.length,i=[],o=0,s="string"==typeof t?t.split(""):t,a=0;a<r;a++){a in s&&(n=s[a],e.call(void 0,n,a,t)&&(i[o++]=n))}return i},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(){return Array.prototype.concat.apply([],arguments)}function K(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}var z,Q=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]},Y=/&/g,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){it=it.userAgent;if(it){z=it;break t}}z=""}function ot(t){return nt(z,t)}function st(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function at(t){for(var e in t)return;return 1}function ut(t){var e,n={};for(e in t)n[e]=t[e];return n}var ct="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function ht(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<ct.length;i++)e=ct[i],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function lt(t,e){t:{try{var n=t&&t.ownerDocument,n=n&&(n.defaultView||n.parentWindow);if((n=n||l).Element&&n.Location){var r=n;break t}}catch(t){}r=null}if(r&&void 0!==r[e]&&(!t||!(t instanceof r[e])&&(t instanceof r.Location||t instanceof r.Element))){if(v(t))try{var i=t.constructor.displayName||t.constructor.name||Object.prototype.toString.call(t)}catch(t){i="<object could not be stringified>"}else i=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,i)}}function ft(t,e){this.a=t===vt&&e||"",this.b=dt}function pt(t){return t instanceof ft&&t.constructor===ft&&t.b===dt?t.a:(R("expected object of type Const, got '"+t+"'"),"type_error:Const")}ft.prototype.ra=!0,ft.prototype.qa=function(){return this.a},ft.prototype.toString=function(){return"Const{"+this.a+"}"};var dt={},vt={},yt=new ft(vt,"");function gt(t,e){this.a=t===It&&e||"",this.b=Et}function mt(t){return t instanceof gt&&t.constructor===gt&&t.b===Et?t.a:(R("expected object of type TrustedResourceUrl, got '"+t+"' of type "+n(t)),"type_error:TrustedResourceUrl")}function bt(t,n){var r=pt(t);if(!wt.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return t=r.replace(_t,function(t,e){if(!Object.prototype.hasOwnProperty.call(n,e))throw Error('Found marker, "'+e+'", in format string, "'+r+'", but no valid label mapping found in args: '+JSON.stringify(n));return(t=n[e])instanceof ft?pt(t):encodeURIComponent(String(t))}),new gt(It,t)}gt.prototype.ra=!0,gt.prototype.qa=function(){return this.a.toString()},gt.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var _t=/%{(\w+)}/g,wt=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,Et={},It={};function Tt(t,e){this.a=t===kt&&e||"",this.b=At}function St(t){return t instanceof Tt&&t.constructor===Tt&&t.b===At?t.a:(R("expected object of type SafeUrl, got '"+t+"' of type "+n(t)),"type_error:SafeUrl")}Tt.prototype.ra=!0,Tt.prototype.qa=function(){return this.a.toString()},Tt.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Ct=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function Nt(t){return t instanceof Tt?t:(t="object"==typeof t&&t.ra?t.qa():String(t),Ct.test(t)||(t="about:invalid#zClosurez"),new Tt(kt,t))}var At={},kt={};function Ot(){this.a="",this.b=Pt}function Rt(t){return t instanceof Ot&&t.constructor===Ot&&t.b===Pt?t.a:(R("expected object of type SafeHtml, got '"+t+"' of type "+n(t)),"type_error:SafeHtml")}Ot.prototype.ra=!0,Ot.prototype.qa=function(){return this.a.toString()},Ot.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Pt={};function Dt(t){var e=new Ot;return e.a=t,e}Dt("<!DOCTYPE html>");var xt=Dt("");function Lt(t){for(var e=t.split("%s"),n="",r=Array.prototype.slice.call(arguments,1);r.length&&1<e.length;)n+=e.shift()+r.shift();return n+e.join("%s")}function Mt(t){return et.test(t)&&(-1!=t.indexOf("&")&&(t=t.replace(Y,"&")),-1!=t.indexOf("<")&&(t=t.replace(X,"<")),-1!=t.indexOf(">")&&(t=t.replace($,">")),-1!=t.indexOf('"')&&(t=t.replace(J,""")),-1!=t.indexOf("'")&&(t=t.replace(Z,"'")),-1!=t.indexOf("\0")&&(t=t.replace(tt,"�"))),t}function Ft(t){return Ft[" "](t),t}Dt("<br>"),Ft[" "]=s;var Ut,jt=ot("Opera"),Vt=ot("Trident")||ot("MSIE"),qt=ot("Edge"),Bt=qt||Vt,Wt=ot("Gecko")&&!(nt(z.toLowerCase(),"webkit")&&!ot("Edge"))&&!(ot("Trident")||ot("MSIE"))&&!ot("Edge"),Ht=nt(z.toLowerCase(),"webkit")&&!ot("Edge");function Gt(){var t=l.document;return t?t.documentMode:void 0}t:{var Kt="",zt=(zt=z,Wt?/rv:([^\);]+)(\)|;)/.exec(zt):qt?/Edge\/([\d\.]+)/.exec(zt):Vt?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(zt):Ht?/WebKit\/(\S+)/.exec(zt):jt?/(?:Version)[ \/]?(\S+)/.exec(zt):void 0);if(zt&&(Kt=zt?zt[1]:""),Vt){zt=Gt();if(null!=zt&&zt>parseFloat(Kt)){Ut=String(zt);break t}}Ut=Kt}var Qt,Yt={};function Xt(a){return t=a,e=function(){for(var t=0,e=Q(String(Ut)).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=Yt,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}Qt=l.document&&Vt?Gt():void 0;try{new self.OffscreenCanvas(0,0).getContext("2d")}catch(t){}var $t=!Vt||9<=Number(Qt);function Jt(t){var e=document;return"string"==typeof t?e.getElementById(t):t}function Zt(n,t){st(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:ne.hasOwnProperty(e)?n.setAttribute(ne[e],t):0==e.lastIndexOf("aria-",0)||0==e.lastIndexOf("data-",0)?n.setAttribute(e,t):n[e]=t})}var te,ee,ne={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 re(){var t,e=arguments,n=document,r=String(e[0]),i=e[1];return!$t&&i&&(i.name||i.type)&&(r=["<",r],i.name&&r.push(' name="',Mt(i.name),'"'),i.type&&(r.push(' type="',Mt(i.type),'"'),ht(t={},i),delete t.type,i=t),r.push(">"),r=r.join("")),r=ie(n,r),i&&("string"==typeof i?r.className=i:Array.isArray(i)?r.className=i.join(" "):Zt(r,i)),2<e.length&&function(e,n,t){function r(t){t&&n.appendChild("string"==typeof t?e.createTextNode(t):t)}for(var i=2;i<t.length;i++){var o=t[i];!p(o)||v(o)&&0<o.nodeType?r(o):U(function(t){if(t&&"number"==typeof t.length){if(v(t))return"function"==typeof t.item||"string"==typeof t.item;if(d(t))return"function"==typeof t.item}return!1}(o)?K(o):o,r)}}(n,r,e),r}function ie(t,e){return e=String(e),"application/xhtml+xml"===t.contentType&&(e=e.toLowerCase()),t.createElement(e)}function oe(t){l.setTimeout(function(){throw t},0)}function se(){var t=l.MessageChannel;if(void 0===t&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!ot("Presto")&&(t=function(){var t,e,n=ie(document,"IFRAME");n.style.display="none",t=n,e=new gt(It,pt(yt)),lt(t,"HTMLIFrameElement"),t.src=mt(e).toString(),document.documentElement.appendChild(n);var r=n.contentWindow;(n=r.document).open(),n.write(Rt(xt)),n.close();var i="callImmediate"+Math.random(),o="file:"==r.location.protocol?"*":r.location.protocol+"//"+r.location.host;n=g(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||ot("Trident")||ot("MSIE"))return function(t){l.setTimeout(t,0)};var e=new t,n={},r=n;return e.port1.onmessage=function(){var t;void 0!==n.next&&(t=(n=n.next).Db,n.Db=null,t())},function(t){r.next={Db:t},r=r.next,e.port2.postMessage(0)}}function ae(t,e){ee||function(){{var t;ee=l.Promise&&l.Promise.resolve?(t=l.Promise.resolve(void 0),function(){t.then(he)}):function(){var t=he;!d(l.setImmediate)||l.Window&&l.Window.prototype&&!ot("Edge")&&l.Window.prototype.setImmediate==l.setImmediate?(te=te||se())(t):l.setImmediate(t)}}}(),ue||(ee(),ue=!0),ce.add(t,e)}var ue=!1,ce=new x;function he(){for(var t,e,n;n=e=void 0,n=null,(e=ce).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){oe(t)}D(L,t)}ue=!1}function le(t,e){if(this.a=fe,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,t!=s)try{var n=this;t.call(e,function(t){Te(n,pe,t)},function(t){if(!(t instanceof Re))try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(t){}Te(n,de,t)})}catch(t){Te(this,de,t)}}var fe=0,pe=2,de=3;function ve(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}ve.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var ye=new P(function(){return new ve},function(t){t.reset()});function ge(t,e,n){var r=ye.get();return r.g=t,r.b=e,r.f=n,r}function me(t){if(t instanceof le)return t;var e=new le(s);return Te(e,pe,t),e}function be(n){return new le(function(t,e){e(n)})}function _e(t,e,n){Se(t,e,n,null)||ae(m(e,t))}function we(n){return new le(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++)_e(n[e],m(t,e,!0),m(t,e,!1));else r(o)})}function Ee(t,e){t.b||t.a!=pe&&t.a!=de||Ce(t),t.f?t.f.next=e:t.b=e,t.f=e}function Ie(t,i,o,s){var e=ge(null,null,null);return e.a=new le(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 Re?r(t):n(e)}catch(t){r(t)}}:r}),Ee(e.a.c=t,e),e.a}function Te(t,e,n){var r,i;t.a==fe&&(t===n&&(e=de,n=new TypeError("Promise cannot resolve to itself")),t.a=1,Se(n,t.Yc,t.Zc,t)||(t.i=n,t.a=e,t.c=null,Ce(t),e!=de||n instanceof Re||(i=n,(r=t).g=!0,ae(function(){r.g&&Oe.call(null,i)}))))}function Se(t,e,n,r){if(t instanceof le)return Ee(t,ge(e||s,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 Ce(t){t.h||(t.h=!0,ae(t.ec,t))}function Ne(t){var e=null;return t.b&&(e=t.b,t.b=e.next,e.next=null),t.b||(t.f=null),e}function Ae(t,e,n,r){if(n==de&&e.b&&!e.c)for(;t&&t.g;t=t.c)t.g=!1;if(e.a)e.a.c=null,ke(e,n,r);else try{e.c?e.g.call(e.f):ke(e,n,r)}catch(t){Oe.call(null,t)}D(ye,e)}function ke(t,e,n){e==pe?t.g.call(t.f,n):t.b&&t.b.call(t.f,n)}le.prototype.then=function(t,e,n){return Ie(this,d(t)?t:null,d(e)?e:null,n)},le.prototype.$goog_Thenable=!0,(t=le.prototype).ma=function(t,e){return(t=ge(t,t,e)).c=!0,Ee(this,t),this},t.o=function(t,e){return Ie(this,null,t,e)},t.cancel=function(t){var e;this.a==fe&&(e=new Re(t),ae(function(){!function t(e,n){if(e.a==fe)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==fe&&1==i?t(r,n):(s?((i=s).next==r.f&&(r.f=i),i.next=i.next.next):Ne(r),Ae(r,o,de,n)))}e.c=null}else Te(e,de,n)}(this,e)},this))},t.Yc=function(t){this.a=fe,Te(this,pe,t)},t.Zc=function(t){this.a=fe,Te(this,de,t)},t.ec=function(){for(var t;t=Ne(this);)Ae(this,t,this.a,this.i);this.h=!1};var Oe=oe;function Re(t){k.call(this,t)}function Pe(){this.wa=this.wa,this.na=this.na}_(Re,k);var De=0;function xe(t){t.wa||(t.wa=!0,t.Ba(),0==De)||(t=t,Object.prototype.hasOwnProperty.call(t,e)&&t[e]||(t[e]=++r))}Pe.prototype.wa=!(Re.prototype.name="cancel"),Pe.prototype.Ba=function(){if(this.na)for(;this.na.length;)this.na.shift()()};var Le=Object.freeze||function(t){return t},Me=!Vt||9<=Number(Qt),Fe=Vt&&!Xt("9"),Ue=function(){if(!l.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{l.addEventListener("test",s,e),l.removeEventListener("test",s,e)}catch(t){}return t}();function je(t,e){this.type=t,this.b=this.target=e,this.defaultPrevented=!1}function Ve(t,e){if(je.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(Wt){t:{try{Ft(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:qe[t.pointerType]||"",(this.a=t).defaultPrevented&&this.preventDefault()}}je.prototype.preventDefault=function(){this.defaultPrevented=!0},_(Ve,je);var qe=Le({2:"touch",3:"pen",4:"mouse"});Ve.prototype.preventDefault=function(){Ve.Za.preventDefault.call(this);var t=this.a;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,Fe)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}},Ve.prototype.f=function(){return this.a};var Be="closure_listenable_"+(1e6*Math.random()|0),We=0;function He(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=++We,this.ua=this.Na=!1}function Ge(t){t.ua=!0,t.listener=null,t.proxy=null,t.src=null,t.Ta=null}function Ke(t){this.src=t,this.a={},this.b=0}function ze(t,e){var n=e.type;n in t.a&&W(t.a[n],e)&&(Ge(e),0==t.a[n].length&&(delete t.a[n],t.b--))}function Qe(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}Ke.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=Qe(t,e,r,i);return-1<s?(e=t[s],n||(e.Na=!1)):((e=new He(e,this.src,o,!!r,i)).Na=n,t.push(e)),e};var Ye="closure_lm_"+(1e6*Math.random()|0),Xe={};function $e(t,e,n,r,i){if(r&&r.once)Ze(t,e,n,r,i);else if(Array.isArray(e))for(var o=0;o<e.length;o++)$e(t,e[o],n,r,i);else n=cn(n),t&&t[Be]?ln(t,e,n,v(r)?!!r.capture:!!r,i):Je(t,e,n,!1,r,i)}function Je(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s,a,u=v(i)?!!i.capture:!!i,c=an(t);if(c||(t[Ye]=c=new Ke(t)),!(n=c.add(e,n,r,u,o)).proxy)if(s=sn,r=a=Me?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)Ue||(i=u),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(nn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}}function Ze(t,e,n,r,i){if(Array.isArray(e))for(var o=0;o<e.length;o++)Ze(t,e[o],n,r,i);else n=cn(n),t&&t[Be]?fn(t,e,n,v(r)?!!r.capture:!!r,i):Je(t,e,n,!0,r,i)}function tn(t,e,n,r,i){if(Array.isArray(e))for(var o=0;o<e.length;o++)tn(t,e[o],n,r,i);else r=v(r)?!!r.capture:!!r,n=cn(n),t&&t[Be]?(t=t.u,(e=String(e).toString())in t.a&&(-1<(n=Qe(o=t.a[e],n,r,i))&&(Ge(o[n]),Array.prototype.splice.call(o,n,1),0==o.length&&(delete t.a[e],t.b--)))):(t=t&&an(t))&&(e=t.a[e.toString()],t=-1,e&&(t=Qe(e,n,r,i)),(n=-1<t?e[t]:null)&&en(n))}function en(t){var e,n,r;"number"!=typeof t&&t&&!t.ua&&((e=t.src)&&e[Be]?ze(e.u,t):(n=t.type,r=t.proxy,e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(nn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=an(e))?(ze(n,t),0==n.b&&(n.src=null,e[Ye]=null)):Ge(t)))}function nn(t){return t in Xe?Xe[t]:Xe[t]="on"+t}function rn(t,e,n,r){var i=!0;if((t=an(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=on(o,r),i=i&&!1!==o)}return i}function on(t,e){var n=t.listener,r=t.Ta||t.src;return t.Na&&en(t),n.call(r,e)}function sn(t,e){if(t.ua)return!0;if(Me)return on(t,new Ve(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 Ve(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=rn(r[i],t,!0,e),n=n&&o}for(i=0;i<r.length;i++)e.b=r[i],o=rn(r[i],t,!1,e),n=n&&o}return n}function an(t){return(t=t[Ye])instanceof Ke?t:null}var un="__closure_events_fn_"+(1e9*Math.random()>>>0);function cn(e){return d(e)?e:(e[un]||(e[un]=function(t){return e.handleEvent(t)}),e[un])}function hn(){Pe.call(this),this.u=new Ke(this),(this.Yb=this).eb=null}function ln(t,e,n,r,i){t.u.add(String(e),n,!1,r,i)}function fn(t,e,n,r,i){t.u.add(String(e),n,!0,r,i)}function pn(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,a,u=e[o];u&&!u.ua&&u.capture==n&&(s=u.listener,a=u.Ta||u.src,u.Na&&ze(t.u,u),i=!1!==s.call(a,r)&&i)}return i&&!r.defaultPrevented}function dn(t,e,n){if(d(t))n&&(t=g(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=g(t.handleEvent,t)}return 2147483647<Number(e)?-1:l.setTimeout(t,e||0)}function vn(n){var r=null;return new le(function(t,e){-1==(r=dn(function(){t(void 0)},n))&&e(Error("Failed to schedule timer."))}).o(function(t){throw l.clearTimeout(r),t})}function yn(t){if(t.V&&"function"==typeof t.V)return t.V();if("string"==typeof t)return t.split("");if(p(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}function gn(t){if(t.X&&"function"==typeof t.X)return t.X();if(!t.V||"function"!=typeof t.V){if(p(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}function mn(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 mn)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 bn(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];_n(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){for(var i={},n=e=0;e<t.a.length;)_n(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function _n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}_(hn,Pe),hn.prototype[Be]=!0,hn.prototype.addEventListener=function(t,e,n,r){$e(this,t,e,n,r)},hn.prototype.removeEventListener=function(t,e,n,r){tn(this,t,e,n,r)},hn.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 je(t,n):t instanceof je?t.target=t.target||n:(s=t,ht(t=new je(r,n),s)),s=!0,e)for(var i=e.length-1;0<=i;i--)var o=t.b=e[i],s=pn(o,r,!0,t)&&s;if(s=pn(o=t.b=n,r,!0,t)&&s,s=pn(o,r,!1,t)&&s,e)for(i=0;i<e.length;i++)s=pn(o=t.b=e[i],r,!1,t)&&s;return s},hn.prototype.Ba=function(){if(hn.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++)Ge(n[r]);delete e.a[t],e.b--}}this.eb=null},(t=mn.prototype).V=function(){bn(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},t.X=function(){return bn(this),this.a.concat()},t.clear=function(){this.b={},this.c=this.a.length=0},t.get=function(t,e){return _n(this.b,t)?this.b[t]:e},t.set=function(t,e){_n(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 wn=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/\\#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function En(t,e){var n;this.b=this.i=this.f="",this.l=null,this.g=this.c="",this.h=!1,t instanceof En?(this.h=void 0!==e?e:t.h,In(this,t.f),this.i=t.i,this.b=t.b,Tn(this,t.l),this.c=t.c,Sn(this,Hn(t.a)),this.g=t.g):t&&(n=String(t).match(wn))?(this.h=!!e,In(this,n[1]||"",!0),this.i=On(n[2]||""),this.b=On(n[3]||"",!0),Tn(this,n[4]),this.c=On(n[5]||"",!0),Sn(this,n[6]||"",!0),this.g=On(n[7]||"")):(this.h=!!e,this.a=new Un(null,this.h))}function In(t,e,n){t.f=n?On(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function Tn(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 Sn(t,e,n){var r,i;e instanceof Un?(t.a=e,r=t.a,(i=t.h)&&!r.f&&(jn(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(qn(this,e),Wn(this,n,t))},r)),r.f=i):(n||(e=Rn(e,Mn)),t.a=new Un(e,t.h))}function Cn(t,e,n){t.a.set(e,n)}function Nn(t,e){return t.a.get(e)}function An(t){return t instanceof En?new En(t):new En(t,void 0)}function kn(t,e){var n=new En(null,void 0);return In(n,"https"),t&&(n.b=t),e&&(n.c=e),n}function On(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Rn(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Pn),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Pn(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}En.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Rn(e,Dn,!0),":");var n=this.b;return!n&&"file"!=e||(t.push("//"),(e=this.i)&&t.push(Rn(e,Dn,!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(Rn(n,"/"==n.charAt(0)?Ln:xn,!0))),(n=this.a.toString())&&t.push("?",n),(n=this.g)&&t.push("#",Rn(n,Fn)),t.join("")},En.prototype.resolve=function(t){var e=new En(this),n=!!t.f;n?In(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,i=t.c;if(n)Tn(e,t.l);else if(n=!!t.c){if("/"!=i.charAt(0)&&(this.b&&!this.c?i="/"+i:-1!=(r=e.c.lastIndexOf("/"))&&(i=e.c.substr(0,r+1)+i)),".."==(r=i)||"."==r)i="";else if(nt(r,"./")||nt(r,"/.")){i=0==r.lastIndexOf("/",0),r=r.split("/");for(var o=[],s=0;s<r.length;){var a=r[s++];"."==a?i&&s==r.length&&o.push(""):".."==a?((1<o.length||1==o.length&&""!=o[0])&&o.pop(),i&&s==r.length&&o.push("")):(o.push(a),i=!0)}i=o.join("/")}else i=r}return n?e.c=i:n=""!==t.a.toString(),n?Sn(e,Hn(t.a)):n=!!t.g,n&&(e.g=t.g),e};var Dn=/[#\/\?@]/g,xn=/[#\?:]/g,Ln=/[#\?]/g,Mn=/[#\?@]/g,Fn=/#/g;function Un(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function jn(n){n.a||(n.a=new mn,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r,i=t[n].indexOf("="),o=null;0<=i?(r=t[n].substring(0,i),o=t[n].substring(i+1)):r=t[n],e(r,o?decodeURIComponent(o.replace(/\+/g," ")):"")}}}(n.c,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function Vn(t){var e=gn(t);if(void 0===e)throw Error("Keys are undefined");var n=new Un(null,void 0);t=yn(t);for(var r=0;r<e.length;r++){var i=e[r],o=t[r];Array.isArray(o)?Wn(n,i,o):n.add(i,o)}return n}function qn(t,e){jn(t),e=Gn(t,e),_n(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,_n((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&bn(t)))}function Bn(t,e){return jn(t),e=Gn(t,e),_n(t.a.b,e)}function Wn(t,e,n){qn(t,e),0<n.length&&(t.c=null,t.a.set(Gn(t,e),K(n)),t.b+=n.length)}function Hn(t){var e=new Un;return e.c=t.c,t.a&&(e.a=new mn(t.a),e.b=t.b),e}function Gn(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function Kn(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)&&(s=n[i],"function"!=typeof s&&(r.push(o),Xn(i,r),r.push(":"),t(e,s,r),o=","));return void r.push("}")}n=n.valueOf()}switch(typeof n){case"string":Xn(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 zn,t,e),e.join("")}function zn(){}(t=Un.prototype).add=function(t,e){jn(this),this.c=null,t=Gn(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){jn(this),this.a.forEach(function(t,e){U(t,function(t){n.call(r,t,e,this)},this)},this)},t.X=function(){jn(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){jn(this);var e=[];if("string"==typeof t)Bn(this,t)&&(e=G(e,this.a.get(Gn(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 jn(this),this.c=null,Bn(this,t=Gn(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++)for(var r=e[n],i=encodeURIComponent(String(r)),r=this.V(r),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 Qn={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},Yn=/\uffff/.test("")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g;function Xn(t,e){e.push('"',t.replace(Yn,function(t){var e=Qn[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),Qn[t]=e),e}),'"')}function $n(){var t=yr();return Vt&&Qt&&11==Qt||/Edge\/\d+/.test(t)}function Jn(){return l.window&&l.window.location.href||self&&self.location&&self.location.href||""}function Zn(t,e){e=e||l.window;var n="about:blank";t&&(n=St(Nt(t))),e.location.href=n}function tr(t){return!!((t=(t||yr()).toLowerCase()).match(/android/)||t.match(/webos/)||t.match(/iphone|ipad|ipod/)||t.match(/blackberry/)||t.match(/windows phone/)||t.match(/iemobile/))}function er(t){t=t||l.window;try{t.close()}catch(t){}}function nr(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=yr().toLowerCase(),r&&(e.target=r,nt(n,"crios/")&&(e.target="_blank")),pr(yr())==lr&&(t=t||"http://localhost",e.scrollbars=!0),n=t||"",(t=e)||(t={}),r=window,e=n instanceof Tt?n:Nt(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((ot("iPhone")&&!ot("iPod")&&!ot("iPad")||ot("iPad")||ot("iPod"))&&r.navigator&&r.navigator.standalone&&n&&"_self"!=n?(lt(s=ie(document,"A"),"HTMLAnchorElement"),e instanceof Tt||e instanceof Tt||(e="object"==typeof e&&e.ra?e.qa():String(e),Ct.test(e)||(e="about:invalid#zClosurez"),e=new Tt(kt,e)),s.href=St(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=St(e),s&&(Bt&&nt(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),s.opener=null,t=Dt('<meta name="referrer" content="no-referrer"><meta http-equiv="refresh" content="0; url='+Mt(t)+'">'),r=s.document)&&(r.write(Rt(t)),r.close())):(s=r.open(St(e),n,s))&&t.noopener&&(s.opener=null),s)try{s.focus()}catch(t){}return s}var rr=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ir=/^[^@]+@[^@]+$/;function or(){var e=null;return new le(function(t){"complete"==l.document.readyState?t():(e=function(){t()},Ze(window,"load",e))}).o(function(t){throw tn(window,"load",e),t})}function sr(t){return t=t||yr(),!("file:"!==wr()&&"ionic:"!==wr()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function ar(){var t=l.window;try{return t&&t!=t.top}catch(t){return}}function ur(){return void 0!==l.WorkerGlobalScope&&"function"==typeof l.importScripts}function cr(){return Bl.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":Bl.INTERNAL.hasOwnProperty("node")?"Node":ur()?"Worker":"Browser"}function hr(){var t=cr();return"ReactNative"===t||"Node"===t}var lr="Firefox",fr="Chrome";function pr(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/")?lr: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":fr:"Safari"}var dr={jd:"FirebaseCore-web",ld:"FirebaseUI-web"};function vr(t,e){e=e||[];var n,r=[],i={};for(n in dr)i[dr[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=cr())?r=pr(i=yr()):"Worker"===r&&(r=pr(i=yr())+"-"+r),r+"/JsCore/"+t+"/"+e.join(",")}function yr(){return l.navigator&&l.navigator.userAgent||""}function gr(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 mr(){try{var t=l.localStorage,e=Cr();if(t)return t.setItem(e,"1"),t.removeItem(e),!$n()||!!l.indexedDB}catch(t){return ur()&&!!l.indexedDB}return!1}function br(){return(_r()||"chrome-extension:"===wr()||sr())&&!hr()&&mr()&&!ur()}function _r(){return"http:"===wr()||"https:"===wr()}function wr(){return l.location&&l.location.protocol||null}function Er(t){return!tr(t=t||yr())&&pr(t)!=lr}function Ir(t){return void 0===t?null:Kn(t)}function Tr(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 Sr(t){if(null!==t)return JSON.parse(t)}function Cr(t){return t||Math.floor(1e9*Math.random()).toString()}function Nr(t){return"Safari"!=pr(t=t||yr())&&!t.toLowerCase().match(/iphone|ipad|ipod/)}function Ar(){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 kr(t,e){if(e<t)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=yr(),e=cr(),this.b=tr(t)||"ReactNative"===e}function Or(){var t=l.document;return!t||void 0===t.visibilityState||"visible"==t.visibilityState}function Rr(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 Pr(){return gr("fireauth.oauthhelper",l)||gr("fireauth.iframe",l)}kr.prototype.get=function(){var t=l.navigator;return!t||"boolean"!=typeof t.onLine||!_r()&&"chrome-extension:"!==wr()&&void 0===t.connection||t.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var Dr,xr={};function Lr(t){xr[t]||(xr[t]=!0,"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(t))}try{var Mr={};Object.defineProperty(Mr,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(Mr,"abcd",{configurable:!0,enumerable:!0,value:2}),Dr=2==Mr.abcd}catch(t){Dr=!1}function Fr(t,e,n){Dr?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function Ur(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&Fr(t,n,e[n])}function jr(t){var e={};return Ur(e,t),e}function Vr(t){var e=t;if("object"==typeof t&&null!=t)for(var n in e="length"in t?[]:{},t)Fr(e,n,Vr(t[n]));return e}function qr(t){var e=t&&(t[Kr]?"phone":null);if(!(e&&t&&t[Gr]))throw new w("internal-error","Internal assert: invalid MultiFactorInfo object");Fr(this,"uid",t[Gr]),Fr(this,"displayName",t[Wr]||null);var n=null;t[Hr]&&(n=new Date(t[Hr]).toUTCString()),Fr(this,"enrollmentTime",n),Fr(this,"factorId",e)}function Br(t){try{var e=new zr(t)}catch(t){e=null}return e}qr.prototype.v=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};var Wr="displayName",Hr="enrolledAt",Gr="mfaEnrollmentId",Kr="phoneInfo";function zr(t){qr.call(this,t),Fr(this,"phoneNumber",t[Kr])}function Qr(t){var e={},n=t[Jr],r=t[ti],i=t[ei];if(t=Br(t[Zr]),!i||i!=Xr&&i!=$r&&!n||i==$r&&!r||i==Yr&&!t)throw Error("Invalid checkActionCode response!");i==$r?(e[ri]=n||null,e[oi]=n||null,e[ni]=r):(e[ri]=r||null,e[oi]=r||null,e[ni]=n||null),e[ii]=t||null,Fr(this,ai,i),Fr(this,si,Vr(e))}_(zr,qr),zr.prototype.v=function(){var t=zr.Za.v.call(this);return t.phoneNumber=this.phoneNumber,t};var Yr="REVERT_SECOND_FACTOR_ADDITION",Xr="EMAIL_SIGNIN",$r="VERIFY_AND_CHANGE_EMAIL",Jr="email",Zr="mfaInfo",ti="newEmail",ei="requestType",ni="email",ri="fromEmail",ii="multiFactorInfo",oi="previousEmail",si="data",ai="operation";function ui(t){var e=Nn(t=An(t),ci)||null,n=Nn(t,hi)||null,r=(r=Nn(t,pi)||null)&&vi[r]||null;if(!e||!n||!r)throw new w("argument-error",ci+", "+hi+"and "+pi+" are required in a valid action code URL.");Ur(this,{apiKey:e,operation:r,code:n,continueUrl:Nn(t,li)||null,languageCode:Nn(t,fi)||null,tenantId:Nn(t,di)||null})}var ci="apiKey",hi="oobCode",li="continueUrl",fi="languageCode",pi="mode",di="tenantId",vi={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:Yr,signIn:Xr,verifyAndChangeEmail:$r,verifyEmail:"VERIFY_EMAIL"};function yi(t){try{return new ui(t)}catch(t){return null}}function gi(t){var e=t[Ei];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");if(this.h=e,this.b=this.a=null,this.g=!1,(r=t[mi])&&"object"==typeof r){e=r[Si];var n=r[Ii],r=r[Ti];if("string"==typeof e&&e.length){if(this.a=e,void 0!==n&&"boolean"!=typeof n)throw new w("argument-error",Ii+" property must be a boolean when specified.");if(this.g=!!n,void 0!==r&&("string"!=typeof r||"string"==typeof r&&!r.length))throw new w("argument-error",Ti+" property must be a non empty string when specified.");this.b=r||null}else{if(void 0!==e)throw new w("argument-error",Si+" property must be a non empty string when specified.");if(void 0!==n||void 0!==r)throw new w("missing-android-pkg-name")}}else if(void 0!==r)throw new w("argument-error",mi+" property must be a non null object when specified.");if(this.f=null,(e=t[wi])&&"object"==typeof e){if("string"==typeof(e=e[Ci])&&e.length)this.f=e;else if(void 0!==e)throw new w("argument-error",Ci+" property must be a non empty string when specified.")}else if(void 0!==e)throw new w("argument-error",wi+" property must be a non null object when specified.");if(void 0!==(e=t[_i])&&"boolean"!=typeof e)throw new w("argument-error",_i+" property must be a boolean when specified.");if(this.c=!!e,void 0!==(t=t[bi])&&("string"!=typeof t||"string"==typeof t&&!t.length))throw new w("argument-error",bi+" property must be a non empty string when specified.");this.i=t||null}var mi="android",bi="dynamicLinkDomain",_i="handleCodeInApp",wi="iOS",Ei="url",Ii="installApp",Ti="minimumVersion",Si="packageName",Ci="bundleId";function Ni(t){var e,n={};for(e in n.continueUrl=t.h,n.canHandleCodeInApp=t.c,(n.androidPackageName=t.a)&&(n.androidMinimumVersion=t.b,n.androidInstallApp=t.g),n.iOSBundleId=t.f,n.dynamicLinkDomain=t.i,n)null===n[e]&&delete n[e];return n}var Ai=null;function ki(t){var e="";return function(r,t){function e(t){for(;i<r.length;){var e=r.charAt(i++),n=Ai[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return t}!function(){if(!Ai){Ai={};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===Ai[o]&&(Ai[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 Oi(t){var e=Pi(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 Ri(t){try{return new Oi(t)}catch(t){return null}}function Pi(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(ki(t))}catch(t){}return null}Oi.prototype.S=function(){return this.f},Oi.prototype.i=function(){return this.b},Oi.prototype.toString=function(){return this.g};var Di="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),xi=["client_id","response_type","scope","redirect_uri","state"],Li={kd:{Ha:"locale",ta:700,sa:600,ea:"facebook.com",Va:xi},md:{Ha:null,ta:500,sa:750,ea:"github.com",Va:xi},nd:{Ha:"hl",ta:515,sa:680,ea:"google.com",Va:xi},td:{Ha:"lang",ta:485,sa:705,ea:"twitter.com",Va:Di},gd:{Ha:"locale",ta:640,sa:600,ea:"apple.com",Va:[]}};function Mi(t){for(var e in Li)if(Li[e].ea==t)return Li[e];return null}function Fi(t){var e={};e["facebook.com"]=Bi,e["google.com"]=Hi,e["github.com"]=Wi,e["twitter.com"]=Gi;var n=t&&t[ji];try{if(n)return new(e[n]?e[n]:qi)(t);if(void 0!==t[Ui])return new Vi(t)}catch(t){}return null}var Ui="idToken",ji="providerId";function Vi(t){var e,n=t[ji];if(n||!t[Ui]||(e=Ri(t[Ui]))&&e.a&&(n=e.a),!n)throw Error("Invalid additional user info!");"anonymous"!=n&&"custom"!=n||(n=null),e=!1,void 0!==t.isNewUser?e=!!t.isNewUser:"identitytoolkit#SignupNewUserResponse"===t.kind&&(e=!0),Fr(this,"providerId",n),Fr(this,"isNewUser",e)}function qi(t){Vi.call(this,t),Fr(this,"profile",Vr((t=Sr(t.rawUserInfo||"{}"))||{}))}function Bi(t){if(qi.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function Wi(t){if(qi.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");Fr(this,"username",this.profile&&this.profile.login||null)}function Hi(t){if(qi.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function Gi(t){if(qi.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");Fr(this,"username",t.screenName||null)}function Ki(t){var e=Nn(r=An(t),"link"),n=Nn(An(e),"link"),r=Nn(r,"deep_link_id");return Nn(An(r),"link")||r||n||e||t}function zi(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?Qi:Yi}_(qi,Vi),_(Bi,qi),_(Wi,qi),_(Hi,qi),_(Gi,qi);var Qi="enroll",Yi="signin";function Xi(){}function $i(t,n){return t.then(function(t){if(t[Vs]){var e=Ri(t[Vs]);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==T+"user-not-found"?new w("user-mismatch"):t})}function Ji(t,e){if(!e)throw new w("internal-error","failed to construct a credential");this.a=e,Fr(this,"providerId",t),Fr(this,"signInMethod",t)}function Zi(t){return{pendingToken:t.a,requestUri:"http://localhost"}}function to(t){if(t&&t.providerId&&t.signInMethod&&0==t.providerId.indexOf("saml.")&&t.pendingToken)try{return new Ji(t.providerId,t.pendingToken)}catch(t){}return null}function eo(t,e,n){if(this.a=null,e.idToken||e.accessToken)e.idToken&&Fr(this,"idToken",e.idToken),e.accessToken&&Fr(this,"accessToken",e.accessToken),e.nonce&&!e.pendingToken&&Fr(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");Fr(this,"accessToken",e.oauthToken),Fr(this,"secret",e.oauthTokenSecret)}Fr(this,"providerId",t),Fr(this,"signInMethod",n)}function no(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:Vn(e).toString(),requestUri:"http://localhost"},t.a&&(delete e.postBody,e.pendingToken=t.a),e}function ro(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 eo(t.providerId,e,t.signInMethod)}catch(t){}}return null}function io(t,e){this.Oc=e||[],Ur(this,{providerId:t,isOAuthProvider:!0}),this.Fb={},this.lb=(Mi(t)||{}).Ha||null,this.kb=null}function oo(t){if("string"!=typeof t||0!=t.indexOf("saml."))throw new w("argument-error",'SAML provider IDs must be prefixed with "saml."');io.call(this,t,[])}function so(t){io.call(this,t,xi),this.a=[]}function ao(){so.call(this,"facebook.com")}function uo(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 ao).credential({accessToken:e})}function co(){so.call(this,"github.com")}function ho(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 co).credential({accessToken:e})}function lo(){so.call(this,"google.com"),this.Aa("profile")}function fo(t,e){var n=t;return v(t)&&(n=t.idToken,e=t.accessToken),(new lo).credential({idToken:n,accessToken:e})}function po(){io.call(this,"twitter.com",Di)}function vo(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 eo("twitter.com",n,"twitter.com")}function yo(t,e,n){this.a=t,this.f=e,Fr(this,"providerId","password"),Fr(this,"signInMethod",n===mo.EMAIL_LINK_SIGN_IN_METHOD?mo.EMAIL_LINK_SIGN_IN_METHOD:mo.EMAIL_PASSWORD_SIGN_IN_METHOD)}function go(t){return t&&t.email&&t.password?new yo(t.email,t.password,t.signInMethod):null}function mo(){Ur(this,{providerId:"password",isOAuthProvider:!1})}function bo(t,e){if(!(e=_o(e)))throw new w("argument-error","Invalid email link!");return new yo(t,e.code,mo.EMAIL_LINK_SIGN_IN_METHOD)}function _o(t){return(t=yi(t=Ki(t)))&&t.operation===Xr?t:null}function wo(t){if(!(t.bb&&t.ab||t.Ja&&t.da))throw new w("internal-error");this.a=t,Fr(this,"providerId","phone"),this.ea="phone",Fr(this,"signInMethod","phone")}function Eo(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 wo(n)}return null}function Io(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 To(t){try{this.a=t||Bl.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().")}Ur(this,{providerId:"phone",isOAuthProvider:!1})}function So(t,e){if(!t)throw new w("missing-verification-id");if(!e)throw new w("missing-verification-code");return new wo({bb:t,ab:e})}function Co(t){if(t.temporaryProof&&t.phoneNumber)return new wo({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 fo(o,n);case"facebook.com":return uo(n);case"github.com":return ho(n);case"twitter.com":return vo(n,r);default:return n||r||o||s?s?0==e.indexOf("saml.")?new Ji(e,s):new eo(e,{pendingToken:s,idToken:t.oauthIdToken,accessToken:t.oauthAccessToken},e):new so(e).credential({idToken:o,accessToken:n,rawNonce:i}):null}}catch(t){return null}}function No(t){if(!t.isOAuthProvider)throw new w("invalid-oauth-provider")}function Ao(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 ko(t){return(t=t||{}).type?new Ao(t.type,t.eventId,t.urlResponse,t.sessionId,t.error&&E(t.error),t.postBody,t.tenantId):null}function Oo(){this.b=null,this.a=[]}zi.prototype.Fa=function(){return this.a?me(this.a):me(this.b)},zi.prototype.v=function(){return this.type==Qi?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}},Xi.prototype.ia=function(){},Xi.prototype.b=function(){},Xi.prototype.c=function(){},Xi.prototype.v=function(){},Ji.prototype.ia=function(t){return sa(t,Zi(this))},Ji.prototype.b=function(t,e){var n=Zi(this);return n.idToken=e,aa(t,n)},Ji.prototype.c=function(t,e){return $i(ua(t,Zi(this)),e)},Ji.prototype.v=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}},eo.prototype.ia=function(t){return sa(t,no(this))},eo.prototype.b=function(t,e){var n=no(this);return n.idToken=e,aa(t,n)},eo.prototype.c=function(t,e){return $i(ua(t,no(this)),e)},eo.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},io.prototype.Ia=function(t){return this.Fb=ut(t),this},_(oo,io),_(so,io),so.prototype.Aa=function(t){return B(this.a,t)||this.a.push(t),this},so.prototype.Nb=function(){return K(this.a)},so.prototype.credential=function(t,e){e=v(t)?{idToken:t.idToken||null,accessToken:t.accessToken||null,nonce:t.rawNonce||null}:{idToken:t||null,accessToken:e||null};if(!e.idToken&&!e.accessToken)throw new w("argument-error","credential failed: must provide the ID token and/or the access token.");return new eo(this.providerId,e,this.providerId)},_(ao,so),Fr(ao,"PROVIDER_ID","facebook.com"),Fr(ao,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),_(co,so),Fr(co,"PROVIDER_ID","github.com"),Fr(co,"GITHUB_SIGN_IN_METHOD","github.com"),_(lo,so),Fr(lo,"PROVIDER_ID","google.com"),Fr(lo,"GOOGLE_SIGN_IN_METHOD","google.com"),_(po,io),Fr(po,"PROVIDER_ID","twitter.com"),Fr(po,"TWITTER_SIGN_IN_METHOD","twitter.com"),yo.prototype.ia=function(t){return this.signInMethod==mo.EMAIL_LINK_SIGN_IN_METHOD?Wa(t,ya,{email:this.a,oobCode:this.f}):Wa(t,Ua,{email:this.a,password:this.f})},yo.prototype.b=function(t,e){return this.signInMethod==mo.EMAIL_LINK_SIGN_IN_METHOD?Wa(t,ga,{idToken:e,email:this.a,oobCode:this.f}):Wa(t,Oa,{idToken:e,email:this.a,password:this.f})},yo.prototype.c=function(t,e){return $i(this.ia(t),e)},yo.prototype.v=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}},Ur(mo,{PROVIDER_ID:"password"}),Ur(mo,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),Ur(mo,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),wo.prototype.ia=function(t){return t.cb(Io(this))},wo.prototype.b=function(t,e){var n=Io(this);return n.idToken=e,Wa(t,Va,n)},wo.prototype.c=function(t,e){var n=Io(this);return n.operation="REAUTH",$i(t=Wa(t,qa,n),e)},wo.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},To.prototype.cb=function(r,i){var o=this.a.b;return me(i.verify()).then(function(n){if("string"!=typeof n)throw new w("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");if("recaptcha"!==i.type)throw new w("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.');var t=v(r)?r.session:null,e=v(r)?r.phoneNumber:r,t=t&&t.type==Qi?t.Fa().then(function(t){return Wa(o,Pa,{idToken:t,phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:n}}).then(function(t){return t.phoneSessionInfo.sessionInfo})}):t&&t.type==Yi?t.Fa().then(function(t){return e=o,t={mfaPendingCredential:t,mfaEnrollmentId:r.multiFactorHint&&r.multiFactorHint.uid||r.multiFactorUid,phoneSignInInfo:{recaptchaToken:n}},Wa(e,Da,t).then(function(t){return t.phoneResponseInfo.sessionInfo});var e}):Wa(o,Aa,{phoneNumber:e,recaptchaToken:n});return t.then(function(t){return"function"==typeof i.reset&&i.reset(),t},function(t){throw"function"==typeof i.reset&&i.reset(),t})})},Ur(To,{PROVIDER_ID:"phone"}),Ur(To,{PHONE_SIGN_IN_METHOD:"phone"}),Ao.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("-")},Ao.prototype.S=function(){return this.h},Ao.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 Ro,Po=null;function Do(t){var e="unauthorized-domain",n=void 0,r=An(t);t=r.b,"chrome-extension"==(r=r.f)?n=Lt("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=Lt("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 xo(t,e,n){w.call(this,t,n),(t=e||{}).Gb&&Fr(this,"email",t.Gb),t.da&&Fr(this,"phoneNumber",t.da),t.credential&&Fr(this,"credential",t.credential),t.Wb&&Fr(this,"tenantId",t.Wb)}function Lo(t){if(t.code){var e=t.code||"";0==e.indexOf(T)&&(e=e.substring(T.length));var n={credential:Co(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 xo(e,n,t.message)}return null}function Mo(){}function Fo(t){return t.c||(t.c=t.b())}function Uo(){}function jo(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 Vo(){}function qo(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseType=this.responseText=this.response="",this.status=-1,this.statusText="",this.a.onload=g(this.oc,this),this.a.onerror=g(this.Pb,this),this.a.onprogress=g(this.pc,this),this.a.ontimeout=g(this.tc,this)}function Bo(t,e){t.readyState=e,t.onreadystatechange&&t.onreadystatechange()}function Wo(t,e,n){this.reset(t,e,n,void 0,void 0)}function Ho(t){this.f=t,this.b=this.c=this.a=null}function Go(t,e){this.name=t,this.value=e}_(Do,w),_(xo,w),xo.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&&ht(t,e),t},xo.prototype.toJSON=function(){return this.v()},Mo.prototype.c=null,_(Uo,Mo),Uo.prototype.a=function(){var t=jo(this);return t?new ActiveXObject(t):new XMLHttpRequest},Uo.prototype.b=function(){var t={};return jo(this)&&(t[0]=!0,t[1]=!0),t},Ro=new Uo,_(Vo,Mo),Vo.prototype.a=function(){var t=new XMLHttpRequest;if("withCredentials"in t)return t;if("undefined"!=typeof XDomainRequest)return new qo;throw Error("Unsupported browser")},Vo.prototype.b=function(){return{}},(t=qo.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,Bo(this,4)},t.Pb=function(){this.status=500,this.response=this.responseText="",Bo(this,4)},t.tc=function(){this.Pb()},t.pc=function(){this.status=200,Bo(this,1)},t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType},Wo.prototype.a=null,Wo.prototype.reset=function(t,e,n,r,i){delete this.a},Go.prototype.toString=function(){return this.name};var Ko=new Go("SEVERE",1e3),zo=new Go("WARNING",900),Qo=new Go("CONFIG",700),Yo=new Go("FINE",500);Ho.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 Wo(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var Xo,$o={},Jo=null;function Zo(t){var e,n,r;return Jo||(Jo=new Ho(""),($o[""]=Jo).c=Qo),(e=$o[t])||(e=new Ho(t),r=t.lastIndexOf("."),n=t.substr(r+1),(r=Zo(t.substr(0,r))).b||(r.b={}),(r.b[n]=e).a=r,$o[t]=e),e}function ts(t,e){t&&t.log(Yo,e,void 0)}function es(t){this.f=t}function ns(t){hn.call(this),this.s=t,this.readyState=rs,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=Zo("goog.net.FetchXmlHttp"),this.l=this.c=this.f=null}_(es,Mo),es.prototype.a=function(){return new ns(this.f)},es.prototype.b=(Xo={},function(){return Xo}),_(ns,hn);var rs=0;function is(t){t.c.read().then(t.nc.bind(t)).catch(t.Sa.bind(t))}function os(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,ss(t)}function ss(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function as(t){hn.call(this),this.headers=new mn,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=us,this.w=this.R=!1}(t=ns.prototype).open=function(t,e){if(this.readyState!=rs)throw this.abort(),Error("Error reopening a connection");this.m=t,this.g=e,this.readyState=1,ss(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,os(this,!1)),this.readyState=rs},t.sc=function(t){this.a&&(this.f=t,this.b||(this.b=t.headers,this.readyState=2,ss(this)),this.a&&(this.readyState=3,ss(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,is(this)):t.text().then(this.rc.bind(this),this.Sa.bind(this)))))},t.nc=function(t){var e;this.a&&((e=this.l.decode(t.value?t.value:new Uint8Array(0),{stream:!t.done}))&&(this.response=this.responseText+=e),t.done?os(this,!0):ss(this),3==this.readyState&&is(this))},t.rc=function(t){this.a&&(this.response=this.responseText=t,os(this,!0))},t.qc=function(t){this.a&&(this.response=t,os(this,!0))},t.Sa=function(t){var e=this.h;e&&e.log(zo,"Failed to fetch url "+this.g,t instanceof Error?t:Error(t)),this.a&&os(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(zo,"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(zo,"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")},_(as,hn);var us="";as.prototype.b=Zo("goog.net.XhrIo");var cs=/^https?$/i,hs=["POST","PUT"];function ls(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:Ro).a(),e.B=e.D?Fo(e.D):Fo(Ro),e.a.onreadystatechange=g(e.Sb,e);try{ts(e.b,_s(e,"Opening Xhr")),e.O=!0,e.a.open(n,String(t),!0),e.O=!1}catch(t){return ts(e.b,_s(e,"Error opening Xhr: "+t.message)),void ps(e,t)}t=r||"";var o,s=new mn(e.headers);i&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(p(t)||"string"==typeof t)U(t,e,void 0);else for(var n=gn(t),r=yn(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=fs,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(hs,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{gs(e),0<e.g&&(e.w=(o=e.a,Vt&&Xt(9)&&"number"==typeof o.timeout&&void 0!==o.ontimeout),ts(e.b,_s(e,"Will abort after "+e.g+"ms if incomplete, xhr2 "+e.w)),e.w?(e.a.timeout=e.g,e.a.ontimeout=g(e.Ka,e)):e.s=dn(e.Ka,e.g,e)),ts(e.b,_s(e,"Sending request")),e.i=!0,e.a.send(t),e.i=!1}catch(t){ts(e.b,_s(e,"Send error: "+t.message)),ps(e,t)}}function fs(t){return"content-type"==t.toLowerCase()}function ps(t,e){t.c=!1,t.a&&(t.f=!0,t.a.abort(),t.f=!1),t.h=e,ds(t),ys(t)}function ds(t){t.N||(t.N=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function vs(e){if(e.c&&void 0!==h)if(e.B[1]&&4==ms(e)&&2==bs(e))ts(e.b,_s(e,"Local request error detected and ignored"));else if(e.i&&4==ms(e))dn(e.Sb,0,e);else if(e.dispatchEvent("readystatechange"),4==ms(e)){ts(e.b,_s(e,"Request complete")),e.c=!1;try{var t,n,r,i,o=bs(e);t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var s=!0;break t;default:s=!1}if((t=s)||((n=0===o)&&(!(i=String(e.l).match(wn)[1]||null)&&l.self&&l.self.location&&(i=(r=l.self.location.protocol).substr(0,r.length-1)),n=!cs.test(i?i.toLowerCase():"")),t=n),t)e.dispatchEvent("complete"),e.dispatchEvent("success");else{try{var a=2<ms(e)?e.a.statusText:""}catch(t){ts(e.b,"Can not get status: "+t.message),a=""}e.h=a+" ["+bs(e)+"]",ds(e)}}finally{ys(e)}}}function ys(e,t){if(e.a){gs(e);var n=e.a,r=e.B[0]?s:null;e.a=null,e.B=null,t||e.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){(e=e.b)&&e.log(Ko,"Problem encountered resetting onreadystatechange: "+t.message,void 0)}}}function gs(t){t.a&&t.w&&(t.a.ontimeout=null),t.s&&(l.clearTimeout(t.s),t.s=null)}function ms(t){return t.a?t.a.readyState:0}function bs(t){try{return 2<ms(t)?t.a.status:-1}catch(t){return-1}}function _s(t,e){return e+" ["+t.P+" "+t.l+" "+bs(t)+"]"}function ws(t){var e=Ps;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 Es(t,e,n){t.a=!0,t.c=n,t.f=!e,Cs(t)}function Is(t){if(t.a){if(!t.u)throw new Ns;t.u=!1}}function Ts(t,e,n,r){t.g.push([e,n,r]),t.a&&Cs(t)}function Ss(t){return q(t.g,function(t){return d(t[1])})}function Cs(e){var n,r;e.h&&e.a&&Ss(e)&&(n=e.h,(r=Os[n])&&(l.clearTimeout(r.a),delete Os[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=(s=e.g.shift())[0],o=s[1],s=s[2];if(i=e.f?o:i)try{var a=i.call(s||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,Ss(e)||(r=!0)}}e.c=n,t&&(a=g(e.m,e,!0),t=g(e.m,e,!1),n instanceof ws?(Ts(n,a,t),n.B=!0):n.then(a,t)),r&&(n=new ks(n),Os[n.a]=n,e.h=n.a)}function Ns(){k.call(this)}function As(){k.call(this)}function ks(t){this.a=l.setTimeout(g(this.c,this),0),this.b=t}(t=as.prototype).Ka=function(){void 0!==h&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",ts(this.b,_s(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},t.abort=function(){this.a&&this.c&&(ts(this.b,_s(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),ys(this))},t.Ba=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),ys(this,!0)),as.Za.Ba.call(this)},t.Sb=function(){this.wa||(this.O||this.i||this.f?vs(this):this.Hc())},t.Hc=function(){vs(this)},t.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.m){case us: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(Ko,"Response type "+this.m+" is not supported on this browser",void 0),null}catch(t){return ts(this.b,"Can not get response: "+t.message),null}},ws.prototype.cancel=function(t){var e;this.a?this.c instanceof ws&&this.c.cancel():(this.b&&(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 As,Is(this),Es(this,!1,t)))},ws.prototype.m=function(t,e){this.i=!1,Es(this,t,e)},ws.prototype.then=function(t,e,n){var r,i,o=new le(function(t,e){r=t,i=e});return Ts(this,r,function(t){t instanceof As?o.cancel():i(t)}),o.then(t,e,n)},ws.prototype.$goog_Thenable=!0,_(Ns,k),Ns.prototype.message="Deferred has already fired",Ns.prototype.name="AlreadyCalledError",_(As,k),As.prototype.message="Deferred was canceled",As.prototype.name="CanceledError",ks.prototype.c=function(){throw delete Os[this.a],this.b};var Os={};function Rs(t){var e=document,n=mt(t).toString(),r=ie(document,"SCRIPT"),i={Tb:r,Ka:void 0},o=new ws(i),s=window.setTimeout(function(){Ds(r,!0);var t=new Ms(Ls,"Timeout reached for loading script "+n);Is(o),Es(o,!1,t)},5e3);return i.Ka=s,r.onload=r.onreadystatechange=function(){r.readyState&&"loaded"!=r.readyState&&"complete"!=r.readyState||(Ds(r,!1,s),Is(o),Es(o,!0,null))},r.onerror=function(){Ds(r,!0,s);var t=new Ms(xs,"Error while loading script "+n);Is(o),Es(o,!1,t)},ht(i={},{type:"text/javascript",charset:"UTF-8"}),Zt(r,i),i=t,lt(t=r,"HTMLScriptElement"),t.src=mt(i),null===f&&(f=(i=(i=l.document).querySelector&&i.querySelector("script[nonce]"))&&(i=i.nonce||i.getAttribute("nonce"))&&a.test(i)?i:""),(i=f)&&t.setAttribute("nonce",i),((e=((i=e)||document).getElementsByTagName("HEAD"))&&0!=e.length?e[0]:i.documentElement).appendChild(r),o}function Ps(){var t;this&&this.Tb&&((t=this.Tb)&&"SCRIPT"==t.tagName&&Ds(t,!0,this.Ka))}function Ds(t,e,n){null!=n&&l.clearTimeout(n),t.onload=s,t.onerror=s,t.onreadystatechange=s,e&&window.setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},0)}var xs=0,Ls=1;function Ms(t,e){var n="Jsloader error (code #"+t+")";e&&(n+=": "+e),k.call(this,n),this.code=t}function Fs(t){this.f=t}function Us(t,e,n){if(this.c=t,t=e||{},this.u=t.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token",this.m=t.secureTokenTimeout||qs,this.g=ut(t.secureTokenHeaders||Bs),this.h=t.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.l=t.identityPlatformEndpoint||"https://identitytoolkit.googleapis.com/v2/",this.i=t.firebaseTimeout||Ws,this.a=ut(t.firebaseHeaders||Hs),n&&(this.a["X-Client-Version"]=n,this.g["X-Client-Version"]=n),n="Node"==cr(),!(n=l.XMLHttpRequest||n&&Bl.INTERNAL.node&&Bl.INTERNAL.node.XMLHttpRequest)&&!ur())throw new w("internal-error","The XMLHttpRequest compatibility library was not found.");this.f=void 0,ur()?this.f=new es(self):hr()?this.f=new Fs(n):this.f=new Vo,this.b=null}_(Ms,k),_(Fs,Mo),Fs.prototype.a=function(){return new this.f},Fs.prototype.b=function(){return{}};var js,Vs="idToken",qs=new kr(3e4,6e4),Bs={"Content-Type":"application/x-www-form-urlencoded"},Ws=new kr(3e4,6e4),Hs={"Content-Type":"application/json"};function Gs(t,e){e?t.a["X-Firebase-Locale"]=e:delete t.a["X-Firebase-Locale"]}function Ks(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 zs(t,e,n,r,i,o,s){var a;(t=((a=pr(a=yr())==fr&&(a=a.match(/\sChrome\/(\d+)/i))&&2==a.length?parseInt(a[1],10):null)&&a<30||Vt&&Qt&&!(9<Qt))&&!ur()?(js=js||new le(function(t,e){!function(t,e){{((window.gapi||{}).client||{}).request?t():(l[Ys]=function(){((window.gapi||{}).client||{}).request?t():e(Error("CORS_UNSUPPORTED"))},function(t,e){Ts(t,null,e,void 0)}(Rs(bt(Qs,{onload:Ys})),function(){e(Error("CORS_UNSUPPORTED"))}))}}(t,e)}),g(t.s,t)):g(t.w,t))(e,n,r,i,o,s)}Us.prototype.S=function(){return this.b},Us.prototype.w=function(t,n,e,r,i,o){if(ur()&&(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,a=new as(this.f);o&&(a.g=Math.max(0,o),s=setTimeout(function(){a.dispatchEvent("timeout")},o)),ln(a,"complete",function(){s&&clearTimeout(s);var e=null;try{e=JSON.parse(function(e){try{return e.a?e.a.responseText:""}catch(t){return ts(e.b,"Can not get responseText: "+t.message),""}}(this))||null}catch(t){e=null}n&&n(e)}),fn(a,"ready",function(){s&&clearTimeout(s),xe(this)}),fn(a,"timeout",function(){s&&clearTimeout(s),xe(this),n&&n(null)}),ls(a,t,e,r,i)};var Qs=new ft(vt,"https://apis.google.com/js/client.js?onload=%{onload}"),Ys="__fcb"+Math.floor(1e6*Math.random()).toString();function Xs(t,e,n,r,i,o,s){var a=An(e+n);Cn(a,"key",t.c),s&&Cn(a,"cb",b().toString());var u="GET"==r;if(u)for(var c in i)i.hasOwnProperty(c)&&Cn(a,c,i[c]);return new le(function(e,n){zs(t,a.toString(),function(t){t?t.error?n(Ga(t,o||{})):e(t):n(new w("network-request-failed"))},r,u?void 0:Kn(Tr(i)),t.a,t.i.get())})}function $s(t){if("string"!=typeof(t=t.email)||!ir.test(t))throw new w("invalid-email")}function Js(t){"email"in t&&$s(t)}function Zs(t){if(!t[Vs]){if(t.mfaPendingCredential)throw new w("multi-factor-auth-required",null,ut(t));throw new w("internal-error")}}function ta(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")}}Us.prototype.s=function(t,n,r,i,o){var s=this;js.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"}})})},Us.prototype.vb=function(){return Wa(this,Ra,{})},Us.prototype.xb=function(t,e){return Wa(this,ka,{idToken:t,email:e})},Us.prototype.yb=function(t,e){return Wa(this,Oa,{idToken:t,password:e})};var ea={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};function na(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 ra(t){if(!t.requestUri||!t.sessionId&&!t.postBody&&!t.pendingToken)throw new w("internal-error")}function ia(t,e){return e.oauthIdToken&&e.providerId&&0==e.providerId.indexOf("oidc.")&&!e.pendingToken&&(t.sessionId?e.nonce=t.sessionId:t.postBody&&(Bn(t=new Un(t.postBody),"nonce")&&(e.nonce=t.get("nonce")))),e}function oa(t){var e=null;if(t.needConfirmation?(t.code="account-exists-with-different-credential",e=Lo(t)):"FEDERATED_USER_ID_ALREADY_LINKED"==t.errorMessage?(t.code="credential-already-in-use",e=Lo(t)):"EMAIL_EXISTS"==t.errorMessage?(t.code="email-already-in-use",e=Lo(t)):t.errorMessage&&(e=Ha(t.errorMessage)),e)throw e;Zs(t)}function sa(t,e){return e.returnIdpCredential=!0,Wa(t,xa,e)}function aa(t,e){return e.returnIdpCredential=!0,Wa(t,Ma,e)}function ua(t,e){return e.returnIdpCredential=!0,e.autoCreate=!1,Wa(t,La,e)}function ca(t){if(!t.oobCode)throw new w("invalid-action-code")}(t=Us.prototype).zb=function(t,r){var i={idToken:t},o=[];return st(ea,function(t,e){var n=r[e];null===n?o.push(t):e in r&&(i[e]=n)}),o.length&&(i.deleteAttribute=o),Wa(this,ka,i)},t.rb=function(t,e){return ht(t={requestType:"PASSWORD_RESET",email:t},e),Wa(this,Ta,t)},t.sb=function(t,e){return ht(t={requestType:"EMAIL_SIGNIN",email:t},e),Wa(this,wa,t)},t.qb=function(t,e){return ht(t={requestType:"VERIFY_EMAIL",idToken:t},e),Wa(this,Ea,t)},t.Ab=function(t,e,n){return ht(t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:t,newEmail:e},n),Wa(this,Ia,t)},t.cb=function(t){return Wa(this,ja,t)},t.jb=function(t,e){return Wa(this,Na,{oobCode:t,newPassword:e})},t.Pa=function(t){return Wa(this,la,{oobCode:t})},t.fb=function(t){return Wa(this,ha,{oobCode:t})};var ha={endpoint:"setAccountInfo",A:ca,Y:"email",C:!0},la={endpoint:"resetPassword",A:ca,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},fa={endpoint:"signupNewUser",A:function(t){if($s(t),!t.password)throw new w("weak-password")},G:Zs,U:!0,C:!0},pa={endpoint:"createAuthUri",C:!0},da={endpoint:"deleteAccount",M:["idToken"]},va={endpoint:"setAccountInfo",M:["idToken","deleteProvider"],A:function(t){if("array"!=n(t.deleteProvider))throw new w("internal-error")}},ya={endpoint:"emailLinkSignin",M:["email","oobCode"],A:$s,G:Zs,U:!0,C:!0},ga={endpoint:"emailLinkSignin",M:["idToken","email","oobCode"],A:$s,G:Zs,U:!0},ma={endpoint:"accounts/mfaEnrollment:finalize",M:["idToken","phoneVerificationInfo"],A:na,G:Zs,C:!0,La:!0},ba={endpoint:"accounts/mfaSignIn:finalize",M:["mfaPendingCredential","phoneVerificationInfo"],A:na,G:Zs,C:!0,La:!0},_a={endpoint:"getAccountInfo"},wa={endpoint:"getOobConfirmationCode",M:["requestType"],A:function(t){if("EMAIL_SIGNIN"!=t.requestType)throw new w("internal-error");$s(t)},Y:"email",C:!0},Ea={endpoint:"getOobConfirmationCode",M:["idToken","requestType"],A:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new w("internal-error")},Y:"email",C:!0},Ia={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},Ta={endpoint:"getOobConfirmationCode",M:["requestType"],A:function(t){if("PASSWORD_RESET"!=t.requestType)throw new w("internal-error");$s(t)},Y:"email",C:!0},Sa={hb:!0,endpoint:"getProjectConfig",Rb:"GET"},Ca={hb:!0,endpoint:"getRecaptchaParam",Rb:"GET",G:function(t){if(!t.recaptchaSiteKey)throw new w("internal-error")}},Na={endpoint:"resetPassword",A:ca,Y:"email",C:!0},Aa={endpoint:"sendVerificationCode",M:["phoneNumber","recaptchaToken"],Y:"sessionInfo",C:!0},ka={endpoint:"setAccountInfo",M:["idToken"],A:Js,U:!0},Oa={endpoint:"setAccountInfo",M:["idToken"],A:function(t){if(Js(t),!t.password)throw new w("weak-password")},G:Zs,U:!0},Ra={endpoint:"signupNewUser",G:Zs,U:!0,C:!0},Pa={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},Da={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},xa={endpoint:"verifyAssertion",A:ra,Wa:ia,G:oa,U:!0,C:!0},La={endpoint:"verifyAssertion",A:ra,Wa:ia,G:function(t){if(t.errorMessage&&"USER_NOT_FOUND"==t.errorMessage)throw new w("user-not-found");if(t.errorMessage)throw Ha(t.errorMessage);Zs(t)},U:!0,C:!0},Ma={endpoint:"verifyAssertion",A:function(t){if(ra(t),!t.idToken)throw new w("internal-error")},Wa:ia,G:oa,U:!0},Fa={endpoint:"verifyCustomToken",A:function(t){if(!t.token)throw new w("invalid-custom-token")},G:Zs,U:!0,C:!0},Ua={endpoint:"verifyPassword",A:function(t){if($s(t),!t.password)throw new w("wrong-password")},G:Zs,U:!0,C:!0},ja={endpoint:"verifyPhoneNumber",A:ta,G:Zs,C:!0},Va={endpoint:"verifyPhoneNumber",A:function(t){if(!t.idToken)throw new w("internal-error");ta(t)},G:function(t){if(t.temporaryProof)throw t.code="credential-already-in-use",Lo(t);Zs(t)}},qa={Eb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:ta,G:Zs,C:!0},Ba={endpoint:"accounts/mfaEnrollment:withdraw",M:["idToken","mfaEnrollmentId"],G:function(t){if(!!t[Vs]^!!t.refreshToken)throw new w("internal-error")},C:!0,La:!0};function Wa(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 be(new w("internal-error"));var r,i=!!e.La,o=e.Rb||"POST";return me(n).then(e.A).then(function(){return e.U&&(n.returnSecureToken=!0),e.C&&t.b&&void 0===n.tenantId&&(n.tenantId=t.b),Xs(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 Ha(t){return Ga({error:{errors:[{message:t}],code:400,message:t}})}function Ga(t,e){var n,r=(t.error&&t.error.errors&&t.error.errors[0]||{}).reason||"",i={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(r=i[r]?new w(i[r]):null)return r;for(n in r=t.error&&t.error.message||"",ht(i={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=r.match(/^[^\s]+\s*:\s*([\s\S]*)$/))&&1<e.length?e[1]:void 0,i)if(0===r.indexOf(n))return new w(i[n],e);return!e&&t&&(e=Ir(t)),new w("internal-error",e)}function Ka(t){var o;this.b=t,this.a=null,this.nb=(o=this,(Xa||(Xa=new le(function(t,e){function n(){Ar(),gr("gapi.load")("gapi.iframes",{callback:t,ontimeout:function(){Ar(),e(Error("Network Error"))},timeout:Qa.get()})}var r;gr("gapi.iframes.Iframe")?t():gr("gapi.load")?n():(r="__iframefcb"+Math.floor(1e6*Math.random()).toString(),l[r]=function(){gr("gapi.load")?n():e(Error("Network Error"))},me(Rs(r=bt(za,{onload:r}))).o(function(){e(Error("Network Error"))}))}).o(function(t){throw Xa=null,t}))).then(function(){return new le(function(r,i){gr("gapi.iframes.getContext")().open({where:document.body,url:o.b,messageHandlersFilter:gr("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"))},Ya.get());t.ping(e).then(e,function(){i(Error("Network Error"))})})})}))}var za=new ft(vt,"https://apis.google.com/js/api.js?onload=%{onload}"),Qa=new kr(3e4,6e4),Ya=new kr(5e3,15e3),Xa=null;function $a(t,e,n){this.i=t,this.g=e,this.h=n,this.f=null,this.a=kn(this.i,"/__/auth/iframe"),Cn(this.a,"apiKey",this.g),Cn(this.a,"appName",this.h),this.b=null,this.c=[]}function Ja(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 Za(t){try{return Bl.app(t).auth().Ea()}catch(t){return[]}}function tu(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 eu(t){var a=Jn();return Wa(t,Sa,{}).then(function(t){return t.authorizedDomains||[]}).then(function(t){t:{for(var e=(n=An(a)).f,n=n.b,r=0;r<t.length;r++){var i=t[r],o=n,s=e;if(o=0==i.indexOf("chrome-extension://")?An(i).b==o&&"chrome-extension"==s:("http"==s||"https"==s)&&(rr.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 Do(Jn())})}function nu(i){return i.l||(i.l=or().then(function(){var t,e,n,r;i.s||(t=i.c,e=i.h,n=Za(i.b),(r=new $a(i.u,i.f,i.b)).f=t,r.b=e,r.c=K(n||[]),i.s=r.toString()),i.i=new Ka(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,gr("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}(r.i,function(t){var e={};if(t&&t.authEvent){var n=!1;for(t=ko(t.authEvent),e=0;e<r.g.length;e++)n=r.g[e](t)||n;return(e={}).status=n?"ACK":"ERROR",me(e)}return e.status="ERROR",me(e)})}(i)})),i.l}function ru(t){return t.m||(t.w=t.c?vr(t.c,Za(t.b)):null,t.m=new Us(t.f,N(t.h),t.w)),t.m}function iu(t,e,n,r,i,o,s,a,u,c,h){return(t=new Ja(t,e,n,r,i)).l=o,t.g=s,t.i=a,t.b=ut(u||null),t.f=c,t.ub(h).toString()}function ou(t){if(this.a=t||Bl.INTERNAL.reactNative&&Bl.INTERNAL.reactNative.AsyncStorage,!this.a)throw new w("internal-error","The React Native compatibility library was not found.");this.type="asyncStorage"}function su(t){this.b=t,this.a={},this.f=g(this.c,this)}$a.prototype.toString=function(){return this.f?Cn(this.a,"v",this.f):qn(this.a.a,"v"),this.b?Cn(this.a,"eid",this.b):qn(this.a.a,"eid"),this.c.length?Cn(this.a,"fw",this.c.join(",")):qn(this.a.a,"fw"),this.a.toString()},Ja.prototype.ub=function(t){return this.h=t,this},Ja.prototype.toString=function(){var t=kn(this.s,"/__/auth/handler");if(Cn(t,"apiKey",this.m),Cn(t,"appName",this.c),Cn(t,"authType",this.u),this.a.isOAuthProvider){var e,n=this.a;try{var r=Bl.app(this.c).auth().ja()}catch(t){r=null}for(e in n.kb=r,Cn(t,"providerId",this.a.providerId),r=Tr((n=this.a).Fb))r[e]=r[e].toString();e=n.Oc,r=ut(r);for(var i=0;i<e.length;i++){var o=e[i];o in r&&delete r[o]}n.lb&&n.kb&&!r[n.lb]&&(r[n.lb]=n.kb),at(r)||Cn(t,"customParameters",Ir(r))}if("function"==typeof this.a.Nb&&((n=this.a.Nb()).length&&Cn(t,"scopes",n.join(","))),this.l?Cn(t,"redirectUrl",this.l):qn(t.a,"redirectUrl"),this.g?Cn(t,"eventId",this.g):qn(t.a,"eventId"),this.i?Cn(t,"v",this.i):qn(t.a,"v"),this.b)for(var s in this.b)this.b.hasOwnProperty(s)&&!Nn(t,s)&&Cn(t,s,this.b[s]);return this.h?Cn(t,"tid",this.h):qn(t.a,"tid"),this.f?Cn(t,"eid",this.f):qn(t.a,"eid"),(s=Za(this.c)).length&&Cn(t,"fw",s.join(",")),t.toString()},(t=tu.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"},nu(t=o).then(function(){return e=t.i,n=r,e.nb.then(function(){return new le(function(t){e.a.send(n.type,n,t,gr("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&&er(e),n(i),s=!0)})}).o(function(){}).then(function(){if(!s)return n=e,new le(function(e){return function t(){vn(2e3).then(function(){return n&&!n.closed?t():void e()})}()});var n}).then(function(){if(!s)return vn(t).then(function(){n(r)})})},t.Ub=function(){var t=yr();return!Er(t)&&!Nr(t)},t.Qb=function(){return!1},t.Jb=function(e,t,n,r,i,o,s,a){if(!e)return be(new w("popup-blocked"));if(s&&!Er())return this.ka().o(function(t){er(e),i(t)}),r(),me();this.a||(this.a=eu(ru(this)));var u=this;return this.a.then(function(){var t=u.ka().o(function(t){throw er(e),i(t),t});return r(),t}).then(function(){No(n),s||Zn(iu(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=eu(ru(this)));var i=this;return this.a.then(function(){No(e),Zn(iu(i.u,i.f,i.b,t,e,Jn(),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 nu(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=ou.prototype).get=function(t){return me(this.a.getItem(t)).then(function(t){return t&&Sr(t)})},t.set=function(t,e){return me(this.a.setItem(t,Ir(e)))},t.T=function(t){return me(this.a.removeItem(t))},t.ba=function(){},t.ha=function(){};var au,uu=[];function cu(t,e,n){at(t.a)&&t.b.addEventListener("message",t.f),void 0===t.a[e]&&(t.a[e]=[]),t.a[e].push(n)}function hu(t){this.a=t}function lu(t){this.c=t,this.b=!1,this.a=[]}function fu(r,t,e,n){var i,o,s,a,u=e||{},c=null;if(r.b)return be(Error("connection_unavailable"));var h=n?800:50,l="undefined"!=typeof MessageChannel?new MessageChannel:null;return new le(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 pu(r,c),t}).o(function(t){throw pu(r,c),t})}function pu(t,e){var n,r;e&&(n=e.messageChannel,r=e.onMessage,n&&(n.port1.removeEventListener("message",r),n.port1.close()),H(t.a,function(t){return t==e}))}function du(){if(!gu())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,e,n,r=this;ur()&&self?(this.l=(n=ur()?self:null,U(uu,function(t){t.b==n&&(e=t)}),e||(e=new su(n),uu.push(e)),e),cu(this.l,"keyChanged",function(t,n){return Eu(r).then(function(e){return 0<e.length&&U(r.a,function(t){t(e)}),{keyProcessed:B(e,n.key)}})}),cu(this.l,"ping",function(){return me(["keyChanged"])})):((t=l.navigator)&&t.serviceWorker?me().then(function(){return t.serviceWorker.ready}).then(function(t){return t.active||null}).o(function(){return null}):me(null)).then(function(t){(r.h=t)&&(r.g=new lu(new hu(t)),fu(r.g,"ping",null,!0).then(function(t){t[0].fulfilled&&B(t[0].value,"keyChanged")&&(r.s=!0)}).o(function(){}))})}function vu(i){return new le(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 le(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 vu(i)}).then(function(t){e(t)}).o(function(t){n(t)}))}})}function yu(t){return t.m||(t.m=vu(t)),t.m}function gu(){try{return l.indexedDB}catch(t){return}}function mu(t){return t.objectStore("firebaseLocalStorage")}function bu(t,e){return t.transaction(["firebaseLocalStorage"],e?"readwrite":"readonly")}function _u(t){return new le(function(e,n){t.onsuccess=function(t){t&&t.target?e(t.target.result):e()},t.onerror=function(t){n(t.target.error)}})}function wu(t,e){return t.g&&t.h&&((n=l.navigator)&&n.serviceWorker&&n.serviceWorker.controller||null)===t.h?fu(t.g,"keyChanged",{key:e},t.s).then(function(){}).o(function(){}):me();var n}function Eu(r){return yu(r).then(function(t){var i=mu(bu(t,!1));return i.getAll?_u(i.getAll()):new le(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 Iu(t){t.i&&t.i.cancel("STOP_EVENT"),t.f&&(clearTimeout(t.f),t.f=null)}function Tu(t){var r=this,i=null;this.a=[],this.type="indexedDB",this.c=t,this.b=me().then(function(){if(gu()){var e=Cr(),n="__sak"+e;return au=au||new du,(i=au).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 Su(){this.a={},this.type="inMemory"}function Cu(){if(!function(){var t="Node"==cr();if(!(t=Nu()||t&&Bl.INTERNAL.node&&Bl.INTERNAL.node.localStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==cr())throw new w("internal-error","The LocalStorage compatibility library was not found.");throw new w("web-storage-unsupported")}this.a=Nu()||Bl.INTERNAL.node.localStorage,this.type="localStorage"}function Nu(){try{var t=l.localStorage,e=Cr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Au(){this.type="nullStorage"}function ku(){if(!function(){var t="Node"==cr();if(!(t=Ou()||t&&Bl.INTERNAL.node&&Bl.INTERNAL.node.sessionStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==cr())throw new w("internal-error","The SessionStorage compatibility library was not found.");throw new w("web-storage-unsupported")}this.a=Ou()||Bl.INTERNAL.node.sessionStorage,this.type="sessionStorage"}function Ou(){try{var t=l.sessionStorage,e=Cr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Ru(){var t={};t.Browser=xu,t.Node=Lu,t.ReactNative=Mu,t.Worker=Fu,this.a=t[cr()]}su.prototype.c=function(n){var e,r=n.data.eventType,i=n.data.eventId,t=this.a[r];t&&0<t.length&&(n.ports[0].postMessage({status:"ack",eventId:i,eventType:r,response:null}),e=[],U(t,function(t){e.push(me().then(function(){return t(n.origin,n.data.data)}))}),we(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})}))},hu.prototype.postMessage=function(t,e){this.a.postMessage(t,e)},lu.prototype.close=function(){for(;0<this.a.length;)pu(this,this.a[0]);this.b=!0},(t=du.prototype).set=function(n,r){var i,o=!1,s=this;return yu(this).then(function(t){return _u((t=mu(bu(i=t,!0))).get(n))}).then(function(t){var e=mu(bu(i,!0));return t?(t.value=r,_u(e.put(t))):(s.b++,o=!0,(t={}).fbase_key=n,t.value=r,_u(e.add(t)))}).then(function(){return s.c[n]=r,wu(s,n)}).ma(function(){o&&s.b--})},t.get=function(e){return yu(this).then(function(t){return _u(mu(bu(t,!1)).get(e))}).then(function(t){return t&&t.value})},t.T=function(e){var n=!1,r=this;return yu(this).then(function(t){return n=!0,r.b++,_u(mu(bu(t,!0)).delete(e))}).then(function(){return delete r.c[e],wu(r,e)}).ma(function(){n&&r.b--})},t.ba=function(t){var n;0==this.a.length&&(Iu(n=this),function e(){n.f=setTimeout(function(){n.i=Eu(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&&Iu(this)},(t=Tu.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=Su.prototype).get=function(t){return me(this.a[t])},t.set=function(t,e){return this.a[t]=e,me()},t.T=function(t){return delete this.a[t],me()},t.ba=function(){},t.ha=function(){},(t=Cu.prototype).get=function(t){var e=this;return me().then(function(){return Sr(e.a.getItem(t))})},t.set=function(e,n){var r=this;return me().then(function(){var t=Ir(n);null===t?r.T(e):r.a.setItem(e,t)})},t.T=function(t){var e=this;return me().then(function(){e.a.removeItem(t)})},t.ba=function(t){l.window&&$e(l.window,"storage",t)},t.ha=function(t){l.window&&tn(l.window,"storage",t)},(t=Au.prototype).get=function(){return me(null)},t.set=function(){return me()},t.T=function(){return me()},t.ba=function(){},t.ha=function(){},(t=ku.prototype).get=function(t){var e=this;return me().then(function(){return Sr(e.a.getItem(t))})},t.set=function(e,n){var r=this;return me().then(function(){var t=Ir(n);null===t?r.T(e):r.a.setItem(e,t)})},t.T=function(t){var e=this;return me().then(function(){e.a.removeItem(t)})},t.ba=function(){},t.ha=function(){};var Pu,Du,xu={F:Cu,$a:ku},Lu={F:Cu,$a:ku},Mu={F:ou,$a:Au},Fu={F:Cu,$a:Au},Uu={od:"local",NONE:"none",qd:"session"};function ju(){var t=!(Nr(yr())||!ar()),e=Er(),n=mr();this.m=t,this.h=e,this.l=n,this.a={},t=Pu=Pu||new Ru;try{this.g=!$n()&&Pr()||!l.indexedDB?new t.a.F:new Tu(new(ur()?Su:t.a.F))}catch(t){this.g=new Su,this.h=!0}try{this.i=new t.a.$a}catch(t){this.i=new Su}this.u=new Su,this.f=g(this.Vb,this),this.b={}}function Vu(){return Du=Du||new ju}function qu(t,e){switch(e){case"session":return t.i;case"none":return t.u;default:return t.g}}function Bu(t,e){return"firebase:"+t.name+(e?":"+e:"")}function Wu(t,e,n){return n=Bu(e,n),"local"==e.F&&(t.b[n]=null),qu(t,e.F).T(n)}function Hu(t){t.c&&(clearInterval(t.c),t.c=null)}function Gu(t){this.a=t,this.b=Vu()}(t=ju.prototype).get=function(t,e){return qu(this,t.F).get(Bu(t,e))},t.set=function(e,t,n){var r=Bu(e,n),i=this,o=qu(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=Bu(t,e),this.l&&(this.b[t]=l.localStorage.getItem(t)),at(this.a)&&(qu(this,"local").ba(this.f),this.h||($n()||!Pr())&&l.indexedDB||!this.l||(Hu(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 Ve({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=Bu(t,e),this.a[t]&&(H(this.a[t],function(t){return t==n}),0==this.a[t].length&&delete this.a[t]),at(this.a)&&(qu(this,"local").ha(this.f),Hu(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?qu(this,"local").ha(this.f):Hu(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))};Vt&&Qt&&10==Qt&&l.localStorage.getItem(e)!==t.a.newValue&&t.a.newValue!==t.a.oldValue?setTimeout(n,10):n()}}else U(t,g(this.ib,this))},t.ib=function(t){this.a[t]&&U(this.a[t],function(t){t()})};var Ku,zu={name:"authEvent",F:"local"};function Qu(){this.a=Vu()}function Yu(t,e){this.b=Xu,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===Ku&&(Ku=l.Int32Array?new Int32Array(rc):rc),this.reset()}_(Yu,function(){this.b=-1});for(var Xu=64,$u=Xu-1,Ju=[],Zu=0;Zu<$u;Zu++)Ju[Zu]=0;var tc=G(128,Ju);function ec(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|Ku[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 nc(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&&(ec(t),i=0);else{if(!p(e))throw Error("message must be string or array");for(;r<n;){var o=e[r++];if(!("number"==typeof o&&0<=o&&o<=255&&o==(0|o)))throw Error("message must be a byte array");t.f[i++]=o,i==t.b&&(ec(t),i=0)}}t.c=i,t.g+=n}Yu.prototype.reset=function(){this.g=this.c=0,this.a=l.Int32Array?new Int32Array(this.h):K(this.h)};var rc=[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 ic(){Yu.call(this,8,oc)}_(ic,Yu);var oc=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function sc(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 Qu,this.g=new Gu(this.h),this.f=null,this.b=[],this.a=this.c=null}function ac(t){return new w("invalid-cordova-configuration",t)}function uc(t){var e=new ic;nc(e,t),t=[];var n=8*e.g;e.c<56?nc(e,tc,56-e.c):nc(e,tc,e.b-(e.c-56));for(var r=63;56<=r;r--)e.f[r]=255&n,n/=256;for(ec(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 cc(t,e){for(var n=0;n<t.b.length;n++)try{t.b[n](e)}catch(t){}}function hc(a){return a.f||(a.f=a.ka().then(function(){return new le(function(n){function e(r){t=!0,s&&s.cancel(),lc(i).then(function(t){var e,n=o;t&&r&&r.url&&(e=null,-1!=(n=Ki(r.url)).indexOf("/__/auth/callback")&&(e=(e="object"==typeof(e=Sr(Nn(e=An(n),"firebaseError")||null))?E(e):null)?new Ao(t.c,t.b,null,null,e,null,t.S()):new Ao(t.c,t.b,n,t.f,null,null,t.S())),n=e||o),cc(i,n)})}var i,o,t,s,r;a.Ca(function t(e){return n(e),a.Qa(t),!1}),i=a,o=new Ao("unknown",null,null,null,new w("no-auth-event")),t=!1,s=vn(500).then(function(){return lc(i).then(function(){t||cc(i,o)})}),r=l.handleOpenURL,l.handleOpenURL=function(t){if(0==t.toLowerCase().indexOf(gr("BuildInfo.packageName",l).toLowerCase()+"://")&&e({url:t}),"function"==typeof r)try{r(t)}catch(t){console.error(t)}},Po=Po||new Oo,function(t){var n=Po;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=gr("universalLinks.subscribe",l))&&t(null,n.b))}(e)})})),a.f}function lc(e){var t,n=null;return(t=e.g).b.get(zu,t.a).then(ko).then(function(t){return n=t,Wu((t=e.g).b,zu,t.a)}).then(function(){return n})}function fc(t){this.a=t,this.b=Vu()}(t=sc.prototype).ka=function(){return this.Ga?this.Ga:this.Ga=(sr(void 0)?or().then(function(){return new le(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)})}):be(Error("Cordova must run in an Android or iOS file scheme."))).then(function(){if("function"!=typeof gr("universalLinks.subscribe",l))throw ac("cordova-universal-links-plugin-fix is not installed");if(void 0===gr("BuildInfo.packageName",l))throw ac("cordova-plugin-buildinfo is not installed");if("function"!=typeof gr("cordova.plugins.browsertab.openUrl",l))throw ac("cordova-plugin-browsertab is not installed");if("function"!=typeof gr("cordova.InAppBrowser.open",l))throw ac("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")),me()},t.Jb=function(){return be(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 be(new w("redirect-operation-pending"));var i=this,o=l.document,s=null,a=null,u=null,c=null;return this.c=me().then(function(){return No(e),hc(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 Ao(t,r,null,o,new w("no-auth-event"),null,i),a=gr("BuildInfo.packageName",l);if("string"!=typeof a)throw new w("invalid-cordova-configuration");var u=gr("BuildInfo.displayName",l),c={};if(yr().toLowerCase().match(/iphone|ipad|ipod/))c.ibi=a;else{if(!yr().toLowerCase().match(/android/))return be(new w("operation-not-supported-in-this-environment"));c.apn=a}u&&(c.appDisplayName=u),o=uc(o),c.sessionId=o;var h=iu(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(zu,s.v(),t)}).then(function(){var t=gr("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=gr("cordova.plugins.browsertab.openUrl",l)))throw new w("invalid-cordova-configuration");e(h)}else{if("function"!=typeof(e=gr("cordova.InAppBrowser.open",l)))throw new w("invalid-cordova-configuration");t=yr(),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 le(function(e,t){a=function(){var t=gr("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||vn(2e3).then(function(){t(new w("redirect-cancelled-by-user"))})},c=function(){Or()&&u()},o.addEventListener("resume",u,!1),yr().toLowerCase().match(/android/)||o.addEventListener("visibilitychange",c,!1)}).o(function(t){return lc(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),hc(this).o(function(t){"auth/invalid-cordova-configuration"===t.code&&(t=new Ao("unknown",null,null,null,new w("no-auth-event")),e(t))})},t.Qa=function(e){H(this.b,function(t){return t==e})};var pc={name:"pendingRedirect",F:"session"};function dc(t){return Wu(t.b,pc,t.a)}function vc(t,e,n){this.i={},this.w=0,this.D=t,this.u=e,this.m=n,this.h=[],this.f=!1,this.l=g(this.s,this),this.b=new kc,this.B=new xc,this.g=new fc(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=yc(this.D,this.u,this.m,I)}function yc(t,e,n,r){var i=Bl.SDK_VERSION||null;return new(sr()?sc:tu)(t,e,n,i,r)}function gc(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 mc(n){n.a.Ub()&&gc(n).o(function(t){var e=new Ao("unknown",null,null,null,new w("operation-not-supported-in-this-environment"));Tc(t)&&n.s(e)}),n.a.Qb()||Oc(n.b)}function bc(n,t){B(n.h,t)||n.h.push(t),n.f||(t=n.g).b.get(pc,t.a).then(function(t){return"pending"==t}).then(function(t){t?dc(n.g).then(function(){gc(n).o(function(t){var e=new Ao("unknown",null,null,null,new w("operation-not-supported-in-this-environment"));Tc(t)&&n.s(e)})}):mc(n)}).o(function(){mc(n)})}function _c(t,e){H(t.h,function(t){return t==e})}vc.prototype.reset=function(){this.f=!1,this.a.Qa(this.l),this.a=yc(this.D,this.u,this.m),this.i={}},vc.prototype.s=function(t){if(!t)throw new w("invalid-auth-event");if(6e5<=b()-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=b())),e=!0;break}}return Oc(this.b),e};var wc=new kr(2e3,1e4),Ec=new kr(3e4,6e4);function Ic(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 Tc(t){return!(!t||"auth/cordova-not-ready"!=t.code)}function Sc(e,t,n,r,i){var o,s;return(s=e.g).b.set(pc,"pending",s.a).then(function(){return e.a.Kb(t,n,r,i).o(function(t){if(Tc(t))throw new w("operation-not-supported-in-this-environment");return o=t,dc(e.g).then(function(){throw o})}).then(function(){return e.a.Xb()?new le(function(){}):dc(e.g).then(function(){return e.pa()}).then(function(){}).o(function(){})})})}function Cc(t,e,n,r,i){return t.a.Lb(r,function(t){e.la(n,null,t,i)},wc.get())}vc.prototype.pa=function(){return this.b.pa()};var Nc={};function Ac(t,e,n){var r=e+":"+n;return Nc[r]||(Nc[r]=new vc(t,e,n)),Nc[r]}function kc(){this.b=null,this.f=[],this.c=[],this.a=null,this.i=this.g=!1}function Oc(t){t.g||(t.g=!0,Dc(t,!1,null,null))}function Rc(t){t.g&&!t.i&&Dc(t,!1,null,null)}function Pc(t,e){if(t.b=function(){return me(e)},t.f.length)for(var n=0;n<t.f.length;n++)t.f[n](e)}function Dc(t,e,n,r){e?r?function(t,e){if(t.b=function(){return be(e)},t.c.length)for(var n=0;n<t.c.length;n++)t.c[n](e)}(t,r):Pc(t,n):Pc(t,{user:null}),t.f=[],t.c=[]}function xc(){}function Lc(){this.Bb=!1,Object.defineProperty(this,"appVerificationDisabled",{get:function(){return this.Bb},set:function(t){this.Bb=t},enumerable:!1})}function Mc(t,e){this.a=e,Fr(this,"verificationId",t)}function Fc(t,e,n,r){return new To(t).cb(e,n).then(function(t){return new Mc(t,r)})}function Uc(t){var e=Pi(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.");Ur(this,{token:t,expirationTime:Rr(1e3*e.exp),authTime:Rr(1e3*e.auth_time),issuedAtTime:Rr(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 jc(t,e,n){var r=e&&e[qc];if(!r)throw new w("argument-error","Internal assert: Invalid MultiFactorResolver");this.a=t,this.f=ut(e),this.g=n,this.c=new zi(null,r),this.b=[];var i=this;U(e[Vc]||[],function(t){(t=Br(t))&&i.b.push(t)}),Fr(this,"auth",this.a),Fr(this,"session",this.c),Fr(this,"hints",this.b)}kc.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},kc.prototype.h=function(t,e){var n,r,i,o;t?(this.reset(),this.g=!0,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?(Dc(this,!0,null,t.a),me()):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){Dc(e,a,t,null)}).o(function(t){Dc(e,a,null,t)})}(this,t,e):be(new w("invalid-auth-event")):(Dc(this,!1,null,null),me())):be(new w("invalid-auth-event"))},kc.prototype.pa=function(){var i=this;return new le(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=vn(Ec.get()).then(function(){n.b||(n.g=!0,Dc(n,!0,null,r))}))})},xc.prototype.h=function(t,e){var n,r,i,o,s;t?(n=t.c,r=t.b,t.a?(e.la(t.c,null,t.a,t.b),me()):e.Da(n,r)?(i=e,o=(t=t).b,s=t.c,i.Da(s,o)(t.g,t.f,t.S(),t.i).then(function(t){i.la(s,t,null,o)}).o(function(t){i.la(s,null,t,o)})):be(new w("invalid-auth-event"))):be(new w("invalid-auth-event"))},Mc.prototype.confirm=function(t){return t=So(this.verificationId,t),this.a(t)};var Vc="mfaInfo",qc="mfaPendingCredential";function Bc(t,e,n,r){w.call(this,"multi-factor-auth-required",r,e),this.b=new jc(t,e,n),Fr(this,"resolver",this.b)}function Wc(t,e,n){if(t&&v(t.serverResponse)&&"auth/multi-factor-auth-required"===t.code)try{return new Bc(e,t.serverResponse,n,t.message)}catch(t){}return null}function Hc(){}function Gc(t){Fr(this,"factorId",t.ea),this.a=t}function Kc(t){if(Gc.call(this,t),this.a.ea!=To.PROVIDER_ID)throw new w("argument-error","firebase.auth.PhoneMultiFactorAssertion requires a valid firebase.auth.PhoneAuthCredential")}function zc(t,e){for(var n in je.call(this,t),e)this[n]=e[n]}function Qc(t,e){this.a=t,this.b=[],this.c=g(this.wc,this),$e(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[Gr]=t.uid),t.displayName&&(n[Wr]=t.displayName),t.enrollmentTime&&(n[Hr]=new Date(t.enrollmentTime).toISOString()),t.phoneNumber&&(n[Kr]=t.phoneNumber);try{e=new zr(n)}catch(t){}t=e}else t=null;t&&r.push(t)}),Yc(this,r)}function Yc(t,e){t.b=e,Fr(t,"enrolledFactors",e)}function Xc(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 $c(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 Jc(t){this.c=t,this.b=this.a=null}function Zc(t){return t.b&&1e3*t.b.c||0}function th(t,e){var n=e.refreshToken;t.b=Ri(e[Vs]||""),t.a=n}function eh(e,t){return r=e.c,i=t,new le(function(e,n){"refresh_token"==i.grant_type&&i.refresh_token||"authorization_code"==i.grant_type&&i.code?zs(r,r.u+"?key="+encodeURIComponent(r.c),function(t){t?t.error?n(Ga(t)):t.access_token&&t.refresh_token?e(t):n(new w("internal-error")):n(new w("network-request-failed"))},"POST",Vn(i).toString(),r.g,r.m.get()):n(new w("internal-error"))}).then(function(t){return e.b=Ri(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 nh(t,e){this.a=t||null,this.b=e||null,Ur(this,{lastSignInTime:Rr(e||null),creationTime:Rr(t||null)})}function rh(t,e,n,r,i,o){Ur(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}function ih(t,e,n){var r;this.N=[],this.l=t.apiKey,this.m=t.appName,this.s=t.authDomain||null,t=Bl.SDK_VERSION?vr(Bl.SDK_VERSION):null,this.a=new Us(this.l,N(I),t),this.b=new Jc(this.a),lh(this,e[Vs]),th(this.b,e),Fr(this,"refreshToken",this.b.a),dh(this,n||{}),hn.call(this),this.P=!1,this.s&&br()&&(this.i=Ac(this.s,this.l,this.m)),this.R=[],this.h=null,this.B=(r=this,new Xc(function(){return r.I(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var t=Zc(r.b)-b()-3e5;return 0<t?t:0})),this.Z=g(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){sh(i,t.c)},this.$=null,this.O=new Qc(this,n),Fr(this,"multiFactor",this.O)}function oh(t,e){t.aa&&tn(t.aa,"languageCodeChanged",t.za),(t.aa=e)&&$e(e,"languageCodeChanged",t.za)}function sh(t,e){t.W=e,Ks(t.a,Bl.SDK_VERSION?vr(Bl.SDK_VERSION,t.W):null)}function ah(t,e){t.$&&tn(t.$,"frameworkChanged",t.ya),(t.$=e)&&$e(e,"frameworkChanged",t.ya)}function uh(e){try{return Bl.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 ch(t){t.D||t.B.b||(t.B.start(),tn(t,"tokenChanged",t.Z),$e(t,"tokenChanged",t.Z))}function hh(t){tn(t,"tokenChanged",t.Z),t.B.stop()}function lh(t,e){t.xa=e,Fr(t,"_lat",e)}function fh(t){for(var e=[],n=0;n<t.R.length;n++)e.push(t.R[n](t));return we(e).then(function(){return t})}function ph(t){t.i&&!t.P&&(t.P=!0,bc(t.i,t))}function dh(t,e){Ur(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 nh(e.createdAt,e.lastLoginAt),providerData:[]}),t.a.b=t.tenantId}function vh(){}function yh(t){return me().then(function(){if(t.D)throw new w("app-deleted")})}function gh(t){return V(t.providerData,function(t){return t.providerId})}function mh(t,e){e&&(bh(t,e.providerId),t.providerData.push(e))}function bh(t,e){H(t.providerData,function(t){return t.providerId==e})}function _h(t,e,n){("uid"!=e||n)&&t.hasOwnProperty(e)&&Fr(t,e,n)}function wh(e,t){var n,r;e!=t&&(Ur(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?Fr(e,"metadata",new nh((r=t.metadata).a,r.b)):Fr(e,"metadata",new nh),U(t.providerData,function(t){mh(e,t)}),n=e.b,r=t.b,n.b=r.b,n.a=r.a,Fr(e,"refreshToken",e.b.a),Yc(e.O,t.O.b))}function Eh(i){return i.I().then(function(t){var e,n,r=i.isAnonymous;return n=t,Wa((e=i).a,_a,{idToken:n}).then(g(e.Ic,e)).then(function(){return r||_h(i,"isAnonymous",!1),t})})}function Ih(t,e){e[Vs]&&t.xa!=e[Vs]&&(th(t.b,e),t.dispatchEvent(new zc("tokenChanged")),lh(t,e[Vs]),_h(t,"refreshToken",t.b.a))}function Th(t,e){return Eh(t).then(function(){if(B(gh(t),e))return fh(t).then(function(){throw new w("provider-already-linked")})})}function Sh(t,e,n){return jr({user:t,credential:Co(e),additionalUserInfo:e=Fi(e),operationType:n})}function Ch(t,e){return Ih(t,e),t.reload().then(function(){return t})}function Nh(n,r,t,e,i){if(!br())return be(new w("operation-not-supported-in-this-environment"));if(n.h&&!i)return be(n.h);var o=Mi(t.providerId),s=Cr(n.uid+":::"),a=null;(!Er()||ar())&&n.s&&t.isOAuthProvider&&(a=iu(n.s,n.l,n.m,r,t,null,s,Bl.SDK_VERSION||null,null,null,n.tenantId));var u=nr(a,o&&o.ta,o&&o.sa);return e=e().then(function(){if(kh(n),!i)return n.I().then(function(){})}).then(function(){return Ic(n.i,u,r,t,s,!!a,n.tenantId)}).then(function(){return new le(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=Cc(n.i,n,r,u,s)})}).then(function(t){return u&&er(u),t?jr(t):null}).o(function(t){throw u&&er(u),t}),Oh(n,e,i)}function Ah(e,t,n,r,i){if(!br())return be(new w("operation-not-supported-in-this-environment"));if(e.h&&!i)return be(e.h);var o=null,s=Cr(e.uid+":::");return r=r().then(function(){if(kh(e),!i)return e.I().then(function(){})}).then(function(){return e.fa=s,fh(e)}).then(function(t){return e.ga&&(t=(t=e.ga).b.set(Dh,e.v(),t.a)),t}).then(function(){return Sc(e.i,t,n,s,e.tenantId)}).o(function(t){if(o=t,e.ga)return xh(e.ga);throw o}).then(function(){if(o)throw o}),Oh(e,r,i)}function kh(t){if(!t.i||!t.P){if(t.i&&!t.P)throw new w("internal-error");throw new w("auth-domain-config-required")}}function Oh(n,t,e){var r,i=(t=t,e=e,(r=n).h&&!e?(t.cancel(),be(r.h)):t.o(function(t){throw!t||"auth/user-disabled"!=t.code&&"auth/user-token-expired"!=t.code||(r.h||r.dispatchEvent(new zc("userInvalidated")),r.h=t),t}));return n.N.push(i),i.ma(function(){W(n.N,i)}),i.o(function(t){var e=null;throw t&&"auth/multi-factor-auth-required"===t.code&&(e=Wc(t.v(),uh(n),g(n.hc,n))),e||t})}function Rh(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[Vs]=t.stsTokenManager.accessToken,n.refreshToken=t.stsTokenManager.refreshToken||null;var r=new ih(e,n,t);return t.providerData&&U(t.providerData,function(t){t&&mh(r,jr(t))}),t.redirectEventId&&(r.fa=t.redirectEventId),r}function Ph(t){this.a=t,this.b=Vu()}jc.prototype.Pc=function(t){var n=this;return t.ob(this.a.b,this.c).then(function(t){var e=ut(n.f);return delete e[Vc],delete e[qc],ht(e,t),n.g(e)})},_(Bc,w),Hc.prototype.ob=function(t,e,n){return e.type==Qi?(o=this,s=t,a=n,e.Fa().then(function(t){return t={idToken:t},void 0!==a&&(t.displayName=a),ht(t,{phoneVerificationInfo:Io(o.a)}),Wa(s,ma,t)})):(r=this,i=t,e.Fa().then(function(t){return ht(t={mfaPendingCredential:t},{phoneVerificationInfo:Io(r.a)}),Wa(i,ba,t)}));var r,i,o,s,a},_(Gc,Hc),_(Kc,Gc),_(zc,je),(t=Qc.prototype).wc=function(t){var e;Yc(this,(t=t.ed,e=[],U(t.mfaInfo||[],function(t){(t=Br(t))&&e.push(t)}),e))},t.Ob=function(){return this.a.I().then(function(t){return new zi(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 Ih(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 Wa(e,Ba,{idToken:t,mfaEnrollmentId:r})}).then(function(t){var e=j(n.b,function(t){return t.uid!=r});return Yc(n,e),Ih(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()})}}},Xc.prototype.start=function(){this.a=this.c,function e(n,t){n.stop();n.b=vn($c(n,t)).then(function(){return e=l.document,n=null,Or()||!e?me():new le(function(t){n=function(){Or()&&(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)},Xc.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},Jc.prototype.v=function(){return{apiKey:this.c.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:Zc(this)}},Jc.prototype.getToken=function(t){return t=!!t,this.b&&!this.a?be(new w("user-token-expired")):t||!this.b||b()>Zc(this)-3e4?this.a?eh(this,{grant_type:"refresh_token",refresh_token:this.a}):me(null):me({accessToken:this.b.toString(),refreshToken:this.a})},nh.prototype.v=function(){return{lastLoginAt:this.b,createdAt:this.a}},_(ih,hn),ih.prototype.va=function(t){this.oa=t,Gs(this.a,t)},ih.prototype.ja=function(){return this.oa},ih.prototype.Ea=function(){return K(this.W)},ih.prototype.Ma=function(){this.B.b&&(this.B.stop(),this.B.start())},Fr(ih.prototype,"providerId","firebase"),(t=ih.prototype).reload=function(){var t=this;return Oh(this,yh(this).then(function(){return Eh(t).then(function(){return fh(t)}).then(vh)}))},t.mc=function(t){return this.I(t).then(function(t){return new Uc(t)})},t.I=function(t){var e=this;return Oh(this,yh(this).then(function(){return e.b.getToken(t)}).then(function(t){if(!t)throw new w("internal-error");return t.accessToken!=e.xa&&(lh(e,t.accessToken),e.dispatchEvent(new zc("tokenChanged"))),_h(e,"refreshToken",t.refreshToken),t.accessToken}))},t.Ic=function(t){if(!(t=t.users)||!t.length)throw new w("internal-error");dh(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,n=(e=(e=t).providerUserInfo)&&e.length?V(e,function(t){return new rh(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[],r=0;r<n.length;r++)mh(this,n[r]);_h(this,"isAnonymous",!(this.email&&t.passwordHash||this.providerData&&this.providerData.length)),this.dispatchEvent(new zc("userReloaded",{ed:t}))},t.Jc=function(t){return Lr("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 Oh(this,t.c(this.a,this.uid).then(function(t){return Ih(e,t),n=Sh(e,t,"reauthenticate"),e.h=null,e.reload()}).then(function(){return n}),!0)},t.Ac=function(t){return Lr("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 Oh(this,Th(this,e.providerId).then(function(){return n.I()}).then(function(t){return e.b(n.a,t)}).then(function(t){return r=Sh(n,t,"link"),Ch(n,t)}).then(function(){return r}))},t.Bc=function(t,e){var n=this;return Oh(this,Th(this,"phone").then(function(){return Fc(uh(n),t,e,g(n.mb,n))}))},t.Kc=function(t,e){var n=this;return Oh(this,me().then(function(){return Fc(uh(n),t,e,g(n.pb,n))}),!0)},t.xb=function(e){var n=this;return Oh(this,this.I().then(function(t){return n.a.xb(t,e)}).then(function(t){return Ih(n,t),n.reload()}))},t.cd=function(e){var n=this;return Oh(this,this.I().then(function(t){return e.b(n.a,t)}).then(function(t){return Ih(n,t),n.reload()}))},t.yb=function(e){var n=this;return Oh(this,this.I().then(function(t){return n.a.yb(t,e)}).then(function(t){return Ih(n,t),n.reload()}))},t.zb=function(e){if(void 0===e.displayName&&void 0===e.photoURL)return yh(this);var n=this;return Oh(this,this.I().then(function(t){return n.a.zb(t,{displayName:e.displayName,photoUrl:e.photoURL})}).then(function(t){return Ih(n,t),_h(n,"displayName",t.displayName||null),_h(n,"photoURL",t.photoUrl||null),U(n.providerData,function(t){"password"===t.providerId&&(Fr(t,"displayName",n.displayName),Fr(t,"photoURL",n.photoURL))}),fh(n)}).then(vh))},t.ad=function(e){var n=this;return Oh(this,Eh(this).then(function(t){return B(gh(n),e)?Wa(n.a,va,{idToken:t,deleteProvider:[e]}).then(function(t){var e={};return U(t.providerUserInfo||[],function(t){e[t.providerId]=!0}),U(gh(n),function(t){e[t]||bh(n,t)}),e[To.PROVIDER_ID]||Fr(n,"phoneNumber",null),fh(n)}):fh(n).then(function(){throw new w("no-such-provider")})}))},t.delete=function(){var e=this;return Oh(this,this.I().then(function(t){return Wa(e.a,da,{idToken:t})}).then(function(){e.dispatchEvent(new zc("userDeleted"))})).then(function(){for(var t=0;t<e.N.length;t++)e.N[t].cancel("app-deleted");oh(e,null),ah(e,null),e.N=[],e.D=!0,hh(e),Fr(e,"refreshToken",null),e.i&&_c(e.i,e)})},t.Cb=function(t,e){return!!("linkViaPopup"==t&&(this.g||null)==e&&this.f||"reauthViaPopup"==t&&(this.g||null)==e&&this.f||"linkViaRedirect"==t&&(this.fa||null)==e||"reauthViaRedirect"==t&&(this.fa||null)==e)},t.la=function(t,e,n,r){"linkViaPopup"!=t&&"reauthViaPopup"!=t||r!=(this.g||null)||(n&&this.w?this.w(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.w)},t.Da=function(t,e){return"linkViaPopup"==t&&e==(this.g||null)?g(this.Hb,this):"reauthViaPopup"==t&&e==(this.g||null)?g(this.Ib,this):"linkViaRedirect"==t&&(this.fa||null)==e?g(this.Hb,this):"reauthViaRedirect"==t&&(this.fa||null)==e?g(this.Ib,this):null},t.Cc=function(t){var e=this;return Nh(this,"linkViaPopup",t,function(){return Th(e,t.providerId).then(function(){return fh(e)})},!1)},t.Lc=function(t){return Nh(this,"reauthViaPopup",t,function(){return me()},!0)},t.Dc=function(t){var e=this;return Ah(this,"linkViaRedirect",t,function(){return Th(e,t.providerId)},!1)},t.Mc=function(t){return Ah(this,"reauthViaRedirect",t,function(){return me()},!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 aa(i.a,{requestUri:e,postBody:r,sessionId:n,idToken:t})}).then(function(t){return o=Sh(i,t,"link"),Ch(i,t)}).then(function(){return o}),Oh(this,t)},t.Ib=function(t,e,n,r){var i=this;this.c&&(this.c.cancel(),this.c=null);var o=null;return Oh(this,me().then(function(){return $i(ua(i.a,{requestUri:t,sessionId:e,postBody:r,tenantId:n}),i.uid)}).then(function(t){return o=Sh(i,t,"reauthenticate"),Ih(i,t),i.h=null,i.reload()}).then(function(){return o}),!0)},t.qb=function(e){var n=this,r=null;return Oh(this,this.I().then(function(t){return r=t,void 0===e||at(e)?{}:Ni(new gi(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 Oh(this,this.I().then(function(t){return i=t,void 0===n||at(n)?{}:Ni(new gi(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 Oh(this,t=$i(me(t),n.uid).then(function(t){return e=Sh(n,t,"reauthenticate"),Ih(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&&ht(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))}),ht(e,this.O.v()),e};var Dh={name:"redirectUser",F:"session"};function xh(t){return Wu(t.b,Dh,t.a)}function Lh(t){var e,n,r,i;this.a=t,this.b=Vu(),this.c=null,this.f=(n=Uh("local"),r=Uh("session"),i=Uh("none"),function(n,r,i){var o=Bu(r,i),s=qu(n,r.F);return n.get(r,i).then(function(t){var e=null;try{e=Sr(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(Fh,e.a).then(function(t){return t?Uh(t):n})})})}).then(function(t){return e.c=t,Mh(e,t.F)}).o(function(){e.c||(e.c=n)})),this.b.addListener(Uh("local"),this.a,g(this.g,this))}function Mh(t,e){var n,a,r=[];for(n in Uu)Uu[n]!==e&&r.push(Wu(t.b,Uh(Uu[n]),t.a));return r.push(Wu(t.b,Fh,t.a)),a=r,new le(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++)_e(a[s],m(t,s),o);else n(i)})}Lh.prototype.g=function(){var e=this,n=Uh("local");Bh(this,function(){return me().then(function(){return e.c&&"local"!=e.c.F?e.b.get(n,e.a):null}).then(function(t){if(t)return Mh(e,"local").then(function(){e.c=n})})})};var Fh={name:"persistence",F:"session"};function Uh(t){return{name:"authUser",F:t}}function jh(t,e){return Bh(t,function(){return t.b.set(t.c,e.v(),t.a)})}function Vh(t){return Bh(t,function(){return Wu(t.b,t.c,t.a)})}function qh(t,e){return Bh(t,function(){return t.b.get(t.c,t.a).then(function(t){return t&&e&&(t.authDomain=e),Rh(t||{})})})}function Bh(t,e){return t.f=t.f.then(e,e),t.f}function Wh(t){if(this.l=!1,Fr(this,"settings",new Lc),Fr(this,"app",t),!this.app.options||!this.app.options.apiKey)throw new w("invalid-api-key");var n,e,r,i,o,s;t=Bl.SDK_VERSION?vr(Bl.SDK_VERSION):null,this.b=new Us(this.app.options&&this.app.options.apiKey,N(I),t),this.P=[],this.m=[],this.O=[],this.$b=Bl.INTERNAL.createSubscribe(g(this.xc,this)),this.W=void 0,this.ac=Bl.INTERNAL.createSubscribe(g(this.yc,this)),Yh(this,null),this.i=new Lh(this.app.options.apiKey+":"+this.app.name),this.B=new Ph(this.app.options.apiKey+":"+this.app.name),this.Z=tl(this,(e=(n=this).app.options.authDomain,t=function(e){var t=function(t,e){return t.b.get(Dh,t.a).then(function(t){return t&&e&&(t.authDomain=e),Rh(t||{})})}(e.B,e.app.options.authDomain).then(function(t){return(e.D=t)&&(t.ga=e.B),xh(e.B)});return tl(e,t)}(n).then(function(){return qh(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 jh(n.i,e).then(function(){return e})}).o(function(t){return"auth/network-request-failed"==t.code?e:Vh(n.i)})):null}).then(function(t){Yh(n,t||null)}),tl(n,t))),this.h=tl(this,(r=this).Z.then(function(){return zh(r)}).o(function(){}).then(function(){if(!r.l)return r.oa()}).o(function(){}).then(function(){var t;r.l||(r.aa=!0,(t=r.i).b.addListener(Uh("local"),t.a,r.oa))})),this.aa=!1,this.oa=g(this.Xc,this),this.Ma=g(this.ca,this),this.xa=g(this.jc,this),this.ya=g(this.uc,this),this.za=g(this.vc,this),this.a=null,o=(i=this).app.options.authDomain,s=i.app.options.apiKey,o&&br()&&(i.Zb=i.Z.then(function(){var t;if(!i.l)return i.a=Ac(o,s,i.app.name),bc(i.a,i),$h(i)&&ph($h(i)),i.D&&(ph(i.D),(t=i.D).va(i.ja()),oh(t,i),sh(t=i.D,i.N),ah(t,i),i.D=null),i.a})),this.INTERNAL={},this.INTERNAL.delete=g(this.delete,this),this.INTERNAL.logFramework=g(this.Ec,this),this.s=0,hn.call(this),t=this,Object.defineProperty(t,"lc",{get:function(){return this.ja()},set:function(t){this.va(t)},enumerable:!1}),t.$=null,Object.defineProperty(t,"ti",{get:function(){return this.S()},set:function(t){this.ub(t)},enumerable:!1}),t.R=null,this.N=[]}function Hh(t){je.call(this,"languageCodeChanged"),this.g=t}function Gh(t){je.call(this,"frameworkChanged"),this.c=t}function Kh(t){return t.Zb||be(new w("auth-domain-config-required"))}function zh(t){if(!br())return be(new w("operation-not-supported-in-this-environment"));var e=Kh(t).then(function(){return t.a.pa()}).then(function(t){return t?jr(t):null});return tl(t,e)}function Qh(o,s){var a={};return a.apiKey=o.app.options.apiKey,a.authDomain=o.app.options.authDomain,a.appName=o.app.name,o.Z.then(function(){return t=a,e=s,n=o.B,r=o.Ea(),i=new ih(t,e),n&&(i.ga=n),r&&sh(i,r),i.reload().then(function(){return i});var t,e,n,r,i}).then(function(t){return $h(o)&&t.uid==$h(o).uid?wh($h(o),t):(Yh(o,t),ph(t)),o.ca(t)}).then(function(){Zh(o)})}function Yh(t,e){var n,r;$h(t)&&(n=$h(t),r=t.Ma,H(n.R,function(t){return t==r}),tn($h(t),"tokenChanged",t.xa),tn($h(t),"userDeleted",t.ya),tn($h(t),"userInvalidated",t.za),hh($h(t))),e&&(e.R.push(t.Ma),$e(e,"tokenChanged",t.xa),$e(e,"userDeleted",t.ya),$e(e,"userInvalidated",t.za),0<t.s&&ch(e)),Fr(t,"currentUser",e),e&&(e.va(t.ja()),oh(e,t),sh(e,t.N),ah(e,t))}function Xh(n,t){var e=null,r=null;return tl(n,t.then(function(t){return e=Co(t),r=Fi(t),Qh(n,t)},function(t){var e=null;throw t&&"auth/multi-factor-auth-required"===t.code&&(e=Wc(t.v(),n,g(n.ic,n))),e||t}).then(function(){return jr({user:$h(n),credential:e,additionalUserInfo:r,operationType:"signIn"})}))}function $h(t){return t.currentUser}function Jh(t){return $h(t)&&$h(t)._lat||null}function Zh(t){if(t.aa){for(var e=0;e<t.m.length;e++)t.m[e]&&t.m[e](Jh(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](Jh(t))}}function tl(t,e){return t.P.push(e),e.ma(function(){W(t.P,e)}),e}function el(){}function nl(){this.a={},this.b=1e12}Lh.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 Uu)if(Uu[r]==t){var r=!0;break t}r=!1}if(!r||"string"!=typeof t)throw e;switch(cr()){case"ReactNative":if("session"===t)throw n;break;case"Node":if("none"!==t)throw n;break;case"Worker":if("session"===t||!gu()&&"none"!==t)throw n;break;default:if(!mr()&&"none"!==t)throw n}}(e),Bh(this,function(){return e!=r.c.F?r.b.get(r.c,r.a).then(function(t){return n=t,Mh(r,e)}).then(function(){if(r.c=Uh(e),n)return r.b.set(r.c,n,r.a)}):me()})},_(Wh,hn),_(Hh,je),_(Gh,je),(t=Wh.prototype).tb=function(t){return t=this.i.tb(t),tl(this,t)},t.va=function(t){this.$===t||this.l||(this.$=t,Gs(this.b,this.$),this.dispatchEvent(new Hh(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),Ks(this.b,Bl.SDK_VERSION?vr(Bl.SDK_VERSION,this.N):null),this.dispatchEvent(new Gh(this.N))},t.Ea=function(){return K(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:this.app.options.apiKey,authDomain:this.app.options.authDomain,appName:this.app.name,currentUser:$h(this)&&$h(this).v()}},t.Cb=function(t,e){switch(t){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==e&&!!this.f;default:return!1}},t.la=function(t,e,n,r){"signInViaPopup"==t&&this.g==r&&(n&&this.w?this.w(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.w)},t.Da=function(t,e){return"signInViaRedirect"==t||"signInViaPopup"==t&&this.g==e&&this.f?g(this.gc,this):null},t.gc=function(t,e,n,r){var i=this,o={requestUri:t,postBody:r,sessionId:e,tenantId:n};return this.c&&(this.c.cancel(),this.c=null),i.Z.then(function(){return Xh(i,sa(i.b,o))})},t.Vc=function(e){if(!br())return be(new w("operation-not-supported-in-this-environment"));var n=this,t=Mi(e.providerId),r=Cr(),i=null;(!Er()||ar())&&this.app.options.authDomain&&e.isOAuthProvider&&(i=iu(this.app.options.authDomain,this.app.options.apiKey,this.app.name,"signInViaPopup",e,null,r,Bl.SDK_VERSION||null,null,null,this.S()));var o=nr(i,t&&t.ta,t&&t.sa);return tl(this,t=Kh(this).then(function(t){return Ic(t,o,"signInViaPopup",e,r,!!i,n.S())}).then(function(){return new le(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=Cc(n.a,n,"signInViaPopup",o,r)})}).then(function(t){return o&&er(o),t?jr(t):null}).o(function(t){throw o&&er(o),t}))},t.Wc=function(t){if(!br())return be(new w("operation-not-supported-in-this-environment"));var e=this;return tl(this,Kh(this).then(function(){return Bh(t=e.i,function(){return t.b.set(Fh,t.c.F,t.a)});var t}).then(function(){return Sc(e.a,"signInViaRedirect",t,void 0,e.S())}))},t.pa=function(){var e=this;return zh(this).then(function(t){return e.a&&Rc(e.a.b),t}).o(function(t){throw e.a&&Rc(e.a.b),t})},t.bd=function(t){if(!t)return be(new w("null-user"));if(this.R!=t.tenantId)return be(new w("tenant-id-mismatch"));var e=this,n={};n.apiKey=this.app.options.apiKey,n.authDomain=this.app.options.authDomain,n.appName=this.app.name;var r,i,o,s,a,u=(r=t,i=n,o=e.B,s=e.Ea(),a=r.b,(n={})[Vs]=a.b&&a.b.toString(),n.refreshToken=a.a,i=new ih(i||{apiKey:r.l,authDomain:r.s,appName:r.m},n),o&&(i.ga=o),s&&sh(i,s),wh(i,r),i);return tl(this,this.h.then(function(){if(e.app.options.apiKey!=t.l)return u.reload()}).then(function(){return $h(e)&&t.uid==$h(e).uid?(wh($h(e),t),e.ca(t)):(Yh(e,u),ph(u),e.ca(u))}).then(function(){Zh(e)}))},t.wb=function(){var t=this,e=this.h.then(function(){return t.a&&Rc(t.a.b),$h(t)?(Yh(t,null),Vh(t.i).then(function(){Zh(t)})):me()});return tl(this,e)},t.Xc=function(){var r=this;return qh(this.i,this.app.options.authDomain).then(function(t){if(!r.l){var e,n;if((n=$h(r)&&t)&&(n=$h(r).uid,e=t.uid,n=null!=n&&""!==n&&null!=e&&""!==e&&n==e),n)return wh($h(r),t),$h(r).I();($h(r)||t)&&(Yh(r,t),t&&(ph(t),t.ga=r.B),r.a&&bc(r.a,r),Zh(r))}})},t.ca=function(t){return jh(this.i,t)},t.jc=function(){Zh(this),this.ca($h(this))},t.uc=function(){this.wb()},t.vc=function(){this.wb()},t.ic=function(t){var e=this;return this.h.then(function(){return Xh(e,me(t))})},t.xc=function(t){var e=this;this.addAuthTokenListener(function(){t.next($h(e))})},t.yc=function(t){var e,n,r=this;n=function(){t.next($h(r))},(e=this).O.push(n),tl(e,e.h.then(function(){!e.l&&B(e.O,n)&&e.W!==e.getUid()&&(e.W=e.getUid(),n(Jh(e)))}))},t.Gc=function(t,e,n){var r=this;return this.aa&&Promise.resolve().then(function(){"function"==typeof t?t($h(r)):"function"==typeof t.next&&t.next($h(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(),"function"==typeof t?t($h(r)):"function"==typeof t.next&&t.next($h(r))}),this.ac(t,e,n)},t.kc=function(t){var e=this,n=this.h.then(function(){return $h(e)?$h(e).I(t).then(function(t){return{accessToken:t}}):null});return tl(this,n)},t.Rc=function(t){var n=this;return this.h.then(function(){return Xh(n,Wa(n.b,Fa,{token:t}))}).then(function(t){var e=t.user;return _h(e,"isAnonymous",!1),n.ca(e),t})},t.Sc=function(t,e){var n=this;return this.h.then(function(){return Xh(n,Wa(n.b,Ua,{email:t,password:e}))})},t.cc=function(t,e){var n=this;return this.h.then(function(){return Xh(n,Wa(n.b,fa,{email:t,password:e}))})},t.Ya=function(t){var e=this;return this.h.then(function(){return Xh(e,t.ia(e.b))})},t.Qc=function(t){return Lr("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=$h(n);if(t&&t.isAnonymous){var e=jr({providerId:null,isNewUser:!1});return jr({user:t,credential:null,additionalUserInfo:e,operationType:"signIn"})}return Xh(n,n.b.vb()).then(function(t){var e=t.user;return _h(e,"isAnonymous",!0),n.ca(e),t})})},t.getUid=function(){return $h(this)&&$h(this).uid||null},t.bc=function(t){this.addAuthTokenListener(t),this.s++,0<this.s&&$h(this)&&ch($h(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&&$h(this)&&hh($h(this)),this.removeAuthTokenListener(e)},t.addAuthTokenListener=function(t){var e=this;this.m.push(t),tl(this,this.h.then(function(){e.l||B(e.m,t)&&t(Jh(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(Uh("local"),t.a,this.oa),this.a&&(_c(this.a,this),Rc(this.a.b)),Promise.resolve()},t.fc=function(t){return tl(this,Wa(this.b,pa,{identifier:t,continueUri:_r()?Jn():"http://localhost"}).then(function(t){return t.signinMethods||[]}))},t.zc=function(t){return!!_o(t)},t.sb=function(e,n){var r=this;return tl(this,me().then(function(){var t=new gi(n);if(!t.c)throw new w("argument-error",_i+" must be true when sending sign in link to email");return Ni(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 tl(this,this.b.jb(t,e).then(function(){}))},t.Pa=function(t){return tl(this,this.b.Pa(t).then(function(t){return new Qr(t)}))},t.fb=function(t){return tl(this,this.b.fb(t).then(function(){}))},t.rb=function(e,t){var n=this;return tl(this,me().then(function(){return void 0===t||at(t)?{}:Ni(new gi(t))}).then(function(t){return n.b.rb(e,t)}).then(function(){}))},t.Uc=function(t,e){return tl(this,Fc(this,t,e,g(this.Ya,this)))},t.Tc=function(n,r){var i=this;return tl(this,me().then(function(){var t=r||Jn(),e=bo(n,t);if(!(t=_o(t)))throw new w("argument-error","Invalid email link!");if(t.tenantId!==i.S())throw new w("tenant-id-mismatch");return i.Ya(e)}))},el.prototype.render=function(){},el.prototype.reset=function(){},el.prototype.getResponse=function(){},el.prototype.execute=function(){};var rl=null;function il(t,e){return(e=ol(e))&&t.a[e]||null}function ol(t){return(t=void 0===t?1e12:t)?t.toString():null}function sl(t,e){this.g=!1,this.c=e,this.a=this.b=null,this.h="invisible"!==this.c.size,this.f=Jt(t);var n=this;this.i=function(){n.execute()},this.h?this.execute():$e(this.f,"click",this.i)}function al(t){if(t.g)throw Error("reCAPTCHA mock was already deleted!")}function ul(){}function cl(){}nl.prototype.render=function(t,e){return this.a[this.b.toString()]=new sl(t,e),this.b++},nl.prototype.reset=function(t){var e=il(this,t);t=ol(t),e&&t&&(e.delete(),delete this.a[t])},nl.prototype.getResponse=function(t){return(t=il(this,t))?t.getResponse():null},nl.prototype.execute=function(t){(t=il(this,t))&&t.execute()},sl.prototype.getResponse=function(){return al(this),this.b},sl.prototype.execute=function(){al(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))},sl.prototype.delete=function(){al(this),this.g=!0,clearTimeout(this.a),this.a=null,tn(this.f,"click",this.i)},Fr(ul,"FACTOR_ID","phone"),cl.prototype.g=function(){return me(rl=rl||new nl)},cl.prototype.c=function(){};var hl=null;function ll(){this.b=l.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var fl=new ft(vt,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),pl=new kr(3e4,6e4);ll.prototype.g=function(i){var o=this;return new le(function(t,e){var r=setTimeout(function(){e(new w("network-request-failed"))},pl.get());!l.grecaptcha||i!==o.f&&!o.b?(l[o.a]=function(){var n;l.grecaptcha?(o.f=i,n=l.grecaptcha.render,l.grecaptcha.render=function(t,e){return t=n(t,e),o.b++,t},clearTimeout(r),t(l.grecaptcha)):(clearTimeout(r),e(new w("internal-error"))),delete l[o.a]},me(Rs(bt(fl,{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))})},ll.prototype.c=function(){this.b--};var dl=null;function vl(t,e,n,r,i,o,s){if(Fr(this,"type","recaptcha"),this.c=this.f=null,this.D=!1,this.u=e,this.g=null,s=s?hl=hl||new cl:dl=dl||new ll,this.m=s,this.a=n||{theme:"light",type:"image"},this.h=[],this.a[ml])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[bl],!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(!Jt(e)||!this.i&&Jt(e).hasChildNodes())throw new w("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.s=new Us(t,o||null,i||null),this.w=r||function(){return null};var a=this;this.l=[];var u=this.a[yl];this.a[yl]=function(t){var e;_l(a,t),"function"==typeof u?u(t):"string"!=typeof u||"function"==typeof(e=gr(u,l))&&e(t)};var c=this.a[gl];this.a[gl]=function(){var t;_l(a,null),"function"==typeof c?c():"string"!=typeof c||"function"==typeof(t=gr(c,l))&&t()}}var yl="callback",gl="expired-callback",ml="sitekey",bl="size";function _l(t,e){for(var n=0;n<t.l.length;n++)try{t.l[n](e)}catch(t){}}function wl(t,e){return t.h.push(e),e.ma(function(){W(t.h,e)}),e}function El(t){if(t.D)throw new w("internal-error","RecaptchaVerifier instance has been destroyed.")}function Il(t,e,n){var r=!1;try{this.b=n||Bl.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=Bl.SDK_VERSION?vr(Bl.SDK_VERSION,o):null,vl.call(this,n,t,e,function(){try{var e=i.b.auth().ja()}catch(t){e=null}return e},o,N(I),r)}function Tl(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>=Sl.length)throw new w("internal-error","Argument validator received an unsupported number of arguments.");n=Sl[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=vl.prototype).Ga=function(){var e=this;return this.f?this.f:this.f=wl(this,me().then(function(){if(_r()&&!ur())return or();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,Wa(e.s,Ca,{})}).then(function(t){e.a[ml]=t.recaptchaSiteKey}).o(function(t){throw e.f=null,t}))},t.render=function(){El(this);var n=this;return wl(this,this.Ga().then(function(){var t,e;return null===n.c&&(e=n.u,n.i||(t=Jt(e),e=re("DIV"),t.appendChild(e)),n.c=n.g.render(e,n.a)),n.c}))},t.verify=function(){El(this);var i=this;return wl(this,this.render().then(function(e){return new le(function(n){var r,t=i.g.getResponse(e);t?n(t):(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(){El(this),null!==this.c&&this.g.reset(this.c)},t.clear=function(){El(this),this.D=!0,this.m.c();for(var t,e=0;e<this.h.length;e++)this.h[e].cancel("RecaptchaVerifier instance has been destroyed.");if(!this.i){e=Jt(this.u);for(;t=e.firstChild;)e.removeChild(t)}},_(Il,vl);var Sl="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function Cl(t,e){return{name:t||"",J:"a valid string",optional:!!e,K:function(t){return"string"==typeof t}}}function Nl(t,e){return{name:t||"",J:"a boolean",optional:!!e,K:function(t){return"boolean"==typeof t}}}function Al(t,e){return{name:t||"",J:"a valid object",optional:!!e,K:v}}function kl(t,e){return{name:t||"",J:"a function",optional:!!e,K:function(t){return"function"==typeof t}}}function Ol(t,e){return{name:t||"",J:"null",optional:!!e,K:function(t){return null===t}}}function Rl(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 Pl(){return{name:"multiFactorAssertion",J:"a valid multiFactorAssertion",optional:!1,K:function(t){return!!t&&!!t.ob}}}function Dl(){return{name:"authProvider",J:"a valid Auth provider",optional:!1,K:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}}function xl(t,e){return v(t)&&"string"==typeof t.type&&t.type===e&&"function"==typeof t.Fa}function Ll(t){return v(t)&&"string"==typeof t.uid}function Ml(){return{name:"applicationVerifier",J:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,K:function(t){return!(!t||"string"!=typeof t.type||"function"!=typeof t.verify)}}}function Fl(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 Ul(t,e){for(var n in e){var r=e[n].name;t[r]=ql(r,t[n],e[n].j)}}function jl(t,e){for(var n in e){var r=e[n].name;r!==n&&Object.defineProperty(t,r,{get:m(function(t){return this[t]},n),set:m(function(t,e,n,r){Tl(t,[n],[r],!0),this[e]=r},r,n,e[n].gb),enumerable:!0})}}function Vl(t,e,n,r){t[e]=ql(e,n,r)}function ql(t,e,n){function r(){var t=Array.prototype.slice.call(arguments);return Tl(o,n,t),e.apply(this,t)}if(!n)return e;var i,o=(t=(t=t).split("."))[t.length-1];for(i in e)r[i]=e[i];for(i in e.prototype)r.prototype[i]=e.prototype[i];return r}Ul(Wh.prototype,{fb:{name:"applyActionCode",j:[Cl("code")]},Pa:{name:"checkActionCode",j:[Cl("code")]},jb:{name:"confirmPasswordReset",j:[Cl("code"),Cl("newPassword")]},cc:{name:"createUserWithEmailAndPassword",j:[Cl("email"),Cl("password")]},fc:{name:"fetchSignInMethodsForEmail",j:[Cl("email")]},pa:{name:"getRedirectResult",j:[]},zc:{name:"isSignInWithEmailLink",j:[Cl("emailLink")]},Fc:{name:"onAuthStateChanged",j:[Fl(Al(),kl(),"nextOrObserver"),kl("opt_error",!0),kl("opt_completed",!0)]},Gc:{name:"onIdTokenChanged",j:[Fl(Al(),kl(),"nextOrObserver"),kl("opt_error",!0),kl("opt_completed",!0)]},rb:{name:"sendPasswordResetEmail",j:[Cl("email"),Fl(Al("opt_actionCodeSettings",!0),Ol(null,!0),"opt_actionCodeSettings",!0)]},sb:{name:"sendSignInLinkToEmail",j:[Cl("email"),Al("actionCodeSettings")]},tb:{name:"setPersistence",j:[Cl("persistence")]},Qc:{name:"signInAndRetrieveDataWithCredential",j:[Rl()]},vb:{name:"signInAnonymously",j:[]},Ya:{name:"signInWithCredential",j:[Rl()]},Rc:{name:"signInWithCustomToken",j:[Cl("token")]},Sc:{name:"signInWithEmailAndPassword",j:[Cl("email"),Cl("password")]},Tc:{name:"signInWithEmailLink",j:[Cl("email"),Cl("emailLink",!0)]},Uc:{name:"signInWithPhoneNumber",j:[Cl("phoneNumber"),Ml()]},Vc:{name:"signInWithPopup",j:[Dl()]},Wc:{name:"signInWithRedirect",j:[Dl()]},bd:{name:"updateCurrentUser",j:[Fl({name:"user",J:"an instance of Firebase User",optional:!1,K:function(t){return!!(t&&t instanceof ih)}},Ol(),"user")]},wb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[Cl(null,!0)]},dd:{name:"useDeviceLanguage",j:[]},fd:{name:"verifyPasswordResetCode",j:[Cl("code")]}}),jl(Wh.prototype,{lc:{name:"languageCode",gb:Fl(Cl(),Ol(),"languageCode")},ti:{name:"tenantId",gb:Fl(Cl(),Ol(),"tenantId")}}),(Wh.Persistence=Uu).LOCAL="local",Wh.Persistence.SESSION="session",Wh.Persistence.NONE="none",Ul(ih.prototype,{delete:{name:"delete",j:[]},mc:{name:"getIdTokenResult",j:[Nl("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[Nl("opt_forceRefresh",!0)]},Ac:{name:"linkAndRetrieveDataWithCredential",j:[Rl()]},mb:{name:"linkWithCredential",j:[Rl()]},Bc:{name:"linkWithPhoneNumber",j:[Cl("phoneNumber"),Ml()]},Cc:{name:"linkWithPopup",j:[Dl()]},Dc:{name:"linkWithRedirect",j:[Dl()]},Jc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[Rl()]},pb:{name:"reauthenticateWithCredential",j:[Rl()]},Kc:{name:"reauthenticateWithPhoneNumber",j:[Cl("phoneNumber"),Ml()]},Lc:{name:"reauthenticateWithPopup",j:[Dl()]},Mc:{name:"reauthenticateWithRedirect",j:[Dl()]},reload:{name:"reload",j:[]},qb:{name:"sendEmailVerification",j:[Fl(Al("opt_actionCodeSettings",!0),Ol(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[Cl(null,!0)]},ad:{name:"unlink",j:[Cl("provider")]},xb:{name:"updateEmail",j:[Cl("email")]},yb:{name:"updatePassword",j:[Cl("password")]},cd:{name:"updatePhoneNumber",j:[Rl("phone")]},zb:{name:"updateProfile",j:[Al("profile")]},Ab:{name:"verifyBeforeUpdateEmail",j:[Cl("email"),Fl(Al("opt_actionCodeSettings",!0),Ol(null,!0),"opt_actionCodeSettings",!0)]}}),Ul(nl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Ul(el.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Ul(le.prototype,{ma:{name:"finally"},o:{name:"catch"},then:{name:"then"}}),jl(Lc.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",gb:Nl("appVerificationDisabledForTesting")}}),Ul(Mc.prototype,{confirm:{name:"confirm",j:[Cl("verificationCode")]}}),Vl(Xi,"fromJSON",function(t){t="string"==typeof t?JSON.parse(t):t;for(var e,n=[ro,go,Eo,to],r=0;r<n.length;r++)if(e=n[r](t))return e;return null},[Fl(Cl(),Al(),"json")]),Vl(mo,"credential",function(t,e){return new yo(t,e)},[Cl("email"),Cl("password")]),Ul(yo.prototype,{v:{name:"toJSON",j:[Cl(null,!0)]}}),Ul(ao.prototype,{Aa:{name:"addScope",j:[Cl("scope")]},Ia:{name:"setCustomParameters",j:[Al("customOAuthParameters")]}}),Vl(ao,"credential",uo,[Fl(Cl(),Al(),"token")]),Vl(mo,"credentialWithLink",bo,[Cl("email"),Cl("emailLink")]),Ul(co.prototype,{Aa:{name:"addScope",j:[Cl("scope")]},Ia:{name:"setCustomParameters",j:[Al("customOAuthParameters")]}}),Vl(co,"credential",ho,[Fl(Cl(),Al(),"token")]),Ul(lo.prototype,{Aa:{name:"addScope",j:[Cl("scope")]},Ia:{name:"setCustomParameters",j:[Al("customOAuthParameters")]}}),Vl(lo,"credential",fo,[Fl(Cl(),Fl(Al(),Ol()),"idToken"),Fl(Cl(),Ol(),"accessToken",!0)]),Ul(po.prototype,{Ia:{name:"setCustomParameters",j:[Al("customOAuthParameters")]}}),Vl(po,"credential",vo,[Fl(Cl(),Al(),"token"),Cl("secret",!0)]),Ul(so.prototype,{Aa:{name:"addScope",j:[Cl("scope")]},credential:{name:"credential",j:[Fl(Cl(),Fl(Al(),Ol()),"optionsOrIdToken"),Fl(Cl(),Ol(),"accessToken",!0)]},Ia:{name:"setCustomParameters",j:[Al("customOAuthParameters")]}}),Ul(eo.prototype,{v:{name:"toJSON",j:[Cl(null,!0)]}}),Ul(Ji.prototype,{v:{name:"toJSON",j:[Cl(null,!0)]}}),Vl(To,"credential",So,[Cl("verificationId"),Cl("verificationCode")]),Ul(To.prototype,{cb:{name:"verifyPhoneNumber",j:[Fl(Cl(),{name:"phoneInfoOptions",J:"valid phone info options",optional:!1,K:function(t){return!!t&&(t.session&&t.phoneNumber?xl(t.session,Qi)&&"string"==typeof t.phoneNumber:t.session&&t.multiFactorHint?xl(t.session,Yi)&&Ll(t.multiFactorHint):t.session&&t.multiFactorUid?xl(t.session,Yi)&&"string"==typeof t.multiFactorUid:!!t.phoneNumber&&"string"==typeof t.phoneNumber)}},"phoneInfoOptions"),Ml()]}}),Ul(wo.prototype,{v:{name:"toJSON",j:[Cl(null,!0)]}}),Ul(w.prototype,{toJSON:{name:"toJSON",j:[Cl(null,!0)]}}),Ul(xo.prototype,{toJSON:{name:"toJSON",j:[Cl(null,!0)]}}),Ul(Do.prototype,{toJSON:{name:"toJSON",j:[Cl(null,!0)]}}),Ul(Bc.prototype,{toJSON:{name:"toJSON",j:[Cl(null,!0)]}}),Ul(jc.prototype,{Pc:{name:"resolveSignIn",j:[Pl()]}}),Ul(Qc.prototype,{Ob:{name:"getSession",j:[]},dc:{name:"enroll",j:[Pl(),Cl("displayName",!0)]},$c:{name:"unenroll",j:[Fl({name:"multiFactorInfo",J:"a valid multiFactorInfo",optional:!1,K:Ll},Cl(),"multiFactorInfoIdentifier")]}}),Ul(Il.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}),Vl(ui,"parseLink",yi,[Cl("link")]),Vl(ul,"assertion",function(t){return new Kc(t)},[Rl("phone")]),function(){if(void 0===Bl||!Bl.INTERNAL||!Bl.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:Xr,PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:Yr,VERIFY_AND_CHANGE_EMAIL:$r,VERIFY_EMAIL:"VERIFY_EMAIL"}},Auth:Wh,AuthCredential:Xi,Error:w};Vl(t,"EmailAuthProvider",mo,[]),Vl(t,"FacebookAuthProvider",ao,[]),Vl(t,"GithubAuthProvider",co,[]),Vl(t,"GoogleAuthProvider",lo,[]),Vl(t,"TwitterAuthProvider",po,[]),Vl(t,"OAuthProvider",so,[Cl("providerId")]),Vl(t,"SAMLAuthProvider",oo,[Cl("providerId")]),Vl(t,"PhoneAuthProvider",To,[{name:"auth",J:"an instance of Firebase Auth",optional:!0,K:function(t){return!!(t&&t instanceof Wh)}}]),Vl(t,"RecaptchaVerifier",Il,[Fl(Cl(),{name:"",J:"an HTML element",optional:!1,K:function(t){return!!(t&&t instanceof Element)}},"recaptchaContainer"),Al("recaptchaParameters",!0),{name:"app",J:"an instance of Firebase App",optional:!0,K:function(t){return!!(t&&t instanceof Bl.app.App)}}]),Vl(t,"ActionCodeURL",ui,[]),Vl(t,"PhoneMultiFactorGenerator",ul,[]),Bl.INTERNAL.registerComponent({name:"auth",instanceFactory:function(t){return new Wh(t=t.getProvider("app").getImmediate())},multipleInstances:!1,serviceProps:t,instantiationMode:"LAZY",type:"PUBLIC"}),Bl.INTERNAL.registerComponent({name:"auth-internal",instanceFactory:function(t){return{getUid:g((t=t.getProvider("auth").getImmediate()).getUid,t),getToken:g(t.kc,t),addAuthTokenListener:g(t.bc,t),removeAuthTokenListener:g(t.Nc,t)}},multipleInstances:!1,instantiationMode:"LAZY",type:"PRIVATE"}),Bl.registerVersion("@firebase/auth","0.14.9"),Bl.INTERNAL.extendNamespace({User:ih})}()}).apply("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Xs=($s.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),$o(e))},$s.prototype.get=function(t){t=this.domStorage_.getItem(this.prefixedName_(t));return null==t?null:Xo(t)},$s.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},$s.prototype.prefixedName_=function(t){return this.prefix_+t},$s.prototype.toString=function(){return this.domStorage_.toString()},$s);function $s(t){this.domStorage_=t,this.prefix_="firebase:"}var Js=(Zs.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},Zs.prototype.get=function(t){return Zo(this.cache_,t)?this.cache_[t]:null},Zs.prototype.remove=function(t){delete this.cache_[t]},Zs);function Zs(){this.cache_={},this.isInMemoryStorage=!0}function ta(t){var e=function(t){for(var e=[],n=0,r=0;r<t.length;r++){var i,o=t.charCodeAt(r);55296<=o&&o<=56319&&(i=o-55296,Ao(++r<t.length,"Surrogate pair missing trail surrogate."),o=65536+(i<<10)+(t.charCodeAt(r)-56320)),o<128?e[n++]=o:(o<2048?e[n++]=o>>6|192:(o<65536?e[n++]=o>>12|224:(e[n++]=o>>18|240,e[n++]=o>>12&63|128),e[n++]=o>>6&63|128),e[n++]=63&o|128)}return e}(t);return(t=new rs).update(e),t=t.digest(),Oo.encodeByteArray(t)}function ea(t,e){Ao(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(fa.logLevel=Ns.VERBOSE,va=fa.log.bind(fa),e&&la.set("logging_enabled",!0)):"function"==typeof t?va=t:(va=null,la.remove("logging_enabled"))}function na(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE INTERNAL ERROR: "+da.apply(void 0,Io(t));fa.error(n)}function ra(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE FATAL ERROR: "+da.apply(void 0,Io(t));throw fa.error(n),new Error(n)}function ia(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE WARNING: "+da.apply(void 0,Io(t));fa.warn(n)}function oa(t){return"number"==typeof t&&(t!=t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)}function sa(t,e){return t===e?0:t<e?-1:1}function aa(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+$o(e))}function ua(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 ca,Dr=function(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 Xs(e)}}catch(t){}return new Js},ha=Dr("localStorage"),la=Dr("sessionStorage"),fa=new Ds("@firebase/database"),pa=(ca=1,function(){return ca++}),da=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+=da.apply(null,i):n+="object"==typeof i?$o(i):i,n+=" "}return n},va=null,ya=!0,ga=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];!0===ya&&(ya=!1,null===va&&!0===la.get("logging_enabled")&&ea(!0)),va&&(t=da.apply(null,e),va(t))},ma=function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];ga.apply(void 0,Io([n],t))}},ba="[MIN_NAME]",_a="[MAX_NAME]",wa=function(t,e){if(t===e)return 0;if(t===ba||e===_a)return-1;if(e===ba||t===_a)return 1;var n=Aa(t),r=Aa(e);return null!==n?null!==r?n-r==0?t.length-e.length:n-r:-1:null===r&&t<e?-1:1},Ea=function(t){if("object"!=typeof t||null===t)return $o(t);var e,n=[];for(e in t)n.push(e);n.sort();for(var r="{",i=0;i<n.length;i++)0!==i&&(r+=","),r+=$o(n[i]),r+=":",r+=Ea(t[n[i]]);return r+="}"};function Ia(t,e){for(var n in t)t.hasOwnProperty(n)&&e(n,t[n])}function Ta(t){var e,n,r,i;Ao(!oa(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))));for(var o=[],s=52;s;--s)o.push(r%2?1:0),r=Math.floor(r/2);for(s=11;s;--s)o.push(n%2?1:0),n=Math.floor(n/2);o.push(e?1:0),o.reverse();var a=o.join(""),u="";for(s=0;s<64;s+=8){var c=parseInt(a.substr(s,8),2).toString(16);1===c.length&&(c="0"+c),u+=c}return u.toLowerCase()}function Sa(t){try{t()}catch(e){setTimeout(function(){var t=e.stack||"";throw ia("Exception was thrown by user callback.",t),e},Math.floor(0))}}function Ca(t,e){return"object"==typeof(e=setTimeout(t,e))&&e.unref&&e.unref(),e}var Na=new RegExp("^-?(0*)\\d{1,10}$"),Aa=function(t){if(Na.test(t)){t=Number(t);if(-2147483648<=t&&t<=2147483647)return t}return null},ka=(Object.defineProperty(Oa,"Empty",{get:function(){return new Oa("")},enumerable:!1,configurable:!0}),Oa.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},Oa.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},Oa.prototype.popFront=function(){var t=this.pieceNum_;return t<this.pieces_.length&&t++,new Oa(this.pieces_,t)},Oa.prototype.getBack=function(){return this.pieceNum_<this.pieces_.length?this.pieces_[this.pieces_.length-1]:null},Oa.prototype.toString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"},Oa.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||"/"},Oa.prototype.slice=function(t){return void 0===t&&(t=0),this.pieces_.slice(this.pieceNum_+t)},Oa.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 Oa(t,0)},Oa.prototype.child=function(t){for(var e=[],n=this.pieceNum_;n<this.pieces_.length;n++)e.push(this.pieces_[n]);if(t instanceof Oa)for(n=t.pieceNum_;n<t.pieces_.length;n++)e.push(t.pieces_[n]);else for(var r=t.split("/"),n=0;n<r.length;n++)0<r[n].length&&e.push(r[n]);return new Oa(e,0)},Oa.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},Oa.relativePath=function(t,e){var n=t.getFront(),r=e.getFront();if(null===n)return e;if(n===r)return Oa.relativePath(t.popFront(),e.popFront());throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")},Oa.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;i<n.length&&i<r.length;i++){var o=wa(n[i],r[i]);if(0!==o)return o}return n.length===r.length?0:n.length<r.length?-1:1},Oa.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},Oa.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},Oa);function Oa(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 Ra=(Object.defineProperty(Pa,"MAX_PATH_DEPTH",{get:function(){return 32},enumerable:!1,configurable:!0}),Object.defineProperty(Pa,"MAX_PATH_LENGTH_BYTES",{get:function(){return 768},enumerable:!1,configurable:!0}),Pa.prototype.push=function(t){0<this.parts_.length&&(this.byteLength_+=1),this.parts_.push(t),this.byteLength_+=ps(t),this.checkValid_()},Pa.prototype.pop=function(){var t=this.parts_.pop();this.byteLength_-=ps(t),0<this.parts_.length&&--this.byteLength_},Pa.prototype.checkValid_=function(){if(this.byteLength_>Pa.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+Pa.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>Pa.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Pa.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},Pa.prototype.toErrorString=function(){return 0===this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},Pa);function Pa(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_+=ps(this.parts_[n]);this.checkValid_()}var Da="firebaseio.com",xa="websocket",La="long_polling",Ma=(Fa.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()||this.includeNamespaceInQueryParams},Fa.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},Fa.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},Fa.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},Fa.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&ha.set("host:"+this.host,this.internalHost))},Fa.prototype.connectionURL=function(t,e){var n;if(Ao("string"==typeof t,"typeof type must == string"),Ao("object"==typeof e,"typeof params must == object"),t===xa)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(t!==La)throw new Error("Unknown connection type: "+t);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(e.ns=this.namespace);var r=[];return Ia(e,function(t,e){r.push(t+"="+e)}),n+r.join("&")},Fa.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},Fa.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},Fa);function Fa(t,e,n,r,i,o,s){void 0===i&&(i=!1),void 0===o&&(o=""),void 0===s&&(s=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=o,this.includeNamespaceInQueryParams=s,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=ha.get("host:"+t)||this.host}function Ua(t,e){var n=Xa(t),r=n.namespace;return"firebase.com"===n.domain&&ra(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),r&&"undefined"!==r||"localhost"===n.domain||ra("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&ia("Insecure Firebase access from a secure page. Please use https in calls to new Firebase()."),t="ws"===n.scheme||"wss"===n.scheme,{repoInfo:new Ma(n.host,n.secure,r,e,t,"",r!==n.subdomain),path:new ka(n.pathString)}}function ja(t){return"string"==typeof t&&0!==t.length&&!$a.test(t)}function Va(t){return"string"==typeof t&&0!==t.length&&!Ja.test(t)}function qa(t){return null===t||"string"==typeof t||"number"==typeof t&&!oa(t)||t&&"object"==typeof t&&Zo(t,".sv")}function Ba(t,e,n,r,i){i&&void 0===n||tu(hs(t,e,i),n,r)}function Wa(t,e,n,r,i){if(!i||void 0!==n){var o=hs(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=[];Ia(n,function(t,e){t=new ka(t);if(tu(o,e,r.child(t)),".priority"===t.getBack()&&!qa(e))throw new Error(o+"contains an invalid value for '"+t.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");s.push(t)}),function(t,e){for(var n,r=0;r<e.length;r++)for(var i=(n=e[r]).slice(),o=0;o<i.length;o++)if((".priority"!==i[o]||o!==i.length-1)&&!ja(i[o]))throw new Error(t+"contains an invalid key ("+i[o]+") in path "+n.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');e.sort(ka.comparePaths);var s=null;for(r=0;r<e.length;r++){if(n=e[r],null!==s&&s.contains(n))throw new Error(t+"contains a path "+s.toString()+" that is ancestor of another path "+n.toString());s=n}}(o,s)}}function Ha(t,e,n,r){if(!r||void 0!==n){if(oa(n))throw new Error(hs(t,e,r)+"is "+n.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!qa(n))throw new Error(hs(t,e,r)+"must be a valid Firebase priority (a string, finite number, server value, or null).")}}function Ga(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(hs(t,e,r)+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}}function Ka(t,e,n,r){if(!(r&&void 0===n||ja(n)))throw new Error(hs(t,e,r)+'was an invalid key = "'+n+'". Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')}function za(t,e,n,r){if(!(r&&void 0===n||Va(n)))throw new Error(hs(t,e,r)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')}function Qa(t,e){if(".info"===e.getFront())throw new Error(t+" failed = Can't modify data under /.info/")}function Ya(t,e,n){var r=n.path.toString();if("string"!=typeof n.repoInfo.host||0===n.repoInfo.host.length||!ja(n.repoInfo.namespace)&&"localhost"!==n.repoInfo.host.split(":")[0]||0!==r.length&&(r=(r=r)&&r.replace(/^\/*\.info(\/|$)/,"/"),!Va(r)))throw new Error(hs(t,e,!1)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')}var Xa=function(t){var e,n,r,i="",o="",s="",a="",u="",c=!0,h="https",l=443;return"string"==typeof t&&(0<=(r=t.indexOf("//"))&&(h=t.substring(0,r-1),t=t.substring(r+2)),-1===(e=t.indexOf("/"))&&(e=t.length),-1===(n=t.indexOf("?"))&&(n=t.length),i=t.substring(0,Math.min(e,n)),e<n&&(a=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(e,n))),n=function(t){var e,n,r={};"?"===t.charAt(0)&&(t=t.substring(1));try{for(var i=wo(t.split("&")),o=i.next();!o.done;o=i.next()){var s,a=o.value;0!==a.length&&(2===(s=a.split("=")).length?r[decodeURIComponent(s[0])]=decodeURIComponent(s[1]):ia("Invalid query segment '"+a+"' 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,n))),0<=(r=i.indexOf(":"))?(c="https"===h||"wss"===h,l=parseInt(i.substring(r+1),10)):r=i.length,"localhost"===(r=i.slice(0,r)).toLowerCase()?o="localhost":r.split(".").length<=2?o=r:(r=i.indexOf("."),s=i.substring(0,r).toLowerCase(),o=i.substring(r+1),u=s),"ns"in n&&(u=n.ns)),{host:i,port:l,domain:o,subdomain:s,secure:c,scheme:h,pathString:a,namespace:u}},$a=/[\[\].#$\/\u0000-\u001F\u007F]/,Ja=/[\[\].#$\u0000-\u001F\u007F]/,Za=10485760,tu=function(n,t,e){var r=e instanceof ka?new Ra(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(oa(t))throw new Error(n+"contains "+t.toString()+" "+r.toErrorString());if("string"==typeof t&&t.length>Za/3&&ps(t)>Za)throw new Error(n+"contains a string greater than "+Za+" utf8 bytes "+r.toErrorString()+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){var i=!1,o=!1;if(Ia(t,function(t,e){if(".value"===t)i=!0;else if(".priority"!==t&&".sv"!==t&&(o=!0,!ja(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),tu(n,e,r),r.pop()}),i&&o)throw new Error(n+' contains ".value" child '+r.toErrorString()+" in addition to actual children.")}},eu=(nu.prototype.cancel=function(t){cs("OnDisconnect.cancel",0,1,arguments.length),ls("OnDisconnect.cancel",1,t,!0);var e=new Do;return this.repo_.onDisconnectCancel(this.path_,e.wrapCallback(t)),e.promise},nu.prototype.remove=function(t){cs("OnDisconnect.remove",0,1,arguments.length),Qa("OnDisconnect.remove",this.path_),ls("OnDisconnect.remove",1,t,!0);var e=new Do;return this.repo_.onDisconnectSet(this.path_,null,e.wrapCallback(t)),e.promise},nu.prototype.set=function(t,e){cs("OnDisconnect.set",1,2,arguments.length),Qa("OnDisconnect.set",this.path_),Ba("OnDisconnect.set",1,t,this.path_,!1),ls("OnDisconnect.set",2,e,!0);var n=new Do;return this.repo_.onDisconnectSet(this.path_,t,n.wrapCallback(e)),n.promise},nu.prototype.setWithPriority=function(t,e,n){cs("OnDisconnect.setWithPriority",2,3,arguments.length),Qa("OnDisconnect.setWithPriority",this.path_),Ba("OnDisconnect.setWithPriority",1,t,this.path_,!1),Ha("OnDisconnect.setWithPriority",2,e,!1),ls("OnDisconnect.setWithPriority",3,n,!0);var r=new Do;return this.repo_.onDisconnectSetWithPriority(this.path_,t,e,r.wrapCallback(n)),r.promise},nu.prototype.update=function(t,e){if(cs("OnDisconnect.update",1,2,arguments.length),Qa("OnDisconnect.update",this.path_),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,ia("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.")}Wa("OnDisconnect.update",1,t,this.path_,!1),ls("OnDisconnect.update",2,e,!0);var i=new Do;return this.repo_.onDisconnectUpdate(this.path_,t,i.wrapCallback(e)),i.promise},nu);function nu(t,e){this.repo_=t,this.path_=e}var ru=(iu.prototype.toJSON=function(){return cs("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},iu);function iu(t,e){this.committed=t,this.snapshot=e}var ou,su,au,uu=(ou="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",su=0,au=[],function(t){var e=t===su;su=t;for(var n=new Array(8),r=7;0<=r;r--)n[r]=ou.charAt(t%64),t=Math.floor(t/64);Ao(0===t,"Cannot push at time == 0");var i=n.join("");if(e){for(r=11;0<=r&&63===au[r];r--)au[r]=0;au[r]++}else for(r=0;r<12;r++)au[r]=Math.floor(64*Math.random());for(r=0;r<12;r++)i+=ou.charAt(au[r]);return Ao(20===i.length,"nextPushId: Length should be 20."),i}),cu=(hu.Wrap=function(t,e){return new hu(t,e)},hu);function hu(t,e){this.name=t,this.node=e}var lu,K=(fu.prototype.getCompare=function(){return this.compare.bind(this)},fu.prototype.indexedValueChanged=function(t,e){t=new cu(ba,t),e=new cu(ba,e);return 0!==this.compare(t,e)},fu.prototype.minPost=function(){return cu.MIN},fu);function fu(){}var pu,du=(go(vu,pu=K),Object.defineProperty(vu,"__EMPTY_NODE",{get:function(){return lu},set:function(t){lu=t},enumerable:!1,configurable:!0}),vu.prototype.compare=function(t,e){return wa(t.name,e.name)},vu.prototype.isDefinedOn=function(t){throw ko("KeyIndex.isDefinedOn not expected to be called.")},vu.prototype.indexedValueChanged=function(t,e){return!1},vu.prototype.minPost=function(){return cu.MIN},vu.prototype.maxPost=function(){return new cu(_a,lu)},vu.prototype.makePost=function(t,e){return Ao("string"==typeof t,"KeyIndex indexValue must always be a string."),new cu(t,lu)},vu.prototype.toString=function(){return".key"},vu);function vu(){return null!==pu&&pu.apply(this,arguments)||this}var yu,gu=new du;function mu(t){return"number"==typeof t?"number:"+Ta(t):"string:"+t}var bu,_u,wu,Eu,Iu=function(t){var e;t.isLeafNode()?(e=t.val(),Ao("string"==typeof e||"number"==typeof e||"object"==typeof e&&Zo(e,".sv"),"Priority must be a string or number.")):Ao(t===yu||t.isEmpty(),"priority of unexpected type."),Ao(t===yu||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},Tu=(Object.defineProperty(Su,"__childrenNodeConstructor",{get:function(){return bu},set:function(t){bu=t},enumerable:!1,configurable:!0}),Su.prototype.isLeafNode=function(){return!0},Su.prototype.getPriority=function(){return this.priorityNode_},Su.prototype.updatePriority=function(t){return new Su(this.value_,t)},Su.prototype.getImmediateChild=function(t){return".priority"===t?this.priorityNode_:Su.__childrenNodeConstructor.EMPTY_NODE},Su.prototype.getChild=function(t){return t.isEmpty()?this:".priority"===t.getFront()?this.priorityNode_:Su.__childrenNodeConstructor.EMPTY_NODE},Su.prototype.hasChild=function(){return!1},Su.prototype.getPredecessorChildName=function(t,e){return null},Su.prototype.updateImmediateChild=function(t,e){return".priority"===t?this.updatePriority(e):e.isEmpty()&&".priority"!==t?this:Su.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,e).updatePriority(this.priorityNode_)},Su.prototype.updateChild=function(t,e){var n=t.getFront();return null===n?e:e.isEmpty()&&".priority"!==n?this:(Ao(".priority"!==n||1===t.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(n,Su.__childrenNodeConstructor.EMPTY_NODE.updateChild(t.popFront(),e)))},Su.prototype.isEmpty=function(){return!1},Su.prototype.numChildren=function(){return 0},Su.prototype.forEachChild=function(t,e){return!1},Su.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},Su.prototype.hash=function(){var t,e;return null===this.lazyHash_&&(t="",this.priorityNode_.isEmpty()||(t+="priority:"+mu(this.priorityNode_.val())+":"),t+=(e=typeof this.value_)+":",t+="number"==e?Ta(this.value_):this.value_,this.lazyHash_=ta(t)),this.lazyHash_},Su.prototype.getValue=function(){return this.value_},Su.prototype.compareTo=function(t){return t===Su.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof Su.__childrenNodeConstructor?-1:(Ao(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))},Su.prototype.compareToLeafNode_=function(t){var e=typeof t.value_,n=typeof this.value_,r=Su.VALUE_TYPE_ORDER.indexOf(e),i=Su.VALUE_TYPE_ORDER.indexOf(n);return Ao(0<=r,"Unknown leaf type: "+e),Ao(0<=i,"Unknown leaf type: "+n),r===i?"object"==n?0:this.value_<t.value_?-1:this.value_===t.value_?0:1:i-r},Su.prototype.withIndex=function(){return this},Su.prototype.isIndexed=function(){return!0},Su.prototype.equals=function(t){return t===this||!!t.isLeafNode()&&(this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_))},Su.VALUE_TYPE_ORDER=["object","boolean","number","string"],Su);function Su(t,e){void 0===e&&(e=Su.__childrenNodeConstructor.EMPTY_NODE),this.value_=t,this.priorityNode_=e,this.lazyHash_=null,Ao(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),Iu(this.priorityNode_)}function Cu(){return null!==Eu&&Eu.apply(this,arguments)||this}var Nu=new(go(Cu,Eu=K),Cu.prototype.compare=function(t,e){var n=t.node.getPriority(),r=e.node.getPriority(),r=n.compareTo(r);return 0===r?wa(t.name,e.name):r},Cu.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},Cu.prototype.indexedValueChanged=function(t,e){return!t.getPriority().equals(e.getPriority())},Cu.prototype.minPost=function(){return cu.MIN},Cu.prototype.maxPost=function(){return new cu(_a,new Tu("[PRIORITY-POST]",wu))},Cu.prototype.makePost=function(t,e){t=_u(t);return new cu(e,new Tu("[PRIORITY-POST]",t))},Cu.prototype.toString=function(){return".priority"},Cu),Au=(ku.prototype.getNext=function(){if(0===this.nodeStack_.length)return null;var t=this.nodeStack_.pop(),e=this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value};if(this.isReverse_)for(t=t.left;!t.isEmpty();)this.nodeStack_.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack_.push(t),t=t.left;return e},ku.prototype.hasNext=function(){return 0<this.nodeStack_.length},ku.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}},ku);function ku(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(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 Ou=(Ru.prototype.copy=function(t,e,n,r,i){return new Ru(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)},Ru.prototype.count=function(){return this.left.count()+1+this.right.count()},Ru.prototype.isEmpty=function(){return!1},Ru.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)},Ru.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},Ru.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},Ru.prototype.minKey=function(){return this.min_().key},Ru.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},Ru.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_()},Ru.prototype.removeMin_=function(){if(this.left.isEmpty())return Du.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_()},Ru.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r.left.isEmpty()||r.left.isRed_()||r.left.left.isRed_()||(r=r.moveRedLeft_()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed_()&&(r=r.rotateRight_()),r.right.isEmpty()||r.right.isRed_()||r.right.left.isRed_()||(r=r.moveRedRight_()),0===e(t,r.key)){if(r.right.isEmpty())return Du.EMPTY_NODE;n=r.right.min_(),r=r.copy(n.key,n.value,null,null,r.right.removeMin_())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp_()},Ru.prototype.isRed_=function(){return this.color},Ru.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},Ru.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},Ru.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t.left.left.isRed_()&&(t=(t=t.rotateRight_()).colorFlip_()),t},Ru.prototype.rotateLeft_=function(){var t=this.copy(null,null,Ru.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},Ru.prototype.rotateRight_=function(){var t=this.copy(null,null,Ru.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},Ru.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)},Ru.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)<=this.count()+1},Ru.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)},Ru.RED=!0,Ru.BLACK=!1,Ru);function Ru(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:Ru.RED,this.left=null!=r?r:Du.EMPTY_NODE,this.right=null!=i?i:Du.EMPTY_NODE}Pu.prototype.copy=function(t,e,n,r,i){return this},Pu.prototype.insert=function(t,e,n){return new Ou(t,e,null)},Pu.prototype.remove=function(t,e){return this},Pu.prototype.count=function(){return 0},Pu.prototype.isEmpty=function(){return!0},Pu.prototype.inorderTraversal=function(t){return!1},Pu.prototype.reverseTraversal=function(t){return!1},Pu.prototype.minKey=function(){return null},Pu.prototype.maxKey=function(){return null},Pu.prototype.check_=function(){return 0},Pu.prototype.isRed_=function(){return!1},M=Pu;function Pu(){}var Du=(xu.prototype.insert=function(t,e){return new xu(this.comparator_,this.root_.insert(t,e,this.comparator_).copy(null,null,Ou.BLACK,null,null))},xu.prototype.remove=function(t){return new xu(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,Ou.BLACK,null,null))},xu.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},xu.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?")},xu.prototype.isEmpty=function(){return this.root_.isEmpty()},xu.prototype.count=function(){return this.root_.count()},xu.prototype.minKey=function(){return this.root_.minKey()},xu.prototype.maxKey=function(){return this.root_.maxKey()},xu.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},xu.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},xu.prototype.getIterator=function(t){return new Au(this.root_,null,this.comparator_,!1,t)},xu.prototype.getIteratorFrom=function(t,e){return new Au(this.root_,t,this.comparator_,!1,e)},xu.prototype.getReverseIteratorFrom=function(t,e){return new Au(this.root_,t,this.comparator_,!0,e)},xu.prototype.getReverseIterator=function(t){return new Au(this.root_,null,this.comparator_,!0,t)},xu.EMPTY_NODE=new M,xu);function xu(t,e){void 0===e&&(e=xu.EMPTY_NODE),this.comparator_=t,this.root_=e}var Lu=Math.log(2),Mu=(Fu.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<<this.current_);return this.current_--,t},Fu);function Fu(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/Lu,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 Uu,ju,Vu=function(c,t,h,e){c.sort(t);var l=function(t,e){var n=e-t;if(0==n)return null;if(1==n)return r=c[t],i=h?h(r):r,new Ou(i,r.node,Ou.BLACK,null,null);var n=parseInt(n/2,10)+t,t=l(t,n),e=l(n+1,e),r=c[n],i=h?h(r):r;return new Ou(i,r.node,Ou.BLACK,t,e)},n=function(t){for(var e=null,n=null,i=c.length,r=function(t,e){var n=i-t,r=i;i-=t;t=l(1+n,r),r=c[n],n=h?h(r):r;o(new Ou(n,r.node,e,null,t))},o=function(t){e=e?e.left=t:n=t},s=0;s<t.count;++s){var a=t.nextBitIsOne(),u=Math.pow(2,t.count-(s+1));a?r(u,Ou.BLACK):(r(u,Ou.BLACK),r(u,Ou.RED))}return n}(new Mu(c.length));return new Du(e||t,n)},qu={},Bu=(Object.defineProperty(Wu,"Default",{get:function(){return Ao(Nu,"ChildrenNode.ts has not been loaded"),Uu=Uu||new Wu({".priority":qu},{".priority":Nu})},enumerable:!1,configurable:!0}),Wu.prototype.get=function(t){var e=ts(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e instanceof Du?e:null},Wu.prototype.hasIndex=function(t){return Zo(this.indexSet_,t.toString())},Wu.prototype.addIndex=function(t,e){Ao(t!==gu,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var n,r=[],i=!1,o=e.getIterator(cu.Wrap),s=o.getNext();s;)i=i||t.isDefinedOn(s.node),r.push(s),s=o.getNext();n=i?Vu(r,t.getCompare()):qu;var a=t.toString(),u=mo({},this.indexSet_);u[a]=t;e=mo({},this.indexes_);return e[a]=n,new Wu(e,u)},Wu.prototype.addToIndexes=function(s,a){var u=this;return new Wu(ns(this.indexes_,function(t,e){var n=ts(u.indexSet_,e);if(Ao(n,"Missing index implementation for "+e),t===qu){if(n.isDefinedOn(s.node)){for(var r=[],i=a.getIterator(cu.Wrap),o=i.getNext();o;)o.name!==s.name&&r.push(o),o=i.getNext();return r.push(s),Vu(r,n.getCompare())}return qu}n=a.get(s.name);return n&&(t=t.remove(new cu(s.name,n))),t.insert(s,s.node)}),this.indexSet_)},Wu.prototype.removeFromIndexes=function(n,r){return new Wu(ns(this.indexes_,function(t){if(t===qu)return t;var e=r.get(n.name);return e?t.remove(new cu(n.name,e)):t}),this.indexSet_)},Wu);function Wu(t,e){this.indexes_=t,this.indexSet_=e}function Hu(t,e){return wa(t.name,e.name)}function Gu(t,e){return wa(t,e)}var Ku,zu=(Object.defineProperty(Qu,"EMPTY_NODE",{get:function(){return ju=ju||new Qu(new Du(Gu),null,Bu.Default)},enumerable:!1,configurable:!0}),Qu.prototype.isLeafNode=function(){return!1},Qu.prototype.getPriority=function(){return this.priorityNode_||ju},Qu.prototype.updatePriority=function(t){return this.children_.isEmpty()?this:new Qu(this.children_,t,this.indexMap_)},Qu.prototype.getImmediateChild=function(t){if(".priority"===t)return this.getPriority();t=this.children_.get(t);return null===t?ju:t},Qu.prototype.getChild=function(t){var e=t.getFront();return null===e?this:this.getImmediateChild(e).getChild(t.popFront())},Qu.prototype.hasChild=function(t){return null!==this.children_.get(t)},Qu.prototype.updateImmediateChild=function(t,e){if(Ao(e,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(e);var n=new cu(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_)),n=r.isEmpty()?ju:this.priorityNode_;return new Qu(r,n,i)},Qu.prototype.updateChild=function(t,e){var n=t.getFront();if(null===n)return e;Ao(".priority"!==t.getFront()||1===t.getLength(),".priority must be the last token in a path");e=this.getImmediateChild(n).updateChild(t.popFront(),e);return this.updateImmediateChild(n,e)},Qu.prototype.isEmpty=function(){return this.children_.isEmpty()},Qu.prototype.numChildren=function(){return this.children_.count()},Qu.prototype.val=function(n){if(this.isEmpty())return null;var r={},i=0,o=0,s=!0;if(this.forEachChild(Nu,function(t,e){r[t]=e.val(n),i++,s&&Qu.INTEGER_REGEXP_.test(t)?o=Math.max(o,Number(t)):s=!1}),!n&&s&&o<2*i){var t,e=[];for(t in r)e[t]=r[t];return e}return n&&!this.getPriority().isEmpty()&&(r[".priority"]=this.getPriority().val()),r},Qu.prototype.hash=function(){var n;return null===this.lazyHash_&&(n="",this.getPriority().isEmpty()||(n+="priority:"+mu(this.getPriority().val())+":"),this.forEachChild(Nu,function(t,e){e=e.hash();""!==e&&(n+=":"+t+":"+e)}),this.lazyHash_=""===n?"":ta(n)),this.lazyHash_},Qu.prototype.getPredecessorChildName=function(t,e,n){n=this.resolveIndex_(n);if(n){e=n.getPredecessorKey(new cu(t,e));return e?e.name:null}return this.children_.getPredecessorKey(t)},Qu.prototype.getFirstChildName=function(t){t=this.resolveIndex_(t);if(t){t=t.minKey();return t&&t.name}return this.children_.minKey()},Qu.prototype.getFirstChild=function(t){t=this.getFirstChildName(t);return t?new cu(t,this.children_.get(t)):null},Qu.prototype.getLastChildName=function(t){t=this.resolveIndex_(t);if(t){t=t.maxKey();return t&&t.name}return this.children_.maxKey()},Qu.prototype.getLastChild=function(t){t=this.getLastChildName(t);return t?new cu(t,this.children_.get(t)):null},Qu.prototype.forEachChild=function(t,e){t=this.resolveIndex_(t);return t?t.inorderTraversal(function(t){return e(t.name,t.node)}):this.children_.inorderTraversal(e)},Qu.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},Qu.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,cu.Wrap),i=r.peek();null!=i&&e.compare(i,t)<0;)r.getNext(),i=r.peek();return r},Qu.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},Qu.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,cu.Wrap),i=r.peek();null!=i&&0<e.compare(i,t);)r.getNext(),i=r.peek();return r},Qu.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===Xu?-1:0},Qu.prototype.withIndex=function(t){if(t===gu||this.indexMap_.hasIndex(t))return this;t=this.indexMap_.addIndex(t,this.children_);return new Qu(this.children_,this.priorityNode_,t)},Qu.prototype.isIndexed=function(t){return t===gu||this.indexMap_.hasIndex(t)},Qu.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode())return!1;if(this.getPriority().equals(t.getPriority())){if(this.children_.count()!==t.children_.count())return!1;for(var e=this.getIterator(Nu),n=t.getIterator(Nu),r=e.getNext(),i=n.getNext();r&&i;){if(r.name!==i.name||!r.node.equals(i.node))return!1;r=e.getNext(),i=n.getNext()}return null===r&&null===i}return!1},Qu.prototype.resolveIndex_=function(t){return t===gu?null:this.indexMap_.get(t.toString())},Qu.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,Qu);function Qu(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&Iu(this.priorityNode_),this.children_.isEmpty()&&Ao(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}function Yu(){return Ku.call(this,new Du(Gu),zu.EMPTY_NODE,Bu.Default)||this}var Xu=new(go(Yu,Ku=zu),Yu.prototype.compareTo=function(t){return t===this?0:1},Yu.prototype.equals=function(t){return t===this},Yu.prototype.getPriority=function(){return this},Yu.prototype.getImmediateChild=function(t){return zu.EMPTY_NODE},Yu.prototype.isEmpty=function(){return!1},Yu);Object.defineProperties(cu,{MIN:{value:new cu(ba,zu.EMPTY_NODE)},MAX:{value:new cu(_a,Xu)}}),du.__EMPTY_NODE=zu.EMPTY_NODE,Tu.__childrenNodeConstructor=zu,yu=Xu,wu=Xu;var $u,Ju=!0;function Zu(n,t){if(void 0===t&&(t=null),null===n)return zu.EMPTY_NODE;if("object"==typeof n&&".priority"in n&&(t=n[".priority"]),Ao(null===t||"string"==typeof t||"number"==typeof t||"object"==typeof t&&".sv"in t,"Invalid priority type found: "+typeof t),"object"==typeof n&&".value"in n&&null!==n[".value"]&&(n=n[".value"]),"object"!=typeof n||".sv"in n)return new Tu(n,Zu(t));if(n instanceof Array||!Ju){var r=zu.EMPTY_NODE;return Ia(n,function(t,e){Zo(n,t)&&"."!==t.substring(0,1)&&(!(e=Zu(e)).isLeafNode()&&e.isEmpty()||(r=r.updateImmediateChild(t,e)))}),r.updatePriority(Zu(t))}var i=[],o=!1;if(Ia(n,function(t,e){"."!==t.substring(0,1)&&((e=Zu(e)).isEmpty()||(o=o||!e.getPriority().isEmpty(),i.push(new cu(t,e))))}),0===i.length)return zu.EMPTY_NODE;var e=Vu(i,Hu,function(t){return t.name},Gu);if(o){var s=Vu(i,Nu.getCompare());return new zu(e,Zu(t),new Bu({".priority":s},{".priority":Nu}))}return new zu(e,Zu(t),Bu.Default)}function tc(){return null!==$u&&$u.apply(this,arguments)||this}_u=Zu;var ec,nc=new(go(tc,$u=K),tc.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?wa(t.name,e.name):n},tc.prototype.isDefinedOn=function(t){return!0},tc.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},tc.prototype.minPost=function(){return cu.MIN},tc.prototype.maxPost=function(){return cu.MAX},tc.prototype.makePost=function(t,e){t=Zu(t);return new cu(e,t)},tc.prototype.toString=function(){return".value"},tc),rc=(go(ic,ec=K),ic.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},ic.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},ic.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),r=n.compareTo(r);return 0===r?wa(t.name,e.name):r},ic.prototype.makePost=function(t,e){t=Zu(t),t=zu.EMPTY_NODE.updateChild(this.indexPath_,t);return new cu(e,t)},ic.prototype.maxPost=function(){var t=zu.EMPTY_NODE.updateChild(this.indexPath_,Xu);return new cu(_a,t)},ic.prototype.toString=function(){return this.indexPath_.slice().join("/")},ic);function ic(t){var e=ec.call(this)||this;return e.indexPath_=t,Ao(!t.isEmpty()&&".priority"!==t.getFront(),"Can't create PathIndex with empty path or .priority key"),e}var oc=(sc.prototype.val=function(){return cs("DataSnapshot.val",0,0,arguments.length),this.node_.val()},sc.prototype.exportVal=function(){return cs("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},sc.prototype.toJSON=function(){return cs("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},sc.prototype.exists=function(){return cs("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},sc.prototype.child=function(t){cs("DataSnapshot.child",0,1,arguments.length),t=String(t),za("DataSnapshot.child",1,t,!1);var e=new ka(t),t=this.ref_.child(e);return new sc(this.node_.getChild(e),t,Nu)},sc.prototype.hasChild=function(t){cs("DataSnapshot.hasChild",1,1,arguments.length),za("DataSnapshot.hasChild",1,t,!1);t=new ka(t);return!this.node_.getChild(t).isEmpty()},sc.prototype.getPriority=function(){return cs("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},sc.prototype.forEach=function(n){var r=this;return cs("DataSnapshot.forEach",1,1,arguments.length),ls("DataSnapshot.forEach",1,n,!1),!this.node_.isLeafNode()&&!!this.node_.forEachChild(this.index_,function(t,e){return n(new sc(e,r.ref_.child(t),Nu))})},sc.prototype.hasChildren=function(){return cs("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()},Object.defineProperty(sc.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!1,configurable:!0}),sc.prototype.numChildren=function(){return cs("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},sc.prototype.getRef=function(){return cs("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(sc.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),sc);function sc(t,e,n){this.node_=t,this.ref_=e,this.index_=n}var ac=(uc.prototype.getPath=function(){var t=this.snapshot.getRef();return("value"===this.eventType?t:t.getParent()).path},uc.prototype.getEventType=function(){return this.eventType},uc.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},uc.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+$o(this.snapshot.exportVal())},uc);function uc(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}var cc=(hc.prototype.getPath=function(){return this.path},hc.prototype.getEventType=function(){return"cancel"},hc.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},hc.prototype.toString=function(){return this.path.toString()+":cancel"},hc);function hc(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}var lc=(fc.prototype.respondsTo=function(t){return"value"===t},fc.prototype.createEvent=function(t,e){var n=e.getQueryParams().getIndex();return new ac("value",this,new oc(t.snapshotNode,e.getRef(),n))},fc.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){Ao(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)}},fc.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new cc(this,t,e):null},fc.prototype.matches=function(t){return t instanceof fc&&(!t.callback_||!this.callback_||t.callback_===this.callback_&&t.context_===this.context_)},fc.prototype.hasAnyCallback=function(){return null!==this.callback_},fc);function fc(t,e,n){this.callback_=t,this.cancelCallback_=e,this.context_=n}var pc,dc=(vc.prototype.respondsTo=function(t){t="children_removed"===(t="children_added"===t?"child_added":t)?"child_removed":t;return Zo(this.callbacks_,t)},vc.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new cc(this,t,e):null},vc.prototype.createEvent=function(t,e){Ao(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),e=e.getQueryParams().getIndex();return new ac(t.type,this,new oc(t.snapshotNode,n,e),t.prevName)},vc.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){Ao(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)}},vc.prototype.matches=function(e){var n=this;if(e instanceof vc){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]});t=t[0],r=r[0];return!(r!==t||e.callbacks_[t]&&this.callbacks_[r]&&e.callbacks_[t]!==this.callbacks_[r])}}}return!1},vc.prototype.hasAnyCallback=function(){return null!==this.callbacks_},vc);function vc(t,e,n){this.callbacks_=t,this.cancelCallback_=e,this.context_=n}var yc=(Object.defineProperty(gc,"__referenceConstructor",{get:function(){return Ao(pc,"Reference.ts has not been loaded"),pc},set:function(t){pc=t},enumerable:!1,configurable:!0}),gc.validateQueryEndpoints_=function(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===gu){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()!==ba)throw new Error(r);if("string"!=typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!==_a)throw new Error(r);if("string"!=typeof n)throw new Error(i)}}else if(t.getIndex()===Nu){if(null!=e&&!qa(e)||null!=n&&!qa(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(Ao(t.getIndex()instanceof rc||t.getIndex()===nc,"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.")},gc.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.")},gc.prototype.validateNoPreviousOrderByCall_=function(t){if(!0===this.orderByCalled_)throw new Error(t+": You can't combine multiple orderBy calls.")},gc.prototype.getQueryParams=function(){return this.queryParams_},gc.prototype.getRef=function(){return cs("Query.ref",0,0,arguments.length),new gc.__referenceConstructor(this.repo,this.path)},gc.prototype.on=function(t,e,n,r){cs("Query.on",2,4,arguments.length),Ga("Query.on",1,t,!1),ls("Query.on",2,e,!1);n=gc.getCancelAndContextArgs_("Query.on",n,r);return"value"===t?this.onValueEvent(e,n.cancel,n.context):((r={})[t]=e,this.onChildEvent(r,n.cancel,n.context)),e},gc.prototype.onValueEvent=function(t,e,n){n=new lc(t,e||null,n||null);this.repo.addEventCallbackForQuery(this,n)},gc.prototype.onChildEvent=function(t,e,n){n=new dc(t,e,n);this.repo.addEventCallbackForQuery(this,n)},gc.prototype.off=function(t,e,n){cs("Query.off",0,3,arguments.length),Ga("Query.off",1,t,!0),ls("Query.off",2,e,!0),fs("Query.off",3,n,!0);var r=null,i=null;"value"===t?r=new lc(e||null,null,n||null):t&&(e&&((i={})[t]=e),r=new dc(i,null,n||null)),this.repo.removeEventCallbackForQuery(this,r)},gc.prototype.once=function(e,n,t,r){var i=this;cs("Query.once",1,4,arguments.length),Ga("Query.once",1,e,!1),ls("Query.once",2,n,!0);var o=gc.getCancelAndContextArgs_("Query.once",t,r),s=!0,a=new Do;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},gc.prototype.limitToFirst=function(t){if(cs("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 gc(this.repo,this.path,this.queryParams_.limitToFirst(t),this.orderByCalled_)},gc.prototype.limitToLast=function(t){if(cs("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 gc(this.repo,this.path,this.queryParams_.limitToLast(t),this.orderByCalled_)},gc.prototype.orderByChild=function(t){if(cs("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.');za("Query.orderByChild",1,t,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");t=new ka(t);if(t.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");t=new rc(t),t=this.queryParams_.orderBy(t);return gc.validateQueryEndpoints_(t),new gc(this.repo,this.path,t,!0)},gc.prototype.orderByKey=function(){cs("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var t=this.queryParams_.orderBy(gu);return gc.validateQueryEndpoints_(t),new gc(this.repo,this.path,t,!0)},gc.prototype.orderByPriority=function(){cs("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var t=this.queryParams_.orderBy(Nu);return gc.validateQueryEndpoints_(t),new gc(this.repo,this.path,t,!0)},gc.prototype.orderByValue=function(){cs("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var t=this.queryParams_.orderBy(nc);return gc.validateQueryEndpoints_(t),new gc(this.repo,this.path,t,!0)},gc.prototype.startAt=function(t,e){void 0===t&&(t=null),cs("Query.startAt",0,2,arguments.length),Ba("Query.startAt",1,t,this.path,!0),Ka("Query.startAt",2,e,!0);var n=this.queryParams_.startAt(t,e);if(gc.validateLimit_(n),gc.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 gc(this.repo,this.path,n,this.orderByCalled_)},gc.prototype.endAt=function(t,e){void 0===t&&(t=null),cs("Query.endAt",0,2,arguments.length),Ba("Query.endAt",1,t,this.path,!0),Ka("Query.endAt",2,e,!0);e=this.queryParams_.endAt(t,e);if(gc.validateLimit_(e),gc.validateQueryEndpoints_(e),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new gc(this.repo,this.path,e,this.orderByCalled_)},gc.prototype.equalTo=function(t,e){if(cs("Query.equalTo",1,2,arguments.length),Ba("Query.equalTo",1,t,this.path,!1),Ka("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)},gc.prototype.toString=function(){return cs("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},gc.prototype.toJSON=function(){return cs("Query.toJSON",0,1,arguments.length),this.toString()},gc.prototype.queryObject=function(){return this.queryParams_.getQueryObject()},gc.prototype.queryIdentifier=function(){var t=this.queryObject(),t=Ea(t);return"{}"===t?"default":t},gc.prototype.isEqual=function(t){if(cs("Query.isEqual",1,1,arguments.length),!(t instanceof gc)){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),t=this.queryIdentifier()===t.queryIdentifier();return e&&n&&t},gc.getCancelAndContextArgs_=function(t,e,n){var r={cancel:null,context:null};if(e&&n)r.cancel=e,ls(t,3,r.cancel,!0),r.context=n,fs(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(hs(t,3,!0)+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(gc.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),gc);function gc(t,e,n,r){this.repo=t,this.path=e,this.queryParams_=n,this.orderByCalled_=r}var mc=(bc.prototype.getImmediateChild=function(t){return new bc(this.node_.getImmediateChild(t))},bc.prototype.node=function(){return this.node_},bc);function bc(t){this.node_=t}var _c=(wc.prototype.getImmediateChild=function(t){t=this.path_.child(t);return new wc(this.syncTree_,t)},wc.prototype.node=function(){return this.syncTree_.calcCompleteEventCache(this.path_)},wc);function wc(t,e){this.syncTree_=t,this.path_=e}function Ec(t,e,n,r){return Nc(e,new _c(n,t),r)}function Ic(t,e,n){return Nc(t,new mc(e),n)}var Tc=function(t,e,n){return t&&"object"==typeof t?(Ao(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?Sc(t[".sv"],e,n):"object"==typeof t[".sv"]?Cc(t[".sv"],e):void Ao(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},Sc=function(t,e,n){if("timestamp"===t)return n.timestamp;Ao(!1,"Unexpected server value: "+t)},Cc=function(t,e,n){t.hasOwnProperty("increment")||Ao(!1,"Unexpected server value: "+JSON.stringify(t,null,2));t=t.increment;"number"!=typeof t&&Ao(!1,"Unexpected increment value: "+t);e=e.node();if(Ao(null!=e,"Expected ChildrenNode.EMPTY_NODE for nulls"),!e.isLeafNode())return t;e=e.getValue();return"number"!=typeof e?t:e+t};function Nc(t,r,i){var e=t.getPriority().val(),n=Tc(e,r.getImmediateChild(".priority"),i);if(t.isLeafNode()){var o=t,e=Tc(o.getValue(),r,i);return e!==o.getValue()||n!==o.getPriority().val()?new Tu(e,Zu(n)):t}var t=t,s=t;return n!==t.getPriority().val()&&(s=s.updatePriority(new Tu(n))),t.forEachChild(Nu,function(t,e){var n=Nc(e,r.getImmediateChild(t),i);n!==e&&(s=s.updateImmediateChild(t,n))}),s}var Ac,kc=(Oc.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},Oc.prototype.remember=function(t,e){var n;t.isEmpty()?(this.value=e,this.children.clear()):null!==this.value?this.value=this.value.updateChild(t,e):(n=t.getFront(),this.children.has(n)||this.children.set(n,new Oc),n=this.children.get(n),t=t.popFront(),n.remember(t,e))},Oc.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(Nu,function(t,e){n.remember(new ka(t),e)}),this.forget(t)}if(0<this.children.size){e=t.getFront();return t=t.popFront(),this.children.has(e)&&this.children.get(e).forget(t)&&this.children.delete(e),0===this.children.size}return!0},Oc.prototype.forEachTree=function(n,r){null!==this.value?r(n,this.value):this.forEachChild(function(t,e){t=new ka(n.toString()+"/"+t);e.forEachTree(t,r)})},Oc.prototype.forEachChild=function(n){this.children.forEach(function(t,e){n(e,t)})},Oc);function Oc(){this.value=null,this.children=new Map}(Dr=Ac=Ac||{})[Dr.OVERWRITE=0]="OVERWRITE",Dr[Dr.MERGE=1]="MERGE",Dr[Dr.ACK_USER_WRITE=2]="ACK_USER_WRITE",Dr[Dr.LISTEN_COMPLETE=3]="LISTEN_COMPLETE";var Rc=(Pc.User=new Pc(!0,!1,null,!1),Pc.Server=new Pc(!1,!0,null,!1),Pc.forServerTaggedQuery=function(t){return new Pc(!1,!0,t,!0)},Pc);function Pc(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,Ao(!r||e,"Tagged queries must be from server.")}var Dc,xc=(Lc.prototype.operationForChild=function(t){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return Ao(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var e=this.affectedTree.subtree(new ka(t));return new Lc(ka.Empty,e,this.revert)}return Ao(this.path.getFront()===t,"operationForChild called for unrelated child."),new Lc(this.path.popFront(),this.affectedTree,this.revert)},Lc);function Lc(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=Ac.ACK_USER_WRITE,this.source=Rc.User}var Mc=(Fc.fromObject=function(t){var n=Fc.Empty;return Ia(t,function(t,e){n=n.set(new ka(t),e)}),n},Fc.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},Fc.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:ka.Empty,value:this.value};if(t.isEmpty())return null;var n=t.getFront(),r=this.children.get(n);if(null===r)return null;e=r.findRootMostMatchingPathAndValue(t.popFront(),e);return null==e?null:{path:new ka(n).child(e.path),value:e.value}},Fc.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},Fc.prototype.subtree=function(t){if(t.isEmpty())return this;var e=t.getFront(),e=this.children.get(e);return null!==e?e.subtree(t.popFront()):Fc.Empty},Fc.prototype.set=function(t,e){if(t.isEmpty())return new Fc(e,this.children);var n=t.getFront(),e=(this.children.get(n)||Fc.Empty).set(t.popFront(),e),e=this.children.insert(n,e);return new Fc(this.value,e)},Fc.prototype.remove=function(t){if(t.isEmpty())return this.children.isEmpty()?Fc.Empty:new Fc(null,this.children);var e=t.getFront(),n=this.children.get(e);if(n){n=n.remove(t.popFront()),t=void 0,t=n.isEmpty()?this.children.remove(e):this.children.insert(e,n);return null===this.value&&t.isEmpty()?Fc.Empty:new Fc(this.value,t)}return this},Fc.prototype.get=function(t){if(t.isEmpty())return this.value;var e=t.getFront(),e=this.children.get(e);return e?e.get(t.popFront()):null},Fc.prototype.setTree=function(t,e){if(t.isEmpty())return e;var n=t.getFront(),t=(this.children.get(n)||Fc.Empty).setTree(t.popFront(),e),e=void 0,e=t.isEmpty()?this.children.remove(n):this.children.insert(n,t);return new Fc(this.value,e)},Fc.prototype.fold=function(t){return this.fold_(ka.Empty,t)},Fc.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)},Fc.prototype.findOnPath=function(t,e){return this.findOnPath_(t,ka.Empty,e)},Fc.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(),r=this.children.get(i);return r?r.findOnPath_(t.popFront(),e.child(i),n):null},Fc.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,ka.Empty,e)},Fc.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):Fc.Empty},Fc.prototype.foreach=function(t){this.foreach_(ka.Empty,t)},Fc.prototype.foreach_=function(n,r){this.children.inorderTraversal(function(t,e){e.foreach_(n.child(t),r)}),this.value&&r(n,this.value)},Fc.prototype.foreachChild=function(n){this.children.inorderTraversal(function(t,e){e.value&&n(t,e.value)})},Fc.Empty=new Fc(null),Fc);function Fc(t,e){void 0===e&&(e=Dc=Dc||new Du(sa)),this.value=t,this.children=e}var Uc=(jc.prototype.operationForChild=function(t){return this.path.isEmpty()?new jc(this.source,ka.Empty):new jc(this.source,this.path.popFront())},jc);function jc(t,e){this.source=t,this.path=e,this.type=Ac.LISTEN_COMPLETE}var Vc=(qc.prototype.operationForChild=function(t){return this.path.isEmpty()?new qc(this.source,ka.Empty,this.snap.getImmediateChild(t)):new qc(this.source,this.path.popFront(),this.snap)},qc);function qc(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=Ac.OVERWRITE}var Bc=(Wc.prototype.operationForChild=function(t){if(this.path.isEmpty()){var e=this.children.subtree(new ka(t));return e.isEmpty()?null:e.value?new Vc(this.source,ka.Empty,e.value):new Wc(this.source,ka.Empty,e)}return Ao(this.path.getFront()===t,"Can't get a merge for a child not on the path of the operation"),new Wc(this.source,this.path.popFront(),this.children)},Wc.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},Wc);function Wc(t,e,n){this.source=t,this.path=e,this.children=n,this.type=Ac.MERGE}var Hc=(Gc.prototype.isFullyInitialized=function(){return this.fullyInitialized_},Gc.prototype.isFiltered=function(){return this.filtered_},Gc.prototype.isCompleteForPath=function(t){if(t.isEmpty())return this.isFullyInitialized()&&!this.filtered_;t=t.getFront();return this.isCompleteForChild(t)},Gc.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},Gc.prototype.getNode=function(){return this.node_},Gc);function Gc(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}var Kc=(zc.prototype.updateEventSnap=function(t,e,n){return new zc(new Hc(t,e,n),this.serverCache_)},zc.prototype.updateServerSnap=function(t,e,n){return new zc(this.eventCache_,new Hc(t,e,n))},zc.prototype.getEventCache=function(){return this.eventCache_},zc.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},zc.prototype.getServerCache=function(){return this.serverCache_},zc.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},zc.Empty=new zc(new Hc(zu.EMPTY_NODE,!1,!1),new Hc(zu.EMPTY_NODE,!1,!1)),zc);function zc(t,e){this.eventCache_=t,this.serverCache_=e}var Qc=(Yc.valueChange=function(t){return new Yc(Yc.VALUE,t)},Yc.childAddedChange=function(t,e){return new Yc(Yc.CHILD_ADDED,e,t)},Yc.childRemovedChange=function(t,e){return new Yc(Yc.CHILD_REMOVED,e,t)},Yc.childChangedChange=function(t,e,n){return new Yc(Yc.CHILD_CHANGED,e,t,n)},Yc.childMovedChange=function(t,e){return new Yc(Yc.CHILD_MOVED,e,t)},Yc.CHILD_ADDED="child_added",Yc.CHILD_REMOVED="child_removed",Yc.CHILD_CHANGED="child_changed",Yc.CHILD_MOVED="child_moved",Yc.VALUE="value",Yc);function Yc(t,e,n,r,i){this.type=t,this.snapshotNode=e,this.childName=n,this.oldSnap=r,this.prevName=i}var Xc=($c.prototype.updateChild=function(t,e,n,r,i,o){Ao(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(Qc.childRemovedChange(e,s)):Ao(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?o.trackChildChange(Qc.childAddedChange(e,n)):o.trackChildChange(Qc.childChangedChange(e,n,s))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},$c.prototype.updateFullNode=function(r,n,i){return null!=i&&(r.isLeafNode()||r.forEachChild(Nu,function(t,e){n.hasChild(t)||i.trackChildChange(Qc.childRemovedChange(t,e))}),n.isLeafNode()||n.forEachChild(Nu,function(t,e){var n;r.hasChild(t)?(n=r.getImmediateChild(t)).equals(e)||i.trackChildChange(Qc.childChangedChange(t,e,n)):i.trackChildChange(Qc.childAddedChange(t,e))})),n.withIndex(this.index_)},$c.prototype.updatePriority=function(t,e){return t.isEmpty()?zu.EMPTY_NODE:t.updatePriority(e)},$c.prototype.filtersNodes=function(){return!1},$c.prototype.getIndexedFilter=function(){return this},$c.prototype.getIndex=function(){return this.index_},$c);function $c(t){this.index_=t}var Jc=(Zc.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;Ao(e===Qc.CHILD_ADDED||e===Qc.CHILD_CHANGED||e===Qc.CHILD_REMOVED,"Only child changes supported for tracking"),Ao(".priority"!==n,"Only non-priority child changes can be tracked.");var r=this.changeMap.get(n);if(r){var i=r.type;if(e===Qc.CHILD_ADDED&&i===Qc.CHILD_REMOVED)this.changeMap.set(n,Qc.childChangedChange(n,t.snapshotNode,r.snapshotNode));else if(e===Qc.CHILD_REMOVED&&i===Qc.CHILD_ADDED)this.changeMap.delete(n);else if(e===Qc.CHILD_REMOVED&&i===Qc.CHILD_CHANGED)this.changeMap.set(n,Qc.childRemovedChange(n,r.oldSnap));else if(e===Qc.CHILD_CHANGED&&i===Qc.CHILD_ADDED)this.changeMap.set(n,Qc.childAddedChange(n,t.snapshotNode));else{if(e!==Qc.CHILD_CHANGED||i!==Qc.CHILD_CHANGED)throw ko("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap.set(n,Qc.childChangedChange(n,t.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,t)},Zc.prototype.getChanges=function(){return Array.from(this.changeMap.values())},Zc);function Zc(){this.changeMap=new Map}function th(){}var eh=new(th.prototype.getCompleteChild=function(t){return null},th.prototype.getChildAfterChild=function(t,e,n){return null},th),nh=(rh.prototype.getCompleteChild=function(t){var e=this.viewCache_.getEventCache();if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);e=null!=this.optCompleteServerCache_?new Hc(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(t,e)},rh.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:this.viewCache_.getCompleteServerSnap(),t=this.writes_.calcIndexedSlice(r,e,1,n,t);return 0===t.length?null:t[0]},rh);function rh(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}var ih=function(t,e){this.viewCache=t,this.changes=e},oh=(sh.prototype.assertIndexed=function(t){Ao(t.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),Ao(t.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},sh.prototype.applyOperation=function(t,e,n,r){var i=new Jc;if(e.type===Ac.OVERWRITE)var o=e,s=o.source.fromUser?this.applyUserOverwrite_(t,o.path,o.snap,n,r,i):(Ao(o.source.fromServer,"Unknown source."),a=o.source.tagged||t.getServerCache().isFiltered()&&!o.path.isEmpty(),this.applyServerOverwrite_(t,o.path,o.snap,n,r,a,i));else if(e.type===Ac.MERGE){o=e;s=o.source.fromUser?this.applyUserMerge_(t,o.path,o.children,n,r,i):(Ao(o.source.fromServer,"Unknown source."),a=o.source.tagged||t.getServerCache().isFiltered(),this.applyServerMerge_(t,o.path,o.children,n,r,a,i))}else if(e.type===Ac.ACK_USER_WRITE){var a=e;s=a.revert?this.revertUserWrite_(t,a.path,n,r,i):this.ackUserWrite_(t,a.path,a.affectedTree,n,r,i)}else{if(e.type!==Ac.LISTEN_COMPLETE)throw ko("Unknown operation type: "+e.type);s=this.listenComplete_(t,e.path,n,i)}i=i.getChanges();return sh.maybeAddValueEvent_(t,s,i),new ih(s,i)},sh.maybeAddValueEvent_=function(t,e,n){var r,i,o=e.getEventCache();o.isFullyInitialized()&&(r=o.getNode().isLeafNode()||o.getNode().isEmpty(),i=t.getCompleteEventSnap(),(0<n.length||!t.getEventCache().isFullyInitialized()||r&&!o.getNode().equals(i)||!o.getNode().getPriority().equals(i.getPriority()))&&n.push(Qc.valueChange(e.getCompleteEventSnap())))},sh.prototype.generateEventCacheAfterServerEvent_=function(t,e,n,r,i){var o=t.getEventCache();if(null!=n.shadowingWrite(e))return t;var s,a,u,c,h=void 0,l=void 0;return h=e.isEmpty()?(Ao(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()?(s=(s=t.getCompleteServerSnap())instanceof zu?s:zu.EMPTY_NODE,s=n.calcCompleteEventChildren(s),this.filter_.updateFullNode(t.getEventCache().getNode(),s,i)):(a=n.calcCompleteEventCache(t.getCompleteServerSnap()),this.filter_.updateFullNode(t.getEventCache().getNode(),a,i))):".priority"===(a=e.getFront())?(Ao(1===e.getLength(),"Can't have a priority with additional path components"),u=o.getNode(),l=t.getServerCache().getNode(),null!=(c=n.calcEventCacheAfterServerOverwrite(e,u,l))?this.filter_.updatePriority(u,c):o.getNode()):(u=e.popFront(),c=void 0,null!=(c=o.isCompleteForChild(a)?(l=t.getServerCache().getNode(),null!=(l=n.calcEventCacheAfterServerOverwrite(e,o.getNode(),l))?o.getNode().getImmediateChild(a).updateChild(u,l):o.getNode().getImmediateChild(a)):n.calcCompleteChild(a,t.getServerCache()))?this.filter_.updateChild(o.getNode(),a,c,u,r,i):o.getNode()),t.updateEventSnap(h,o.isFullyInitialized()||e.isEmpty(),this.filter_.filtersNodes())},sh.prototype.applyServerOverwrite_=function(t,e,n,r,i,o,s){var a=t.getServerCache(),u=o?this.filter_:this.filter_.getIndexedFilter();if(e.isEmpty())h=u.updateFullNode(a.getNode(),n,null);else if(u.filtersNodes()&&!a.isFiltered())var c=a.getNode().updateChild(e,n),h=u.updateFullNode(a.getNode(),c,null);else{o=e.getFront();if(!a.isCompleteForPath(e)&&1<e.getLength())return t;c=e.popFront(),n=a.getNode().getImmediateChild(o).updateChild(c,n);h=".priority"===o?u.updatePriority(a.getNode(),n):u.updateChild(a.getNode(),o,n,c,eh,null)}u=t.updateServerSnap(h,a.isFullyInitialized()||e.isEmpty(),u.filtersNodes()),i=new nh(r,u,i);return this.generateEventCacheAfterServerEvent_(u,e,r,i,s)},sh.prototype.applyUserOverwrite_=function(t,e,n,r,i,o){var s,a,u=t.getEventCache(),c=new nh(r,t,i);return e.isEmpty()?(a=this.filter_.updateFullNode(t.getEventCache().getNode(),n,o),t.updateEventSnap(a,!0,this.filter_.filtersNodes())):".priority"===(s=e.getFront())?(a=this.filter_.updatePriority(t.getEventCache().getNode(),n),t.updateEventSnap(a,u.isFullyInitialized(),u.isFiltered())):(r=e.popFront(),i=u.getNode().getImmediateChild(s),a=void 0,a=r.isEmpty()?n:null!=(e=c.getCompleteChild(s))?".priority"===r.getBack()&&e.getChild(r.parent()).isEmpty()?e:e.updateChild(r,n):zu.EMPTY_NODE,i.equals(a)?t:(o=this.filter_.updateChild(u.getNode(),s,a,r,c,o),t.updateEventSnap(o,u.isFullyInitialized(),this.filter_.filtersNodes())))},sh.cacheHasChild_=function(t,e){return t.getEventCache().isCompleteForChild(e)},sh.prototype.applyUserMerge_=function(n,r,t,i,o,s){var a=this,u=n;return t.foreach(function(t,e){t=r.child(t);sh.cacheHasChild_(n,t.getFront())&&(u=a.applyUserOverwrite_(u,t,e,i,o,s))}),t.foreach(function(t,e){t=r.child(t);sh.cacheHasChild_(n,t.getFront())||(u=a.applyUserOverwrite_(u,t,e,i,o,s))}),u},sh.prototype.applyMerge_=function(n,t){return t.foreach(function(t,e){n=n.updateChild(t,e)}),n},sh.prototype.applyServerMerge_=function(r,t,e,i,o,s,a){var u=this;if(r.getServerCache().getNode().isEmpty()&&!r.getServerCache().isFullyInitialized())return r;var c=r,e=t.isEmpty()?e:Mc.Empty.setTree(t,e),h=r.getServerCache().getNode();return e.children.inorderTraversal(function(t,e){var n;h.hasChild(t)&&(n=r.getServerCache().getNode().getImmediateChild(t),e=u.applyMerge_(n,e),c=u.applyServerOverwrite_(c,new ka(t),e,i,o,s,a))}),e.children.inorderTraversal(function(t,e){var n=!r.getServerCache().isCompleteForChild(t)&&null==e.value;h.hasChild(t)||n||(n=r.getServerCache().getNode().getImmediateChild(t),e=u.applyMerge_(n,e),c=u.applyServerOverwrite_(c,new ka(t),e,i,o,s,a))}),c},sh.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=Mc.Empty;return a.getNode().forEachChild(gu,function(t,e){u=u.set(new ka(t),e)}),this.applyServerMerge_(t,r,u,n,i,s,o)}return t}var c=Mc.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)},sh.prototype.listenComplete_=function(t,e,n,r){var i=t.getServerCache(),i=t.updateServerSnap(i.getNode(),i.isFullyInitialized()||e.isEmpty(),i.isFiltered());return this.generateEventCacheAfterServerEvent_(i,e,n,eh,r)},sh.prototype.revertUserWrite_=function(t,e,n,r,i){var o;if(null!=n.shadowingWrite(e))return t;var s,a,u=new nh(n,t,r),c=t.getEventCache().getNode(),r=void 0;return e.isEmpty()||".priority"===e.getFront()?(a=void 0,a=t.getServerCache().isFullyInitialized()?n.calcCompleteEventCache(t.getCompleteServerSnap()):(s=t.getServerCache().getNode(),Ao(s instanceof zu,"serverChildren would be complete if leaf node"),n.calcCompleteEventChildren(s)),r=this.filter_.updateFullNode(c,a,i)):(s=e.getFront(),null==(a=n.calcCompleteChild(s,t.getServerCache()))&&t.getServerCache().isCompleteForChild(s)&&(a=c.getImmediateChild(s)),(r=null!=a?this.filter_.updateChild(c,s,a,e.popFront(),u,i):t.getEventCache().getNode().hasChild(s)?this.filter_.updateChild(c,s,zu.EMPTY_NODE,e.popFront(),u,i):c).isEmpty()&&t.getServerCache().isFullyInitialized()&&(o=n.calcCompleteEventCache(t.getCompleteServerSnap())).isLeafNode()&&(r=this.filter_.updateFullNode(r,o,i))),o=t.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(ka.Empty),t.updateEventSnap(r,o,this.filter_.filtersNodes())},sh);function sh(t){this.filter_=t}var ah=(uh.prototype.generateEventsForChanges=function(t,e,n){var r=this,i=[],o=[];return t.forEach(function(t){t.type===Qc.CHILD_CHANGED&&r.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(Qc.childMovedChange(t.childName,t.snapshotNode))}),this.generateEventsForType_(i,Qc.CHILD_REMOVED,t,n,e),this.generateEventsForType_(i,Qc.CHILD_ADDED,t,n,e),this.generateEventsForType_(i,Qc.CHILD_MOVED,o,n,e),this.generateEventsForType_(i,Qc.CHILD_CHANGED,t,n,e),this.generateEventsForType_(i,Qc.VALUE,t,n,e),i},uh.prototype.generateEventsForType_=function(r,e,t,i,o){var s=this,t=t.filter(function(t){return t.type===e});t.sort(this.compareChanges_.bind(this)),t.forEach(function(e){var n=s.materializeSingleChange_(e,o);i.forEach(function(t){t.respondsTo(e.type)&&r.push(t.createEvent(n,s.query_))})})},uh.prototype.materializeSingleChange_=function(t,e){return"value"===t.type||"child_removed"===t.type||(t.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.index_)),t},uh.prototype.compareChanges_=function(t,e){if(null==t.childName||null==e.childName)throw ko("Should only compare child_ events.");t=new cu(t.childName,t.snapshotNode),e=new cu(e.childName,e.snapshotNode);return this.index_.compare(t,e)},uh);function uh(t){this.query_=t,this.index_=this.query_.getQueryParams().getIndex()}var ch,hh=(lh.prototype.getQuery=function(){return this.query_},lh.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},lh.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},lh.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},lh.prototype.addEventRegistration=function(t){this.eventRegistrations_.push(t)},lh.prototype.removeEventRegistration=function(t,e){var n,r=[];if(e&&(Ao(null==t,"A cancel should cancel all event registrations."),n=this.query_.path,this.eventRegistrations_.forEach(function(t){t=t.createCancelEvent(e,n);t&&r.push(t)})),t){for(var i=[],o=0;o<this.eventRegistrations_.length;++o){var s=this.eventRegistrations_[o];if(s.matches(t)){if(t.hasAnyCallback()){i=i.concat(this.eventRegistrations_.slice(o+1));break}}else i.push(s)}this.eventRegistrations_=i}else this.eventRegistrations_=[];return r},lh.prototype.applyOperation=function(t,e,n){t.type===Ac.MERGE&&null!==t.source.queryId&&(Ao(this.viewCache_.getCompleteServerSnap(),"We should always have a full cache before handling merges"),Ao(this.viewCache_.getCompleteEventSnap(),"Missing event cache, even though we have a server cache"));var r=this.viewCache_,n=this.processor_.applyOperation(r,t,e,n);return this.processor_.assertIndexed(n.viewCache),Ao(n.viewCache.getServerCache().isFullyInitialized()||!r.getServerCache().isFullyInitialized(),"Once a server snap is complete, it should never go back"),this.viewCache_=n.viewCache,this.generateEventsForChanges_(n.changes,n.viewCache.getEventCache().getNode(),null)},lh.prototype.getInitialEvents=function(t){var e=this.viewCache_.getEventCache(),n=[];return e.getNode().isLeafNode()||e.getNode().forEachChild(Nu,function(t,e){n.push(Qc.childAddedChange(t,e))}),e.isFullyInitialized()&&n.push(Qc.valueChange(e.getNode())),this.generateEventsForChanges_(n,e.getNode(),t)},lh.prototype.generateEventsForChanges_=function(t,e,n){n=n?[n]:this.eventRegistrations_;return this.eventGenerator_.generateEventsForChanges(t,e,n)},lh);function lh(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new Xc(n.getIndex()),i=n.getNodeFilter();this.processor_=new oh(i);var o=e.getServerCache(),t=e.getEventCache(),n=r.updateFullNode(zu.EMPTY_NODE,o.getNode(),null),e=i.updateFullNode(zu.EMPTY_NODE,t.getNode(),null),r=new Hc(n,o.isFullyInitialized(),r.filtersNodes()),i=new Hc(e,t.isFullyInitialized(),i.filtersNodes());this.viewCache_=new Kc(i,r),this.eventGenerator_=new ah(this.query_)}var fh=(Object.defineProperty(ph,"__referenceConstructor",{get:function(){return Ao(ch,"Reference.ts has not been loaded"),ch},set:function(t){Ao(!ch,"__referenceConstructor has already been defined"),ch=t},enumerable:!1,configurable:!0}),ph.prototype.isEmpty=function(){return 0===this.views.size},ph.prototype.applyOperation=function(t,e,n){var r,i,o=t.source.queryId;if(null!==o){var s=this.views.get(o);return Ao(null!=s,"SyncTree gave us an op for an invalid query."),s.applyOperation(t,e,n)}var a=[];try{for(var u=wo(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},ph.prototype.addEventRegistration=function(t,e,n,r,i){var o,s,a=t.queryIdentifier(),u=this.views.get(a);return u||(s=!1,s=!!(o=n.calcCompleteEventCache(i?r:null))||(o=r instanceof zu?n.calcCompleteEventChildren(r):zu.EMPTY_NODE,!1),i=new Kc(new Hc(o,s,!1),new Hc(r,i,!1)),u=new hh(t,i),this.views.set(a,u)),u.addEventRegistration(e),u.getInitialEvents(e)},ph.prototype.removeEventRegistration=function(t,e,n){var r,i,o=t.queryIdentifier(),s=[],a=[],u=this.hasCompleteView();if("default"===o)try{for(var c=wo(this.views.entries()),h=c.next();!h.done;h=c.next()){var l=Eo(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 ph.__referenceConstructor(t.repo,t.path)),{removed:s,events:a}},ph.prototype.getQueryViews=function(){var e,t,n=[];try{for(var r=wo(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},ph.prototype.getCompleteServerCache=function(t){var e,n,r=null;try{for(var i=wo(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},ph.prototype.viewForQuery=function(t){if(t.getQueryParams().loadsAllData())return this.getCompleteView();t=t.queryIdentifier();return this.views.get(t)},ph.prototype.viewExistsForQuery=function(t){return null!=this.viewForQuery(t)},ph.prototype.hasCompleteView=function(){return null!=this.getCompleteView()},ph.prototype.getCompleteView=function(){var e,t;try{for(var n=wo(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},ph);function ph(){this.views=new Map}var dh=(vh.prototype.addWrite=function(t,e){if(t.isEmpty())return new vh(new Mc(e));var n=this.writeTree_.findRootMostValueAndPath(t);if(null!=n){var r=n.path,i=n.value,n=ka.relativePath(r,t),i=i.updateChild(n,e);return new vh(this.writeTree_.set(r,i))}e=new Mc(e);return new vh(this.writeTree_.setTree(t,e))},vh.prototype.addWrites=function(n,t){var r=this;return Ia(t,function(t,e){r=r.addWrite(n.child(t),e)}),r},vh.prototype.removeWrite=function(t){return t.isEmpty()?vh.Empty:new vh(this.writeTree_.setTree(t,Mc.Empty))},vh.prototype.hasCompleteWrite=function(t){return null!=this.getCompleteNode(t)},vh.prototype.getCompleteNode=function(t){var e=this.writeTree_.findRootMostValueAndPath(t);return null!=e?this.writeTree_.get(e.path).getChild(ka.relativePath(e.path,t)):null},vh.prototype.getCompleteChildren=function(){var n=[],t=this.writeTree_.value;return null!=t?t.isLeafNode()||t.forEachChild(Nu,function(t,e){n.push(new cu(t,e))}):this.writeTree_.children.inorderTraversal(function(t,e){null!=e.value&&n.push(new cu(t,e.value))}),n},vh.prototype.childCompoundWrite=function(t){if(t.isEmpty())return this;var e=this.getCompleteNode(t);return new vh(null!=e?new Mc(e):this.writeTree_.subtree(t))},vh.prototype.isEmpty=function(){return this.writeTree_.isEmpty()},vh.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?(Ao(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}}(ka.Empty,this.writeTree_,t)},vh.Empty=new vh(new Mc(null)),vh);function vh(t){this.writeTree_=t}var yh=(gh.prototype.childWrites=function(t){return new mh(t,this)},gh.prototype.addOverwrite=function(t,e,n,r){Ao(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},gh.prototype.addMerge=function(t,e,n){Ao(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},gh.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},gh.prototype.removeWrite=function(e){var n=this,t=this.allWrites_.findIndex(function(t){return t.writeId===e});Ao(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):Ia(r.children,function(t){n.visibleWrites_=n.visibleWrites_.removeWrite(r.path.child(t))}),!0)},gh.prototype.getCompleteWriteData=function(t){return this.visibleWrites_.getCompleteNode(t)},gh.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(ka.Empty)){var o=gh.layerTree_(this.allWrites_,function(t){return(t.visible||r)&&(!n||!~n.indexOf(t.writeId))&&(t.path.contains(e)||e.contains(t.path))},e),s=t||zu.EMPTY_NODE;return o.apply(s)}return null}o=this.visibleWrites_.getCompleteNode(e);if(null!=o)return o;o=this.visibleWrites_.childCompoundWrite(e);if(o.isEmpty())return t;if(null!=t||o.hasCompleteWrite(ka.Empty)){var s=t||zu.EMPTY_NODE;return o.apply(s)}return null},gh.prototype.calcCompleteEventChildren=function(t,e){var n=zu.EMPTY_NODE,r=this.visibleWrites_.getCompleteNode(t);if(r)return r.isLeafNode()||r.forEachChild(Nu,function(t,e){n=n.updateImmediateChild(t,e)}),n;if(e){var i=this.visibleWrites_.childCompoundWrite(t);return e.forEachChild(Nu,function(t,e){e=i.childCompoundWrite(new ka(t)).apply(e);n=n.updateImmediateChild(t,e)}),i.getCompleteChildren().forEach(function(t){n=n.updateImmediateChild(t.name,t.node)}),n}return this.visibleWrites_.childCompoundWrite(t).getCompleteChildren().forEach(function(t){n=n.updateImmediateChild(t.name,t.node)}),n},gh.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n,r){Ao(n||r,"Either existingEventSnap or existingServerSnap must exist");t=t.child(e);if(this.visibleWrites_.hasCompleteWrite(t))return null;t=this.visibleWrites_.childCompoundWrite(t);return t.isEmpty()?r.getChild(e):t.apply(r.getChild(e))},gh.prototype.calcCompleteChild=function(t,e,n){var r=t.child(e),t=this.visibleWrites_.getCompleteNode(r);return null!=t?t:n.isCompleteForChild(e)?this.visibleWrites_.childCompoundWrite(r).apply(n.getNode().getImmediateChild(e)):null},gh.prototype.shadowingWrite=function(t){return this.visibleWrites_.getCompleteNode(t)},gh.prototype.calcIndexedSlice=function(t,e,n,r,i,o){var s,a=this.visibleWrites_.childCompoundWrite(t),t=a.getCompleteNode(ka.Empty);if(null!=t)s=t;else{if(null==e)return[];s=a.apply(e)}if((s=s.withIndex(o)).isEmpty()||s.isLeafNode())return[];for(var u=[],c=o.getCompare(),h=i?s.getReverseIteratorFrom(n,o):s.getIteratorFrom(n,o),l=h.getNext();l&&u.length<r;)0!==c(l,n)&&u.push(l),l=h.getNext();return u},gh.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},gh.prototype.resetTree_=function(){this.visibleWrites_=gh.layerTree_(this.allWrites_,gh.DefaultFilter_,ka.Empty),0<this.allWrites_.length?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},gh.DefaultFilter_=function(t){return t.visible},gh.layerTree_=function(t,e,n){for(var r=dh.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=ka.relativePath(n,s),r=r.addWrite(a,o.snap)):s.contains(n)&&(a=ka.relativePath(s,n),r=r.addWrite(ka.Empty,o.snap.getChild(a)));else{if(!o.children)throw ko("WriteRecord should have .snap or .children");n.contains(s)?(a=ka.relativePath(n,s),r=r.addWrites(a,o.children)):s.contains(n)&&((a=ka.relativePath(s,n)).isEmpty()?r=r.addWrites(ka.Empty,o.children):(o=ts(o.children,a.getFront()))&&(a=o.getChild(a.popFront()),r=r.addWrite(ka.Empty,a)))}}}return r},gh);function gh(){this.visibleWrites_=dh.Empty,this.allWrites_=[],this.lastWriteId_=-1}var mh=(bh.prototype.calcCompleteEventCache=function(t,e,n){return this.writeTree_.calcCompleteEventCache(this.treePath_,t,e,n)},bh.prototype.calcCompleteEventChildren=function(t){return this.writeTree_.calcCompleteEventChildren(this.treePath_,t)},bh.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n){return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_,t,e,n)},bh.prototype.shadowingWrite=function(t){return this.writeTree_.shadowingWrite(this.treePath_.child(t))},bh.prototype.calcIndexedSlice=function(t,e,n,r,i){return this.writeTree_.calcIndexedSlice(this.treePath_,t,e,n,r,i)},bh.prototype.calcCompleteChild=function(t,e){return this.writeTree_.calcCompleteChild(this.treePath_,t,e)},bh.prototype.child=function(t){return new bh(this.treePath_.child(t),this.writeTree_)},bh);function bh(t,e){this.treePath_=t,this.writeTree_=e}var _h=(wh.prototype.applyUserOverwrite=function(t,e,n,r){return this.pendingWriteTree_.addOverwrite(t,e,n,r),r?this.applyOperationToSyncPoints_(new Vc(Rc.User,t,e)):[]},wh.prototype.applyUserMerge=function(t,e,n){this.pendingWriteTree_.addMerge(t,e,n);e=Mc.fromObject(e);return this.applyOperationToSyncPoints_(new Bc(Rc.User,t,e))},wh.prototype.ackUserWrite=function(t,e){void 0===e&&(e=!1);var n=this.pendingWriteTree_.getWrite(t);if(this.pendingWriteTree_.removeWrite(t)){var r=Mc.Empty;return null!=n.snap?r=r.set(ka.Empty,!0):Ia(n.children,function(t,e){r=r.set(new ka(t),e)}),this.applyOperationToSyncPoints_(new xc(n.path,r,e))}return[]},wh.prototype.applyServerOverwrite=function(t,e){return this.applyOperationToSyncPoints_(new Vc(Rc.Server,t,e))},wh.prototype.applyServerMerge=function(t,e){e=Mc.fromObject(e);return this.applyOperationToSyncPoints_(new Bc(Rc.Server,t,e))},wh.prototype.applyListenComplete=function(t){return this.applyOperationToSyncPoints_(new Uc(Rc.Server,t))},wh.prototype.applyTaggedQueryOverwrite=function(t,e,n){var r=this.queryKeyForTag_(n);if(null==r)return[];n=wh.parseQueryKey_(r),r=n.path,n=n.queryId,t=ka.relativePath(r,t),e=new Vc(Rc.forServerTaggedQuery(n),t,e);return this.applyTaggedOperation_(r,e)},wh.prototype.applyTaggedQueryMerge=function(t,e,n){var r=this.queryKeyForTag_(n);if(r){n=wh.parseQueryKey_(r),r=n.path,n=n.queryId,t=ka.relativePath(r,t),e=Mc.fromObject(e),e=new Bc(Rc.forServerTaggedQuery(n),t,e);return this.applyTaggedOperation_(r,e)}return[]},wh.prototype.applyTaggedListenComplete=function(t,e){var n=this.queryKeyForTag_(e);if(n){e=wh.parseQueryKey_(n),n=e.path,e=e.queryId,t=ka.relativePath(n,t),t=new Uc(Rc.forServerTaggedQuery(e),t);return this.applyTaggedOperation_(n,t)}return[]},wh.prototype.addEventRegistration=function(t,e){var n=t.path,r=null,i=!1;this.syncPointTree_.foreachOnPath(n,function(t,e){t=ka.relativePath(t,n);r=r||e.getCompleteServerCache(t),i=i||e.hasCompleteView()});var o=this.syncPointTree_.get(n);o?(i=i||o.hasCompleteView(),r=r||o.getCompleteServerCache(ka.Empty)):(o=new fh,this.syncPointTree_=this.syncPointTree_.set(n,o)),null!=r?c=!0:(c=!1,r=zu.EMPTY_NODE,this.syncPointTree_.subtree(n).foreachChild(function(t,e){e=e.getCompleteServerCache(ka.Empty);e&&(r=r.updateImmediateChild(t,e))}));var s,a=o.viewExistsForQuery(t);a||t.getQueryParams().loadsAllData()||(u=wh.makeQueryKey_(t),Ao(!this.queryToTagMap.has(u),"View does not exist, but we have a tag"),s=wh.getNextQueryTag_(),this.queryToTagMap.set(u,s),this.tagToQueryMap.set(s,u));var u=this.pendingWriteTree_.childWrites(n),c=o.addEventRegistration(t,e,u,r,c);return a||i||(o=o.viewForQuery(t),c=c.concat(this.setupListener_(t,o))),c},wh.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));e=a.removed,s=a.events,o=-1!==e.findIndex(function(t){return t.getQueryParams().loadsAllData()}),a=this.syncPointTree_.findOnPath(i,function(t,e){return e.hasCompleteView()});if(o&&!a){i=this.syncPointTree_.subtree(i);if(!i.isEmpty())for(var u=this.collectDistinctViewsForSubTree_(i),c=0;c<u.length;++c){var h=u[c],l=h.getQuery(),h=this.createListenerForView_(h);this.listenProvider_.startListening(wh.queryForListening_(l),this.tagForQuery_(l),h.hashFn,h.onComplete)}}!a&&0<e.length&&!n&&(o?this.listenProvider_.stopListening(wh.queryForListening_(t),null):e.forEach(function(t){var e=r.queryToTagMap.get(wh.makeQueryKey_(t));r.listenProvider_.stopListening(wh.queryForListening_(t),e)})),this.removeTags_(e)}return s},wh.prototype.calcCompleteEventCache=function(n,t){var e=this.pendingWriteTree_,r=this.syncPointTree_.findOnPath(n,function(t,e){t=ka.relativePath(t,n),t=e.getCompleteServerCache(t);if(t)return t});return e.calcCompleteEventCache(n,r,t,!0)},wh.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()),Ia(n,function(t,e){r=r.concat(e)}),r})},wh.prototype.removeTags_=function(t){for(var e=0;e<t.length;++e){var n,r=t[e];r.getQueryParams().loadsAllData()||(n=wh.makeQueryKey_(r),r=this.queryToTagMap.get(n),this.queryToTagMap.delete(n),this.tagToQueryMap.delete(r))}},wh.queryForListening_=function(t){return t.getQueryParams().loadsAllData()&&!t.getQueryParams().isDefault()?t.getRef():t},wh.prototype.setupListener_=function(t,e){var n=t.path,r=this.tagForQuery_(t),e=this.createListenerForView_(e),e=this.listenProvider_.startListening(wh.queryForListening_(t),r,e.hashFn,e.onComplete),n=this.syncPointTree_.subtree(n);if(r)Ao(!n.value.hasCompleteView(),"If we're adding a query, it shouldn't be shadowed");else for(var i=n.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()}))),Ia(n,function(t,e){r=r.concat(e)}),r}),o=0;o<i.length;++o){var s=i[o];this.listenProvider_.stopListening(wh.queryForListening_(s),this.tagForQuery_(s))}return e},wh.prototype.createListenerForView_=function(t){var e=this,n=t.getQuery(),r=this.tagForQuery_(n);return{hashFn:function(){return(t.getServerCache()||zu.EMPTY_NODE).hash()},onComplete:function(t){if("ok"===t)return r?e.applyTaggedListenComplete(n.path,r):e.applyListenComplete(n.path);t=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");n=new Error(t+" at "+e.path.toString()+": "+n);return n.code=t.toUpperCase(),n}(t,n);return e.removeEventRegistration(n,null,t)}}},wh.makeQueryKey_=function(t){return t.path.toString()+"$"+t.queryIdentifier()},wh.parseQueryKey_=function(t){var e=t.indexOf("$");return Ao(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new ka(t.substr(0,e))}},wh.prototype.queryKeyForTag_=function(t){return this.tagToQueryMap.get(t)},wh.prototype.tagForQuery_=function(t){t=wh.makeQueryKey_(t);return this.queryToTagMap.get(t)},wh.getNextQueryTag_=function(){return wh.nextQueryTag_++},wh.prototype.applyTaggedOperation_=function(t,e){var n=this.syncPointTree_.get(t);Ao(n,"Missing sync point for query tag that we're tracking");t=this.pendingWriteTree_.childWrites(t);return n.applyOperation(e,t,null)},wh.prototype.applyOperationToSyncPoints_=function(t){return this.applyOperationHelper_(t,this.syncPointTree_,null,this.pendingWriteTree_.childWrites(ka.Empty))},wh.prototype.applyOperationHelper_=function(t,e,n,r){if(t.path.isEmpty())return this.applyOperationDescendantsHelper_(t,e,n,r);var i=e.get(ka.Empty);null==n&&null!=i&&(n=i.getCompleteServerCache(ka.Empty));var o=[],s=t.path.getFront(),a=t.operationForChild(s),u=e.children.get(s);return u&&a&&(e=n?n.getImmediateChild(s):null,s=r.child(s),o=o.concat(this.applyOperationHelper_(a,u,e,s))),i&&(o=o.concat(i.applyOperation(t,r,n))),o},wh.prototype.applyOperationDescendantsHelper_=function(i,t,o,s){var a=this,e=t.get(ka.Empty);null==o&&null!=e&&(o=e.getCompleteServerCache(ka.Empty));var u=[];return t.children.inorderTraversal(function(t,e){var n=o?o.getImmediateChild(t):null,r=s.child(t),t=i.operationForChild(t);t&&(u=u.concat(a.applyOperationDescendantsHelper_(t,e,n,r)))}),e&&(u=u.concat(e.applyOperation(i,s,o))),u},wh.nextQueryTag_=1,wh);function wh(t){this.listenProvider_=t,this.syncPointTree_=Mc.Empty,this.pendingWriteTree_=new yh,this.tagToQueryMap=new Map,this.queryToTagMap=new Map}var Eh=(Ih.prototype.getNode=function(t){return this.rootNode_.getChild(t)},Ih.prototype.updateSnapshot=function(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)},Ih);function Ih(){this.rootNode_=zu.EMPTY_NODE}var Th=(Sh.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),Zo(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},Sh.prototype.get=function(){return Ro(this.counters_)},Sh);function Sh(){this.counters_={}}var Ch=(Nh.getCollection=function(t){t=t.toString();return this.collections_[t]||(this.collections_[t]=new Th),this.collections_[t]},Nh.getOrCreateReporter=function(t,e){t=t.toString();return this.reporters_[t]||(this.reporters_[t]=e()),this.reporters_[t]},Nh.collections_={},Nh.reporters_={},Nh);function Nh(){}var Ah=(kh.prototype.get=function(){var t=this.collection_.get(),n=mo({},t);return this.last_&&Ia(this.last_,function(t,e){n[t]=n[t]-e}),this.last_=t,n},kh);function kh(t){this.collection_=t,this.last_=null}var Oh=(Rh.prototype.includeStat=function(t){this.statsToReport_[t]=!0},Rh.prototype.reportStats_=function(){var n=this,t=this.statsListener_.get(),r={},i=!1;Ia(t,function(t,e){0<e&&Zo(n.statsToReport_,t)&&(r[t]=e,i=!0)}),i&&this.server_.reportStats(r),Ca(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},Rh);function Rh(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new Ah(t);t=1e4+2e4*Math.random();Ca(this.reportStats_.bind(this),Math.floor(t))}var Ph=(Dh.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 xh(i)),e.add(r)}e&&this.eventLists_.push(e)},Dh.prototype.raiseEventsAtPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_(function(t){return t.equals(e)})},Dh.prototype.raiseEventsForChangedPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_(function(t){return t.contains(e)||e.contains(t)})},Dh.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_--},Dh);function Dh(){this.eventLists_=[],this.recursionDepth_=0}var xh=(Lh.prototype.add=function(t){this.events_.push(t)},Lh.prototype.raise=function(){for(var t=0;t<this.events_.length;t++){var e,n=this.events_[t];null!==n&&(this.events_[t]=null,e=n.getEventRunner(),va&&ga("event: "+n.toString()),Sa(e))}},Lh.prototype.getPath=function(){return this.path_},Lh);function Lh(t){this.path_=t,this.events_=[]}Mh.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=Io(this.listeners_[t]),i=0;i<r.length;i++)r[i].callback.apply(r[i].context,e)},Mh.prototype.on=function(t,e,n){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:e,context:n});t=this.getInitialEvent(t);t&&e.apply(n,t)},Mh.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)},Mh.prototype.validateEventType_=function(e){Ao(this.allowedEvents_.find(function(t){return t===e}),"Unknown event: "+e)},M=Mh;function Mh(t){this.allowedEvents_=t,this.listeners_={},Ao(Array.isArray(t)&&0<t.length,"Requires a non-empty array")}var Fh,Uh=(go(jh,Fh=M),jh.getInstance=function(){return new jh},jh.prototype.getInitialEvent=function(t){return Ao("visible"===t,"Unknown event type: "+t),[this.visible_]},jh);function jh(){var e,t,n=Fh.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 Vh,qh=(go(Bh,Vh=M),Bh.getInstance=function(){return new Bh},Bh.prototype.getInitialEvent=function(t){return Ao("online"===t,"Unknown event type: "+t),[this.online_]},Bh.prototype.currentlyOnline=function(){return this.online_},Bh);function Bh(){var t=Vh.call(this,["online"])||this;return t.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||Mo()||(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 Wh=(Hh.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},Hh.prototype.handleResponse=function(t,e){var n=this;this.pendingResponses[t]=e;for(var r=this;this.pendingResponses[this.currentResponseNum];){if("break"===function(){var e=r.pendingResponses[r.currentResponseNum];delete r.pendingResponses[r.currentResponseNum];for(var t=0;t<e.length;++t)!function(t){e[t]&&Sa(function(){n.onMessage_(e[t])})}(t);if(r.currentResponseNum===r.closeAfterResponse)return r.onClose&&(r.onClose(),r.onClose=null),"break";r.currentResponseNum++}())break}},Hh);function Hh(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}var Gh="pLPCommand",Kh="pRTLPCB",zh=(Qh.prototype.open=function(t,e){var n,r,i,s=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new Wh(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(function(){s.log_("Timed out trying to connect."),s.onClosed_(),s.connectTimeoutTimer_=null},Math.floor(3e4)),n=function(){var t;s.isClosed_||(s.scriptTagHolder=new Yh(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Eo(t,5),r=n[0],i=n[1],o=n[2];n[3],n[4];if(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=Eo(t,2),r=n[0],n=n[1];s.incrementIncomingBytes_(t),s.myPacketOrderer.handleResponse(r,n)},function(){s.onClosed_()},s.urlFn),(t={start:"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),s.applicationId&&(t.p=s.applicationId),"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(Da)&&(t.r="f"),t=s.urlFn(t),s.log_("Connecting via long-poll to "+t),s.scriptTagHolder.addTag(t,function(){}))},"complete"===document.readyState?n():(r=!1,i=function(){document.body?r||(r=!0,n()):setTimeout(i,Math.floor(10))},document.addEventListener?(document.addEventListener("DOMContentLoaded",i,!1),window.addEventListener("load",i,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&i()}),window.attachEvent("onload",i)))},Qh.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},Qh.forceAllow=function(){Qh.forceAllow_=!0},Qh.forceDisallow=function(){Qh.forceDisallow_=!0},Qh.isAvailable=function(){return!!Qh.forceAllow_||!(Qh.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)},Qh.prototype.markConnectionHealthy=function(){},Qh.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)},Qh.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},Qh.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},Qh.prototype.send=function(t){t=$o(t);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);for(var t=function(t){t=So(t);return Oo.encodeByteArray(t,!0)}(t),e=ua(t,1840),n=0;n<e.length;n++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,e.length,e[n]),this.curSegmentNum++},Qh.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)},Qh.prototype.incrementIncomingBytes_=function(t){t=$o(t).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)},Qh);function Qh(t,e,n,r,i){this.connId=t,this.repoInfo=e,this.applicationId=n,this.transportSessionId=r,this.lastSessionId=i,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=ma(t),this.stats_=Ch.getCollection(e),this.urlFn=function(t){return e.connectionURL(La,t)}}var Yh=(Xh.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||ga("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},Xh.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())},Xh.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},Xh.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 t=this.urlFn(t),e="",n=0;0<this.pendingSegs.length;){if(!(this.pendingSegs[0].d.length+30+e.length<=1870))break;var r=this.pendingSegs.shift(),e=e+"&seg"+n+"="+r.seg+"&ts"+n+"="+r.ts+"&d"+n+"="+r.d;n++}return t+=e,this.addLongPollTag_(t,this.currentSerial),!0}return!1},Xh.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},Xh.prototype.addLongPollTag_=function(t,e){var n=this;this.outstandingRequests.add(e);function r(){n.outstandingRequests.delete(e),n.newRequest_()}var i=setTimeout(r,Math.floor(25e3));this.addTag(t,function(){clearTimeout(i),r()})},Xh.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(){ga("Long-poll script failed to load: "+t),r.sendNewPolls=!1,r.close()},r.myIFrame.doc.body.appendChild(e)}catch(t){}},Math.floor(1))},Xh);function Xh(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=pa(),window[Gh+this.uniqueCallbackIdentifier]=t,window[Kh+this.uniqueCallbackIdentifier]=e,this.myIFrame=Xh.createIFrame_();e="";this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length)&&(e='<script>document.domain="'+document.domain+'";<\/script>');var i="<html><body>"+e+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(i),this.myIFrame.doc.close()}catch(t){ga("frame writing exception"),t.stack&&ga(t.stack),ga(t)}}var $h="";function Jh(t){$h=t}var Zh=null;"undefined"!=typeof MozWebSocket?Zh=MozWebSocket:"undefined"!=typeof WebSocket&&(Zh=WebSocket);var tl=(el.connectionURL_=function(t,e,n){var r={v:"5"};return"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(Da)&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),t.connectionURL(xa,r)},el.prototype.open=function(e,t){var n,r=this;this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,ha.set("previous_websocket_failure",!0);try{jo()||(n={headers:{"X-Firebase-GMPID":this.applicationId||""}},this.mySock=new Zh(this.connURL,[],n))}catch(t){this.log_("Error instantiating WebSocket.");e=t.message||t.data;return e&&this.log_(e),void this.onClosed_()}this.mySock.onopen=function(){r.log_("Websocket connected."),r.everConnected_=!0},this.mySock.onclose=function(){r.log_("Websocket connection was disconnected."),r.mySock=null,r.onClosed_()},this.mySock.onmessage=function(t){r.handleIncomingFrame(t)},this.mySock.onerror=function(t){r.log_("WebSocket error. Closing connection.");t=t.message||t.data;t&&r.log_(t),r.onClosed_()}},el.prototype.start=function(){},el.forceDisallow=function(){el.forceDisallow_=!0},el.isAvailable=function(){var t,e=!1;return"undefined"!=typeof navigator&&navigator.userAgent&&((t=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/))&&1<t.length&&parseFloat(t[1])<4.4&&(e=!0)),!e&&null!==Zh&&!el.forceDisallow_},el.previouslyFailed=function(){return ha.isInMemoryStorage||!0===ha.get("previous_websocket_failure")},el.prototype.markConnectionHealthy=function(){ha.remove("previous_websocket_failure")},el.prototype.appendFrame_=function(t){this.frames.push(t),this.frames.length===this.totalFrames&&(t=this.frames.join(""),this.frames=null,t=Xo(t),this.onMessage(t))},el.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},el.prototype.extractFrameCount_=function(t){if(Ao(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},el.prototype.handleIncomingFrame=function(t){null!==this.mySock&&(t=t.data,this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),null!==this.frames?this.appendFrame_(t):null!==(t=this.extractFrameCount_(t))&&this.appendFrame_(t))},el.prototype.send=function(t){this.resetKeepAlive();t=$o(t);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);var e=ua(t,16384);1<e.length&&this.sendString_(String(e.length));for(var n=0;n<e.length;n++)this.sendString_(e[n])},el.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},el.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},el.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},el.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(function(){t.mySock&&t.sendString_("0"),t.resetKeepAlive()},Math.floor(45e3))},el.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)}},el.responsesRequiredToBeHealthy=2,el.healthyTimeout=3e4,el);function el(t,e,n,r,i){this.connId=t,this.applicationId=n,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=ma(this.connId),this.stats_=Ch.getCollection(e),this.connURL=el.connectionURL_(e,r,i),this.nodeAdmin=e.nodeAdmin}var nl=(Object.defineProperty(rl,"ALL_TRANSPORTS",{get:function(){return[zh,tl]},enumerable:!1,configurable:!0}),rl.prototype.initTransports_=function(t){var e,n,r=tl&&tl.isAvailable(),i=r&&!tl.previouslyFailed();if(t.webSocketOnly&&(r||ia("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)this.transports_=[tl];else{var o=this.transports_=[];try{for(var s=wo(rl.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}}}},rl.prototype.initialTransport=function(){if(0<this.transports_.length)return this.transports_[0];throw new Error("No transports available")},rl.prototype.upgradeTransport=function(){return 1<this.transports_.length?this.transports_[1]:null},rl);function rl(t){this.initTransports_(t)}var il=(ol.prototype.start_=function(){var t=this,e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,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));e=e.healthyTimeout||0;0<e&&(this.healthyTimeout_=Ca(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(e)))},ol.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},ol.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")}},ol.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"))}},ol.prototype.sendRequest=function(t){t={t:"d",d:t};this.sendData_(t)},ol.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)},ol.prototype.onSecondaryControl_=function(t){"t"in t&&("a"===(t=t.t)?this.upgradeIfSecondaryHealthy_():"r"===t?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===t&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_()))},ol.prototype.onSecondaryMessageReceived_=function(t){var e=aa("t",t),t=aa("d",t);if("c"===e)this.onSecondaryControl_(t);else{if("d"!==e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(t)}},ol.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:{}}}))},ol.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()},ol.prototype.onPrimaryMessageReceived_=function(t){var e=aa("t",t),t=aa("d",t);"c"===e?this.onControl_(t):"d"===e&&this.onDataMessage_(t)},ol.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},ol.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},ol.prototype.onControl_=function(t){var e=aa("t",t);if("d"in t){t=t.d;if("h"===e)this.onHandshake_(t);else if("n"===e){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var n=0;n<this.pendingDataMessages.length;++n)this.onDataMessage_(this.pendingDataMessages[n]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===e?this.onConnectionShutdown_(t):"r"===e?this.onReset_(t):"e"===e?na("Server Error: "+t):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):na("Unknown control packet command: "+e)}},ol.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&&ia("Protocol version mismatch detected"),this.tryStartUpgrade_())},ol.prototype.tryStartUpgrade_=function(){var t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)},ol.prototype.startUpgrade_=function(t){var e=this;this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.secondaryConn_),t=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,t),Ca(function(){e.secondaryConn_&&(e.log_("Timed out trying to upgrade."),e.secondaryConn_.close())},Math.floor(6e4))},ol.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_())},ol.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):Ca(function(){n.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))},ol.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},ol.prototype.onSecondaryConnectionLost_=function(){var t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()},ol.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()&&(ha.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()},ol.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()},ol.prototype.sendData_=function(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)},ol.prototype.close=function(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))},ol.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)},ol);function ol(t,e,n,r,i,o,s,a){this.id=t,this.repoInfo_=e,this.applicationId_=n,this.onMessage_=r,this.onReady_=i,this.onDisconnect_=o,this.onKill_=s,this.lastSessionId=a,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=ma("c:"+this.id+":"),this.transportManager_=new nl(e),this.log_("Connection created"),this.start_()}sl.prototype.put=function(t,e,n,r){},sl.prototype.merge=function(t,e,n,r){},sl.prototype.refreshAuthToken=function(t){},sl.prototype.onDisconnectPut=function(t,e,n){},sl.prototype.onDisconnectMerge=function(t,e,n){},sl.prototype.onDisconnectCancel=function(t,e){},sl.prototype.reportStats=function(t){},du=sl;function sl(){}var al,ul=1e3,cl=3e5,hl=(go(ll,al=du),ll.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,e={r:r,a:t,b:e};this.log_($o(e)),Ao(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(e),n&&(this.requestCBHash_[r]=n)},ll.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),Ao(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),Ao(!this.listens.get(o).has(i),"listen() called twice for same path/queryId.");n={onComplete:r,hashFn:e,query:t,tag:n};this.listens.get(o).set(i,n),this.connected_&&this.sendListen_(n)},ll.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;ll.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))})},ll.warnOnListenWarnings_=function(t,e){t&&"object"==typeof t&&Zo(t,"w")&&(t=ts(t,"w"),Array.isArray(t)&&~t.indexOf("no_index")&&(t='".indexOn": "'+e.getQueryParams().getIndex().toString()+'"',e=e.path.toString(),ia("Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding "+t+" at "+e+" to your security rules for better performance.")))},ll.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)},ll.prototype.reduceReconnectDelayIfAdminCredential_=function(t){(t&&40===t.length||function(t){t=Jo(t).claims;return"object"==typeof t&&!0===t.admin}(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},ll.prototype.tryAuth=function(){var n,t,e,r=this;this.connected_&&this.authToken_&&(t=function(t){t=Jo(t).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")}(n=this.authToken_)?"auth":"gauth",e={cred:n},null===this.authOverride_?e.noauth=!0:"object"==typeof this.authOverride_&&(e.authvar=this.authOverride_),this.sendRequest(t,e,function(t){var e=t.s,t=t.d||"error";r.authToken_===n&&("ok"===e?r.invalidAuthTokenCount_=0:r.onAuthRevoked_(e,t))}))},ll.prototype.unlisten=function(t,e){var n=t.path.toString(),r=t.queryIdentifier();this.log_("Unlisten called for "+n+" "+r),Ao(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)},ll.prototype.sendUnlisten_=function(t,e,n,r){this.log_("Unlisten on "+t+" for "+e);t={p:t};r&&(t.q=n,t.t=r),this.sendRequest("n",t)},ll.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})},ll.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})},ll.prototype.onDisconnectCancel=function(t,e){this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},ll.prototype.sendOnDisconnect_=function(t,e,n,r){n={p:e,d:n};this.log_("onDisconnect "+t,n),this.sendRequest(t,n,function(t){r&&setTimeout(function(){r(t.s,t.d)},Math.floor(0))})},ll.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},ll.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},ll.prototype.putInternal=function(t,e,n,r,i){n={p:e,d:n};void 0!==i&&(n.h=i),this.outstandingPuts_.push({action:t,request:n,onComplete:r}),this.outstandingPutCount_++;r=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(r):this.log_("Buffering put: "+e)},ll.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)})},ll.prototype.reportStats=function(t){var e=this;this.connected_&&(t={c:t},this.log_("reportStats",t),this.sendRequest("s",t,function(t){"ok"!==t.s&&(t=t.d,e.log_("reportStats","Error sending stats: "+t))}))},ll.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+$o(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)}},ll.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):na("Unrecognized action received from server: "+$o(t)+"\nAre you using the latest client?")},ll.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)},ll.prototype.scheduleConnect_=function(t){var e=this;Ao(!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))},ll.prototype.onVisible_=function(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=ul,this.realtime_||this.scheduleConnect_(0)),this.visible_=t},ll.prototype.onOnline_=function(t){t?(this.log_("Browser went online."),this.reconnectDelay_=ul,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())},ll.prototype.onRealtimeDisconnect_=function(){var t;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_=ul),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime()),t=(new Date).getTime()-this.lastConnectionAttemptTime_,t=Math.max(0,this.reconnectDelay_-t),t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)),this.onConnectStatus_(!1)},ll.prototype.establishConnection_=function(){var e,n,r,i,o,s,a,u,c,t,h=this;this.shouldReconnect_()&&(this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null,e=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+ll.nextConnectionId_++,s=(o=this).lastSessionId,a=!1,u=null,c=function(){u?u.close():(a=!0,r())},this.realtime_={close:c,sendRequest:function(t){Ao(u,"sendRequest call when we're not connected not allowed."),u.sendRequest(t)}},t=this.forceTokenRefresh_,this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(t).then(function(t){a?ga("getToken() completed but was canceled"):(ga("getToken() completed. Creating connection."),o.authToken_=t&&t.accessToken,u=new il(i,o.repoInfo_,o.applicationId_,e,n,r,function(t){ia(t+" ("+o.repoInfo_.toString()+")"),o.interrupt("server_kill")},s))}).then(null,function(t){o.log_("Failed to get token: "+t),a||(h.repoInfo_.nodeAdmin&&ia(t),c())}))},ll.prototype.interrupt=function(t){ga("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_())},ll.prototype.resume=function(t){ga("Resuming connection for reason: "+t),delete this.interruptReasons_[t],es(this.interruptReasons_)&&(this.reconnectDelay_=ul,this.realtime_||this.scheduleConnect_(0))},ll.prototype.handleTimestamp_=function(t){t-=(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:t})},ll.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_=[])},ll.prototype.onListenRevoked_=function(t,e){e=e?e.map(function(t){return Ea(t)}).join("$"):"default",e=this.removeListen_(t,e);e&&e.onComplete&&e.onComplete("permission_denied")},ll.prototype.removeListen_=function(t,e){var n,r=new ka(t).toString();return this.listens.has(r)?(n=(t=this.listens.get(r)).get(e),t.delete(e),0===t.size&&this.listens.delete(r)):n=void 0,n},ll.prototype.onAuthRevoked_=function(t,e){ga("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()))},ll.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},ll.prototype.restoreState_=function(){var e,t,n,r;this.tryAuth();try{for(var i=wo(this.listens.values()),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,wo(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)}},ll.prototype.sendConnectStats_=function(){var t={};t["sdk.js."+$h.replace(/\./g,"-")]=1,Mo()?t["framework.cordova"]=1:Uo()&&(t["framework.reactnative"]=1),this.reportStats(t)},ll.prototype.shouldReconnect_=function(){var t=qh.getInstance().currentlyOnline();return es(this.interruptReasons_)&&t},ll.nextPersistentConnectionId_=0,ll.nextConnectionId_=0,ll);function ll(t,e,n,r,i,o,s){var a=al.call(this)||this;if(a.repoInfo_=t,a.applicationId_=e,a.onDataUpdate_=n,a.onConnectStatus_=r,a.onServerInfoUpdate_=i,a.authTokenProvider_=o,a.authOverride_=s,a.id=ll.nextPersistentConnectionId_++,a.log_=ma("p:"+a.id+":"),a.interruptReasons_={},a.listens=new Map,a.outstandingPuts_=[],a.outstandingPutCount_=0,a.onDisconnectRequestQueue_=[],a.connected_=!1,a.reconnectDelay_=ul,a.maxReconnectDelay_=cl,a.securityDebugCallback_=null,a.lastSessionId=null,a.establishConnectionTimer_=null,a.visible_=!1,a.requestCBHash_={},a.requestNumber_=0,a.realtime_=null,a.authToken_=null,a.forceTokenRefresh_=!1,a.invalidAuthTokenCount_=0,a.firstConnection_=!0,a.lastConnectionAttemptTime_=null,a.lastConnectionEstablishedTime_=null,s&&!jo())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");return a.scheduleConnect_(0),Uh.getInstance().on("visible",a.onVisible_,a),-1===t.host.indexOf("fblocal")&&qh.getInstance().on("online",a.onOnline_,a),a}var fl,pl=(go(dl,fl=du),dl.prototype.reportStats=function(t){throw new Error("Method not implemented.")},dl.getListenId_=function(t,e){return void 0!==e?"tag$"+e:(Ao(t.getQueryParams().isDefault(),"should have a tag if it's not a default query."),t.path.toString())},dl.prototype.listen=function(t,e,n,r){var i=this,o=t.path.toString();this.log_("Listen called for "+o+" "+t.queryIdentifier());var s=dl.getListenId_(t,n),a={};this.listens_[s]=a;t=t.getQueryParams().toRestQueryStringParameters();this.restRequest_(o+".json",t,function(t,e){404===t&&(t=e=null),null===t&&i.onDataUpdate_(o,e,!1,n),ts(i.listens_,s)===a&&r(t?401===t?"permission_denied":"rest_error:"+t:"ok",null)})},dl.prototype.unlisten=function(t,e){e=dl.getListenId_(t,e);delete this.listens_[e]},dl.prototype.refreshAuthToken=function(t){},dl.prototype.restRequest_=function(r,i,o){var s=this;void 0===i&&(i={}),i.format="export",this.authTokenProvider_.getToken(!1).then(function(t){t=t&&t.accessToken;t&&(i.auth=t);var e=(s.repoInfo_.secure?"https://":"http://")+s.repoInfo_.host+r+"?ns="+s.repoInfo_.namespace+function(t){for(var n=[],e=0,r=Object.entries(t);e<r.length;e++){var i=r[e];!function(e,t){Array.isArray(t)?t.forEach(function(t){n.push(encodeURIComponent(e)+"="+encodeURIComponent(t))}):n.push(encodeURIComponent(e)+"="+encodeURIComponent(t))}(i[0],i[1])}return n.length?"&"+n.join("&"):""}(i);s.log_("Sending REST request for "+e);var n=new XMLHttpRequest;n.onreadystatechange=function(){if(o&&4===n.readyState){s.log_("REST Response for "+e+" received. status:",n.status,"response:",n.responseText);var t=null;if(200<=n.status&&n.status<300){try{t=Xo(n.responseText)}catch(t){ia("Failed to parse JSON response for "+e+": "+n.responseText)}o(null,t)}else 401!==n.status&&404!==n.status&&ia("Got unsuccessful REST response for "+e+" Status: "+n.status),o(n.status);o=null}},n.open("GET",e,!0),n.send()})},dl);function dl(t,e,n){var r=fl.call(this)||this;return r.repoInfo_=t,r.onDataUpdate_=e,r.authTokenProvider_=n,r.log_=ma("p:rest:"),r.listens_={},r}var vl="repo_interrupt",yl=(gl.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},gl.prototype.name=function(){return this.repoInfo_.namespace},gl.prototype.serverTime=function(){var t=this.infoData_.getNode(new ka(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t},gl.prototype.generateServerValues=function(){return(t=(t={timestamp:this.serverTime()})||{}).timestamp=t.timestamp||(new Date).getTime(),t;var t},gl.prototype.onDataUpdate_=function(t,e,n,r){this.dataUpdateCount++;var i=new ka(t);e=this.interceptServerDataCallback_?this.interceptServerDataCallback_(t,e):e;var o,s=[],t=i;0<(s=r?n?(o=ns(e,function(t){return Zu(t)}),this.serverSyncTree_.applyTaggedQueryMerge(i,o,r)):(o=Zu(e),this.serverSyncTree_.applyTaggedQueryOverwrite(i,o,r)):n?(n=ns(e,function(t){return Zu(t)}),this.serverSyncTree_.applyServerMerge(i,n)):(e=Zu(e),this.serverSyncTree_.applyServerOverwrite(i,e))).length&&(t=this.rerunTransactions_(i)),this.eventQueue_.raiseEventsForChangedPath(t,s)},gl.prototype.interceptServerData_=function(t){this.interceptServerDataCallback_=t},gl.prototype.onConnectStatus_=function(t){this.updateInfo_("connected",t),!1===t&&this.runOnDisconnectEvents_()},gl.prototype.onServerInfoUpdate_=function(t){var n=this;Ia(t,function(t,e){n.updateInfo_(t,e)})},gl.prototype.updateInfo_=function(t,e){t=new ka("/.info/"+t),e=Zu(e);this.infoData_.updateSnapshot(t,e);e=this.infoSyncTree_.applyServerOverwrite(t,e);this.eventQueue_.raiseEventsForChangedPath(t,e)},gl.prototype.getNextWriteId_=function(){return this.nextWriteId_++},gl.prototype.setWithPriority=function(r,t,e,i){var o=this;this.log_("set",{path:r.toString(),value:t,priority:e});var n=this.generateServerValues(),t=Zu(t,e),e=this.serverSyncTree_.calcCompleteEventCache(r),n=Ic(t,e,n),s=this.getNextWriteId_(),n=this.serverSyncTree_.applyUserOverwrite(r,n,s,!0);this.eventQueue_.queueEvents(n),this.server_.put(r.toString(),t.val(!0),function(t,e){var n="ok"===t;n||ia("set at "+r+" failed: "+t);n=o.serverSyncTree_.ackUserWrite(s,!n);o.eventQueue_.raiseEventsForChangedPath(r,n),o.callOnCompleteCallback(i,t,e)});t=this.abortTransactions_(r);this.rerunTransactions_(t),this.eventQueue_.raiseEventsForChangedPath(t,[])},gl.prototype.update=function(i,t,o){var s=this;this.log_("update",{path:i.toString(),value:t});var a,e,n=!0,r=this.generateServerValues(),u={};Ia(t,function(t,e){n=!1,u[t]=Ec(i.child(t),Zu(e),s.serverSyncTree_,r)}),n?(ga("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(o,"ok")):(a=this.getNextWriteId_(),e=this.serverSyncTree_.applyUserMerge(i,u,a),this.eventQueue_.queueEvents(e),this.server_.merge(i.toString(),t,function(t,e){var n="ok"===t;n||ia("update at "+i+" failed: "+t);var r=s.serverSyncTree_.ackUserWrite(a,!n),n=0<r.length?s.rerunTransactions_(i):i;s.eventQueue_.raiseEventsForChangedPath(n,r),s.callOnCompleteCallback(o,t,e)}),Ia(t,function(t){t=s.abortTransactions_(i.child(t));s.rerunTransactions_(t)}),this.eventQueue_.raiseEventsForChangedPath(i,[]))},gl.prototype.runOnDisconnectEvents_=function(){var n=this;this.log_("onDisconnectEvents");var r=this.generateServerValues(),i=new kc;this.onDisconnect_.forEachTree(ka.Empty,function(t,e){e=Ec(t,e,n.serverSyncTree_,r);i.remember(t,e)});var o=[];i.forEachTree(ka.Empty,function(t,e){o=o.concat(n.serverSyncTree_.applyServerOverwrite(t,e));t=n.abortTransactions_(t);n.rerunTransactions_(t)}),this.onDisconnect_=new kc,this.eventQueue_.raiseEventsForChangedPath(ka.Empty,o)},gl.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)})},gl.prototype.onDisconnectSet=function(n,t,r){var i=this,o=Zu(t);this.server_.onDisconnectPut(n.toString(),o.val(!0),function(t,e){"ok"===t&&i.onDisconnect_.remember(n,o),i.callOnCompleteCallback(r,t,e)})},gl.prototype.onDisconnectSetWithPriority=function(n,t,e,r){var i=this,o=Zu(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)})},gl.prototype.onDisconnectUpdate=function(n,r,i){var o=this;if(es(r))return ga("onDisconnect().update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(i,"ok");this.server_.onDisconnectMerge(n.toString(),r,function(t,e){"ok"===t&&Ia(r,function(t,e){e=Zu(e);o.onDisconnect_.remember(n.child(t),e)}),o.callOnCompleteCallback(i,t,e)})},gl.prototype.addEventCallbackForQuery=function(t,e){e=(".info"===t.path.getFront()?this.infoSyncTree_:this.serverSyncTree_).addEventRegistration(t,e);this.eventQueue_.raiseEventsAtPath(t.path,e)},gl.prototype.removeEventCallbackForQuery=function(t,e){e=(".info"===t.path.getFront()?this.infoSyncTree_:this.serverSyncTree_).removeEventRegistration(t,e);this.eventQueue_.raiseEventsAtPath(t.path,e)},gl.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt(vl)},gl.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume(vl)},gl.prototype.stats=function(t){var i;void 0===t&&(t=!1),"undefined"!=typeof console&&(t=t?(this.statsListener_||(this.statsListener_=new Ah(this.stats_)),this.statsListener_.get()):this.stats_.get(),i=Object.keys(t).reduce(function(t,e){return Math.max(e.length,t)},0),Ia(t,function(t,e){for(var n=t,r=t.length;r<i+2;r++)n+=" ";console.log(n+e)}))},gl.prototype.statsIncrementCounter=function(t){this.stats_.incrementCounter(t),this.statsReporter_.includeStat(t)},gl.prototype.log_=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="";this.persistentConnection_&&(n=this.persistentConnection_.id+":"),ga.apply(void 0,Io([n],t))},gl.prototype.callOnCompleteCallback=function(n,r,i){n&&Sa(function(){var t,e;"ok"===r?n(null):(e=t=(r||"error").toUpperCase(),i&&(e+=": "+i),(e=new Error(e)).code=t,n(e))})},Object.defineProperty(gl.prototype,"database",{get:function(){return this.__database||(this.__database=new Ul(this))},enumerable:!1,configurable:!0}),gl);function gl(t,e,n,r){var s=this;if(this.repoInfo_=t,this.app=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Ph,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new kc,this.persistentConnection_=null,this.stats_=Ch.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 pl(this.repoInfo_,this.onDataUpdate_.bind(this),r),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var i=n.options.databaseAuthVariableOverride;if(null!=i){if("object"!=typeof i)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{$o(i)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}this.persistentConnection_=new hl(this.repoInfo_,n.options.appId,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),r,i),this.server_=this.persistentConnection_}r.addTokenChangeListener(function(t){s.server_.refreshAuthToken(t)}),this.statsReporter_=Ch.getOrCreateReporter(t,function(){return new Oh(s.stats_,s.server_)}),this.transactionsInit_(),this.infoData_=new Eh,this.infoSyncTree_=new _h({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 _h({startListening:function(n,t,e,r){return s.server_.listen(n,e,t,function(t,e){e=r(t,e);s.eventQueue_.raiseEventsForChangedPath(n.path,e)}),[]},stopListening:function(t,e){s.server_.unlisten(t,e)}})}var ml=(bl.prototype.getStartPost=function(){return this.startPost_},bl.prototype.getEndPost=function(){return this.endPost_},bl.prototype.matches=function(t){return this.index_.compare(this.getStartPost(),t)<=0&&this.index_.compare(t,this.getEndPost())<=0},bl.prototype.updateChild=function(t,e,n,r,i,o){return this.matches(new cu(e,n))||(n=zu.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,r,i,o)},bl.prototype.updateFullNode=function(t,e,n){e.isLeafNode()&&(e=zu.EMPTY_NODE);var r=(r=e.withIndex(this.index_)).updatePriority(zu.EMPTY_NODE),i=this;return e.forEachChild(Nu,function(t,e){i.matches(new cu(t,e))||(r=r.updateImmediateChild(t,zu.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,r,n)},bl.prototype.updatePriority=function(t,e){return t},bl.prototype.filtersNodes=function(){return!0},bl.prototype.getIndexedFilter=function(){return this.indexedFilter_},bl.prototype.getIndex=function(){return this.index_},bl.getStartPost_=function(t){if(t.hasStart()){var e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()},bl.getEndPost_=function(t){if(t.hasEnd()){var e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()},bl);function bl(t){this.indexedFilter_=new Xc(t.getIndex()),this.index_=t.getIndex(),this.startPost_=bl.getStartPost_(t),this.endPost_=bl.getEndPost_(t)}var _l=(wl.prototype.updateChild=function(t,e,n,r,i,o){return this.rangedFilter_.matches(new cu(e,n))||(n=zu.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)},wl.prototype.updateFullNode=function(t,e,n){var r;if(e.isLeafNode()||e.isEmpty())r=zu.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<e.numChildren()&&e.isIndexed(this.index_)){r=zu.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(zu.EMPTY_NODE);var a,u=void 0,c=void 0,h=void 0,i=void 0;h=this.reverse_?(i=r.getReverseIterator(this.index_),u=this.rangedFilter_.getEndPost(),c=this.rangedFilter_.getStartPost(),a=this.index_.getCompare(),function(t,e){return a(e,t)}):(i=r.getIterator(this.index_),u=this.rangedFilter_.getStartPost(),c=this.rangedFilter_.getEndPost(),this.index_.getCompare());for(var o=0,l=!1;i.hasNext();){s=i.getNext();!l&&h(u,s)<=0&&(l=!0),l&&o<this.limit_&&h(s,c)<=0?o++:r=r.updateImmediateChild(s.name,zu.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,r,n)},wl.prototype.updatePriority=function(t,e){return t},wl.prototype.filtersNodes=function(){return!0},wl.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},wl.prototype.getIndex=function(){return this.index_},wl.prototype.fullLimitUpdateChild_=function(t,e,n,r,i){var o,s;s=this.reverse_?(o=this.index_.getCompare(),function(t,e){return o(e,t)}):this.index_.getCompare();var a=t;Ao(a.numChildren()===this.limit_,"");var u=new cu(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:s(f,u);if(h&&!n.isEmpty()&&0<=p)return null!=i&&i.trackChildChange(Qc.childChangedChange(e,n,l)),a.updateImmediateChild(e,n);null!=i&&i.trackChildChange(Qc.childRemovedChange(e,l));l=a.updateImmediateChild(e,zu.EMPTY_NODE);return null!=f&&this.rangedFilter_.matches(f)?(null!=i&&i.trackChildChange(Qc.childAddedChange(f.name,f.node)),l.updateImmediateChild(f.name,f.node)):l}return!n.isEmpty()&&h&&0<=s(c,u)?(null!=i&&(i.trackChildChange(Qc.childRemovedChange(c.name,c.node)),i.trackChildChange(Qc.childAddedChange(e,n))),a.updateImmediateChild(e,n).updateImmediateChild(c.name,zu.EMPTY_NODE)):t},wl);function wl(t){this.rangedFilter_=new ml(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft()}var El=(Il.prototype.hasStart=function(){return this.startSet_},Il.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===Il.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},Il.prototype.getIndexStartValue=function(){return Ao(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},Il.prototype.getIndexStartName=function(){return Ao(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:ba},Il.prototype.hasEnd=function(){return this.endSet_},Il.prototype.getIndexEndValue=function(){return Ao(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},Il.prototype.getIndexEndName=function(){return Ao(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:_a},Il.prototype.hasLimit=function(){return this.limitSet_},Il.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},Il.prototype.getLimit=function(){return Ao(this.limitSet_,"Only valid if limit has been set"),this.limit_},Il.prototype.getIndex=function(){return this.index_},Il.prototype.copy_=function(){var t=new Il;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},Il.prototype.limit=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_="",e},Il.prototype.limitToFirst=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_=Il.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,e},Il.prototype.limitToLast=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_=Il.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,e},Il.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},Il.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},Il.prototype.orderBy=function(t){var e=this.copy_();return e.index_=t,e},Il.prototype.getQueryObject=function(){var t,e=Il.WIRE_PROTOCOL_CONSTANTS_,n={};return this.startSet_&&(n[e.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&&(n[e.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&&(n[e.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&&(n[e.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_&&(n[e.LIMIT]=this.limit_,""===(t=this.viewFrom_)&&(t=this.isViewFromLeft()?e.VIEW_FROM_LEFT:e.VIEW_FROM_RIGHT),n[e.VIEW_FROM]=t),this.index_!==Nu&&(n[e.INDEX]=this.index_.toString()),n},Il.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},Il.prototype.isDefault=function(){return this.loadsAllData()&&this.index_===Nu},Il.prototype.getNodeFilter=function(){return this.loadsAllData()?new Xc(this.getIndex()):new(this.hasLimit()?_l:ml)(this)},Il.prototype.toRestQueryStringParameters=function(){var t,e=Il.REST_QUERY_CONSTANTS_,n={};return this.isDefault()||(t=this.index_===Nu?e.PRIORITY_INDEX:this.index_===nc?e.VALUE_INDEX:this.index_===gu?e.KEY_INDEX:(Ao(this.index_ instanceof rc,"Unrecognized index type!"),this.index_.toString()),n[e.ORDER_BY]=$o(t),this.startSet_&&(n[e.START_AT]=$o(this.indexStartValue_),this.startNameSet_&&(n[e.START_AT]+=","+$o(this.indexStartName_))),this.endSet_&&(n[e.END_AT]=$o(this.indexEndValue_),this.endNameSet_&&(n[e.END_AT]+=","+$o(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?n[e.LIMIT_TO_FIRST]=this.limit_:n[e.LIMIT_TO_LAST]=this.limit_)),n},Il.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"},Il.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"},Il.DEFAULT=new Il,Il);function Il(){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_=Nu}var Tl,Sl=(go(Cl,Tl=yc),Cl.prototype.getKey=function(){return cs("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},Cl.prototype.child=function(t){var e,n,r,i;return cs("Reference.child",1,1,arguments.length),"number"==typeof t?t=String(t):t instanceof ka||(null===this.path.getFront()?(e="Reference.child",i=!(n=1),r=(r=t)&&r.replace(/^\/*\.info(\/|$)/,"/"),za(e,n,r,i)):za("Reference.child",1,t,!1)),new Cl(this.repo,this.path.child(t))},Cl.prototype.getParent=function(){cs("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new Cl(this.repo,t)},Cl.prototype.getRoot=function(){cs("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},Cl.prototype.databaseProp=function(){return this.repo.database},Cl.prototype.set=function(t,e){cs("Reference.set",1,2,arguments.length),Qa("Reference.set",this.path),Ba("Reference.set",1,t,this.path,!1),ls("Reference.set",2,e,!0);var n=new Do;return this.repo.setWithPriority(this.path,t,null,n.wrapCallback(e)),n.promise},Cl.prototype.update=function(t,e){if(cs("Reference.update",1,2,arguments.length),Qa("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,ia("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.")}Wa("Reference.update",1,t,this.path,!1),ls("Reference.update",2,e,!0);var i=new Do;return this.repo.update(this.path,t,i.wrapCallback(e)),i.promise},Cl.prototype.setWithPriority=function(t,e,n){if(cs("Reference.setWithPriority",2,3,arguments.length),Qa("Reference.setWithPriority",this.path),Ba("Reference.setWithPriority",1,t,this.path,!1),Ha("Reference.setWithPriority",2,e,!1),ls("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 Do;return this.repo.setWithPriority(this.path,t,e,r.wrapCallback(n)),r.promise},Cl.prototype.remove=function(t){return cs("Reference.remove",0,1,arguments.length),Qa("Reference.remove",this.path),ls("Reference.remove",1,t,!0),this.set(null,t)},Cl.prototype.transaction=function(t,r,e){if(cs("Reference.transaction",1,3,arguments.length),Qa("Reference.transaction",this.path),ls("Reference.transaction",1,t,!1),ls("Reference.transaction",2,r,!0),function(t,e,n,r){if((!r||void 0!==n)&&"boolean"!=typeof n)throw new Error(hs(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 Do;"function"==typeof r&&i.promise.catch(function(){});return this.repo.startTransaction(this.path,t,function(t,e,n){t?i.reject(t):i.resolve(new ru(e,n)),"function"==typeof r&&r(t,e,n)},e),i.promise},Cl.prototype.setPriority=function(t,e){cs("Reference.setPriority",1,2,arguments.length),Qa("Reference.setPriority",this.path),Ha("Reference.setPriority",1,t,!1),ls("Reference.setPriority",2,e,!0);var n=new Do;return this.repo.setWithPriority(this.path.child(".priority"),t,null,n.wrapCallback(e)),n.promise},Cl.prototype.push=function(t,e){cs("Reference.push",0,2,arguments.length),Qa("Reference.push",this.path),Ba("Reference.push",1,t,this.path,!0),ls("Reference.push",2,e,!0);var n=this.repo.serverTime(),r=uu(n),n=this.child(r),i=this.child(r),t=null!=t?n.set(t,e).then(function(){return i}):Promise.resolve(i);return n.then=t.then.bind(t),n.catch=t.then.bind(t,void 0),"function"==typeof e&&t.catch(function(){}),n},Cl.prototype.onDisconnect=function(){return Qa("Reference.onDisconnect",this.path),new eu(this.repo,this.path)},Object.defineProperty(Cl.prototype,"database",{get:function(){return this.databaseProp()},enumerable:!1,configurable:!0}),Object.defineProperty(Cl.prototype,"key",{get:function(){return this.getKey()},enumerable:!1,configurable:!0}),Object.defineProperty(Cl.prototype,"parent",{get:function(){return this.getParent()},enumerable:!1,configurable:!0}),Object.defineProperty(Cl.prototype,"root",{get:function(){return this.getRoot()},enumerable:!1,configurable:!0}),Cl);function Cl(t,e){if(!(t instanceof yl))throw new Error("new Reference() no longer supported - use app.database().");return Tl.call(this,t,e,El.DEFAULT,!1)||this}yc.__referenceConstructor=Sl,fh.__referenceConstructor=Sl;var Nl,Al=function(){this.children={},this.childCount=0,this.value=null},kl=(Ol.prototype.subTree=function(t){for(var e=t instanceof ka?t:new ka(t),n=this,r=e.getFront();null!==r;)n=new Ol(r,n,ts(n.node_.children,r)||new Al),r=(e=e.popFront()).getFront();return n},Ol.prototype.getValue=function(){return this.node_.value},Ol.prototype.setValue=function(t){Ao(void 0!==t,"Cannot set value to undefined"),this.node_.value=t,this.updateParents_()},Ol.prototype.clear=function(){this.node_.value=null,this.node_.children={},this.node_.childCount=0,this.updateParents_()},Ol.prototype.hasChildren=function(){return 0<this.node_.childCount},Ol.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},Ol.prototype.forEachChild=function(n){var r=this;Ia(this.node_.children,function(t,e){n(new Ol(t,r,e))})},Ol.prototype.forEachDescendant=function(e,t,n){t&&!n&&e(this),this.forEachChild(function(t){t.forEachDescendant(e,!0,n)}),t&&n&&e(this)},Ol.prototype.forEachAncestor=function(t,e){for(var n=e?this:this.parent();null!==n;){if(t(n))return!0;n=n.parent()}return!1},Ol.prototype.forEachImmediateDescendantWithValue=function(e){this.forEachChild(function(t){null!==t.getValue()?e(t):t.forEachImmediateDescendantWithValue(e)})},Ol.prototype.path=function(){return new ka(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)},Ol.prototype.name=function(){return this.name_},Ol.prototype.parent=function(){return this.parent_},Ol.prototype.updateParents_=function(){null!==this.parent_&&this.parent_.updateChild_(this.name_,this)},Ol.prototype.updateChild_=function(t,e){var n=e.isEmpty(),r=Zo(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_())},Ol);function Ol(t,e,n){void 0===t&&(t=""),void 0===e&&(e=null),void 0===n&&(n=new Al),this.name_=t,this.parent_=e,this.node_=n}(K=Nl=Nl||{})[K.RUN=0]="RUN",K[K.SENT=1]="SENT",K[K.COMPLETED=2]="COMPLETED",K[K.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",K[K.NEEDS_ABORT=4]="NEEDS_ABORT",yl.MAX_TRANSACTION_RETRIES_=25,yl.prototype.transactionsInit_=function(){this.transactionQueueTree_=new kl},yl.prototype.startTransaction=function(t,e,n,r){this.log_("transaction on "+t);function i(){}var o=new Sl(this,t);o.on("value",i);var s={path:t,update:e,onComplete:n,status:null,order:pa(),applyLocally:r,retryCount:0,unwatcher:function(){o.off("value",i)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},e=this.getLatestState_(t);s.currentInputSnapshot=e;var a,n=s.update(e.val());void 0===n?(s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete&&(a=new oc(s.currentInputSnapshot,new Sl(this,s.path),Nu),s.onComplete(null,!1,a))):(tu("transaction failed: Data returned ",n,s.path),s.status=Nl.RUN,(a=(r=this.transactionQueueTree_.subTree(t)).getValue()||[]).push(s),r.setValue(a),r=void 0,"object"==typeof n&&null!==n&&Zo(n,".priority")?(r=ts(n,".priority"),Ao(qa(r),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):r=(this.serverSyncTree_.calcCompleteEventCache(t)||zu.EMPTY_NODE).getPriority().val(),a=this.generateServerValues(),r=Zu(n,r),a=Ic(r,e,a),s.currentOutputSnapshotRaw=r,s.currentOutputSnapshotResolved=a,s.currentWriteId=this.getNextWriteId_(),s=this.serverSyncTree_.applyUserOverwrite(t,a,s.currentWriteId,s.applyLocally),this.eventQueue_.raiseEventsForChangedPath(t,s),this.sendReadyTransactions_())},yl.prototype.getLatestState_=function(t,e){return this.serverSyncTree_.calcCompleteEventCache(t,e)||zu.EMPTY_NODE},yl.prototype.sendReadyTransactions_=function(t){var e,n=this;void 0===t&&(t=this.transactionQueueTree_),t||this.pruneCompletedTransactionsBelowNode_(t),null!==t.getValue()?(e=this.buildTransactionQueue_(t),Ao(0<e.length,"Sending zero length transaction queue"),e.every(function(t){return t.status===Nl.RUN})&&this.sendTransactionQueue_(t.path(),e)):t.hasChildren()&&t.forEachChild(function(t){n.sendReadyTransactions_(t)})},yl.prototype.sendTransactionQueue_=function(s,a){for(var u=this,t=a.map(function(t){return t.currentWriteId}),e=this.getLatestState_(s,t),n=e,t=e.hash(),r=0;r<a.length;r++){var i=a[r];Ao(i.status===Nl.RUN,"tryToSendTransactionQueue_: items in queue should all be run."),i.status=Nl.SENT,i.retryCount++;var o=ka.relativePath(s,i.path),n=n.updateChild(o,i.currentOutputSnapshotRaw)}var e=n.val(!0),c=s;this.server_.put(c.toString(),e,function(t){u.log_("transaction put response",{path:c.toString(),status:t});var e=[];if("ok"===t){for(var n,r,i=[],o=0;o<a.length;o++){a[o].status=Nl.COMPLETED,e=e.concat(u.serverSyncTree_.ackUserWrite(a[o].currentWriteId)),a[o].onComplete&&(n=a[o].currentOutputSnapshotResolved,r=new Sl(u,a[o].path),r=new oc(n,r,Nu),i.push(a[o].onComplete.bind(null,null,!0,r))),a[o].unwatcher()}u.pruneCompletedTransactionsBelowNode_(u.transactionQueueTree_.subTree(s)),u.sendReadyTransactions_(),u.eventQueue_.raiseEventsForChangedPath(s,e);for(o=0;o<i.length;o++)Sa(i[o])}else{if("datastale"===t)for(o=0;o<a.length;o++)a[o].status===Nl.SENT_NEEDS_ABORT?a[o].status=Nl.NEEDS_ABORT:a[o].status=Nl.RUN;else{ia("transaction at "+c.toString()+" failed: "+t);for(o=0;o<a.length;o++)a[o].status=Nl.NEEDS_ABORT,a[o].abortReason=t}u.rerunTransactions_(s)}},t)},yl.prototype.rerunTransactions_=function(t){var e=this.getAncestorTransactionNode_(t),t=e.path(),e=this.buildTransactionQueue_(e);return this.rerunTransactionQueue_(e,t),t},yl.prototype.rerunTransactionQueue_=function(t,e){if(0!==t.length){for(var n=[],r=[],i=t.filter(function(t){return t.status===Nl.RUN}).map(function(t){return t.currentWriteId}),o=0;o<t.length;o++){var s,a,u,c=t[o],h=ka.relativePath(e,c.path),l=!1,f=void 0;Ao(null!==h,"rerunTransactionsUnderNode_: relativePath should not be null."),c.status===Nl.NEEDS_ABORT?(l=!0,f=c.abortReason,r=r.concat(this.serverSyncTree_.ackUserWrite(c.currentWriteId,!0))):c.status===Nl.RUN&&(r=c.retryCount>=yl.MAX_TRANSACTION_RETRIES_?(l=!0,f="maxretry",r.concat(this.serverSyncTree_.ackUserWrite(c.currentWriteId,!0))):(s=this.getLatestState_(c.path,i),c.currentInputSnapshot=s,void 0!==(u=t[o].update(s.val()))?(tu("transaction failed: Data returned ",u,c.path),a=Zu(u),"object"==typeof u&&null!=u&&Zo(u,".priority")||(a=a.updatePriority(s.getPriority())),h=c.currentWriteId,u=this.generateServerValues(),u=Ic(a,s,u),c.currentOutputSnapshotRaw=a,c.currentOutputSnapshotResolved=u,c.currentWriteId=this.getNextWriteId_(),i.splice(i.indexOf(h),1),(r=r.concat(this.serverSyncTree_.applyUserOverwrite(c.path,u,c.currentWriteId,c.applyLocally))).concat(this.serverSyncTree_.ackUserWrite(h,!0))):(l=!0,f="nodata",r.concat(this.serverSyncTree_.ackUserWrite(c.currentWriteId,!0))))),this.eventQueue_.raiseEventsForChangedPath(e,r),r=[],l&&(t[o].status=Nl.COMPLETED,c=t[o].unwatcher,setTimeout(c,Math.floor(0)),t[o].onComplete&&("nodata"===f?(l=new Sl(this,t[o].path),c=t[o].currentInputSnapshot,l=new oc(c,l,Nu),n.push(t[o].onComplete.bind(null,null,!1,l))):n.push(t[o].onComplete.bind(null,new Error(f),!1,null))))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(o=0;o<n.length;o++)Sa(n[o]);this.sendReadyTransactions_()}},yl.prototype.getAncestorTransactionNode_=function(t){for(var e=this.transactionQueueTree_,n=t.getFront();null!==n&&null===e.getValue();)e=e.subTree(n),n=(t=t.popFront()).getFront();return e},yl.prototype.buildTransactionQueue_=function(t){var e=[];return this.aggregateTransactionQueuesForNode_(t,e),e.sort(function(t,e){return t.order-e.order}),e},yl.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)})},yl.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!==Nl.COMPLETED&&(n[r]=n[i],r++);n.length=r,t.setValue(0<n.length?n:null)}t.forEachChild(function(t){e.pruneCompletedTransactionsBelowNode_(t)})},yl.prototype.abortTransactions_=function(t){var e=this,n=this.getAncestorTransactionNode_(t).path(),t=this.transactionQueueTree_.subTree(t);return t.forEachAncestor(function(t){e.abortTransactionsOnNode_(t)}),this.abortTransactionsOnNode_(t),t.forEachDescendant(function(t){e.abortTransactionsOnNode_(t)}),n},yl.prototype.abortTransactionsOnNode_=function(t){var e=t.getValue();if(null!==e){for(var n=[],r=[],i=-1,o=0;o<e.length;o++){e[o].status===Nl.SENT_NEEDS_ABORT||(e[o].status===Nl.SENT?(Ao(i===o-1,"All SENT items should be at beginning of queue."),e[i=o].status=Nl.SENT_NEEDS_ABORT,e[o].abortReason="set"):(Ao(e[o].status===Nl.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++)Sa(n[o])}};var Rl=(Pl.prototype.getToken=function(t){return this.auth_?this.auth_.getToken(t).catch(function(t){return t&&"auth/token-not-initialized"===t.code?(ga("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t)}):Promise.resolve(null)},Pl.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)}))},Pl.prototype.removeTokenChangeListener=function(e){this.authProvider_.get().then(function(t){return t.removeAuthTokenListener(e)})},Pl.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/.',ia(t)},Pl);function Pl(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 Dl=(xl.prototype.getToken=function(t){return Promise.resolve({accessToken:xl.EMULATOR_AUTH_TOKEN})},xl.prototype.addTokenChangeListener=function(t){t(xl.EMULATOR_AUTH_TOKEN)},xl.prototype.removeTokenChangeListener=function(t){},xl.prototype.notifyForInvalidToken=function(){},xl.EMULATOR_AUTH_TOKEN="owner",xl);function xl(){}var Ll,Ml=(Fl.getInstance=function(){return Ll=Ll||new Fl},Fl.prototype.interrupt=function(){var e,t,n,r;try{for(var i=wo(Object.keys(this.repos_)),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,wo(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}}},Fl.prototype.resume=function(){var e,t,n,r;try{for(var i=wo(Object.keys(this.repos_)),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,wo(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}}},Fl.prototype.databaseFromApp=function(t,e,n,r){var i=n||t.options.databaseURL;void 0===i&&(t.options.projectId||ra("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),ga("Using default host for project ",t.options.projectId),i=t.options.projectId+"-default-rtdb.firebaseio.com");var o,s=Ua(i,r),a=s.repoInfo,n=void 0;"undefined"!=typeof process&&(n=process.env.FIREBASE_DATABASE_EMULATOR_HOST),n?(o=!0,i="http://"+n+"?ns="+a.namespace,a=(s=Ua(i,r)).repoInfo):o=!s.repoInfo.secure;e=r&&o?new Dl:new Rl(t,e);return Ya("Invalid Firebase Database URL",1,s),s.path.isEmpty()||ra("Database URL must point to the root of a Firebase Database (not including a child path)."),this.createRepo(a,t,e).database},Fl.prototype.deleteRepo=function(t){var e=ts(this.repos_,t.app.name);e&&ts(e,t.repoInfo_.toURLString())===t||ra("Database "+t.app.name+"("+t.repoInfo_+") has already been deleted."),t.interrupt(),delete e[t.repoInfo_.toURLString()]},Fl.prototype.createRepo=function(t,e,n){var r=ts(this.repos_,e.name);r||(r={},this.repos_[e.name]=r);var i=ts(r,t.toURLString());return i&&ra("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),i=new yl(t,this.useRestClient_,e,n),r[t.toURLString()]=i},Fl.prototype.forceRestClient=function(t){this.useRestClient_=t},Fl);function Fl(){this.repos_={},this.useRestClient_=!1}var Ul=(Object.defineProperty(jl.prototype,"app",{get:function(){return this.repo_.app},enumerable:!1,configurable:!0}),jl.prototype.ref=function(t){return this.checkDeleted_("ref"),cs("database.ref",0,1,arguments.length),t instanceof Sl?this.refFromURL(t.toString()):void 0!==t?this.root_.child(t):this.root_},jl.prototype.refFromURL=function(t){var e="database.refFromURL";this.checkDeleted_(e),cs(e,1,1,arguments.length);var n=Ua(t,this.repo_.repoInfo_.nodeAdmin);Ya(e,1,n);t=n.repoInfo;return t.host!==this.repo_.repoInfo_.host&&ra(e+": Host name does not match the current database: (found "+t.host+" but expected "+this.repo_.repoInfo_.host+")"),this.ref(n.path.toString())},jl.prototype.checkDeleted_=function(t){null===this.repo_&&ra("Cannot call "+t+" on a deleted database.")},jl.prototype.goOffline=function(){cs("database.goOffline",0,0,arguments.length),this.checkDeleted_("goOffline"),this.repo_.interrupt()},jl.prototype.goOnline=function(){cs("database.goOnline",0,0,arguments.length),this.checkDeleted_("goOnline"),this.repo_.resume()},jl.ServerValue={TIMESTAMP:{".sv":"timestamp"},increment:function(t){return{".sv":{increment:t}}}},jl);function jl(t){(this.repo_=t)instanceof yl||ra("Don't call new Database() directly - please use firebase.database()."),this.root_=new Sl(t,ka.Empty),this.INTERNAL=new Vl(this)}var Vl=(ql.prototype.delete=function(){return bo(this,void 0,void 0,function(){return _o(this,function(t){return this.database.checkDeleted_("delete"),Ml.getInstance().deleteRepo(this.database.repo_),this.database.repo_=null,this.database.root_=null,this.database.INTERNAL=null,this.database=null,[2]})})},ql);function ql(t){this.database=t}var Wl=Object.freeze({__proto__:null,forceLongPolling:function(){tl.forceDisallow(),zh.forceAllow()},forceWebSockets:function(){zh.forceDisallow()},isWebSocketsAvailable:function(){return tl.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)},initStandalone:function(t){var e=t.app,n=t.url,r=t.version,i=t.customAuthImpl,o=t.namespace,t=void 0!==(t=t.nodeAdmin)&&t;return Jh(r),(r=new Es("auth-internal",new Ts("database-standalone"))).setComponent(new bs("auth-internal",function(){return i},"PRIVATE")),{instance:Ml.getInstance().databaseFromApp(e,r,n,t),namespace:o}}}),Dr=hl;hl.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},hl.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};var Hl,Gl=Object.freeze({__proto__:null,DataConnection:Dr,RealTimeConnection:il,hijackHash:function(i){var o=hl.prototype.put;return hl.prototype.put=function(t,e,n,r){void 0!==r&&(r=i()),o.call(this,t,e,n,r)},function(){hl.prototype.put=o}},ConnectionTarget:Ma,queryIdentifier:function(t){return t.queryIdentifier()},forceRestClient:function(t){Ml.getInstance().forceRestClient(t)}}),Kl=Ul.ServerValue;Jh((Hl=Bl).SDK_VERSION),Hl.INTERNAL.registerComponent(new bs("database",function(t,e){var n=t.getProvider("app").getImmediate(),t=t.getProvider("auth-internal");return Ml.getInstance().databaseFromApp(n,t,e)},"PUBLIC").setServiceProps({Reference:Sl,Query:yc,Database:Ul,DataSnapshot:oc,enableLogging:ea,INTERNAL:Wl,ServerValue:Kl,TEST_ACCESS:Gl}).setMultipleInstances(!0)),Hl.registerVersion("@firebase/database","0.6.13");var zl=function(t,e){return(zl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function Ql(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.")}var M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Yl={},Xl=M||self;function $l(){}function Jl(t){var e=typeof t;return"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}function Zl(t){var e=Jl(t);return"array"==e||"object"==e&&"number"==typeof t.length}function tf(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var ef="closure_uid_"+(1e9*Math.random()>>>0),nf=0;function rf(t,e,n){return t.call.apply(t.bind,arguments)}function of(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 sf(t,e,n){return(sf=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?rf:of).apply(null,arguments)}function af(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 uf=Date.now;function cf(t,e){function n(){}n.prototype=e.prototype,t.S=e.prototype,t.prototype=new n,t.prototype.constructor=t}function hf(){this.j=this.j,this.i=this.i}hf.prototype.j=!1,hf.prototype.ja=function(){var t;!this.j&&(this.j=!0,this.G(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,ef)&&t[ef]||(t[ef]=++nf))},hf.prototype.G=function(){if(this.i)for(;this.i.length;)this.i.shift()()};var lf=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},ff=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 pf(){return Array.prototype.concat.apply([],arguments)}function df(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 vf(t){return/^[\s\xa0]*$/.test(t)}var yf,gf=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function mf(t,e){return-1!=t.indexOf(e)}function bf(t,e){return t<e?-1:e<t?1:0}t:{var _f=Xl.navigator;if(_f){_f=_f.userAgent;if(_f){yf=_f;break t}}yf=""}function wf(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Ef(t){var e,n={};for(e in t)n[e]=t[e];return n}var If="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Tf(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<If.length;i++)e=If[i],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function Sf(t){return Sf[" "](t),t}Sf[" "]=$l;var Cf,Nf=mf(yf,"Opera"),Af=mf(yf,"Trident")||mf(yf,"MSIE"),kf=mf(yf,"Edge"),Of=kf||Af,Rf=mf(yf,"Gecko")&&!(mf(yf.toLowerCase(),"webkit")&&!mf(yf,"Edge"))&&!(mf(yf,"Trident")||mf(yf,"MSIE"))&&!mf(yf,"Edge"),Pf=mf(yf.toLowerCase(),"webkit")&&!mf(yf,"Edge");function Df(){var t=Xl.document;return t?t.documentMode:void 0}t:{var xf="",Lf=(Lf=yf,Rf?/rv:([^\);]+)(\)|;)/.exec(Lf):kf?/Edge\/([\d\.]+)/.exec(Lf):Af?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Lf):Pf?/WebKit\/(\S+)/.exec(Lf):Nf?/(?:Version)[ \/]?(\S+)/.exec(Lf):void 0);if(Lf&&(xf=Lf?Lf[1]:""),Af){Lf=Df();if(null!=Lf&&Lf>parseFloat(xf)){Cf=String(Lf);break t}}Cf=xf}var Mf={};function Ff(a){return t=a,e=function(){for(var t=0,e=gf(String(Cf)).split("."),n=gf(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=bf(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||bf(0==o[2].length,0==s[2].length)||bf(o[2],s[2]),o=o[3],s=s[3]}while(0==t)}return 0<=t},n=Mf,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}var Uf=Xl.document&&Af?Df()||(parseInt(Cf,10)||void 0):void 0,jf=!Af||9<=Number(Uf),Vf=Af&&!Ff("9"),qf=function(){if(!Xl.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{Xl.addEventListener("test",$l,e),Xl.removeEventListener("test",$l,e)}catch(t){}return t}();function Bf(t,e){this.type=t,this.a=this.target=e,this.defaultPrevented=!1}function Wf(t,e){if(Bf.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(Rf){t:{try{Sf(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:Hf[t.pointerType]||"",(this.c=t).defaultPrevented&&this.b()}}Bf.prototype.b=function(){this.defaultPrevented=!0},cf(Wf,Bf);var Hf={2:"touch",3:"pen",4:"mouse"};Wf.prototype.b=function(){Wf.S.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,Vf)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}};var Gf="closure_listenable_"+(1e6*Math.random()|0),Kf=0;function zf(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ca=i,this.key=++Kf,this.Y=this.Z=!1}function Qf(t){t.Y=!0,t.listener=null,t.proxy=null,t.src=null,t.ca=null}function Yf(t){this.src=t,this.a={},this.b=0}function Xf(t,e){var n,r,i,o=e.type;o in t.a&&(n=t.a[o],(i=0<=(r=lf(n,e)))&&Array.prototype.splice.call(n,r,1),i&&(Qf(e),0==t.a[o].length&&(delete t.a[o],t.b--)))}function $f(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.Y&&o.listener==e&&o.capture==!!n&&o.ca==r)return i}return-1}Yf.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=$f(t,e,r,i);return-1<s?(e=t[s],n||(e.Z=!1)):((e=new zf(e,this.src,o,!!r,i)).Z=n,t.push(e)),e};var Jf="closure_lm_"+(1e6*Math.random()|0),Zf={};function tp(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=up(r);return e&&e[Gf]?e.wa(n,r,tf(i)?!!i.capture:!!i,o):ep(e,n,r,!0,i,o)}(t,e,n,r,i);if(Array.isArray(e)){for(var o=0;o<e.length;o++)tp(t,e[o],n,r,i);return null}return n=up(n),t&&t[Gf]?t.va(e,n,tf(r)?!!r.capture:!!r,i):ep(t,e,n,!1,r,i)}function ep(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s=tf(i)?!!i.capture:!!i;if(s&&!jf)return null;var a,u,c=sp(t);if(c||(t[Jf]=c=new Yf(t)),(n=c.add(e,n,r,s,o)).proxy)return n;if(a=op,r=u=jf?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)qf||(i=s),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(rp(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function np(t){var e,n,r;"number"!=typeof t&&t&&!t.Y&&((e=t.src)&&e[Gf]?Xf(e.c,t):(n=t.type,r=t.proxy,e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(rp(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=sp(e))?(Xf(n,t),0==n.b&&(n.src=null,e[Jf]=null)):Qf(t)))}function rp(t){return t in Zf?Zf[t]:Zf[t]="on"+t}function ip(t,e){var n=t.listener,r=t.ca||t.src;return t.Z&&np(t),n.call(r,e)}function op(t,e){if(t.Y)return!0;if(jf)return ip(t,new Wf(e,this));if(!e)t:{e=["window","event"];for(var n=Xl,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}return ip(t,e=new Wf(e,this))}function sp(t){return(t=t[Jf])instanceof Yf?t:null}var ap="__closure_events_fn_"+(1e9*Math.random()>>>0);function up(e){return"function"==Jl(e)?e:(e[ap]||(e[ap]=function(t){return e.handleEvent(t)}),e[ap])}function cp(){hf.call(this),this.c=new Yf(this),(this.J=this).C=null}function hp(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,a,u=e[o];u&&!u.Y&&u.capture==n&&(s=u.listener,a=u.ca||u.src,u.Z&&Xf(t.c,u),i=!1!==s.call(a,r)&&i)}return i&&!r.defaultPrevented}cf(cp,hf),cp.prototype[Gf]=!0,(du=cp.prototype).addEventListener=function(t,e,n,r){tp(this,t,e,n,r)},du.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=tf(i)?!!i.capture:!!i,r=up(r),e&&e[Gf]?(e=e.c,(n=String(n).toString())in e.a&&-1<(r=$f(s=e.a[n],r,i,o))&&(Qf(s[r]),Array.prototype.splice.call(s,r,1),0==s.length&&(delete e.a[n],e.b--))):(e=e&&sp(e))&&(n=e.a[n.toString()],e=-1,n&&(e=$f(n,r,i,o)),(r=-1<e?n[e]:null)&&np(r))}(this,t,e,n,r)},du.dispatchEvent=function(t){var e,n=this.C;if(n)for(e=[];n;n=n.C)e.push(n);n=this.J;var r=t.type||t;if("string"==typeof t?t=new Bf(t,n):t instanceof Bf?t.target=t.target||n:(s=t,Tf(t=new Bf(r,n),s)),s=!0,e)for(var i=e.length-1;0<=i;i--)var o=t.a=e[i],s=hp(o,r,!0,t)&&s;if(s=hp(o=t.a=n,r,!0,t)&&s,s=hp(o,r,!1,t)&&s,e)for(i=0;i<e.length;i++)s=hp(o=t.a=e[i],r,!1,t)&&s;return s},du.G=function(){if(cp.S.G.call(this),this.c){var t,e=this.c;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)Qf(n[r]);delete e.a[t],e.b--}}this.C=null},du.va=function(t,e,n,r){return this.c.add(String(t),e,!1,n,r)},du.wa=function(t,e,n,r){return this.c.add(String(t),e,!0,n,r)};var lp=Xl.JSON.stringify;function fp(){this.b=this.a=null}var pp,dp=(vp.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 vp(function(){return new yp},function(t){t.reset()},100));function vp(t,e,n){this.f=n,this.c=t,this.g=e,this.b=0,this.a=null}function yp(){this.next=this.b=this.a=null}function gp(t,e){var n;pp||(n=Xl.Promise.resolve(void 0),pp=function(){n.then(_p)}),mp||(pp(),mp=!0),bp.add(t,e)}fp.prototype.add=function(t,e){var n=dp.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},yp.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null};var mp=!(yp.prototype.reset=function(){this.next=this.b=this.a=null}),bp=new fp;function _p(){for(var t,e;n=e=void 0,n=null,(e=bp).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){!function(t){Xl.setTimeout(function(){throw t},0)}(t)}var n=dp;n.g(t),n.b<n.f&&(n.b++,t.next=n.a,n.a=t)}mp=!1}function wp(t,e){cp.call(this),this.b=t||1,this.a=e||Xl,this.f=sf(this.Ya,this),this.g=uf()}function Ep(t){t.aa=!1,t.M&&(t.a.clearTimeout(t.M),t.M=null)}function Ip(t,e,n){if("function"==Jl(t))n&&(t=sf(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=sf(t.handleEvent,t)}return 2147483647<Number(e)?-1:Xl.setTimeout(t,e||0)}cf(wp,cp),(du=wp.prototype).aa=!1,du.M=null,du.Ya=function(){var t;this.aa&&(0<(t=uf()-this.g)&&t<.8*this.b?this.M=this.a.setTimeout(this.f,this.b-t):(this.M&&(this.a.clearTimeout(this.M),this.M=null),this.dispatchEvent("tick"),this.aa&&(Ep(this),this.start())))},du.start=function(){this.aa=!0,this.M||(this.M=this.a.setTimeout(this.f,this.b),this.g=uf())},du.G=function(){wp.S.G.call(this),Ep(this),delete this.a};var Tp,Sp,Cp,Np=(zl(Sp=kp,Cp=Tp=hf),Sp.prototype=null===Cp?Object.create(Cp):(Ap.prototype=Cp.prototype,new Ap),kp.prototype.f=function(t){this.b=arguments,this.a?this.c=!0:function t(e){e.a=Ip(function(){e.a=null,e.c&&(e.c=!1,t(e))},e.h);var n=e.b;e.b=null,e.g.apply(null,n)}(this)},kp.prototype.G=function(){Tp.prototype.G.call(this),this.a&&(Xl.clearTimeout(this.a),this.a=null,this.c=!1,this.b=null)},kp);function Ap(){this.constructor=Sp}function kp(t,e,n){var r=Tp.call(this)||this;return r.g=null!=n?t.bind(n):t,r.h=e,r.b=null,r.c=!1,r.a=null,r}function Op(t){hf.call(this),this.b=t,this.a={}}cf(Op,hf);var Rp=[];function Pp(t,e,n,r){Array.isArray(n)||(n&&(Rp[0]=n.toString()),n=Rp);for(var i=0;i<n.length;i++){var o=tp(e,n[i],r||t.handleEvent,!1,t.b||t);if(!o)break;t.a[o.key]=o}}function Dp(t){wf(t.a,function(t,e){this.a.hasOwnProperty(e)&&np(t)},t),t.a={}}function xp(){this.a=!0}function Lp(t,e,n,r){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.a)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(r.length<2)){var i=r[1];if(Array.isArray(i)&&!(i.length<1)){r=i[0];if("noop"!=r&&"stop"!=r&&"close"!=r)for(var o=1;o<i.length;o++)i[o]=""}}}return lp(n)}catch(t){return e}}(t,n)+(r?" "+r:"")})}Op.prototype.G=function(){Op.S.G.call(this),Dp(this)},Op.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},xp.prototype.info=function(){};var Mp=null;function Fp(){return Mp=Mp||new cp}function Up(t){Bf.call(this,"serverreachability",t)}function jp(t){var e=Fp();e.dispatchEvent(new Up(e))}function Vp(t){Bf.call(this,"statevent",t)}function qp(t){var e=Fp();e.dispatchEvent(new Vp(e))}function Bp(t){Bf.call(this,"timingevent",t)}function Wp(t,e){if("function"!=Jl(t))throw Error("Fn must not be null and must be a function");return Xl.setTimeout(function(){t()},e)}cf(Up,Bf),cf(Vp,Bf),cf(Bp,Bf);K={NO_ERROR:0,Za:1,gb:2,fb:3,bb:4,eb:5,hb:6,Da:7,TIMEOUT:8,kb:9},Dr={ab:"complete",ob:"success",Ea:"error",Da:"abort",mb:"ready",nb:"readystatechange",TIMEOUT:"timeout",ib:"incrementaldata",lb:"progress",cb:"downloadprogress",pb:"uploadprogress"};function Hp(){}function Gp(t){var e;return(e=t.a)||(e=t.a={}),e}function Kp(){}Hp.prototype.a=null;var zp,M={OPEN:"a",$a:"b",Ea:"c",jb:"d"};function Qp(){Bf.call(this,"d")}function Yp(){Bf.call(this,"c")}function Xp(){}function $p(t,e,n,r){this.g=t,this.c=e,this.f=n,this.T=r||1,this.J=new Op(this),this.P=Jp,t=Of?125:void 0,this.R=new wp(t),this.B=null,this.b=!1,this.j=this.l=this.i=this.H=this.u=this.U=this.o=null,this.s=[],this.a=null,this.D=0,this.h=this.m=null,this.N=-1,this.A=!1,this.O=0,this.F=null,this.W=this.C=this.V=this.I=!1}cf(Qp,Bf),cf(Yp,Bf),cf(Xp,Hp),zp=new Xp;var Jp=45e3,Zp={},td={};function ed(t,e,n){t.H=1,t.i=Ed(yd(e)),t.j=n,t.I=!0,nd(t,null)}function nd(t,e){t.u=uf(),id(t),t.l=yd(t.i);var s,a,u,c,h,l,n=t.l,r=t.T;Array.isArray(r)||(r=[String(r)]),Ld(n.b,"t",r),t.D=0,t.a=Av(t.g,t.g.C?e:null),0<t.O&&(t.F=new Np(sf(t.Ca,t,t.a),t.O)),Pp(t.J,t.a,"readystatechange",t.Wa),e=t.B?Ef(t.B):{},t.j?(t.m||(t.m="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.a.ba(t.l,t.m,t.j,e)):(t.m="GET",t.a.ba(t.l,t.m,null,e)),jp(1),s=t.c,a=t.m,u=t.l,c=t.f,h=t.T,l=t.j,s.info(function(){if(s.a)if(l)for(var t="",e=l.split("&"),n=0;n<e.length;n++){var r,i,o=e[n].split("=");1<o.length&&(r=o[0],o=o[1],t=2<=(i=r.split("_")).length&&"type"==i[1]?t+(r+"=")+o+"&":t+(r+"=redacted&"))}else t=null;else t=l;return"XMLHTTP REQ ("+c+") [attempt "+h+"]: "+a+"\n"+u+"\n"+t})}function rd(t,e,n){for(var r,i,o,s=!0;!t.A&&t.D<n.length;){var a=(a=n,o=i=void 0,i=(r=t).D,-1==(o=a.indexOf("\n",i))?td:(i=Number(a.substring(i,o)),isNaN(i)?Zp:(o+=1)+i>a.length?td:(a=a.substr(o,i),r.D=o+i,a)));if(a==td){4==e&&(t.h=4,qp(14),s=!1),Lp(t.c,t.f,null,"[Incomplete Response]");break}if(a==Zp){t.h=4,qp(15),Lp(t.c,t.f,n,"[Invalid Chunk]"),s=!1;break}Lp(t.c,t.f,a,null),cd(t,a)}4==e&&0==n.length&&(t.h=1,qp(16),s=!1),t.b=t.b&&s,s?0<n.length&&!t.W&&(t.W=!0,(e=t.g).a==t&&e.V&&!e.F&&(e.c.info("Great, no buffering proxy detected. Bytes received: "+n.length),_v(e),e.F=!0)):(Lp(t.c,t.f,n,"[Invalid Chunked Response]"),ud(t),ad(t))}function id(t){t.U=uf()+t.P,od(t,t.P)}function od(t,e){if(null!=t.o)throw Error("WatchDog timer not null");t.o=Wp(sf(t.Ua,t),e)}function sd(t){t.o&&(Xl.clearTimeout(t.o),t.o=null)}function ad(t){0==t.g.v||t.A||Iv(t.g,t)}function ud(t){sd(t);var e=t.F;e&&"function"==typeof e.ja&&e.ja(),t.F=null,Ep(t.R),Dp(t.J),t.a&&(e=t.a,t.a=null,e.abort(),e.ja())}function cd(t,e){try{var n,r,i,o,s,a=t.g;if(0!=a.v&&(a.a==t||Bd(a.b,t)))if(a.I=t.N,!t.C&&Bd(a.b,t)&&3==a.v){try{var u=a.ka.a.parse(e)}catch(t){u=null}if(Array.isArray(u)&&3==u.length){var c=u;if(0==c[0]){t:if(!a.j){if(a.a){if(!(a.a.u+3e3<t.u))break t;Ev(a),lv(a)}bv(a),qp(18)}}else a.oa=c[1],0<a.oa-a.P&&c[2]<37500&&a.H&&0==a.o&&!a.m&&(a.m=Wp(sf(a.Ra,a),6e3));if(qd(a.b)<=1&&a.ea){try{a.ea()}catch(t){}a.ea=void 0}}else Sv(a,11)}else if(!t.C&&a.a!=t||Ev(a),!vf(e))for(e=u=a.ka.a.parse(e),u=0;u<e.length;u++){c=e[u],a.P=c[0],c=c[1],2==a.v?"c"==c[0]?(a.J=c[1],a.ga=c[2],null!=(r=c[3])&&(a.ha=r,a.c.info("VER="+a.ha)),null!=(o=c[4])&&(a.pa=o,a.c.info("SVER="+a.pa)),null!=(r=c[5])&&"number"==typeof r&&0<r&&(n=1.5*r,a.D=n,a.c.info("backChannelRequestTimeoutMs_="+n)),n=a,(o=t.a)&&(!(r=o.a?o.a.getResponseHeader("X-Client-Wire-Protocol"):null)||!(i=n.b).a&&(mf(r,"spdy")||mf(r,"quic")||mf(r,"h2"))&&(i.f=i.g,i.a=new Set,i.b&&(Wd(i,i.b),i.b=null)),!n.A||(s=o.a?o.a.getResponseHeader("X-HTTP-Session-Id"):null)&&(n.na=s,wd(n.B,n.A,s))),a.v=3,a.f&&a.f.ta(),a.V&&(a.N=uf()-t.u,a.c.info("Handshake RTT: "+a.N+"ms")),i=t,(n=a).la=Nv(n,n.C?n.ga:null,n.fa),i.C?(Hd(n.b,i),o=i,(s=n.D)&&o.setTimeout(s),o.o&&(sd(o),id(o)),n.a=i):mv(n),0<a.g.length&&dv(a)):"stop"!=c[0]&&"close"!=c[0]||Sv(a,7):3==a.v&&("stop"==c[0]||"close"==c[0]?"stop"==c[0]?Sv(a,7):hv(a):"noop"!=c[0]&&a.f&&a.f.sa(c),a.o=0)}jp(4)}catch(t){}}function hd(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Zl(t)||"string"==typeof t)ff(t,e,void 0);else{if(t.L&&"function"==typeof t.L)var n=t.L();else if(t.K&&"function"==typeof t.K)n=void 0;else if(Zl(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.K&&"function"==typeof t.K)return t.K();if("string"==typeof t)return t.split("");if(Zl(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 ld(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 ld)for(n=t.L(),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 fd(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];pd(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){for(var i={},n=e=0;e<t.a.length;)pd(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function pd(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(du=$p.prototype).setTimeout=function(t){this.P=t},du.Wa=function(t){t=t.target;var e=this.F;e&&3==sv(t)?e.f():this.Ca(t)},du.Ca=function(t){try{if(t==this.a)t:{var e=sv(this.a),n=this.a.ua(),r=this.a.X();if(!(e<3||3==e&&!Of&&!this.a.$())){this.A||4!=e||7==n||jp(8==n||r<=0?3:2),sd(this);var i=this.a.X();this.N=i;n=this.a.$();if(this.b=200==i,r=this.c,a=this.m,u=this.l,c=this.f,h=this.T,l=e,f=i,r.info(function(){return"XMLHTTP RESP ("+c+") [ attempt "+h+"]: "+a+"\n"+u+"\n"+l+" "+f}),this.b){if(this.V&&!this.C){e:{if(this.a){var o=this.a;if((o=o.a?o.a.getResponseHeader("X-HTTP-Initial-Response"):null)&&!vf(o)){var s=o;break e}}s=null}if(!s){this.b=!1,this.h=3,qp(12),ud(this),ad(this);break t}Lp(this.c,this.f,s,"Initial handshake response via X-HTTP-Initial-Response"),this.C=!0,cd(this,s)}this.I?(rd(this,e,n),Of&&this.b&&3==e&&(Pp(this.J,this.R,"tick",this.Va),this.R.start())):(Lp(this.c,this.f,n,null),cd(this,n)),4==e&&ud(this),this.b&&!this.A&&(4==e?Iv(this.g,this):(this.b=!1,id(this)))}else 400==i&&0<n.indexOf("Unknown SID")?(this.h=3,qp(12)):(this.h=0,qp(13)),ud(this),ad(this)}}}catch(t){}var a,u,c,h,l,f},du.Va=function(){var t,e;this.a&&(t=sv(this.a),e=this.a.$(),this.D<e.length&&(sd(this),rd(this,t,e),this.b&&4!=t&&id(this)))},du.cancel=function(){this.A=!0,ud(this)},du.Ua=function(){this.o=null;var t,e,n=uf();0<=n-this.U?(t=this.c,e=this.l,t.info(function(){return"TIMEOUT: "+e}),2!=this.H&&(jp(3),qp(17)),ud(this),this.h=2,ad(this)):od(this,this.U-n)},(du=ld.prototype).K=function(){fd(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},du.L=function(){return fd(this),this.a.concat()},du.get=function(t,e){return pd(this.b,t)?this.b[t]:e},du.set=function(t,e){pd(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},du.forEach=function(t,e){for(var n=this.L(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var dd=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function vd(t,e){var n;this.c=this.j=this.f="",this.h=null,this.i=this.g="",this.a=!1,t instanceof vd?(this.a=void 0!==e?e:t.a,gd(this,t.f),this.j=t.j,md(this,t.c),bd(this,t.h),this.g=t.g,e=t.b,(n=new Rd).c=e.c,e.a&&(n.a=new ld(e.a),n.b=e.b),_d(this,n),this.i=t.i):t&&(n=String(t).match(dd))?(this.a=!!e,gd(this,n[1]||"",!0),this.j=Id(n[2]||""),md(this,n[3]||"",!0),bd(this,n[4]),this.g=Id(n[5]||"",!0),_d(this,n[6]||"",!0),this.i=Id(n[7]||"")):(this.a=!!e,this.b=new Rd(null,this.a))}function yd(t){return new vd(t)}function gd(t,e,n){t.f=n?Id(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function md(t,e,n){t.c=n?Id(e,!0):e}function bd(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 _d(t,e,n){var r,i;e instanceof Rd?(t.b=e,r=t.b,(i=t.a)&&!r.f&&(Pd(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Dd(this,e),Ld(this,n,t))},r)),r.f=i):(n||(e=Td(e,kd)),t.b=new Rd(e,t.a))}function wd(t,e,n){t.b.set(e,n)}function Ed(t){return wd(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^uf()).toString(36)),t}function Id(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Td(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Sd),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Sd(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}vd.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Td(e,Cd,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(Td(e,Cd,!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(Td(n,"/"==n.charAt(0)?Ad:Nd,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",Td(n,Od)),t.join("")};var Cd=/[#\/\?@]/g,Nd=/[#\?:]/g,Ad=/[#\?]/g,kd=/[#\?@]/g,Od=/#/g;function Rd(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Pd(n){n.a||(n.a=new ld,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r,i=t[n].indexOf("="),o=null;0<=i?(r=t[n].substring(0,i),o=t[n].substring(i+1)):r=t[n],e(r,o?decodeURIComponent(o.replace(/\+/g," ")):"")}}}(n.c,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function Dd(t,e){Pd(t),e=Md(t,e),pd(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,pd((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&fd(t)))}function xd(t,e){return Pd(t),e=Md(t,e),pd(t.a.b,e)}function Ld(t,e,n){Dd(t,e),0<n.length&&(t.c=null,t.a.set(Md(t,e),df(n)),t.b+=n.length)}function Md(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function Fd(t,e){this.b=t,this.a=e}function Ud(t){this.g=t||jd,t=Xl.PerformanceNavigationTiming?0<(t=Xl.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(Xl.ia&&Xl.ia.ya&&Xl.ia.ya()&&Xl.ia.ya().qb),this.f=t?this.g:1,this.a=null,1<this.f&&(this.a=new Set),this.b=null,this.c=[]}(du=Rd.prototype).add=function(t,e){Pd(this),this.c=null,t=Md(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},du.forEach=function(n,r){Pd(this),this.a.forEach(function(t,e){ff(t,function(t){n.call(r,t,e,this)},this)},this)},du.L=function(){Pd(this);for(var t=this.a.K(),e=this.a.L(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},du.K=function(t){Pd(this);var e=[];if("string"==typeof t)xd(this,t)&&(e=pf(e,this.a.get(Md(this,t))));else{t=this.a.K();for(var n=0;n<t.length;n++)e=pf(e,t[n])}return e},du.set=function(t,e){return Pd(this),this.c=null,xd(this,t=Md(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},du.get=function(t,e){return t&&0<(t=this.K(t)).length?String(t[0]):e},du.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.L(),n=0;n<e.length;n++)for(var r=e[n],i=encodeURIComponent(String(r)),r=this.K(r),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 jd=10;function Vd(t){return t.b||t.a&&t.a.size>=t.f}function qd(t){return t.b?1:t.a?t.a.size:0}function Bd(t,e){return t.b?t.b==e:t.a&&t.a.has(e)}function Wd(t,e){t.a?t.a.add(e):t.b=e}function Hd(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function Gd(t){var e,n;if(null!=t.b)return t.c.concat(t.b.s);if(null==t.a||0===t.a.size)return df(t.c);var r=t.c;try{for(var i=Ql(t.a.values()),o=i.next();!o.done;o=i.next())var s=o.value,r=r.concat(s.s)}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 Kd(){}function zd(){this.a=new Kd}function Qd(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}Ud.prototype.cancel=function(){var e,t;if(this.c=Gd(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=Ql(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()}},Kd.prototype.stringify=function(t){return Xl.JSON.stringify(t,void 0)},Kd.prototype.parse=function(t){return Xl.JSON.parse(t,void 0)};var Yd=Xl.JSON.parse;function Xd(t){cp.call(this),this.headers=new ld,this.H=t||null,this.b=!1,this.s=this.a=null,this.B="",this.h=0,this.f="",this.g=this.A=this.l=this.u=!1,this.o=0,this.m=null,this.I=$d,this.D=this.F=!1}cf(Xd,cp);var $d="",Jd=/^https?$/i,Zd=["POST","PUT"];function tv(t){return"content-type"==t.toLowerCase()}function ev(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,nv(t),iv(t)}function nv(t){t.u||(t.u=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function rv(t){if(t.b&&void 0!==Yl&&(!t.s[1]||4!=sv(t)||2!=t.X()))if(t.l&&4==sv(t))Ip(t.za,0,t);else if(t.dispatchEvent("readystatechange"),4==sv(t)){t.b=!1;try{var e,n,r,i,o=t.X();t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var s=!0;break t;default:s=!1}if((e=s)||((n=0===o)&&(!(i=String(t.B).match(dd)[1]||null)&&Xl.self&&Xl.self.location&&(i=(r=Xl.self.location.protocol).substr(0,r.length-1)),n=!Jd.test(i?i.toLowerCase():"")),e=n),e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.h=6;try{var a=2<sv(t)?t.a.statusText:""}catch(t){a=""}t.f=a+" ["+t.X()+"]",nv(t)}}finally{iv(t)}}}function iv(t,e){if(t.a){ov(t);var n=t.a,r=t.s[0]?$l:null;t.a=null,t.s=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){}}}function ov(t){t.a&&t.D&&(t.a.ontimeout=null),t.m&&(Xl.clearTimeout(t.m),t.m=null)}function sv(t){return t.a?t.a.readyState:0}function av(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}var i;r||(i="",wf(n,function(t,e){i+=e,i+=":",i+=t,i+="\r\n"}),n=i,"string"==typeof t?null!=n&&encodeURIComponent(String(n)):wd(t,e,n))}function uv(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function cv(t){this.pa=0,this.g=[],this.c=new xp,this.ga=this.la=this.B=this.fa=this.a=this.na=this.A=this.W=this.i=this.O=this.l=null,this.La=this.R=0,this.Ia=uv("failFast",!1,t),this.H=this.m=this.j=this.h=this.f=null,this.T=!0,this.I=this.oa=this.P=-1,this.U=this.o=this.u=0,this.Fa=uv("baseRetryDelayMs",5e3,t),this.Ma=uv("retryDelaySeedMs",1e4,t),this.Ja=uv("forwardChannelMaxRetries",2,t),this.ma=uv("forwardChannelRequestTimeoutMs",2e4,t),this.Ka=t&&t.g||void 0,this.D=void 0,this.C=t&&t.supportsCrossDomainXhr||!1,this.J="",this.b=new Ud(t&&t.concurrentRequestLimit),this.ka=new zd,this.da=t&&t.fastHandshake||!1,this.Ga=t&&t.b||!1,t&&t.f&&(this.c.a=!1),t&&t.forceLongPolling&&(this.T=!1),this.V=!this.da&&this.T&&t&&t.c||!1,this.ea=void 0,this.N=0,this.F=!1,this.s=null}function hv(t){var e,n;fv(t),3==t.v&&(e=t.R++,wd(n=yd(t.B),"SID",t.J),wd(n,"RID",e),wd(n,"TYPE","terminate"),yv(t,n),(e=new $p(t,t.c,e,void 0)).H=2,e.i=Ed(yd(n)),n=!1,Xl.navigator&&Xl.navigator.sendBeacon&&(n=Xl.navigator.sendBeacon(e.i.toString(),"")),!n&&Xl.Image&&((new Image).src=e.i,n=!0),n||(e.a=Av(e.g,null),e.a.ba(e.i)),e.u=uf(),id(e)),Cv(t)}function lv(t){t.a&&(_v(t),t.a.cancel(),t.a=null)}function fv(t){lv(t),t.j&&(Xl.clearTimeout(t.j),t.j=null),Ev(t),t.b.cancel(),t.h&&("number"==typeof t.h&&Xl.clearTimeout(t.h),t.h=null)}function pv(t,e){t.g.push(new Fd(t.La++,e)),3==t.v&&dv(t)}function dv(t){Vd(t.b)||t.h||(t.h=!0,gp(t.Ba,t),t.u=0)}function vv(t,e){var n=e?e.f:t.R++,r=yd(t.B);wd(r,"SID",t.J),wd(r,"RID",n),wd(r,"AID",t.P),yv(t,r),t.i&&t.l&&av(r,t.i,t.l),n=new $p(t,t.c,n,t.u+1),null===t.i&&(n.B=t.l),e&&(t.g=e.s.concat(t.g)),e=gv(t,n,1e3),n.setTimeout(Math.round(.5*t.ma)+Math.round(.5*t.ma*Math.random())),Wd(t.b,n),ed(n,r,e)}function yv(t,n){t.f&&hd({},function(t,e){wd(n,e,t)})}function gv(t,e,n){n=Math.min(t.g.length,n);var r=t.f?sf(t.f.Ha,t.f,t):null;t:for(var i=t.g,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{!function(t,r,e){var i=e||"";try{hd(t,function(t,e){var n=t;tf(t)&&(n=lp(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}(h,s,"req"+c+"_")}catch(t){r&&r(h)}}if(a){r=s.join("&");break t}}return t=t.g.splice(0,n),e.s=t,r}function mv(t){t.a||t.j||(t.U=1,gp(t.Aa,t),t.o=0)}function bv(t){return!(t.a||t.j||3<=t.o)&&(t.U++,t.j=Wp(sf(t.Aa,t),Tv(t,t.o)),t.o++,1)}function _v(t){null!=t.s&&(Xl.clearTimeout(t.s),t.s=null)}function wv(t){t.a=new $p(t,t.c,"rpc",t.U),null===t.i&&(t.a.B=t.l),t.a.O=0;var e=yd(t.la);wd(e,"RID","rpc"),wd(e,"SID",t.J),wd(e,"CI",t.H?"0":"1"),wd(e,"AID",t.P),yv(t,e),wd(e,"TYPE","xmlhttp"),t.i&&t.l&&av(e,t.i,t.l),t.D&&t.a.setTimeout(t.D);var n=t.a;t=t.ga,n.H=1,n.i=Ed(yd(e)),n.j=null,n.I=!0,nd(n,t)}function Ev(t){null!=t.m&&(Xl.clearTimeout(t.m),t.m=null)}function Iv(t,e){var n,r=null;if(t.a==e){Ev(t),_v(t),t.a=null;var i=2}else{if(!Bd(t.b,e))return;r=e.s,Hd(t.b,e),i=1}if(t.I=e.N,0!=t.v)if(e.b){1==i?(r=e.j?e.j.length:0,e=uf()-e.u,n=t.u,(i=Fp()).dispatchEvent(new Bp(i)),dv(t)):mv(t)}else if(3==(n=e.h)||0==n&&0<t.I||!(1==i&&function(t,e){if(!(qd(t.b)>=t.b.f-(t.h?1:0))){if(t.h)return t.g=e.s.concat(t.g),1;if(!(1==t.v||2==t.v||t.u>=(t.Ia?0:t.Ja)))return t.h=Wp(sf(t.Ba,t,e),Tv(t,t.u)),t.u++,1}}(t,e)||2==i&&bv(t)))switch(r&&0<r.length&&(e=t.b,e.c=e.c.concat(r)),n){case 1:Sv(t,5);break;case 4:Sv(t,10);break;case 3:Sv(t,6);break;default:Sv(t,2)}}function Tv(t,e){var n=t.Fa+Math.floor(Math.random()*t.Ma);return t.f||(n*=2),n*e}function Sv(t,e){var n,r,i,o;t.c.info("Error code "+e),2==e?(r=null,t.f&&(r=null),o=sf(t.Xa,t),r||(r=new vd("//www.google.com/images/cleardot.gif"),Xl.location&&"http"==Xl.location.protocol||gd(r,"https"),Ed(r)),n=r.toString(),r=o,o=new xp,Xl.Image?((i=new Image).onload=af(Qd,o,i,"TestLoadImage: loaded",!0,r),i.onerror=af(Qd,o,i,"TestLoadImage: error",!1,r),i.onabort=af(Qd,o,i,"TestLoadImage: abort",!1,r),i.ontimeout=af(Qd,o,i,"TestLoadImage: timeout",!1,r),Xl.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=n):r(!1)):qp(2),t.v=0,t.f&&t.f.ra(e),Cv(t),fv(t)}function Cv(t){t.v=0,t.I=-1,t.f&&(0==Gd(t.b).length&&0==t.g.length||(t.b.c.length=0,df(t.g),t.g.length=0),t.f.qa())}function Nv(t,e,n){var r,i,o,s,a,u=(s=n)instanceof vd?yd(s):new vd(s,void 0);return""!=u.c?(e&&md(u,e+"."+u.c),bd(u,u.h)):(a=Xl.location,r=a.protocol,i=e?e+"."+a.hostname:a.hostname,o=+a.port,s=n,a=new vd(null,void 0),r&&gd(a,r),i&&md(a,i),o&&bd(a,o),s&&(a.g=s),u=a),t.W&&wf(t.W,function(t,e){wd(u,e,t)}),e=t.A,n=t.na,e&&n&&wd(u,e,n),wd(u,"VER",t.ha),yv(t,u),u}function Av(t,e){if(e&&!t.C)throw Error("Can't create secondary domain capable XhrIo object.");return(e=new Xd(t.Ka)).F=t.C,e}function kv(){}function Ov(){if(Af&&!(10<=Number(Uf)))throw Error("Environmental error: no available transport.")}function Rv(t,e){cp.call(this),this.a=new cv(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.l=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.a&&(t?t["X-WebChannel-Client-Profile"]=e.a:t={"X-WebChannel-Client-Profile":e.a}),this.a.O=t,(t=e&&e.httpHeadersOverwriteParam)&&!vf(t)&&(this.a.i=t),this.h=e&&e.supportsCrossDomainXhr||!1,this.g=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!vf(e)&&(this.a.A=e,null!==(t=this.b)&&e in t&&(e in(t=this.b)&&delete t[e])),this.f=new xv(this)}function Pv(t){Qp.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 Dv(){Yp.call(this),this.status=1}function xv(t){this.a=t}(du=Xd.prototype).ba=function(t,e,n,r){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.B+"; newUri="+t);e=e?e.toUpperCase():"GET",this.B=t,this.f="",this.h=0,this.u=!1,this.b=!0,this.a=new XMLHttpRequest,this.s=this.H?Gp(this.H):Gp(zp),this.a.onreadystatechange=sf(this.za,this);try{this.A=!0,this.a.open(e,String(t),!0),this.A=!1}catch(t){return void ev(this,t)}t=n||"";var i,o=new ld(this.headers);r&&hd(r,function(t,e){o.set(e,t)}),r=function(t){t:{for(var e=tv,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.L()),n=Xl.FormData&&t instanceof Xl.FormData,0<=lf(Zd,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.I&&(this.a.responseType=this.I),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{ov(this),0<this.o&&((this.D=(i=this.a,Af&&Ff(9)&&"number"==typeof i.timeout&&void 0!==i.ontimeout))?(this.a.timeout=this.o,this.a.ontimeout=sf(this.xa,this)):this.m=Ip(this.xa,this.o,this)),this.l=!0,this.a.send(t),this.l=!1}catch(t){ev(this,t)}},du.xa=function(){void 0!==Yl&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,this.dispatchEvent("timeout"),this.abort(8))},du.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"),iv(this))},du.G=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),iv(this,!0)),Xd.S.G.call(this)},du.za=function(){this.j||(this.A||this.l||this.g?rv(this):this.Ta())},du.Ta=function(){rv(this)},du.X=function(){try{return 2<sv(this)?this.a.status:-1}catch(t){return-1}},du.$=function(){try{return this.a?this.a.responseText:""}catch(t){return""}},du.Na=function(t){if(this.a){var e=this.a.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Yd(e)}},du.ua=function(){return this.h},du.Qa=function(){return"string"==typeof this.f?this.f:String(this.f)},(du=cv.prototype).ha=8,du.v=1,du.Ba=function(t){if(this.h)if(this.h=null,1==this.v){if(!t){this.R=Math.floor(1e5*Math.random()),t=this.R++;var e,n=new $p(this,this.c,t,void 0),r=this.l;if(this.O&&(r?Tf(r=Ef(r),this.O):r=this.O),null===this.i&&(n.B=r),this.da)t:{for(var i=e=0;i<this.g.length;i++){var o=this.g[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.g.length-1){e=i+1;break t}}e=1e3}else e=1e3;e=gv(this,n,e),wd(i=yd(this.B),"RID",t),wd(i,"CVER",22),this.A&&wd(i,"X-HTTP-Session-Id",this.A),yv(this,i),this.i&&r&&av(i,this.i,r),Wd(this.b,n),this.Ga&&wd(i,"TYPE","init"),this.da?(wd(i,"$req",e),wd(i,"SID","null"),n.V=!0,ed(n,i,null)):ed(n,i,e),this.v=2}}else 3==this.v&&(t?vv(this,t):0==this.g.length||Vd(this.b)||vv(this))},du.Aa=function(){var t;this.j=null,wv(this),this.V&&!(this.F||null==this.a||this.N<=0)&&(t=2*this.N,this.c.info("BP detection timer enabled: "+t),this.s=Wp(sf(this.Sa,this),t))},du.Sa=function(){this.s&&(this.s=null,this.c.info("BP detection timeout reached."),this.c.info("Buffering proxy detected and switch to long-polling!"),this.H=!1,this.F=!0,lv(this),wv(this))},du.Ra=function(){null!=this.m&&(this.m=null,lv(this),bv(this),qp(19))},du.Xa=function(t){t?(this.c.info("Successfully pinged google.com"),qp(2)):(this.c.info("Failed to ping google.com"),qp(1))},(du=kv.prototype).ta=function(){},du.sa=function(){},du.ra=function(){},du.qa=function(){},du.Ha=function(){},Ov.prototype.a=function(t,e){return new Rv(t,e)},cf(Rv,cp),(du=Rv.prototype).addEventListener=function(t,e,n,r){Rv.S.addEventListener.call(this,t,e,n,r)},du.removeEventListener=function(t,e,n,r){Rv.S.removeEventListener.call(this,t,e,n,r)},du.Oa=function(){this.a.f=this.f,this.h&&(this.a.C=!0);var t=this.a,e=this.l,n=this.b||void 0;qp(0),t.fa=e,t.W=n||{},t.H=t.T,t.B=Nv(t,null,t.fa),dv(t)},du.close=function(){hv(this.a)},du.Pa=function(t){var e;"string"==typeof t?((e={}).__data__=t,pv(this.a,e)):this.g?((e={}).__data__=lp(t),pv(this.a,e)):pv(this.a,t)},du.G=function(){this.a.f=null,delete this.f,hv(this.a),delete this.a,Rv.S.G.call(this)},cf(Pv,Qp),cf(Dv,Yp),cf(xv,kv),xv.prototype.ta=function(){this.a.dispatchEvent("a")},xv.prototype.sa=function(t){this.a.dispatchEvent(new Pv(t))},xv.prototype.ra=function(t){this.a.dispatchEvent(new Dv)},xv.prototype.qa=function(){this.a.dispatchEvent("b")},Ov.prototype.createWebChannel=Ov.prototype.a,Rv.prototype.send=Rv.prototype.Pa,Rv.prototype.open=Rv.prototype.Oa,K.NO_ERROR=0,K.TIMEOUT=8,K.HTTP_ERROR=6,Dr.COMPLETE="complete",(Kp.EventType=M).OPEN="a",M.CLOSE="b",M.ERROR="c",M.MESSAGE="d",cp.prototype.listen=cp.prototype.va,Xd.prototype.listenOnce=Xd.prototype.wa,Xd.prototype.getLastError=Xd.prototype.Qa,Xd.prototype.getLastErrorCode=Xd.prototype.ua,Xd.prototype.getStatus=Xd.prototype.X,Xd.prototype.getResponseJson=Xd.prototype.Na,Xd.prototype.getResponseText=Xd.prototype.$,Xd.prototype.send=Xd.prototype.ba;var Lv,M={createWebChannelTransport:function(){return new Ov},ErrorCode:K,EventType:Dr,WebChannel:Kp,XhrIo:Xd},Mv=M.createWebChannelTransport,Fv=M.ErrorCode,Uv=M.EventType,jv=M.WebChannel,Vv=M.XhrIo,qv={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"},Bv=(go(Hv,Lv=Error),Hv),Wv=new Ds("@firebase/firestore");function Hv(t,e){var n=this;return(n=Lv.call(this,e)||this).code=t,n.message=e,n.name="FirebaseError",n.toString=function(){return n.name+": [code="+n.code+"]: "+n.message},n}function Gv(){return Wv.logLevel}function Kv(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Wv.logLevel<=Ns.DEBUG&&(e=n.map(Yv),Wv.debug.apply(Wv,To(["Firestore (7.23.0): "+t],e)))}function zv(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Wv.logLevel<=Ns.ERROR&&(e=n.map(Yv),Wv.error.apply(Wv,To(["Firestore (7.23.0): "+t],e)))}function Qv(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Wv.logLevel<=Ns.WARN&&(e=n.map(Yv),Wv.warn.apply(Wv,To(["Firestore (7.23.0): "+t],e)))}function Yv(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function Xv(t){void 0===t&&(t="Unexpected state");t="FIRESTORE (7.23.0) INTERNAL ASSERTION FAILED: "+t;throw zv(t),new Error(t)}function $v(t){t||Xv()}function Jv(t){var e,n=0;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&n++;return n}function Zv(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function ty(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var ey,ny,K=(Object.defineProperty(hy.prototype,"length",{get:function(){return this.t},enumerable:!1,configurable:!0}),hy.prototype.isEqual=function(t){return 0===hy.i(this,t)},hy.prototype.child=function(t){var e=this.segments.slice(this.offset,this.limit());return t instanceof hy?t.forEach(function(t){e.push(t)}):e.push(t),this.o(e)},hy.prototype.limit=function(){return this.offset+this.length},hy.prototype.u=function(t){return t=void 0===t?1:t,this.o(this.segments,this.offset+t,this.length-t)},hy.prototype.h=function(){return this.o(this.segments,this.offset,this.length-1)},hy.prototype.l=function(){return this.segments[this.offset]},hy.prototype._=function(){return this.get(this.length-1)},hy.prototype.get=function(t){return this.segments[this.offset+t]},hy.prototype.m=function(){return 0===this.length},hy.prototype.T=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},hy.prototype.I=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},hy.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},hy.prototype.A=function(){return this.segments.slice(this.offset,this.limit())},hy.i=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},hy),ry=(go(cy,ny=K),cy.prototype.o=function(t,e,n){return new cy(t,e,n)},cy.prototype.R=function(){return this.A().join("/")},cy.prototype.toString=function(){return this.R()},cy.P=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];if(0<=o.indexOf("//"))throw new Bv(qv.INVALID_ARGUMENT,"Invalid segment ("+o+"). Paths must not contain // in them.");n.push.apply(n,o.split("/").filter(function(t){return 0<t.length}))}return new cy(n)},cy.g=function(){return new cy([])},cy),iy=/^[_a-zA-Z][_a-zA-Z0-9]*$/,oy=(go(uy,ey=K),uy.prototype.o=function(t,e,n){return new uy(t,e,n)},uy.V=function(t){return iy.test(t)},uy.prototype.R=function(){return this.A().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),uy.V(t)||(t="`"+t+"`"),t}).join(".")},uy.prototype.toString=function(){return this.R()},uy.prototype.p=function(){return 1===this.length&&"__name__"===this.get(0)},uy.v=function(){return new uy(["__name__"])},uy.S=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new Bv(qv.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 Bv(qv.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var a=t[r+1];if("\\"!==a&&"."!==a&&"`"!==a)throw new Bv(qv.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 Bv(qv.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new uy(e)},uy.g=function(){return new uy([])},uy),sy=(ay.D=function(t){return new ay(ry.P(t))},ay.C=function(t){return new ay(ry.P(t).u(5))},ay.prototype.N=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},ay.prototype.isEqual=function(t){return null!==t&&0===ry.i(this.path,t.path)},ay.prototype.toString=function(){return this.path.toString()},ay.i=function(t,e){return ry.i(t.path,e.path)},ay.F=function(t){return t.length%2==0},ay.$=function(t){return new ay(new ry(t.slice()))},ay);function ay(t){this.path=t}function uy(){return null!==ey&&ey.apply(this,arguments)||this}function cy(){return null!==ny&&ny.apply(this,arguments)||this}function hy(t,e,n){void 0===e?e=0:e>t.length&&Xv(),void 0===n?n=t.length-e:n>t.length-e&&Xv(),this.segments=t,this.offset=e,this.t=n}function ly(t,e){if(0!==e.length)throw new Bv(qv.INVALID_ARGUMENT,"Function "+t+"() does not support arguments, but was called with "+ky(e.length,"argument")+".")}function fy(t,e,n){if(e.length!==n)throw new Bv(qv.INVALID_ARGUMENT,"Function "+t+"() requires "+ky(n,"argument")+", but was called with "+ky(e.length,"argument")+".")}function py(t,e,n){if(e.length<n)throw new Bv(qv.INVALID_ARGUMENT,"Function "+t+"() requires at least "+ky(n,"argument")+", but was called with "+ky(e.length,"argument")+".")}function dy(t,e,n,r){if(e.length<n||e.length>r)throw new Bv(qv.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+ky(e.length,"argument")+".")}function vy(t,e,n,r){wy(t,e,Ay(n)+" argument",r)}function yy(t,e,n,r){void 0!==r&&vy(t,e,n,r)}function gy(t,e,n,r){wy(t,e,n+" option",r)}function my(t,e,n,r){void 0!==r&&gy(t,e,n,r)}function by(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(Iy(s))}var a=Iy(n);throw new Bv(qv.INVALID_ARGUMENT,"Invalid value "+a+" provided to function "+t+'() for option "'+e+'". Acceptable values: '+r.join(", "))}(t,n,r)}function _y(t,e,n,r){if(!e.some(function(t){return t===r}))throw new Bv(qv.INVALID_ARGUMENT,"Invalid value "+Iy(r)+" provided to function "+t+"() for its "+Ay(n)+" argument. Acceptable values: "+e.join(", "));return r}function wy(t,e,n,r){if(!("object"===e?Ey(r):"non-empty string"===e?"string"==typeof r&&""!==r:typeof r===e)){r=Iy(r);throw new Bv(qv.INVALID_ARGUMENT,"Function "+t+"() requires its "+n+" to be of type "+e+", but it was: "+r)}}function Ey(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}function Iy(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":Xv();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 Ty(t,e,n){if(void 0===n)throw new Bv(qv.INVALID_ARGUMENT,"Function "+t+"() requires a valid "+Ay(e)+" argument, but it was undefined.")}function Sy(n,t,r){Zv(t,function(t,e){if(r.indexOf(t)<0)throw new Bv(qv.INVALID_ARGUMENT,"Unknown option '"+t+"' passed to function "+n+"(). Available options: "+r.join(", "))})}function Cy(t,e,n,r){r=Iy(r);return new Bv(qv.INVALID_ARGUMENT,"Function "+t+"() requires its "+Ay(n)+" argument to be a "+e+", but it was: "+r)}function Ny(t,e,n){if(n<=0)throw new Bv(qv.INVALID_ARGUMENT,"Function "+t+"() requires its "+Ay(e)+" argument to be a positive number, but it was: "+n+".")}function Ay(t){switch(t){case 1:return"first";case 2:return"second";case 3:return"third";default:return t+"th"}}function ky(t,e){return t+" "+e+(1===t?"":"s")}var Oy=(Ry.k=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length,n="";n.length<20;)for(var r=function(t){var e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(var r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n}(40),i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%t.length));return n},Ry);function Ry(){}function Py(t,e){return t<e?-1:e<t?1:0}function Dy(t,n,r){return t.length===n.length&&t.every(function(t,e){return r(t,n[e])})}function xy(t){return t+"\0"}var Ly=(My.fromBase64String=function(t){return new My(atob(t))},My.fromUint8Array=function(t){return new My(function(t){for(var e="",n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t))},My.prototype.toBase64=function(){return t=this.M,btoa(t);var t},My.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.M)},My.prototype.O=function(){return 2*this.M.length},My.prototype.L=function(t){return Py(this.M,t.M)},My.prototype.isEqual=function(t){return this.M===t.M},My);function My(t){this.M=t}Ly.B=new Ly("");var Fy=(Uy.fromBase64String=function(t){try{return new Uy(Ly.fromBase64String(t))}catch(t){throw new Bv(qv.INVALID_ARGUMENT,"Failed to construct Bytes from Base64 string: "+t)}},Uy.fromUint8Array=function(t){return new Uy(Ly.fromUint8Array(t))},Uy.prototype.toBase64=function(){return this.q.toBase64()},Uy.prototype.toUint8Array=function(){return this.q.toUint8Array()},Uy.prototype.toString=function(){return"Bytes(base64: "+this.toBase64()+")"},Uy.prototype.isEqual=function(t){return this.q.isEqual(t.q)},Uy);function Uy(t){this.q=t}function jy(){if("undefined"==typeof Uint8Array)throw new Bv(qv.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function Vy(){if("undefined"==typeof atob)throw new Bv(qv.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}function qy(t,e,n,r,i){this.U=t,this.persistenceKey=e,this.host=n,this.ssl=r,this.forceLongPolling=i}var By,Wy=(go(Jy,By=Fy),Jy.fromBase64String=function(t){fy("Blob.fromBase64String",arguments,1),vy("Blob.fromBase64String","string",1,t),Vy();try{return new Jy(Ly.fromBase64String(t))}catch(t){throw new Bv(qv.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+t)}},Jy.fromUint8Array=function(t){if(fy("Blob.fromUint8Array",arguments,1),jy(),!(t instanceof Uint8Array))throw Cy("Blob.fromUint8Array","Uint8Array",1,t);return new Jy(Ly.fromUint8Array(t))},Jy.prototype.toBase64=function(){return fy("Blob.toBase64",arguments,0),Vy(),By.prototype.toBase64.call(this)},Jy.prototype.toUint8Array=function(){return fy("Blob.toUint8Array",arguments,0),jy(),By.prototype.toUint8Array.call(this)},Jy.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},Jy),Hy=(Object.defineProperty($y.prototype,"W",{get:function(){return"(default)"===this.database},enumerable:!1,configurable:!0}),$y.prototype.isEqual=function(t){return t instanceof $y&&t.projectId===this.projectId&&t.database===this.database},$y.prototype.L=function(t){return Py(this.projectId,t.projectId)||Py(this.database,t.database)},$y),Gy=(Xy.prototype.get=function(t){var e=this.j(t),e=this.G[e];if(void 0!==e)for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],i=i[1];if(this.K(o,t))return i}},Xy.prototype.has=function(t){return void 0!==this.get(t)},Xy.prototype.set=function(t,e){var n=this.j(t),r=this.G[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(this.K(r[i][0],t))return void(r[i]=[t,e]);r.push([t,e])}else this.G[n]=[[t,e]]},Xy.prototype.delete=function(t){var e=this.j(t),n=this.G[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(this.K(n[r][0],t))return 1===n.length?delete this.G[e]:n.splice(r,1),!0;return!1},Xy.prototype.forEach=function(s){Zv(this.G,function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],i=i[1];s(o,i)}})},Xy.prototype.m=function(){return ty(this.G)},Xy),Ky=(Yy.now=function(){return Yy.fromMillis(Date.now())},Yy.fromDate=function(t){return Yy.fromMillis(t.getTime())},Yy.fromMillis=function(t){var e=Math.floor(t/1e3);return new Yy(e,1e6*(t-1e3*e))},Yy.prototype.toDate=function(){return new Date(this.toMillis())},Yy.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},Yy.prototype.H=function(t){return this.seconds===t.seconds?Py(this.nanoseconds,t.nanoseconds):Py(this.seconds,t.seconds)},Yy.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},Yy.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},Yy.prototype.toJSON=function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}},Yy.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},Yy),zy=(Qy.Y=function(t){return new Qy(t)},Qy.min=function(){return new Qy(new Ky(0,0))},Qy.prototype.L=function(t){return this.timestamp.H(t.timestamp)},Qy.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},Qy.prototype.J=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},Qy.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},Qy.prototype.X=function(){return this.timestamp},Qy);function Qy(t){this.timestamp=t}function Yy(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new Bv(qv.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new Bv(qv.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Bv(qv.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new Bv(qv.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function Xy(t,e){this.j=t,this.K=e,this.G={}}function $y(t,e){this.projectId=t,this.database=e||"(default)"}function Jy(){return null!==By&&By.apply(this,arguments)||this}function Zy(t){return null==t}function tg(t){return 0===t&&1/t==-1/0}function eg(t){return"number"==typeof t&&Number.isInteger(t)&&!tg(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var ng=function(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.Z=null};function rg(t,e,n,r,i,o,s){return 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),new ng(t,e,n,r,i,o,s)}function ig(t){var e=t;return null===e.Z&&(t=e.path.R(),null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(function(t){return(t=t).field.R()+t.op.toString()+rm(t.value)}).join(","),t+="|ob:",t+=e.orderBy.map(function(t){return(t=t).field.R()+t.dir}).join(","),Zy(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=M_(e.startAt)),e.endAt&&(t+="|ub:",t+=M_(e.endAt)),e.Z=t),e.Z}function og(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(var n,r,i=0;i<t.orderBy.length;i++)if(n=t.orderBy[i],r=e.orderBy[i],n.dir!==r.dir||!n.field.isEqual(r.field))return!1;if(t.filters.length!==e.filters.length)return!1;for(var o,s,a=0;a<t.filters.length;a++)if(o=t.filters[a],s=e.filters[a],o.op!==s.op||!o.field.isEqual(s.field)||!Zg(o.value,s.value))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!U_(t.startAt,e.startAt)&&U_(t.endAt,e.endAt)}function sg(t){return sy.F(t.path)&&null===t.collectionGroup&&0===t.filters.length}function ag(t){this.count=t}var ug,cg=(hg.prototype.nt=function(t){return new hg(this.target,this.targetId,this.tt,t,this.et,this.lastLimboFreeSnapshotVersion,this.resumeToken)},hg.prototype.st=function(t,e){return new hg(this.target,this.targetId,this.tt,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)},hg.prototype.it=function(t){return new hg(this.target,this.targetId,this.tt,this.sequenceNumber,this.et,t,this.resumeToken)},hg);function hg(t,e,n,r,i,o,s){void 0===i&&(i=zy.min()),void 0===o&&(o=zy.min()),void 0===s&&(s=Ly.B),this.target=t,this.targetId=e,this.tt=n,this.sequenceNumber=r,this.et=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s}function lg(t){switch(t){case qv.OK:return Xv(),0;case qv.CANCELLED:case qv.UNKNOWN:case qv.DEADLINE_EXCEEDED:case qv.RESOURCE_EXHAUSTED:case qv.INTERNAL:case qv.UNAVAILABLE:case qv.UNAUTHENTICATED:return;case qv.INVALID_ARGUMENT:case qv.NOT_FOUND:case qv.ALREADY_EXISTS:case qv.PERMISSION_DENIED:case qv.FAILED_PRECONDITION:case qv.ABORTED:case qv.OUT_OF_RANGE:case qv.UNIMPLEMENTED:case qv.DATA_LOSS:return 1;default:return Xv(),0}}function fg(t){if(void 0===t)return zv("GRPC error has no .code"),qv.UNKNOWN;switch(t){case ug.OK:return qv.OK;case ug.CANCELLED:return qv.CANCELLED;case ug.UNKNOWN:return qv.UNKNOWN;case ug.DEADLINE_EXCEEDED:return qv.DEADLINE_EXCEEDED;case ug.RESOURCE_EXHAUSTED:return qv.RESOURCE_EXHAUSTED;case ug.INTERNAL:return qv.INTERNAL;case ug.UNAVAILABLE:return qv.UNAVAILABLE;case ug.UNAUTHENTICATED:return qv.UNAUTHENTICATED;case ug.INVALID_ARGUMENT:return qv.INVALID_ARGUMENT;case ug.NOT_FOUND:return qv.NOT_FOUND;case ug.ALREADY_EXISTS:return qv.ALREADY_EXISTS;case ug.PERMISSION_DENIED:return qv.PERMISSION_DENIED;case ug.FAILED_PRECONDITION:return qv.FAILED_PRECONDITION;case ug.ABORTED:return qv.ABORTED;case ug.OUT_OF_RANGE:return qv.OUT_OF_RANGE;case ug.UNIMPLEMENTED:return qv.UNIMPLEMENTED;case ug.DATA_LOSS:return qv.DATA_LOSS;default:return Xv()}}(Dr=ug=ug||{})[Dr.OK=0]="OK",Dr[Dr.CANCELLED=1]="CANCELLED",Dr[Dr.UNKNOWN=2]="UNKNOWN",Dr[Dr.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Dr[Dr.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Dr[Dr.NOT_FOUND=5]="NOT_FOUND",Dr[Dr.ALREADY_EXISTS=6]="ALREADY_EXISTS",Dr[Dr.PERMISSION_DENIED=7]="PERMISSION_DENIED",Dr[Dr.UNAUTHENTICATED=16]="UNAUTHENTICATED",Dr[Dr.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Dr[Dr.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Dr[Dr.ABORTED=10]="ABORTED",Dr[Dr.OUT_OF_RANGE=11]="OUT_OF_RANGE",Dr[Dr.UNIMPLEMENTED=12]="UNIMPLEMENTED",Dr[Dr.INTERNAL=13]="INTERNAL",Dr[Dr.UNAVAILABLE=14]="UNAVAILABLE",Dr[Dr.DATA_LOSS=15]="DATA_LOSS";var pg=(mg.prototype.rt=function(t,e){return new mg(this.i,this.root.rt(t,e,this.i).copy(null,null,vg.ot,null,null))},mg.prototype.remove=function(t){return new mg(this.i,this.root.remove(t,this.i).copy(null,null,vg.ot,null,null))},mg.prototype.get=function(t){for(var e=this.root;!e.m();){var n=this.i(t,e.key);if(0===n)return e.value;n<0?e=e.left:0<n&&(e=e.right)}return null},mg.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.m();){var r=this.i(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},mg.prototype.m=function(){return this.root.m()},Object.defineProperty(mg.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),mg.prototype.at=function(){return this.root.at()},mg.prototype.ct=function(){return this.root.ct()},mg.prototype.ut=function(t){return this.root.ut(t)},mg.prototype.forEach=function(n){this.ut(function(t,e){return n(t,e),!1})},mg.prototype.toString=function(){var n=[];return this.ut(function(t,e){return n.push(t+":"+e),!1}),"{"+n.join(", ")+"}"},mg.prototype.ht=function(t){return this.root.ht(t)},mg.prototype.lt=function(){return new dg(this.root,null,this.i,!1)},mg.prototype._t=function(t){return new dg(this.root,t,this.i,!1)},mg.prototype.ft=function(){return new dg(this.root,null,this.i,!0)},mg.prototype.dt=function(t){return new dg(this.root,t,this.i,!0)},mg),dg=(gg.prototype.Et=function(){var t=this.Tt.pop(),e={key:t.key,value:t.value};if(this.wt)for(t=t.left;!t.m();)this.Tt.push(t),t=t.right;else for(t=t.right;!t.m();)this.Tt.push(t),t=t.left;return e},gg.prototype.It=function(){return 0<this.Tt.length},gg.prototype.At=function(){if(0===this.Tt.length)return null;var t=this.Tt[this.Tt.length-1];return{key:t.key,value:t.value}},gg),vg=(yg.prototype.copy=function(t,e,n,r,i){return new yg(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)},yg.prototype.m=function(){return!1},yg.prototype.ut=function(t){return this.left.ut(t)||t(this.key,this.value)||this.right.ut(t)},yg.prototype.ht=function(t){return this.right.ht(t)||t(this.key,this.value)||this.left.ht(t)},yg.prototype.min=function(){return this.left.m()?this:this.left.min()},yg.prototype.at=function(){return this.min().key},yg.prototype.ct=function(){return this.right.m()?this.key:this.right.ct()},yg.prototype.rt=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.rt(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.rt(t,e,n))).Rt()},yg.prototype.Pt=function(){if(this.left.m())return yg.EMPTY;var t=this;return t.left.gt()||t.left.left.gt()||(t=t.yt()),(t=t.copy(null,null,null,t.left.Pt(),null)).Rt()},yg.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r.left.m()||r.left.gt()||r.left.left.gt()||(r=r.yt()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.gt()&&(r=r.Vt()),r.right.m()||r.right.gt()||r.right.left.gt()||(r=r.bt()),0===e(t,r.key)){if(r.right.m())return yg.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.Pt())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.Rt()},yg.prototype.gt=function(){return this.color},yg.prototype.Rt=function(){var t=this;return t.right.gt()&&!t.left.gt()&&(t=t.vt()),t.left.gt()&&t.left.left.gt()&&(t=t.Vt()),t.left.gt()&&t.right.gt()&&(t=t.St()),t},yg.prototype.yt=function(){var t=this.St();return t.right.left.gt()&&(t=(t=(t=t.copy(null,null,null,null,t.right.Vt())).vt()).St()),t},yg.prototype.bt=function(){var t=this.St();return t.left.left.gt()&&(t=(t=t.Vt()).St()),t},yg.prototype.vt=function(){var t=this.copy(null,null,yg.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},yg.prototype.Vt=function(){var t=this.copy(null,null,yg.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},yg.prototype.St=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)},yg.prototype.Dt=function(){var t=this.Ct();return Math.pow(2,t)<=this.size+1},yg.prototype.Ct=function(){if(this.gt()&&this.left.gt())throw Xv();if(this.right.gt())throw Xv();var t=this.left.Ct();if(t!==this.right.Ct())throw Xv();return t+(this.gt()?0:1)},yg);function yg(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:yg.RED,this.left=null!=r?r:yg.EMPTY,this.right=null!=i?i:yg.EMPTY,this.size=this.left.size+1+this.right.size}function gg(t,e,n,r){this.wt=r,this.Tt=[];for(var i=1;!t.m();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.wt?t.left:t.right;else{if(0===i){this.Tt.push(t);break}this.Tt.push(t),t=this.wt?t.right:t.left}}function mg(t,e){this.i=t,this.root=e||vg.EMPTY}function bg(){this.size=0}vg.EMPTY=null,vg.RED=!0,vg.ot=!1,vg.EMPTY=(Object.defineProperty(bg.prototype,"key",{get:function(){throw Xv()},enumerable:!1,configurable:!0}),Object.defineProperty(bg.prototype,"value",{get:function(){throw Xv()},enumerable:!1,configurable:!0}),Object.defineProperty(bg.prototype,"color",{get:function(){throw Xv()},enumerable:!1,configurable:!0}),Object.defineProperty(bg.prototype,"left",{get:function(){throw Xv()},enumerable:!1,configurable:!0}),Object.defineProperty(bg.prototype,"right",{get:function(){throw Xv()},enumerable:!1,configurable:!0}),bg.prototype.copy=function(t,e,n,r,i){return this},bg.prototype.rt=function(t,e,n){return new vg(t,e)},bg.prototype.remove=function(t,e){return this},bg.prototype.m=function(){return!0},bg.prototype.ut=function(t){return!1},bg.prototype.ht=function(t){return!1},bg.prototype.at=function(){return null},bg.prototype.ct=function(){return null},bg.prototype.gt=function(){return!1},bg.prototype.Dt=function(){return!0},bg.prototype.Ct=function(){return 0},new bg);var _g=(Tg.prototype.has=function(t){return null!==this.data.get(t)},Tg.prototype.first=function(){return this.data.at()},Tg.prototype.last=function(){return this.data.ct()},Object.defineProperty(Tg.prototype,"size",{get:function(){return this.data.size},enumerable:!1,configurable:!0}),Tg.prototype.indexOf=function(t){return this.data.indexOf(t)},Tg.prototype.forEach=function(n){this.data.ut(function(t,e){return n(t),!1})},Tg.prototype.Nt=function(t,e){for(var n=this.data._t(t[0]);n.It();){var r=n.Et();if(0<=this.i(r.key,t[1]))return;e(r.key)}},Tg.prototype.Ft=function(t,e){for(var n=void 0!==e?this.data._t(e):this.data.lt();n.It();)if(!t(n.Et().key))return},Tg.prototype.$t=function(t){t=this.data._t(t);return t.It()?t.Et().key:null},Tg.prototype.lt=function(){return new wg(this.data.lt())},Tg.prototype._t=function(t){return new wg(this.data._t(t))},Tg.prototype.add=function(t){return this.copy(this.data.remove(t).rt(t,!0))},Tg.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},Tg.prototype.m=function(){return this.data.m()},Tg.prototype.xt=function(t){var e=this;return e.size<t.size&&(e=t,t=this),t.forEach(function(t){e=e.add(t)}),e},Tg.prototype.isEqual=function(t){if(!(t instanceof Tg))return!1;if(this.size!==t.size)return!1;for(var e=this.data.lt(),n=t.data.lt();e.It();){var r=e.Et().key,i=n.Et().key;if(0!==this.i(r,i))return!1}return!0},Tg.prototype.A=function(){var e=[];return this.forEach(function(t){e.push(t)}),e},Tg.prototype.toString=function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"},Tg.prototype.copy=function(t){var e=new Tg(this.i);return e.data=t,e},Tg),wg=(Ig.prototype.Et=function(){return this.kt.Et().key},Ig.prototype.It=function(){return this.kt.It()},Ig),Eg=new pg(sy.i);function Ig(t){this.kt=t}function Tg(t){this.i=t,this.data=new pg(this.i)}var Sg=new pg(sy.i);var Cg=new pg(sy.i),Ng=new _g(sy.i);function Ag(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=Ng,r=0,i=t;r<i.length;r++)var o=i[r],n=n.add(o);return n}var kg=new _g(Py);var Og=(Kg.Lt=function(t){return new Kg(t.i)},Kg.prototype.has=function(t){return null!=this.Mt.get(t)},Kg.prototype.get=function(t){return this.Mt.get(t)},Kg.prototype.first=function(){return this.Ot.at()},Kg.prototype.last=function(){return this.Ot.ct()},Kg.prototype.m=function(){return this.Ot.m()},Kg.prototype.indexOf=function(t){t=this.Mt.get(t);return t?this.Ot.indexOf(t):-1},Object.defineProperty(Kg.prototype,"size",{get:function(){return this.Ot.size},enumerable:!1,configurable:!0}),Kg.prototype.forEach=function(n){this.Ot.ut(function(t,e){return n(t),!1})},Kg.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.Mt.rt(t.key,t),e.Ot.rt(t,null))},Kg.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.Mt.remove(t),this.Ot.remove(e)):this},Kg.prototype.isEqual=function(t){if(!(t instanceof Kg))return!1;if(this.size!==t.size)return!1;for(var e=this.Ot.lt(),n=t.Ot.lt();e.It();){var r=e.Et().key,i=n.Et().key;if(!r.isEqual(i))return!1}return!0},Kg.prototype.toString=function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"},Kg.prototype.copy=function(t,e){var n=new Kg;return n.i=this.i,n.Mt=t,n.Ot=e,n},Kg),Rg=(Gg.prototype.track=function(t){var e=t.doc.key,n=this.Bt.get(e);!n||0!==t.type&&3===n.type?this.Bt=this.Bt.rt(e,t):3===t.type&&1!==n.type?this.Bt=this.Bt.rt(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Bt=this.Bt.rt(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Bt=this.Bt.rt(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Bt=this.Bt.remove(e):1===t.type&&2===n.type?this.Bt=this.Bt.rt(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Bt=this.Bt.rt(e,{type:2,doc:t.doc}):Xv()},Gg.prototype.qt=function(){var n=[];return this.Bt.ut(function(t,e){n.push(e)}),n},Gg),Pg=(Hg.Kt=function(t,e,n,r){var i=[];return e.forEach(function(t){i.push({type:0,doc:t})}),new Hg(t,e,Og.Lt(e),i,n,r,!0,!1)},Object.defineProperty(Hg.prototype,"hasPendingWrites",{get:function(){return!this.Qt.m()},enumerable:!1,configurable:!0}),Hg.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.Wt===t.Wt&&this.Qt.isEqual(t.Qt)&&o_(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.Ut.isEqual(t.Ut)))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},Hg),Dg=(Wg.Jt=function(t,e){var n=new Map;return n.set(t,xg.Xt(t,e)),new Wg(zy.min(),n,kg,Eg,Ag())},Wg),xg=(Bg.Xt=function(t,e){return new Bg(Ly.B,e,Ag(),Ag(),Ag())},Bg),Lg=function(t,e,n,r){this.se=t,this.removedTargetIds=e,this.key=n,this.ie=r},Mg=function(t,e){this.targetId=t,this.re=e},Fg=function(t,e,n,r){void 0===n&&(n=Ly.B),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r},Ug=(Object.defineProperty(qg.prototype,"Zt",{get:function(){return this.ue},enumerable:!1,configurable:!0}),Object.defineProperty(qg.prototype,"resumeToken",{get:function(){return this.ce},enumerable:!1,configurable:!0}),Object.defineProperty(qg.prototype,"le",{get:function(){return 0!==this.oe},enumerable:!1,configurable:!0}),Object.defineProperty(qg.prototype,"_e",{get:function(){return this.he},enumerable:!1,configurable:!0}),qg.prototype.fe=function(t){0<t.O()&&(this.he=!0,this.ce=t)},qg.prototype.de=function(){var n=Ag(),r=Ag(),i=Ag();return this.ae.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:Xv()}}),new xg(this.ce,this.ue,n,r,i)},qg.prototype.we=function(){this.he=!1,this.ae=Qg()},qg.prototype.me=function(t,e){this.he=!0,this.ae=this.ae.rt(t,e)},qg.prototype.Te=function(t){this.he=!0,this.ae=this.ae.remove(t)},qg.prototype.Ee=function(){this.oe+=1},qg.prototype.Ie=function(){--this.oe},qg.prototype.Ae=function(){this.he=!0,this.ue=!0},qg),jg=(Vg.prototype.pe=function(t){for(var e=0,n=t.se;e<n.length;e++){var r=n[e];t.ie instanceof Vb?this.be(r,t.ie):t.ie instanceof qb&&this.ve(r,t.key,t.ie)}for(var i=0,o=t.removedTargetIds;i<o.length;i++){var s=o[i];this.ve(s,t.key,t.ie)}},Vg.prototype.Se=function(n){var r=this;this.De(n,function(t){var e=r.Ce(t);switch(n.state){case 0:r.Ne(t)&&e.fe(n.resumeToken);break;case 1:e.Ie(),e.le||e.we(),e.fe(n.resumeToken);break;case 2:e.Ie(),e.le||r.removeTarget(t);break;case 3:r.Ne(t)&&(e.Ae(),e.fe(n.resumeToken));break;case 4:r.Ne(t)&&(r.Fe(t),e.fe(n.resumeToken));break;default:Xv()}})},Vg.prototype.De=function(t,n){var r=this;0<t.targetIds.length?t.targetIds.forEach(n):this.Pe.forEach(function(t,e){r.Ne(e)&&n(e)})},Vg.prototype.$e=function(t){var e=t.targetId,n=t.re.count,t=this.xe(e);t&&(sg(t=t.target)?0===n?(t=new sy(t.path),this.ve(e,t,new qb(t,zy.min()))):$v(1===n):this.ke(e)!==n&&(this.Fe(e),this.Ve=this.Ve.add(e)))},Vg.prototype.Me=function(r){var i=this,o=new Map;this.Pe.forEach(function(t,e){var n=i.xe(e);n&&(t.Zt&&sg(n.target)&&(n=new sy(n.target.path),null!==i.ge.get(n)||i.Oe(e,n)||i.ve(e,n,new qb(n,r))),t._e&&(o.set(e,t.de()),t.we()))});var s=Ag();this.ye.forEach(function(t,e){var n=!0;e.Ft(function(t){t=i.xe(t);return!t||2===t.tt||(n=!1)}),n&&(s=s.add(t))});var t=new Dg(r,o,this.Ve,this.ge,s);return this.ge=Eg,this.ye=zg(),this.Ve=new _g(Py),t},Vg.prototype.be=function(t,e){var n;this.Ne(t)&&(n=this.Oe(t,e.key)?2:0,this.Ce(t).me(e.key,n),this.ge=this.ge.rt(e.key,e),this.ye=this.ye.rt(e.key,this.Le(e.key).add(t)))},Vg.prototype.ve=function(t,e,n){var r;this.Ne(t)&&(r=this.Ce(t),this.Oe(t,e)?r.me(e,1):r.Te(e),this.ye=this.ye.rt(e,this.Le(e).delete(t)),n&&(this.ge=this.ge.rt(e,n)))},Vg.prototype.removeTarget=function(t){this.Pe.delete(t)},Vg.prototype.ke=function(t){var e=this.Ce(t).de();return this.Re.Be(t).size+e.te.size-e.ne.size},Vg.prototype.Ee=function(t){this.Ce(t).Ee()},Vg.prototype.Ce=function(t){var e=this.Pe.get(t);return e||(e=new Ug,this.Pe.set(t,e)),e},Vg.prototype.Le=function(t){var e=this.ye.get(t);return e||(e=new _g(Py),this.ye=this.ye.rt(t,e)),e},Vg.prototype.Ne=function(t){var e=null!==this.xe(t);return e||Kv("WatchChangeAggregator","Detected inactive target",t),e},Vg.prototype.xe=function(t){var e=this.Pe.get(t);return e&&e.le?null:this.Re.qe(t)},Vg.prototype.Fe=function(e){var n=this;this.Pe.set(e,new Ug),this.Re.Be(e).forEach(function(t){n.ve(e,t,null)})},Vg.prototype.Oe=function(t,e){return this.Re.Be(t).has(e)},Vg);function Vg(t){this.Re=t,this.Pe=new Map,this.ge=Eg,this.ye=zg(),this.Ve=new _g(Py)}function qg(){this.oe=0,this.ae=Qg(),this.ce=Ly.B,this.ue=!1,this.he=!0}function Bg(t,e,n,r,i){this.resumeToken=t,this.Zt=e,this.te=n,this.ee=r,this.ne=i}function Wg(t,e,n,r,i){this.et=t,this.Gt=e,this.zt=n,this.Ht=r,this.Yt=i}function Hg(t,e,n,r,i,o,s,a){this.query=t,this.docs=e,this.Ut=n,this.docChanges=r,this.Qt=i,this.fromCache=o,this.Wt=s,this.jt=a}function Gg(){this.Bt=new pg(sy.i)}function Kg(n){this.i=n?function(t,e){return n(t,e)||sy.i(t.key,e.key)}:function(t,e){return sy.i(t.key,e.key)},this.Mt=Sg,this.Ot=new pg(this.i)}function zg(){return new pg(sy.i)}function Qg(){return new pg(sy.i)}function Yg(t){return"server_timestamp"===(null===(t=((null===(t=null==t?void 0:t.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===t?void 0:t.stringValue)}function Xg(t){t=im(t.mapValue.fields.__local_write_time__.timestampValue);return new Ky(t.seconds,t.nanos)}var $g=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Jg(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?Yg(t)?4:10:Xv()}function Zg(r,i){var t,e=Jg(r);if(e!==Jg(i))return!1;switch(e){case 0:return!0;case 1:return r.booleanValue===i.booleanValue;case 4:return Xg(r).isEqual(Xg(i));case 3:return function(t){if("string"==typeof r.timestampValue&&"string"==typeof t.timestampValue&&r.timestampValue.length===t.timestampValue.length)return r.timestampValue===t.timestampValue;var e=im(r.timestampValue),t=im(t.timestampValue);return e.seconds===t.seconds&&e.nanos===t.nanos}(i);case 5:return r.stringValue===i.stringValue;case 6:return t=i,sm(r.bytesValue).isEqual(sm(t.bytesValue));case 7:return r.referenceValue===i.referenceValue;case 8:return e=i,om((t=r).geoPointValue.latitude)===om(e.geoPointValue.latitude)&&om(t.geoPointValue.longitude)===om(e.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return om(t.integerValue)===om(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){t=om(t.doubleValue),e=om(e.doubleValue);return t===e?tg(t)===tg(e):isNaN(t)&&isNaN(e)}return!1}(r,i);case 9:return Dy(r.arrayValue.values||[],i.arrayValue.values||[],Zg);case 10:return function(){var t,e=r.mapValue.fields||{},n=i.mapValue.fields||{};if(Jv(e)!==Jv(n))return!1;for(t in e)if(e.hasOwnProperty(t)&&(void 0===n[t]||!Zg(e[t],n[t])))return!1;return!0}();default:return Xv()}}function tm(t,e){return void 0!==(t.values||[]).find(function(t){return Zg(t,e)})}function em(t,e){var n,r,i=Jg(t),o=Jg(e);if(i!==o)return Py(i,o);switch(i){case 0:return 0;case 1:return Py(t.booleanValue,e.booleanValue);case 2:return n=e,r=om(t.integerValue||t.doubleValue),n=om(n.integerValue||n.doubleValue),r<n?-1:n<r?1:r===n?0:isNaN(r)?isNaN(n)?0:-1:1;case 3:return nm(t.timestampValue,e.timestampValue);case 4:return nm(Xg(t),Xg(e));case 5:return Py(t.stringValue,e.stringValue);case 6:return function(t,e){t=sm(t),e=sm(e);return t.L(e)}(t.bytesValue,e.bytesValue);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=Py(n[i],r[i]);if(0!==o)return o}return Py(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return i=t.geoPointValue,r=e.geoPointValue,0!==(n=Py(om(i.latitude),om(r.latitude)))?n:Py(om(i.longitude),om(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=em(n[i],r[i]);if(o)return o}return Py(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=Py(r[s],o[s]);if(0!==a)return a;a=em(n[r[s]],i[o[s]]);if(0!==a)return a}return Py(r.length,o.length)}(t.mapValue,e.mapValue);default:throw Xv()}}function nm(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Py(t,e);var n=im(t),t=im(e),e=Py(n.seconds,t.seconds);return 0!==e?e:Py(n.nanos,t.nanos)}function rm(t){return function s(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){var t=im(t);return"time("+t.seconds+","+t.nanos+")"}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?sm(t.bytesValue).toBase64():"referenceValue"in t?(e=t.referenceValue,sy.C(e).toString()):"geoPointValue"in t?"geo("+(e=t.geoPointValue).latitude+","+e.longitude+")":"arrayValue"in t?function(t){for(var e="[",n=!0,r=0,i=t.values||[];r<i.length;r++)n?n=!1:e+=",",e+=s(i[r]);return e+"]"}(t.arrayValue):"mapValue"in t?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+"}"}(t.mapValue):Xv();var e}(t)}function im(t){if($v(!!t),"string"!=typeof t)return{seconds:om(t.seconds),nanos:om(t.nanos)};var e=0,n=$g.exec(t);$v(!!n),n[1]&&(n=((n=n[1])+"000000000").substr(0,9),e=Number(n));t=new Date(t);return{seconds:Math.floor(t.getTime()/1e3),nanos:e}}function om(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function sm(t){return"string"==typeof t?Ly.fromBase64String(t):Ly.fromUint8Array(t)}function am(t,e){return{referenceValue:"projects/"+t.projectId+"/databases/"+t.database+"/documents/"+e.path.R()}}function um(t){return t&&"integerValue"in t}function cm(t){return!!t&&"arrayValue"in t}function hm(t){return t&&"nullValue"in t}function lm(t){return t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function fm(t){return t&&"mapValue"in t}var pm={asc:"ASCENDING",desc:"DESCENDING"},dm={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},vm=function(t,e){this.U=t,this.Ue=e};function ym(t){return{integerValue:""+t}}function gm(t,e){if(t.Ue){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:tg(e)?"-0":e}}function mm(t,e){return eg(e)?ym(e):gm(t,e)}function bm(t,e){return t.Ue?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function _m(t,e){return t.Ue?e.toBase64():e.toUint8Array()}function wm(t){return $v(!!t),zy.Y((t=im(t),new Ky(t.seconds,t.nanos)))}function Em(t,e){return new ry(["projects",t.projectId,"databases",t.database]).child("documents").child(e).R()}function Im(t){t=ry.P(t);return $v(qm(t)),t}function Tm(t,e){return Em(t.U,e.path)}function Sm(t,e){e=Im(e);return $v(e.get(1)===t.U.projectId),$v(!e.get(3)&&!t.U.database||e.get(3)===t.U.database),new sy(km(e))}function Cm(t,e){return Em(t.U,e)}function Nm(t){t=Im(t);return 4===t.length?ry.g():km(t)}function Am(t){return new ry(["projects",t.U.projectId,"databases",t.U.database]).R()}function km(t){return $v(4<t.length&&"documents"===t.get(4)),t.u(5)}function Om(t,e,n){return{name:Tm(t,e),fields:n.proto.mapValue.fields}}function Rm(t,e){var n,r,i;if(e instanceof mb)n={update:Om(t,e.key,e.value)};else if(e instanceof kb)n={delete:Tm(t,e.key)};else if(e instanceof bb)n={update:Om(t,e.key,e.data),updateMask:(i=e.Qe,r=[],i.fields.forEach(function(t){return r.push(t.R())}),{fieldPaths:r})};else if(e instanceof Tb)n={transform:{document:Tm(t,e.key),fieldTransforms:e.fieldTransforms.map(function(t){var e=t.transform;if(e instanceof Gm)return{fieldPath:t.field.R(),setToServerValue:"REQUEST_TIME"};if(e instanceof Km)return{fieldPath:t.field.R(),appendMissingElements:{values:e.elements}};if(e instanceof $m)return{fieldPath:t.field.R(),removeAllFromArray:{values:e.elements}};if(e instanceof eb)return{fieldPath:t.field.R(),increment:e.We};throw Xv()})}};else{if(!(e instanceof Ob))return Xv();n={verify:Tm(t,e.key)}}return e.Ke.je||(n.currentDocument=void 0!==(i=e.Ke).updateTime?{updateTime:(e=t,t=i.updateTime,bm(e,t.X()))}:void 0!==i.exists?{exists:i.exists}:Xv()),n}function Pm(e,t){var n=t.currentDocument?void 0!==(o=t.currentDocument).updateTime?cb.updateTime(wm(o.updateTime)):void 0!==o.exists?cb.exists(o.exists):cb.Ge():cb.Ge();if(t.update){t.update.name;var r=Sm(e,t.update.name),i=new Rb({mapValue:{fields:t.update.fields}});if(t.updateMask){var o=(o=t.updateMask.fieldPaths||[],new ob(o.map(function(t){return oy.S(t)})));return new bb(r,i,o,n)}return new mb(r,i,n)}if(t.delete){var s=Sm(e,t.delete);return new kb(s,n)}if(t.transform){i=Sm(e,t.transform.document),s=t.transform.fieldTransforms.map(function(t){return function(t,e){var n,r=null;"setToServerValue"in e?($v("REQUEST_TIME"===e.setToServerValue),r=new Gm):"appendMissingElements"in e?(n=e.appendMissingElements.values||[],r=new Km(n)):"removeAllFromArray"in e?(n=e.removeAllFromArray.values||[],r=new $m(n)):"increment"in e?r=new eb(t,e.increment):Xv();e=oy.S(e.fieldPath);return new sb(e,r)}(e,t)});return $v(!0===n.exists),new Tb(i,s)}if(t.verify){t=Sm(e,t.verify);return new Ob(t,n)}return Xv()}function Dm(t,e){return{documents:[Cm(t,e.path)]}}function xm(t,e){var n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Cm(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Cm(t,r.h()),n.structuredQuery.from=[{collectionId:r._()}]);r=function(t){if(0!==t.length){t=t.map(function(t){if("=="===t.op){if(lm(t.value))return{unaryFilter:{field:Um(t.field),op:"IS_NAN"}};if(hm(t.value))return{unaryFilter:{field:Um(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(lm(t.value))return{unaryFilter:{field:Um(t.field),op:"IS_NOT_NAN"}};if(hm(t.value))return{unaryFilter:{field:Um(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Um(t.field),op:(e=t.op,dm[e]),value:t.value}};var e});return 1===t.length?t[0]:{compositeFilter:{op:"AND",filters:t}}}}(e.filters);r&&(n.structuredQuery.where=r);r=function(t){if(0!==t.length)return t.map(function(t){return{field:Um((t=t).field),direction:(t=t.dir,pm[t])}})}(e.orderBy);r&&(n.structuredQuery.orderBy=r);r=e.limit,r=t.Ue||Zy(r)?r:{value:r};return null!==r&&(n.structuredQuery.limit=r),e.startAt&&(n.structuredQuery.startAt=Mm(e.startAt)),e.endAt&&(n.structuredQuery.endAt=Mm(e.endAt)),n}function Lm(t){var e=Nm(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;0<r&&($v(1===r),(s=n.from[0]).allDescendants?i=s.collectionId:e=e.child(s.collectionId));var o=[];n.where&&(o=function e(t){return t?void 0!==t.unaryFilter?[Vm(t)]:void 0!==t.fieldFilter?[(n=t,l_.create(jm(n.fieldFilter.field),function(){switch(n.fieldFilter.op){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return Xv()}}(),n.fieldFilter.value))]:void 0!==t.compositeFilter?t.compositeFilter.filters.map(function(t){return e(t)}).reduce(function(t,e){return t.concat(e)}):Xv():[];var n}(n.where));t=[];n.orderBy&&(t=n.orderBy.map(function(t){return new j_(jm((e=t).field),function(){switch(e.direction){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}());var e}));r=null;n.limit&&(r=Zy(a="object"==typeof(a=n.limit)?a.value:a)?null:a);var s=null;n.startAt&&(s=Fm(n.startAt));var a=null;return n.endAt&&(a=Fm(n.endAt)),e_(zb(e,i,t,o,r,"F",s,a))}function Mm(t){return{before:t.before,values:t.position}}function Fm(t){var e=!!t.before,t=t.values||[];return new R_(t,e)}function Um(t){return{fieldPath:t.R()}}function jm(t){return oy.S(t.fieldPath)}function Vm(t){switch(t.unaryFilter.op){case"IS_NAN":var e=jm(t.unaryFilter.field);return l_.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=jm(t.unaryFilter.field);return l_.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":n=jm(t.unaryFilter.field);return l_.create(n,"!=",{doubleValue:NaN});case"IS_NOT_NULL":t=jm(t.unaryFilter.field);return l_.create(t,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return Xv()}}function qm(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}M=function(){this.ze=void 0};function Bm(t,e){return t instanceof eb?um(t=e)||t&&"doubleValue"in t?e:{integerValue:0}:null}var Wm,Hm,Gm=(go(Qm,Hm=M),Qm),Km=(go(zm,Wm=M),zm);function zm(t){var e=this;return(e=Wm.call(this)||this).elements=t,e}function Qm(){return null!==Hm&&Hm.apply(this,arguments)||this}function Ym(t,e){for(var n=ib(e),r=0,i=t.elements;r<i.length;r++)!function(e){n.some(function(t){return Zg(t,e)})||n.push(e)}(i[r]);return{arrayValue:{values:n}}}var Xm,$m=(go(Jm,Xm=M),Jm);function Jm(t){var e=this;return(e=Xm.call(this)||this).elements=t,e}function Zm(t,e){for(var n=ib(e),r=0,i=t.elements;r<i.length;r++)!function(e){n=n.filter(function(t){return!Zg(t,e)})}(i[r]);return{arrayValue:{values:n}}}var tb,eb=(go(nb,tb=M),nb);function nb(t,e){var n=this;return(n=tb.call(this)||this).serializer=t,n.We=e,n}function rb(t){return om(t.integerValue||t.doubleValue)}function ib(t){return cm(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}var ob=(ab.prototype.He=function(t){for(var e=0,n=this.fields;e<n.length;e++)if(n[e].T(t))return!0;return!1},ab.prototype.isEqual=function(t){return Dy(this.fields,t.fields,function(t,e){return t.isEqual(e)})},ab),sb=function(t,e){this.field=t,this.transform=e};function ab(t){(this.fields=t).sort(oy.i)}function ub(t,e){this.version=t,this.transformResults=e}var cb=(hb.Ge=function(){return new hb},hb.exists=function(t){return new hb(void 0,t)},hb.updateTime=function(t){return new hb(t)},Object.defineProperty(hb.prototype,"je",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!1,configurable:!0}),hb.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},hb);function hb(t,e){this.updateTime=t,this.exists=e}function lb(t,e){return void 0!==t.updateTime?e instanceof Vb&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e instanceof Vb}K=function(){};function fb(t,e,n){return t instanceof mb?new Vb(t.key,n.version,t.value,{hasCommittedMutations:!0}):t instanceof bb?function(t,e,n){if(!lb(t.Ke,e))return new Bb(t.key,n.version);e=Eb(t,e);return new Vb(t.key,n.version,e,{hasCommittedMutations:!0})}(t,e,n):t instanceof Tb?function(t,e,n){if($v(null!=n.transformResults),!lb(t.Ke,e))return new Bb(t.key,n.version);var r=e,e=function(t,e,n){var r=[];$v(t.length===n.length);for(var i=0;i<n.length;i++){var o=t[i],s=o.transform,a=null;e instanceof Vb&&(a=e.field(o.field)),r.push((o=s,s=a,a=n[i],o instanceof Km?Ym(o,s):o instanceof $m?Zm(o,s):a))}return r}(t.fieldTransforms,e,n.transformResults),n=n.version,e=Cb(t,r.data(),e);return new Vb(t.key,n,e,{hasCommittedMutations:!0})}(t,e,n):new qb(t.key,n.version,{hasCommittedMutations:!0})}function pb(t,e,n,r){return t instanceof mb?function(t,e){if(!lb(t.Ke,e))return e;e=vb(e);return new Vb(t.key,e,t.value,{Ye:!0})}(t,e):t instanceof bb?function(t,e){if(!lb(t.Ke,e))return e;var n=vb(e),e=Eb(t,e);return new Vb(t.key,n,e,{Ye:!0})}(t,e):t instanceof Tb?function(t,e,n,r){if(!lb(t.Ke,e))return e;var i=e,r=function(t,e,n,r){for(var i,o=[],s=0,a=t;s<a.length;s++){var u=a[s],c=u.transform,h=null;n instanceof Vb&&(h=n.field(u.field)),null===h&&r instanceof Vb&&(h=r.field(u.field)),o.push((i=h,u=e,h=void 0,(c=c)instanceof Gm?(h={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:u.seconds,nanos:u.nanoseconds}}}},i&&(h.fields.__previous_value__=i),{mapValue:h}):c instanceof Km?Ym(c,i):c instanceof $m?Zm(c,i):(c=Bm(h=c,i),i=rb(c)+rb(h.We),um(c)&&um(h.We)?ym(i):gm(h.serializer,i))))}return o}(t.fieldTransforms,n,e,r),r=Cb(t,i.data(),r);return new Vb(t.key,i.version,r,{Ye:!0})}(t,e,r,n):(e=e,lb((t=t).Ke,e)?new qb(t.key,zy.min()):e)}function db(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.Ke.isEqual(e.Ke)&&(0===t.type?t.value.isEqual(e.value):1===t.type?t.data.isEqual(e.data)&&t.Qe.isEqual(e.Qe):2!==t.type||Dy(t.fieldTransforms,t.fieldTransforms,function(t,e){return e=e,(t=t).field.isEqual(e.field)&&(t=t.transform,e=e.transform,t instanceof Km&&e instanceof Km||t instanceof $m&&e instanceof $m?Dy(t.elements,e.elements,Zg):t instanceof eb&&e instanceof eb?Zg(t.We,e.We):t instanceof Gm&&e instanceof Gm)}))}function vb(t){return t instanceof Vb?t.version:zy.min()}var yb,gb,mb=(go(wb,gb=K),wb),bb=(go(_b,yb=K),_b);function _b(t,e,n,r){var i=this;return(i=yb.call(this)||this).key=t,i.data=e,i.Qe=n,i.Ke=r,i.type=1,i}function wb(t,e,n){var r=this;return(r=gb.call(this)||this).key=t,r.value=e,r.Ke=n,r.type=0,r}function Eb(t,e){return n=t,e=e instanceof Vb?e.data():Rb.empty(),r=new Pb(e),n.Qe.fields.forEach(function(t){var e;t.m()||(null!==(e=n.data.field(t))?r.set(t,e):r.delete(t))}),r.Je();var n,r}var Ib,Tb=(go(Sb,Ib=K),Sb);function Sb(t,e){var n=this;return(n=Ib.call(this)||this).key=t,n.fieldTransforms=e,n.type=2,n.Ke=cb.exists(!0),n}function Cb(t,e,n){for(var r=new Pb(e),i=0;i<t.fieldTransforms.length;i++){var o=t.fieldTransforms[i];r.set(o.field,n[i])}return r.Je()}var Nb,Ab,kb=(go(Mb,Ab=K),Mb),Ob=(go(Lb,Nb=K),Lb),Rb=(xb.empty=function(){return new xb({mapValue:{}})},xb.prototype.field=function(t){if(t.m())return this.proto;for(var e=this.proto,n=0;n<t.length-1;++n){if(!e.mapValue.fields)return null;if(!fm(e=e.mapValue.fields[t.get(n)]))return null}return(e=(e.mapValue.fields||{})[t._()])||null},xb.prototype.isEqual=function(t){return Zg(this.proto,t.proto)},xb),Pb=(Db.prototype.set=function(t,e){return this.tn(t,e),this},Db.prototype.delete=function(t){return this.tn(t,null),this},Db.prototype.tn=function(t,e){for(var n=this.Ze,r=0;r<t.length-1;++r)var i=t.get(r),o=n.get(i),n=(o instanceof Map||(o=o&&10===Jg(o)?new Map(Object.entries(o.mapValue.fields||{})):new Map,n.set(i,o)),o);n.set(t._(),e)},Db.prototype.Je=function(){var t=this.en(oy.g(),this.Ze);return null!=t?new Rb(t):this.Xe},Db.prototype.en=function(r,t){var i=this,o=!1,e=this.Xe.field(r),s=fm(e)?Object.assign({},e.mapValue.fields):{};return t.forEach(function(t,e){var n;t instanceof Map?null!=(n=i.en(r.child(e),t))&&(s[e]=n,o=!0):null!==t?(s[e]=t,o=!0):s.hasOwnProperty(e)&&(delete s[e],o=!0)}),o?{mapValue:{fields:s}}:null},Db);function Db(t){void 0===t&&(t=Rb.empty()),this.Xe=t,this.Ze=new Map}function xb(t){this.proto=t}function Lb(t,e){var n=this;return(n=Nb.call(this)||this).key=t,n.Ke=e,n.type=4,n}function Mb(t,e){var n=this;return(n=Ab.call(this)||this).key=t,n.Ke=e,n.type=3,n}var Fb,Ub,jb,Dr=function(t,e){this.key=t,this.version=e},Vb=(go(Kb,jb=Dr),Kb.prototype.field=function(t){return this.nn.field(t)},Kb.prototype.data=function(){return this.nn},Kb.prototype.sn=function(){return this.nn.proto},Kb.prototype.isEqual=function(t){return t instanceof Kb&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.Ye===t.Ye&&this.hasCommittedMutations===t.hasCommittedMutations&&this.nn.isEqual(t.nn)},Kb.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.nn.toString()+", {hasLocalMutations: "+this.Ye+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(Kb.prototype,"hasPendingWrites",{get:function(){return this.Ye||this.hasCommittedMutations},enumerable:!1,configurable:!0}),Kb),qb=(go(Gb,Ub=Dr),Gb.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(Gb.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!1,configurable:!0}),Gb.prototype.isEqual=function(t){return t instanceof Gb&&t.hasCommittedMutations===this.hasCommittedMutations&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Gb),Bb=(go(Hb,Fb=Dr),Hb.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(Hb.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!1,configurable:!0}),Hb.prototype.isEqual=function(t){return t instanceof Hb&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Hb),Wb=function(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.rn=n,this.filters=r,this.limit=i,this.on=o,this.startAt=s,this.endAt=a,this.an=null,this.cn=null,this.startAt,this.endAt};function Hb(){return null!==Fb&&Fb.apply(this,arguments)||this}function Gb(t,e,n){var r=this;return(r=Ub.call(this,t,e)||this).hasCommittedMutations=!(!n||!n.hasCommittedMutations),r}function Kb(t,e,n,r){var i=this;return(i=jb.call(this,t,e)||this).nn=n,i.Ye=!!r.Ye,i.hasCommittedMutations=!!r.hasCommittedMutations,i}function zb(t,e,n,r,i,o,s,a){return new Wb(t,e,n,r,i,o,s,a)}function Qb(t){return new Wb(t)}function Yb(t){return!Zy(t.limit)&&"F"===t.on}function Xb(t){return!Zy(t.limit)&&"L"===t.on}function $b(t){return 0<t.rn.length?t.rn[0].field:null}function Jb(t){for(var e=0,n=t.filters;e<n.length;e++){var r=n[e];if(r.un())return r.field}return null}function Zb(t){return null!==t.collectionGroup}function t_(t){var e=t;if(null===e.an){e.an=[];var n=Jb(e),t=$b(e);if(null!==n&&null===t)n.p()||e.an.push(new j_(n)),e.an.push(new j_(oy.v(),"asc"));else{for(var r=!1,i=0,o=e.rn;i<o.length;i++){var s=o[i];e.an.push(s),s.field.p()&&(r=!0)}r||(n=0<e.rn.length?e.rn[e.rn.length-1].dir:"asc",e.an.push(new j_(oy.v(),n)))}}return e.an}function e_(t){var e=t;if(!e.cn)if("F"===e.on)e.cn=rg(e.path,e.collectionGroup,t_(e),e.filters,e.limit,e.startAt,e.endAt);else{for(var n=[],r=0,i=t_(e);r<i.length;r++){var o=i[r],s="desc"===o.dir?"asc":"desc";n.push(new j_(o.field,s))}var a=e.endAt?new R_(e.endAt.position,!e.endAt.before):null,t=e.startAt?new R_(e.startAt.position,!e.startAt.before):null;e.cn=rg(e.path,e.collectionGroup,n,e.filters,e.limit,a,t)}return e.cn}function n_(t,e,n){return new Wb(t.path,t.collectionGroup,t.rn.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function r_(t,e){return new Wb(t.path,t.collectionGroup,t.rn.slice(),t.filters.slice(),t.limit,t.on,e,t.endAt)}function i_(t,e){return new Wb(t.path,t.collectionGroup,t.rn.slice(),t.filters.slice(),t.limit,t.on,t.startAt,e)}function o_(t,e){return og(e_(t),e_(e))&&t.on===e.on}function s_(t){return ig(e_(t))+"|lt:"+t.on}function a_(t){return"Query(target="+(e=e_(t),n=e.path.R(),null!==e.collectionGroup&&(n+=" collectionGroup="+e.collectionGroup),0<e.filters.length&&(n+=", filters: ["+e.filters.map(function(t){return(t=t).field.R()+" "+t.op+" "+rm(t.value)}).join(", ")+"]"),Zy(e.limit)||(n+=", limit: "+e.limit),0<e.orderBy.length&&(n+=", orderBy: ["+e.orderBy.map(function(t){return(t=t).field.R()+" ("+t.dir+")"}).join(", ")+"]"),e.startAt&&(n+=", startAt: "+M_(e.startAt)),e.endAt&&(n+=", endAt: "+M_(e.endAt)),"Target("+n+")")+"; limitType="+t.on+")";var e,n}function u_(i,t){return e=i,n=t.key.path,(null!==e.collectionGroup?t.key.N(e.collectionGroup)&&e.path.T(n):sy.F(e.path)?e.path.isEqual(n):e.path.I(n))&&function(t){for(var e=0,n=i.rn;e<n.length;e++){var r=n[e];if(!r.field.p()&&null===t.field(r.field))return}return 1}(t)&&function(t){for(var e=0,n=i.filters;e<n.length;e++)if(!n[e].matches(t))return;return 1}(t)&&(n=t,(!(t=i).startAt||F_(t.startAt,t_(t),n))&&(!t.endAt||!F_(t.endAt,t_(t),n)));var e,n}function c_(a){return function(t,e){for(var n=!1,r=0,i=t_(a);r<i.length;r++){var o=i[r],s=function(t,r,e){e=t.field.p()?sy.i(r.key,e.key):function(t,e){var n=r.field(t),t=e.field(t);return null!==n&&null!==t?em(n,t):Xv()}(t.field,e);switch(t.dir){case"asc":return e;case"desc":return-1*e;default:return Xv()}}(o,t,e);if(0!==s)return s;n=n||o.field.p()}return 0}}var h_,l_=(go(f_,h_=function(){}),f_.create=function(t,e,n){if(t.p())return"in"===e||"not-in"===e?this.hn(t,e,n):new y_(t,e,n);if(hm(n)){if("=="!==e&&"!="!==e)throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. Null only supports '==' and '!=' comparisons.");return new f_(t,e,n)}if(lm(n)){if("=="!==e&&"!="!==e)throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. NaN only supports '==' and '!=' comparisons.");return new f_(t,e,n)}return"array-contains"===e?new N_(t,n):"in"===e?new A_(t,n):"not-in"===e?new k_(t,n):"array-contains-any"===e?new O_(t,n):new f_(t,e,n)},f_.hn=function(t,e,n){return new("in"===e?g_:m_)(t,n)},f_.prototype.matches=function(t){t=t.field(this.field);return"!="===this.op?null!==t&&this.ln(em(t,this.value)):null!==t&&Jg(this.value)===Jg(t)&&this.ln(em(t,this.value))},f_.prototype.ln=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;case">=":return 0<=t;default:return Xv()}},f_.prototype.un=function(){return 0<=["<","<=",">",">=","!=","not-in"].indexOf(this.op)},f_);function f_(t,e,n){var r=this;return(r=h_.call(this)||this).field=t,r.op=e,r.value=n,r}var p_,d_,v_,y_=(go(w_,v_=l_),w_.prototype.matches=function(t){t=sy.i(t.key,this.key);return this.ln(t)},w_),g_=(go(__,d_=l_),__.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},__),m_=(go(b_,p_=l_),b_.prototype.matches=function(e){return!this.keys.some(function(t){return t.isEqual(e.key)})},b_);function b_(t,e){var n=this;return(n=p_.call(this,t,"not-in",e)||this).keys=E_(0,e),n}function __(t,e){var n=this;return(n=d_.call(this,t,"in",e)||this).keys=E_(0,e),n}function w_(t,e,n){var r=this;return(r=v_.call(this,t,e,n)||this).key=sy.C(n.referenceValue),r}function E_(t,e){return((null===(e=e.arrayValue)||void 0===e?void 0:e.values)||[]).map(function(t){return sy.C(t.referenceValue)})}var I_,T_,S_,C_,N_=(go(L_,C_=l_),L_.prototype.matches=function(t){t=t.field(this.field);return cm(t)&&tm(t.arrayValue,this.value)},L_),A_=(go(x_,S_=l_),x_.prototype.matches=function(t){t=t.field(this.field);return null!==t&&tm(this.value.arrayValue,t)},x_),k_=(go(D_,T_=l_),D_.prototype.matches=function(t){if(tm(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;t=t.field(this.field);return null!==t&&!tm(this.value.arrayValue,t)},D_),O_=(go(P_,I_=l_),P_.prototype.matches=function(t){var e=this,t=t.field(this.field);return!(!cm(t)||!t.arrayValue.values)&&t.arrayValue.values.some(function(t){return tm(e.value.arrayValue,t)})},P_),R_=function(t,e){this.position=t,this.before=e};function P_(t,e){return I_.call(this,t,"array-contains-any",e)||this}function D_(t,e){return T_.call(this,t,"not-in",e)||this}function x_(t,e){return S_.call(this,t,"in",e)||this}function L_(t,e){return C_.call(this,t,"array-contains",e)||this}function M_(t){return(t.before?"b":"a")+":"+t.position.map(rm).join(",")}function F_(t,e,n){for(var r=0,i=0;i<t.position.length;i++){var o=e[i],s=t.position[i],r=o.field.p()?sy.i(sy.C(s.referenceValue),n.key):em(s,n.field(o.field));if("desc"===o.dir&&(r*=-1),0!==r)break}return t.before?r<=0:r<0}function U_(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.before!==e.before||t.position.length!==e.position.length)return!1;for(var n=0;n<t.position.length;n++)if(!Zg(t.position[n],e.position[n]))return!1;return!0}var j_=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function V_(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}var q_,B_=($_.prototype.reset=function(){this.Tn=0},$_.prototype.An=function(){this.Tn=this.mn},$_.prototype.Rn=function(t){var e=this;this.cancel();var n=Math.floor(this.Tn+this.Pn()),r=Math.max(0,Date.now()-this.In),i=Math.max(0,n-r);0<i&&Kv("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.Tn+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.En=this._n.gn(this.fn,i,function(){return e.In=Date.now(),t()}),this.Tn*=this.wn,this.Tn<this.dn&&(this.Tn=this.dn),this.Tn>this.mn&&(this.Tn=this.mn)},$_.prototype.yn=function(){null!==this.En&&(this.En.Vn(),this.En=null)},$_.prototype.cancel=function(){null!==this.En&&(this.En.cancel(),this.En=null)},$_.prototype.Pn=function(){return(Math.random()-.5)*this.Tn},$_),W_=(X_.prototype.catch=function(t){return this.next(void 0,t)},X_.prototype.next=function(r,i){var o=this;return this.Sn&&Xv(),this.Sn=!0,this.vn?this.error?this.Dn(i,this.error):this.Cn(r,this.result):new X_(function(e,n){o.pn=function(t){o.Cn(r,t).next(e,n)},o.bn=function(t){o.Dn(i,t).next(e,n)}})},X_.prototype.Nn=function(){var n=this;return new Promise(function(t,e){n.next(t,e)})},X_.prototype.Fn=function(t){try{var e=t();return e instanceof X_?e:X_.resolve(e)}catch(t){return X_.reject(t)}},X_.prototype.Cn=function(t,e){return t?this.Fn(function(){return t(e)}):X_.resolve(e)},X_.prototype.Dn=function(t,e){return t?this.Fn(function(){return t(e)}):X_.reject(e)},X_.resolve=function(n){return new X_(function(t,e){t(n)})},X_.reject=function(n){return new X_(function(t,e){e(n)})},X_.$n=function(t){return new X_(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()})},X_.xn=function(t){for(var n=X_.resolve(!1),e=0,r=t;e<r.length;e++)!function(e){n=n.next(function(t){return t?X_.resolve(t):e()})}(r[e]);return n},X_.forEach=function(t,n){var r=this,i=[];return t.forEach(function(t,e){i.push(n.call(r,t,e))}),this.$n(i)},X_),H_=(Y_.delete=function(t){return Kv("SimpleDb","Removing database:",t),rw(window.indexedDB.deleteDatabase(t)).Nn()},Y_.On=function(){if("undefined"==typeof indexedDB)return!1;if(Y_.Ln())return!0;var t=Lo(),e=Y_.Mn(t),n=0<e&&e<10,e=Y_.Bn(t),e=0<e&&e<4.5;return!(0<t.indexOf("MSIE ")||0<t.indexOf("Trident/")||0<t.indexOf("Edge/")||n||e)},Y_.Ln=function(){var t;return"undefined"!=typeof process&&"YES"===(null===(t=process.env)||void 0===t?void 0:t.qn)},Y_.Un=function(t,e){return t.store(e)},Y_.Mn=function(t){t=t.match(/i(?:phone|pad|pod) os ([\d_]+)/i),t=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(t)},Y_.Bn=function(t){t=t.match(/Android ([\d.]+)/i),t=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(t)},Y_.prototype.Qn=function(o){return bo(this,void 0,void 0,function(){var e,i=this;return _o(this,function(t){switch(t.label){case 0:return this.db?[3,2]:(Kv("SimpleDb","Opening database:",this.name),e=this,[4,new Promise(function(e,n){var r=indexedDB.open(i.name,i.version);r.onsuccess=function(t){t=t.target.result;e(t)},r.onblocked=function(){n(new K_(o,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},r.onerror=function(t){t=t.target.error;"VersionError"===t.name?n(new Bv(qv.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.")):n(new K_(o,t))},r.onupgradeneeded=function(t){Kv("SimpleDb",'Database "'+i.name+'" requires upgrade from version:',t.oldVersion);var e=t.target.result;i.kn.createOrUpgrade(e,r.transaction,t.oldVersion,i.version).next(function(){Kv("SimpleDb","Database upgrade to version "+i.version+" complete")})}})]);case 1:e.db=t.sent(),t.label=2;case 2:return[2,(this.Wn&&(this.db.onversionchange=function(t){return i.Wn(t)}),this.db)]}})})},Y_.prototype.jn=function(e){this.Wn=e,this.db&&(this.db.onversionchange=function(t){return e(t)})},Y_.prototype.runTransaction=function(a,n,u,c){return bo(this,void 0,void 0,function(){var i,o,s,e;return _o(this,function(t){switch(t.label){case 0:i="readonly"===n,o=0,e=function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:++o,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,s.Qn(a)];case 2:return s.db=t.sent(),e=Z_.open(s.db,a,i?"readonly":"readwrite",u),n=c(e).catch(function(t){return e.abort(t),W_.reject(t)}).Nn(),r={},n.catch(function(){}),[4,e.Kn];case 3:return[2,(r.value=(t.sent(),n),r)];case 4:return n=t.sent(),r="FirebaseError"!==n.name&&o<3,Kv("SimpleDb","Transaction failed with error:",n.message,"Retrying:",r),s.close(),r?[3,5]:[2,{value:Promise.reject(n)}];case 5:return[2]}})},s=this,t.label=1;case 1:return[5,e()];case 2:if("object"==typeof(e=t.sent()))return[2,e.value];t.label=3;case 3:return[3,1];case 4:return[2]}})})},Y_.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},Y_),G_=(Object.defineProperty(Q_.prototype,"vn",{get:function(){return this.zn},enumerable:!1,configurable:!0}),Object.defineProperty(Q_.prototype,"Yn",{get:function(){return this.Hn},enumerable:!1,configurable:!0}),Object.defineProperty(Q_.prototype,"cursor",{set:function(t){this.Gn=t},enumerable:!1,configurable:!0}),Q_.prototype.done=function(){this.zn=!0},Q_.prototype.Jn=function(t){this.Hn=t},Q_.prototype.delete=function(){return rw(this.Gn.delete())},Q_),K_=(go(z_,q_=Bv),z_);function z_(t,e){var n=this;return(n=q_.call(this,qv.UNAVAILABLE,"IndexedDB transaction '"+t+"' failed: "+e)||this).name="IndexedDbTransactionError",n}function Q_(t){this.Gn=t,this.zn=!1,this.Hn=null}function Y_(t,e,n){this.name=t,this.version=e,this.kn=n,12.2===Y_.Mn(Lo())&&zv("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 X_(t){var e=this;this.pn=null,this.bn=null,this.result=void 0,this.error=void 0,this.vn=!1,this.Sn=!1,t(function(t){e.vn=!0,e.result=t,e.pn&&e.pn(t)},function(t){e.vn=!0,e.error=t,e.bn&&e.bn(t)})}function $_(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this._n=t,this.fn=e,this.dn=n,this.wn=r,this.mn=i,this.Tn=0,this.En=null,this.In=Date.now(),this.reset()}function J_(t){return"IndexedDbTransactionError"===t.name}var Z_=(nw.open=function(t,e,n,r){try{return new nw(e,t.transaction(r,n))}catch(t){throw new K_(e,t)}},Object.defineProperty(nw.prototype,"Kn",{get:function(){return this.Xn.promise},enumerable:!1,configurable:!0}),nw.prototype.abort=function(t){t&&this.Xn.reject(t),this.aborted||(Kv("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},nw.prototype.store=function(t){t=this.transaction.objectStore(t);return new tw(t)},nw),tw=(ew.prototype.put=function(t,e){t=void 0!==e?(Kv("SimpleDb","PUT",this.store.name,t,e),this.store.put(e,t)):(Kv("SimpleDb","PUT",this.store.name,"<auto-key>",t),this.store.put(t));return rw(t)},ew.prototype.add=function(t){return Kv("SimpleDb","ADD",this.store.name,t,t),rw(this.store.add(t))},ew.prototype.get=function(e){var n=this;return rw(this.store.get(e)).next(function(t){return void 0===t&&(t=null),Kv("SimpleDb","GET",n.store.name,e,t),t})},ew.prototype.delete=function(t){return Kv("SimpleDb","DELETE",this.store.name,t),rw(this.store.delete(t))},ew.prototype.count=function(){return Kv("SimpleDb","COUNT",this.store.name),rw(this.store.count())},ew.prototype.Zn=function(t,e){var e=this.cursor(this.options(t,e)),n=[];return this.ts(e,function(t,e){n.push(e)}).next(function(){return n})},ew.prototype.es=function(t,e){Kv("SimpleDb","DELETE ALL",this.store.name);e=this.options(t,e);e.ns=!1;e=this.cursor(e);return this.ts(e,function(t,e,n){return n.delete()})},ew.prototype.ss=function(t,e){e?n=t:(n={},e=t);var n=this.cursor(n);return this.ts(n,e)},ew.prototype.rs=function(r){var t=this.cursor({});return new W_(function(n,e){t.onerror=function(t){t=ow(t.target.error);e(t)},t.onsuccess=function(t){var e=t.target.result;e?r(e.primaryKey,e.value).next(function(t){t?e.continue():n()}):n()}})},ew.prototype.ts=function(t,i){var o=[];return new W_(function(r,e){t.onerror=function(t){e(t.target.error)},t.onsuccess=function(t){var e,n=t.target.result;n?(e=new G_(n),(t=i(n.primaryKey,n.value,e))instanceof W_&&(t=t.catch(function(t){return e.done(),W_.reject(t)}),o.push(t)),e.vn?r():null===e.Yn?n.continue():n.continue(e.Yn)):r()}}).next(function(){return W_.$n(o)})},ew.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},ew.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.ns?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},ew);function ew(t){this.store=t}function nw(e,t){var n=this;this.action=e,this.transaction=t,this.aborted=!1,this.Xn=new V_,this.transaction.oncomplete=function(){n.Xn.resolve()},this.transaction.onabort=function(){t.error?n.Xn.reject(new K_(e,t.error)):n.Xn.resolve()},this.transaction.onerror=function(t){t=ow(t.target.error);n.Xn.reject(new K_(e,t))}}function rw(t){return new W_(function(e,n){t.onsuccess=function(t){t=t.target.result;e(t)},t.onerror=function(t){t=ow(t.target.error);n(t)}})}var iw=!1;function ow(t){var e=H_.Mn(Lo());if(12.2<=e&&e<13){e="An internal error was encountered in the Indexed Database server";if(0<=t.message.indexOf(e)){var n=new Bv("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+e+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return iw||(iw=!0,setTimeout(function(){throw n},0)),n}}return t}function sw(){return"undefined"!=typeof window?window:null}function aw(){return"undefined"!=typeof document?document:null}var uw=(lw.ls=function(t,e,n,r,i){i=new lw(t,e,Date.now()+n,r,i);return i.start(n),i},lw.prototype.start=function(t){var e=this;this._s=setTimeout(function(){return e.fs()},t)},lw.prototype.Vn=function(){return this.fs()},lw.prototype.cancel=function(t){null!==this._s&&(this.clearTimeout(),this.hs.reject(new Bv(qv.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},lw.prototype.fs=function(){var e=this;this.os.ds(function(){return null!==e._s?(e.clearTimeout(),e.op().then(function(t){return e.hs.resolve(t)})):Promise.resolve()})},lw.prototype.clearTimeout=function(){null!==this._s&&(this.us(this),clearTimeout(this._s),this._s=null)},lw),cw=(Object.defineProperty(hw.prototype,"Vs",{get:function(){return this.Es},enumerable:!1,configurable:!0}),hw.prototype.ds=function(t){this.enqueue(t)},hw.prototype.ps=function(t){this.bs(),this.vs(t)},hw.prototype.Ss=function(){var t;this.Es||(this.Es=!0,(t=aw())&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.ys))},hw.prototype.enqueue=function(t){return this.bs(),this.Es?new Promise(function(t){}):this.vs(t)},hw.prototype.Ds=function(t){var e=this;this.Ts.push(t),this.ds(function(){return e.Cs()})},hw.prototype.Cs=function(){return bo(this,void 0,void 0,function(){var e,n=this;return _o(this,function(t){switch(t.label){case 0:if(0===this.Ts.length)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.Ts[0]()];case 2:return t.sent(),this.Ts.shift(),this.gs.reset(),[3,4];case 3:if(!J_(e=t.sent()))throw e;return Kv("AsyncQueue","Operation failed with retryable error: "+e),[3,4];case 4:0<this.Ts.length&&this.gs.Rn(function(){return n.Cs()}),t.label=5;case 5:return[2]}})})},hw.prototype.vs=function(t){var r=this,e=this.ws.then(function(){return r.Rs=!0,t().catch(function(t){throw r.As=t,r.Rs=!1,zv("INTERNAL UNHANDLED ERROR: ",(n=(e=t).message||"",e.stack&&(n=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),n)),t;var e,n}).then(function(t){return r.Rs=!1,t})});return this.ws=e},hw.prototype.gn=function(t,e,n){var r=this;this.bs(),-1<this.Ps.indexOf(t)&&(e=0);n=uw.ls(this,t,e,n,function(t){return r.Ns(t)});return this.Is.push(n),n},hw.prototype.bs=function(){this.As&&Xv()},hw.prototype.Fs=function(){},hw.prototype.$s=function(){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return[4,e=this.ws];case 1:t.sent(),t.label=2;case 2:if(e!==this.ws)return[3,0];t.label=3;case 3:return[2]}})})},hw.prototype.xs=function(t){for(var e=0,n=this.Is;e<n.length;e++)if(n[e].fn===t)return!0;return!1},hw.prototype.ks=function(r){var i=this;return this.$s().then(function(){i.Is.sort(function(t,e){return t.cs-e.cs});for(var t=0,e=i.Is;t<e.length;t++){var n=e[t];if(n.Vn(),"all"!==r&&n.fn===r)break}return i.$s()})},hw.prototype.Ms=function(t){this.Ps.push(t)},hw.prototype.Ns=function(t){t=this.Is.indexOf(t);this.Is.splice(t,1)},hw);function hw(){var e=this;this.ws=Promise.resolve(),this.Ts=[],this.Es=!1,this.Is=[],this.As=null,this.Rs=!1,this.Ps=[],this.gs=new B_(this,"async_queue_retry"),this.ys=function(){var t=aw();t&&Kv("AsyncQueue","Visibility state changed to ",t.visibilityState),e.gs.yn()};var t=aw();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.ys)}function lw(t,e,n,r,i){this.os=t,this.fn=e,this.cs=n,this.op=r,this.us=i,this.hs=new V_,this.then=this.hs.promise.then.bind(this.hs.promise),this.hs.promise.catch(function(t){})}function fw(t,e){if(zv("AsyncQueue",e+": "+t),J_(t))return new Bv(qv.UNAVAILABLE,e+": "+t);throw t}function pw(){this.Os=void 0,this.listeners=[]}function dw(){this.Ls=new Gy(s_,o_),this.onlineState="Unknown",this.Bs=new Set}function vw(s,a){return bo(this,void 0,void 0,function(){var e,n,r,i,o;return _o(this,function(t){switch(t.label){case 0:if(e=s,n=a.query,r=!1,(i=e.Ls.get(n))||(r=!0,i=new pw),!r)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),o=i,[4,e.qs(n)];case 2:return o.Os=t.sent(),[3,4];case 3:return o=t.sent(),o=fw(o,"Initialization of query '"+a_(a.query)+"' failed"),[2,void a.onError(o)];case 4:return e.Ls.set(n,i),i.listeners.push(a),a.Us(e.onlineState),i.Os&&a.Qs(i.Os)&&gw(e),[2]}})})}function yw(s,a){return bo(this,void 0,void 0,function(){var e,n,r,i,o;return _o(this,function(t){return e=s,n=a.query,r=!1,(i=e.Ls.get(n))&&0<=(o=i.listeners.indexOf(a))&&(i.listeners.splice(o,1),r=0===i.listeners.length),r?[2,(e.Ls.delete(n),e.Ws(n))]:[2]})})}function gw(t){t.Bs.forEach(function(t){t.next()})}var mw=(ww.prototype.Qs=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 Pg(t.query,t.docs,t.Ut,e,t.Qt,t.fromCache,t.Wt,!0)}var o=!1;return this.Ks?this.zs(t)&&(this.js.next(t),o=!0):this.Hs(t,this.onlineState)&&(this.Ys(t),o=!0),this.Gs=t,o},ww.prototype.onError=function(t){this.js.error(t)},ww.prototype.Us=function(t){this.onlineState=t;var e=!1;return this.Gs&&!this.Ks&&this.Hs(this.Gs,t)&&(this.Ys(this.Gs),e=!0),e},ww.prototype.Hs=function(t,e){if(!t.fromCache)return!0;var n="Offline"!==e;return!(this.options.Js&&n||t.docs.m()&&"Offline"!==e)},ww.prototype.zs=function(t){if(0<t.docChanges.length)return!0;var e=this.Gs&&this.Gs.hasPendingWrites!==t.hasPendingWrites;return!(!t.Wt&&!e)&&!0===this.options.includeMetadataChanges},ww.prototype.Ys=function(t){t=Pg.Kt(t.query,t.docs,t.Qt,t.fromCache),this.Ks=!0,this.js.next(t)},ww),bw=(_w.prototype.Xs=function(){return null!=this.uid},_w.prototype.Zs=function(){return this.Xs()?"uid:"+this.uid:"anonymous-user"},_w.prototype.isEqual=function(t){return t.uid===this.uid},_w);function _w(t){this.uid=t}function ww(t,e,n){this.query=t,this.js=e,this.Ks=!1,this.Gs=null,this.onlineState="Unknown",this.options=n||{}}bw.UNAUTHENTICATED=new bw(null),bw.ti=new bw("google-credentials-uid"),bw.ei=new bw("first-party-uid");var Ew=(Iw.prototype.si=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},Iw.prototype.next=function(){var t=++this.previousValue;return this.ii&&this.ii(t),t},Iw);function Iw(t,e){var n=this;this.previousValue=t,e&&(e.ni=function(t){return n.si(t)},this.ii=function(t){return e.ri(t)})}function Tw(t,e){return"firestore_clients_"+t+"_"+e}function Sw(t,e,n){n="firestore_mutations_"+t+"_"+n;return e.Xs()&&(n+="_"+e.uid),n}function Cw(t,e){return"firestore_targets_"+t+"_"+e}Ew.oi=-1;var Nw=($w.ai=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 Bv(r.error.code,r.error.message)),i?new $w(t,e,r.state,o):(zv("SharedClientState","Failed to parse mutation state for ID '"+e+"': "+n),null)},$w.prototype.ci=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)},$w),Aw=(Xw.ai=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 Bv(n.error.code,n.error.message)),r?new Xw(t,n.state,i):(zv("SharedClientState","Failed to parse target state for ID '"+t+"': "+e),null)},Xw.prototype.ci=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)},Xw),kw=(Yw.ai=function(t,e){for(var n=JSON.parse(e),r="object"==typeof n&&n.activeTargetIds instanceof Array,i=kg,o=0;r&&o<n.activeTargetIds.length;++o)r=eg(n.activeTargetIds[o]),i=i.add(n.activeTargetIds[o]);return r?new Yw(t,i):(zv("SharedClientState","Failed to parse client data for instance '"+t+"': "+e),null)},Yw),Ow=(Qw.ai=function(t){var e=JSON.parse(t);return"object"==typeof e&&-1!==["Unknown","Online","Offline"].indexOf(e.onlineState)&&"string"==typeof e.clientId?new Qw(e.clientId,e.onlineState):(zv("SharedClientState","Failed to parse online state: "+t),null)},Qw),Rw=(zw.prototype.ui=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},zw.prototype.hi=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},zw.prototype.ci=function(){var t={activeTargetIds:this.activeTargetIds.A(),updateTimeMs:Date.now()};return JSON.stringify(t)},zw),Pw=(Kw.On=function(t){return!(!t||!t.localStorage)},Kw.prototype.start=function(){return bo(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l=this;return _o(this,function(t){switch(t.label){case 0:return[4,this._i.Vi()];case 1:for(s=t.sent(),e=0,n=s;e<n.length;e++)(r=n[e])!==this.li&&(i=this.getItem(Tw(this.persistenceKey,r)))&&(o=kw.ai(r,i))&&(this.mi=this.mi.rt(o.clientId,o));for(this.pi(),(s=this.storage.getItem(this.yi))&&(a=this.bi(s))&&this.vi(a),u=0,c=this.Ei;u<c.length;u++)h=c[u],this.wi(h);return this.Ei=[],this.window.addEventListener("unload",function(){return l.Si()}),this.Ti=!0,[2]}})})},Kw.prototype.ri=function(t){this.setItem(this.Ai,JSON.stringify(t))},Kw.prototype.Di=function(){return this.Ci(this.mi)},Kw.prototype.Ni=function(n){var r=!1;return this.mi.forEach(function(t,e){e.activeTargetIds.has(n)&&(r=!0)}),r},Kw.prototype.Fi=function(t){this.$i(t,"pending")},Kw.prototype.xi=function(t,e,n){this.$i(t,e,n),this.ki(t)},Kw.prototype.Mi=function(t){var e,n="not-current";return this.Ni(t)&&(!(e=this.storage.getItem(Cw(this.persistenceKey,t)))||(e=Aw.ai(t,e))&&(n=e.state)),this.Oi.ui(t),this.pi(),n},Kw.prototype.Li=function(t){this.Oi.hi(t),this.pi()},Kw.prototype.Bi=function(t){return this.Oi.activeTargetIds.has(t)},Kw.prototype.qi=function(t){this.removeItem(Cw(this.persistenceKey,t))},Kw.prototype.Ui=function(t,e,n){this.Qi(t,e,n)},Kw.prototype.Wi=function(t,e,n){var r=this;e.forEach(function(t){r.ki(t)}),this.currentUser=t,n.forEach(function(t){r.Fi(t)})},Kw.prototype.ji=function(t){this.Ki(t)},Kw.prototype.Si=function(){this.Ti&&(this.window.removeEventListener("storage",this.di),this.removeItem(this.Ii),this.Ti=!1)},Kw.prototype.getItem=function(t){var e=this.storage.getItem(t);return Kv("SharedClientState","READ",t,e),e},Kw.prototype.setItem=function(t,e){Kv("SharedClientState","SET",t,e),this.storage.setItem(t,e)},Kw.prototype.removeItem=function(t){Kv("SharedClientState","REMOVE",t),this.storage.removeItem(t)},Kw.prototype.wi=function(t){var e=this,s=t;if(s.storageArea===this.storage){if(Kv("SharedClientState","EVENT",s.key,s.newValue),s.key===this.Ii)return void zv("Received WebStorage notification for local change. Another client might have garbage-collected our state");this._n.Ds(function(){return bo(e,void 0,void 0,function(){var e,n,r,i,o;return _o(this,function(t){if(this.Ti){if(null!==s.key)if(this.Ri.test(s.key)){if(null==s.newValue)return e=this.Gi(s.key),[2,this.zi(e,null)];if(e=this.Hi(s.key,s.newValue))return[2,this.zi(e.clientId,e)]}else if(this.Pi.test(s.key)){if(null!==s.newValue&&(n=this.Yi(s.key,s.newValue)))return[2,this.Ji(n)]}else if(this.gi.test(s.key)){if(null!==s.newValue&&(r=this.Xi(s.key,s.newValue)))return[2,this.Zi(r)]}else if(s.key===this.yi){if(null!==s.newValue&&(i=this.bi(s.newValue)))return[2,this.vi(i)]}else s.key===this.Ai&&(o=function(t){var e=Ew.oi;if(null!=t)try{var n=JSON.parse(t);$v("number"==typeof n),e=n}catch(t){zv("SharedClientState","Failed to read sequence number from WebStorage",t)}return e}(s.newValue))!==Ew.oi&&this.ni(o)}else this.Ei.push(s);return[2]})})})}},Object.defineProperty(Kw.prototype,"Oi",{get:function(){return this.mi.get(this.li)},enumerable:!1,configurable:!0}),Kw.prototype.pi=function(){this.setItem(this.Ii,this.Oi.ci())},Kw.prototype.$i=function(t,e,n){n=new Nw(this.currentUser,t,e,n),t=Sw(this.persistenceKey,this.currentUser,t);this.setItem(t,n.ci())},Kw.prototype.ki=function(t){t=Sw(this.persistenceKey,this.currentUser,t);this.removeItem(t)},Kw.prototype.Ki=function(t){t={clientId:this.li,onlineState:t};this.storage.setItem(this.yi,JSON.stringify(t))},Kw.prototype.Qi=function(t,e,n){var r=Cw(this.persistenceKey,t),n=new Aw(t,e,n);this.setItem(r,n.ci())},Kw.prototype.Gi=function(t){t=this.Ri.exec(t);return t?t[1]:null},Kw.prototype.Hi=function(t,e){t=this.Gi(t);return kw.ai(t,e)},Kw.prototype.Yi=function(t,e){var n=this.Pi.exec(t),t=Number(n[1]),n=void 0!==n[2]?n[2]:null;return Nw.ai(new bw(n),t,e)},Kw.prototype.Xi=function(t,e){t=this.gi.exec(t),t=Number(t[1]);return Aw.ai(t,e)},Kw.prototype.bi=function(t){return Ow.ai(t)},Kw.prototype.Ji=function(e){return bo(this,void 0,void 0,function(){return _o(this,function(t){return e.user.uid===this.currentUser.uid?[2,this._i.tr(e.batchId,e.state,e.error)]:(Kv("SharedClientState","Ignoring mutation for non-active user "+e.user.uid),[2])})})},Kw.prototype.Zi=function(t){return this._i.er(t.targetId,t.state,t.error)},Kw.prototype.zi=function(t,e){var n=this,r=e?this.mi.rt(t,e):this.mi.remove(t),i=this.Ci(this.mi),o=this.Ci(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._i.nr(s,a).then(function(){n.mi=r})},Kw.prototype.vi=function(t){this.mi.get(t.clientId)&&this.fi(t.onlineState)},Kw.prototype.Ci=function(t){var n=kg;return t.forEach(function(t,e){n=n.xt(e.activeTargetIds)}),n},Kw),Dw=(Gw.prototype.Fi=function(t){},Gw.prototype.xi=function(t,e,n){},Gw.prototype.Mi=function(t){return this.sr.ui(t),this.ir[t]||"not-current"},Gw.prototype.Ui=function(t,e,n){this.ir[t]=e},Gw.prototype.Li=function(t){this.sr.hi(t)},Gw.prototype.Bi=function(t){return this.sr.activeTargetIds.has(t)},Gw.prototype.qi=function(t){delete this.ir[t]},Gw.prototype.Di=function(){return this.sr.activeTargetIds},Gw.prototype.Ni=function(t){return this.sr.activeTargetIds.has(t)},Gw.prototype.start=function(){return this.sr=new Rw,Promise.resolve()},Gw.prototype.Wi=function(t,e,n){},Gw.prototype.ji=function(t){},Gw.prototype.Si=function(){},Gw.prototype.ri=function(t){},Gw),xw=(Hw.prototype.ar=function(t,e,n){for(var r=n.cr,i=0;i<this.mutations.length;i++){var o=this.mutations[i];o.key.isEqual(t)&&(e=fb(o,e,r[i]))}return e},Hw.prototype.ur=function(t,e){for(var n=0,r=this.baseMutations;n<r.length;n++){var i=r[n];i.key.isEqual(t)&&(e=pb(i,e,e,this.rr))}for(var o=e,s=0,a=this.mutations;s<a.length;s++){var u=a[s];u.key.isEqual(t)&&(e=pb(u,e,o,this.rr))}return e},Hw.prototype.hr=function(n){var r=this,i=n;return this.mutations.forEach(function(t){var e=r.ur(t.key,n.get(t.key));e&&(i=i.rt(t.key,e))}),i},Hw.prototype.keys=function(){return this.mutations.reduce(function(t,e){return t.add(e.key)},Ag())},Hw.prototype.isEqual=function(t){return this.batchId===t.batchId&&Dy(this.mutations,t.mutations,db)&&Dy(this.baseMutations,t.baseMutations,db)},Hw),Lw=(Ww.from=function(t,e,n){$v(t.mutations.length===n.length);for(var r=Cg,i=t.mutations,o=0;o<i.length;o++)r=r.rt(i[o].key,n[o].version);return new Ww(t,e,n,r)},Ww),M=(Object.defineProperty(Bw.prototype,"readTime",{get:function(){return this.mr},set:function(t){this.mr=t},enumerable:!1,configurable:!0}),Bw.prototype.Tr=function(t,e){this.Er(),this.readTime=e,this.dr.set(t.key,t)},Bw.prototype.Ir=function(t,e){this.Er(),e&&(this.readTime=e),this.dr.set(t,null)},Bw.prototype.Ar=function(t,e){this.Er();var n=this.dr.get(e);return void 0!==n?W_.resolve(n):this.Rr(t,e)},Bw.prototype.getEntries=function(t,e){return this.Pr(t,e)},Bw.prototype.apply=function(t){return this.Er(),this.wr=!0,this.gr(t)},Bw.prototype.Er=function(){},Bw),Mw="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",K=(qw.prototype.Vr=function(t){this.yr.push(t)},qw.prototype.pr=function(){this.yr.forEach(function(t){return t()})},qw),Fw=(Vw.prototype.Dr=function(e,n){var r=this;return this.vr.Cr(e,n).next(function(t){return r.Nr(e,n,t)})},Vw.prototype.Nr=function(t,r,i){return this.br.Ar(t,r).next(function(t){for(var e=0,n=i;e<n.length;e++)t=n[e].ur(r,t);return t})},Vw.prototype.Fr=function(t,e,i){var o=Eg;return e.forEach(function(t,e){for(var n=0,r=i;n<r.length;n++)e=r[n].ur(t,e);o=o.rt(t,e)}),o},Vw.prototype.$r=function(e,t){var n=this;return this.br.getEntries(e,t).next(function(t){return n.kr(e,t)})},Vw.prototype.kr=function(e,r){var i=this;return this.vr.Mr(e,r).next(function(t){var t=i.Fr(e,r,t),n=Eg;return t.forEach(function(t,e){e=e||new qb(t,zy.min()),n=n.rt(t,e)}),n})},Vw.prototype.Or=function(t,e,n){return r=e,sy.F(r.path)&&null===r.collectionGroup&&0===r.filters.length?this.Lr(t,e.path):Zb(e)?this.Br(t,e,n):this.qr(t,e,n);var r},Vw.prototype.Lr=function(t,e){return this.Dr(t,new sy(e)).next(function(t){var e=Sg;return t instanceof Vb&&(e=e.rt(t.key,t)),e})},Vw.prototype.Br=function(n,r,i){var o=this,s=r.collectionGroup,a=Sg;return this.Sr.Ur(n,s).next(function(t){return W_.forEach(t,function(t){var e,e=(e=r,t=t.child(s),new Wb(t,null,e.rn.slice(),e.filters.slice(),e.limit,e.on,e.startAt,e.endAt));return o.qr(n,e,i).next(function(t){t.forEach(function(t,e){a=a.rt(t,e)})})}).next(function(){return a})})},Vw.prototype.qr=function(e,n,t){var c,h,r=this;return this.br.Or(e,n,t).next(function(t){return c=t,r.vr.Qr(e,n)}).next(function(t){return h=t,r.Wr(e,h,c).next(function(t){c=t;for(var e=0,n=h;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=c.get(a),u=pb(s,u,u,r.rr);c=u instanceof Vb?c.rt(a,u):c.remove(a)}})}).next(function(){return c.forEach(function(t,e){u_(n,e)||(c=c.remove(t))}),c})},Vw.prototype.Wr=function(t,e,n){for(var r=Ag(),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 bb&&null===n.get(u.key)&&(r=r.add(u.key))}var c=n;return this.br.getEntries(t,r).next(function(t){return t.forEach(function(t,e){null!==e&&e instanceof Vb&&(c=c.rt(t,e))}),c})},Vw),Uw=(jw.Gr=function(t,e){for(var n=Ag(),r=Ag(),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 jw(t,e.fromCache,n,r)},jw);function jw(t,e,n,r){this.targetId=t,this.fromCache=e,this.jr=n,this.Kr=r}function Vw(t,e,n){this.br=t,this.vr=e,this.Sr=n}function qw(){this.yr=[]}function Bw(){this.dr=new Gy(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),this.wr=!1}function Ww(t,e,n,r){this.batch=t,this.lr=e,this.cr=n,this._r=r}function Hw(t,e,n,r){this.batchId=t,this.rr=e,this.baseMutations=n,this.mutations=r}function Gw(){this.sr=new Rw,this.ir={},this.fi=null,this.ni=null}function Kw(t,e,n,r,i){this.window=t,this._n=e,this.persistenceKey=n,this.li=r,this._i=null,this.fi=null,this.ni=null,this.di=this.wi.bind(this),this.mi=new pg(Py),this.Ti=!1,this.Ei=[];n=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=i,this.Ii=Tw(this.persistenceKey,this.li),this.Ai="firestore_sequence_number_"+this.persistenceKey,this.mi=this.mi.rt(this.li,new Rw),this.Ri=new RegExp("^firestore_clients_"+n+"_([^_]*)$"),this.Pi=new RegExp("^firestore_mutations_"+n+"_(\\d+)(?:_(.*))?$"),this.gi=new RegExp("^firestore_targets_"+n+"_(\\d+)$"),this.yi="firestore_online_state_"+this.persistenceKey,this.window.addEventListener("storage",this.di)}function zw(){this.activeTargetIds=kg}function Qw(t,e){this.clientId=t,this.onlineState=e}function Yw(t,e){this.clientId=t,this.activeTargetIds=e}function Xw(t,e,n){this.targetId=t,this.state=e,this.error=n}function $w(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}function Jw(t,e){var n=t[0],r=t[1],t=e[0],e=e[1],t=Py(n,t);return 0===t?Py(r,e):t}var Zw=(rE.prototype.Yr=function(){return++this.Hr},rE.prototype.Jr=function(t){var e=[t,this.Yr()];this.buffer.size<this.zr?this.buffer=this.buffer.add(e):Jw(e,t=this.buffer.last())<0&&(this.buffer=this.buffer.delete(t).add(e))},Object.defineProperty(rE.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!1,configurable:!0}),rE),tE={Xr:!1,Zr:0,eo:0,no:0},eE=(nE.oo=function(t){return new nE(t,nE.ao,nE.co)},nE);function nE(t,e,n){this.so=t,this.io=e,this.ro=n}function rE(t){this.zr=t,this.buffer=new _g(Jw),this.Hr=0}eE.uo=-1,eE.ho=1048576,eE.lo=41943040,eE.ao=10,eE.co=1e3,eE._o=new eE(eE.lo,eE.ao,eE.co),eE.fo=new eE(eE.uo,0,0);var iE=(aE.prototype.start=function(t){this.do.params.so!==eE.uo&&this.To(t)},aE.prototype.stop=function(){this.mo&&(this.mo.cancel(),this.mo=null)},Object.defineProperty(aE.prototype,"Ti",{get:function(){return null!==this.mo},enumerable:!1,configurable:!0}),aE.prototype.To=function(n){var t=this,e=this.wo?3e5:6e4;Kv("LruGarbageCollector","Garbage collection scheduled in "+e+"ms"),this.mo=this.os.gn("lru_garbage_collection",e,function(){return bo(t,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:this.mo=null,this.wo=!0,t.label=1;case 1:return t.trys.push([1,3,,7]),[4,n.Eo(this.do)];case 2:return t.sent(),[3,7];case 3:return J_(e=t.sent())?(Kv("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",e),[3,6]):[3,4];case 4:return[4,jI(e)];case 5:t.sent(),t.label=6;case 6:return[3,7];case 7:return[4,this.To(n)];case 8:return t.sent(),[2]}})})})},aE),oE=(sE.prototype.Ao=function(t,e){return this.Io.Ro(t).next(function(t){return Math.floor(e/100*t)})},sE.prototype.Po=function(t,e){var n=this;if(0===e)return W_.resolve(Ew.oi);var r=new Zw(e);return this.Io.De(t,function(t){return r.Jr(t.sequenceNumber)}).next(function(){return n.Io.yo(t,function(t){return r.Jr(t)})}).next(function(){return r.maxValue})},sE.prototype.Vo=function(t,e,n){return this.Io.Vo(t,e,n)},sE.prototype.po=function(t,e){return this.Io.po(t,e)},sE.prototype.bo=function(e,n){var r=this;return this.params.so===eE.uo?(Kv("LruGarbageCollector","Garbage collection skipped; disabled"),W_.resolve(tE)):this.vo(e).next(function(t){return t<r.params.so?(Kv("LruGarbageCollector","Garbage collection skipped; Cache size "+t+" is lower than threshold "+r.params.so),tE):r.So(e,n)})},sE.prototype.vo=function(t){return this.Io.vo(t)},sE.prototype.So=function(e,n){var r,i,o,s,a,u,c,h=this,l=Date.now();return this.Ao(e,this.params.io).next(function(t){return i=t>h.params.ro?(Kv("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.params.ro+" from "+t),h.params.ro):t,s=Date.now(),h.Po(e,i)}).next(function(t){return r=t,a=Date.now(),h.Vo(e,r,n)}).next(function(t){return o=t,u=Date.now(),h.po(e,r)}).next(function(t){return c=Date.now(),Gv()<=Ns.DEBUG&&Kv("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"),W_.resolve({Xr:!0,Zr:i,eo:o,no:t})})},sE);function sE(t,e){this.Io=t,this.params=e}function aE(t,e){this.do=t,this.os=e,this.wo=!1,this.mo=null}function uE(t){for(var e="",n=0;n<t.length;n++)0<e.length&&(e=cE(e)),e=function(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}(t.get(n),e);return cE(e)}function cE(t){return t+""}function hE(t){var e=t.length;if($v(2<=e),2===e)return $v(""===t.charAt(0)&&""===t.charAt(1)),ry.g();for(var n=e-2,r=[],i="",o=0;o<e;){var s=t.indexOf("",o);switch((s<0||n<s)&&Xv(),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:Xv()}o=s+2}return new ry(r)}var lE=function(t){this.Do=t};function fE(t,e){if(e.document)return n=t.Do,r=e.document,i=!!e.hasCommittedMutations,t=Sm(n,r.name),n=wm(r.updateTime),r=new Rb({mapValue:{fields:r.fields}}),new Vb(t,n,r,{hasCommittedMutations:!!i});var n,r;if(e.noDocument){var i=sy.$(e.noDocument.path),o=gE(e.noDocument.readTime);return new qb(i,o,{hasCommittedMutations:!!e.hasCommittedMutations})}if(e.unknownDocument){o=sy.$(e.unknownDocument.path),e=gE(e.unknownDocument.version);return new Bb(o,e)}return Xv()}function pE(t,e,n){var r=dE(n),n=e.key.path.h().A();if(e instanceof Vb){var i={name:Tm(i=t.Do,(o=e).key),fields:o.sn().mapValue.fields,updateTime:bm(i,o.version.X())},o=e.hasCommittedMutations;return new $E(null,null,i,o,r,n)}if(e instanceof qb){var i=e.key.path.A(),o=yE(e.version),s=e.hasCommittedMutations;return new $E(null,new YE(i,o),null,s,r,n)}if(e instanceof Bb){s=e.key.path.A(),e=yE(e.version);return new $E(new XE(s,e),null,null,!0,r,n)}return Xv()}function dE(t){t=t.X();return[t.seconds,t.nanoseconds]}function vE(t){t=new Ky(t[0],t[1]);return zy.Y(t)}function yE(t){t=t.X();return new VE(t.seconds,t.nanoseconds)}function gE(t){t=new Ky(t.seconds,t.nanoseconds);return zy.Y(t)}function mE(e,t){var n=(t.baseMutations||[]).map(function(t){return Pm(e.Do,t)}),r=t.mutations.map(function(t){return Pm(e.Do,t)}),i=Ky.fromMillis(t.localWriteTimeMs);return new xw(t.batchId,i,n,r)}function bE(t){var e=gE(t.readTime),n=void 0!==t.lastLimboFreeSnapshotVersion?gE(t.lastLimboFreeSnapshotVersion):zy.min(),r=void 0!==t.query.documents?($v(1===(r=t.query).documents.length),e_(Qb(Nm(r.documents[0])))):Lm(t.query);return new cg(r,t.targetId,0,t.lastListenSequenceNumber,e,n,Ly.fromBase64String(t.resumeToken))}function _E(t,e){var n=yE(e.et),r=yE(e.lastLimboFreeSnapshotVersion),i=(sg(e.target)?Dm:xm)(t.Do,e.target),t=e.resumeToken.toBase64();return new ZE(e.targetId,ig(e.target),n,t,e.sequenceNumber,r,i)}var wE=(EE.Fo=function(t,e,n,r){return $v(""!==t.uid),new EE(t.Xs()?t.uid:"",e,n,r)},EE.prototype.$o=function(t){var r=!0,e=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return SE(t).ss({index:KE.userMutationsIndex,range:e},function(t,e,n){r=!1,n.done()}).next(function(){return r})},EE.prototype.xo=function(d,v,y,g){var m=this,b=CE(d),_=SE(d);return _.add({}).next(function(t){$v("number"==typeof t);for(var e,n,r,i,o,s=new xw(t,v,y,g),a=(e=m.serializer,n=m.userId,i=(r=s).baseMutations.map(function(t){return Rm(e.Do,t)}),o=r.mutations.map(function(t){return Rm(e.Do,t)}),new KE(n,r.batchId,r.rr.toMillis(),i,o)),u=[],c=new _g(function(t,e){return Py(t.R(),e.R())}),h=0,l=g;h<l.length;h++){var f=l[h],p=zE.key(m.userId,f.key.path,t),c=c.add(f.key.path.h());u.push(_.put(a)),u.push(b.put(p,zE.PLACEHOLDER))}return c.forEach(function(t){u.push(m.Sr.ko(d,t))}),d.Vr(function(){m.No[t]=s.keys()}),W_.$n(u).next(function(){return s})})},EE.prototype.Mo=function(t,e){var n=this;return SE(t).get(e).next(function(t){return t?($v(t.userId===n.userId),mE(n.serializer,t)):null})},EE.prototype.Oo=function(t,e){var n=this;return this.No[e]?W_.resolve(this.No[e]):this.Mo(t,e).next(function(t){if(t){t=t.keys();return n.No[e]=t}return null})},EE.prototype.Lo=function(t,e){var r=this,i=e+1,e=IDBKeyRange.lowerBound([this.userId,i]),o=null;return SE(t).ss({index:KE.userMutationsIndex,range:e},function(t,e,n){e.userId===r.userId&&($v(e.batchId>=i),o=mE(r.serializer,e)),n.done()}).next(function(){return o})},EE.prototype.Bo=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return SE(t).ss({index:KE.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},EE.prototype.qo=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return SE(t).Zn(KE.userMutationsIndex,n).next(function(t){return t.map(function(t){return mE(e.serializer,t)})})},EE.prototype.Cr=function(o,s){var a=this,t=zE.prefixForPath(this.userId,s.path),t=IDBKeyRange.lowerBound(t),u=[];return CE(o).ss({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=hE(i);if(r===a.userId&&s.path.isEqual(i))return SE(o).get(t).next(function(t){if(!t)throw Xv();$v(t.userId===a.userId),u.push(mE(a.serializer,t))});n.done()}).next(function(){return u})},EE.prototype.Mr=function(e,t){var s=this,a=new _g(Py),n=[];return t.forEach(function(o){var t=zE.prefixForPath(s.userId,o.path),t=IDBKeyRange.lowerBound(t),t=CE(e).ss({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=hE(i);r===s.userId&&o.path.isEqual(i)?a=a.add(t):n.done()});n.push(t)}),W_.$n(n).next(function(){return s.Uo(e,a)})},EE.prototype.Qr=function(t,e){var o=this,s=e.path,a=s.length+1,e=zE.prefixForPath(this.userId,s),e=IDBKeyRange.lowerBound(e),u=new _g(Py);return CE(t).ss({range:e},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=hE(i);r===o.userId&&s.T(i)?i.length===a&&(u=u.add(t)):n.done()}).next(function(){return o.Uo(t,u)})},EE.prototype.Uo=function(e,t){var n=this,r=[],i=[];return t.forEach(function(t){i.push(SE(e).get(t).next(function(t){if(null===t)throw Xv();$v(t.userId===n.userId),r.push(mE(n.serializer,t))}))}),W_.$n(i).next(function(){return r})},EE.prototype.Qo=function(e,n){var r=this;return TE(e.Wo,this.userId,n).next(function(t){return e.Vr(function(){r.jo(n.batchId)}),W_.forEach(t,function(t){return r.Co.Ko(e,t)})})},EE.prototype.jo=function(t){delete this.No[t]},EE.prototype.Go=function(e){var i=this;return this.$o(e).next(function(t){if(!t)return W_.resolve();var t=IDBKeyRange.lowerBound(zE.prefixForUser(i.userId)),r=[];return CE(e).ss({range:t},function(t,e,n){t[0]===i.userId?(t=hE(t[1]),r.push(t)):n.done()}).next(function(){$v(0===r.length)})})},EE.prototype.zo=function(t,e){return IE(t,this.userId,e)},EE.prototype.Ho=function(t){var e=this;return NE(t).get(this.userId).next(function(t){return t||new GE(e.userId,-1,"")})},EE);function EE(t,e,n,r){this.userId=t,this.serializer=e,this.Sr=n,this.Co=r,this.No={}}function IE(t,o,e){var e=zE.prefixForPath(o,e.path),s=e[1],e=IDBKeyRange.lowerBound(e),a=!1;return CE(t).ss({range:e,ns:!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 TE(t,e,n){var r=t.store(KE.store),i=t.store(zE.store),o=[],t=IDBKeyRange.only(n.batchId),s=0,t=r.ss({range:t},function(t,e,n){return s++,n.delete()});o.push(t.next(function(){$v(1===s)}));for(var a=[],u=0,c=n.mutations;u<c.length;u++){var h=c[u],l=zE.key(e,h.key.path,n.batchId);o.push(i.delete(l)),a.push(h.key)}return W_.$n(o).next(function(){return a})}function SE(t){return bI.Un(t,KE.store)}function CE(t){return bI.Un(t,zE.store)}function NE(t){return bI.Un(t,GE.store)}var AE,kE=(PE.prototype.Tr=function(t,e,n){return xE(t).put(LE(e),n)},PE.prototype.Ir=function(t,e){t=xE(t),e=LE(e);return t.delete(e)},PE.prototype.updateMetadata=function(e,n){var r=this;return this.getMetadata(e).next(function(t){return t.byteSize+=n,r.Yo(e,t)})},PE.prototype.Ar=function(t,e){var n=this;return xE(t).get(LE(e)).next(function(t){return n.Jo(t)})},PE.prototype.Xo=function(t,e){var n=this;return xE(t).get(LE(e)).next(function(t){var e=n.Jo(t);return e?{Zo:e,size:ME(t)}:null})},PE.prototype.getEntries=function(t,e){var n=this,r=Eg;return this.ta(t,e,function(t,e){e=n.Jo(e);r=r.rt(t,e)}).next(function(){return r})},PE.prototype.ea=function(t,e){var r=this,i=Eg,o=new pg(sy.i);return this.ta(t,e,function(t,e){var n=r.Jo(e);o=n?(i=i.rt(t,n),o.rt(t,ME(e))):(i=i.rt(t,null),o.rt(t,0))}).next(function(){return{na:i,sa:o}})},PE.prototype.ta=function(t,e,i){if(e.m())return W_.resolve();var n=IDBKeyRange.bound(e.first().path.A(),e.last().path.A()),o=e.lt(),s=o.Et();return xE(t).ss({range:n},function(t,e,n){for(var r=sy.$(t);s&&sy.i(s,r)<0;)i(s,null),s=o.Et();s&&s.isEqual(r)&&(i(s,e),s=o.It()?o.Et():null),s?n.Jn(s.path.A()):n.done()}).next(function(){for(;s;)i(s,null),s=o.It()?o.Et():null})},PE.prototype.Or=function(t,r,e){var n,i=this,o=Sg,s=r.path.length+1,a={};return e.isEqual(zy.min())?(n=r.path.A(),a.range=IDBKeyRange.lowerBound(n)):(n=r.path.A(),e=dE(e),a.range=IDBKeyRange.lowerBound([n,e],!0),a.index=$E.collectionReadTimeIndex),xE(t).ss(a,function(t,e,n){t.length===s&&(e=fE(i.serializer,e),r.path.T(e.key.path)?e instanceof Vb&&u_(r,e)&&(o=o.rt(e.key,e)):n.done())}).next(function(){return o})},PE.prototype.ia=function(t){return new OE(this,!!t&&t.ra)},PE.prototype.oa=function(t){return this.getMetadata(t).next(function(t){return t.byteSize})},PE.prototype.getMetadata=function(t){return DE(t).get(JE.key).next(function(t){return $v(!!t),t})},PE.prototype.Yo=function(t,e){return DE(t).put(JE.key,e)},PE.prototype.Jo=function(t){if(t){t=fE(this.serializer,t);return t instanceof qb&&t.version.isEqual(zy.min())?null:t}return null},PE),OE=(go(RE,AE=M),RE.prototype.gr=function(i){var o=this,s=[],a=0,u=new _g(function(t,e){return Py(t.R(),e.R())});return this.dr.forEach(function(t,e){var n,r=o.ca.get(t);e?(n=pE(o.aa.serializer,e,o.readTime),u=u.add(t.path.h()),e=ME(n),a+=e-r,s.push(o.aa.Tr(i,t,n))):(a-=r,o.ra?(r=pE(o.aa.serializer,new qb(t,zy.min()),o.readTime),s.push(o.aa.Tr(i,t,r))):s.push(o.aa.Ir(i,t)))}),u.forEach(function(t){s.push(o.aa.Sr.ko(i,t))}),s.push(this.aa.updateMetadata(i,a)),W_.$n(s)},RE.prototype.Rr=function(t,e){var n=this;return this.aa.Xo(t,e).next(function(t){return null===t?(n.ca.set(e,0),null):(n.ca.set(e,t.size),t.Zo)})},RE.prototype.Pr=function(t,e){var n=this;return this.aa.ea(t,e).next(function(t){var e=t.na;return t.sa.forEach(function(t,e){n.ca.set(t,e)}),e})},RE);function RE(t,e){var n=this;return(n=AE.call(this)||this).aa=t,n.ra=e,n.ca=new Gy(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),n}function PE(t,e){this.serializer=t,this.Sr=e}function DE(t){return bI.Un(t,JE.store)}function xE(t){return bI.Un(t,$E.store)}function LE(t){return t.path.A()}function ME(t){var e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw Xv();e=t.noDocument}return JSON.stringify(e).length}var FE=(HE.prototype.ko=function(t,e){return this.ua.add(e),W_.resolve()},HE.prototype.Ur=function(t,e){return W_.resolve(this.ua.getEntries(e))},HE),UE=(WE.prototype.add=function(t){var e=t._(),n=t.h(),r=this.index[e]||new _g(ry.i),t=!r.has(n);return this.index[e]=r.add(n),t},WE.prototype.has=function(t){var e=t._(),t=t.h(),e=this.index[e];return e&&e.has(t)},WE.prototype.getEntries=function(t){return(this.index[t]||new _g(ry.i)).A()},WE),jE=(BE.prototype.createOrUpgrade=function(e,n,t,r){var i=this;$v(t<r&&0<=t&&r<=10);var o=new Z_("createOrUpgrade",n);t<1&&1<=r&&(e.createObjectStore(qE.store),(s=e).createObjectStore(GE.store,{keyPath:GE.keyPath}),s.createObjectStore(KE.store,{keyPath:KE.keyPath,autoIncrement:!0}).createIndex(KE.userMutationsIndex,KE.userMutationsKeyPath,{unique:!0}),s.createObjectStore(zE.store),rI(e),e.createObjectStore($E.store));var s,a=W_.resolve();return t<3&&3<=r&&(0!==t&&((s=e).deleteObjectStore(tI.store),s.deleteObjectStore(ZE.store),s.deleteObjectStore(eI.store),rI(e)),a=a.next(function(){return t=o.store(eI.store),e=new eI(0,0,zy.min().X(),0),t.put(eI.key,e);var t,e})),t<4&&4<=r&&(0!==t&&(a=a.next(function(){return n=e,(r=o).store(KE.store).Zn().next(function(t){n.deleteObjectStore(KE.store),n.createObjectStore(KE.store,{keyPath:KE.keyPath,autoIncrement:!0}).createIndex(KE.userMutationsIndex,KE.userMutationsKeyPath,{unique:!0});var e=r.store(KE.store),t=t.map(function(t){return e.put(t)});return W_.$n(t)});var n,r})),a=a.next(function(){e.createObjectStore(iI.store,{keyPath:iI.keyPath})})),t<5&&5<=r&&(a=a.next(function(){return i.removeAcknowledgedMutations(o)})),t<6&&6<=r&&(a=a.next(function(){return e.createObjectStore(JE.store),i.addDocumentGlobal(o)})),t<7&&7<=r&&(a=a.next(function(){return i.ensureSequenceNumbers(o)})),t<8&&8<=r&&(a=a.next(function(){return i.createCollectionParentIndex(e,o)})),t<9&&9<=r&&(a=a.next(function(){var t;(t=e).objectStoreNames.contains("remoteDocumentChanges")&&t.deleteObjectStore("remoteDocumentChanges"),(t=n.objectStore($E.store)).createIndex($E.readTimeIndex,$E.readTimeIndexPath,{unique:!1}),t.createIndex($E.collectionReadTimeIndex,$E.collectionReadTimeIndexPath,{unique:!1})})),t<10&&10<=r&&(a=a.next(function(){return i.rewriteCanonicalIds(o)})),a},BE.prototype.addDocumentGlobal=function(e){var n=0;return e.store($E.store).ss(function(t,e){n+=ME(e)}).next(function(){var t=new JE(n);return e.store(JE.store).put(JE.key,t)})},BE.prototype.removeAcknowledgedMutations=function(n){var r=this,t=n.store(GE.store),i=n.store(KE.store);return t.Zn().next(function(t){return W_.forEach(t,function(e){var t=IDBKeyRange.bound([e.userId,-1],[e.userId,e.lastAcknowledgedBatchId]);return i.Zn(KE.userMutationsIndex,t).next(function(t){return W_.forEach(t,function(t){$v(t.userId===e.userId);t=mE(r.serializer,t);return TE(n,e.userId,t).next(function(){})})})})})},BE.prototype.ensureSequenceNumbers=function(t){var o=t.store(tI.store),e=t.store($E.store);return t.store(eI.store).get(eI.key).next(function(r){var i=[];return e.ss(function(t,e){var n=new ry(t),t=[0,uE(n)];i.push(o.get(t).next(function(t){return t?W_.resolve():o.put(new tI(0,uE(n),r.highestListenSequenceNumber))}))}).next(function(){return W_.$n(i)})})},BE.prototype.createCollectionParentIndex=function(t,e){t.createObjectStore(nI.store,{keyPath:nI.keyPath});function r(t){if(i.add(t)){var e=t._(),t=t.h();return n.put({collectionId:e,parent:uE(t)})}}var n=e.store(nI.store),i=new UE;return e.store($E.store).ss({ns:!0},function(t,e){t=new ry(t);return r(t.h())}).next(function(){return e.store(zE.store).ss({ns:!0},function(t,e){t[0];var n=t[1],n=(t[2],hE(n));return r(n.h())})})},BE.prototype.rewriteCanonicalIds=function(t){var n=this,r=t.store(ZE.store);return r.ss(function(t,e){e=bE(e),e=_E(n.serializer,e);return r.put(e)})},BE),VE=function(t,e){this.seconds=t,this.nanoseconds=e},qE=function(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n};function BE(t){this.serializer=t}function WE(){this.index={}}function HE(){this.ua=new UE}qE.store="owner",qE.key="owner";var GE=function(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n};GE.store="mutationQueues",GE.keyPath="userId";var KE=function(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i};KE.store="mutations",KE.keyPath="batchId",KE.userMutationsIndex="userMutationsIndex",KE.userMutationsKeyPath=["userId","batchId"];var zE=(QE.prefixForUser=function(t){return[t]},QE.prefixForPath=function(t,e){return[t,uE(e)]},QE.key=function(t,e,n){return[t,uE(e),n]},QE);function QE(){}zE.store="documentMutations",zE.PLACEHOLDER=new zE;var YE=function(t,e){this.path=t,this.readTime=e},XE=function(t,e){this.path=t,this.version=e},$E=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};$E.store="remoteDocuments",$E.readTimeIndex="readTimeIndex",$E.readTimeIndexPath="readTime",$E.collectionReadTimeIndex="collectionReadTimeIndex",$E.collectionReadTimeIndexPath=["parentPath","readTime"];var JE=function(t){this.byteSize=t};JE.store="remoteDocumentGlobal",JE.key="remoteDocumentGlobalKey";var ZE=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};ZE.store="targets",ZE.keyPath="targetId",ZE.queryTargetsIndexName="queryTargetsIndex",ZE.queryTargetsKeyPath=["canonicalId","targetId"];var tI=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};tI.store="targetDocuments",tI.keyPath=["targetId","path"],tI.documentTargetsIndex="documentTargetsIndex",tI.documentTargetsKeyPath=["path","targetId"];var eI=function(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r};eI.key="targetGlobalKey",eI.store="targetGlobal";var nI=function(t,e){this.collectionId=t,this.parent=e};function rI(t){t.createObjectStore(tI.store,{keyPath:tI.keyPath}).createIndex(tI.documentTargetsIndex,tI.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(ZE.store,{keyPath:ZE.keyPath}).createIndex(ZE.queryTargetsIndexName,ZE.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(eI.store)}nI.store="collectionParents",nI.keyPath=["collectionId","parent"];var iI=function(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r};iI.store="clientMetadata",iI.keyPath="clientId";var oI=To(To(To([GE.store,KE.store,zE.store,$E.store,ZE.store,qE.store,eI.store,tI.store],[iI.store]),[JE.store]),[nI.store]),sI=(aI.prototype.ko=function(t,e){var n=this;if(this.ha.has(e))return W_.resolve();var r=e._(),i=e.h();t.Vr(function(){n.ha.add(e)});i={collectionId:r,parent:uE(i)};return uI(t).put(i)},aI.prototype.Ur=function(t,i){var o=[],e=IDBKeyRange.bound([i,""],[xy(i),""],!1,!0);return uI(t).Zn(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(hE(r.parent))}return o})},aI);function aI(){this.ha=new UE}function uI(t){return bI.Un(t,nI.store)}var cI=(fI.prototype.next=function(){return this.la+=2,this.la},fI._a=function(){return new fI(0)},fI.fa=function(){return new fI(-1)},fI),hI=(lI.prototype.da=function(n){var r=this;return this.wa(n).next(function(t){var e=new cI(t.highestTargetId);return t.highestTargetId=e.next(),r.ma(n,t).next(function(){return t.highestTargetId})})},lI.prototype.Ta=function(t){return this.wa(t).next(function(t){return zy.Y(new Ky(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},lI.prototype.Ea=function(t){return this.wa(t).next(function(t){return t.highestListenSequenceNumber})},lI.prototype.Ia=function(e,n,r){var i=this;return this.wa(e).next(function(t){return t.highestListenSequenceNumber=n,r&&(t.lastRemoteSnapshotVersion=r.X()),n>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.ma(e,t)})},lI.prototype.Aa=function(e,n){var r=this;return this.Ra(e,n).next(function(){return r.wa(e).next(function(t){return t.targetCount+=1,r.Pa(n,t),r.ma(e,t)})})},lI.prototype.ga=function(t,e){return this.Ra(t,e)},lI.prototype.ya=function(e,t){var n=this;return this.Va(e,t.targetId).next(function(){return pI(e).delete(t.targetId)}).next(function(){return n.wa(e)}).next(function(t){return $v(0<t.targetCount),--t.targetCount,n.ma(e,t)})},lI.prototype.Vo=function(n,r,i){var o=this,s=0,a=[];return pI(n).ss(function(t,e){e=bE(e);e.sequenceNumber<=r&&null===i.get(e.targetId)&&(s++,a.push(o.ya(n,e)))}).next(function(){return W_.$n(a)}).next(function(){return s})},lI.prototype.De=function(t,n){return pI(t).ss(function(t,e){e=bE(e);n(e)})},lI.prototype.wa=function(t){return dI(t).get(eI.key).next(function(t){return $v(null!==t),t})},lI.prototype.ma=function(t,e){return dI(t).put(eI.key,e)},lI.prototype.Ra=function(t,e){return pI(t).put(_E(this.serializer,e))},lI.prototype.Pa=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},lI.prototype.pa=function(t){return this.wa(t).next(function(t){return t.targetCount})},lI.prototype.ba=function(t,r){var e=ig(r),e=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),i=null;return pI(t).ss({range:e,index:ZE.queryTargetsIndexName},function(t,e,n){e=bE(e);og(r,e.target)&&(i=e,n.done())}).next(function(){return i})},lI.prototype.va=function(n,t,r){var i=this,o=[],s=vI(n);return t.forEach(function(t){var e=uE(t.path);o.push(s.put(new tI(r,e))),o.push(i.Co.Sa(n,r,t))}),W_.$n(o)},lI.prototype.Da=function(n,t,r){var i=this,o=vI(n);return W_.forEach(t,function(t){var e=uE(t.path);return W_.$n([o.delete([r,e]),i.Co.Ca(n,r,t)])})},lI.prototype.Va=function(t,e){t=vI(t),e=IDBKeyRange.bound([e],[e+1],!1,!0);return t.delete(e)},lI.prototype.Na=function(t,e){var e=IDBKeyRange.bound([e],[e+1],!1,!0),t=vI(t),r=Ag();return t.ss({range:e,ns:!0},function(t,e,n){t=hE(t[1]),t=new sy(t);r=r.add(t)}).next(function(){return r})},lI.prototype.zo=function(t,e){var e=uE(e.path),e=IDBKeyRange.bound([e],[xy(e)],!1,!0),i=0;return vI(t).ss({index:tI.documentTargetsIndex,ns:!0,range:e},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0<i})},lI.prototype.qe=function(t,e){return pI(t).get(e).next(function(t){return t?bE(t):null})},lI);function lI(t,e){this.Co=t,this.serializer=e}function fI(t){this.la=t}function pI(t){return bI.Un(t,ZE.store)}function dI(t){return bI.Un(t,eI.store)}function vI(t){return bI.Un(t,tI.store)}var yI,gI="Failed to obtain exclusive access to the persistence layer. To allow shared access, make sure to invoke `enablePersistence()` with `synchronizeTabs:true` in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",mI=(go(wI,yI=K),wI),bI=(_I.Un=function(t,e){if(t instanceof mI)return H_.Un(t.Wo,e);throw Xv()},_I.prototype.start=function(){var e=this;return this.Ga().then(function(){if(!e.isPrimary&&!e.allowTabSynchronization)throw new Bv(qv.FAILED_PRECONDITION,gI);return e.za(),e.Ha(),e.Ya(),e.runTransaction("getHighestListenSequenceNumber","readonly",function(t){return e.ja.Ea(t)})}).then(function(t){e.ka=new Ew(t,e.$a)}).then(function(){e.Ma=!0}).catch(function(t){return e.Wa&&e.Wa.close(),Promise.reject(t)})},_I.prototype.Ja=function(n){var t=this;return this.Ua=function(e){return bo(t,void 0,void 0,function(){return _o(this,function(t){return this.Ti?[2,n(e)]:[2]})})},n(this.isPrimary)},_I.prototype.Xa=function(n){var t=this;this.Wa.jn(function(e){return bo(t,void 0,void 0,function(){return _o(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]}})})})},_I.prototype.Za=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this._n.ds(function(){return bo(e,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return this.Ti?[4,this.Ga()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})}))},_I.prototype.Ga=function(){var n=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",function(e){return II(e).put(new iI(n.clientId,Date.now(),n.networkEnabled,n.inForeground)).next(function(){if(n.isPrimary)return n.tc(e).next(function(t){t||(n.isPrimary=!1,n._n.Ds(function(){return n.Ua(!1)}))})}).next(function(){return n.ec(e)}).next(function(t){return n.isPrimary&&!t?n.nc(e).next(function(){return!1}):!!t&&n.sc(e).next(function(){return!0})})}).catch(function(t){if(J_(t))return Kv("IndexedDbPersistence","Failed to extend owner lease: ",t),n.isPrimary;if(!n.allowTabSynchronization)throw t;return Kv("IndexedDbPersistence","Releasing owner lease after error during lease refresh",t),!1}).then(function(t){n.isPrimary!==t&&n._n.Ds(function(){return n.Ua(t)}),n.isPrimary=t})},_I.prototype.tc=function(t){var e=this;return EI(t).get(qE.key).next(function(t){return W_.resolve(e.ic(t))})},_I.prototype.rc=function(t){return II(t).delete(this.clientId)},_I.prototype.oc=function(){return bo(this,void 0,void 0,function(){var e,n,r,i,o=this;return _o(this,function(t){switch(t.label){case 0:return!this.isPrimary||this.ac(this.qa,18e5)?[3,2]:(this.qa=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(t){var r=_I.Un(t,iI.store);return r.Zn().next(function(t){var e=o.cc(t,18e5),n=t.filter(function(t){return-1===e.indexOf(t)});return W_.forEach(n,function(t){return r.delete(t.clientId)}).next(function(){return n})})}).catch(function(){return[]})]);case 1:if(e=t.sent(),this.Ka)for(n=0,r=e;n<r.length;n++)i=r[n],this.Ka.removeItem(this.uc(i.clientId));t.label=2;case 2:return[2]}})})},_I.prototype.Ya=function(){var t=this;this.Ba=this._n.gn("client_metadata_refresh",4e3,function(){return t.Ga().then(function(){return t.oc()}).then(function(){return t.Ya()})})},_I.prototype.ic=function(t){return!!t&&t.ownerId===this.clientId},_I.prototype.ec=function(e){var r=this;return this.xa?W_.resolve(!0):EI(e).get(qE.key).next(function(t){if(null!==t&&r.ac(t.leaseTimestampMs,5e3)&&!r.hc(t.ownerId)){if(r.ic(t)&&r.networkEnabled)return!0;if(!r.ic(t)){if(!t.allowTabSynchronization)throw new Bv(qv.FAILED_PRECONDITION,gI);return!1}}return!(!r.networkEnabled||!r.inForeground)||II(e).Zn().next(function(t){return void 0===r.cc(t,5e3).find(function(t){if(r.clientId!==t.clientId){var e=!r.networkEnabled&&t.networkEnabled,n=!r.inForeground&&t.inForeground,t=r.networkEnabled===t.networkEnabled;if(e||n&&t)return!0}return!1})})}).next(function(t){return r.isPrimary!==t&&Kv("IndexedDbPersistence","Client "+(t?"is":"is not")+" eligible for a primary lease."),t})},_I.prototype.Si=function(){return bo(this,void 0,void 0,function(){var n=this;return _o(this,function(t){switch(t.label){case 0:return this.Ma=!1,this.lc(),this.Ba&&(this.Ba.cancel(),this.Ba=null),this._c(),this.fc(),[4,this.Wa.runTransaction("shutdown","readwrite",[qE.store,iI.store],function(t){var e=new mI(t,Ew.oi);return n.nc(e).next(function(){return n.rc(e)})})];case 1:return t.sent(),this.Wa.close(),this.dc(),[2]}})})},_I.prototype.cc=function(t,e){var n=this;return t.filter(function(t){return n.ac(t.updateTimeMs,e)&&!n.hc(t.clientId)})},_I.prototype.Vi=function(){var e=this;return this.runTransaction("getActiveClients","readonly",function(t){return II(t).Zn().next(function(t){return e.cc(t,18e5).map(function(t){return t.clientId})})})},Object.defineProperty(_I.prototype,"Ti",{get:function(){return this.Ma},enumerable:!1,configurable:!0}),_I.prototype.wc=function(t){return wE.Fo(t,this.serializer,this.Sr,this.Co)},_I.prototype.mc=function(){return this.ja},_I.prototype.Tc=function(){return this.br},_I.prototype.Ec=function(){return this.Sr},_I.prototype.runTransaction=function(e,n,r){var i=this;Kv("IndexedDbPersistence","Starting transaction:",e);var o,t="readonly"===n?"readonly":"readwrite";return this.Wa.runTransaction(e,t,oI,function(t){return o=new mI(t,i.ka?i.ka.next():Ew.oi),"readwrite-primary"===n?i.tc(o).next(function(t){return!!t||i.ec(o)}).next(function(t){if(!t)throw zv("Failed to obtain primary lease for action '"+e+"'."),i.isPrimary=!1,i._n.Ds(function(){return i.Ua(!1)}),new Bv(qv.FAILED_PRECONDITION,Mw);return r(o)}).next(function(t){return i.sc(o).next(function(){return t})}):i.Ic(o).next(function(){return r(o)})}).then(function(t){return o.pr(),t})},_I.prototype.Ic=function(t){var e=this;return EI(t).get(qE.key).next(function(t){if(null!==t&&e.ac(t.leaseTimestampMs,5e3)&&!e.hc(t.ownerId)&&!e.ic(t)&&!(e.xa||e.allowTabSynchronization&&t.allowTabSynchronization))throw new Bv(qv.FAILED_PRECONDITION,gI)})},_I.prototype.sc=function(t){var e=new qE(this.clientId,this.allowTabSynchronization,Date.now());return EI(t).put(qE.key,e)},_I.On=function(){return H_.On()},_I.prototype.nc=function(t){var e=this,n=EI(t);return n.get(qE.key).next(function(t){return e.ic(t)?(Kv("IndexedDbPersistence","Releasing primary lease."),n.delete(qE.key)):W_.resolve()})},_I.prototype.ac=function(t,e){var n=Date.now();return!(t<n-e||n<t&&(zv("Detected an update time that is in the future: "+t+" > "+n),1))},_I.prototype.za=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.La=function(){t._n.ds(function(){return t.inForeground="visible"===t.document.visibilityState,t.Ga()})},this.document.addEventListener("visibilitychange",this.La),this.inForeground="visible"===this.document.visibilityState)},_I.prototype._c=function(){this.La&&(this.document.removeEventListener("visibilitychange",this.La),this.La=null)},_I.prototype.Ha=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.Oa=function(){e.lc(),e._n.ds(function(){return e.Si()})},this.window.addEventListener("unload",this.Oa))},_I.prototype.fc=function(){this.Oa&&(this.window.removeEventListener("unload",this.Oa),this.Oa=null)},_I.prototype.hc=function(t){try{var e=null!==(null===(e=this.Ka)||void 0===e?void 0:e.getItem(this.uc(t)));return Kv("IndexedDbPersistence","Client '"+t+"' "+(e?"is":"is not")+" zombied in LocalStorage"),e}catch(t){return zv("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},_I.prototype.lc=function(){if(this.Ka)try{this.Ka.setItem(this.uc(this.clientId),String(Date.now()))}catch(t){zv("Failed to set zombie client id.",t)}},_I.prototype.dc=function(){if(this.Ka)try{this.Ka.removeItem(this.uc(this.clientId))}catch(t){}},_I.prototype.uc=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},_I);function _I(t,e,n,r,i,o,s,a,u,c){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this._n=i,this.window=o,this.document=s,this.$a=u,this.xa=c,this.ka=null,this.Ma=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Oa=null,this.inForeground=!1,this.La=null,this.Ba=null,this.qa=Number.NEGATIVE_INFINITY,this.Ua=function(t){return Promise.resolve()},!_I.On())throw new Bv(qv.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.Co=new TI(this,r),this.Qa=e+"main",this.serializer=new lE(a),this.Wa=new H_(this.Qa,10,new jE(this.serializer)),this.ja=new hI(this.Co,this.serializer),this.Sr=new sI,this.br=(e=this.serializer,a=this.Sr,new kE(e,a)),this.window&&this.window.localStorage?this.Ka=this.window.localStorage:(this.Ka=null,!1===c&&zv("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}function wI(t,e){var n=this;return(n=yI.call(this)||this).Wo=t,n.Fa=e,n}function EI(t){return bI.Un(t,qE.store)}function II(t){return bI.Un(t,iI.store)}var TI=(SI.prototype.Ro=function(t){var n=this.Ac(t);return this.db.mc().pa(t).next(function(e){return n.next(function(t){return e+t})})},SI.prototype.Ac=function(t){var e=0;return this.yo(t,function(t){e++}).next(function(){return e})},SI.prototype.De=function(t,e){return this.db.mc().De(t,e)},SI.prototype.yo=function(t,n){return this.Rc(t,function(t,e){return n(e)})},SI.prototype.Sa=function(t,e,n){return CI(t,n)},SI.prototype.Ca=function(t,e,n){return CI(t,n)},SI.prototype.Vo=function(t,e,n){return this.db.mc().Vo(t,e,n)},SI.prototype.Ko=CI,SI.prototype.Pc=function(t,e){return r=e,i=!1,NE(n=t).rs(function(t){return IE(n,t,r).next(function(t){return t&&(i=!0),W_.resolve(!t)})}).next(function(){return i});var n,r,i},SI.prototype.po=function(n,r){var i=this,o=this.db.Tc().ia(),s=[],a=0;return this.Rc(n,function(e,t){t<=r&&(t=i.Pc(n,e).next(function(t){if(!t)return a++,o.Ar(n,e).next(function(){return o.Ir(e),vI(n).delete([0,uE(e.path)])})}),s.push(t))}).next(function(){return W_.$n(s)}).next(function(){return o.apply(n)}).next(function(){return a})},SI.prototype.removeTarget=function(t,e){e=e.nt(t.Fa);return this.db.mc().ga(t,e)},SI.prototype.gc=CI,SI.prototype.Rc=function(t,r){var i,t=vI(t),o=Ew.oi;return t.ss({index:tI.documentTargetsIndex},function(t,e){var n=t[0],t=(t[1],e.path),e=e.sequenceNumber;0===n?(o!==Ew.oi&&r(new sy(hE(i)),o),o=e,i=t):o=Ew.oi}).next(function(){o!==Ew.oi&&r(new sy(hE(i)),o)})},SI.prototype.vo=function(t){return this.db.Tc().oa(t)},SI);function SI(t,e){this.db=t,this.do=new oE(this,e)}function CI(t,e){return vI(t).put((t=t.Fa,new tI(0,uE(e.path),t)))}function NI(t,e){var n=t.projectId;return t.W||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}var AI=(kI.prototype.Eo=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(t){return e.bo(t,n.Vc)})},kI);function kI(t,e,n){this.persistence=t,this.yc=e,this.Vc=new pg(Py),this.bc=new Gy(ig,og),this.vc=zy.min(),this.vr=t.wc(n),this.Sc=t.Tc(),this.ja=t.mc(),this.Dc=new Fw(this.Sc,this.vr,this.persistence.Ec()),this.yc.Cc(this.Dc)}function OI(t,h){var l=t;return l.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(t){var e,r,i,o,s,n,a,u=h.batch.keys(),c=l.Sc.ia({ra:!0});return e=l,r=t,o=c,s=(i=h).batch,n=s.keys(),a=W_.resolve(),n.forEach(function(n){a=a.next(function(){return o.Ar(r,n)}).next(function(t){var e=t,t=i._r.get(n);$v(null!==t),(!e||e.version.L(t)<0)&&(e=s.ar(n,e,i))&&o.Tr(e,i.lr)})}),a.next(function(){return e.vr.Qo(r,s)}).next(function(){return c.apply(t)}).next(function(){return l.vr.Go(t)}).next(function(){return l.Dc.$r(t,u)})})}function RI(t){var e=t;return e.persistence.runTransaction("Get last remote snapshot version","readonly",function(t){return e.ja.Ta(t)})}function PI(t,u){var c=t,h=u.et,l=c.Vc;return c.persistence.runTransaction("Apply remote event","readwrite-primary",function(s){var i=c.Sc.ia({ra:!0});l=c.Vc;var a=[];u.Gt.forEach(function(t,e){var n,r,i,o=l.get(e);o&&(a.push(c.ja.Da(s,t.ne,e).next(function(){return c.ja.va(s,t.te,e)})),0<(i=t.resumeToken).O()&&(n=o.st(i,h).nt(s.Fa),l=l.rt(e,n),r=o,i=t,$v(0<(o=n).resumeToken.O()),(0===r.resumeToken.O()||3e8<=o.et.J()-r.et.J()||0<i.te.size+i.ee.size+i.ne.size)&&a.push(c.ja.ga(s,n))))});var t,o=Eg,n=Ag();return u.Ht.forEach(function(t,e){n=n.add(t)}),a.push(i.getEntries(s,n).next(function(r){u.Ht.forEach(function(t,e){var n=r.get(t);e instanceof qb&&e.version.isEqual(zy.min())?(i.Ir(t,h),o=o.rt(t,e)):null==n||0<e.version.L(n.version)||0===e.version.L(n.version)&&n.hasPendingWrites?(i.Tr(e,h),o=o.rt(t,e)):Kv("LocalStore","Ignoring outdated watch update for ",t,". Current version:",n.version," Watch version:",e.version),u.Yt.has(t)&&a.push(c.persistence.Co.gc(s,t))})})),h.isEqual(zy.min())||(t=c.ja.Ta(s).next(function(t){return c.ja.Ia(s,s.Fa,h)}),a.push(t)),W_.$n(a).next(function(){return i.apply(s)}).next(function(){return c.Dc.kr(s,o)})}).then(function(t){return c.Vc=l,t})}function DI(t,r){var i=t;return i.persistence.runTransaction("Allocate target","readwrite",function(e){var n;return i.ja.ba(e,r).next(function(t){return t?(n=t,W_.resolve(n)):i.ja.da(e).next(function(t){return n=new cg(r,t,0,e.Fa),i.ja.Aa(e,n).next(function(){return n})})})}).then(function(t){var e=i.Vc.get(t.targetId);return(null===e||0<t.et.L(e.et))&&(i.Vc=i.Vc.rt(t.targetId,t),i.bc.set(r,t.targetId)),t})}function xI(i,o,s){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:n=(e=i).Vc.get(o),r=s?"readwrite":"readwrite-primary",t.label=1;case 1:return t.trys.push([1,4,,5]),s?[3,3]:[4,e.persistence.runTransaction("Release target",r,function(t){return e.persistence.Co.removeTarget(t,n)})];case 2:t.sent(),t.label=3;case 3:return[3,5];case 4:if(!J_(r=t.sent()))throw r;return Kv("LocalStore","Failed to update sequence numbers for target "+o+": "+r),[3,5];case 5:return e.Vc=e.Vc.remove(o),e.bc.delete(n.target),[2]}})})}function LI(t,o,s){var a=t,u=zy.min(),c=Ag();return a.persistence.runTransaction("Execute query","readonly",function(e){return t=a,n=e,r=e_(o),(void 0!==(t=(i=t).bc.get(r))?W_.resolve(i.Vc.get(t)):i.ja.ba(n,r)).next(function(t){if(t)return u=t.lastLimboFreeSnapshotVersion,a.ja.Na(e,t.targetId).next(function(t){c=t})}).next(function(){return a.yc.Or(e,o,s?u:zy.min(),s?c:Ag())}).next(function(t){return{documents:t,Nc:c}});var t,n,r,i})}function MI(t,e){var n=t,r=n.ja,t=n.Vc.get(e);return t?Promise.resolve(t.target):n.persistence.runTransaction("Get target data","readonly",function(t){return r.qe(t,e).next(function(t){return t?t.target:null})})}function FI(t){var s=t;return s.persistence.runTransaction("Get new document changes","readonly",function(t){return e=s.Sc,n=t,t=s.vc,r=e,i=Eg,o=dE(t),t=xE(n),n=IDBKeyRange.lowerBound(o,!0),t.ss({index:$E.readTimeIndex,range:n},function(t,e){var n=fE(r.serializer,e);i=i.rt(n.key,n),o=e.readTime}).next(function(){return{Fc:i,readTime:vE(o)}});var e,n,r,i,o}).then(function(t){var e=t.Fc,t=t.readTime;return s.vc=t,e})}function UI(n){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){return[2,(e=n).persistence.runTransaction("Synchronize last document change read time","readonly",function(t){return t=xE(t),r=zy.min(),t.ss({index:$E.readTimeIndex,reverse:!0},function(t,e,n){e.readTime&&(r=vE(e.readTime)),n.done()}).next(function(){return r});var r}).then(function(t){e.vc=t})]})})}function jI(e){return bo(this,void 0,void 0,function(){return _o(this,function(t){if(e.code!==qv.FAILED_PRECONDITION||e.message!==Mw)throw e;return Kv("LocalStore","Unexpectedly lost primary lease"),[2]})})}function VI(t,e){this.user=e,this.type="OAuth",this.jc={},this.jc.Authorization="Bearer "+t}function qI(t,e,n,r,i){var o=this;this.Wu=t,this.ju=e,this.os=n,this.Ku={},this.Gu=[],this.zu=new Map,this.Hu=new Set,this.Yu=[],this.Ju=i,this.Ju.Xu(function(t){n.ds(function(){return bo(o,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return wT(this)?(Kv("RemoteStore","Restarting streams for network reachability change."),[4,function(n){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return(e=n).Hu.add(4),[4,pT(e)];case 1:return t.sent(),e.Zu.set("Unknown"),e.Hu.delete(4),[4,fT(e)];case 2:return t.sent(),[2]}})})}(this)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}),this.Zu=new tT(n,r)}var BI,WI,HI,GI=(lT.prototype.m=function(){return this.$c.m()},lT.prototype.Sa=function(t,e){e=new KI(t,e);this.$c=this.$c.add(e),this.kc=this.kc.add(e)},lT.prototype.Oc=function(t,e){var n=this;t.forEach(function(t){return n.Sa(t,e)})},lT.prototype.Ca=function(t,e){this.Lc(new KI(t,e))},lT.prototype.Bc=function(t,e){var n=this;t.forEach(function(t){return n.Ca(t,e)})},lT.prototype.qc=function(t){var e=this,n=new sy(new ry([])),r=new KI(n,t),t=new KI(n,t+1),i=[];return this.kc.Nt([r,t],function(t){e.Lc(t),i.push(t.key)}),i},lT.prototype.Uc=function(){var e=this;this.$c.forEach(function(t){return e.Lc(t)})},lT.prototype.Lc=function(t){this.$c=this.$c.delete(t),this.kc=this.kc.delete(t)},lT.prototype.Qc=function(t){var e=new sy(new ry([])),n=new KI(e,t),t=new KI(e,t+1),r=Ag();return this.kc.Nt([n,t],function(t){r=r.add(t.key)}),r},lT.prototype.zo=function(t){var e=new KI(t,0),e=this.$c.$t(e);return null!==e&&t.isEqual(e.key)},lT),KI=(hT.xc=function(t,e){return sy.i(t.key,e.key)||Py(t.Wc,e.Wc)},hT.Mc=function(t,e){return Py(t.Wc,e.Wc)||sy.i(t.key,e.key)},hT),zI=(cT.prototype.getToken=function(){return Promise.resolve(null)},cT.prototype.Gc=function(){},cT.prototype.zc=function(t){(this.Kc=t)(bw.UNAUTHENTICATED)},cT.prototype.Hc=function(){this.Kc=null},cT),QI=(uT.prototype.getToken=function(){var e=this,n=this.Xc,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(function(t){return e.Xc!==n?(Kv("FirebaseCredentialsProvider","getToken aborted due to token change."),e.getToken()):t?($v("string"==typeof t.accessToken),new VI(t.accessToken,e.currentUser)):null}):Promise.resolve(null)},uT.prototype.Gc=function(){this.forceRefresh=!0},uT.prototype.zc=function(t){this.Kc=t,this.Jc&&t(this.currentUser)},uT.prototype.Hc=function(){this.auth&&this.auth.removeAuthTokenListener(this.Yc),this.Yc=null,this.Kc=null},uT.prototype.Zc=function(){var t=this.auth&&this.auth.getUid();return $v(null===t||"string"==typeof t),new bw(t)},uT),YI=(Object.defineProperty(aT.prototype,"jc",{get:function(){var t={"X-Goog-AuthUser":this.eu},e=this.tu.auth.getAuthHeaderValueForFirstParty([]);return e&&(t.Authorization=e),t},enumerable:!1,configurable:!0}),aT),XI=(sT.prototype.getToken=function(){return Promise.resolve(new YI(this.tu,this.eu))},sT.prototype.zc=function(t){t(bw.ei)},sT.prototype.Hc=function(){},sT.prototype.Gc=function(){},sT),Dr=(oT.prototype.au=function(){return 1===this.state||2===this.state||4===this.state},oT.prototype.cu=function(){return 2===this.state},oT.prototype.start=function(){3!==this.state?this.auth():this.uu()},oT.prototype.stop=function(){return bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return this.au()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},oT.prototype.hu=function(){this.state=0,this.gs.reset()},oT.prototype.lu=function(){var t=this;this.cu()&&null===this.ou&&(this.ou=this._n.gn(this.nu,6e4,function(){return t._u()}))},oT.prototype.fu=function(t){this.du(),this.stream.send(t)},oT.prototype._u=function(){return bo(this,void 0,void 0,function(){return _o(this,function(t){return this.cu()?[2,this.close(0)]:[2]})})},oT.prototype.du=function(){this.ou&&(this.ou.cancel(),this.ou=null)},oT.prototype.close=function(e,n){return bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return this.du(),this.gs.cancel(),this.ru++,3!==e?this.gs.reset():n&&n.code===qv.RESOURCE_EXHAUSTED?(zv(n.toString()),zv("Using maximum backoff delay to prevent overloading the backend."),this.gs.An()):n&&n.code===qv.UNAUTHENTICATED&&this.iu.Gc(),null!==this.stream&&(this.wu(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.mu(n)];case 1:return t.sent(),[2]}})})},oT.prototype.wu=function(){},oT.prototype.auth=function(){var n=this;this.state=1;var t=this.Tu(this.ru),e=this.ru;this.iu.getToken().then(function(t){n.ru===e&&n.Eu(t)},function(e){t(function(){var t=new Bv(qv.UNKNOWN,"Fetching auth token failed: "+e.message);return n.Iu(t)})})},oT.prototype.Eu=function(t){var e=this,n=this.Tu(this.ru);this.stream=this.Au(t),this.stream.Ru(function(){n(function(){return e.state=2,e.listener.Ru()})}),this.stream.mu(function(t){n(function(){return e.Iu(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},oT.prototype.uu=function(){var t=this;this.state=4,this.gs.Rn(function(){return bo(t,void 0,void 0,function(){return _o(this,function(t){return this.state=0,this.start(),[2]})})})},oT.prototype.Iu=function(t){return Kv("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},oT.prototype.Tu=function(e){var n=this;return function(t){n._n.ds(function(){return n.ru===e?t():(Kv("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},oT),$I=(go(iT,HI=Dr),iT.prototype.Au=function(t){return this.su.Pu("Listen",t)},iT.prototype.onMessage=function(t){this.gs.reset();var e=function(t,e){if("targetChange"in e){e.targetChange;var n="NO_CHANGE"===(i=e.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===i?1:"REMOVE"===i?2:"CURRENT"===i?3:"RESET"===i?4:Xv(),r=e.targetChange.targetIds||[],i=(o=e.targetChange.resumeToken,t.Ue?($v(void 0===o||"string"==typeof o),Ly.fromBase64String(o||"")):($v(void 0===o||o instanceof Uint8Array),Ly.fromUint8Array(o||new Uint8Array))),o=e.targetChange.cause,s=o&&(o=void 0===(s=o).code?qv.UNKNOWN:fg(s.code),new Bv(o,s.message||"")),r=new Fg(n,r,i,s||null)}else if("documentChange"in e){e.documentChange;var a=e.documentChange;a.document,a.document.name,a.document.updateTime;var i=Sm(t,a.document.name),u=wm(a.document.updateTime),s=new Rb({mapValue:{fields:a.document.fields}}),u=new Vb(i,u,s,{}),s=a.targetIds||[],a=a.removedTargetIds||[];r=new Lg(s,a,u.key,u)}else if("documentDelete"in e){e.documentDelete;a=e.documentDelete;a.document;var u=Sm(t,a.document),c=a.readTime?wm(a.readTime):zy.min(),c=new qb(u,c),a=a.removedTargetIds||[];r=new Lg([],a,c.key,c)}else if("documentRemove"in e){e.documentRemove;c=e.documentRemove;c.document;var h=Sm(t,c.document),c=c.removedTargetIds||[];r=new Lg([],c,h,null)}else{if(!("filter"in e))return Xv();e.filter;h=e.filter;h.targetId;e=h.count||0,e=new ag(e),h=h.targetId;r=new Mg(h,e)}return r}(this.serializer,t),t=function(t){if(!("targetChange"in t))return zy.min();t=t.targetChange;return(!t.targetIds||!t.targetIds.length)&&t.readTime?wm(t.readTime):zy.min()}(t);return this.listener.gu(e,t)},iT.prototype.yu=function(t){var e,n,r,i={};i.database=Am(this.serializer),i.addTarget=(e=this.serializer,(r=sg(r=(n=t).target)?{documents:Dm(e,r)}:{query:xm(e,r)}).targetId=n.targetId,0<n.resumeToken.O()&&(r.resumeToken=_m(e,n.resumeToken)),r);var o,t=(this.serializer,o=t,null==(t=function(){switch(o.tt){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Xv()}}())?null:{"goog-listen-tags":t});t&&(i.labels=t),this.fu(i)},iT.prototype.Vu=function(t){var e={};e.database=Am(this.serializer),e.removeTarget=t,this.fu(e)},iT),JI=(go(rT,WI=Dr),Object.defineProperty(rT.prototype,"bu",{get:function(){return this.pu},enumerable:!1,configurable:!0}),rT.prototype.start=function(){this.pu=!1,this.lastStreamToken=void 0,WI.prototype.start.call(this)},rT.prototype.wu=function(){this.pu&&this.vu([])},rT.prototype.Au=function(t){return this.su.Pu("Write",t)},rT.prototype.onMessage=function(t){if($v(!!t.streamToken),this.lastStreamToken=t.streamToken,this.pu){this.gs.reset();var e=(n=t.writeResults,r=t.commitTime,n&&0<n.length?($v(void 0!==r),n.map(function(t){return function(t,e){var n=t.updateTime?wm(t.updateTime):wm(e);n.isEqual(zy.min())&&(n=wm(e));e=null;return t.transformResults&&0<t.transformResults.length&&(e=t.transformResults),new ub(n,e)}(t,r)})):[]),n=wm(t.commitTime);return this.listener.Su(n,e)}var n,r;return $v(!t.writeResults||0===t.writeResults.length),this.pu=!0,this.listener.Du()},rT.prototype.Cu=function(){var t={};t.database=Am(this.serializer),this.fu(t)},rT.prototype.vu=function(t){var e=this,t={streamToken:this.lastStreamToken,writes:t.map(function(t){return Rm(e.serializer,t)})};this.fu(t)},rT),ZI=(go(nT,BI=function(){}),nT.prototype.Fu=function(){if(this.Nu)throw new Bv(qv.FAILED_PRECONDITION,"The client has already been terminated.")},nT.prototype.$u=function(e,n,r){var i=this;return this.Fu(),this.credentials.getToken().then(function(t){return i.su.$u(e,n,r,t)}).catch(function(t){throw t.code===qv.UNAUTHENTICATED&&i.credentials.Gc(),t})},nT.prototype.xu=function(e,n,r){var i=this;return this.Fu(),this.credentials.getToken().then(function(t){return i.su.xu(e,n,r,t)}).catch(function(t){throw t.code===qv.UNAUTHENTICATED&&i.credentials.Gc(),t})},nT.prototype.terminate=function(){this.Nu=!1},nT),tT=(eT.prototype.Lu=function(){var t=this;0===this.ku&&(this.Bu("Unknown"),this.Mu=this.os.gn("online_state_timeout",1e4,function(){return t.Mu=null,t.qu("Backend didn't respond within 10 seconds."),t.Bu("Offline"),Promise.resolve()}))},eT.prototype.Uu=function(t){"Online"===this.state?this.Bu("Unknown"):(this.ku++,1<=this.ku&&(this.Qu(),this.qu("Connection failed 1 times. Most recent error: "+t.toString()),this.Bu("Offline")))},eT.prototype.set=function(t){this.Qu(),this.ku=0,"Online"===t&&(this.Ou=!1),this.Bu(t)},eT.prototype.Bu=function(t){t!==this.state&&(this.state=t,this.fi(t))},eT.prototype.qu=function(t){t="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.Ou?(zv(t),this.Ou=!1):Kv("OnlineStateTracker",t)},eT.prototype.Qu=function(){null!==this.Mu&&(this.Mu.cancel(),this.Mu=null)},eT);function eT(t,e){this.os=t,this.fi=e,this.state="Unknown",this.ku=0,this.Mu=null,this.Ou=!0}function nT(t,e,n){var r=this;return(r=BI.call(this)||this).credentials=t,r.su=e,r.serializer=n,r.Nu=!1,r}function rT(t,e,n,r,i){var o=this;return(o=WI.call(this,t,"write_stream_connection_backoff","write_stream_idle",e,n,i)||this).serializer=r,o.pu=!1,o}function iT(t,e,n,r,i){var o=this;return(o=HI.call(this,t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i)||this).serializer=r,o}function oT(t,e,n,r,i,o){this._n=t,this.nu=n,this.su=r,this.iu=i,this.listener=o,this.state=0,this.ru=0,this.ou=null,this.stream=null,this.gs=new B_(t,e)}function sT(t,e){this.tu=t,this.eu=e}function aT(t,e){this.tu=t,this.eu=e,this.type="FirstParty",this.user=bw.ei}function uT(t){var e=this;this.Yc=null,this.currentUser=bw.UNAUTHENTICATED,this.Jc=!1,this.Xc=0,this.Kc=null,this.forceRefresh=!1,this.Yc=function(){e.Xc++,e.currentUser=e.Zc(),e.Jc=!0,e.Kc&&e.Kc(e.currentUser)},this.Xc=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.Yc):(this.Yc(null),t.get().then(function(t){e.auth=t,e.Yc&&e.auth.addAuthTokenListener(e.Yc)},function(){}))}function cT(){this.Kc=null}function hT(t,e){this.key=t,this.Wc=e}function lT(){this.$c=new _g(KI.xc),this.kc=new _g(KI.Mc)}function fT(r){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:if(!wT(r))return[3,4];e=0,n=r.Yu,t.label=1;case 1:return e<n.length?[4,(0,n[e])(!0)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})}function pT(r){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:e=0,n=r.Yu,t.label=1;case 1:return e<n.length?[4,(0,n[e])(!1)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})}function dT(n){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return e=n,Kv("RemoteStore","RemoteStore shutting down."),e.Hu.add(5),[4,pT(e)];case 1:return t.sent(),e.Ju.Si(),e.Zu.set("Unknown"),[2]}})})}function vT(t,e){t.zu.has(e.targetId)||(t.zu.set(e.targetId,e),_T(t)?bT(t):OT(t).cu()&&gT(t,e))}function yT(t,e){var n=t,t=OT(n);n.zu.delete(e),t.cu()&&mT(n,e),0===n.zu.size&&(t.cu()?t.lu():wT(n)&&n.Zu.set("Unknown"))}function gT(t,e){t.th.Ee(e.targetId),OT(t).yu(e)}function mT(t,e){t.th.Ee(e),OT(t).Vu(e)}function bT(e){e.th=new jg({Be:function(t){return e.Ku.Be(t)},qe:function(t){return e.zu.get(t)||null}}),OT(e).start(),e.Zu.Lu()}function _T(t){return wT(t)&&!OT(t).au()&&0<t.zu.size}function wT(t){return 0===t.Hu.size}function ET(t){t.th=void 0}function IT(s,a,u){return bo(this,void 0,void 0,function(){var n,o;return _o(this,function(t){switch(t.label){case 0:if(s.Zu.set("Online"),!(a instanceof Fg&&2===a.state&&a.cause))return[3,6];t.label=1;case 1:return t.trys.push([1,3,,5]),[4,function(o,s){return bo(this,void 0,void 0,function(){var e,n,r,i;return _o(this,function(t){switch(t.label){case 0:e=s.cause,n=0,r=s.targetIds,t.label=1;case 1:return n<r.length?(i=r[n],o.zu.has(i)?[4,o.Ku.eh(i,e)]:[3,3]):[3,5];case 2:t.sent(),o.zu.delete(i),o.th.removeTarget(i),t.label=3;case 3:t.label=4;case 4:return n++,[3,1];case 5:return[2]}})})}(s,a)];case 2:return t.sent(),[3,5];case 3:return n=t.sent(),Kv("RemoteStore","Failed to remove targets %s: %s ",a.targetIds.join(","),n),[4,TT(s,n)];case 4:return t.sent(),[3,5];case 5:return[3,13];case 6:if(a instanceof Lg?s.th.pe(a):a instanceof Mg?s.th.$e(a):s.th.Se(a),u.isEqual(zy.min()))return[3,13];t.label=7;case 7:return t.trys.push([7,11,,13]),[4,RI(s.Wu)];case 8:return o=t.sent(),0<=u.L(o)?[4,(i=u,(e=(r=s).th.Me(i)).Gt.forEach(function(t,e){var n;0<t.resumeToken.O()&&((n=r.zu.get(e))&&r.zu.set(e,n.st(t.resumeToken,i)))}),e.zt.forEach(function(t){var e=r.zu.get(t);e&&(r.zu.set(t,e.st(Ly.B,e.et)),mT(r,t),e=new cg(e.target,t,1,e.sequenceNumber),gT(r,e))}),r.Ku.nh(e))]:[3,10];case 9:t.sent(),t.label=10;case 10:return[3,13];case 11:return Kv("RemoteStore","Failed to raise snapshot:",o=t.sent()),[4,TT(s,o)];case 12:return t.sent(),[3,13];case 13:return[2]}var r,i,e})})}function TT(n,r,i){return bo(this,void 0,void 0,function(){var e=this;return _o(this,function(t){switch(t.label){case 0:if(!J_(r))throw r;return n.Hu.add(1),[4,pT(n)];case 1:return t.sent(),n.Zu.set("Offline"),i=i||function(){return RI(n.Wu)},n.os.Ds(function(){return bo(e,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return Kv("RemoteStore","Retrying IndexedDB access"),[4,i()];case 1:return t.sent(),n.Hu.delete(1),[4,fT(n)];case 2:return t.sent(),[2]}})})}),[2]}})})}function ST(e,n){return n().catch(function(t){return TT(e,t,n)})}function CT(u){return bo(this,void 0,void 0,function(){var i,o,s,a;return _o(this,function(t){switch(t.label){case 0:o=RT(i=u),s=0<i.Gu.length?i.Gu[i.Gu.length-1].batchId:-1,t.label=1;case 1:if(!(wT(i)&&i.Gu.length<10))return[3,7];t.label=2;case 2:return t.trys.push([2,4,,6]),[4,(e=i.Wu,n=s,(r=e).persistence.runTransaction("Get next mutation batch","readonly",function(t){return void 0===n&&(n=-1),r.vr.Lo(t,n)}))];case 3:return null===(a=t.sent())?(0===i.Gu.length&&o.lu(),[3,7]):(s=a.batchId,function(t,e){t.Gu.push(e);t=RT(t);t.cu()&&t.bu&&t.vu(e.mutations)}(i,a),[3,6]);case 4:return a=t.sent(),[4,TT(i,a)];case 5:return t.sent(),[3,6];case 6:return[3,1];case 7:return NT(i)&&AT(i),[2]}var e,n,r})})}function NT(t){return wT(t)&&!RT(t).au()&&0<t.Gu.length}function AT(t){RT(t).start()}function kT(n,r){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return e=n,r?(e.Hu.delete(2),[4,fT(e)]):[3,2];case 1:return t.sent(),[3,5];case 2:return r?[3,4]:(e.Hu.add(2),[4,pT(e)]);case 3:t.sent(),e.Zu.set("Unknown"),t.label=4;case 4:t.label=5;case 5:return[2]}})})}function OT(n){var t,e,r,i=this;return n.rh||(n.rh=(t=n.ju,e=n.os,r={Ru:function(n){return bo(this,void 0,void 0,function(){return _o(this,function(t){return n.zu.forEach(function(t,e){gT(n,t)}),[2]})})}.bind(null,n),mu:function(e,n){return bo(this,void 0,void 0,function(){return _o(this,function(t){return ET(e),_T(e)?(e.Zu.Uu(n),bT(e)):e.Zu.set("Unknown"),[2]})})}.bind(null,n),gu:IT.bind(null,n)},t.Fu(),new $I(e,t.su,t.credentials,t.serializer,r)),n.Yu.push(function(e){return bo(i,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return e?(n.rh.hu(),_T(n)?bT(n):n.Zu.set("Unknown"),[3,3]):[3,1];case 1:return[4,n.rh.stop()];case 2:t.sent(),ET(n),t.label=3;case 3:return[2]}})})})),n.rh}function RT(n){var t,e,r,i=this;return n.oh||(n.oh=(t=n.ju,e=n.os,r={Ru:function(e){return bo(this,void 0,void 0,function(){return _o(this,function(t){return RT(e).Cu(),[2]})})}.bind(null,n),mu:function(e,n){return bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return n&&RT(e).bu?[4,function(r,i){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return lg(n=i.code)&&n!==qv.ABORTED?(e=r.Gu.shift(),RT(r).hu(),[4,ST(r,function(){return r.Ku.ih(e.batchId,i)})]):[3,3];case 1:return t.sent(),[4,CT(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}(e,n)]:[3,2];case 1:t.sent(),t.label=2;case 2:return NT(e)&&AT(e),[2]}})})}.bind(null,n),Du:function(o){return bo(this,void 0,void 0,function(){var e,n,r,i;return _o(this,function(t){for(e=RT(o),n=0,r=o.Gu;n<r.length;n++)i=r[n],e.vu(i.mutations);return[2]})})}.bind(null,n),Su:function(r,i,o){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return e=r.Gu.shift(),n=Lw.from(e,i,o),[4,ST(r,function(){return r.Ku.sh(n)})];case 1:return t.sent(),[4,CT(r)];case 2:return t.sent(),[2]}})})}.bind(null,n)},t.Fu(),new JI(e,t.su,t.credentials,t.serializer,r)),n.Yu.push(function(e){return bo(i,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return e?(n.oh.hu(),[4,CT(n)]):[3,2];case 1:return t.sent(),[3,4];case 2:return[4,n.oh.stop()];case 3:t.sent(),0<n.Gu.length&&(Kv("RemoteStore","Stopping write stream with "+n.Gu.length+" pending writes"),n.Gu=[]),t.label=4;case 4:return[2]}})})})),n.oh}var PT=function(t){this.key=t},DT=function(t){this.key=t},xT=(Object.defineProperty(jT.prototype,"fh",{get:function(){return this.ah},enumerable:!1,configurable:!0}),jT.prototype.dh=function(t,e){var s=this,a=e?e.wh:new Rg,u=(e||this)._h,c=(e||this).Qt,h=u,l=!1,f=Yb(this.query)&&u.size===this.query.limit?u.last():null,p=Xb(this.query)&&u.size===this.query.limit?u.first():null;if(t.ut(function(t,e){var n=u.get(t),r=(r=e instanceof Vb?e:null)&&(u_(s.query,r)?r:null),i=!!n&&s.Qt.has(n.key),o=!!r&&(r.Ye||s.Qt.has(r.key)&&r.hasCommittedMutations),e=!1;n&&r?n.data().isEqual(r.data())?i!==o&&(a.track({type:3,doc:r}),e=!0):s.mh(n,r)||(a.track({type:2,doc:r}),e=!0,(f&&0<s.lh(r,f)||p&&s.lh(r,p)<0)&&(l=!0)):!n&&r?(a.track({type:0,doc:r}),e=!0):n&&!r&&(a.track({type:1,doc:n}),e=!0,(f||p)&&(l=!0)),e&&(c=r?(h=h.add(r),o?c.add(t):c.delete(t)):(h=h.delete(t),c.delete(t)))}),Yb(this.query)||Xb(this.query))for(;h.size>this.query.limit;){var n=Yb(this.query)?h.last():h.first(),h=h.delete(n.key),c=c.delete(n.key);a.track({type:1,doc:n})}return{_h:h,wh:a,Th:l,Qt:c}},jT.prototype.mh=function(t,e){return t.Ye&&e.hasCommittedMutations&&!e.Ye},jT.prototype.gr=function(t,e,n){var o=this,r=this._h;this._h=t._h,this.Qt=t.Qt;var i=t.wh.qt();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.lh(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 Xv()}}var r,i}),this.Eh(n);var s=e?this.Ih():[],n=0===this.hh.size&&this.Zt?1:0,e=n!==this.uh;return this.uh=n,0!==i.length||e?{snapshot:new Pg(this.query,t._h,r,i,t.Qt,0==n,e,!1),Ah:s}:{Ah:s}},jT.prototype.Us=function(t){return this.Zt&&"Offline"===t?(this.Zt=!1,this.gr({_h:this._h,wh:new Rg,Qt:this.Qt,Th:!1},!1)):{Ah:[]}},jT.prototype.Rh=function(t){return!this.ah.has(t)&&!!this._h.has(t)&&!this._h.get(t).Ye},jT.prototype.Eh=function(t){var e=this;t&&(t.te.forEach(function(t){return e.ah=e.ah.add(t)}),t.ee.forEach(function(t){}),t.ne.forEach(function(t){return e.ah=e.ah.delete(t)}),this.Zt=t.Zt)},jT.prototype.Ih=function(){var e=this;if(!this.Zt)return[];var n=this.hh;this.hh=Ag(),this._h.forEach(function(t){e.Rh(t.key)&&(e.hh=e.hh.add(t.key))});var r=[];return n.forEach(function(t){e.hh.has(t)||r.push(new DT(t))}),this.hh.forEach(function(t){n.has(t)||r.push(new PT(t))}),r},jT.prototype.Ph=function(t){this.ah=t.Nc,this.hh=Ag();t=this.dh(t.documents);return this.gr(t,!0)},jT.prototype.gh=function(){return Pg.Kt(this.query,this._h,this.Qt,0===this.uh)},jT),LT=function(t,e,n){this.query=t,this.targetId=e,this.view=n},MT=function(t){this.key=t,this.yh=!1},FT=(Object.defineProperty(UT.prototype,"qh",{get:function(){return!0===this.Bh},enumerable:!1,configurable:!0}),UT);function UT(t,e,n,r,i,o){this.Wu=t,this.Vh=e,this.ph=n,this.bh=r,this.currentUser=i,this.Sh=o,this.Dh={},this.Ch=new Gy(s_,o_),this.Nh=new Map,this.Fh=[],this.$h=new pg(sy.i),this.xh=new Map,this.kh=new GI,this.Mh={},this.Oh=new Map,this.Lh=cI.fa(),this.onlineState="Unknown",this.Bh=void 0}function jT(t,e){this.query=t,this.ah=e,this.uh=null,this.Zt=!1,this.hh=Ag(),this.Qt=Ag(),this.lh=c_(t),this._h=new Og(this.lh)}function VT(i,o,s,a){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return i.Uh=function(t,e,n){return function(r,i,o,s){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return(e=i.view.dh(o)).Th?[4,LI(r.Wu,i.query,!1).then(function(t){t=t.documents;return i.view.dh(t,e)})]:[3,2];case 1:e=t.sent(),t.label=2;case 2:return n=s&&s.Gt.get(i.targetId),n=i.view.gr(e,r.qh,n),[2,(QT(r,i.targetId,n.Ah),n.snapshot)]}})})}(i,t,e,n)},[4,LI(i.Wu,o,!0)];case 1:return n=t.sent(),r=new xT(o,n.Nc),e=r.dh(n.documents),n=xg.Xt(s,a&&"Offline"!==i.onlineState),n=r.gr(e,i.qh,n),QT(i,s,n.Ah),r=new LT(o,s,r),[2,(i.Ch.set(o,r),i.Nh.has(s)?i.Nh.get(s).push(o):i.Nh.set(s,[o]),n.snapshot)]}})})}function qT(r,i){return bo(this,void 0,void 0,function(){var n,e;return _o(this,function(t){switch(t.label){case 0:n=r,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,PI(n.Wu,i)];case 2:return e=t.sent(),i.Gt.forEach(function(t,e){e=n.xh.get(e);e&&($v(t.te.size+t.ee.size+t.ne.size<=1),0<t.te.size?e.yh=!0:0<t.ee.size?$v(e.yh):0<t.ne.size&&($v(e.yh),e.yh=!1))}),[4,XT(n,e,i)];case 3:return t.sent(),[3,6];case 4:return[4,jI(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}function BT(t,n,e){var r,t=t;(t.qh&&0===e||!t.qh&&1===e)&&(r=[],t.Ch.forEach(function(t,e){e=e.view.Us(n);e.snapshot&&r.push(e.snapshot)}),function(t,i){t.onlineState=i;var o=!1;t.Ls.forEach(function(t,e){for(var n=0,r=e.listeners;n<r.length;n++)r[n].Us(i)&&(o=!0)}),o&&gw(t)}(t.ph,n),r.length&&t.Dh.gu(r),t.onlineState=n,t.qh&&t.bh.ji(n))}function WT(s,a,u){return bo(this,void 0,void 0,function(){var n,o;return _o(this,function(t){switch(t.label){case 0:n=s,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,(e=n.Wu,r=a,(i=e).persistence.runTransaction("Reject batch","readwrite-primary",function(e){var n;return i.vr.Mo(e,r).next(function(t){return $v(null!==t),n=t.keys(),i.vr.Qo(e,t)}).next(function(){return i.vr.Go(e)}).next(function(){return i.Dc.$r(e,n)})}))];case 2:return o=t.sent(),GT(n,a,u),HT(n,a),n.bh.xi(a,"rejected",u),[4,XT(n,o)];case 3:return t.sent(),[3,6];case 4:return[4,jI(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}var e,r,i})})}function HT(t,e){(t.Oh.get(e)||[]).forEach(function(t){t.resolve()}),t.Oh.delete(e)}function GT(t,e,n){var r=t,i=r.Mh[r.currentUser.Zs()];i&&((t=i.get(e))&&(n?t.reject(n):t.resolve(),i=i.remove(e)),r.Mh[r.currentUser.Zs()]=i)}function KT(e,t,n){void 0===n&&(n=null),e.bh.Li(t);for(var r=0,i=e.Nh.get(t);r<i.length;r++){var o=i[r];e.Ch.delete(o),n&&e.Dh.Qh(o,n)}e.Nh.delete(t),e.qh&&e.kh.qc(t).forEach(function(t){e.kh.zo(t)||zT(e,t)})}function zT(t,e){var n=t.$h.get(e);null!==n&&(yT(t.Vh,n),t.$h=t.$h.remove(e),t.xh.delete(n),YT(t))}function QT(t,e,n){for(var r=0,i=n;r<i.length;r++){var o=i[r];o instanceof PT?(t.kh.Sa(o.key,e),function(t,e){e=e.key;t.$h.get(e)||(Kv("SyncEngine","New document in limbo: "+e),t.Fh.push(e),YT(t))}(t,o)):o instanceof DT?(Kv("SyncEngine","Document no longer in limbo: "+o.key),t.kh.Ca(o.key,e),t.kh.zo(o.key)||zT(t,o.key)):Xv()}}function YT(t){for(;0<t.Fh.length&&t.$h.size<t.Sh;){var e=t.Fh.shift(),n=t.Lh.next();t.xh.set(n,new MT(e)),t.$h=t.$h.rt(e,n),vT(t.Vh,new cg(e_(Qb(e.path)),n,2,Ew.oi))}}function XT(e,s,a){return bo(this,void 0,void 0,function(){var n,r,i,o;return _o(this,function(t){switch(t.label){case 0:return r=[],i=[],o=[],(n=e).Ch.m()?[3,3]:(n.Ch.forEach(function(t,e){o.push(n.Uh(e,s,a).then(function(t){t&&(n.qh&&n.bh.Ui(e.targetId,t.fromCache?"not-current":"current"),r.push(t),t=Uw.Gr(e.targetId,t),i.push(t))}))}),[4,Promise.all(o)]);case 1:return t.sent(),n.Dh.gu(r),[4,function(u,c){return bo(this,void 0,void 0,function(){var r,e,n,i,o,s,a;return _o(this,function(t){switch(t.label){case 0:r=u,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,r.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(n){return W_.forEach(c,function(e){return W_.forEach(e.jr,function(t){return r.persistence.Co.Sa(n,e.targetId,t)}).next(function(){return W_.forEach(e.Kr,function(t){return r.persistence.Co.Ca(n,e.targetId,t)})})})})];case 2:return t.sent(),[3,4];case 3:if(!J_(e=t.sent()))throw e;return Kv("LocalStore","Failed to update sequence numbers: "+e),[3,4];case 4:for(n=0,i=c;n<i.length;n++)a=i[n],o=a.targetId,a.fromCache||(s=r.Vc.get(o),a=s.et,a=s.it(a),r.Vc=r.Vc.rt(o,a));return[2]}})})}(n.Wu,i)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}function $T(i,o){return bo(this,void 0,void 0,function(){var n,r;return _o(this,function(t){switch(t.label){case 0:return(n=i).currentUser.isEqual(o)?[3,3]:(Kv("SyncEngine","User change. New user:",o.Zs()),[4,function(i,o){return bo(this,void 0,void 0,function(){var e,n,m,r;return _o(this,function(t){switch(t.label){case 0:return n=(e=i).vr,m=e.Dc,[4,e.persistence.runTransaction("Handle user change","readonly",function(y){var g;return e.vr.qo(y).next(function(t){return g=t,n=e.persistence.wc(o),m=new Fw(e.Sc,n,e.persistence.Ec()),n.qo(y)}).next(function(t){for(var e=[],n=[],r=Ag(),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.$r(y,r).next(function(t){return{Wh:t,jh:e,Kh:n}})})})];case 1:return r=t.sent(),[2,(e.vr=n,e.Dc=m,e.yc.Cc(e.Dc),r)]}})})}(n.Wu,o)]);case 1:return r=t.sent(),n.currentUser=o,(e=n).Oh.forEach(function(t){t.forEach(function(t){t.reject(new Bv(qv.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.Oh.clear(),n.bh.Wi(o,r.jh,r.Kh),[4,XT(n,r.Wh)];case 2:t.sent(),t.label=3;case 3:return[2]}var e})})}function JT(a,u,c,h){return bo(this,void 0,void 0,function(){var o,s;return _o(this,function(t){switch(t.label){case 0:return[4,(e=(o=a).Wu,n=u,i=(r=e).vr,r.persistence.runTransaction("Lookup mutation documents","readonly",function(e){return i.Oo(e,n).next(function(t){return t?r.Dc.$r(e,t):W_.resolve(null)})}))];case 1:return null===(s=t.sent())?[3,6]:"pending"!==c?[3,3]:[4,CT(o.Vh)];case 2:return t.sent(),[3,4];case 3:"acknowledged"===c||"rejected"===c?(GT(o,u,h||null),HT(o,u),o.Wu.vr.jo(u)):Xv(),t.label=4;case 4:return[4,XT(o,s)];case 5:return t.sent(),[3,7];case 6:Kv("SyncEngine","Cannot apply mutation batch with id: "+u),t.label=7;case 7:return[2]}var e,n,r,i})})}function ZT(h,l){return bo(this,void 0,void 0,function(){var r,e,i,o,s,a,u,c;return _o(this,function(t){switch(t.label){case 0:return nS(r=h),rS(r),!0!==l||!0===r.Bh?[3,3]:(e=r.bh.Di(),[4,tS(r,e.A())]);case 1:return i=t.sent(),r.Bh=!0,[4,kT(r.Vh,!0)];case 2:for(t.sent(),o=0,s=i;o<s.length;o++)a=s[o],vT(r.Vh,a);return[3,7];case 3:return!1!==l||!1===r.Bh?[3,7]:(u=[],c=Promise.resolve(),r.Nh.forEach(function(t,e){r.bh.Bi(e)?u.push(e):c=c.then(function(){return KT(r,e),xI(r.Wu,e,!0)}),yT(r.Vh,e)}),[4,c]);case 4:return t.sent(),[4,tS(r,u)];case 5:return t.sent(),(n=r).xh.forEach(function(t,e){yT(n.Vh,e)}),n.kh.Uc(),n.xh=new Map,n.$h=new pg(sy.i),r.Bh=!1,[4,kT(r.Vh,!1)];case 6:t.sent(),t.label=7;case 7:return[2]}var n})})}function tS(p,d){return bo(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l,f;return _o(this,function(t){switch(t.label){case 0:e=p,n=[],r=[],i=0,o=d,t.label=1;case 1:return i<o.length?(s=o[i],a=void 0,(u=e.Nh.get(s))&&0!==u.length?[4,DI(e.Wu,e_(u[0]))]:[3,7]):[3,13];case 2:a=t.sent(),c=0,h=u,t.label=3;case 3:return c<h.length?(l=h[c],l=e.Ch.get(l),[4,function(r,i){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return[4,LI((e=r).Wu,i.query,!0)];case 1:return n=t.sent(),n=i.view.Ph(n),[2,(e.qh&&QT(e,i.targetId,n.Ah),n)]}})})}(e,l)]):[3,6];case 4:(l=t.sent()).snapshot&&r.push(l.snapshot),t.label=5;case 5:return c++,[3,3];case 6:return[3,11];case 7:return[4,MI(e.Wu,s)];case 8:return f=t.sent(),[4,DI(e.Wu,f)];case 9:return a=t.sent(),[4,VT(e,eS(f),s,!1)];case 10:t.sent(),t.label=11;case 11:n.push(a),t.label=12;case 12:return i++,[3,1];case 13:return[2,(e.Dh.gu(r),n)]}})})}function eS(t){return zb(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)}function nS(t){return t.Vh.Ku.nh=qT.bind(null,t),t.Vh.Ku.Be=function(t,e){var n=t;if((t=n.xh.get(e))&&t.yh)return Ag().add(t.key);var r=Ag();if(!(e=n.Nh.get(e)))return r;for(var i=0,o=e;i<o.length;i++)var s=o[i],s=n.Ch.get(s),r=r.xt(s.view.fh);return r}.bind(null,t),t.Vh.Ku.eh=function(o,s,a){return bo(this,void 0,void 0,function(){var e,n,r,i;return _o(this,function(t){switch(t.label){case 0:return(e=o).bh.Ui(s,"rejected",a),i=e.xh.get(s),(n=i&&i.key)?(r=(r=new pg(sy.i)).rt(n,new qb(n,zy.min())),i=Ag().add(n),i=new Dg(zy.min(),new Map,new _g(Py),r,i),[4,qT(e,i)]):[3,2];case 1:return t.sent(),e.$h=e.$h.remove(n),e.xh.delete(s),YT(e),[3,4];case 2:return[4,xI(e.Wu,s,!1).then(function(){return KT(e,s,a)}).catch(jI)];case 3:t.sent(),t.label=4;case 4:return[2]}})})}.bind(null,t),t.Dh.gu=function(t,e){for(var n=t,r=!1,i=0,o=e;i<o.length;i++){var s=o[i],a=s.query,a=n.Ls.get(a);if(a){for(var u=0,c=a.listeners;u<c.length;u++)c[u].Qs(s)&&(r=!0);a.Os=s}}r&&gw(n)}.bind(null,t.ph),t.Dh.Qh=function(t,e,n){var r=t;if(t=r.Ls.get(e))for(var i=0,o=t.listeners;i<o.length;i++)o[i].onError(n);r.Ls.delete(e)}.bind(null,t.ph),t}function rS(t){return t.Vh.Ku.sh=function(i,o){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:e=i,n=o.batch.batchId,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,OI(e.Wu,o)];case 2:return r=t.sent(),GT(e,n,null),HT(e,n),e.bh.xi(n,"acknowledged"),[4,XT(e,r)];case 3:return t.sent(),[3,6];case 4:return[4,jI(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}.bind(null,t),t.Vh.Ku.ih=WT.bind(null,t),t}var iS,oS,sS,aS=(PS.prototype.Cc=function(t){this.Gh=t},PS.prototype.Or=function(e,r,i,o){var s=this;return 0===r.filters.length&&null===r.limit&&null==r.startAt&&null==r.endAt&&(0===r.rn.length||1===r.rn.length&&r.rn[0].field.p())||i.isEqual(zy.min())?this.zh(e,r):this.Gh.$r(e,o).next(function(t){var n=s.Hh(r,t);return(Yb(r)||Xb(r))&&s.Th(r.on,n,o,i)?s.zh(e,r):(Gv()<=Ns.DEBUG&&Kv("IndexFreeQueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),a_(r)),s.Gh.Or(e,r,i).next(function(e){return n.forEach(function(t){e=e.rt(t.key,t)}),e}))})},PS.prototype.Hh=function(n,t){var r=new _g(c_(n));return t.forEach(function(t,e){e instanceof Vb&&u_(n,e)&&(r=r.add(e))}),r},PS.prototype.Th=function(t,e,n,r){if(n.size!==e.size)return!0;e="F"===t?e.last():e.first();return!!e&&(e.hasPendingWrites||0<e.version.L(r))},PS.prototype.zh=function(t,e){return Gv()<=Ns.DEBUG&&Kv("IndexFreeQueryEngine","Using full collection scan to execute query:",a_(e)),this.Gh.Or(t,e,zy.min())},PS),uS=(RS.prototype.$o=function(t){return W_.resolve(0===this.vr.length)},RS.prototype.xo=function(t,e,n,r){var i=this.Yh;this.Yh++,0<this.vr.length&&this.vr[this.vr.length-1];n=new xw(i,e,n,r);this.vr.push(n);for(var o=0,s=r;o<s.length;o++){var a=s[o];this.Jh=this.Jh.add(new KI(a.key,i)),this.Sr.ko(t,a.key.path.h())}return W_.resolve(n)},RS.prototype.Mo=function(t,e){return W_.resolve(this.Xh(e))},RS.prototype.Lo=function(t,e){e+=1,e=this.Zh(e),e=e<0?0:e;return W_.resolve(this.vr.length>e?this.vr[e]:null)},RS.prototype.Bo=function(){return W_.resolve(0===this.vr.length?-1:this.Yh-1)},RS.prototype.qo=function(t){return W_.resolve(this.vr.slice())},RS.prototype.Cr=function(t,e){var n=this,r=new KI(e,0),e=new KI(e,Number.POSITIVE_INFINITY),i=[];return this.Jh.Nt([r,e],function(t){t=n.Xh(t.Wc);i.push(t)}),W_.resolve(i)},RS.prototype.Mr=function(t,e){var n=this,r=new _g(Py);return e.forEach(function(t){var e=new KI(t,0),t=new KI(t,Number.POSITIVE_INFINITY);n.Jh.Nt([e,t],function(t){r=r.add(t.Wc)})}),W_.resolve(this.tl(r))},RS.prototype.Qr=function(t,e){var n=e.path,r=n.length+1,e=n;sy.F(e)||(e=e.child(""));var e=new KI(new sy(e),0),i=new _g(Py);return this.Jh.Ft(function(t){var e=t.key.path;return!!n.T(e)&&(e.length===r&&(i=i.add(t.Wc)),!0)},e),W_.resolve(this.tl(i))},RS.prototype.tl=function(t){var e=this,n=[];return t.forEach(function(t){t=e.Xh(t);null!==t&&n.push(t)}),n},RS.prototype.Qo=function(n,r){var i=this;$v(0===this.el(r.batchId,"removed")),this.vr.shift();var o=this.Jh;return W_.forEach(r.mutations,function(t){var e=new KI(t.key,r.batchId);return o=o.delete(e),i.Co.Ko(n,t.key)}).next(function(){i.Jh=o})},RS.prototype.jo=function(t){},RS.prototype.zo=function(t,e){var n=new KI(e,0),n=this.Jh.$t(n);return W_.resolve(e.isEqual(n&&n.key))},RS.prototype.Go=function(t){return this.vr.length,W_.resolve()},RS.prototype.el=function(t,e){return this.Zh(t)},RS.prototype.Zh=function(t){return 0===this.vr.length?0:t-this.vr[0].batchId},RS.prototype.Xh=function(t){t=this.Zh(t);return t<0||t>=this.vr.length?null:this.vr[t]},RS),cS=(OS.prototype.Tr=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,i=this.nl(e);return this.docs=this.docs.rt(r,{Zo:e,size:i,readTime:n}),this.size+=i-o,this.Sr.ko(t,r.path.h())},OS.prototype.Ir=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},OS.prototype.Ar=function(t,e){e=this.docs.get(e);return W_.resolve(e?e.Zo:null)},OS.prototype.getEntries=function(t,e){var n=this,r=Eg;return e.forEach(function(t){var e=n.docs.get(t);r=r.rt(t,e?e.Zo:null)}),W_.resolve(r)},OS.prototype.Or=function(t,e,n){for(var r=Sg,i=new sy(e.path.child("")),o=this.docs._t(i);o.It();){var s=o.Et(),a=s.key,u=s.value,s=u.Zo,u=u.readTime;if(!e.path.T(a.path))break;u.L(n)<=0||s instanceof Vb&&u_(e,s)&&(r=r.rt(s.key,s))}return W_.resolve(r)},OS.prototype.sl=function(t,e){return W_.forEach(this.docs,function(t){return e(t)})},OS.prototype.ia=function(t){return new hS(this)},OS.prototype.oa=function(t){return W_.resolve(this.size)},OS),hS=(go(kS,sS=M),kS.prototype.gr=function(n){var r=this,i=[];return this.dr.forEach(function(t,e){e?i.push(r.aa.Tr(n,e,r.readTime)):r.aa.Ir(t)}),W_.$n(i)},kS.prototype.Rr=function(t,e){return this.aa.Ar(t,e)},kS.prototype.Pr=function(t,e){return this.aa.getEntries(t,e)},kS),lS=(AS.prototype.De=function(t,n){return this.il.forEach(function(t,e){return n(e)}),W_.resolve()},AS.prototype.Ta=function(t){return W_.resolve(this.lastRemoteSnapshotVersion)},AS.prototype.Ea=function(t){return W_.resolve(this.rl)},AS.prototype.da=function(t){return this.highestTargetId=this.al.next(),W_.resolve(this.highestTargetId)},AS.prototype.Ia=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.rl&&(this.rl=e),W_.resolve()},AS.prototype.Ra=function(t){this.il.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.al=new cI(e),this.highestTargetId=e),t.sequenceNumber>this.rl&&(this.rl=t.sequenceNumber)},AS.prototype.Aa=function(t,e){return this.Ra(e),this.targetCount+=1,W_.resolve()},AS.prototype.ga=function(t,e){return this.Ra(e),W_.resolve()},AS.prototype.ya=function(t,e){return this.il.delete(e.target),this.ol.qc(e.targetId),--this.targetCount,W_.resolve()},AS.prototype.Vo=function(n,r,i){var o=this,s=0,a=[];return this.il.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.il.delete(t),a.push(o.Va(n,e.targetId)),s++)}),W_.$n(a).next(function(){return s})},AS.prototype.pa=function(t){return W_.resolve(this.targetCount)},AS.prototype.ba=function(t,e){e=this.il.get(e)||null;return W_.resolve(e)},AS.prototype.va=function(t,e,n){return this.ol.Oc(e,n),W_.resolve()},AS.prototype.Da=function(e,t,n){this.ol.Bc(t,n);var r=this.persistence.Co,i=[];return r&&t.forEach(function(t){i.push(r.Ko(e,t))}),W_.$n(i)},AS.prototype.Va=function(t,e){return this.ol.qc(e),W_.resolve()},AS.prototype.Na=function(t,e){e=this.ol.Qc(e);return W_.resolve(e)},AS.prototype.zo=function(t,e){return W_.resolve(this.ol.zo(e))},AS),fS=(NS.prototype.start=function(){return Promise.resolve()},NS.prototype.Si=function(){return this.Ma=!1,Promise.resolve()},Object.defineProperty(NS.prototype,"Ti",{get:function(){return this.Ma},enumerable:!1,configurable:!0}),NS.prototype.Xa=function(){},NS.prototype.Za=function(){},NS.prototype.Ec=function(){return this.Sr},NS.prototype.wc=function(t){var e=this.cl[t.Zs()];return e||(e=new uS(this.Sr,this.Co),this.cl[t.Zs()]=e),e},NS.prototype.mc=function(){return this.ja},NS.prototype.Tc=function(){return this.br},NS.prototype.runTransaction=function(t,e,n){var r=this;Kv("MemoryPersistence","Starting transaction:",t);var i=new pS(this.ka.next());return this.Co.hl(),n(i).next(function(t){return r.Co.ll(i).next(function(){return t})}).Nn().then(function(t){return i.pr(),t})},NS.prototype._l=function(e,n){return W_.xn(Object.values(this.cl).map(function(t){return function(){return t.zo(e,n)}}))},NS),pS=(go(CS,oS=K),CS),dS=(SS.wl=function(t){return new SS(t)},Object.defineProperty(SS.prototype,"ml",{get:function(){if(this.dl)return this.dl;throw Xv()},enumerable:!1,configurable:!0}),SS.prototype.Sa=function(t,e,n){return this.fl.Sa(n,e),this.ml.delete(n.toString()),W_.resolve()},SS.prototype.Ca=function(t,e,n){return this.fl.Ca(n,e),this.ml.add(n.toString()),W_.resolve()},SS.prototype.Ko=function(t,e){return this.ml.add(e.toString()),W_.resolve()},SS.prototype.removeTarget=function(t,e){var n=this;this.fl.qc(e.targetId).forEach(function(t){return n.ml.add(t.toString())});var r=this.persistence.mc();return r.Na(t,e.targetId).next(function(t){t.forEach(function(t){return n.ml.add(t.toString())})}).next(function(){return r.ya(t,e)})},SS.prototype.hl=function(){this.dl=new Set},SS.prototype.ll=function(n){var r=this,i=this.persistence.Tc().ia();return W_.forEach(this.ml,function(t){var e=sy.D(t);return r.Tl(n,e).next(function(t){t||i.Ir(e)})}).next(function(){return r.dl=null,i.apply(n)})},SS.prototype.gc=function(t,e){var n=this;return this.Tl(t,e).next(function(t){t?n.ml.delete(e.toString()):n.ml.add(e.toString())})},SS.prototype.ul=function(t){return 0},SS.prototype.Tl=function(t,e){var n=this;return W_.xn([function(){return W_.resolve(n.fl.zo(e))},function(){return n.persistence.mc().zo(t,e)},function(){return n.persistence._l(t,e)}])},SS),vS=(TS.prototype.Ru=function(t){this.Al=t},TS.prototype.mu=function(t){this.Rl=t},TS.prototype.onMessage=function(t){this.Pl=t},TS.prototype.close=function(){this.Il()},TS.prototype.send=function(t){this.El(t)},TS.prototype.gl=function(){this.Al()},TS.prototype.yl=function(t){this.Rl(t)},TS.prototype.Vl=function(t){this.Pl(t)},TS),yS={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"},gS=(IS.prototype.$u=function(e,t,n,r){var i=this.Sl(e,t);Kv("RestConnection","Sending: ",i,n);t={};return this.Dl(t,r),this.Cl(e,i,t,n).then(function(t){return Kv("RestConnection","Received: ",t),t},function(t){throw Qv("RestConnection",e+" failed with error: ",t,"url: ",i,"request:",n),t})},IS.prototype.xu=function(t,e,n,r){return this.$u(t,e,n,r)},IS.prototype.Dl=function(t,e){if(t["X-Goog-Api-Client"]="gl-js/ fire/7.23.0",t["Content-Type"]="text/plain",e)for(var n in e.jc)e.jc.hasOwnProperty(n)&&(t[n]=e.jc[n])},IS.prototype.Sl=function(t,e){t=yS[t];return this.bl+"/v1/"+e+":"+t},go(ES,iS=IS),ES.prototype.Cl=function(o,e,s,a){return new Promise(function(n,r){var i=new Vv;i.listenOnce(Uv.COMPLETE,function(){try{switch(i.getLastErrorCode()){case Fv.NO_ERROR:var t=i.getResponseJson();Kv("Connection","XHR received:",JSON.stringify(t)),n(t);break;case Fv.TIMEOUT:Kv("Connection",'RPC "'+o+'" timed out'),r(new Bv(qv.DEADLINE_EXCEEDED,"Request time out"));break;case Fv.HTTP_ERROR:var e=i.getStatus();Kv("Connection",'RPC "'+o+'" failed with status:',e,"response text:",i.getResponseText()),0<e?(t=i.getResponseJson().error)&&t.status&&t.message?(e=t.status.toLowerCase().replace("_","-"),e=0<=Object.values(qv).indexOf(e)?e:qv.UNKNOWN,r(new Bv(e,t.message))):r(new Bv(qv.UNKNOWN,"Server responded with status "+i.getStatus())):r(new Bv(qv.UNAVAILABLE,"Connection failed."));break;default:Xv()}}finally{Kv("Connection",'RPC "'+o+'" completed.')}});var t=JSON.stringify(a);i.send(e,"POST",t,s,15)})},ES.prototype.Pu=function(t,e){var n=[this.bl,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=Mv(),t={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.U.projectId+"/databases/"+this.U.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling};this.Dl(t.initMessageHeaders,e),Mo()||Uo()||0<=Lo().indexOf("Electron/")||(0<=(e=Lo()).indexOf("MSIE ")||0<=e.indexOf("Trident/"))||0<=Lo().indexOf("MSAppHost/")||Fo()||(t.httpHeadersOverwriteParam="$httpHeaders");n=n.join("");Kv("Connection","Creating WebChannel: "+n,t);var o=r.createWebChannel(n,t),i=!1,s=!1,a=new vS({El:function(t){s?Kv("Connection","Not sending because WebChannel is closed:",t):(i||(Kv("Connection","Opening WebChannel transport."),o.open(),i=!0),Kv("Connection","WebChannel sending:",t),o.send(t))},Il:function(){return o.close()}}),t=function(t,e){o.listen(t,function(t){try{e(t)}catch(t){setTimeout(function(){throw t},0)}})};return t(jv.EventType.OPEN,function(){s||Kv("Connection","WebChannel transport opened.")}),t(jv.EventType.CLOSE,function(){s||(s=!0,Kv("Connection","WebChannel transport closed"),a.yl())}),t(jv.EventType.ERROR,function(t){s||(s=!0,Qv("Connection","WebChannel transport errored:",t),a.yl(new Bv(qv.UNAVAILABLE,"The operation could not be completed")))}),t(jv.EventType.MESSAGE,function(t){var e,n,r,i;s||($v(!!(e=t.data[0])),(n=e.error||(null===(i=e[0])||void 0===i?void 0:i.error))?(Kv("Connection","WebChannel received error:",n),r=n.status,t=function(){var t=ug[r];if(void 0!==t)return fg(t)}(),i=n.message,void 0===t&&(t=qv.INTERNAL,i="Unknown error status: "+r+" with message "+n.message),s=!0,a.yl(new Bv(t,i)),o.close()):(Kv("Connection","WebChannel received:",e),a.Vl(e)))}),setTimeout(function(){a.gl()},0),a},ES),mS=(wS.prototype.Xu=function(t){this.kl.push(t)},wS.prototype.Si=function(){window.removeEventListener("online",this.Nl),window.removeEventListener("offline",this.$l)},wS.prototype.Ml=function(){window.addEventListener("online",this.Nl),window.addEventListener("offline",this.$l)},wS.prototype.Fl=function(){Kv("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.kl;t<e.length;t++)(0,e[t])(0)},wS.prototype.xl=function(){Kv("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.kl;t<e.length;t++)(0,e[t])(1)},wS.On=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},wS),bS=(_S.prototype.Xu=function(t){},_S.prototype.Si=function(){},_S);function _S(){}function wS(){var t=this;this.Nl=function(){return t.Fl()},this.$l=function(){return t.xl()},this.kl=[],this.Ml()}function ES(t){var e=this;return(e=iS.call(this,t)||this).forceLongPolling=t.forceLongPolling,e}function IS(t){this.pl=t,this.U=t.U;var e=t.ssl?"https":"http";this.bl=e+"://"+t.host,this.vl="projects/"+this.U.projectId+"/databases/"+this.U.database+"/documents"}function TS(t){this.El=t.El,this.Il=t.Il}function SS(t){this.persistence=t,this.fl=new GI,this.dl=null}function CS(t){var e=this;return(e=oS.call(this)||this).Fa=t,e}function NS(t){var e=this;this.cl={},this.ka=new Ew(0),this.Ma=!1,this.Ma=!0,this.Co=t(this),this.ja=new lS(this),this.Sr=new FE,this.br=(t=this.Sr,new cS(t,function(t){return e.Co.ul(t)}))}function AS(t){this.persistence=t,this.il=new Gy(ig,og),this.lastRemoteSnapshotVersion=zy.min(),this.highestTargetId=0,this.rl=0,this.ol=new GI,this.targetCount=0,this.al=cI._a()}function kS(t){var e=this;return(e=sS.call(this)||this).aa=t,e}function OS(t,e){this.Sr=t,this.nl=e,this.docs=new pg(sy.i),this.size=0}function RS(t,e){this.Sr=t,this.Co=e,this.vr=[],this.Yh=1,this.Jh=new _g(KI.xc)}function PS(){}function DS(t){return new vm(t,!0)}var xS,LS,MS,FS,US="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.",jS=(tC.prototype.initialize=function(e){return bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return this.bh=this.Ol(e),this.persistence=this.Ll(e),[4,this.persistence.start()];case 1:return t.sent(),this.Bl=this.ql(e),this.Wu=this.Ul(e),[2]}})})},tC.prototype.ql=function(t){return null},tC.prototype.Ul=function(t){return e=this.persistence,n=new aS,t=t.Ql,new AI(e,n,t);var e,n},tC.prototype.Ll=function(t){if(t.persistenceSettings.Wl)throw new Bv(qv.FAILED_PRECONDITION,US);return new fS(dS.wl)},tC.prototype.Ol=function(t){return new Dw},tC.prototype.terminate=function(){return bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return this.Bl&&this.Bl.stop(),[4,this.bh.Si()];case 1:return t.sent(),[4,this.persistence.Si()];case 2:return t.sent(),[2]}})})},tC.prototype.clearPersistence=function(t,e){throw new Bv(qv.FAILED_PRECONDITION,US)},tC),VS=(go(ZS,FS=jS),ZS.prototype.initialize=function(e){return bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return[4,FS.prototype.initialize.call(this,e)];case 1:return t.sent(),[4,UI(this.Wu)];case 2:return t.sent(),[4,this.jl.initialize(this,e)];case 3:return t.sent(),[4,rS(this.jl._i)];case 4:return t.sent(),[4,CT(this.jl.Vh)];case 5:return t.sent(),[2]}})})},ZS.prototype.ql=function(t){var e=this.persistence.Co.do;return new iE(e,t.os)},ZS.prototype.Ll=function(t){var e=NI(t.pl.U,t.pl.persistenceKey),n=DS(t.pl.U);return new bI(t.persistenceSettings.synchronizeTabs,e,t.clientId,eE.oo(t.persistenceSettings.cacheSizeBytes),t.os,sw(),aw(),n,this.bh,t.persistenceSettings.xa)},ZS.prototype.Ol=function(t){return new Dw},ZS.prototype.clearPersistence=function(t,e){return function(n){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return H_.On()?(e=n+"main",[4,H_.delete(e)]):[2,Promise.resolve()];case 1:return t.sent(),[2]}})})}(NI(t,e))},go(JS,MS=ZS),JS.prototype.initialize=function(r){return bo(this,void 0,void 0,function(){var e,n=this;return _o(this,function(t){switch(t.label){case 0:return[4,MS.prototype.initialize.call(this,r)];case 1:return t.sent(),e=this.jl._i,this.bh instanceof Pw?(this.bh._i={tr:JT.bind(null,e),er:function(i,o,s,a){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return(e=i).Bh?(Kv("SyncEngine","Ignoring unexpected query state notification."),[3,8]):[3,1];case 1:if(!e.Nh.has(o))return[3,8];switch(s){case"current":case"not-current":return[3,2];case"rejected":return[3,5]}return[3,7];case 2:return[4,FI(e.Wu)];case 3:return n=t.sent(),r=Dg.Jt(o,"current"===s),[4,XT(e,n,r)];case 4:return t.sent(),[3,8];case 5:return[4,xI(e.Wu,o,!0)];case 6:return t.sent(),KT(e,o,a),[3,8];case 7:Xv(),t.label=8;case 8:return[2]}})})}.bind(null,e),nr:function(c,h,l){return bo(this,void 0,void 0,function(){var n,e,r,i,o,s,a,u;return _o(this,function(t){switch(t.label){case 0:if(!(n=nS(c)).Bh)return[3,10];e=0,r=h,t.label=1;case 1:return e<r.length?(r=r[e],n.Nh.has(r)?(Kv("SyncEngine","Adding an already active target "+r),[3,5]):[4,MI(n.Wu,r)]):[3,6];case 2:return i=t.sent(),[4,DI(n.Wu,i)];case 3:return o=t.sent(),[4,VT(n,eS(i),o.targetId,!1)];case 4:t.sent(),vT(n.Vh,o),t.label=5;case 5:return e++,[3,1];case 6:s=function(e){return _o(this,function(t){switch(t.label){case 0:return n.Nh.has(e)?[4,xI(n.Wu,e,!1).then(function(){yT(n.Vh,e),KT(n,e)}).catch(jI)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})},a=0,u=l,t.label=7;case 7:return a<u.length?(u=u[a],[5,s(u)]):[3,10];case 8:t.sent(),t.label=9;case 9:return a++,[3,7];case 10:return[2]}})})}.bind(null,e),Vi:function(t){return t.Wu.persistence.Vi()}.bind(null,e)},[4,this.bh.start()]):[3,3];case 2:t.sent(),t.label=3;case 3:return[4,this.persistence.Ja(function(e){return bo(n,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return[4,ZT(this.jl._i,e)];case 1:return t.sent(),this.Bl&&(e&&!this.Bl.Ti?this.Bl.start(this.Wu):e||this.Bl.stop()),[2]}})})})];case 4:return t.sent(),[2]}})})},JS.prototype.Ol=function(t){if(t.persistenceSettings.Wl&&t.persistenceSettings.synchronizeTabs){var e=sw();if(!Pw.On(e))throw new Bv(qv.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var n=NI(t.pl.U,t.pl.persistenceKey);return new Pw(e,t.os,n,t.clientId,t.Ql)}return new Dw},JS),qS=($S.prototype.initialize=function(n,r){return bo(this,void 0,void 0,function(){var e=this;return _o(this,function(t){switch(t.label){case 0:return this.Wu?[3,2]:(this.Wu=n.Wu,this.bh=n.bh,this.ju=this.Kl(r),this.Vh=this.Gl(r),this.ph=this.zl(r),this._i=this.Hl(r),this.bh.fi=function(t){return BT(e._i,t,1)},this.Vh.Ku.Yl=$T.bind(null,this._i),[4,kT(this.Vh,this._i.qh)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},$S.prototype.zl=function(t){return new dw},$S.prototype.Kl=function(t){var e=DS(t.pl.U),n=(n=t.pl,new gS(n));return t=t.credentials,new ZI(t,n,e)},$S.prototype.Gl=function(t){var e=this,n=this.Wu,r=this.ju,i=t.os,o=function(t){return BT(e._i,t,0)},t=new(mS.On()?mS:bS);return new qI(n,r,i,o,t)},$S.prototype.Hl=function(t){return function(t,e,n,r,i,o,s){o=new FT(t,e,n,r,i,o);return s&&(o.Bh=!0),o}(this.Wu,this.Vh,this.ph,this.bh,t.Ql,t.Sh,!t.persistenceSettings.Wl||!t.persistenceSettings.synchronizeTabs)},$S.prototype.terminate=function(){return dT(this.Vh)},$S),BS=(XS.prototype.next=function(t){this.observer.next&&this.Jl(this.observer.next,t)},XS.prototype.error=function(t){this.observer.error?this.Jl(this.observer.error,t):console.error("Uncaught Error in snapshot listener:",t)},XS.prototype.Xl=function(){this.muted=!0},XS.prototype.Jl=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},XS),WS=function(t){!function(){if(!(t instanceof Array)||t.length<1)throw new Bv(qv.INVALID_ARGUMENT,"Function FieldPath() requires its fieldNames argument to be an array with at least 1 element.")}();for(var e=0;e<t.length;++e)if(vy("FieldPath","string",e,t[e]),0===t[e].length)throw new Bv(qv.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this.Zl=new oy(t)},HS=(go(YS,LS=WS),YS.documentId=function(){return new YS(oy.v().R())},YS.prototype.isEqual=function(t){if(!(t instanceof YS))throw Cy("isEqual","FieldPath",1,t);return this.Zl.isEqual(t.Zl)},YS),GS=new RegExp("[~\\*/\\[\\]]"),KS=function(t){this.t_=t},zS=(go(QS,xS=KS),QS.prototype.e_=function(t){if(2!==t.n_)throw 1===t.n_?t.s_(this.t_+"() can only appear at the top level of your update data"):t.s_(this.t_+"() cannot be used with set() unless you pass {merge:true}");return t.Qe.push(t.path),null},QS.prototype.isEqual=function(t){return t instanceof QS},QS);function QS(){return null!==xS&&xS.apply(this,arguments)||this}function YS(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return LS.call(this,t)||this}function XS(t){this.observer=t,this.muted=!1}function $S(){}function JS(){return null!==MS&&MS.apply(this,arguments)||this}function ZS(t){var e=this;return(e=FS.call(this)||this).jl=t,e}function tC(){}function eC(t,e,n){return new TC({n_:3,i_:e.settings.i_,methodName:t.t_,r_:n},e.U,e.serializer,e.ignoreUndefinedProperties)}var nC,rC,iC,oC,sC=(go(EC,oC=KS),EC.prototype.e_=function(t){return new sb(t.path,new Gm)},EC.prototype.isEqual=function(t){return t instanceof EC},EC),aC=(go(wC,iC=KS),wC.prototype.e_=function(t){var e=eC(this,t,!0),n=this.o_.map(function(t){return PC(t,e)}),n=new Km(n);return new sb(t.path,n)},wC.prototype.isEqual=function(t){return this===t},wC),uC=(go(_C,rC=KS),_C.prototype.e_=function(t){var e=eC(this,t,!0),n=this.o_.map(function(t){return PC(t,e)}),n=new $m(n);return new sb(t.path,n)},_C.prototype.isEqual=function(t){return this===t},_C),cC=(go(bC,nC=KS),bC.prototype.e_=function(t){var e=new eb(t.serializer,mm(t.serializer,this.a_));return new sb(t.path,e)},bC.prototype.isEqual=function(t){return this===t},bC),hC=(Object.defineProperty(mC.prototype,"latitude",{get:function(){return this.c_},enumerable:!1,configurable:!0}),Object.defineProperty(mC.prototype,"longitude",{get:function(){return this.u_},enumerable:!1,configurable:!0}),mC.prototype.isEqual=function(t){return this.c_===t.c_&&this.u_===t.u_},mC.prototype.toJSON=function(){return{latitude:this.c_,longitude:this.u_}},mC.prototype.H=function(t){return Py(this.c_,t.c_)||Py(this.u_,t.u_)},mC),lC=function(t){this.h_=t},fC=/^__.*__$/,pC=function(t,e,n){this.l_=t,this.__=e,this.f_=n},dC=(gC.prototype.d_=function(t,e){var n=[];return null!==this.Qe?n.push(new bb(t,this.data,this.Qe,e)):n.push(new mb(t,this.data,e)),0<this.fieldTransforms.length&&n.push(new Tb(t,this.fieldTransforms)),n},gC),vC=(yC.prototype.d_=function(t,e){e=[new bb(t,this.data,this.Qe,e)];return 0<this.fieldTransforms.length&&e.push(new Tb(t,this.fieldTransforms)),e},yC);function yC(t,e,n){this.data=t,this.Qe=e,this.fieldTransforms=n}function gC(t,e,n){this.data=t,this.Qe=e,this.fieldTransforms=n}function mC(t,e){if(fy("GeoPoint",arguments,2),vy("GeoPoint","number",1,t),vy("GeoPoint","number",2,e),!isFinite(t)||t<-90||90<t)throw new Bv(qv.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||180<e)throw new Bv(qv.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this.c_=t,this.u_=e}function bC(t,e){var n=this;return(n=nC.call(this,t)||this).a_=e,n}function _C(t,e){var n=this;return(n=rC.call(this,t)||this).o_=e,n}function wC(t,e){var n=this;return(n=iC.call(this,t)||this).o_=e,n}function EC(){return null!==oC&&oC.apply(this,arguments)||this}function IC(t){switch(t){case 0:case 2:case 1:return 1;case 3:case 4:return;default:throw Xv()}}var TC=(Object.defineProperty(NC.prototype,"path",{get:function(){return this.settings.path},enumerable:!1,configurable:!0}),Object.defineProperty(NC.prototype,"n_",{get:function(){return this.settings.n_},enumerable:!1,configurable:!0}),NC.prototype.m_=function(t){return new NC(Object.assign(Object.assign({},this.settings),t),this.U,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.Qe)},NC.prototype.T_=function(t){var e=null===(e=this.path)||void 0===e?void 0:e.child(t),e=this.m_({path:e,r_:!1});return e.E_(t),e},NC.prototype.I_=function(t){var e,t=null===(e=this.path)||void 0===e?void 0:e.child(t),t=this.m_({path:t,r_:!1});return t.w_(),t},NC.prototype.A_=function(t){return this.m_({path:void 0,r_:!0})},NC.prototype.s_=function(t){return UC(t,this.settings.methodName,this.settings.R_||!1,this.path,this.settings.i_)},NC.prototype.contains=function(e){return void 0!==this.Qe.find(function(t){return e.T(t)})||void 0!==this.fieldTransforms.find(function(t){return e.T(t.field)})},NC.prototype.w_=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.E_(this.path.get(t))},NC.prototype.E_=function(t){if(0===t.length)throw this.s_("Document fields must not be empty");if(IC(this.n_)&&fC.test(t))throw this.s_('Document fields cannot begin and end with "__"')},NC),SC=(CC.prototype.P_=function(t,e,n,r){return void 0===r&&(r=!1),new TC({n_:t,methodName:e,i_:n,path:oy.g(),r_:!1,R_:r},this.U,this.serializer,this.ignoreUndefinedProperties)},CC);function CC(t,e,n){this.U=t,this.ignoreUndefinedProperties=e,this.serializer=n||DS(t)}function NC(t,e,n,r,i,o){this.settings=t,this.U=e,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this.w_(),this.fieldTransforms=i||[],this.Qe=o||[]}function AC(t,e,n,r,i,o){void 0===o&&(o={});var s=t.P_(o.merge||o.mergeFields?2:0,e,n,i);LC("Data must be an object, but it was:",s,r);var a,u,r=DC(r,s);if(o.merge)a=new ob(s.Qe),u=s.fieldTransforms;else if(o.mergeFields){for(var c=[],h=0,l=o.mergeFields;h<l.length;h++){var f=l[h],p=void 0;if(f instanceof WS)p=f.Zl;else{if("string"!=typeof f)throw Xv();p=FC(e,f,n)}if(!s.contains(p))throw new Bv(qv.INVALID_ARGUMENT,"Field '"+p+"' is specified in your field mask but missing from your input data.");jC(c,p)||c.push(p)}a=new ob(c),u=s.fieldTransforms.filter(function(t){return a.He(t.field)})}else a=null,u=s.fieldTransforms;return new dC(new Rb(r),a,u)}function kC(t,r,i,e){var o=t.P_(1,r,i);LC("Data must be an object, but it was:",o,e);var s=[],a=new Pb;Zv(e,function(t,e){var n=FC(r,t,i),t=o.I_(n);e instanceof zS||e instanceof lC&&e.h_ instanceof zS?s.push(n):null!=(t=PC(e,t))&&(s.push(n),a.set(n,t))});e=new ob(s);return new vC(a.Je(),e,o.fieldTransforms)}function OC(t,e,n,r,i,o){var s=t.P_(1,e,n),a=[MC(e,r,n)],u=[i];if(o.length%2!=0)throw new Bv(qv.INVALID_ARGUMENT,"Function "+e+"() needs to be called with an even number of arguments that alternate between field names and values.");for(var c=0;c<o.length;c+=2)a.push(MC(e,o[c])),u.push(o[c+1]);for(var h,l,f,p=[],d=new Pb,v=a.length-1;0<=v;--v){jC(p,a[v])||(h=a[v],l=u[v],f=s.I_(h),l instanceof zS||l instanceof lC&&l.h_ instanceof zS?p.push(h):null!=(f=PC(l,f))&&(p.push(h),d.set(h,f)))}i=new ob(p);return new vC(d.Je(),i,s.fieldTransforms)}function RC(t,e,n,r){return void 0===r&&(r=!1),PC(n,t.P_(r?4:3,e))}function PC(s,t){if(s instanceof lC&&(s=s.h_),xC(s))return LC("Unsupported field value:",t,s),DC(s,t);if(s instanceof KS)return function(t,e){if(!IC(e.n_))throw e.s_(t.t_+"() can only be used with update() and set()");if(!e.path)throw e.s_(t.t_+"() is not currently supported inside arrays");t=t.e_(e);t&&e.fieldTransforms.push(t)}(s,t),null;if(t.path&&t.Qe.push(t.path),s instanceof Array){if(t.settings.r_&&4!==t.n_)throw t.s_("Nested arrays are not supported");return function(t){for(var e=[],n=0,r=0,i=s;r<i.length;r++){var o=PC(i[r],t.A_(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 mm(e.serializer,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){var n=Ky.fromDate(t);return{timestampValue:bm(e.serializer,n)}}if(t instanceof Ky){var r=new Ky(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:bm(e.serializer,r)}}if(t instanceof hC)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Fy)return{bytesValue:_m(e.serializer,t.q)};if(t instanceof pC){n=e.U,r=t.l_;if(!r.isEqual(n))throw e.s_("Document reference is for database "+r.projectId+"/"+r.database+" but should be for database "+n.projectId+"/"+n.database);return{referenceValue:Em(t.l_||e.U,t.__.path)}}if(void 0===t&&e.ignoreUndefinedProperties)return null;throw e.s_("Unsupported field value: "+Iy(t))}(s,t)}function DC(t,n){var r={};return ty(t)?n.path&&0<n.path.length&&n.Qe.push(n.path):Zv(t,function(t,e){e=PC(e,n.T_(t));null!=e&&(r[t]=e)}),{mapValue:{fields:r}}}function xC(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Ky||t instanceof hC||t instanceof Fy||t instanceof pC||t instanceof KS)}function LC(t,e,n){if(!xC(n)||!Ey(n)){n=Iy(n);throw"an object"===n?e.s_(t+" a custom object"):e.s_(t+" "+n)}}function MC(t,e,n){if(e instanceof WS)return e.Zl;if("string"==typeof e)return FC(t,e);throw UC("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}function FC(t,e,n){try{return function(e){if(0<=e.search(GS))throw new Bv(qv.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(HS.bind.apply(HS,To([void 0],e.split("."))))}catch(t){throw new Bv(qv.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(e).Zl}catch(e){throw UC(e instanceof Error?e.message:e.toString(),t,!1,void 0,n)}}function UC(t,e,n,r,i){var o=r&&!r.m(),s=void 0!==i,e="Function "+e+"() called with invalid data";n&&(e+=" (via `toFirestore()`)");n="";return(o||s)&&(n+=" (found",o&&(n+=" in field "+r),s&&(n+=" in document "+i),n+=")"),new Bv(qv.INVALID_ARGUMENT,(e+=". ")+t+n)}function jC(t,e){return t.some(function(t){return t.isEqual(e)})}var VC=(GC.prototype.b_=function(r){return bo(this,void 0,void 0,function(){var e,n=this;return _o(this,function(t){switch(t.label){case 0:if(this.v_(),0<this.mutations.length)throw new Bv(qv.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(s,a){return bo(this,void 0,void 0,function(){var n,e,r,i,o;return _o(this,function(t){switch(t.label){case 0:return e=Am((n=s).serializer)+"/documents",r={documents:a.map(function(t){return Tm(n.serializer,t)})},[4,n.xu("BatchGetDocuments",e,r)];case 1:return r=t.sent(),i=new Map,r.forEach(function(t){var e,t=(e=n.serializer,"found"in(t=t)?function(t,e){$v(!!e.found),e.found.name,e.found.updateTime;var n=Sm(t,e.found.name),t=wm(e.found.updateTime),e=new Rb({mapValue:{fields:e.found.fields}});return new Vb(n,t,e,{})}(e,t):"missing"in t?function(t,e){$v(!!e.missing),$v(!!e.readTime);t=Sm(t,e.missing),e=wm(e.readTime);return new qb(t,e)}(e,t):Xv());i.set(t.key.toString(),t)}),o=[],[2,(a.forEach(function(t){t=i.get(t.toString());$v(!!t),o.push(t)}),o)]}})})}(this.ju,r)];case 1:return[2,((e=t.sent()).forEach(function(t){t instanceof qb||t instanceof Vb?n.S_(t):Xv()}),e)]}})})},GC.prototype.set=function(t,e){this.write(e.d_(t,this.Ke(t))),this.p_.add(t.toString())},GC.prototype.update=function(t,e){try{this.write(e.d_(t,this.D_(t)))}catch(t){this.V_=t}this.p_.add(t.toString())},GC.prototype.delete=function(t){this.write([new kb(t,this.Ke(t))]),this.p_.add(t.toString())},GC.prototype.commit=function(){return bo(this,void 0,void 0,function(){var e,n=this;return _o(this,function(t){switch(t.label){case 0:if(this.v_(),this.V_)throw this.V_;return e=this.g_,this.mutations.forEach(function(t){e.delete(t.key.toString())}),e.forEach(function(t,e){e=sy.D(e);n.mutations.push(new Ob(e,n.Ke(e)))}),[4,function(i,o){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return n=Am((e=i).serializer)+"/documents",r={writes:o.map(function(t){return Rm(e.serializer,t)})},[4,e.$u("Commit",n,r)];case 1:return t.sent(),[2]}})})}(this.ju,this.mutations)];case 1:return t.sent(),this.y_=!0,[2]}})})},GC.prototype.S_=function(t){var e;if(t instanceof Vb)e=t.version;else{if(!(t instanceof qb))throw Xv();e=zy.min()}var n=this.g_.get(t.key.toString());if(n){if(!e.isEqual(n))throw new Bv(qv.ABORTED,"Document version changed between two reads.")}else this.g_.set(t.key.toString(),e)},GC.prototype.Ke=function(t){var e=this.g_.get(t.toString());return!this.p_.has(t.toString())&&e?cb.updateTime(e):cb.Ge()},GC.prototype.D_=function(t){var e=this.g_.get(t.toString());if(this.p_.has(t.toString())||!e)return cb.exists(!0);if(e.isEqual(zy.min()))throw new Bv(qv.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return cb.updateTime(e)},GC.prototype.write=function(t){this.v_(),this.mutations=this.mutations.concat(t)},GC.prototype.v_=function(){},GC),qC=(HC.prototype.run=function(){this.N_()},HC.prototype.N_=function(){var t=this;this.gs.Rn(function(){return bo(t,void 0,void 0,function(){var e,n,r=this;return _o(this,function(t){return e=new VC(this.ju),(n=this.F_(e))&&n.then(function(t){r.os.ds(function(){return e.commit().then(function(){r.hs.resolve(t)}).catch(function(t){r.x_(t)})})}).catch(function(t){r.x_(t)}),[2]})})})},HC.prototype.F_=function(t){try{var e=this.updateFunction(t);return!Zy(e)&&e.catch&&e.then?e:(this.hs.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.hs.reject(t),null}},HC.prototype.x_=function(t){var e=this;0<this.C_&&this.k_(t)?(--this.C_,this.os.ds(function(){return e.N_(),Promise.resolve()})):this.hs.reject(t)},HC.prototype.k_=function(t){if("FirebaseError"!==t.name)return!1;t=t.code;return"aborted"===t||"failed-precondition"===t||!lg(t)},HC),BC=(WC.prototype.start=function(t,e,n,r){var i=this;this.O_(),this.pl=t;var o=new V_,s=!1;return this.credentials.zc(function(t){return s?void i.os.Ds(function(){return function(r,i){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return(e=r).os.Fs(),Kv("RemoteStore","RemoteStore received new credentials"),n=wT(e),e.Hu.add(3),[4,pT(e)];case 1:return t.sent(),n&&e.Zu.set("Unknown"),[4,e.Ku.Yl(i)];case 2:return t.sent(),e.Hu.delete(3),[4,fT(e)];case 3:return t.sent(),[2]}})})}(i.Vh,t)}):(s=!0,Kv("FirestoreClient","Initializing. user=",t.uid),i.L_(e,n,r,t,o).then(i.M_.resolve,i.M_.reject))}),this.os.ds(function(){return i.M_.promise}),o.promise},WC.prototype.enableNetwork=function(){var e=this;return this.O_(),this.os.enqueue(function(){return e.persistence.Za(!0),(t=e.Vh).Hu.delete(0),fT(t);var t})},WC.prototype.L_=function(r,i,o,s,a){return bo(this,void 0,void 0,function(){var e,n=this;return _o(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),e={os:this.os,pl:this.pl,clientId:this.clientId,credentials:this.credentials,Ql:s,Sh:100,persistenceSettings:o},[4,r.initialize(e)];case 1:return t.sent(),[4,i.initialize(r,e)];case 2:return t.sent(),this.persistence=r.persistence,this.bh=r.bh,this.Wu=r.Wu,this.Bl=r.Bl,this.ju=i.ju,this.Vh=i.Vh,this._i=i._i,this.B_=i.ph,this.B_.qs=function(s,a){return bo(this,void 0,void 0,function(){var e,n,r,i,o;return _o(this,function(t){switch(t.label){case 0:return e=nS(s),(o=e.Ch.get(a))?(n=o.targetId,e.bh.Mi(n),r=o.view.gh(),[3,4]):[3,1];case 1:return[4,DI(e.Wu,e_(a))];case 2:return i=t.sent(),o=e.bh.Mi(i.targetId),n=i.targetId,[4,VT(e,a,n,"current"===o)];case 3:r=t.sent(),e.qh&&vT(e.Vh,i),t.label=4;case 4:return[2,r]}})})}.bind(null,this._i),this.B_.Ws=function(i,o){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return n=(e=i).Ch.get(o),1<(r=e.Nh.get(n.targetId)).length?[2,(e.Nh.set(n.targetId,r.filter(function(t){return!o_(t,o)})),void e.Ch.delete(o))]:e.qh?(e.bh.Li(n.targetId),e.bh.Ni(n.targetId)?[3,2]:[4,xI(e.Wu,n.targetId,!1).then(function(){e.bh.qi(n.targetId),yT(e.Vh,n.targetId),KT(e,n.targetId)}).catch(jI)]):[3,3];case 1:t.sent(),t.label=2;case 2:return[3,5];case 3:return KT(e,n.targetId),[4,xI(e.Wu,n.targetId,!0)];case 4:t.sent(),t.label=5;case 5:return[2]}})})}.bind(null,this._i),this.persistence.Xa(function(){return bo(n,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return[4,this.terminate()];case 1:return t.sent(),[2]}})})}),a.resolve(),[3,4];case 3:if(e=t.sent(),a.reject(e),!this.q_(e))throw e;return[2,(console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+e),this.L_(new jS,new qS,{Wl:!1},s,a))];case 4:return[2]}})})},WC.prototype.q_=function(t){return"FirebaseError"===t.name?t.code===qv.FAILED_PRECONDITION||t.code===qv.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code},WC.prototype.O_=function(){if(this.os.Vs)throw new Bv(qv.FAILED_PRECONDITION,"The client has already been terminated.")},WC.prototype.disableNetwork=function(){var t=this;return this.O_(),this.os.enqueue(function(){return t.persistence.Za(!1),function(n){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return(e=n).Hu.add(0),[4,pT(e)];case 1:return t.sent(),e.Zu.set("Offline"),[2]}})})}(t.Vh)})},WC.prototype.terminate=function(){var t=this;this.os.Ss();var n=new V_;return this.os.ps(function(){return bo(t,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),this.Bl&&this.Bl.stop(),[4,dT(this.Vh)];case 1:return t.sent(),[4,this.bh.Si()];case 2:return t.sent(),[4,this.persistence.Si()];case 3:return t.sent(),this.credentials.Hc(),n.resolve(),[3,5];case 4:return e=t.sent(),e=fw(e,"Failed to shutdown persistence"),n.reject(e),[3,5];case 5:return[2]}})})}),n.promise},WC.prototype.waitForPendingWrites=function(){var t=this;this.O_();var e=new V_;return this.os.ds(function(){return function(o,s){return bo(this,void 0,void 0,function(){var n,r,i;return _o(this,function(t){switch(t.label){case 0:wT((n=o).Vh)||Kv("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,(e=n.Wu).persistence.runTransaction("Get highest unacknowledged batch id","readonly",function(t){return e.vr.Bo(t)})];case 2:return-1===(r=t.sent())?[2,void s.resolve()]:((i=n.Oh.get(r)||[]).push(s),n.Oh.set(r,i),[3,4]);case 3:return i=t.sent(),i=fw(i,"Initialization of waitForPendingWrites() operation failed"),s.reject(i),[3,4];case 4:return[2]}var e})})}(t._i,e)}),e.promise},WC.prototype.listen=function(t,e,n){var r=this;this.O_();var i=new BS(n),o=new mw(t,i,e);return this.os.ds(function(){return vw(r.B_,o)}),function(){i.Xl(),r.os.ds(function(){return yw(r.B_,o)})}},WC.prototype.U_=function(r){return bo(this,void 0,void 0,function(){var e,n=this;return _o(this,function(t){switch(t.label){case 0:return this.O_(),[4,this.M_.promise];case 1:return t.sent(),e=new V_,[2,(this.os.ds(function(){return function(i,o,s){return bo(this,void 0,void 0,function(){var r;return _o(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(e=o,(n=i).persistence.runTransaction("read document","readonly",function(t){return n.Dc.Dr(t,e)}))];case 1:return(r=t.sent())instanceof Vb?s.resolve(r):r instanceof qb?s.resolve(null):s.reject(new Bv(qv.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 r=t.sent(),r=fw(r,"Failed to get document '"+o+" from cache"),s.reject(r),[3,3];case 3:return[2]}var e,n})})}(n.Wu,r,e)}),e.promise)]}})})},WC.prototype.Q_=function(c,h){return void 0===h&&(h={}),bo(this,void 0,void 0,function(){var e,u=this;return _o(this,function(t){switch(t.label){case 0:return this.O_(),[4,this.M_.promise];case 1:return t.sent(),e=new V_,[2,(this.os.ds(function(){return n=u.B_,r=u.os,i=c,o=h,s=e,t=new BS({next:function(t){r.ds(function(){return yw(n,a)});var e=t.docs.has(i);!e&&t.fromCache?s.reject(new Bv(qv.UNAVAILABLE,"Failed to get document because the client is offline.")):e&&t.fromCache&&o&&"server"===o.source?s.reject(new Bv(qv.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.)')):s.resolve(t)},error:function(t){return s.reject(t)}}),a=new mw(Qb(i.path),t,{includeMetadataChanges:!0,Js:!0}),vw(n,a);var n,r,i,o,s,t,a}),e.promise)]}})})},WC.prototype.W_=function(r){return bo(this,void 0,void 0,function(){var e,n=this;return _o(this,function(t){switch(t.label){case 0:return this.O_(),[4,this.M_.promise];case 1:return t.sent(),e=new V_,[2,(this.os.ds(function(){return function(r,i,o){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,LI(r,i,!0)];case 1:return n=t.sent(),e=new xT(i,n.Nc),n=e.dh(n.documents),n=e.gr(n,!1),o.resolve(n.snapshot),[3,3];case 2:return n=t.sent(),n=fw(n,"Failed to execute query '"+i+" against cache"),o.reject(n),[3,3];case 3:return[2]}})})}(n.Wu,r,e)}),e.promise)]}})})},WC.prototype.j_=function(c,h){return void 0===h&&(h={}),bo(this,void 0,void 0,function(){var a,u=this;return _o(this,function(t){switch(t.label){case 0:return this.O_(),[4,this.M_.promise];case 1:return t.sent(),a=new V_,[2,(this.os.ds(function(){return e=u.B_,n=u.os,t=c,r=h,i=a,o=new BS({next:function(t){n.ds(function(){return yw(e,s)}),t.fromCache&&"server"===r.source?i.reject(new Bv(qv.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):i.resolve(t)},error:function(t){return i.reject(t)}}),s=new mw(t,o,{includeMetadataChanges:!0,Js:!0}),vw(e,s);var e,n,t,r,i,o,s}),a.promise)]}})})},WC.prototype.write=function(t){var e=this;this.O_();var n=new V_;return this.os.ds(function(){return function(f,p,d){return bo(this,void 0,void 0,function(){var s,a;return _o(this,function(t){switch(t.label){case 0:a=rS(f),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,(i=a.Wu,u=p,h=i,l=Ky.now(),o=u.reduce(function(t,e){return t.add(e.key)},Ag()),h.persistence.runTransaction("Locally write mutations","readwrite",function(a){return h.Dc.$r(a,o).next(function(t){c=t;for(var s,e=[],n=0,r=u;n<r.length;n++){var i=r[n],o=(s=i,o=c.get(i.key),s instanceof Tb?function(t){for(var e=null,n=0,r=s.fieldTransforms;n<r.length;n++){var i=r[n],o=t instanceof Vb?t.field(i.field):void 0,o=Bm(i.transform,o||null);null!=o&&(e=(null==e?new Pb:e).set(i.field,o))}return e?e.Je():null}(o):null);null!=o&&e.push(new bb(i.key,o,function s(t){var a=[];return Zv(t.fields||{},function(t,e){var n=new oy([t]);if(fm(e))if(0===(e=s(e.mapValue).fields).length)a.push(n);else for(var r=0,i=e;r<i.length;r++){var o=i[r];a.push(n.child(o))}else a.push(n)}),new ob(a)}(o.proto.mapValue),cb.exists(!0)))}return h.vr.xo(a,l,e,u)})}).then(function(t){var e=t.hr(c);return{batchId:t.batchId,dr:e}}))];case 2:return s=t.sent(),a.bh.Fi(s.batchId),e=a,n=s.batchId,r=d,i=(i=(i=e.Mh[e.currentUser.Zs()])||new pg(Py)).rt(n,r),e.Mh[e.currentUser.Zs()]=i,[4,XT(a,s.dr)];case 3:return t.sent(),[4,CT(a.Vh)];case 4:return t.sent(),[3,6];case 5:return a=t.sent(),a=fw(a,"Failed to persist write"),d.reject(a),[3,6];case 6:return[2]}var e,n,r,i,u,c,h,l,o})})}(e._i,t,n)}),n.promise},WC.prototype.U=function(){return this.pl.U},WC.prototype.K_=function(t){var e=this;this.O_();var r=new BS(t);return this.os.ds(function(){return bo(e,void 0,void 0,function(){return _o(this,function(t){return[2,(e=this.B_,n=r,e.Bs.add(n),void n.next())];var e,n})})}),function(){r.Xl(),e.os.ds(function(){return bo(e,void 0,void 0,function(){return _o(this,function(t){return[2,void this.B_.Bs.delete(r)]})})})}},Object.defineProperty(WC.prototype,"G_",{get:function(){return this.os.Vs},enumerable:!1,configurable:!0}),WC.prototype.transaction=function(t){var e=this;this.O_();var n=new V_;return this.os.ds(function(){return new qC(e.os,e.ju,t,n).run(),Promise.resolve()}),n.promise},WC);function WC(t,e){this.credentials=t,this.os=e,this.clientId=Oy.k(),this.M_=new V_}function HC(t,e,n,r){this.os=t,this.ju=e,this.updateFunction=n,this.hs=r,this.C_=5,this.gs=new B_(this.os,"transaction_retry")}function GC(t){this.ju=t,this.g_=new Map,this.mutations=[],this.y_=!1,this.V_=null,this.p_=new Set}function KC(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 zC,QC,YC=(pN.prototype.J_=function(t){switch(Jg(t)){case 0:return null;case 1:return t.booleanValue;case 2:return om(t.integerValue||t.doubleValue);case 3:return this.X_(t.timestampValue);case 4:return this.Z_(t);case 5:return t.stringValue;case 6:return this.Y_(sm(t.bytesValue));case 7:return this.tf(t.referenceValue);case 8:return this.ef(t.geoPointValue);case 9:return this.nf(t.arrayValue);case 10:return this.sf(t.mapValue);default:throw Xv()}},pN.prototype.sf=function(t){var n=this,r={};return Zv(t.fields||{},function(t,e){r[t]=n.J_(e)}),r},pN.prototype.ef=function(t){return new hC(om(t.latitude),om(t.longitude))},pN.prototype.nf=function(t){var e=this;return(t.values||[]).map(function(t){return e.J_(t)})},pN.prototype.Z_=function(t){switch(this.z_){case"previous":var e=function t(e){e=e.mapValue.fields.__previous_value__;return Yg(e)?t(e):e}(t);return null==e?null:this.J_(e);case"estimate":return this.X_(Xg(t));default:return null}},pN.prototype.X_=function(t){t=im(t),t=new Ky(t.seconds,t.nanos);return this.timestampsInSnapshots?t:t.toDate()},pN.prototype.tf=function(t){var e=ry.P(t);$v(qm(e));t=new Hy(e.get(1),e.get(3)),e=new sy(e.u(5));return t.isEqual(this.U)||zv("Document "+e+" contains a document reference within a different database ("+t.projectId+"/"+t.database+") which is not supported. It will be treated as a reference in the current database ("+this.U.projectId+"/"+this.U.database+") instead."),this.H_(e)},pN),XC=eE.uo,$C=(fN.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.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},fN),JC=(Object.defineProperty(lN.prototype,"wf",{get:function(){return this.mf||(this.mf=new SC(this.l_,this.df.ignoreUndefinedProperties)),this.mf},enumerable:!1,configurable:!0}),lN.prototype.settings=function(t){fy("Firestore.settings",arguments,1),vy("Firestore.settings","object",1,t),t.merge&&delete(t=Object.assign(Object.assign({},this.df),t)).merge;t=new $C(t);if(this.hf&&!this.df.isEqual(t))throw new Bv(qv.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.df=t).credentials&&(this.ff=function(t){if(!t)return new zI;switch(t.type){case"gapi":var e=t.client;return $v(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new XI(e,t.sessionIndex||"0");case"provider":return t.client;default:throw new Bv(qv.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(t.credentials))},lN.prototype.enableNetwork=function(){return this.uf(),this.hf.enableNetwork()},lN.prototype.disableNetwork=function(){return this.uf(),this.hf.disableNetwork()},lN.prototype.enablePersistence=function(t){var e;if(this.hf)throw new Bv(qv.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 n=!1,r=!1;if(t&&(void 0!==t.experimentalTabSynchronization&&zv("The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead."),n=null!==(e=null!==(e=t.synchronizeTabs)&&void 0!==e?e:t.experimentalTabSynchronization)&&void 0!==e&&e,r=!!t.experimentalForceOwningTab&&t.experimentalForceOwningTab,n&&r))throw new Bv(qv.INVALID_ARGUMENT,"The 'experimentalForceOwningTab' setting cannot be used with 'synchronizeTabs'.");return this.Tf(this.if,this.rf,{Wl:!0,cacheSizeBytes:this.df.cacheSizeBytes,synchronizeTabs:n,xa:r})},lN.prototype.clearPersistence=function(){return bo(this,void 0,void 0,function(){var n,e=this;return _o(this,function(t){if(void 0!==this.hf&&!this.hf.G_)throw new Bv(qv.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");return n=new V_,[2,(this.cf.ps(function(){return bo(e,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.if.clearPersistence(this.l_,this._f)];case 1:return t.sent(),n.resolve(),[3,3];case 2:return e=t.sent(),n.reject(e),[3,3];case 3:return[2]}})})}),n.promise)]})})},lN.prototype.terminate=function(){return this.app._removeServiceInstance("firestore"),this.INTERNAL.delete()},Object.defineProperty(lN.prototype,"Ef",{get:function(){return this.uf(),this.hf.G_},enumerable:!1,configurable:!0}),lN.prototype.waitForPendingWrites=function(){return this.uf(),this.hf.waitForPendingWrites()},lN.prototype.onSnapshotsInSync=function(t){if(this.uf(),KC(t))return this.hf.K_(t);vy("Firestore.onSnapshotsInSync","function",1,t);t={next:t};return this.hf.K_(t)},lN.prototype.uf=function(){return this.hf||this.Tf(new jS,new qS,{Wl:!1}),this.hf},lN.prototype.If=function(){return new qy(this.l_,this._f,this.df.host,this.df.ssl,this.df.experimentalForceLongPolling)},lN.prototype.Tf=function(t,e,n){var r=this.If();return this.hf=new BC(this.ff,this.cf),this.hf.start(r,t,e,n)},lN.lf=function(t){if(e=t.options,!Object.prototype.hasOwnProperty.call(e,"projectId"))throw new Bv(qv.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');var e,t=t.options.projectId;if(!t||"string"!=typeof t)throw new Bv(qv.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new Hy(t)},Object.defineProperty(lN.prototype,"app",{get:function(){if(!this.af)throw new Bv(qv.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.af},enumerable:!1,configurable:!0}),lN.prototype.collection=function(t){return fy("Firestore.collection",arguments,1),vy("Firestore.collection","non-empty string",1,t),this.uf(),new wN(ry.P(t),this,null)},lN.prototype.doc=function(t){return fy("Firestore.doc",arguments,1),vy("Firestore.doc","non-empty string",1,t),this.uf(),eN.Af(ry.P(t),this,null)},lN.prototype.collectionGroup=function(t){if(fy("Firestore.collectionGroup",arguments,1),vy("Firestore.collectionGroup","non-empty string",1,t),0<=t.indexOf("/"))throw new Bv(qv.INVALID_ARGUMENT,"Invalid collection ID '"+t+"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.");return this.uf(),new bN((t=t,new Wb(ry.g(),t)),this,null)},lN.prototype.runTransaction=function(e){var n=this;return fy("Firestore.runTransaction",arguments,1),vy("Firestore.runTransaction","function",1,e),this.uf().transaction(function(t){return e(new ZC(n,t))})},lN.prototype.batch=function(){return this.uf(),new tN(this)},Object.defineProperty(lN,"logLevel",{get:function(){switch(Gv()){case Ns.DEBUG:return"debug";case Ns.ERROR:return"error";case Ns.SILENT:return"silent";case Ns.WARN:return"warn";case Ns.INFO:return"info";case Ns.VERBOSE:return"verbose";default:return"error"}},enumerable:!1,configurable:!0}),lN.setLogLevel=function(t){fy("Firestore.setLogLevel",arguments,1),_y("setLogLevel",["debug","error","silent","warn","info","verbose"],1,t),Wv.setLogLevel(t)},lN.prototype.Rf=function(){return this.df.timestampsInSnapshots},lN.prototype.Pf=function(){return this.df},lN),ZC=(hN.prototype.get=function(t){var e=this;fy("Transaction.get",arguments,1);var n=AN("Transaction.get",t,this.gf);return this.yf.b_([n.__]).then(function(t){if(!t||1!==t.length)return Xv();t=t[0];if(t instanceof qb)return new rN(e.gf,n.__,null,!1,!1,n.f_);if(t instanceof Vb)return new rN(e.gf,n.__,t,!1,!1,n.f_);throw Xv()})},hN.prototype.set=function(t,e,n){dy("Transaction.set",arguments,2,3);t=AN("Transaction.set",t,this.gf);n=SN("Transaction.set",n);e=kN(t.f_,e,n),n=AC(this.gf.wf,"Transaction.set",t.__,e,null!==t.f_,n);return this.yf.set(t.__,n),this},hN.prototype.update=function(t,e,n){for(var r,i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return e="string"==typeof e||e instanceof HS?(py("Transaction.update",arguments,3),r=AN("Transaction.update",t,this.gf),OC(this.gf.wf,"Transaction.update",r.__,e,n,i)):(fy("Transaction.update",arguments,2),r=AN("Transaction.update",t,this.gf),kC(this.gf.wf,"Transaction.update",r.__,e)),this.yf.update(r.__,e),this},hN.prototype.delete=function(t){fy("Transaction.delete",arguments,1);t=AN("Transaction.delete",t,this.gf);return this.yf.delete(t.__),this},hN),tN=(cN.prototype.set=function(t,e,n){dy("WriteBatch.set",arguments,2,3),this.bf();t=AN("WriteBatch.set",t,this.gf);n=SN("WriteBatch.set",n);e=kN(t.f_,e,n),n=AC(this.gf.wf,"WriteBatch.set",t.__,e,null!==t.f_,n);return this.Vf=this.Vf.concat(n.d_(t.__,cb.Ge())),this},cN.prototype.update=function(t,e,n){for(var r,i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return this.bf(),e="string"==typeof e||e instanceof HS?(py("WriteBatch.update",arguments,3),r=AN("WriteBatch.update",t,this.gf),OC(this.gf.wf,"WriteBatch.update",r.__,e,n,i)):(fy("WriteBatch.update",arguments,2),r=AN("WriteBatch.update",t,this.gf),kC(this.gf.wf,"WriteBatch.update",r.__,e)),this.Vf=this.Vf.concat(e.d_(r.__,cb.exists(!0))),this},cN.prototype.delete=function(t){fy("WriteBatch.delete",arguments,1),this.bf();t=AN("WriteBatch.delete",t,this.gf);return this.Vf=this.Vf.concat(new kb(t.__,cb.Ge())),this},cN.prototype.commit=function(){return this.bf(),this.pf=!0,0<this.Vf.length?this.gf.uf().write(this.Vf):Promise.resolve()},cN.prototype.bf=function(){if(this.pf)throw new Bv(qv.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},cN),eN=(go(uN,QC=pC),uN.Af=function(t,e,n){if(t.length%2!=0)throw new Bv(qv.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.R()+" has "+t.length);return new uN(new sy(t),e,n)},Object.defineProperty(uN.prototype,"id",{get:function(){return this.__.path._()},enumerable:!1,configurable:!0}),Object.defineProperty(uN.prototype,"parent",{get:function(){return new wN(this.__.path.h(),this.firestore,this.f_)},enumerable:!1,configurable:!0}),Object.defineProperty(uN.prototype,"path",{get:function(){return this.__.path.R()},enumerable:!1,configurable:!0}),uN.prototype.collection=function(t){if(fy("DocumentReference.collection",arguments,1),vy("DocumentReference.collection","non-empty string",1,t),!t)throw new Bv(qv.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");t=ry.P(t);return new wN(this.__.path.child(t),this.firestore,null)},uN.prototype.isEqual=function(t){if(!(t instanceof uN))throw Cy("isEqual","DocumentReference",1,t);return this.firestore===t.firestore&&this.__.isEqual(t.__)&&this.f_===t.f_},uN.prototype.set=function(t,e){dy("DocumentReference.set",arguments,1,2),e=SN("DocumentReference.set",e);t=kN(this.f_,t,e),e=AC(this.firestore.wf,"DocumentReference.set",this.__,t,null!==this.f_,e);return this.hf.write(e.d_(this.__,cb.Ge()))},uN.prototype.update=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return t="string"==typeof t||t instanceof HS?(py("DocumentReference.update",arguments,2),OC(this.firestore.wf,"DocumentReference.update",this.__,t,e,n)):(fy("DocumentReference.update",arguments,1),kC(this.firestore.wf,"DocumentReference.update",this.__,t)),this.hf.write(t.d_(this.__,cb.exists(!0)))},uN.prototype.delete=function(){return fy("DocumentReference.delete",arguments,0),this.hf.write([new kb(this.__,cb.Ge())])},uN.prototype.onSnapshot=function(){for(var e=this,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];dy("DocumentReference.onSnapshot",arguments,1,4);var r={includeMetadataChanges:!1},i=0;"object"!=typeof n[i]||KC(n[i])||(Sy("DocumentReference.onSnapshot",r=n[i],["includeMetadataChanges"]),my("DocumentReference.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++);var o={includeMetadataChanges:r.includeMetadataChanges};KC(n[i])?(s=n[i],n[i]=null===(r=s.next)||void 0===r?void 0:r.bind(s),n[i+1]=null===(r=s.error)||void 0===r?void 0:r.bind(s),n[i+2]=null===(r=s.complete)||void 0===r?void 0:r.bind(s)):(vy("DocumentReference.onSnapshot","function",i,n[i]),yy("DocumentReference.onSnapshot","function",i+1,n[i+1]),yy("DocumentReference.onSnapshot","function",i+2,n[i+2]));var s={next:function(t){n[i]&&n[i](e.vf(t))},error:n[i+1],complete:n[i+2]};return this.hf.listen(Qb(this.__.path),o,s)},uN.prototype.get=function(t){var e=this;dy("DocumentReference.get",arguments,0,1),NN("DocumentReference.get",t);var n=this.firestore.uf();return t&&"cache"===t.source?n.U_(this.__).then(function(t){return new rN(e.firestore,e.__,t,!0,t instanceof Vb&&t.Ye,e.f_)}):n.Q_(this.__,t).then(function(t){return e.vf(t)})},uN.prototype.withConverter=function(t){return new uN(this.__,this.firestore,t)},uN.prototype.vf=function(t){var e=t.docs.get(this.__);return new rN(this.firestore,this.__,e,t.fromCache,t.hasPendingWrites,this.f_)},uN),nN=(aN.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},aN),rN=(sN.prototype.data=function(t){var e=this;if(dy("DocumentSnapshot.data",arguments,0,1),t=CN("DocumentSnapshot.data",t),this.Sf){if(this.f_){var n=new iN(this.gf,this.__,this.Sf,this.Df,this.Cf,null);return this.f_.fromFirestore(n,t)}return new YC(this.gf.l_,this.gf.Rf(),t.serverTimestamps||"none",function(t){return new eN(t,e.gf,null)},function(t){return new Wy(t)}).J_(this.Sf.sn())}},sN.prototype.get=function(t,e){var n=this;if(dy("DocumentSnapshot.get",arguments,1,2),e=CN("DocumentSnapshot.get",e),this.Sf){t=this.Sf.data().field(MC("DocumentSnapshot.get",t,this.__));if(null!==t)return new YC(this.gf.l_,this.gf.Rf(),e.serverTimestamps||"none",function(t){return new eN(t,n.gf,n.f_)},function(t){return new Wy(t)}).J_(t)}},Object.defineProperty(sN.prototype,"id",{get:function(){return this.__.path._()},enumerable:!1,configurable:!0}),Object.defineProperty(sN.prototype,"ref",{get:function(){return new eN(this.__,this.gf,this.f_)},enumerable:!1,configurable:!0}),Object.defineProperty(sN.prototype,"exists",{get:function(){return null!==this.Sf},enumerable:!1,configurable:!0}),Object.defineProperty(sN.prototype,"metadata",{get:function(){return new nN(this.Cf,this.Df)},enumerable:!1,configurable:!0}),sN.prototype.isEqual=function(t){if(!(t instanceof sN))throw Cy("isEqual","DocumentSnapshot",1,t);return this.gf===t.gf&&this.Df===t.Df&&this.__.isEqual(t.__)&&(null===this.Sf?null===t.Sf:this.Sf.isEqual(t.Sf))&&this.f_===t.f_},sN),iN=(go(oN,zC=rN),oN.prototype.data=function(t){return zC.prototype.data.call(this,t)},oN);function oN(){return null!==zC&&zC.apply(this,arguments)||this}function sN(t,e,n,r,i,o){this.gf=t,this.__=e,this.Sf=n,this.Df=r,this.Cf=i,this.f_=o}function aN(t,e){this.hasPendingWrites=t,this.fromCache=e}function uN(t,e,n){var r=this;return(r=QC.call(this,e.l_,t,n)||this).__=t,r.firestore=e,r.f_=n,r.hf=r.firestore.uf(),r}function cN(t){this.gf=t,this.Vf=[],this.pf=!1}function hN(t,e){this.gf=t,this.yf=e}function lN(t,e,n,r){var i=this;if(void 0===n&&(n=new jS),void 0===r&&(r=new qS),this.if=n,this.rf=r,this.af=null,this.cf=new cw,this.INTERNAL={delete:function(){return bo(i,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return this.uf(),[4,this.hf.terminate()];case 1:return t.sent(),[2]}})})}},"object"==typeof t.options){r=t;this.af=r,this.l_=lN.lf(r),this._f=r.name,this.ff=new QI(e)}else{t=t;if(!t.projectId)throw new Bv(qv.INVALID_ARGUMENT,"Must provide projectId");this.l_=new Hy(t.projectId,t.database),this._f="[DEFAULT]",this.ff=new zI}this.df=new $C({})}function fN(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Bv(qv.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else gy("settings","non-empty string","host",t.host),this.host=t.host,my("settings","boolean","ssl",t.ssl),this.ssl=null===(e=t.ssl)||void 0===e||e;if(Sy("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling","ignoreUndefinedProperties"]),my("settings","object","credentials",t.credentials),this.credentials=t.credentials,my("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),my("settings","boolean","ignoreUndefinedProperties",t.ignoreUndefinedProperties),!0===t.timestampsInSnapshots?zv("The setting 'timestampsInSnapshots: true' is no longer required and should be removed."):!1===t.timestampsInSnapshots&&zv("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),this.timestampsInSnapshots=null===(e=t.timestampsInSnapshots)||void 0===e||e,this.ignoreUndefinedProperties=null!==(e=t.ignoreUndefinedProperties)&&void 0!==e&&e,my("settings","number","cacheSizeBytes",t.cacheSizeBytes),void 0===t.cacheSizeBytes)this.cacheSizeBytes=eE.lo;else{if(t.cacheSizeBytes!==XC&&t.cacheSizeBytes<eE.ho)throw new Bv(qv.INVALID_ARGUMENT,"cacheSizeBytes must be at least "+eE.ho);this.cacheSizeBytes=t.cacheSizeBytes}my("settings","boolean","experimentalForceLongPolling",t.experimentalForceLongPolling),this.experimentalForceLongPolling=null!==(t=t.experimentalForceLongPolling)&&void 0!==t&&t}function pN(t,e,n,r,i){this.U=t,this.timestampsInSnapshots=e,this.z_=n,this.H_=r,this.Y_=i}function dN(t,e,n){if("string"==typeof n){if(""===n)throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!Zb(e)&&-1!==n.indexOf("/"))throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '"+n+"' contains a '/' character.");e=e.path.child(ry.P(n));if(!sy.F(e))throw new Bv(qv.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 am(t,new sy(e))}if(n instanceof pC)return am(t,n.__);throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+Iy(n)+".")}function vN(t,e){if(!Array.isArray(t)||0===t.length)throw new Bv(qv.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(10<t.length)throw new Bv(qv.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.");if("in"===e||"array-contains-any"===e){if(0<=t.indexOf(null))throw new Bv(qv.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 Bv(qv.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'NaN' in the value array.")}}function yN(t,e,n){if(!n.isEqual(e))throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}function gN(t){if(Xb(t)&&0===t.rn.length)throw new Bv(qv.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var mN,bN=(TN.prototype.where=function(t,e,n){fy("Query.where",arguments,3),Ty("Query.where",3,n);e=_y("Query.where",["<","<=","==","!=",">=",">","array-contains","in","array-contains-any","not-in"],2,e),t=MC("Query.where",t),e=function(t,e,n,r,i,o,s){if(i.p()){if("array-contains"===o||"array-contains-any"===o)throw new Bv(qv.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+o+"' queries on FieldPath.documentId().");if("in"===o||"not-in"===o){vN(s,o);for(var a=[],u=0,c=s;u<c.length;u++){var h=c[u];a.push(dN(r,t,h))}l={arrayValue:{values:a}}}else l=dN(r,t,s)}else"in"!==o&&"not-in"!==o&&"array-contains-any"!==o||vN(s,o),l=RC(n,e,s,"in"===o||"not-in"===o);var l=l_.create(i,o,l);return function(t,e){if(e.un()){var n=Jb(t);if(null!==n&&!n.isEqual(e.field))throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+n.toString()+"' and '"+e.field.toString()+"'");n=$b(t);null!==n&&yN(0,e.field,n)}t=function(t,e){for(var n=0,r=t.filters;n<r.length;n++){var i=r[n];if(0<=e.indexOf(i.op))return i.op}return null}(t,function(){switch(e.op){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}());if(null!==t)throw t===e.op?new Bv(qv.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new Bv(qv.INVALID_ARGUMENT,"Invalid query. You cannot use '"+e.op.toString()+"' filters with '"+t.toString()+"' filters.")}(t,l),l}(this.Nf,"Query.where",this.firestore.wf,this.firestore.l_,t,e,n);return new TN((n=this.Nf,e=n.filters.concat([e]),new Wb(n.path,n.collectionGroup,n.rn.slice(),e,n.limit,n.on,n.startAt,n.endAt)),this.firestore,this.f_)},TN.prototype.orderBy=function(t,e){if(dy("Query.orderBy",arguments,1,2),yy("Query.orderBy","non-empty string",2,e),void 0===e||"asc"===e)n="asc";else{if("desc"!==e)throw new Bv(qv.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+e+"', expected 'asc' or 'desc'.");n="desc"}var n,t=MC("Query.orderBy",t),t=function(t,e,n){if(null!==t.startAt)throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");var r=new j_(e,n);return e=r,null!==$b(n=t)||null!==(t=Jb(n))&&yN(0,t,e.field),r}(this.Nf,t,n);return new TN((n=this.Nf,t=n.rn.concat([t]),new Wb(n.path,n.collectionGroup,t,n.filters.slice(),n.limit,n.on,n.startAt,n.endAt)),this.firestore,this.f_)},TN.prototype.limit=function(t){return fy("Query.limit",arguments,1),vy("Query.limit","number",1,t),Ny("Query.limit",1,t),new TN(n_(this.Nf,t,"F"),this.firestore,this.f_)},TN.prototype.limitToLast=function(t){return fy("Query.limitToLast",arguments,1),vy("Query.limitToLast","number",1,t),Ny("Query.limitToLast",1,t),new TN(n_(this.Nf,t,"L"),this.firestore,this.f_)},TN.prototype.startAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];py("Query.startAt",arguments,1);t=this.Ff("Query.startAt",t,e,!0);return new TN(r_(this.Nf,t),this.firestore,this.f_)},TN.prototype.startAfter=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];py("Query.startAfter",arguments,1);t=this.Ff("Query.startAfter",t,e,!1);return new TN(r_(this.Nf,t),this.firestore,this.f_)},TN.prototype.endBefore=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];py("Query.endBefore",arguments,1);t=this.Ff("Query.endBefore",t,e,!0);return new TN(i_(this.Nf,t),this.firestore,this.f_)},TN.prototype.endAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];py("Query.endAt",arguments,1);t=this.Ff("Query.endAt",t,e,!1);return new TN(i_(this.Nf,t),this.firestore,this.f_)},TN.prototype.isEqual=function(t){if(!(t instanceof TN))throw Cy("isEqual","Query",1,t);return this.firestore===t.firestore&&o_(this.Nf,t.Nf)&&this.f_===t.f_},TN.prototype.withConverter=function(t){return new TN(this.Nf,this.firestore,t)},TN.prototype.Ff=function(c,t,e,n){if(Ty(c,1,t),t instanceof rN)return fy(c,To([t],e),1),function(t,e,n,r){if(!n)throw new Bv(qv.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+c+"().");for(var i=[],o=0,s=t_(t);o<s.length;o++){var a=s[o];if(a.field.p())i.push(am(e,n.key));else{var u=n.field(a.field);if(Yg(u))throw new Bv(qv.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+a.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===u){a=a.field.R();throw new Bv(qv.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.")}i.push(u)}}return new R_(i,r)}(this.Nf,this.firestore.l_,t.Sf,n);e=[t].concat(e);return function(t,e,n,r,i,o){var s=t.rn;if(i.length>s.length)throw new Bv(qv.INVALID_ARGUMENT,"Too many arguments provided to "+r+"(). The number of arguments must be less than or equal to the number of orderBy() clauses");for(var a=[],u=0;u<i.length;u++){var c=i[u];if(s[u].field.p()){if("string"!=typeof c)throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+r+"(), but got a "+typeof c);if(!Zb(t)&&-1!==c.indexOf("/"))throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to "+r+"() must be a plain document ID, but '"+c+"' contains a slash.");var h=t.path.child(ry.P(c));if(!sy.F(h))throw new Bv(qv.INVALID_ARGUMENT,"Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to "+r+"() must result in a valid document path, but '"+h+"' is not because it contains an odd number of segments.");h=new sy(h);a.push(am(e,h))}else{c=RC(n,r,c);a.push(c)}}return new R_(a,o)}(this.Nf,this.firestore.l_,this.firestore.wf,c,e,n)},TN.prototype.onSnapshot=function(){for(var t,e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];dy("Query.onSnapshot",arguments,1,4);var i={},o=0;"object"!=typeof n[o]||KC(n[o])||(Sy("Query.onSnapshot",i=n[o],["includeMetadataChanges"]),my("Query.onSnapshot","boolean","includeMetadataChanges",i.includeMetadataChanges),o++),KC(n[o])?(s=n[o],n[o]=null===(t=s.next)||void 0===t?void 0:t.bind(s),n[o+1]=null===(t=s.error)||void 0===t?void 0:t.bind(s),n[o+2]=null===(t=s.complete)||void 0===t?void 0:t.bind(s)):(vy("Query.onSnapshot","function",o,n[o]),yy("Query.onSnapshot","function",o+1,n[o+1]),yy("Query.onSnapshot","function",o+2,n[o+2]));var s={next:function(t){n[o]&&n[o](new _N(e.firestore,e.Nf,t,e.f_))},error:n[o+1],complete:n[o+2]};return gN(this.Nf),this.firestore.uf().listen(this.Nf,i,s)},TN.prototype.get=function(t){var e=this;dy("Query.get",arguments,0,1),NN("Query.get",t),gN(this.Nf);var n=this.firestore.uf();return(t&&"cache"===t.source?n.W_(this.Nf):n.j_(this.Nf,t)).then(function(t){return new _N(e.firestore,e.Nf,t,e.f_)})},TN),_N=(Object.defineProperty(IN.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!1,configurable:!0}),Object.defineProperty(IN.prototype,"empty",{get:function(){return this.xf.docs.m()},enumerable:!1,configurable:!0}),Object.defineProperty(IN.prototype,"size",{get:function(){return this.xf.docs.size},enumerable:!1,configurable:!0}),IN.prototype.forEach=function(e,n){var r=this;dy("QuerySnapshot.forEach",arguments,1,2),vy("QuerySnapshot.forEach","function",1,e),this.xf.docs.forEach(function(t){e.call(n,r.Of(t,r.metadata.fromCache,r.xf.Qt.has(t.key)))})},Object.defineProperty(IN.prototype,"query",{get:function(){return new bN(this.$f,this.gf,this.f_)},enumerable:!1,configurable:!0}),IN.prototype.docChanges=function(t){t&&(Sy("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),my("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));t=!(!t||!t.includeMetadataChanges);if(t&&this.xf.jt)throw new Bv(qv.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.kf&&this.Mf===t||(this.kf=function(i,e,o){if(i.Ut.m()){var n=0;return i.docChanges.map(function(t){var e=o(t.doc,i.fromCache,i.Qt.has(t.doc.key));return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var s=i.Ut;return i.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=o(t.doc,i.fromCache,i.Qt.has(t.doc.key)),n=-1,r=-1;return 0!==t.type&&(n=s.indexOf(t.doc.key),s=s.delete(t.doc.key)),1!==t.type&&(r=(s=s.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 Xv()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this.xf,t,this.Of.bind(this)),this.Mf=t),this.kf},IN.prototype.isEqual=function(t){if(!(t instanceof IN))throw Cy("isEqual","QuerySnapshot",1,t);return this.gf===t.gf&&o_(this.$f,t.$f)&&this.xf.isEqual(t.xf)&&this.f_===t.f_},IN.prototype.Of=function(t,e,n){return new iN(this.gf,t.key,t,e,n,this.f_)},IN),wN=(go(EN,mN=bN),Object.defineProperty(EN.prototype,"id",{get:function(){return this.Nf.path._()},enumerable:!1,configurable:!0}),Object.defineProperty(EN.prototype,"parent",{get:function(){var t=this.Nf.path.h();return t.m()?null:new eN(new sy(t),this.firestore,null)},enumerable:!1,configurable:!0}),Object.defineProperty(EN.prototype,"path",{get:function(){return this.Nf.path.R()},enumerable:!1,configurable:!0}),EN.prototype.doc=function(t){dy("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=Oy.k()),vy("CollectionReference.doc","non-empty string",1,t);t=ry.P(t);return eN.Af(this.Nf.path.child(t),this.firestore,this.f_)},EN.prototype.add=function(t){fy("CollectionReference.add",arguments,1);t=this.f_?this.f_.toFirestore(t):t;vy("CollectionReference.add","object",1,t);var e=this.doc();return new eN(e.__,this.firestore,null).set(t).then(function(){return e})},EN.prototype.withConverter=function(t){return new EN(this.Lf,this.firestore,t)},EN);function EN(t,e,n){var r=this;if(((r=mN.call(this,Qb(t),e,n)||this).Lf=t).length%2!=1)throw new Bv(qv.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.R()+" has "+t.length);return r}function IN(t,e,n,r){this.gf=t,this.$f=e,this.xf=n,this.f_=r,this.kf=null,this.Mf=null,this.metadata=new nN(n.hasPendingWrites,n.fromCache)}function TN(t,e,n){this.Nf=t,this.firestore=e,this.f_=n}function SN(t,e){if(void 0===e)return{merge:!1};if(Sy(t,e,["merge","mergeFields"]),my(t,"boolean","merge",e.merge),void 0!==(n=e.mergeFields)&&function(t,e,n,r){if(!(n instanceof Array))throw new Bv(qv.INVALID_ARGUMENT,"Function "+t+"() requires its "+e+" option to be an array, but it was: "+Iy(n));for(var i=0;i<n.length;++i)if(!r(n[i]))throw new Bv(qv.INVALID_ARGUMENT,"Function "+t+"() requires all "+e+" elements to be a string or a FieldPath, but the value at index "+i+" was: "+Iy(n[i]))}(t,"mergeFields",n,function(t){return"string"==typeof t||t instanceof HS}),void 0!==e.mergeFields&&void 0!==e.merge)throw new Bv(qv.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');var n;return e}function CN(t,e){return void 0===e?{}:(Sy(t,e,["serverTimestamps"]),by(t,0,"serverTimestamps",e.serverTimestamps,["estimate","previous","none"]),e)}function NN(t,e){yy(t,"object",1,e),e&&(Sy(t,e,["source"]),by(t,0,"source",e.source,["default","server","cache"]))}function AN(t,e,n){if(e instanceof pC){if(e.firestore!==n)throw new Bv(qv.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}throw Cy(t,"DocumentReference",1,e)}function kN(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var ON,RN,M=(go(DN,ON=lC),DN.serverTimestamp=function(){ly("FieldValue.serverTimestamp",arguments);var t=new sC("serverTimestamp");return t.t_="FieldValue.serverTimestamp",new DN(t)},DN.delete=function(){ly("FieldValue.delete",arguments);var t=new zS("deleteField");return t.t_="FieldValue.delete",new DN(t)},DN.arrayUnion=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];py("FieldValue.arrayUnion",arguments,1);var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return py("arrayUnion()",arguments,1),new aC("arrayUnion",t)}.apply(void 0,t);return n.t_="FieldValue.arrayUnion",new DN(n)},DN.arrayRemove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];py("FieldValue.arrayRemove",arguments,1);var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return py("arrayRemove()",arguments,1),new uC("arrayRemove",t)}.apply(void 0,t);return n.t_="FieldValue.arrayRemove",new DN(n)},DN.increment=function(t){vy("FieldValue.increment","number",1,t),fy("FieldValue.increment",arguments,1);t=new cC("increment",t);return t.t_="FieldValue.increment",new DN(t)},DN.prototype.isEqual=function(t){return this.h_.isEqual(t.h_)},DN),PN={Firestore:JC,GeoPoint:hC,Timestamp:Ky,Blob:Wy,Transaction:ZC,WriteBatch:tN,DocumentReference:eN,DocumentSnapshot:rN,Query:bN,QueryDocumentSnapshot:iN,QuerySnapshot:_N,CollectionReference:wN,FieldPath:HS,FieldValue:M,setLogLevel:JC.setLogLevel,CACHE_SIZE_UNLIMITED:XC};function DN(){return null!==ON&&ON.apply(this,arguments)||this}(RN=Bl).INTERNAL.registerComponent(new bs("firestore",function(t){return e=t.getProvider("app").getImmediate(),n=t.getProvider("auth-internal"),r=new qS,t=new VS(r),new JC(e,n,t,r);var e,n,r},"PUBLIC").setServiceProps(Object.assign({},PN))),RN.registerVersion("@firebase/firestore","1.17.3");var xN,LN={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"},MN=(go(FN,xN=Error),FN);function FN(t,e,n){e=xN.call(this,e)||this;return Object.setPrototypeOf(e,FN.prototype),e.code=t,e.details=n,e}function UN(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(!LN[a])return new MN("internal","internal");r=LN[a],i=a}a=s.message;"string"==typeof a&&(i=a),void 0!==(o=s.details)&&(o=n.decode(o))}}catch(t){}return"ok"===r?null:new MN(r,i,o)}var jN=(VN.prototype.getAuthToken=function(){return bo(this,void 0,void 0,function(){var e;return _o(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]}})})},VN.prototype.getInstanceIdToken=function(){return bo(this,void 0,void 0,function(){return _o(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]})})},VN.prototype.getContext=function(){return bo(this,void 0,void 0,function(){var e,n;return _o(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}]}})})},VN);function VN(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 qN(t,e){var n,r={};for(n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}var BN=(WN.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 qN(t,function(t){return e.encode(t)});throw new Error("Data cannot be encoded in JSON: "+t)},WN.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?qN(t,function(t){return e.decode(t)}):t},WN);function WN(){}var HN=(Object.defineProperty(GN.prototype,"app",{get:function(){return this.app_},enumerable:!1,configurable:!0}),GN.prototype._url=function(t){var e=this.app_.options.projectId;return null===this.emulatorOrigin?null!==this.customDomain?this.customDomain+"/"+t:"https://"+this.region+"-"+e+".cloudfunctions.net/"+t:this.emulatorOrigin+"/"+e+"/"+this.region+"/"+t},GN.prototype.useFunctionsEmulator=function(t){this.emulatorOrigin=t},GN.prototype.httpsCallable=function(e,n){var r=this;return function(t){return r.call(e,t,n||{})}},GN.prototype.postJSON=function(r,i,o){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:o["Content-Type"]="application/json",t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.fetchImpl(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}]}})})},GN.prototype.call=function(c,h,l){return bo(this,void 0,void 0,function(){var i,o,s,a,u;return _o(this,function(t){switch(t.label){case 0:return i=this._url(c),h=this.serializer.encode(h),o={data:h},s={},[4,this.contextProvider.getContext()];case 1:return(a=t.sent()).authToken&&(s.Authorization="Bearer "+a.authToken),a.instanceIdToken&&(s["Firebase-Instance-ID-Token"]=a.instanceIdToken),u=l.timeout||7e4,n=u,e=new Promise(function(t,e){r=setTimeout(function(){e(new MN("deadline-exceeded","deadline-exceeded"))},n)}),u=(a={timer:r,promise:e}).timer,a=a.promise,[4,Promise.race([KN(u,this.postJSON(i,o,s)),a,KN(u,this.cancelAllRequests)])];case 2:if(!(a=t.sent()))throw new MN("cancelled","Firebase Functions instance was deleted.");if(u=UN(a.status,a.json,this.serializer))throw u;if(!a.json)throw new MN("internal","Response is not valid JSON object.");if(void 0===(u=a.json.data)&&(u=a.json.result),void 0===u)throw new MN("internal","Response is missing data field.");return[2,{data:this.serializer.decode(u)}]}var n,r,e})})},GN);function GN(t,e,n,r,i){var o=this;void 0===r&&(r="us-central1"),this.app_=t,this.fetchImpl=i,this.serializer=new BN,this.emulatorOrigin=null,this.INTERNAL={delete:function(){return Promise.resolve(o.deleteService())}},this.contextProvider=new jN(e,n),this.cancelAllRequests=new Promise(function(t){o.deleteService=function(){return t()}});try{var s=new URL(r);this.customDomain=s.origin,this.region="us-central1"}catch(t){this.customDomain=null,this.region=r}}function KN(n,r){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return[4,r];case 1:return e=t.sent(),clearTimeout(n),[2,e]}})})}var zN,QN,YN;function XN(n){return new Promise(function(t,e){n.onsuccess=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function $N(n,r,i){var o,t=new Promise(function(t,e){XN(o=n[r].apply(n,i)).then(t,e)});return t.request=o,t}function JN(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 ZN(e,n,r,t){t.forEach(function(t){t in r.prototype&&(e.prototype[t]=function(){return $N(this[n],t,arguments)})})}function tA(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 eA(t,r,e,n){n.forEach(function(n){n in e.prototype&&(t.prototype[n]=function(){return t=this[r],(e=$N(t,n,arguments)).then(function(t){if(t)return new rA(t,e.request)});var t,e})})}function nA(t){this._index=t}function rA(t,e){this._cursor=t,this._request=e}function iA(t){this._store=t}function oA(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 sA(t,e,n){this._db=t,this.oldVersion=e,this.transaction=new oA(n)}function aA(t){this._db=t}function uA(t,e,n){var e=$N(indexedDB,"open",[t,e]),r=e.request;return r&&(r.onupgradeneeded=function(t){n&&n(new sA(r.result,t.oldVersion,r.transaction))}),e.then(function(t){return new aA(t)})}function cA(t){return $N(indexedDB,"deleteDatabase",[t])}zN=Bl,QN=fetch.bind(self),YN={Functions:HN},zN.INTERNAL.registerComponent(new bs("functions",function(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),t=t.getProvider("messaging");return new HN(n,r,t,e,QN)},"PUBLIC").setServiceProps(YN).setMultipleInstances(!0)),Bl.registerVersion("@firebase/functions","0.5.1"),JN(nA,"_index",["name","keyPath","multiEntry","unique"]),ZN(nA,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),eA(nA,"_index",IDBIndex,["openCursor","openKeyCursor"]),JN(rA,"_cursor",["direction","key","primaryKey","value"]),ZN(rA,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(rA.prototype[n]=function(){var e=this,t=arguments;return Promise.resolve().then(function(){return e._cursor[n].apply(e._cursor,t),XN(e._request).then(function(t){if(t)return new rA(t,e._request)})})})}),iA.prototype.createIndex=function(){return new nA(this._store.createIndex.apply(this._store,arguments))},iA.prototype.index=function(){return new nA(this._store.index.apply(this._store,arguments))},JN(iA,"_store",["name","keyPath","indexNames","autoIncrement"]),ZN(iA,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),eA(iA,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),tA(iA,"_store",IDBObjectStore,["deleteIndex"]),oA.prototype.objectStore=function(){return new iA(this._tx.objectStore.apply(this._tx,arguments))},JN(oA,"_tx",["objectStoreNames","mode"]),tA(oA,"_tx",IDBTransaction,["abort"]),sA.prototype.createObjectStore=function(){return new iA(this._db.createObjectStore.apply(this._db,arguments))},JN(sA,"_db",["name","version","objectStoreNames"]),tA(sA,"_db",IDBDatabase,["deleteObjectStore","close"]),aA.prototype.transaction=function(){return new oA(this._db.transaction.apply(this._db,arguments))},JN(aA,"_db",["name","version","objectStoreNames"]),tA(aA,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach(function(i){[iA,nA].forEach(function(t){i in t.prototype&&(t.prototype[i.replace("open","iterate")]=function(){var t=(n=arguments,Array.prototype.slice.call(n)),e=t[t.length-1],n=this._store||this._index,r=n[i].apply(n,t.slice(0,-1));r.onsuccess=function(){e(r.result)}})})}),[nA,iA].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 hA=1e4,lA="w:0.4.17",fA="FIS_v2",pA="https://firebaseinstallations.googleapis.com/v1",dA=36e5,M=((K={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',K["not-registered"]="Firebase Installation is not registered.",K["installation-not-found"]="Firebase Installation not found.",K["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',K["app-offline"]="Could not process request. Application offline.",K["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",K),vA=new zo("installations","Installations",M);function yA(t){return t instanceof Go&&t.code.includes("request-failed")}function gA(t){t=t.projectId;return pA+"/projects/"+t+"/installations"}function mA(t){return{token:t.token,requestStatus:2,expiresIn:(t=t.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()}}function bA(n,r){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return[4,r.json()];case 1:return e=t.sent(),e=e.error,[2,vA.create("request-failed",{requestName:n,serverCode:e.code,serverMessage:e.message,serverStatus:e.status})]}})})}function _A(t){t=t.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function wA(t,e){e=e.refreshToken,t=_A(t);return t.append("Authorization",fA+" "+e),t}function EA(n){return bo(this,void 0,void 0,function(){var e;return _o(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 IA(e){return new Promise(function(t){setTimeout(t,e)})}var TA=/^[cdef][\w-]{21}$/,SA="";function CA(){try{var t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;t=function(t){return btoa(String.fromCharCode.apply(String,Io(t))).replace(/\+/g,"-").replace(/\//g,"_")}(t).substr(0,22);return TA.test(t)?t:SA}catch(t){return SA}}function NA(t){return t.appName+"!"+t.appId}var AA=new Map;function kA(t,e){t=NA(t);OA(t,e),function(t,e){var n=PA();n&&n.postMessage({key:t,fid:e});DA()}(t,e)}function OA(t,e){var n,r,i=AA.get(t);if(i)try{for(var o=wo(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 RA=null;function PA(){return!RA&&"BroadcastChannel"in self&&((RA=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(t){OA(t.data.key,t.data.fid)}),RA}function DA(){0===AA.size&&RA&&(RA.close(),RA=null)}var xA,LA="firebase-installations-database",MA=1,FA="firebase-installations-store",UA=null;function jA(){return UA=UA||uA(LA,MA,function(t){0===t.oldVersion&&t.createObjectStore(FA)})}function VA(o,s){return bo(this,void 0,void 0,function(){var e,n,r,i;return _o(this,function(t){switch(t.label){case 0:return e=NA(o),[4,jA()];case 1:return r=t.sent(),n=r.transaction(FA,"readwrite"),[4,(r=n.objectStore(FA)).get(e)];case 2:return i=t.sent(),[4,r.put(s,e)];case 3:return t.sent(),[4,n.complete];case 4:return t.sent(),i&&i.fid===s.fid||kA(o,s.fid),[2,s]}})})}function qA(r){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return e=NA(r),[4,jA()];case 1:return n=t.sent(),[4,(n=n.transaction(FA,"readwrite")).objectStore(FA).delete(e)];case 2:return t.sent(),[4,n.complete];case 3:return t.sent(),[2]}})})}function BA(s,a){return bo(this,void 0,void 0,function(){var e,n,r,i,o;return _o(this,function(t){switch(t.label){case 0:return e=NA(s),[4,jA()];case 1:return r=t.sent(),n=r.transaction(FA,"readwrite"),[4,(r=n.objectStore(FA)).get(e)];case 2:return i=t.sent(),void 0!==(o=a(i))?[3,4]:[4,r.delete(e)];case 3:return t.sent(),[3,6];case 4:return[4,r.put(o,e)];case 5:t.sent(),t.label=6;case 6:return[4,n.complete];case 7:return t.sent(),!o||i&&i.fid===o.fid||kA(s,o.fid),[2,o]}})})}function WA(i){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return[4,BA(i,function(t){t=GA(t||{fid:CA(),registrationStatus:0}),t=function(t,e){{if(0!==e.registrationStatus)return 1===e.registrationStatus?{installationEntry:e,registrationPromise:function(i){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return[4,HA(i)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.registrationStatus?[3,5]:[4,IA(100)];case 3:return t.sent(),[4,HA(i)];case 4:return e=t.sent(),[3,2];case 5:return 0!==e.registrationStatus?[3,7]:[4,WA(i)];case 6:return r=t.sent(),n=r.installationEntry,(r=r.registrationPromise)?[2,r]:[2,n];case 7:return[2,e]}})})}(t)}:{installationEntry:e};if(!navigator.onLine){var n=Promise.reject(vA.create("app-offline"));return{installationEntry:e,registrationPromise:n}}e={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},t=function(r,i){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,function(s,t){var a=t.fid;return bo(this,void 0,void 0,function(){var e,n,r,i,o;return _o(this,function(t){switch(t.label){case 0:return e=gA(s),n=_A(s),o={fid:a,authVersion:fA,appId:s.appId,sdkVersion:lA},r={method:"POST",headers:n,body:JSON.stringify(o)},[4,EA(function(){return fetch(e,r)})];case 1:return(i=t.sent()).ok?[4,i.json()]:[3,3];case 2:return o=t.sent(),[2,{fid:o.fid||a,registrationStatus:2,refreshToken:o.refreshToken,authToken:mA(o.authToken)}];case 3:return[4,bA("Create Installation",i)];case 4:throw t.sent()}})})}(r,i)];case 1:return e=t.sent(),[2,VA(r,e)];case 2:return yA(n=t.sent())&&409===n.serverCode?[4,qA(r)]:[3,4];case 3:return t.sent(),[3,6];case 4:return[4,VA(r,{fid:i.fid,registrationStatus:0})];case 5:t.sent(),t.label=6;case 6:throw n;case 7:return[2]}})})}(t,e);return{installationEntry:e,registrationPromise:t}}}(i,t);return e=t.registrationPromise,t.installationEntry})];case 1:return(n=t.sent()).fid!==SA?[3,3]:(r={},[4,e]);case 2:return[2,(r.installationEntry=t.sent(),r)];case 3:return[2,{installationEntry:n,registrationPromise:e}]}})})}function HA(t){return BA(t,function(t){if(!t)throw vA.create("installation-not-found");return GA(t)})}function GA(t){return 1===(e=t).registrationStatus&&e.registrationTime+hA<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}function KA(t,s){var a=t.appConfig,u=t.platformLoggerProvider;return bo(this,void 0,void 0,function(){var e,n,r,i,o;return _o(this,function(t){switch(t.label){case 0:return e=function(t,e){e=e.fid;return gA(t)+"/"+e+"/authTokens:generate"}(a,s),n=wA(a,s),(o=u.getImmediate({optional:!0}))&&n.append("x-firebase-client",o.getPlatformInfoString()),o={installation:{sdkVersion:lA}},r={method:"POST",headers:n,body:JSON.stringify(o)},[4,EA(function(){return fetch(e,r)})];case 1:return(i=t.sent()).ok?[4,i.json()]:[3,3];case 2:return o=t.sent(),[2,mA(o)];case 3:return[4,bA("Generate Auth Token",i)];case 4:throw t.sent()}})})}function zA(i,o){return void 0===o&&(o=!1),bo(this,void 0,void 0,function(){var r,e,n;return _o(this,function(t){switch(t.label){case 0:return[4,BA(i.appConfig,function(t){if(!YA(t))throw vA.create("not-registered");var e,n=t.authToken;if(o||2!==(e=n).requestStatus||function(t){var e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+dA}(e)){if(1===n.requestStatus)return r=function(n,r){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return[4,QA(n.appConfig)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.authToken.requestStatus?[3,5]:[4,IA(100)];case 3:return t.sent(),[4,QA(n.appConfig)];case 4:return e=t.sent(),[3,2];case 5:return 0===(e=e.authToken).requestStatus?[2,zA(n,r)]:[2,e]}})})}(i,o),t;if(!navigator.onLine)throw vA.create("app-offline");n=(e=t,n={requestStatus:1,requestTime:Date.now()},mo(mo({},e),{authToken:n}));return r=function(i,o){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,8]),[4,KA(i,o)];case 1:return e=t.sent(),r=mo(mo({},o),{authToken:e}),[4,VA(i.appConfig,r)];case 2:return t.sent(),[2,e];case 3:return!yA(n=t.sent())||401!==n.serverCode&&404!==n.serverCode?[3,5]:[4,qA(i.appConfig)];case 4:return t.sent(),[3,7];case 5:return r=mo(mo({},o),{authToken:{requestStatus:0}}),[4,VA(i.appConfig,r)];case 6:t.sent(),t.label=7;case 7:throw n;case 8:return[2]}})})}(i,n),n}return t})];case 1:return e=t.sent(),r?[4,r]:[3,3];case 2:return n=t.sent(),[3,4];case 3:n=e.authToken,t.label=4;case 4:return[2,n]}})})}function QA(t){return BA(t,function(t){if(!YA(t))throw vA.create("not-registered");var e=t.authToken;return 1===(e=e).requestStatus&&e.requestTime+hA<Date.now()?mo(mo({},t),{authToken:{requestStatus:0}}):t})}function YA(t){return void 0!==t&&2===t.registrationStatus}function XA(e,n){return void 0===n&&(n=!1),bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return[4,function(n){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return[4,WA(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,zA(e,n)];case 2:return[2,t.sent().token]}})})}function $A(i,o){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return e=function(t,e){e=e.fid;return gA(t)+"/"+e}(i,o),r=wA(i,o),n={method:"DELETE",headers:r},[4,EA(function(){return fetch(e,n)})];case 1:return(r=t.sent()).ok?[3,3]:[4,bA("Delete Installation",r)];case 2:throw t.sent();case 3:return[2]}})})}function JA(t,r){var i=t.appConfig;return function(t,e){PA();var n=NA(t);(t=AA.get(n))||(t=new Set,AA.set(n,t)),t.add(e)}(i,r),function(){var t,e,n;e=r,n=NA(t=i),(t=AA.get(n))&&(t.delete(e),0===t.size&&AA.delete(n),DA())}}function ZA(t){return vA.create("missing-app-config-values",{valueName:t})}(xA=Bl).INTERNAL.registerComponent(new bs("installations",function(t){var e=t.getProvider("app").getImmediate(),n={appConfig:function(t){var e,n;if(!t||!t.options)throw ZA("App Configuration");if(!t.name)throw ZA("App Name");try{for(var r=wo(["projectId","apiKey","appId"]),i=r.next();!i.done;i=r.next()){var o=i.value;if(!t.options[o])throw ZA(o)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(e),platformLoggerProvider:t.getProvider("platform-logger")};return{app:e,getId:function(){return function(r){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return[4,WA(r.appConfig)];case 1:return e=t.sent(),n=e.installationEntry,(e.registrationPromise||zA(r)).catch(console.error),[2,n.fid]}})})}(n)},getToken:function(t){return XA(n,t)},delete:function(){return function(r){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return[4,BA(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 vA.create("delete-pending-registration");case 2:if(2!==n.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw vA.create("app-offline");case 3:return[4,$A(e,n)];case 4:return t.sent(),[4,qA(e)];case 5:t.sent(),t.label=6;case 6:return[2]}})})}(n)},onIdChange:function(t){return JA(n,t)}}},"PUBLIC")),xA.registerVersion("@firebase/installations","0.4.17");var tk,M=((K={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',K["only-available-in-window"]="This method is available in a Window context.",K["only-available-in-sw"]="This method is available in a service worker context.",K["permission-default"]="The notification permission was not granted and dismissed instead.",K["permission-blocked"]="The notification permission was not granted and blocked instead.",K["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",K["failed-service-worker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",K["token-subscribe-failed"]="A problem occurred while subscribing the user to FCM: {$errorInfo}",K["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",K["token-unsubscribe-failed"]="A problem occurred while unsubscribing the user from FCM: {$errorInfo}",K["token-update-failed"]="A problem occurred while updating the user from FCM: {$errorInfo}",K["token-update-no-token"]="FCM returned no token when updating the user to push.",K["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.",K["invalid-sw-registration"]="The input to useServiceWorker() must be a ServiceWorkerRegistration.",K["invalid-bg-handler"]="The input to setBackgroundMessageHandler() must be a function.",K["invalid-vapid-key"]="The public VAPID key must be a string.",K["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.",K),ek=new zo("messaging","Messaging",M),nk="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",rk="https://fcmregistrations.googleapis.com/v1",ik="FCM_MSG",ok="google.c.a.c_id";function sk(t){t=new Uint8Array(t);return btoa(String.fromCharCode.apply(String,Io(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(K=tk=tk||{}).PUSH_RECEIVED="push-received",K.NOTIFICATION_CLICKED="notification-clicked";var ak="fcm_token_details_db",uk=5,ck="fcm_token_object_Store";function hk(s){return bo(this,void 0,void 0,function(){var e,o,n=this;return _o(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(ak))return[2,null];t.label=2;case 2:return o=null,[4,uA(ak,uk,function(i){return bo(n,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return i.oldVersion<2?[2]:i.objectStoreNames.contains(ck)?[4,(r=i.transaction.objectStore(ck)).index("fcmSenderId").get(s)]:[2];case 1:return e=t.sent(),[4,r.clear()];case 2:if(t.sent(),!e)return[2];if(2===i.oldVersion){if(!(n=e).auth||!n.p256dh||!n.endpoint)return[2];o={token:n.fcmToken,createTime:null!==(r=n.createTime)&&void 0!==r?r:Date.now(),subscriptionOptions:{auth:n.auth,p256dh:n.p256dh,endpoint:n.endpoint,swScope:n.swScope,vapidKey:"string"==typeof n.vapidKey?n.vapidKey:sk(n.vapidKey)}}}else(3===i.oldVersion||4===i.oldVersion)&&(o={token:(n=e).fcmToken,createTime:n.createTime,subscriptionOptions:{auth:sk(n.auth),p256dh:sk(n.p256dh),endpoint:n.endpoint,swScope:n.swScope,vapidKey:sk(n.vapidKey)}});return[2]}})})})];case 3:return t.sent().close(),[4,cA(ak)];case 4:return t.sent(),[4,cA("fcm_vapid_details_db")];case 5:return t.sent(),[4,cA("undefined")];case 6:return t.sent(),[2,function(t){if(!t||!t.subscriptionOptions)return!1;var e=t.subscriptionOptions;return"number"==typeof t.createTime&&0<t.createTime&&"string"==typeof t.token&&0<t.token.length&&"string"==typeof e.auth&&0<e.auth.length&&"string"==typeof e.p256dh&&0<e.p256dh.length&&"string"==typeof e.endpoint&&0<e.endpoint.length&&"string"==typeof e.swScope&&0<e.swScope.length&&"string"==typeof e.vapidKey&&0<e.vapidKey.length}(o)?o:null]}})})}var lk="firebase-messaging-database",fk=1,pk="firebase-messaging-store",dk=null;function vk(){return dk=dk||uA(lk,fk,function(t){0===t.oldVersion&&t.createObjectStore(pk)})}function yk(r){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return e=mk(r),[4,vk()];case 1:return[4,t.sent().transaction(pk).objectStore(pk).get(e)];case 2:return(e=t.sent())?[2,e]:[3,3];case 3:return[4,hk(r.appConfig.senderId)];case 4:return(n=t.sent())?[4,gk(r,n)]:[3,6];case 5:return t.sent(),[2,n];case 6:return[2]}})})}function gk(r,i){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return e=mk(r),[4,vk()];case 1:return n=t.sent(),[4,(n=n.transaction(pk,"readwrite")).objectStore(pk).put(i,e)];case 2:return t.sent(),[4,n.complete];case 3:return t.sent(),[2,i]}})})}function mk(t){return t.appConfig.appId}function bk(r,i){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return[4,wk(r)];case 1:e=t.sent(),e={method:"DELETE",headers:e},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(_k(r.appConfig)+"/"+i,e)];case 3:return[4,t.sent().json()];case 4:if((e=t.sent()).error)throw n=e.error.message,ek.create("token-unsubscribe-failed",{errorInfo:n});return[3,6];case 5:throw n=t.sent(),ek.create("token-unsubscribe-failed",{errorInfo:n});case 6:return[2]}})})}function _k(t){t=t.projectId;return rk+"/projects/"+t+"/registrations"}function wk(t){var n=t.appConfig,r=t.installations;return bo(this,void 0,void 0,function(){var e;return _o(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 Ek(t){var e=t.p256dh,n=t.auth,r=t.endpoint,t=t.vapidKey,e={web:{endpoint:r,auth:n,p256dh:e}};return t!==nk&&(e.web.applicationPubKey=t),e}function Ik(c,h,l){return bo(this,void 0,void 0,function(){var s,a,u;return _o(this,function(t){switch(t.label){case 0:if("granted"!==Notification.permission)throw ek.create("permission-blocked");return[4,function(n,r){return bo(this,void 0,void 0,function(){var e;return _o(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 t=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),e=atob(t),n=new Uint8Array(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}(r)})]}})})}(h,l)];case 1:return u=t.sent(),[4,yk(c)];case 2:return s=t.sent(),a={vapidKey:l,swScope:h.scope,endpoint:u.endpoint,auth:sk(u.getKey("auth")),p256dh:sk(u.getKey("p256dh"))},s?[3,3]:[2,Sk(c,a)];case 3:if(e=s.subscriptionOptions,r=(n=a).vapidKey===e.vapidKey,i=n.endpoint===e.endpoint,o=n.auth===e.auth,e=n.p256dh===e.p256dh,r&&i&&o&&e)return[3,8];t.label=4;case 4:return t.trys.push([4,6,,7]),[4,bk(c,s.token)];case 5:return t.sent(),[3,7];case 6:return u=t.sent(),console.warn(u),[3,7];case 7:return[2,Sk(c,a)];case 8:return Date.now()>=s.createTime+6048e5?[2,function(i,o,s){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,5]),[4,function(o,s){return bo(this,void 0,void 0,function(){var e,n,r,i;return _o(this,function(t){switch(t.label){case 0:return[4,wk(o)];case 1:e=t.sent(),n=Ek(s.subscriptionOptions),n={method:"PATCH",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(_k(o.appConfig)+"/"+s.token,n)];case 3:return[4,t.sent().json()];case 4:return r=t.sent(),[3,6];case 5:throw i=t.sent(),ek.create("token-update-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,ek.create("token-update-failed",{errorInfo:i});if(!r.token)throw ek.create("token-update-no-token");return[2,r.token]}})})}(o,i)];case 1:return e=t.sent(),n=mo(mo({},i),{token:e,createTime:Date.now()}),[4,gk(o,n)];case 2:return t.sent(),[2,e];case 3:return r=t.sent(),[4,Tk(o,s)];case 4:throw t.sent(),r;case 5:return[2]}})})}({token:s.token,createTime:Date.now(),subscriptionOptions:a},c,h)]:[2,s.token];case 9:return[2]}var e,n,r,i,o})})}function Tk(n,r){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return[4,yk(n)];case 1:return(e=t.sent())?[4,bk(n,e.token)]:[3,4];case 2:return t.sent(),[4,function(r){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return e=mk(r),[4,vk()];case 1:return n=t.sent(),[4,(n=n.transaction(pk,"readwrite")).objectStore(pk).delete(e)];case 2:return t.sent(),[4,n.complete];case 3:return t.sent(),[2]}})})}(n)];case 3:t.sent(),t.label=4;case 4:return[4,r.pushManager.getSubscription()];case 5:return(e=t.sent())?[2,e.unsubscribe()]:[2,!0]}})})}function Sk(n,r){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return[4,function(o,s){return bo(this,void 0,void 0,function(){var e,n,r,i;return _o(this,function(t){switch(t.label){case 0:return[4,wk(o)];case 1:e=t.sent(),n=Ek(s),n={method:"POST",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(_k(o.appConfig),n)];case 3:return[4,t.sent().json()];case 4:return r=t.sent(),[3,6];case 5:throw i=t.sent(),ek.create("token-subscribe-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,ek.create("token-subscribe-failed",{errorInfo:i});if(!r.token)throw ek.create("token-subscribe-no-token");return[2,r.token]}})})}(n,r)];case 1:return e=t.sent(),e={token:e,createTime:Date.now(),subscriptionOptions:r},[4,gk(n,e)];case 2:return t.sent(),[2,e.token]}})})}function Ck(t){var e={from:t.from,collapseKey:t.collapse_key};return function(t,e){if(!e.notification)return;t.notification={};var n=e.notification.title;n&&(t.notification.title=n);n=e.notification.body;n&&(t.notification.body=n);e=e.notification.image;e&&(t.notification.image=e)}(e,t),function(t,e){if(!e.data)return;t.data=e.data}(e,t),function(t,e){if(!e.fcmOptions)return;t.fcmOptions={};var n=e.fcmOptions.link;n&&(t.fcmOptions.link=n);e=e.fcmOptions.analytics_label;e&&(t.fcmOptions.analyticsLabel=e)}(e,t),e}function Nk(t){return"object"==typeof t&&t&&ok in t}var Ak=(Object.defineProperty(kk.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),kk.prototype.setBackgroundMessageHandler=function(t){if(this.isOnBackgroundMessageUsed=!1,!t||"function"!=typeof t)throw ek.create("invalid-bg-handler");this.bgMessageHandler=t},kk.prototype.onBackgroundMessage=function(t){var e=this;return this.isOnBackgroundMessageUsed=!0,this.bgMessageHandler=t,function(){e.bgMessageHandler=null}},kk.prototype.getToken=function(){var n;return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return this.vapidKey?[3,2]:[4,yk(this.firebaseDependencies)];case 1:e=t.sent(),this.vapidKey=null!==(n=null===(n=null==e?void 0:e.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==n?n:nk,t.label=2;case 2:return[2,Ik(this.firebaseDependencies,self.registration,this.vapidKey)]}})})},kk.prototype.deleteToken=function(){return Tk(this.firebaseDependencies,self.registration)},kk.prototype.requestPermission=function(){throw ek.create("only-available-in-window")},kk.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw ek.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw ek.create("invalid-vapid-key");this.vapidKey=t},kk.prototype.useServiceWorker=function(){throw ek.create("only-available-in-window")},kk.prototype.onMessage=function(){throw ek.create("only-available-in-window")},kk.prototype.onTokenRefresh=function(){throw ek.create("only-available-in-window")},kk.prototype.onPush=function(a){return bo(this,void 0,void 0,function(){var i,o,s;return _o(this,function(t){switch(t.label){case 0:return(s=function(t){var e=t.data;if(!e)return null;try{return e.json()}catch(t){return null}}(a))?[4,Ok()]:(console.debug("FirebaseMessaging: failed to get parsed MessagePayload from the PushEvent. Skip handling the push."),[2]);case 1:return(i=t.sent(),i.some(function(t){return"visible"===t.visibilityState&&!t.url.startsWith("chrome-extension://")}))?[2,function(t,e){var n,r;e.isFirebaseMessaging=!0,e.messageType=tk.PUSH_RECEIVED;try{for(var i=wo(t),o=i.next();!o.done;o=i.next()){o.value.postMessage(e)}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}(i,s)]:(o=!1,s.notification?[4,function(t){var e=t.actions,n=Notification.maxActions;e&&n&&e.length>n&&console.warn("This browser only supports "+n+" actions. The remaining actions will not be displayed.");return self.registration.showNotification(null!==(n=t.title)&&void 0!==n?n:"",t)}(((r=mo({},(e=s).notification)).data=((n={})[ik]=e,n),r))]:[3,3]);case 2:t.sent(),o=!0,t.label=3;case 3:return!0===o&&!1===this.isOnBackgroundMessageUsed?[2]:(this.bgMessageHandler&&(s=Ck(s),"function"==typeof this.bgMessageHandler?this.bgMessageHandler(s):this.bgMessageHandler.next(s)),[2])}var e,n,r})})},kk.prototype.onSubChange=function(n){var r;return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return n.newSubscription?[3,2]:[4,Tk(this.firebaseDependencies,self.registration)];case 1:return t.sent(),[2];case 2:return[4,yk(this.firebaseDependencies)];case 3:return e=t.sent(),[4,Tk(this.firebaseDependencies,self.registration)];case 4:return t.sent(),[4,Ik(this.firebaseDependencies,self.registration,null!==(r=null===(r=null==e?void 0:e.subscriptionOptions)||void 0===r?void 0:r.vapidKey)&&void 0!==r?r:nk)];case 5:return t.sent(),[2]}})})},kk.prototype.onNotificationClick=function(a){var u;return bo(this,void 0,void 0,function(){var n,r,i,o,s;return _o(this,function(t){switch(t.label){case 0:return(n=null===(u=null===(u=a.notification)||void 0===u?void 0:u.data)||void 0===u?void 0:u[ik])?a.action?[2]:(a.stopImmediatePropagation(),a.notification.close(),(r=function(t){var e,n=null!==(e=null===(e=t.fcmOptions)||void 0===e?void 0:e.link)&&void 0!==e?e:null===(n=t.notification)||void 0===n?void 0:n.click_action;if(n)return n;return Nk(t.data)?self.location.origin:null}(n))?(i=new URL(r,self.location.href),o=new URL(self.location.origin),i.host!==o.host?[2]:[4,function(u){return bo(this,void 0,void 0,function(){var e,n,r,i,o,s,a;return _o(this,function(t){switch(t.label){case 0:return[4,Ok()];case 1:e=t.sent();try{for(n=wo(e),r=n.next();!r.done;r=n.next())if(i=r.value,o=new URL(i.url,self.location.href),u.host===o.host)return[2,i]}catch(t){s={error:t}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}}return[2,null]}})})}(i)]):[2]):[2];case 1:return(s=t.sent())?[3,4]:[4,self.clients.openWindow(r)];case 2:return s=t.sent(),[4,(e=3e3,new Promise(function(t){setTimeout(t,e)}))];case 3:return t.sent(),[3,6];case 4:return[4,s.focus()];case 5:s=t.sent(),t.label=6;case 6:return s?(n.messageType=tk.NOTIFICATION_CLICKED,n.isFirebaseMessaging=!0,[2,s.postMessage(n)]):[2]}var e})})},kk);function kk(t){var e=this;this.firebaseDependencies=t,this.isOnBackgroundMessageUsed=null,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 Ok(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}var Rk=(Object.defineProperty(Pk.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),Pk.prototype.messageEventListener=function(i){return bo(this,void 0,void 0,function(){var n,r;return _o(this,function(t){switch(t.label){case 0:return(n=i.data).isFirebaseMessaging?(this.onMessageCallback&&n.messageType===tk.PUSH_RECEIVED&&("function"==typeof this.onMessageCallback?this.onMessageCallback((delete(e=Object.assign({},n)).messageType,delete e.isFirebaseMessaging,e)):this.onMessageCallback.next(Object.assign({},n))),Nk(r=n.data)&&"1"===r["google.c.a.e"]?[4,this.logEvent(n.messageType,r)]:[3,2]):[2];case 1:t.sent(),t.label=2;case 2:return[2]}var e})})},Pk.prototype.getVapidKey=function(){return this.vapidKey},Pk.prototype.getSwReg=function(){return this.swRegistration},Pk.prototype.getToken=function(e){return bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return"default"!==Notification.permission?[3,2]:[4,Notification.requestPermission()];case 1:t.sent(),t.label=2;case 2:if("granted"!==Notification.permission)throw ek.create("permission-blocked");return[4,this.updateVapidKey(null==e?void 0:e.vapidKey)];case 3:return t.sent(),[4,this.updateSwReg(null==e?void 0:e.serviceWorkerRegistration)];case 4:return t.sent(),[2,Ik(this.firebaseDependencies,this.swRegistration,this.vapidKey)]}})})},Pk.prototype.updateVapidKey=function(e){return bo(this,void 0,void 0,function(){return _o(this,function(t){return e?this.vapidKey=e:this.vapidKey||(this.vapidKey=nk),[2]})})},Pk.prototype.updateSwReg=function(e){return bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return e||this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:t.sent(),t.label=2;case 2:if(!e&&this.swRegistration)return[2];if(!(e instanceof ServiceWorkerRegistration))throw ek.create("invalid-sw-registration");return this.swRegistration=e,[2]}})})},Pk.prototype.registerDefaultSw=function(){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=this,[4,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"})];case 1:return e.swRegistration=t.sent(),this.swRegistration.update().catch(function(){}),[3,3];case 2:throw e=t.sent(),ek.create("failed-service-worker-registration",{browserErrorMessage:e.message});case 3:return[2]}})})},Pk.prototype.deleteToken=function(){return bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:t.sent(),t.label=2;case 2:return[2,Tk(this.firebaseDependencies,this.swRegistration)]}})})},Pk.prototype.requestPermission=function(){return bo(this,void 0,void 0,function(){var e;return _o(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?ek.create("permission-blocked"):ek.create("permission-default")}})})},Pk.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw ek.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw ek.create("invalid-vapid-key");this.vapidKey=t},Pk.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw ek.create("invalid-sw-registration");if(this.swRegistration)throw ek.create("use-sw-after-get-token");this.swRegistration=t},Pk.prototype.onMessage=function(t){var e=this;return this.onMessageCallback=t,function(){e.onMessageCallback=null}},Pk.prototype.setBackgroundMessageHandler=function(){throw ek.create("only-available-in-sw")},Pk.prototype.onBackgroundMessage=function(){throw ek.create("only-available-in-sw")},Pk.prototype.onTokenRefresh=function(){return function(){}},Pk.prototype.logEvent=function(n,r){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return e=function(t){switch(t){case tk.NOTIFICATION_CLICKED:return"notification_open";case tk.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[ok],message_name:r["google.c.a.c_l"],message_time:r["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}})})},Pk);function Pk(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",function(t){return e.messageEventListener(t)})}function Dk(t){return ek.create("missing-app-config-values",{valueName:t})}M={isSupported:xk};function xk(){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")}Bl.INTERNAL.registerComponent(new bs("messaging",function(t){var e=t.getProvider("app").getImmediate(),t={app:e,appConfig:function(t){var e,n;if(!t||!t.options)throw Dk("App Configuration Object");if(!t.name)throw Dk("App Name");var r=t.options;try{for(var i=wo(["projectId","apiKey","appId","messagingSenderId"]),o=i.next();!o.done;o=i.next()){var s=o.value;if(!r[s])throw Dk(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(!xk())throw ek.create("unsupported-browser");return new(self&&"ServiceWorkerGlobalScope"in self?Ak:Rk)(t)},"PUBLIC").setServiceProps(M));var Lk="firebasestorage.googleapis.com",Mk=12e4,Fk=6e5,Uk=(jk.prototype.codeProp=function(){return this.code},jk.prototype.codeEquals=function(t){return qk(t)===this.codeProp()},jk.prototype.serverResponseProp=function(){return this.serverResponse_},jk.prototype.setServerResponseProp=function(t){this.serverResponse_=t},Object.defineProperty(jk.prototype,"name",{get:function(){return this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(jk.prototype,"code",{get:function(){return this.code_},enumerable:!1,configurable:!0}),Object.defineProperty(jk.prototype,"message",{get:function(){return this.serverResponse_?this.message_+"\n"+this.serverResponse_:this.message_},enumerable:!1,configurable:!0}),Object.defineProperty(jk.prototype,"serverResponse",{get:function(){return this.serverResponse_},enumerable:!1,configurable:!0}),jk);function jk(t,e){this.code_=qk(t),this.message_="Firebase Storage: "+e,this.serverResponse_=null,this.name_="FirebaseError"}var Vk={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 qk(t){return"storage/"+t}function Bk(){return new Uk(Vk.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function Wk(){return new Uk(Vk.CANCELED,"User canceled the upload/download.")}function Hk(){return new Uk(Vk.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Gk(t,e,n){return new Uk(Vk.INVALID_ARGUMENT,"Invalid argument in `"+e+"` at index "+t+": "+n)}function Kk(){return new Uk(Vk.APP_DELETED,"The Firebase app was deleted.")}function zk(t,e){return new Uk(Vk.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function Qk(t){throw new Uk(Vk.INTERNAL_ERROR,"Internal error: "+t)}var Yk={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};function Xk(t){switch(t){case Yk.RAW:case Yk.BASE64:case Yk.BASE64URL:case Yk.DATA_URL:return;default:throw"Expected one of the event types: ["+Yk.RAW+", "+Yk.BASE64+", "+Yk.BASE64URL+", "+Yk.DATA_URL+"]."}}var $k=function(t,e){this.data=t,this.contentType=e||null};function Jk(t,e){switch(t){case Yk.RAW:return new $k(Zk(e));case Yk.BASE64:case Yk.BASE64URL:return new $k(tO(t,e));case Yk.DATA_URL:return new $k(function(t){t=new eO(t);return t.base64?tO(Yk.BASE64,t.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(t){throw zk(Yk.DATA_URL,"Malformed data URL.")}return Zk(e)}(t.rest)}(e),new eO(e).contentType)}throw Bk()}function Zk(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);r<=127?e.push(r):r<=2047?e.push(192|r>>6,128|63&r):55296==(64512&r)?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)):e.push(239,191,189):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 tO(e,t){switch(e){case Yk.BASE64:var n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r)throw zk(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case Yk.BASE64URL:r=-1!==t.indexOf("+"),n=-1!==t.indexOf("/");if(r||n)throw zk(e,"Invalid character '"+(r?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/")}var i;try{i=atob(t)}catch(t){throw zk(e,"Invalid character found")}for(var o=new Uint8Array(i.length),s=0;s<i.length;s++)o[s]=i.charCodeAt(s);return o}var eO=function(t){var e;if(this.base64=!1,(this.contentType=null)===(e=t.match(/^data:([^,]+)?,/)))throw zk(Yk.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");var n,r=e[1]||null;null!=r&&(this.base64=(n=";base64",(e=r).length>=n.length&&e.substring(e.length-n.length)===n),this.contentType=this.base64?r.substring(0,r.length-";base64".length):r),this.rest=t.substring(t.indexOf(",")+1)};var nO,rO={STATE_CHANGED:"state_changed"},iO="running",oO="pausing",sO="paused",aO="success",uO="canceling",cO="canceled",hO="error",lO={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function fO(t){switch(t){case iO:case oO:case uO:return lO.RUNNING;case sO:return lO.PAUSED;case aO:return lO.SUCCESS;case cO:return lO.CANCELED;case hO:default:return lO.ERROR}}function pO(t){return null!=t}function dO(t){return void 0!==t}function vO(t){return"function"==typeof t}function yO(t){return"object"==typeof t}function gO(t){return"string"==typeof t||t instanceof String}function mO(t){return"number"==typeof t||t instanceof Number}function bO(t){return _O()&&t instanceof Blob}function _O(){return"undefined"!=typeof Blob}(K=nO=nO||{})[K.NO_ERROR=0]="NO_ERROR",K[K.NETWORK_ERROR=1]="NETWORK_ERROR",K[K.ABORT=2]="ABORT";var wO=(EO.prototype.send=function(t,e,n,r){if(this.sent_)throw Qk("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(e,t,!0),pO(r))for(var i in r)r.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,r[i].toString());return pO(n)?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},EO.prototype.getErrorCode=function(){if(!this.sent_)throw Qk("cannot .getErrorCode() before sending");return this.errorCode_},EO.prototype.getStatus=function(){if(!this.sent_)throw Qk("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},EO.prototype.getResponseText=function(){if(!this.sent_)throw Qk("cannot .getResponseText() before sending");return this.xhr_.responseText},EO.prototype.abort=function(){this.xhr_.abort()},EO.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},EO.prototype.addUploadProgressListener=function(t){pO(this.xhr_.upload)&&this.xhr_.upload.addEventListener("progress",t)},EO.prototype.removeUploadProgressListener=function(t){pO(this.xhr_.upload)&&this.xhr_.upload.removeEventListener("progress",t)},EO);function EO(){var e=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=nO.NO_ERROR,this.sendPromise_=new Promise(function(t){e.xhr_.addEventListener("abort",function(){e.errorCode_=nO.ABORT,t(e)}),e.xhr_.addEventListener("error",function(){e.errorCode_=nO.NETWORK_ERROR,t(e)}),e.xhr_.addEventListener("load",function(){t(e)})})}var IO=(TO.prototype.createXhrIo=function(){return new wO},TO);function TO(){}function SO(){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(_O())return new Blob(t);throw Error("This browser doesn't seem to support creating Blobs")}var CO=(NO.prototype.size=function(){return this.size_},NO.prototype.type=function(){return this.type_},NO.prototype.slice=function(t,e){if(bO(this.data_)){var n=this.data_,r=(i=t,r=e,(n=n).webkitSlice?n.webkitSlice(i,r):n.mozSlice?n.mozSlice(i,r):n.slice?n.slice(i,r):null);return null===r?null:new NO(r)}var i,r;return new NO(new Uint8Array(this.data_.buffer,t,e-t),!0)},NO.getBlob=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(_O()){var n=t.map(function(t){return t instanceof NO?t.data_:t});return new NO(SO.apply(null,n))}var n=t.map(function(t){return gO(t)?Jk(Yk.RAW,t).data:t.data_}),r=0;n.forEach(function(t){r+=t.byteLength});var i=new Uint8Array(r),o=0;return n.forEach(function(t){for(var e=0;e<t.length;e++)i[o++]=t[e]}),new NO(i,!0)},NO.prototype.uploadData=function(){return this.data_},NO);function NO(t,e){var n=0,r="";bO(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 AO=(Object.defineProperty(kO.prototype,"path",{get:function(){return this.path_},enumerable:!1,configurable:!0}),Object.defineProperty(kO.prototype,"isRoot",{get:function(){return 0===this.path.length},enumerable:!1,configurable:!0}),kO.prototype.fullServerUrl=function(){var t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)},kO.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},kO.makeFromBucketSpec=function(e){var t,n;try{t=kO.makeFromUrl(e)}catch(t){return new kO(e,"")}if(""===t.path)return t;throw n=e,new Uk(Vk.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")},kO.makeFromUrl=function(t){var e=null,n="([A-Za-z0-9.\\-_]+)";var r=new RegExp("^gs://"+n+"(/(.*))?$","i");function i(t){t.path_=decodeURIComponent(t.path)}for(var o=Lk.replace(/[.]/g,"\\."),s=[{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?://"+o+"/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}],a=0;a<s.length;a++){var u=s[a],c=u.regex.exec(t);if(c){e=new kO(c[u.indices.bucket],c[u.indices.path]||"");u.postModify(e);break}}if(null==e)throw n=t,new Uk(Vk.INVALID_URL,"Invalid URL '"+n+"'.");return e},kO);function kO(t,e){this.bucket=t,this.path_=e}function OO(t){var e,n;try{e=JSON.parse(t)}catch(t){return null}return yO(n=e)&&!Array.isArray(n)?e:null}function RO(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function PO(t){return"https://"+Lk+"/v0"+t}function DO(t){var e,n=encodeURIComponent,r="?";for(e in t){t.hasOwnProperty(e)&&(r=r+(n(e)+"="+n(t[e]))+"&")}return r=r.slice(0,-1)}function xO(t,e){return e}var LO=function(t,e,n,r){this.server=t,this.local=e||t,this.writable=!!n,this.xform=r||xO},MO=null;function FO(){if(MO)return MO;var t=[];t.push(new LO("bucket")),t.push(new LO("generation")),t.push(new LO("metageneration")),t.push(new LO("name","fullPath",!0));var e=new LO("name");e.xform=function(t,e){return!gO(e=e)||e.length<2?e:RO(e)},t.push(e);e=new LO("size");return e.xform=function(t,e){return pO(e)?Number(e):e},t.push(e),t.push(new LO("timeCreated")),t.push(new LO("updated")),t.push(new LO("md5Hash",null,!0)),t.push(new LO("cacheControl",null,!0)),t.push(new LO("contentDisposition",null,!0)),t.push(new LO("contentEncoding",null,!0)),t.push(new LO("contentLanguage",null,!0)),t.push(new LO("contentType",null,!0)),t.push(new LO("metadata","customMetadata",!0)),MO=t}function UO(n,r){Object.defineProperty(n,"ref",{get:function(){var t=n.bucket,e=n.fullPath,e=new AO(t,e);return r.makeStorageReference(e)}})}function jO(t,e,n){e=OO(e);if(null===e)return null;return 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 UO(r,t),r}(t,e,n)}function VO(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 qO(t){if(!yO(t)||!t)throw"Expected Metadata object.";for(var e in t)if(t.hasOwnProperty(e)){var n=t[e];if("customMetadata"===e){if(!yO(n))throw"Expected object for 'customMetadata' mapping."}else if(yO(n=n)&&null!==n)throw"Mapping for '"+e+"' cannot be an object."}}var BO="maxResults",WO=1e3,HO="pageToken",GO="prefixes",KO="items";function zO(t,e,n){n=OO(n);if(null===n)return null;return function(t,e,n){var r={prefixes:[],items:[],nextPageToken:n.nextPageToken};if(n[GO])for(var i=0,o=n[GO];i<o.length;i++){var s=o[i].replace(/\/$/,""),a=t.makeStorageReference(new AO(e,s));r.prefixes.push(a)}if(n[KO])for(var u=0,c=n[KO];u<c.length;u++){var h=c[u],a=t.makeStorageReference(new AO(e,h.name));r.items.push(a)}return r}(t,e,n)}function QO(t){if(!yO(t)||!t)throw"Expected ListOptions object.";for(var e in t)if(e===BO){if(!mO(n=t[BO])||!Number.isInteger(n)||t[BO]<=0)throw"Expected maxResults to be a positive number.";if(1e3<t[BO])throw"Expected maxResults to be less than or equal to "+WO+"."}else{if(e!==HO)throw"Unknown option: "+e;if(t[HO]&&!gO(t[HO]))throw"Expected pageToken to be string."}var n}var YO=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 XO(t){if(!t)throw Bk()}function $O(n,r){return function(t,e){return XO(null!==(e=jO(n,e,r))),e}}function JO(n,r){return function(t,e){return XO(null!==(e=zO(n,r,e))),e}}function ZO(r,i){return function(t,e){var n=jO(r,e,i);return XO(null!==n),function(r,t){if(null===(t=OO(t)))return null;if(!gO(t.downloadTokens))return null;if(0===(t=t.downloadTokens).length)return null;var i=encodeURIComponent;return t.split(",").map(function(t){var e=r.bucket,n=r.fullPath;return PO("/b/"+i(e)+"/o/"+i(n))+DO({alt:"media",token:t})})[0]}(n,e)}}function tR(i){return function(t,e){var n,r=401===t.getStatus()?new Uk(Vk.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(n=i.bucket,new Uk(Vk.QUOTA_EXCEEDED,"Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(r=i.path,new Uk(Vk.UNAUTHORIZED,"User does not have permission to access '"+r+"'.")):e;return r.setServerResponseProp(e.serverResponseProp()),r}}function eR(r){var i=tR(r);return function(t,e){var n=i(t,e);return 404===t.getStatus()&&(t=r.path,n=new Uk(Vk.OBJECT_NOT_FOUND,"Object '"+t+"' does not exist.")),n.setServerResponseProp(e.serverResponseProp()),n}}function nR(t,e,n){var r=PO(e.fullServerUrl()),i=t.maxOperationRetryTime,i=new YO(r,"GET",$O(t,n),i);return i.errorHandler=eR(e),i}function rR(t,e,n){n=Object.assign({},n);return n.fullPath=t.path,n.size=e.size(),n.contentType||(n.contentType=(t=e,(e=null)&&e.contentType||t&&t.type()||"application/octet-stream")),n}function iR(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=rR(e,r,i),i="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+VO(u,n)+"\r\n--"+a+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",a="\r\n--"+a+"--",r=CO.getBlob(i,r,a);if(null===r)throw Hk();a={name:u.fullPath},u=PO(o),o=t.maxUploadRetryTime,o=new YO(u,"POST",$O(t,n),o);return o.urlParams=a,o.headers=s,o.body=r.uploadData(),o.errorHandler=tR(e),o}var oR=function(t,e,n,r){this.current=t,this.total=e,this.finalized=!!n,this.metadata=r||null};function sR(t,e){var n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){XO(!1)}return XO(!!n&&-1!==(e||["active"]).indexOf(n)),n}function aR(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),s=rR(e,r,i),i={name:s.fullPath},o=PO(o),r={"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"},n=VO(s,n),t=t.maxUploadRetryTime;t=new YO(o,"POST",function(t){var e;sR(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){XO(!1)}return XO(gO(e)),e},t);return t.urlParams=i,t.headers=r,t.body=n,t.errorHandler=tR(e),t}function uR(t,e,n,i){t=t.maxUploadRetryTime,t=new YO(n,"POST",function(t){var e=sR(t,["active","final"]),n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){XO(!1)}n||XO(!1);var r=Number(n);return XO(!isNaN(r)),new oR(r,i.size(),"final"===e)},t);return t.headers={"X-Goog-Upload-Command":"query"},t.errorHandler=tR(e),t}function cR(t,o,e,s,n,a,r,i){var u=new oR(0,0);if(r?(u.current=r.current,u.total=r.total):(u.current=0,u.total=s.size()),s.size()!==u.total)throw new Uk(Vk.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");var c=u.total-u.current,h=c;0<n&&(h=Math.min(h,n));r=u.current,n=r+h,c={"X-Goog-Upload-Command":h===c?"upload, finalize":"upload","X-Goog-Upload-Offset":u.current},r=s.slice(r,n);if(null===r)throw Hk();n=o.maxUploadRetryTime,n=new YO(e,"POST",function(t,e){var n=sR(t,["active","final"]),r=u.current+h,i=s.size(),e="final"===n?$O(o,a)(t,e):null;return new oR(r,i,"final"===n,e)},n);return n.headers=c,n.body=r.uploadData(),n.progressCallback=i||null,n.errorHandler=tR(t),n}var hR=function(t,e,n){vO(t)||pO(e)||pO(n)?(this.next=t,this.error=e||null,this.complete=n||null):(t=t,this.next=t.next||null,this.error=t.error||null,this.complete=t.complete||null)},lR=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 fR(e,t,n){for(var r,i,o,s,a=t.length,u=t.length,c=0;c<t.length;c++)if(t[c].optional){a=c;break}if(!(a<=n.length&&n.length<=u))throw r=a,i=u,o=e,u=n.length,i=r===i?1===(s=r)?"argument":"arguments":(s="between "+r+" and "+i,"arguments"),new Uk(Vk.INVALID_ARGUMENT_COUNT,"Invalid argument count in `"+o+"`: Expected "+s+" "+i+", received "+u+".");for(c=0;c<n.length;c++)try{t[c].validator(n[c])}catch(t){throw t instanceof Error?Gk(c,e,t.message):Gk(c,e,t)}}var pR=function(e,t){var n=this;this.validator=function(t){n.optional&&!dO(t)||e(t)},this.optional=!!t};function dR(t,e){function n(t){if(!gO(t))throw"Expected string."}var r,i,t=t?(r=n,i=t,function(t){r(t),i(t)}):n;return new pR(t,e)}function vR(){return new pR(function(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer||_O()&&t instanceof Blob))throw"Expected Blob or File."})}function yR(t){return new pR(qO,t)}function gR(){return new pR(function(t){if(!(mO(t)&&0<=t))throw"Expected a number 0 or greater."})}function mR(e,t){return new pR(function(t){if(!(null===t||pO(t)&&t instanceof Object))throw"Expected an Object.";null!=e&&e(t)},t)}function bR(t){return new pR(function(t){if(!(null===t||vO(t)))throw"Expected a Function."},t)}function _R(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 wR=(ER.prototype.makeProgressCallback_=function(){var e=this,n=this.transferred_;return function(t){return e.updateProgress_(n+t)}},ER.prototype.shouldDoResumable_=function(t){return 262144<t.size()},ER.prototype.start_=function(){this.state_===iO&&null===this.request_&&(this.resumable_?null===this.uploadUrl_?this.createResumable_():this.needToFetchStatus_?this.fetchStatus_():this.needToFetchMetadata_?this.fetchMetadata_():this.continueUpload_():this.oneShotUpload_())},ER.prototype.resolveToken_=function(e){var n=this;this.service_.getAuthToken().then(function(t){switch(n.state_){case iO:e(t);break;case uO:n.transition_(cO);break;case oO:n.transition_(sO)}})},ER.prototype.createResumable_=function(){var n=this;this.resolveToken_(function(t){var e=aR(n.service_,n.location_,n.mappings_,n.blob_,n.metadata_),t=n.service_.makeRequest(e,t);(n.request_=t).getPromise().then(function(t){n.request_=null,n.uploadUrl_=t,n.needToFetchStatus_=!1,n.completeTransitions_()},n.errorHandler_)})},ER.prototype.fetchStatus_=function(){var n=this,r=this.uploadUrl_;this.resolveToken_(function(t){var e=uR(n.service_,n.location_,r,n.blob_),t=n.service_.makeRequest(e,t);(n.request_=t).getPromise().then(function(t){n.request_=null,n.updateProgress_(t.current),n.needToFetchStatus_=!1,t.finalized&&(n.needToFetchMetadata_=!0),n.completeTransitions_()},n.errorHandler_)})},ER.prototype.continueUpload_=function(){var n=this,r=262144*this.chunkMultiplier_,i=new oR(this.transferred_,this.blob_.size()),o=this.uploadUrl_;this.resolveToken_(function(t){var e;try{e=cR(n.location_,n.service_,o,n.blob_,r,n.mappings_,i,n.makeProgressCallback_())}catch(t){return n.error_=t,void n.transition_(hO)}t=n.service_.makeRequest(e,t);(n.request_=t).getPromise().then(function(t){n.increaseMultiplier_(),n.request_=null,n.updateProgress_(t.current),t.finalized?(n.metadata_=t.metadata,n.transition_(aO)):n.completeTransitions_()},n.errorHandler_)})},ER.prototype.increaseMultiplier_=function(){262144*this.chunkMultiplier_<33554432&&(this.chunkMultiplier_*=2)},ER.prototype.fetchMetadata_=function(){var n=this;this.resolveToken_(function(t){var e=nR(n.service_,n.location_,n.mappings_),t=n.service_.makeRequest(e,t);(n.request_=t).getPromise().then(function(t){n.request_=null,n.metadata_=t,n.transition_(aO)},n.metadataErrorHandler_)})},ER.prototype.oneShotUpload_=function(){var n=this;this.resolveToken_(function(t){var e=iR(n.service_,n.location_,n.mappings_,n.blob_,n.metadata_),t=n.service_.makeRequest(e,t);(n.request_=t).getPromise().then(function(t){n.request_=null,n.metadata_=t,n.updateProgress_(n.blob_.size()),n.transition_(aO)},n.errorHandler_)})},ER.prototype.updateProgress_=function(t){var e=this.transferred_;this.transferred_=t,this.transferred_!==e&&this.notifyObservers_()},ER.prototype.transition_=function(t){if(this.state_!==t)switch(t){case uO:case oO:this.state_=t,null!==this.request_&&this.request_.cancel();break;case iO:var e=this.state_===sO;this.state_=t,e&&(this.notifyObservers_(),this.start_());break;case sO:this.state_=t,this.notifyObservers_();break;case cO:this.error_=Wk(),this.state_=t,this.notifyObservers_();break;case hO:case aO:this.state_=t,this.notifyObservers_()}},ER.prototype.completeTransitions_=function(){switch(this.state_){case oO:this.transition_(sO);break;case uO:this.transition_(cO);break;case iO:this.start_()}},Object.defineProperty(ER.prototype,"snapshot",{get:function(){var t=fO(this.state_);return new lR(this.transferred_,this.blob_.size(),t,this.metadata_,this,this.ref_)},enumerable:!1,configurable:!0}),ER.prototype.on=function(t,e,n,o){var r="Expected a function or an Object with one of `next`, `error`, `complete` properties.",i=bR(!0).validator,s=mR(null,!0).validator;function a(t){try{return void i(t)}catch(t){}try{if(s(t),!(dO(t.next)||dO(t.error)||dO(t.complete)))throw"";return}catch(t){throw r}}fR("on",[dR(function(){if(t!==rO.STATE_CHANGED)throw"Expected one of the event types: ["+rO.STATE_CHANGED+"]."}),mR(a,!0),bR(!0),bR(!0)],arguments);var u=this;function c(i){return function(t,e,n){null!==i&&fR("on",i,arguments);var r=new hR(t,e,o);return u.addObserver_(r),function(){u.removeObserver_(r)}}}var h=[mR(function(t){if(null===t)throw r;a(t)}),bR(!0),bR(!0)];return!(dO(e)||dO(n)||dO(o))?c(h):c(null)(e,n,o)},ER.prototype.then=function(t,e){return this.promise_.then(t,e)},ER.prototype.catch=function(t){return this.then(null,t)},ER.prototype.addObserver_=function(t){this.observers_.push(t),this.notifyObserver_(t)},ER.prototype.removeObserver_=function(t){t=this.observers_.indexOf(t);-1!==t&&this.observers_.splice(t,1)},ER.prototype.notifyObservers_=function(){var e=this;this.finishPromise_(),this.observers_.slice().forEach(function(t){e.notifyObserver_(t)})},ER.prototype.finishPromise_=function(){if(null!==this.resolve_){var t=!0;switch(fO(this.state_)){case lO.SUCCESS:_R(this.resolve_.bind(null,this.snapshot))();break;case lO.CANCELED:case lO.ERROR:_R(this.reject_.bind(null,this.error_))();break;default:t=!1}t&&(this.resolve_=null,this.reject_=null)}},ER.prototype.notifyObserver_=function(t){switch(fO(this.state_)){case lO.RUNNING:case lO.PAUSED:t.next&&_R(t.next.bind(t,this.snapshot))();break;case lO.SUCCESS:t.complete&&_R(t.complete.bind(t))();break;case lO.CANCELED:case lO.ERROR:t.error&&_R(t.error.bind(t,this.error_))();break;default:t.error&&_R(t.error.bind(t,this.error_))()}},ER.prototype.resume=function(){fR("resume",[],arguments);var t=this.state_===sO||this.state_===oO;return t&&this.transition_(iO),t},ER.prototype.pause=function(){fR("pause",[],arguments);var t=this.state_===iO;return t&&this.transition_(oO),t},ER.prototype.cancel=function(){fR("cancel",[],arguments);var t=this.state_===iO||this.state_===oO;return t&&this.transition_(uO),t},ER);function ER(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.service_=e,this.location_=n,this.blob_=i,this.metadata_=o,this.mappings_=r,this.resumable_=this.shouldDoResumable_(this.blob_),this.state_=iO,this.errorHandler_=function(t){s.request_=null,s.chunkMultiplier_=1,t.codeEquals(Vk.CANCELED)?(s.needToFetchStatus_=!0,s.completeTransitions_()):(s.error_=t,s.transition_(hO))},this.metadataErrorHandler_=function(t){s.request_=null,t.codeEquals(Vk.CANCELED)?s.completeTransitions_():(s.error_=t,s.transition_(hO))},this.promise_=new Promise(function(t,e){s.resolve_=t,s.reject_=e,s.start_()}),this.promise_.then(null,function(){})}var IR=(TR.prototype.toString=function(){return fR("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},TR.prototype.newRef=function(t,e){return new TR(t,e)},TR.prototype.mappings=FO,TR.prototype.child=function(t){fR("child",[dR()],arguments);var e,t=(e=this.location.path,t=(t=t).split("/").filter(function(t){return 0<t.length}).join("/"),0===e.length?t:e+"/"+t),t=new AO(this.location.bucket,t);return this.newRef(this.service,t)},Object.defineProperty(TR.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;t=new AO(this.location.bucket,t);return this.newRef(this.service,t)},enumerable:!1,configurable:!0}),Object.defineProperty(TR.prototype,"root",{get:function(){var t=new AO(this.location.bucket,"");return this.newRef(this.service,t)},enumerable:!1,configurable:!0}),Object.defineProperty(TR.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!1,configurable:!0}),Object.defineProperty(TR.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!1,configurable:!0}),Object.defineProperty(TR.prototype,"name",{get:function(){return RO(this.location.path)},enumerable:!1,configurable:!0}),Object.defineProperty(TR.prototype,"storage",{get:function(){return this.service},enumerable:!1,configurable:!0}),TR.prototype.put=function(t,e){return void 0===e&&(e=null),fR("put",[vR(),yR(!0)],arguments),this.throwIfRoot_("put"),new wR(this,this.service,this.location,this.mappings(),new CO(t),e)},TR.prototype.putString=function(t,e,n){void 0===e&&(e=Yk.RAW),fR("putString",[dR(),dR(Xk,!0),yR(!0)],arguments),this.throwIfRoot_("putString");t=Jk(e,t),n=Object.assign({},n);return!pO(n.contentType)&&pO(t.contentType)&&(n.contentType=t.contentType),new wR(this,this.service,this.location,this.mappings(),new CO(t.data,!0),n)},TR.prototype.delete=function(){var i=this;return fR("delete",[],arguments),this.throwIfRoot_("delete"),this.service.getAuthToken().then(function(t){var e,n,r,e=(e=i.service,n=i.location,r=PO(n.fullServerUrl()),e=e.maxOperationRetryTime,(e=new YO(r,"DELETE",function(t,e){},e)).successCodes=[200,204],e.errorHandler=eR(n),e);return i.service.makeRequest(e,t).getPromise()})},TR.prototype.listAll=function(){fR("listAll",[],arguments);var t={prefixes:[],items:[]};return this.listAllHelper(t).then(function(){return t})},TR.prototype.listAllHelper=function(r,i){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return n={pageToken:i},[4,this.list(n)];case 1:return e=t.sent(),(n=r.prefixes).push.apply(n,e.prefixes),(n=r.items).push.apply(n,e.items),null==e.nextPageToken?[3,3]:[4,this.listAllHelper(r,e.nextPageToken)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},TR.prototype.list=function(a){fR("list",[new pR(QO,!0)],arguments);var u=this;return this.service.getAuthToken().then(function(t){var e,n,r,i,o,s=a||{},o=(e=u.service,n=u.location,r="/",i=s.pageToken,o=s.maxResults,s={},n.isRoot?s.prefix="":s.prefix=n.path+"/",r&&0<r.length&&(s.delimiter=r),i&&(s.pageToken=i),o&&(s.maxResults=o),i=PO(n.bucketOnlyServerUrl()),o=e.maxOperationRetryTime,(o=new YO(i,"GET",JO(e,n.bucket),o)).urlParams=s,o.errorHandler=tR(n),o);return u.service.makeRequest(o,t).getPromise()})},TR.prototype.getMetadata=function(){var n=this;return fR("getMetadata",[],arguments),this.throwIfRoot_("getMetadata"),this.service.getAuthToken().then(function(t){var e=nR(n.service,n.location,n.mappings());return n.service.makeRequest(e,t).getPromise()})},TR.prototype.updateMetadata=function(a){var u=this;return fR("updateMetadata",[yR()],arguments),this.throwIfRoot_("updateMetadata"),this.service.getAuthToken().then(function(t){var e,n,r,i,o,s,r=(e=u.service,n=u.location,r=a,i=u.mappings(),o=PO(n.fullServerUrl()),s=VO(r,i),r=e.maxOperationRetryTime,(r=new YO(o,"PATCH",$O(e,i),r)).headers={"Content-Type":"application/json; charset=utf-8"},r.body=s,r.errorHandler=eR(n),r);return u.service.makeRequest(r,t).getPromise()})},TR.prototype.getDownloadURL=function(){var s=this;return fR("getDownloadURL",[],arguments),this.throwIfRoot_("getDownloadURL"),this.service.getAuthToken().then(function(t){var e,n,r,i,o,o=(e=s.service,n=s.location,r=s.mappings(),i=PO(n.fullServerUrl()),o=e.maxOperationRetryTime,(o=new YO(i,"GET",ZO(e,r),o)).errorHandler=eR(n),o);return s.service.makeRequest(o,t).getPromise().then(function(t){if(null===t)throw new Uk(Vk.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return t})})},TR.prototype.throwIfRoot_=function(t){if(""===this.location.path)throw t=t,new Uk(Vk.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")},TR);function TR(t,e){this.service=t,this.location=e instanceof AO?e:AO.makeFromUrl(e)}var SR=(CR.prototype.getPromise=function(){return this.promise_},CR.prototype.cancel=function(t){},CR);function CR(t){this.promise_=Promise.reject(t)}var NR=(AR.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());dO(s)?r(s):r()}catch(t){i(t)}else null!==o?((n=Bk()).setServerResponseProp(o.getResponseText()),c.errorCallback_?i(c.errorCallback_(o,n)):i(n)):e.canceled?i(n=(c.appDelete_?Kk:Wk)()):i(n=new Uk(Vk.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,To([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 kR(!1,null,!0)):this.backoffId_=(e=function(r,t){function i(t){var e=t.loaded,t=t.lengthComputable?t.total:-1;null!==c.progressCallback_&&c.progressCallback_(e,t)}t?r(!1,new kR(!1,null,!0)):(t=c.pool_.createXhrIo(),c.pendingXhr_=t,null!==c.progressCallback_&&t.addUploadProgressListener(i),t.send(c.url_,c.method_,c.body_,c.headers_).then(function(t){null!==c.progressCallback_&&t.removeUploadProgressListener(i),c.pendingXhr_=null;var e=t.getErrorCode()===nO.NO_ERROR,n=t.getStatus();e&&!c.isRetryStatusCode_(n)?(n=-1!==c.successCodes_.indexOf(n),r(!0,new kR(n,t))):(t=t.getErrorCode()===nO.ABORT,r(!1,new kR(!1,null,t)))}))},n=h,t=this.timeout_,i=null,u=a=o=!(r=1),p(s=0),setTimeout(function(){v(o=!0)},t),v)},AR.prototype.getPromise=function(){return this.promise_},AR.prototype.cancel=function(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingXhr_&&this.pendingXhr_.abort()},AR.prototype.isRetryStatusCode_=function(t){var e=500<=t&&t<600,n=-1!==[408,429].indexOf(t),t=-1!==this.additionalRetryCodes_.indexOf(t);return e||n||t},AR);function AR(t,e,n,r,i,o,s,a,u,c,h){var l=this;this.pendingXhr_=null,this.backoffId_=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 kR=function(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n};function OR(t,e,n,r){var i=DO(t.urlParams),o=t.url+i,s=Object.assign({},t.headers);return i=s,(e=e)&&(i["X-Firebase-GMPID"]=e),e=s,null!==(n=n)&&0<n.length&&(e.Authorization="Firebase "+n),e=s,n=void 0!==Bl?Bl.SDK_VERSION:"AppManager",e["X-Firebase-Storage-Version"]="webjs/"+n,new NR(o,t.method,s,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,r)}var RR=(PR.extractBucket_=function(t){t=null==t?void 0:t.storageBucket;return null==t?null:AO.makeFromBucketSpec(t)},PR.prototype.getAuthToken=function(){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return(e=this.authProvider_.getImmediate({optional:!0}))?[4,e.getToken()]:[3,2];case 1:if(null!==(e=t.sent()))return[2,e.accessToken];t.label=2;case 2:return[2,null]}})})},PR.prototype.deleteApp=function(){this.deleted_=!0,this.app_=null,this.requests_.forEach(function(t){return t.cancel()}),this.requests_.clear()},PR.prototype.makeStorageReference=function(t){return new IR(this,t)},PR.prototype.makeRequest=function(t,e){var n=this;if(this.deleted_)return new SR(Kk());var r=OR(t,this.appId_,e,this.pool_);return this.requests_.add(r),r.getPromise().then(function(){return n.requests_.delete(r)},function(){return n.requests_.delete(r)}),r},PR.prototype.ref=function(t){if(fR("ref",[dR(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 IR(this,this.bucket_);return null!=t?e.child(t):e},PR.prototype.refFromURL=function(t){return fR("refFromURL",[dR(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{AO.makeFromUrl(t)}catch(t){throw"Expected valid full URL but got an invalid one."}},!1)],arguments),new IR(this,t)},Object.defineProperty(PR.prototype,"maxUploadRetryTime",{get:function(){return this.maxUploadRetryTime_},enumerable:!1,configurable:!0}),PR.prototype.setMaxUploadRetryTime=function(t){fR("setMaxUploadRetryTime",[gR()],arguments),this.maxUploadRetryTime_=t},Object.defineProperty(PR.prototype,"maxOperationRetryTime",{get:function(){return this.maxOperationRetryTime_},enumerable:!1,configurable:!0}),PR.prototype.setMaxOperationRetryTime=function(t){fR("setMaxOperationRetryTime",[gR()],arguments),this.maxOperationRetryTime_=t},Object.defineProperty(PR.prototype,"app",{get:function(){return this.app_},enumerable:!1,configurable:!0}),Object.defineProperty(PR.prototype,"INTERNAL",{get:function(){return this.internals_},enumerable:!1,configurable:!0}),PR);function PR(t,e,n,r){this.bucket_=null,this.appId_=null,this.deleted_=!1,this.app_=t,this.authProvider_=e,this.maxOperationRetryTime_=Mk,this.maxUploadRetryTime_=Fk,this.requests_=new Set,this.pool_=n,this.bucket_=null!=r?AO.makeFromBucketSpec(r):PR.extractBucket_(null===(r=this.app_)||void 0===r?void 0:r.options),this.internals_=new DR(this)}var DR=(xR.prototype.delete=function(){return this.service_.deleteApp(),Promise.resolve()},xR);function xR(t){this.service_=t}var LR,MR;function FR(t,e){var n=t.getProvider("app").getImmediate(),t=t.getProvider("auth-internal");return new RR(n,t,new IO,e)}MR={TaskState:lO,TaskEvent:rO,StringFormat:Yk,Storage:RR,Reference:IR},(LR=Bl).INTERNAL.registerComponent(new bs("storage",FR,"PUBLIC").setServiceProps(MR).setMultipleInstances(!0)),LR.registerVersion("@firebase/storage","0.3.43");var UR,jR,VR="0.4.2",qR="FB-PERF-TRACE-MEASURE",BR="@firebase/performance/config",WR="@firebase/performance/configexpire",M="Performance",K=((K={})["trace started"]="Trace {$traceName} was started before.",K["trace stopped"]="Trace {$traceName} is not running.",K["nonpositive trace startTime"]="Trace {$traceName} startTime should be positive.",K["nonpositive trace duration"]="Trace {$traceName} duration should be positive.",K["no window"]="Window is not available.",K["no app id"]="App id is not available.",K["no project id"]="Project id is not available.",K["no api key"]="Api key is not available.",K["invalid cc log"]="Attempted to queue invalid cc event",K["FB not default"]="Performance can only start when Firebase app instance is the default one.",K["RC response not ok"]="RC response is not ok",K["invalid attribute name"]="Attribute name {$attributeName} is invalid.",K["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",K["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",K["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",K),HR=new zo("performance",M,K),GR=new Ds(M);GR.logLevel=Ns.INFO;var KR,zR=(QR.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},QR.prototype.mark=function(t){this.performance&&this.performance.mark&&this.performance.mark(t)},QR.prototype.measure=function(t,e,n){this.performance&&this.performance.measure&&this.performance.measure(t,e,n)},QR.prototype.getEntriesByType=function(t){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(t):[]},QR.prototype.getEntriesByName=function(t){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(t):[]},QR.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},QR.prototype.requiredApisAvailable=function(){return fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled?!!Vo()||(GR.info("IndexedDB is not supported by current browswer"),!1):(GR.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)},QR.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]})},QR.getInstance=function(){return void 0===UR&&(UR=new QR(jR)),UR},QR);function QR(t){if(!(this.window=t))throw HR.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 YR(t,e){var n=t.length-e.length;if(n<0||1<n)throw HR.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 XR,$R,JR=(ZR.prototype.getAppId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!t)throw HR.create("no app id");return t},ZR.prototype.getProjectId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!t)throw HR.create("no project id");return t},ZR.prototype.getApiKey=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!t)throw HR.create("no api key");return t},ZR.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},ZR.getInstance=function(){return void 0===KR&&(KR=new ZR),KR},ZR);function ZR(){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=YR("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=YR("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}(M=$R=$R||{})[M.UNKNOWN=0]="UNKNOWN",M[M.VISIBLE=1]="VISIBLE",M[M.HIDDEN=2]="HIDDEN";var tP=["firebase_","google_","ga_"],eP=new RegExp("^[a-zA-Z]\\w*$");function nP(){switch(zR.getInstance().document.visibilityState){case"visible":return $R.VISIBLE;case"hidden":return $R.HIDDEN;default:return $R.UNKNOWN}}var rP="0.0.1",iP={loggingEnabled:!0},oP="FIREBASE_INSTALLATIONS_AUTH";function sP(t){var n,e=function(){var t=zR.getInstance().localStorage;if(!t)return;var e=t.getItem(WR);if(!e||!function(t){return Number(t)>Date.now()}(e))return;var n=t.getItem(BR);if(!n)return;try{return JSON.parse(n)}catch(t){return}}();return e?(uP(e),Promise.resolve()):(n=t,function(){var t=JR.getInstance().installationsService.getToken();return t.then(function(t){}),t}().then(function(t){var e="https://firebaseremoteconfig.googleapis.com/v1/projects/"+JR.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+JR.getInstance().getApiKey(),t=new Request(e,{method:"POST",headers:{Authorization:oP+" "+t},body:JSON.stringify({app_instance_id:n,app_instance_id_token:t,app_id:JR.getInstance().getAppId(),app_version:VR,sdk_version:rP})});return fetch(t).then(function(t){if(t.ok)return t.json();throw HR.create("RC response not ok")})}).catch(function(){GR.info(aP)}).then(uP).then(function(t){var e=zR.getInstance().localStorage;if(!t||!e)return;e.setItem(BR,JSON.stringify(t)),e.setItem(WR,String(Date.now()+60*JR.getInstance().configTimeToLive*60*1e3))},function(){}))}var aP="Could not fetch config, will use default configs";function uP(t){if(!t)return t;var e=JR.getInstance(),n=t.entries||{};return e.loggingEnabled=void 0!==n.fpr_enabled?"true"===String(n.fpr_enabled):iP.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=cP(e.tracesSamplingRate),e.logNetworkAfterSampling=cP(e.networkRequestsSamplingRate),t}function cP(t){return Math.random()<=t}var hP,lP=1;function fP(){return lP=2,hP=hP||function(){var n=zR.getInstance().document;return new Promise(function(t){var e;n&&"complete"!==n.readyState?(e=function(){"complete"===n.readyState&&(n.removeEventListener("readystatechange",e),t())},n.addEventListener("readystatechange",e)):t()})}().then(function(){return(t=JR.getInstance().installationsService.getId()).then(function(t){XR=t}),t;var t}).then(sP).then(pP,pP)}function pP(){lP=3}var dP,vP=1e4,yP=5500,gP=3,mP=gP,bP=[],_P=!1;function wP(t){setTimeout(function(){if(0!==mP)return bP.length?void function(){var t=To(bP);bP=[];var e=t.map(function(t){return{source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)}});(function(t,r){return function(t){var e=JR.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then(function(t){return t.ok||GR.info("Call to Firebase backend failed."),t.json()}).then(function(t){var e=Number(t.nextRequestWaitMillis),n=vP;isNaN(e)||(n=Math.max(e,n));t=t.logResponseDetails;Array.isArray(t)&&0<t.length&&"RETRY_REQUEST_LATER"===t[0].responseAction&&(bP=To(r,bP),GR.info("Retry transport request later.")),mP=gP,wP(n)})})({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:JR.getInstance().logSource,log_event:e},t).catch(function(){bP=To(t,bP),mP--,GR.info("Tries left: "+mP+"."),wP(vP)})}():wP(vP)},t)}function EP(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];!function(t){if(!t.eventTime||!t.message)throw HR.create("invalid cc log");bP=To(bP,[t])}({message:n.apply(void 0,t),eventTime:Date.now()})}}function IP(t,e){(dP=dP||EP(CP))(t,e)}function TP(t){var e=JR.getInstance();!e.instrumentationEnabled&&t.isAuto||(e.dataCollectionEnabled||t.isAuto)&&zR.getInstance().requiredApisAvailable()&&(t.isAuto&&nP()!==$R.VISIBLE||(3===lP?SP(t):fP().then(function(){return SP(t)},function(){return SP(t)})))}function SP(t){var e;!XR||(e=JR.getInstance()).loggingEnabled&&e.logTraceAfterSampling&&setTimeout(function(){return IP(t,1)},0)}function CP(t,e){return(0===e?function(t){t={url:t.url,http_method:t.httpMethod||0,http_response_code:200,response_payload_bytes:t.responsePayloadBytes,client_start_time_us:t.startTimeUs,time_to_response_initiated_us:t.timeToResponseInitiatedUs,time_to_response_completed_us:t.timeToResponseCompletedUs},t={application_info:NP(),network_request_metric:t};return JSON.stringify(t)}:function(t){var e={name:t.name,is_auto:t.isAuto,client_start_time_us:t.startTimeUs,duration_us:t.durationUs};0!==Object.keys(t.counters).length&&(e.counters=t.counters);t=t.getAttributes();0!==Object.keys(t).length&&(e.custom_attributes=t);e={application_info:NP(),trace_metric:e};return JSON.stringify(e)})(t)}function NP(){return{google_app_id:JR.getInstance().getAppId(),app_instance_id:XR,web_app_info:{sdk_version:VR,page_url:zR.getInstance().getUrl(),service_worker_status:"serviceWorker"in(t=zR.getInstance().navigator)?t.serviceWorker.controller?2:3:1,visibility_state:nP(),effective_connection_type:function(){var t=zR.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 AP=["_fp","_fcp","_fid"];var kP=(OP.prototype.start=function(){if(1!==this.state)throw HR.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},OP.prototype.stop=function(){if(2!==this.state)throw HR.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(),TP(this)},OP.prototype.record=function(t,e,n){if(t<=0)throw HR.create("nonpositive trace startTime",{traceName:this.name});if(e<=0)throw HR.create("nonpositive trace duration",{traceName:this.name});if(this.durationUs=Math.floor(1e3*e),this.startTimeUs=Math.floor(1e3*t),n&&n.attributes&&(this.customAttributes=mo({},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])))}TP(this)},OP.prototype.incrementMetric=function(t,e){void 0===e&&(e=1),void 0===this.counters[t]?this.putMetric(t,e):this.putMetric(t,this.counters[t]+e)},OP.prototype.putMetric=function(t,e){if(n=t,r=this.name,0===n.length||100<n.length||!(r&&r.startsWith("_wt_")&&-1<AP.indexOf(n))&&n.startsWith("_"))throw HR.create("invalid custom metric name",{customMetricName:t});var n,r;this.counters[t]=(t=e,(e=Math.floor(t))<t&&GR.info("Metric value should be an Integer, setting the value as : "+e+"."),e)},OP.prototype.getMetric=function(t){return this.counters[t]||0},OP.prototype.putAttribute=function(t,e){var n,r,i=!(0===(n=t).length||40<n.length)&&(!tP.some(function(t){return n.startsWith(t)})&&!!n.match(eP)),r=0!==(r=e).length&&r.length<=100;if(i&&r)this.customAttributes[t]=e;else{if(!i)throw HR.create("invalid attribute name",{attributeName:t});if(!r)throw HR.create("invalid attribute value",{attributeValue:e})}},OP.prototype.getAttribute=function(t){return this.customAttributes[t]},OP.prototype.removeAttribute=function(t){void 0!==this.customAttributes[t]&&delete this.customAttributes[t]},OP.prototype.getAttributes=function(){return mo({},this.customAttributes)},OP.prototype.setStartTime=function(t){this.startTimeUs=t},OP.prototype.setDuration=function(t){this.durationUs=t},OP.prototype.calculateTraceMetrics=function(){var t=this.api.getEntriesByName(this.traceMeasure),t=t&&t[0];t&&(this.durationUs=Math.floor(1e3*t.duration),this.startTimeUs=Math.floor(1e3*(t.startTime+this.api.getTimeOrigin())))},OP.createOobTrace=function(t,e,n){var r,i=zR.getInstance().getUrl();i&&(r=new OP("_wt_"+i,!0),i=Math.floor(1e3*zR.getInstance().getTimeOrigin()),r.setStartTime(i),t&&t[0]&&(r.setDuration(Math.floor(1e3*t[0].duration)),r.putMetric("domInteractive",Math.floor(1e3*t[0].domInteractive)),r.putMetric("domContentLoadedEventEnd",Math.floor(1e3*t[0].domContentLoadedEventEnd)),r.putMetric("loadEventEnd",Math.floor(1e3*t[0].loadEventEnd))),e&&((t=e.find(function(t){return"first-paint"===t.name}))&&t.startTime&&r.putMetric("_fp",Math.floor(1e3*t.startTime)),(e=e.find(function(t){return"first-contentful-paint"===t.name}))&&e.startTime&&r.putMetric("_fcp",Math.floor(1e3*e.startTime)),n&&r.putMetric("_fid",Math.floor(1e3*n))),TP(r))},OP.createUserTimingTrace=function(t){TP(new OP(t,!1,t))},OP);function OP(t,e,n){void 0===e&&(e=!1),this.name=t,this.isAuto=e,this.state=1,this.customAttributes={},this.counters={},this.api=zR.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||qR+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}function RP(t){var e,n,r,i=t;i&&void 0!==i.responseStart&&(n=zR.getInstance().getTimeOrigin(),r=Math.floor(1e3*(i.startTime+n)),t=i.responseStart?Math.floor(1e3*(i.responseStart-i.startTime)):void 0,n=Math.floor(1e3*(i.responseEnd-i.startTime)),i={url:i.name&&i.name.split("?")[0],responsePayloadBytes:i.transferSize,startTimeUs:r,timeToResponseInitiatedUs:t,timeToResponseCompletedUs:n},e=i,(r=JR.getInstance()).instrumentationEnabled&&(t=e.url,n=r.logEndPointUrl.split("?")[0],i=r.flTransportEndpointUrl.split("?")[0],t!==n&&t!==i&&r.loggingEnabled&&r.logNetworkAfterSampling&&setTimeout(function(){return IP(e,0)},0)))}var PP=5e3;function DP(){XR&&(setTimeout(function(){var t=zR.getInstance(),e=t.getEntriesByType("navigation"),n=t.getEntriesByType("paint");{var r;t.onFirstInputDelay?(r=setTimeout(function(){kP.createOobTrace(e,n),r=void 0},PP),t.onFirstInputDelay(function(t){r&&(clearTimeout(r),kP.createOobTrace(e,n,t))})):kP.createOobTrace(e,n)}},0),setTimeout(function(){for(var t=zR.getInstance(),e=t.getEntriesByType("resource"),n=0,r=e;n<r.length;n++){RP(r[n])}t.setupObserver("resource",RP)},0),setTimeout(function(){for(var t=zR.getInstance(),e=t.getEntriesByType("measure"),n=0,r=e;n<r.length;n++){xP(r[n])}t.setupObserver("measure",xP)},0))}function xP(t){t=t.name;t.substring(0,qR.length)!==qR&&kP.createUserTimingTrace(t)}var LP=(MP.prototype.trace=function(t){return new kP(t)},Object.defineProperty(MP.prototype,"instrumentationEnabled",{get:function(){return JR.getInstance().instrumentationEnabled},set:function(t){JR.getInstance().instrumentationEnabled=t},enumerable:!1,configurable:!0}),Object.defineProperty(MP.prototype,"dataCollectionEnabled",{get:function(){return JR.getInstance().dataCollectionEnabled},set:function(t){JR.getInstance().dataCollectionEnabled=t},enumerable:!1,configurable:!0}),MP);function MP(t){this.app=t,zR.getInstance().requiredApisAvailable()&&qo().then(function(t){t&&(_P||(wP(yP),_P=!0),fP().then(DP,DP))}).catch(function(t){GR.info("Environment doesn't support IndexedDB: "+t)})}var FP;function UP(t,e){if("[DEFAULT]"!==t.name)throw HR.create("FB not default");if("undefined"==typeof window)throw HR.create("no window");return jR=window,JR.getInstance().firebaseAppInstance=t,JR.getInstance().installationsService=e,new LP(t)}(FP=Bl).INTERNAL.registerComponent(new bs("performance",function(t){var e=t.getProvider("app").getImmediate(),t=t.getProvider("installations").getImmediate();return UP(e,t)},"PUBLIC")),FP.registerVersion("@firebase/performance","0.4.2");var jP,VP,qP="firebase_id",BP="origin",WP=6e4,HP="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig",GP="https://www.googletagmanager.com/gtag/js";(M=jP=jP||{}).EVENT="event",M.SET="set",M.CONFIG="config",(M=VP=VP||{}).ADD_SHIPPING_INFO="add_shipping_info",M.ADD_PAYMENT_INFO="add_payment_info",M.ADD_TO_CART="add_to_cart",M.ADD_TO_WISHLIST="add_to_wishlist",M.BEGIN_CHECKOUT="begin_checkout",M.CHECKOUT_PROGRESS="checkout_progress",M.EXCEPTION="exception",M.GENERATE_LEAD="generate_lead",M.LOGIN="login",M.PAGE_VIEW="page_view",M.PURCHASE="purchase",M.REFUND="refund",M.REMOVE_FROM_CART="remove_from_cart",M.SCREEN_VIEW="screen_view",M.SEARCH="search",M.SELECT_CONTENT="select_content",M.SELECT_ITEM="select_item",M.SELECT_PROMOTION="select_promotion",M.SET_CHECKOUT_OPTION="set_checkout_option",M.SHARE="share",M.SIGN_UP="sign_up",M.TIMING_COMPLETE="timing_complete",M.VIEW_CART="view_cart",M.VIEW_ITEM="view_item",M.VIEW_ITEM_LIST="view_item_list",M.VIEW_PROMOTION="view_promotion",M.VIEW_SEARCH_RESULTS="view_search_results";var KP=new Ds("@firebase/analytics");function zP(o,s,a,u){return function(n,r,i){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return t.trys.push([0,6,,7]),n!==jP.EVENT?[3,2]:[4,function(u,c,h,l,f){return bo(this,void 0,void 0,function(){var n,r,e,i,o,s,a;return _o(this,function(t){switch(t.label){case 0:return(t.trys.push([0,4,,5]),n=[],f&&f.send_to)?(a=f.send_to,Array.isArray(a)||(a=[a]),[4,Promise.all(h)]):[3,2];case 1:for(r=t.sent(),e=function(e){var t=r.find(function(t){return t.measurementId===e}),t=t&&c[t.appId];if(!t)return n=[],"break";n.push(t)},i=0,o=a;i<o.length&&(s=o[i],"break"!==e(s));i++);t.label=2;case 2:return 0===n.length&&(n=Object.values(c)),[4,Promise.all(n)];case 3:return t.sent(),u(jP.EVENT,l,f||{}),[3,5];case 4:return a=t.sent(),KP.error(a),[3,5];case 5:return[2]}})})}(o,s,a,r,i)];case 1:return t.sent(),[3,5];case 2:return n!==jP.CONFIG?[3,4]:[4,function(r,i,o,s,a,u){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:e=s[a],t.label=1;case 1:return t.trys.push([1,7,,8]),e?[4,i[e]]:[3,3];case 2:return t.sent(),[3,6];case 3:return[4,Promise.all(o)];case 4:return n=t.sent(),(n=n.find(function(t){return t.measurementId===a}))?[4,i[n.appId]]:[3,6];case 5:t.sent(),t.label=6;case 6:return[3,8];case 7:return n=t.sent(),KP.error(n),[3,8];case 8:return r(jP.CONFIG,a,u),[2]}})})}(o,s,a,u,r,i)];case 3:return t.sent(),[3,5];case 4:o(jP.SET,r),t.label=5;case 5:return[3,7];case 6:return e=t.sent(),KP.error(e),[3,7];case 7:return[2]}})})}}var M=((M={})["already-exists"]="A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.",M["already-initialized"]="Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.",M["interop-component-reg-failed"]="Firebase Analytics Interop Component failed to instantiate: {$reason}",M["invalid-analytics-context"]="Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}",M["indexeddb-unavailable"]="IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}",M["fetch-throttle"]="The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.",M["config-fetch-failed"]="Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}",M["no-api-key"]='The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',M["no-app-id"]='The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',M),QP=new zo("analytics","Analytics",M),YP=30;function XP(t,e){void 0===t&&(t={}),void 0===e&&(e=1e3),this.throttleMetadata=t,this.intervalMillis=e}var $P=new(XP.prototype.getThrottleMetadata=function(t){return this.throttleMetadata[t]},XP.prototype.setThrottleMetadata=function(t,e){this.throttleMetadata[t]=e},XP.prototype.deleteThrottleMetadata=function(t){delete this.throttleMetadata[t]},XP);function JP(o){var s;return bo(this,void 0,void 0,function(){var e,n,r,i;return _o(this,function(t){switch(t.label){case 0:return e=o.appId,i=o.apiKey,i={method:"GET",headers:new Headers({Accept:"application/json","x-goog-api-key":i})},e=HP.replace("{app-id}",e),[4,fetch(e,i)];case 1:if(200===(n=t.sent()).status||304===n.status)return[3,6];r="",t.label=2;case 2:return t.trys.push([2,4,,5]),[4,n.json()];case 3:return i=t.sent(),null!==(s=i.error)&&void 0!==s&&s.message&&(r=i.error.message),[3,5];case 4:return t.sent(),[3,5];case 5:throw QP.create("config-fetch-failed",{httpStatus:n.status,responseMessage:r});case 6:return[2,n.json()]}})})}function ZP(a,u,c){return void 0===u&&(u=$P),bo(this,void 0,void 0,function(){var e,n,r,i,o,s=this;return _o(this,function(t){if(i=a.options,e=i.appId,n=i.apiKey,r=i.measurementId,!e)throw QP.create("no-app-id");if(n)return i=u.getThrottleMetadata(e)||{backoffCount:0,throttleEndTimeMillis:Date.now()},o=new eD,setTimeout(function(){return bo(s,void 0,void 0,function(){return _o(this,function(t){return o.abort(),[2]})})},void 0!==c?c:WP),[2,function u(c,t,h,l){var f=t.throttleEndTimeMillis,p=t.backoffCount;void 0===l&&(l=$P);return bo(this,void 0,void 0,function(){var e,n,r,s,a;return _o(this,function(t){switch(t.label){case 0:e=c.appId,n=c.measurementId,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,(i=h,o=f,new Promise(function(t,e){var n=Math.max(o-Date.now(),0),r=setTimeout(t,n);i.addEventListener(function(){clearTimeout(r),e(QP.create("fetch-throttle",{throttleEndTimeMillis:o}))})}))];case 2:return t.sent(),[3,4];case 3:if(s=t.sent(),n)return KP.warn("Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID "+n+' provided in the "measurementId" field in the local Firebase config. ['+s.message+"]"),[2,{appId:e,measurementId:n}];throw s;case 4:return t.trys.push([4,6,,7]),[4,JP(c)];case 5:return a=t.sent(),l.deleteThrottleMetadata(e),[2,a];case 6:if(tD(r=t.sent()))return s=503===Number(r.httpStatus)?ms(p,l.intervalMillis,YP):ms(p,l.intervalMillis),a={throttleEndTimeMillis:Date.now()+s,backoffCount:p+1},l.setThrottleMetadata(e,a),KP.debug("Calling attemptFetch again in "+s+" millis"),[2,u(c,a,h,l)];if(l.deleteThrottleMetadata(e),n)return KP.warn("Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID "+n+' provided in the "measurementId" field in the local Firebase config. ['+r.message+"]"),[2,{appId:e,measurementId:n}];throw r;case 7:return[2]}var i,o})})}({appId:e,apiKey:n,measurementId:r},i,o,u)];if(r)return[2,{measurementId:r,appId:e}];throw QP.create("no-api-key")})})}function tD(t){if(t instanceof Go){t=Number(t.httpStatus);return 429===t||500===t||503===t||504===t}}var eD=(nD.prototype.addEventListener=function(t){this.listeners.push(t)},nD.prototype.abort=function(){this.listeners.forEach(function(t){return t()})},nD);function nD(){this.listeners=[]}function rD(i,o,s,a,u){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return(e=ZP(i)).then(function(t){s[t.measurementId]=t.appId,i.options.measurementId&&t.measurementId!==i.options.measurementId&&KP.warn("The measurement ID in the local Firebase config ("+i.options.measurementId+") does not match the measurement ID fetched from the server ("+t.measurementId+"). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.")}).catch(function(t){return KP.error(t)}),o.push(e),n=function(){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return Vo()?[3,1]:(KP.warn(QP.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),[2,!1]);case 1:return t.trys.push([1,3,,4]),[4,qo()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),KP.warn(QP.create("indexeddb-unavailable",{errorInfo:e}).message),[2,!1];case 4:return[2,!0]}})})}().then(function(t){return t?a.getId():void 0}),[4,Promise.all([e,n])];case 1:return r=t.sent(),e=r[0],n=r[1],u("js",new Date),(r={})[BP]="firebase",r.update=!0,r=r,null!=n&&(r[qP]=n),u(jP.CONFIG,e.measurementId,r),[2,e.measurementId]}})})}var iD,oD,sD={},aD=[],uD={},cD="dataLayer",hD="gtag",lD=!1;function fD(t){if(lD)throw QP.create("already-initialized");t.dataLayerName&&(cD=t.dataLayerName),t.gtagName&&(hD=t.gtagName)}function pD(t,e){n=[],Fo()&&n.push("This is a browser extension environment."),Bo()||n.push("Cookies are not available."),0<n.length&&(n=n.map(function(t,e){return"("+(e+1)+") "+t}).join(" "),n=QP.create("invalid-analytics-context",{errorInfo:n}),KP.warn(n.message));var n,r,i,o,s,a,u=t.options.appId;if(!u)throw QP.create("no-app-id");if(!t.options.apiKey){if(!t.options.measurementId)throw QP.create("no-api-key");KP.warn('The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID '+t.options.measurementId+' provided in the "measurementId" field in the local Firebase config.')}if(null!=sD[u])throw QP.create("already-exists",{id:u});return lD||(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(GP))return r}}()||(s=cD,(a=document.createElement("script")).src=GP+"?l="+s,a.async=!0,document.head.appendChild(a)),i=cD,o=[],Array.isArray(window[i])?o=window[i]:window[i]=o,n=sD,s=aD,a=uD,r=cD,i=hD,o=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];window[r].push(arguments)},window[i]&&"function"==typeof window[i]&&(o=window[i]),window[i]=zP(o,n,s,a),i={gtagCore:o,wrappedGtag:window[i]},oD=i.wrappedGtag,iD=i.gtagCore,lD=!0),sD[u]=rD(t,aD,uD,e,iD),{app:t,logEvent:function(t,e,n){(function(n,r,i,o,s){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return s&&s.global?(n(jP.EVENT,i,o),[2]):[3,1];case 1:return[4,r];case 2:e=t.sent(),e=mo(mo({},o),{send_to:e}),n(jP.EVENT,i,e),t.label=3;case 3:return[2]}})})})(oD,sD[u],t,e,n).catch(function(t){return KP.error(t)})},setCurrentScreen:function(t,e){(function(n,r,i,o){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return o&&o.global?(n(jP.SET,{screen_name:i}),[2,Promise.resolve()]):[3,1];case 1:return[4,r];case 2:e=t.sent(),n(jP.CONFIG,e,{update:!0,screen_name:i}),t.label=3;case 3:return[2]}})})})(oD,sD[u],t,e).catch(function(t){return KP.error(t)})},setUserId:function(t,e){(function(n,r,i,o){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return o&&o.global?(n(jP.SET,{user_id:i}),[2,Promise.resolve()]):[3,1];case 1:return[4,r];case 2:e=t.sent(),n(jP.CONFIG,e,{update:!0,user_id:i}),t.label=3;case 3:return[2]}})})})(oD,sD[u],t,e).catch(function(t){return KP.error(t)})},setUserProperties:function(t,e){(function(s,a,u,c){return bo(this,void 0,void 0,function(){var e,n,r,i,o;return _o(this,function(t){switch(t.label){case 0:if(!c||!c.global)return[3,1];for(e={},n=0,r=Object.keys(u);n<r.length;n++)i=r[n],e["user_properties."+i]=u[i];return s(jP.SET,e),[2,Promise.resolve()];case 1:return[4,a];case 2:o=t.sent(),s(jP.CONFIG,o,{update:!0,user_properties:u}),t.label=3;case 3:return[2]}})})})(oD,sD[u],t,e).catch(function(t){return KP.error(t)})},setAnalyticsCollectionEnabled:function(t){(function(n,r){return bo(this,void 0,void 0,function(){var e;return _o(this,function(t){switch(t.label){case 0:return[4,n];case 1:return e=t.sent(),window["ga-disable-"+e]=!r,[2]}})})})(sD[u],t).catch(function(t){return KP.error(t)})},INTERNAL:{delete:function(){return delete sD[u],Promise.resolve()}}}}var dD,vD="analytics";function yD(){return bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:if(Fo())return[2,!1];if(!Bo())return[2,!1];if(!Vo())return[2,!1];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,qo()];case 2:return[2,t.sent()];case 3:return t.sent(),[2,!1];case 4:return[2]}})})}(dD=Bl).INTERNAL.registerComponent(new bs(vD,function(t){return pD(t.getProvider("app").getImmediate(),t.getProvider("installations").getImmediate())},"PUBLIC").setServiceProps({settings:fD,EventName:VP,isSupported:yD})),dD.INTERNAL.registerComponent(new bs("analytics-internal",function(t){try{return{logEvent:t.getProvider(vD).getImmediate().logEvent}}catch(t){throw QP.create("interop-component-reg-failed",{reason:t})}},"PRIVATE")),dD.registerVersion("@firebase/analytics","0.6.0");var gD=(mD.prototype.isCachedDataFresh=function(t,e){if(!e)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;var n=Date.now()-e,e=n<=t;return this.logger.debug("Config fetch cache check. Cache age millis: "+n+". Cache max age millis (minimumFetchIntervalMillis setting): "+t+". Is cache hit: "+e+"."),e},mD.prototype.fetch=function(i){return bo(this,void 0,void 0,function(){var e,n,r;return _o(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()])];case 1:return(r=t.sent(),e=r[0],(r=r[1])&&this.isCachedDataFresh(i.cacheMaxAgeMillis,e))?[2,r]:(i.eTag=r&&r.eTag,[4,this.client.fetch(i)]);case 2:return n=t.sent(),r=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())],200===n.status&&r.push(this.storage.setLastSuccessfulFetchResponse(n)),[4,Promise.all(r)];case 3:return t.sent(),[2,n]}})})},mD);function mD(t,e,n,r){this.client=t,this.storage=e,this.storageCache=n,this.logger=r}var M=((M={})["registration-window"]="Undefined window object. This SDK only supports usage in a browser environment.",M["registration-project-id"]="Undefined project identifier. Check Firebase app initialization.",M["registration-api-key"]="Undefined API key. Check Firebase app initialization.",M["registration-app-id"]="Undefined app identifier. Check Firebase app initialization.",M["storage-open"]="Error thrown when opening storage. Original error: {$originalErrorMessage}.",M["storage-get"]="Error thrown when reading from storage. Original error: {$originalErrorMessage}.",M["storage-set"]="Error thrown when writing to storage. Original error: {$originalErrorMessage}.",M["storage-delete"]="Error thrown when deleting from storage. Original error: {$originalErrorMessage}.",M["fetch-client-network"]="Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.",M["fetch-timeout"]='The config fetch request timed out. Configure timeout using "fetchTimeoutMillis" SDK setting.',M["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}.',M["fetch-client-parse"]="Fetch client could not parse response. Original error: {$originalErrorMessage}.",M["fetch-status"]="Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.",M),bD=new zo("remoteconfig","Remote Config",M);var _D=(wD.prototype.fetch=function(f){return bo(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,h,l;return _o(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()])];case 1:o=t.sent(),n=o[0],i=o[1],r=window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com",o=r+"/v1/projects/"+this.projectId+"/namespaces/"+this.namespace+":fetch?key="+this.apiKey,r={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":f.eTag||"*"},i={sdk_version:this.sdkVersion,app_instance_id:n,app_instance_id_token:i,app_id:this.appId,language_code:(void 0===e&&(e=navigator),e.languages&&e.languages[0]||e.language)},i={method:"POST",headers:r,body:JSON.stringify(i)},o=fetch(o,i),i=new Promise(function(t,e){f.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([o,i])];case 3:return t.sent(),[4,o];case 4:return l=t.sent(),[3,6];case 5:throw i=t.sent(),o="fetch-client-network","AbortError"===i.name&&(o="fetch-timeout"),bD.create(o,{originalErrorMessage:i.message});case 6:if(s=l.status,a=l.headers.get("ETag")||void 0,200!==l.status)return[3,11];h=void 0,t.label=7;case 7:return t.trys.push([7,9,,10]),[4,l.json()];case 8:return h=t.sent(),[3,10];case 9:throw l=t.sent(),bD.create("fetch-client-parse",{originalErrorMessage:l.message});case 10:u=h.entries,c=h.state,t.label=11;case 11:if("INSTANCE_STATE_UNSPECIFIED"===c?s=500:"NO_CHANGE"===c?s=304:"NO_TEMPLATE"!==c&&"EMPTY_CONFIG"!==c||(u={}),304!==s&&200!==s)throw bD.create("fetch-status",{httpStatus:s});return[2,{status:s,eTag:a,config:u}]}var e})})},wD);function wD(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 ED=(ID.prototype.addEventListener=function(t){this.listeners.push(t)},ID.prototype.abort=function(){this.listeners.forEach(function(t){return t()})},ID);function ID(){this.listeners=[]}var TD=["1","true","t","yes","y","on"],SD=(CD.prototype.asString=function(){return this._value},CD.prototype.asBoolean=function(){return"static"!==this._source&&0<=TD.indexOf(this._value.toLowerCase())},CD.prototype.asNumber=function(){if("static"===this._source)return 0;var t=Number(this._value);return isNaN(t)&&(t=0),t},CD.prototype.getSource=function(){return this._source},CD);function CD(t,e){void 0===e&&(e=""),this._source=t,this._value=e}var ND=(AD.prototype.setLogLevel=function(t){switch(t){case"debug":this._logger.logLevel=Ns.DEBUG;break;case"silent":this._logger.logLevel=Ns.SILENT;break;default:this._logger.logLevel=Ns.ERROR}},Object.defineProperty(AD.prototype,"fetchTimeMillis",{get:function(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1},enumerable:!1,configurable:!0}),Object.defineProperty(AD.prototype,"lastFetchStatus",{get:function(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"},enumerable:!1,configurable:!0}),AD.prototype.activate=function(){return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return[4,Promise.all([this._storage.getLastSuccessfulFetchResponse(),this._storage.getActiveConfigEtag()])];case 1:return n=t.sent(),e=n[0],n=n[1],e&&e.config&&e.eTag&&e.eTag!==n?[4,Promise.all([this._storageCache.setActiveConfig(e.config),this._storage.setActiveConfigEtag(e.eTag)])]:[2,!1];case 2:return t.sent(),[2,!0]}})})},AD.prototype.ensureInitialized=function(){var t=this;return this._initializePromise||(this._initializePromise=this._storageCache.loadFromStorage().then(function(){t._isInitializationComplete=!0})),this._initializePromise},AD.prototype.fetch=function(){return bo(this,void 0,void 0,function(){var r,i,o,s=this;return _o(this,function(t){switch(t.label){case 0:r=new ED,setTimeout(function(){return bo(s,void 0,void 0,function(){return _o(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 Go&&-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})})},AD.prototype.fetchAndActivate=function(){return bo(this,void 0,void 0,function(){return _o(this,function(t){switch(t.label){case 0:return[4,this.fetch()];case 1:return t.sent(),[2,this.activate()]}})})},AD.prototype.getAll=function(){var n=this;return function(t,e){void 0===t&&(t={});void 0===e&&(e={});return Object.keys(mo(mo({},t),e))}(this._storageCache.getActiveConfig(),this.defaultConfig).reduce(function(t,e){return t[e]=n.getValue(e),t},{})},AD.prototype.getBoolean=function(t){return this.getValue(t).asBoolean()},AD.prototype.getNumber=function(t){return this.getValue(t).asNumber()},AD.prototype.getString=function(t){return this.getValue(t).asString()},AD.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 SD("remote",e[t]):this.defaultConfig&&void 0!==this.defaultConfig[t]?new SD("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 SD("static"))},AD);function AD(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 kD(t,e){t=t.target.error||void 0;return bD.create(e,{originalErrorMessage:t&&t.message})}var OD="app_namespace_store",RD="firebase_remote_config",PD=1;var DD=(xD.prototype.getLastFetchStatus=function(){return this.get("last_fetch_status")},xD.prototype.setLastFetchStatus=function(t){return this.set("last_fetch_status",t)},xD.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.get("last_successful_fetch_timestamp_millis")},xD.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.set("last_successful_fetch_timestamp_millis",t)},xD.prototype.getLastSuccessfulFetchResponse=function(){return this.get("last_successful_fetch_response")},xD.prototype.setLastSuccessfulFetchResponse=function(t){return this.set("last_successful_fetch_response",t)},xD.prototype.getActiveConfig=function(){return this.get("active_config")},xD.prototype.setActiveConfig=function(t){return this.set("active_config",t)},xD.prototype.getActiveConfigEtag=function(){return this.get("active_config_etag")},xD.prototype.setActiveConfigEtag=function(t){return this.set("active_config_etag",t)},xD.prototype.getThrottleMetadata=function(){return this.get("throttle_metadata")},xD.prototype.setThrottleMetadata=function(t){return this.set("throttle_metadata",t)},xD.prototype.deleteThrottleMetadata=function(){return this.delete("throttle_metadata")},xD.prototype.get=function(a){return bo(this,void 0,void 0,function(){var o,s=this;return _o(this,function(t){switch(t.label){case 0:return[4,this.openDbPromise];case 1:return o=t.sent(),[2,new Promise(function(e,n){var t=o.transaction([OD],"readonly").objectStore(OD),r=s.createCompositeKey(a);try{var i=t.get(r);i.onerror=function(t){n(kD(t,"storage-get"))},i.onsuccess=function(t){t=t.target.result;e(t?t.value:void 0)}}catch(t){n(bD.create("storage-get",{originalErrorMessage:t&&t.message}))}})]}})})},xD.prototype.set=function(a,u){return bo(this,void 0,void 0,function(){var o,s=this;return _o(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([OD],"readwrite").objectStore(OD),r=s.createCompositeKey(a);try{var i=n.put({compositeKey:r,value:u});i.onerror=function(t){e(kD(t,"storage-set"))},i.onsuccess=function(){t()}}catch(t){e(bD.create("storage-set",{originalErrorMessage:t&&t.message}))}})]}})})},xD.prototype.delete=function(a){return bo(this,void 0,void 0,function(){var o,s=this;return _o(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([OD],"readwrite").objectStore(OD),r=s.createCompositeKey(a);try{var i=n.delete(r);i.onerror=function(t){e(kD(t,"storage-delete"))},i.onsuccess=function(){t()}}catch(t){e(bD.create("storage-delete",{originalErrorMessage:t&&t.message}))}})]}})})},xD.prototype.createCompositeKey=function(t){return[this.appId,this.appName,this.namespace,t].join()},xD);function xD(t,e,n,r){void 0===r&&(r=new Promise(function(e,n){var t=indexedDB.open(RD,PD);t.onerror=function(t){n(kD(t,"storage-open"))},t.onsuccess=function(t){e(t.target.result)},t.onupgradeneeded=function(t){var e=t.target.result;0===t.oldVersion&&e.createObjectStore(OD,{keyPath:"compositeKey"})}})),this.appId=t,this.appName=e,this.namespace=n,this.openDbPromise=r}var LD=(MD.prototype.getLastFetchStatus=function(){return this.lastFetchStatus},MD.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.lastSuccessfulFetchTimestampMillis},MD.prototype.getActiveConfig=function(){return this.activeConfig},MD.prototype.loadFromStorage=function(){return bo(this,void 0,void 0,function(){var e,n,r;return _o(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(e=t.sent())&&(this.lastFetchStatus=e),[4,n];case 2:return(n=t.sent())&&(this.lastSuccessfulFetchTimestampMillis=n),[4,r];case 3:return(r=t.sent())&&(this.activeConfig=r),[2]}})})},MD.prototype.setLastFetchStatus=function(t){return this.lastFetchStatus=t,this.storage.setLastFetchStatus(t)},MD.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.lastSuccessfulFetchTimestampMillis=t,this.storage.setLastSuccessfulFetchTimestampMillis(t)},MD.prototype.setActiveConfig=function(t){return this.activeConfig=t,this.storage.setActiveConfig(t)},MD);function MD(t){this.storage=t}var FD=(UD.prototype.fetch=function(n){return bo(this,void 0,void 0,function(){var e;return _o(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)]}})})},UD.prototype.attemptFetch=function(r,t){var s=t.throttleEndTimeMillis,a=t.backoffCount;return bo(this,void 0,void 0,function(){var e,n;return _o(this,function(t){switch(t.label){case 0:return[4,(i=r.signal,o=s,new Promise(function(t,e){var n=Math.max(o-Date.now(),0),r=setTimeout(t,n);i.addEventListener(function(){clearTimeout(r),e(bD.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(r)];case 3:return e=t.sent(),[4,this.storage.deleteThrottleMetadata()];case 4:return t.sent(),[2,e];case 5:if(!function(t){if(t instanceof Go){t=Number(t.httpStatus);return 429===t||500===t||503===t||504===t}}(n=t.sent()))throw n;return n={throttleEndTimeMillis:Date.now()+ms(a),backoffCount:a+1},[4,this.storage.setThrottleMetadata(n)];case 6:return t.sent(),[2,this.attemptFetch(r,n)];case 7:return[2]}var i,o})})},UD);function UD(t,e){this.client=t,this.storage=e}var jD,VD="@firebase/remote-config";return(jD=Bl).INTERNAL.registerComponent(new bs("remoteConfig",function(t,e){var n=t.getProvider("app").getImmediate(),r=t.getProvider("installations").getImmediate();if("undefined"==typeof window)throw bD.create("registration-window");var i=n.options,o=i.projectId,s=i.apiKey,a=i.appId;if(!o)throw bD.create("registration-project-id");if(!s)throw bD.create("registration-api-key");if(!a)throw bD.create("registration-app-id");e=e||"firebase";var u=new DD(a,n.name,e),t=new LD(u),i=new Ds(VD);i.logLevel=Ns.ERROR;a=new _D(r,jD.SDK_VERSION,e,o,s,a),a=new FD(a,u),a=new gD(a,u,t,i),i=new ND(n,a,t,u,i);return i.ensureInitialized(),i},"PUBLIC").setMultipleInstances(!0)),jD.registerVersion(VD,"0.1.28"),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"),Bl.registerVersion("firebase","7.23.0","cdn"),Bl}); //# sourceMappingURL=firebase.js.map
Coded With 💗 by
0x6ick Mod By V1rus_Alfa