!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(t){var e,n,a,r,i,o,s,u,c,h;function l(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return t="string"!=typeof t?String(t):t}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach(function(t,e){this.append(e,t)},this):Array.isArray(e)?e.forEach(function(t){this.append(t[0],t[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function v(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(n){return new Promise(function(t,e){n.onload=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function y(t){var e=new FileReader,n=g(e);return e.readAsArrayBuffer(t),n}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t)if("string"==typeof t)this._bodyText=t;else if(a&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(r&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(i&&a&&s(t))this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!i||!ArrayBuffer.prototype.isPrototypeOf(t)&&!u(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=m(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var t=v(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?v(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,n=v(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=g(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}function _(t,e){var n,r=(e=e||{}).body;if(t instanceof _){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,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 d(e.headers)),this.method=(n=e.method||this.method||"GET",t=n.toUpperCase(),-1<c.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 w(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 I(t,e){e=e||{},this.type="default",this.status=void 0===e.status?200:e.status,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}t.fetch||(e="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,a="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),r="FormData"in t,(i="ArrayBuffer"in t)&&(o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=function(t){return t&&DataView.prototype.isPrototypeOf(t)},u=ArrayBuffer.isView||function(t){return t&&-1<o.indexOf(Object.prototype.toString.call(t))}),d.prototype.append=function(t,e){t=l(t),e=f(e);var n=this.map[t];this.map[t]=n?n+","+e:e},d.prototype.delete=function(t){delete this.map[l(t)]},d.prototype.get=function(t){return t=l(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(l(t))},d.prototype.set=function(t,e){this.map[l(t)]=f(e)},d.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},d.prototype.keys=function(){var n=[];return this.forEach(function(t,e){n.push(e)}),p(n)},d.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),p(e)},d.prototype.entries=function(){var n=[];return this.forEach(function(t,e){n.push([e,t])}),p(n)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries),c=["DELETE","GET","HEAD","OPTIONS","POST","PUT"],_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},b.call(_.prototype),b.call(I.prototype),I.prototype.clone=function(){return new I(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},I.error=function(){var t=new I(null,{status:0,statusText:""});return t.type="error",t},h=[301,302,303,307,308],I.redirect=function(t,e){if(-1===h.indexOf(e))throw new RangeError("Invalid status code");return new I(null,{status:e,headers:{location:t}})},t.Headers=d,t.Request=_,t.Response=I,t.fetch=function(n,o){return new Promise(function(r,t){var e=new _(n,o),i=new XMLHttpRequest;i.onload=function(){var n,t={status:i.status,statusText:i.statusText,headers:(e=i.getAllResponseHeaders()||"",n=new d,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 I(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&&a&&(i.responseType="blob"),e.headers.forEach(function(t,e){i.setRequestHeader(e,t)}),i.send(void 0===e._bodyInit?null:e._bodyInit)})},t.fetch.polyfill=!0)}("undefined"!=typeof self?self:void 0);var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){var e={exports:{}};return t(e,e.exports),e.exports}function g(t){try{return!!t()}catch(t){return!0}}function v(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}function r(t){return d.call(t).slice(8,-1)}function a(t){if(null==t)throw TypeError("Can't call method on "+t);return t}function u(t){return w(a(t))}function y(t){return"object"==typeof t?null!==t:"function"==typeof t}function i(t,e){if(!y(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!y(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!y(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!y(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}function c(t,e){return I.call(t,e)}function n(t){return E?T.createElement(t):{}}function m(t){if(!y(t))throw TypeError(String(t)+" is not an object");return t}function h(e,n){try{R(b,e,n)}catch(t){b[e]=n}return n}var o=function(t){return t&&t.Math==Math&&t},b=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof t&&t)||function(){return this}()||Function("return this")(),f=!g(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}),s={}.propertyIsEnumerable,l=Object.getOwnPropertyDescriptor,p={f:l&&!s.call({1:2},1)?function(t){t=l(this,t);return!!t&&t.enumerable}:s},d={}.toString,_="".split,w=g(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==r(t)?_.call(t,""):Object(t)}:Object,I={}.hasOwnProperty,T=b.document,E=y(T)&&y(T.createElement),S=!f&&!g(function(){return 7!=Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}),C=Object.getOwnPropertyDescriptor,k={f:f?C:function(t,e){if(t=u(t),e=i(e,!0),S)try{return C(t,e)}catch(t){}if(c(t,e))return v(!p.f.call(t,e),t[e])}},N=Object.defineProperty,A={f:f?N:function(t,e,n){if(m(t),e=i(e,!0),m(n),S)try{return N(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}},R=f?function(t,e,n){return A.f(t,e,v(1,n))}:function(t,e,n){return t[e]=n,t},O="__core-js_shared__",P=b[O]||h(O,{}),D=Function.toString;"function"!=typeof P.inspectSource&&(P.inspectSource=function(t){return D.call(t)});function x(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++Q+Y).toString(36)}var L,M,F,U,j,q,V,B,K=P.inspectSource,W=b.WeakMap,H="function"==typeof W&&/native code/.test(K(W)),G=!1,z=e(function(t){(t.exports=function(t,e){return P[t]||(P[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.8.1",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})}),Q=0,Y=Math.random(),X=z("keys"),J=function(t){return X[t]||(X[t]=x(t))},$={},Z=b.WeakMap;V=H?(L=P.state||(P.state=new Z),M=L.get,F=L.has,U=L.set,j=function(t,e){return e.facade=t,U.call(L,t,e),e},q=function(t){return M.call(L,t)||{}},function(t){return F.call(L,t)}):(B=J("state"),$[B]=!0,j=function(t,e){return e.facade=t,R(t,B,e),e},q=function(t){return c(t,B)?t[B]:{}},function(t){return c(t,B)});function tt(t){return"function"==typeof t?t:void 0}function et(t,e){return arguments.length<2?tt(pt[t])||tt(b[t]):pt[t]&&pt[t][e]||b[t]&&b[t][e]}function nt(t){return isNaN(t=+t)?0:(0<t?vt:dt)(t)}function rt(t){return 0<t?gt(nt(t),9007199254740991):0}function it(t,e){var n,r=u(t),i=0,o=[];for(n in r)!c($,n)&&c(r,n)&&o.push(n);for(;e.length>i;)c(r,n=e[i++])&&(~_t(o,n)||o.push(n));return o}function ot(t,e){for(var n=St(e),r=A.f,i=k.f,o=0;o<n.length;o++){var a=n[o];c(t,a)||r(t,a,i(e,a))}}function at(t,e){var n,r,i,o=t.target,a=t.global,s=t.stat,u=a?b:s?b[o]||h(o,{}):(b[o]||{}).prototype;if(u)for(n in e){if(r=e[n],i=t.noTargetGet?(i=Pt(u,n))&&i.value:u[n],!Ot(a?n:o+(s?".":"#")+n,t.forced)&&void 0!==i){if(typeof r==typeof i)continue;ot(r,i)}(t.sham||i&&i.sham)&&R(r,"sham",!0),ft(u,n,r,t)}}function st(t){return Object(a(t))}function ut(){}function ct(t){return"<script>"+t+"</"+Vt+">"}var ht,lt={set:j,get:q,has:V,enforce:function(t){return V(t)?q(t):j(t,{})},getterFor:function(n){return function(t){var e;if(!y(t)||(e=q(t)).type!==n)throw TypeError("Incompatible receiver, "+n+" required");return e}}},ft=e(function(t){var e=lt.get,s=lt.enforce,u=String(String).split("String");(t.exports=function(t,e,n,r){var i=!!r&&!!r.unsafe,o=!!r&&!!r.enumerable,a=!!r&&!!r.noTargetGet;"function"==typeof n&&("string"!=typeof e||c(n,"name")||R(n,"name",e),(r=s(n)).source||(r.source=u.join("string"==typeof e?e:""))),t!==b?(i?!a&&t[e]&&(o=!0):delete t[e],o?t[e]=n:R(t,e,n)):o?t[e]=n:h(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||K(this)})}),pt=b,dt=Math.ceil,vt=Math.floor,gt=Math.min,yt=Math.max,mt=Math.min,bt=function(s){return function(t,e,n){var r,i=u(t),o=rt(i.length),a=function(t,e){t=nt(t);return t<0?yt(t+e,0):mt(t,e)}(n,o);if(s&&e!=e){for(;a<o;)if((r=i[a++])!=r)return!0}else for(;a<o;a++)if((s||a in i)&&i[a]===e)return s||a||0;return!s&&-1}},_t={includes:bt(!0),indexOf:bt(!1)}.indexOf,wt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],It=wt.concat("length","prototype"),Tt={f:Object.getOwnPropertyNames||function(t){return it(t,It)}},Et={f:Object.getOwnPropertySymbols},St=et("Reflect","ownKeys")||function(t){var e=Tt.f(m(t)),n=Et.f;return n?e.concat(n(t)):e},Ct=/#|\.prototype\./,o=function(t,e){t=Nt[kt(t)];return t==Rt||t!=At&&("function"==typeof e?g(e):!!e)},kt=o.normalize=function(t){return String(t).replace(Ct,".").toLowerCase()},Nt=o.data={},At=o.NATIVE="N",Rt=o.POLYFILL="P",Ot=o,Pt=k.f,t=!g(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Dt=J("IE_PROTO"),xt=Object.prototype,Lt=t?Object.getPrototypeOf:function(t){return t=st(t),c(t,Dt)?t[Dt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?xt:null},Mt=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 m(t),function(t){if(!y(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),Ft=Object.keys||function(t){return it(t,wt)},Ut=f?Object.defineProperties:function(t,e){m(t);for(var n,r=Ft(e),i=r.length,o=0;o<i;)A.f(t,n=r[o++],e[n]);return t},jt=et("document","documentElement"),qt="prototype",Vt="script",Bt=J("IE_PROTO"),Kt=function(){try{ht=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t;Kt=ht?function(t){t.write(ct("")),t.close();var e=t.parentWindow.Object;return t=null,e}(ht):((t=n("iframe")).style.display="none",jt.appendChild(t),t.src=String("javascript:"),(t=t.contentWindow.document).open(),t.write(ct("document.F=Object")),t.close(),t.F);for(var e=wt.length;e--;)delete Kt[qt][wt[e]];return Kt()};$[Bt]=!0;function Wt(t){return c(Xt,t)||(Yt&&c(Jt,t)?Xt[t]=Jt[t]:Xt[t]=$t("Symbol."+t)),Xt[t]}function Ht(t){return void 0!==t&&(Zt.Array===t||ee[te]===t)}function Gt(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}function zt(r,i,t){if(Gt(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)}}var Qt=Object.create||function(t,e){var n;return null!==t?(ut[qt]=m(t),n=new ut,ut[qt]=null,n[Bt]=t):n=Kt(),void 0===e?n:Ut(n,e)},Yt=!!Object.getOwnPropertySymbols&&!g(function(){return!String(Symbol())}),s=Yt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Xt=z("wks"),Jt=b.Symbol,$t=s?Jt:Jt&&Jt.withoutSetter||x,Zt={},te=Wt("iterator"),ee=Array.prototype,O={};O[Wt("toStringTag")]="z";function ne(t){if(null!=t)return t[ce]||t["@@iterator"]||Zt[ue(t)]}function re(t){var e=t.return;return void 0!==e&&m(e.call(t)).value}function ie(t,e){this.stopped=t,this.result=e}function oe(t,e,n){function r(t){return o&&re(o),new ie(!0,t)}function i(t){return f?(m(t),d?v(t[0],t[1],r):v(t[0],t[1])):d?v(t,r):v(t)}var o,a,s,u,c,h,l=n&&n.that,f=!(!n||!n.AS_ENTRIES),p=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),v=zt(e,l,1+f+d);if(p)o=t;else{if("function"!=typeof(p=ne(t)))throw TypeError("Target is not iterable");if(Ht(p)){for(a=0,s=rt(t.length);a<s;a++)if((u=i(t[a]))&&u instanceof ie)return u;return new ie(!1)}o=p.call(t)}for(c=o.next;!(h=c.call(o)).done;){try{u=i(h.value)}catch(t){throw re(o),t}if("object"==typeof u&&u&&u instanceof ie)return u}return new ie(!1)}var W="[object z]"===String(O),ae=Wt("toStringTag"),se="Arguments"==r(function(){return arguments}()),ue=W?r: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),ae))?t:se?r(e):"Object"==(t=r(e))&&"function"==typeof e.callee?"Arguments":t},ce=Wt("iterator"),he=function(t,e){var n=this;if(!(n instanceof he))return new he(t,e);Mt&&(n=Mt(new Error(void 0),Lt(n))),void 0!==e&&R(n,"message",String(e));e=[];return oe(t,e.push,{that:e}),R(n,"errors",e),n};he.prototype=Qt(Error.prototype,{constructor:v(5,he),message:v(5,""),name:v(5,"AggregateError")}),at({global:!0},{AggregateError:he});H=W?{}.toString:function(){return"[object "+ue(this)+"]"};W||ft(Object.prototype,"toString",H,{unsafe:!0});function le(t,e,n){for(var r in e)ft(t,r,e[r],n);return t}function fe(t,e,n){t&&!c(t=n?t:t.prototype,ye)&&ge(t,ye,{configurable:!0,value:e})}function pe(t){var e=et(t),t=A.f;f&&e&&!e[me]&&t(e,me,{configurable:!0,get:function(){return this}})}function de(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}var ve=b.Promise,ge=A.f,ye=Wt("toStringTag"),me=Wt("species"),be=Wt("iterator"),_e=!1;try{var we=0,Ie={next:function(){return{done:!!we++}},return:function(){_e=!0}};Ie[be]=function(){return this},Array.from(Ie,function(){throw 2})}catch(Ma){}function Te(t,e){if(!e&&!_e)return!1;var n=!1;try{var r={};r[be]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n}function Ee(t,e){var n;return void 0===(t=m(t).constructor)||null==(n=m(t)[Ne])?e:Gt(n)}function Se(t){var e;xe.hasOwnProperty(t)&&(e=xe[t],delete xe[t],e())}function Ce(t){return function(){Se(t)}}var ke,Ne=Wt("species"),Z=et("navigator","userAgent")||"",bt=/(iphone|ipod|ipad).*applewebkit/i.test(Z),Ae="process"==r(b.process),Re=b.location,o=b.setImmediate,t=b.clearImmediate,Oe=b.process,O=b.MessageChannel,Pe=b.Dispatch,De=0,xe={},Le="onreadystatechange",W=function(t){Se(t.data)},H=function(t){b.postMessage(t+"",Re.protocol+"//"+Re.host)};o&&t||(o=function(t){for(var e=[],n=1;n<arguments.length;)e.push(arguments[n++]);return xe[++De]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},ke(De),De},t=function(t){delete xe[t]},Ae?ke=function(t){Oe.nextTick(Ce(t))}:Pe&&Pe.now?ke=function(t){Pe.now(Ce(t))}:O&&!bt?(We=(O=new O).port2,O.port1.onmessage=W,ke=zt(We.postMessage,We,1)):b.addEventListener&&"function"==typeof postMessage&&!b.importScripts&&Re&&"file:"!==Re.protocol&&!g(H)?(ke=H,b.addEventListener("message",W,!1)):ke=Le in n("script")?function(t){jt.appendChild(n("script"))[Le]=function(){jt.removeChild(this),Se(t)}}:function(t){setTimeout(Ce(t),0)});var Me,Fe,Ue,je,qe,Ve,Be,Ke,We={set:o,clear:t},H=k.f,He=We.set,W=b.MutationObserver||b.WebKitMutationObserver,o=b.document,Ge=b.process,t=b.Promise,H=H(b,"queueMicrotask"),H=H&&H.value;H||(Me=function(){var t,e;for(Ae&&(t=Ge.domain)&&t.exit();Fe;){e=Fe.fn,Fe=Fe.next;try{e()}catch(t){throw Fe?je():Ue=void 0,t}}Ue=void 0,t&&t.enter()},je=!bt&&!Ae&&W&&o?(qe=!0,Ve=o.createTextNode(""),new W(Me).observe(Ve,{characterData:!0}),function(){Ve.data=qe=!qe}):t&&t.resolve?(Be=t.resolve(void 0),Ke=Be.then,function(){Ke.call(Be,Me)}):Ae?function(){Ge.nextTick(Me)}:function(){He.call(b,Me)});function ze(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=Gt(n),this.reject=Gt(r)}function Qe(t,e){return m(t),y(e)&&e.constructor===t?e:((0,(t=Je.f(t)).resolve)(e),t.promise)}function Ye(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}var Xe=H||function(t){t={fn:t,next:void 0};Ue&&(Ue.next=t),Fe||(Fe=t,je()),Ue=t},Je={f:function(t){return new ze(t)}},H=b.process,H=H&&H.versions,H=H&&H.v8;H?On=(Sn=H.split("."))[0]+Sn[1]:Z&&(!(Sn=Z.match(/Edge\/(\d+)/))||74<=Sn[1])&&(Sn=Z.match(/Chrome\/(\d+)/))&&(On=Sn[1]);function $e(t){var e;return!(!y(t)||"function"!=typeof(e=t.then))&&e}function Ze(l,f){var p;l.notified||(l.notified=!0,p=l.reactions,Xe(function(){for(var t=l.value,e=1==l.state,n=0;p.length>n;){var r,i,o,a=p[n++],s=e?a.ok:a.fail,u=a.resolve,c=a.reject,h=a.domain;try{s?(e||(2===l.rejection&&Nn(l),l.rejection=1),!0===s?r=t:(h&&h.enter(),r=s(t),h&&(h.exit(),o=!0)),r===a.promise?c(gn("Promise-chain cycle")):(i=$e(r))?i.call(r,u,c):u(r)):c(t)}catch(t){h&&!o&&h.exit(),c(t)}}l.reactions=[],l.notified=!1,f&&!l.rejection&&Cn(l)}))}function tn(t,e,n){var r,i;In?((r=yn.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),b.dispatchEvent(r)):r={promise:e,reason:n},!Tn&&(i=b["on"+t])?i(r):t===En&&function(t,e){var n=b.console;n&&n.error&&(1===arguments.length?n.error(t):n.error(t,e))}("Unhandled promise rejection",n)}function en(e,n,r){return function(t){e(n,t,r)}}function nn(t,e,n){t.done||(t.done=!0,(t=n?n:t).value=e,t.state=2,Ze(t,!0))}var rn,on,an,sn,un=On&&+On,cn=We.set,hn=Wt("species"),ln="Promise",fn=lt.get,pn=lt.set,dn=lt.getterFor(ln),vn=ve,gn=b.TypeError,yn=b.document,mn=b.process,bn=et("fetch"),_n=Je.f,wn=_n,In=!!(yn&&yn.createEvent&&b.dispatchEvent),Tn="function"==typeof PromiseRejectionEvent,En="unhandledrejection",Z=Ot(ln,function(){if(!(K(vn)!==String(vn))){if(66===un)return!0;if(!Ae&&!Tn)return!0}if(51<=un&&/native code/.test(vn))return!1;function t(t){t(function(){},function(){})}var e=vn.resolve(1);return(e.constructor={})[hn]=t,!(e.then(function(){})instanceof t)}),Sn=Z||!Te(function(t){vn.all(t).catch(function(){})}),Cn=function(i){cn.call(b,function(){var t,e=i.facade,n=i.value,r=kn(i);if(r&&(t=Ye(function(){Ae?mn.emit("unhandledRejection",n,e):tn(En,e,n)}),i.rejection=Ae||kn(i)?2:1,t.error))throw t.value})},kn=function(t){return 1!==t.rejection&&!t.parent},Nn=function(e){cn.call(b,function(){var t=e.facade;Ae?mn.emit("rejectionHandled",t):tn("rejectionhandled",t,e.value)})},An=function(n,t,e){if(!n.done){n.done=!0,e&&(n=e);try{if(n.facade===t)throw gn("Promise can't be resolved itself");var r=$e(t);r?Xe(function(){var e={done:!1};try{r.call(t,en(An,e,n),en(nn,e,n))}catch(t){nn(e,t,n)}}):(n.value=t,n.state=1,Ze(n,!1))}catch(t){nn({done:!1},t,n)}}};Z&&(vn=function(t){de(this,vn,ln),Gt(t),rn.call(this);var e=fn(this);try{t(en(An,e),en(nn,e))}catch(t){nn(e,t)}},(rn=function(t){pn(this,{type:ln,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=le(vn.prototype,{then:function(t,e){var n=dn(this),r=_n(Ee(this,vn));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=Ae?mn.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Ze(n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),on=function(){var t=new rn,e=fn(t);this.promise=t,this.resolve=en(An,e),this.reject=en(nn,e)},Je.f=_n=function(t){return t===vn||t===an?new on:wn(t)},"function"==typeof ve&&(sn=ve.prototype.then,ft(ve.prototype,"then",function(t,e){var n=this;return new vn(function(t,e){sn.call(n,t,e)}).then(t,e)},{unsafe:!0}),"function"==typeof bn&&at({global:!0,enumerable:!0,forced:!0},{fetch:function(t){return Qe(vn,bn.apply(b,arguments))}}))),at({global:!0,wrap:!0,forced:Z},{Promise:vn}),fe(vn,ln,!1),pe(ln),an=et(ln),at({target:ln,stat:!0,forced:Z},{reject:function(t){var e=_n(this);return e.reject.call(void 0,t),e.promise}}),at({target:ln,stat:!0,forced:Z},{resolve:function(t){return Qe(this,t)}}),at({target:ln,stat:!0,forced:Sn},{all:function(t){var s=this,e=_n(s),u=e.resolve,c=e.reject,n=Ye(function(){var r=Gt(s.resolve),i=[],o=0,a=1;oe(t,function(t){var e=o++,n=!1;i.push(void 0),a++,r.call(s,t).then(function(t){n||(n=!0,i[e]=t,--a||u(i))},c)}),--a||u(i)});return n.error&&c(n.value),e.promise},race:function(t){var n=this,r=_n(n),i=r.reject,e=Ye(function(){var e=Gt(n.resolve);oe(t,function(t){e.call(n,t).then(r.resolve,i)})});return e.error&&i(e.value),r.promise}}),at({target:"Promise",stat:!0},{allSettled:function(t){var s=this,e=Je.f(s),u=e.resolve,n=e.reject,r=Ye(function(){var r=Gt(s.resolve),i=[],o=0,a=1;oe(t,function(t){var e=o++,n=!1;i.push(void 0),a++,r.call(s,t).then(function(t){n||(n=!0,i[e]={status:"fulfilled",value:t},--a||u(i))},function(t){n||(n=!0,i[e]={status:"rejected",reason:t},--a||u(i))})}),--a||u(i)});return r.error&&n(r.value),e.promise}});var Rn="No one promise resolved";at({target:"Promise",stat:!0},{any:function(t){var u=this,e=Je.f(u),c=e.resolve,h=e.reject,n=Ye(function(){var r=Gt(u.resolve),i=[],o=0,a=1,s=!1;oe(t,function(t){var e=o++,n=!1;i.push(void 0),a++,r.call(u,t).then(function(t){n||s||(s=!0,c(t))},function(t){n||s||(n=!0,i[e]=t,--a||h(new(et("AggregateError"))(i,Rn)))})}),--a||h(new(et("AggregateError"))(i,Rn))});return n.error&&h(n.value),e.promise}});var On=!!ve&&g(function(){ve.prototype.finally.call({then:function(){}},function(){})});at({target:"Promise",proto:!0,real:!0,forced:On},{finally:function(e){var n=Ee(this,et("Promise")),t="function"==typeof e;return this.then(t?function(t){return Qe(n,e()).then(function(){return t})}:e,t?function(t){return Qe(n,e()).then(function(){throw t})}:e)}}),"function"!=typeof ve||ve.prototype.finally||ft(ve.prototype,"finally",et("Promise").prototype.finally);We=function(o){return function(t,e){var n,r=String(a(t)),i=nt(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}},Z={codeAt:We(!1),charAt:We(!0)},Sn=Wt("iterator"),On=!1;[].keys&&("next"in(Qn=[].keys())?(lr=Lt(Lt(Qn)))!==Object.prototype&&(dr=lr):On=!0),c(dr=null==dr?{}:dr,Sn)||R(dr,Sn,function(){return this});function Pn(){return this}function Dn(){return this}function xn(t,e,n,r,i,o,a){function s(t){if(t===i&&d)return d;if(!Fn&&t in f)return f[t];switch(t){case"keys":case jn:case qn:return function(){return new n(this,t)}}return function(){return new n(this)}}!function(t,e,n){e+=" Iterator";t.prototype=Qt(Ln,{next:v(1,n)}),fe(t,e,!1),Zt[e]=Pn}(n,e,r);var u,c,h=e+" Iterator",l=!1,f=t.prototype,p=f[Un]||f["@@iterator"]||i&&f[i],d=!Fn&&p||s(i);if((r="Array"==e&&f.entries||p)&&(t=Lt(r.call(new t)),Mn!==Object.prototype&&t.next&&(Lt(t)!==Mn&&(Mt?Mt(t,Mn):"function"!=typeof t[Un]&&R(t,Un,Dn)),fe(t,h,!0))),i==jn&&p&&p.name!==jn&&(l=!0,d=function(){return p.call(this)}),f[Un]!==d&&R(f,Un,d),Zt[e]=d,i)if(u={values:s(jn),keys:o?d:s("keys"),entries:s(qn)},a)for(c in u)!Fn&&!l&&c in f||ft(f,c,u[c]);else at({target:e,proto:!0,forced:Fn||l},u);return u}var We={IteratorPrototype:dr,BUGGY_SAFARI_ITERATORS:On},Ln=We.IteratorPrototype,Mn=We.IteratorPrototype,Fn=We.BUGGY_SAFARI_ITERATORS,Un=Wt("iterator"),jn="values",qn="entries",Vn=Z.charAt,Bn="String Iterator",Kn=lt.set,Wn=lt.getterFor(Bn);xn(String,"String",function(t){Kn(this,{type:Bn,string:String(t),index:0})},function(){var t=Wn(this),e=t.string,n=t.index;return n>=e.length?{value:void 0,done:!0}:(n=Vn(e,n),t.index+=n.length,{value:n,done:!1})});var Hn={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},Gn=Wt("unscopables"),zn=Array.prototype;null==zn[Gn]&&A.f(zn,Gn,{configurable:!0,value:Qt(null)});var Qn=function(t){zn[Gn][t]=!0},Yn="Array Iterator",Xn=lt.set,Jn=lt.getterFor(Yn),$n=xn(Array,"Array",function(t,e){Xn(this,{type:Yn,target:u(t),index:0,kind:e})},function(){var t=Jn(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");Zt.Arguments=Zt.Array,Qn("keys"),Qn("values"),Qn("entries");var Zn,tr=Wt("iterator"),er=Wt("toStringTag"),nr=$n.values;for(Zn in Hn){var rr=b[Zn],ir=rr&&rr.prototype;if(ir){if(ir[tr]!==nr)try{R(ir,tr,nr)}catch(Ma){ir[tr]=nr}if(ir[er]||R(ir,er,Zn),Hn[Zn])for(var or in $n)if(ir[or]!==$n[or])try{R(ir,or,$n[or])}catch(Ma){ir[or]=$n[or]}}}pt.Promise;at({target:"Promise",stat:!0},{try:function(t){var e=Je.f(this),t=Ye(t);return(t.error?e.reject:e.resolve)(t.value),e.promise}});function ar(t,e){var n;return new(void 0===(n=ur(t)&&("function"==typeof(n=t.constructor)&&(n===Array||ur(n.prototype))||y(n)&&null===(n=n[cr]))?void 0:n)?Array:n)(0===e?0:e)}function sr(t){throw t}var ur=Array.isArray||function(t){return"Array"==r(t)},cr=Wt("species"),hr=[].push,lr=function(f){var p=1==f,d=2==f,v=3==f,g=4==f,y=6==f,m=7==f,b=5==f||y;return function(t,e,n,r){for(var i,o,a=st(t),s=w(a),u=zt(e,n,3),c=rt(s.length),h=0,r=r||ar,l=p?r(t,c):d||m?r(t,0):void 0;h<c;h++)if((b||h in s)&&(o=u(i=s[h],h,a),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:hr.call(l,i)}else switch(f){case 4:return!1;case 7:hr.call(l,i)}return y?-1:v||g?g:l}},Sn={forEach:lr(0),map:lr(1),filter:lr(2),some:lr(3),every:lr(4),find:lr(5),findIndex:lr(6),filterOut:lr(7)},fr=Object.defineProperty,pr={},dr=function(t,e){if(c(pr,t))return pr[t];var n=[][t],r=!!c(e=e||{},"ACCESSORS")&&e.ACCESSORS,i=c(e,0)?e[0]:sr,o=c(e,1)?e[1]:void 0;return pr[t]=!!n&&!g(function(){if(r&&!f)return 1;var t={length:-1};r?fr(t,1,{enumerable:!0,get:sr}):t[1]=1,n.call(t,i,o)})},vr=Sn.find,On="find",gr=!0,We=dr(On);On in[]&&Array(1)[On](function(){gr=!1}),at({target:"Array",proto:!0,forced:gr||!We},{find:function(t){return vr(this,t,1<arguments.length?arguments[1]:void 0)}}),Qn(On);var yr=Function.call,Z=function(t,e,n){return zt(yr,b[t].prototype[e],n)},mr=(Z("Array","find"),Sn.findIndex),lr="findIndex",br=!0,We=dr(lr);lr in[]&&Array(1)[lr](function(){br=!1}),at({target:"Array",proto:!0,forced:br||!We},{findIndex:function(t){return mr(this,t,1<arguments.length?arguments[1]:void 0)}}),Qn(lr);function _r(t,e,n){(e=i(e))in t?A.f(t,e,v(0,n)):t[e]=n}Z("Array","findIndex");On=!Te(function(t){Array.from(t)});at({target:"Array",stat:!0,forced:On},{from:function(t){var e,n,r,i,o,a,s=st(t),u="function"==typeof this?this:Array,c=arguments.length,h=1<c?arguments[1]:void 0,l=void 0!==h,t=ne(s),f=0;if(l&&(h=zt(h,2<c?arguments[2]:void 0,2)),null==t||u==Array&&Ht(t))for(n=new u(e=rt(s.length));f<e;f++)a=l?h(s[f],f):s[f],_r(n,f,a);else for(o=(i=t.call(s)).next,n=new u;!(r=o.call(i)).done;f++)a=l?function(e,t,n,r){try{return r?t(m(n)[0],n[1]):t(n)}catch(t){throw re(e),t}}(i,h,[r.value,f],!0):r.value,_r(n,f,a);return n.length=f,n}});pt.Array.from;var wr,Ir,Tr=Sn.some,We=!!(Ir=[]["some"])&&g(function(){Ir.call(null,wr||function(){throw 1},1)}),Qn=dr("some");at({target:"Array",proto:!0,forced:!We||!Qn},{some:function(t){return Tr(this,t,1<arguments.length?arguments[1]:void 0)}});Z("Array","some");function Er(t){return!!y(t)&&(t=ue(t),c(Pr,t)||c(Dr,t))}var Sr,lr="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,On=A.f,Cr=b.Int8Array,kr=Cr&&Cr.prototype,dr=b.Uint8ClampedArray,We=dr&&dr.prototype,Nr=Cr&&Lt(Cr),Ar=kr&&Lt(kr),Qn=Object.prototype,dr=(Qn.isPrototypeOf,Wt("toStringTag")),Rr=x("TYPED_ARRAY_TAG"),Or=lr&&!!Mt&&"Opera"!==ue(b.opera),lr=!1,Pr={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Dr={BigInt64Array:8,BigUint64Array:8};for(Sr in Pr)b[Sr]||(Or=!1);if((!Or||"function"!=typeof Nr||Nr===Function.prototype)&&(Nr=function(){throw TypeError("Incorrect invocation")},Or))for(Sr in Pr)b[Sr]&&Mt(b[Sr],Nr);if((!Or||!Ar||Ar===Qn)&&(Ar=Nr.prototype,Or))for(Sr in Pr)b[Sr]&&Mt(b[Sr].prototype,Ar);if(Or&&Lt(We)!==Ar&&Mt(We,Ar),f&&!c(Ar,dr))for(Sr in lr=!0,On(Ar,dr,{get:function(){return y(this)?this[Rr]:void 0}}),Pr)b[Sr]&&R(b[Sr],Rr,Sr);var We=function(t){if(Er(t))return t;throw TypeError("Target is not a typed array")},On=function(t,e,n){if(f){if(n)for(var r in Pr){r=b[r];r&&c(r.prototype,t)&&delete r.prototype[t]}Ar[t]&&!n||ft(Ar,t,!n&&Or&&kr[t]||e)}},dr=Wt("iterator"),lr=b.Uint8Array,xr=$n.values,Lr=$n.keys,Mr=$n.entries,Fr=We,We=On,On=lr&&lr.prototype[dr],lr=!!On&&("values"==On.name||null==On.name),On=function(){return xr.call(Fr(this))};We("entries",function(){return Mr.call(Fr(this))}),We("keys",function(){return Lr.call(Fr(this))}),We("values",On,!lr),We(dr,On,!lr);var Ur=Object.assign,jr=Object.defineProperty,On=!Ur||g(function(){if(f&&1!==Ur({b:1},Ur(jr({},"a",{enumerable:!0,get:function(){jr(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!=Ur({},t)[n]||Ft(Ur({},e)).join("")!=r})?function(t,e){for(var n=st(t),r=arguments.length,i=1,o=Et.f,a=p.f;i<r;)for(var s,u=w(arguments[i++]),c=o?Ft(u).concat(o(u)):Ft(u),h=c.length,l=0;l<h;)s=c[l++],f&&!a.call(u,s)||(n[s]=u[s]);return n}:Ur;at({target:"Object",stat:!0,forced:Object.assign!==On},{assign:On});pt.Object.assign;var qr=p.f,lr=function(s){return function(t){for(var e,n=u(t),r=Ft(n),i=r.length,o=0,a=[];o<i;)e=r[o++],f&&!qr.call(n,e)||a.push(s?[e,n[e]]:n[e]);return a}},On={entries:lr(!0),values:lr(!1)},Vr=On.entries;at({target:"Object",stat:!0},{entries:function(t){return Vr(t)}});pt.Object.entries;var Br=On.values;at({target:"Object",stat:!0},{values:function(t){return Br(t)}});pt.Object.values;function Kr(t){if(y(e=t)&&(void 0!==(n=e[Wr])?!!n:"RegExp"==r(e)))throw TypeError("The method doesn't accept regular expressions");var e,n;return t}var Wr=Wt("match"),Hr=Wt("match"),lr=function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[Hr]=!1,"/./"[e](n)}catch(t){}}return!1};at({target:"String",proto:!0,forced:!lr("includes")},{includes:function(t){return!!~String(a(this)).indexOf(Kr(t),1<arguments.length?arguments[1]:void 0)}});Z("String","includes");var Gr,On=k.f,zr="".startsWith,Qr=Math.min,lr=lr("startsWith"),Gr=!(lr||(!(Gr=On(String.prototype,"startsWith"))||Gr.writable));at({target:"String",proto:!0,forced:!Gr&&!lr},{startsWith:function(t){var e=String(a(this));Kr(t);var n=rt(Qr(1<arguments.length?arguments[1]:void 0,e.length)),t=String(t);return zr?zr.call(e,t,n):e.slice(n,n+t.length)===t}});Z("String","startsWith");at({target:"String",proto:!0},{repeat:"".repeat||function(t){var e=String(a(this)),n="",r=nt(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}});Z("String","repeat");var Yr,Xr=Wt("species"),Jr=Wt("isConcatSpreadable"),$r=9007199254740991,Zr="Maximum allowed index exceeded",lr=51<=un||!g(function(){var t=[];return t[Jr]=!1,t.concat()[0]!==t}),Z=(Yr="concat",51<=un||!g(function(){var t=[];return(t.constructor={})[Xr]=function(){return{foo:1}},1!==t[Yr](Boolean).foo}));at({target:"Array",proto:!0,forced:!lr||!Z},{concat:function(t){for(var e,n,r,i=st(this),o=ar(i,0),a=0,s=-1,u=arguments.length;s<u;s++)if(function(t){if(!y(t))return!1;var e=t[Jr];return void 0!==e?!!e:ur(t)}(r=-1===s?i:arguments[s])){if(n=rt(r.length),$r<a+n)throw TypeError(Zr);for(e=0;e<n;e++,a++)e in r&&_r(o,a,r[e])}else{if($r<=a)throw TypeError(Zr);_r(o,a++,r)}return o.length=a,o}});function ti(t){var e=pt.Symbol||(pt.Symbol={});c(e,t)||si(e,t,{value:ai.f(t)})}function ei(t,e){var n=wi[t]=Qt(vi[li]);return fi(n,{type:hi,tag:t,description:e}),f||(n.description=e),n}function ni(e,t){m(e);var n=u(t),t=Ft(n).concat(Ri(n));return ui(t,function(t){f&&!Ai.call(n,t)||Ni(e,t,n[t])}),e}var ri=Tt.f,ii={}.toString,oi="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Z={f:function(t){return oi&&"[object Window]"==ii.call(t)?function(t){try{return ri(t)}catch(t){return oi.slice()}}(t):ri(u(t))}},ai={f:Wt},si=A.f,ui=Sn.forEach,ci=J("hidden"),hi="Symbol",li="prototype",Sn=Wt("toPrimitive"),fi=lt.set,pi=lt.getterFor(hi),di=Object[li],vi=b.Symbol,gi=et("JSON","stringify"),yi=k.f,mi=A.f,bi=Z.f,_i=p.f,wi=z("symbols"),Ii=z("op-symbols"),Ti=z("string-to-symbol-registry"),Ei=z("symbol-to-string-registry"),J=z("wks"),z=b.QObject,Si=!z||!z[li]||!z[li].findChild,Ci=f&&g(function(){return 7!=Qt(mi({},"a",{get:function(){return mi(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=yi(di,e);r&&delete di[e],mi(t,e,n),r&&t!==di&&mi(di,e,r)}:mi,ki=s?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof vi},Ni=function(t,e,n){t===di&&Ni(Ii,e,n),m(t);e=i(e,!0);return m(n),c(wi,e)?(n.enumerable?(c(t,ci)&&t[ci][e]&&(t[ci][e]=!1),n=Qt(n,{enumerable:v(0,!1)})):(c(t,ci)||mi(t,ci,v(1,{})),t[ci][e]=!0),Ci(t,e,n)):mi(t,e,n)},Ai=function(t){var e=i(t,!0),t=_i.call(this,e);return!(this===di&&c(wi,e)&&!c(Ii,e))&&(!(t||!c(this,e)||!c(wi,e)||c(this,ci)&&this[ci][e])||t)},z=function(t,e){var n=u(t),t=i(e,!0);if(n!==di||!c(wi,t)||c(Ii,t)){e=yi(n,t);return!e||!c(wi,t)||c(n,ci)&&n[ci][t]||(e.enumerable=!0),e}},s=function(t){var t=bi(u(t)),e=[];return ui(t,function(t){c(wi,t)||c($,t)||e.push(t)}),e},Ri=function(t){var e=t===di,t=bi(e?Ii:u(t)),n=[];return ui(t,function(t){!c(wi,t)||e&&!c(di,t)||n.push(wi[t])}),n};Yt||(ft((vi=function(){if(this instanceof vi)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=x(t),n=function(t){this===di&&n.call(Ii,t),c(this,ci)&&c(this[ci],e)&&(this[ci][e]=!1),Ci(this,e,v(1,t))};return f&&Si&&Ci(di,e,{configurable:!0,set:n}),ei(e,t)})[li],"toString",function(){return pi(this).tag}),ft(vi,"withoutSetter",function(t){return ei(x(t),t)}),p.f=Ai,A.f=Ni,k.f=z,Tt.f=Z.f=s,Et.f=Ri,ai.f=function(t){return ei(Wt(t),t)},f&&(mi(vi[li],"description",{configurable:!0,get:function(){return pi(this).description}}),ft(di,"propertyIsEnumerable",Ai,{unsafe:!0}))),at({global:!0,wrap:!0,forced:!Yt,sham:!Yt},{Symbol:vi}),ui(Ft(J),function(t){ti(t)}),at({target:hi,stat:!0,forced:!Yt},{for:function(t){var e=String(t);if(c(Ti,e))return Ti[e];t=vi(e);return Ti[e]=t,Ei[t]=e,t},keyFor:function(t){if(!ki(t))throw TypeError(t+" is not a symbol");if(c(Ei,t))return Ei[t]},useSetter:function(){Si=!0},useSimple:function(){Si=!1}}),at({target:"Object",stat:!0,forced:!Yt,sham:!f},{create:function(t,e){return void 0===e?Qt(t):ni(Qt(t),e)},defineProperty:Ni,defineProperties:ni,getOwnPropertyDescriptor:z}),at({target:"Object",stat:!0,forced:!Yt},{getOwnPropertyNames:s,getOwnPropertySymbols:Ri}),at({target:"Object",stat:!0,forced:g(function(){Et.f(1)})},{getOwnPropertySymbols:function(t){return Et.f(st(t))}}),gi&&(Ki=!Yt||g(function(){var t=vi();return"[null]"!=gi([t])||"{}"!=gi({a:t})||"{}"!=gi(Object(t))}),at({target:"JSON",stat:!0,forced:Ki},{stringify:function(t,e,n){for(var r,i=[t],o=1;o<arguments.length;)i.push(arguments[o++]);if((y(r=e)||void 0!==t)&&!ki(t))return ur(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!ki(e))return e}),i[1]=e,gi.apply(null,i)}})),vi[li][Sn]||R(vi[li],Sn,vi[li].valueOf),fe(vi,hi),$[ci]=!0,ti("asyncIterator");var Oi,Pi,Di,xi,Li,z=A.f,Mi=b.Symbol;!f||"function"!=typeof Mi||"description"in Mi.prototype&&void 0===Mi().description||(Oi={},ot(Pi=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof Pi?new Mi(t):void 0===t?Mi():Mi(t);return""===t&&(Oi[e]=!0),e},Mi),(Gi=Pi.prototype=Mi.prototype).constructor=Pi,Di=Gi.toString,xi="Symbol(test)"==String(Mi("test")),Li=/^Symbol\((.*)\)[^)]+$/,z(Gi,"description",{configurable:!0,get:function(){var t=y(this)?this.valueOf():this,e=Di.call(t);if(c(Oi,t))return"";e=xi?e.slice(7,-1):e.replace(Li,"$1");return""===e?void 0:e}}),at({global:!0,forced:!0},{Symbol:Pi})),ti("hasInstance"),ti("isConcatSpreadable"),ti("iterator"),ti("match"),ti("matchAll"),ti("replace"),ti("search"),ti("species"),ti("split"),ti("toPrimitive"),ti("toStringTag"),ti("unscopables"),fe(b.JSON,"JSON",!0),fe(Math,"Math",!0),at({global:!0},{Reflect:{}}),fe(b.Reflect,"Reflect",!0);pt.Symbol;ti("asyncDispose"),ti("dispose"),ti("observable"),ti("patternMatch"),ti("replaceAll");ai.f("iterator");var Fi=!g(function(){return Object.isExtensible(Object.preventExtensions({}))}),Ui=e(function(t){function n(t){e(t,r,{value:{objectID:"O"+ ++i,weakData:{}}})}var e=A.f,r=x("meta"),i=0,o=Object.isExtensible||function(){return!0},a=t.exports={REQUIRED:!1,fastKey:function(t,e){if(!y(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!c(t,r)){if(!o(t))return"F";if(!e)return"E";n(t)}return t[r].objectID},getWeakData:function(t,e){if(!c(t,r)){if(!o(t))return!0;if(!e)return!1;n(t)}return t[r].weakData},onFreeze:function(t){return Fi&&a.REQUIRED&&o(t)&&!c(t,r)&&n(t),t}};$[r]=!0}),s=function(a,t,e){function n(t){var n=p[t];ft(p,t,"add"==t?function(t){return n.call(this,0===t?0:t),this}:"delete"==t?function(t){return!(h&&!y(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return h&&!y(t)?void 0:n.call(this,0===t?0:t)}:"has"==t?function(t){return!(h&&!y(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,s,u,c=-1!==a.indexOf("Map"),h=-1!==a.indexOf("Weak"),l=c?"set":"add",f=b[a],p=f&&f.prototype,d=f,v={};return Ot(a,"function"!=typeof f||!(h||p.forEach&&!g(function(){(new f).entries().next()})))?(d=e.getConstructor(t,a,c,l),Ui.REQUIRED=!0):Ot(a,!0)&&(i=(r=new d)[l](h?{}:-0,1)!=r,o=g(function(){r.has(1)}),s=Te(function(t){new f(t)}),u=!h&&g(function(){for(var t=new f,e=5;e--;)t[l](e,e);return!t.has(-0)}),s||(((d=t(function(t,e){de(t,d,a);var n,r,i,o,n=(n=new f,r=t,t=d,Mt&&"function"==typeof(i=r.constructor)&&i!==t&&y(o=i.prototype)&&o!==t.prototype&&Mt(n,o),n);return null!=e&&oe(e,n[l],{that:n,AS_ENTRIES: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[a]=d,at({global:!0,forced:d!=f},v),fe(d,a),h||e.setStrong(d,a,c),d},ji=A.f,qi=Ui.fastKey,Vi=lt.set,Bi=lt.getterFor,Ki={getConstructor:function(t,n,r,i){function o(t,e,n){var r,i=s(t),o=u(t,e);return o?o.value=n:(i.last=o={index:r=qi(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 a=t(function(t,e){de(t,a,n),Vi(t,{type:n,index:Qt(null),first:void 0,last:void 0,size:0}),f||(t.size=0),null!=e&&oe(e,t[i],{that:t,AS_ENTRIES:r})}),s=Bi(n),u=function(t,e){var n,r=s(t),t=qi(e);if("F"!==t)return r.index[t];for(n=r.first;n;n=n.next)if(n.key==e)return n};return le(a.prototype,{clear:function(){for(var t=s(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=s(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){for(var e,n=s(this),r=zt(t,1<arguments.length?arguments[1]:void 0,3);e=e?e.next:n.first;)for(r(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!u(this,t)}}),le(a.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&&ji(a.prototype,"size",{get:function(){return s(this).size}}),a},setStrong:function(t,e,n){var r=e+" Iterator",i=Bi(e),o=Bi(r);xn(t,e,function(t,e){Vi(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),pe(e)}},Sn=(s("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Ki),pt.Map,function(t){var e,n,r,i,o=arguments.length,a=1<o?arguments[1]:void 0;return Gt(this),(e=void 0!==a)&&Gt(a),null==t?new this:(n=[],e?(r=0,i=zt(a,2<o?arguments[2]:void 0,2),oe(t,function(t){n.push(i(t,r++))})):oe(t,n.push,{that:n}),new this(n))});at({target:"Map",stat:!0},{from:Sn});z=function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)};at({target:"Map",stat:!0},{of:z});function Wi(){for(var t,e=m(this),n=Gt(e.delete),r=!0,i=0,o=arguments.length;i<o;i++)t=n.call(e,arguments[i]),r=r&&t;return!!r}at({target:"Map",proto:!0,real:!0,forced:G},{deleteAll:function(){return Wi.apply(this,arguments)}});at({target:"Map",proto:!0,real:!0,forced:G},{emplace:function(t,e){var n=m(this),e=n.has(t)&&"update"in e?e.update(n.get(t),t,n):e.insert(t,n);return n.set(t,e),e}});function Hi(t){return Map.prototype.entries.call(t)}at({target:"Map",proto:!0,real:!0,forced:G},{every:function(t){var r=m(this),e=Hi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return!oe(e,function(t,e,n){if(!i(e,t,r))return n()},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),at({target:"Map",proto:!0,real:!0,forced:G},{filter:function(t){var n=m(this),e=Hi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ee(n,et("Map"))),o=Gt(i.set);return oe(e,function(t,e){r(e,t,n)&&o.call(i,t,e)},{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}}),at({target:"Map",proto:!0,real:!0,forced:G},{find:function(t){var r=m(this),e=Hi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return oe(e,function(t,e,n){if(i(e,t,r))return n(e)},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),at({target:"Map",proto:!0,real:!0,forced:G},{findKey:function(t){var r=m(this),e=Hi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return oe(e,function(t,e,n){if(i(e,t,r))return n(t)},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),at({target:"Map",stat:!0},{groupBy:function(t,n){var r=new this;Gt(n);var i=Gt(r.has),o=Gt(r.get),a=Gt(r.set);return oe(t,function(t){var e=n(t);i.call(r,e)?o.call(r,e).push(t):a.call(r,e,[t])}),r}});at({target:"Map",proto:!0,real:!0,forced:G},{includes:function(i){return oe(Hi(m(this)),function(t,e,n){if((r=e)===(e=i)||r!=r&&e!=e)return n();var r},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),at({target:"Map",stat:!0},{keyBy:function(t,e){var n=new this;Gt(e);var r=Gt(n.set);return oe(t,function(t){r.call(n,e(t),t)}),n}}),at({target:"Map",proto:!0,real:!0,forced:G},{keyOf:function(r){return oe(Hi(m(this)),function(t,e,n){if(e===r)return n(t)},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),at({target:"Map",proto:!0,real:!0,forced:G},{mapKeys:function(t){var n=m(this),e=Hi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ee(n,et("Map"))),o=Gt(i.set);return oe(e,function(t,e){o.call(i,r(e,t,n),e)},{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}}),at({target:"Map",proto:!0,real:!0,forced:G},{mapValues:function(t){var n=m(this),e=Hi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ee(n,et("Map"))),o=Gt(i.set);return oe(e,function(t,e){o.call(i,t,r(e,t,n))},{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}}),at({target:"Map",proto:!0,real:!0,forced:G},{merge:function(t){for(var e=m(this),n=Gt(e.set),r=0;r<arguments.length;)oe(arguments[r++],n,{that:e,AS_ENTRIES:!0});return e}}),at({target:"Map",proto:!0,real:!0,forced:G},{reduce:function(n){var r=m(this),t=Hi(r),i=arguments.length<2,o=i?void 0:arguments[1];if(Gt(n),oe(t,function(t,e){o=i?(i=!1,e):n(o,e,t,r)},{AS_ENTRIES:!0,IS_ITERATOR:!0}),i)throw TypeError("Reduce of empty map with no initial value");return o}}),at({target:"Map",proto:!0,real:!0,forced:G},{some:function(t){var r=m(this),e=Hi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return oe(e,function(t,e,n){if(i(e,t,r))return n()},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),at({target:"Map",proto:!0,real:!0,forced:G},{update:function(t,e){var n=m(this),r=arguments.length;Gt(e);var i=n.has(t);if(!i&&r<3)throw TypeError("Updating absent value");r=i?n.get(t):Gt(2<r?arguments[2]:void 0)(t,n);return n.set(t,e(r,t,n)),n}});var Gi=function(t,e){var n,r=m(this),i=2<arguments.length?arguments[2]:void 0;if("function"!=typeof e&&"function"!=typeof i)throw TypeError("At least one callback required");return r.has(t)?(n=r.get(t),"function"==typeof e&&(n=e(n),r.set(t,n))):"function"==typeof i&&(n=i(),r.set(t,n)),n};at({target:"Map",proto:!0,real:!0,forced:G},{upsert:Gi}),at({target:"Map",proto:!0,real:!0,forced:G},{updateOrInsert:Gi});s("Set",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Ki),pt.Set;at({target:"Set",stat:!0},{from:Sn}),at({target:"Set",stat:!0},{of:z});at({target:"Set",proto:!0,real:!0,forced:G},{addAll:function(){return function(){for(var t=m(this),e=Gt(t.add),n=0,r=arguments.length;n<r;n++)e.call(t,arguments[n]);return t}.apply(this,arguments)}}),at({target:"Set",proto:!0,real:!0,forced:G},{deleteAll:function(){return Wi.apply(this,arguments)}});function zi(t){return Set.prototype.values.call(t)}at({target:"Set",proto:!0,real:!0,forced:G},{every:function(t){var n=m(this),e=zi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3);return!oe(e,function(t,e){if(!r(t,t,n))return e()},{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),at({target:"Set",proto:!0,real:!0,forced:G},{difference:function(t){var e=m(this),n=new(Ee(e,et("Set")))(e),r=Gt(n.delete);return oe(t,function(t){r.call(n,t)}),n}}),at({target:"Set",proto:!0,real:!0,forced:G},{filter:function(t){var e=m(this),n=zi(e),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ee(e,et("Set"))),o=Gt(i.add);return oe(n,function(t){r(t,t,e)&&o.call(i,t)},{IS_ITERATOR:!0}),i}}),at({target:"Set",proto:!0,real:!0,forced:G},{find:function(t){var n=m(this),e=zi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3);return oe(e,function(t,e){if(r(t,t,n))return e(t)},{IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),at({target:"Set",proto:!0,real:!0,forced:G},{intersection:function(t){var e=m(this),n=new(Ee(e,et("Set"))),r=Gt(e.has),i=Gt(n.add);return oe(t,function(t){r.call(e,t)&&i.call(n,t)}),n}}),at({target:"Set",proto:!0,real:!0,forced:G},{isDisjointFrom:function(t){var n=m(this),r=Gt(n.has);return!oe(t,function(t,e){if(!0===r.call(n,t))return e()},{INTERRUPTED:!0}).stopped}}),at({target:"Set",proto:!0,real:!0,forced:G},{isSubsetOf:function(t){var e=function(t){var e=ne(t);if("function"!=typeof e)throw TypeError(String(t)+" is not iterable");return m(e.call(t))}(this),n=m(t),r=n.has;return"function"!=typeof r&&(n=new(et("Set"))(t),r=Gt(n.has)),!oe(e,function(t,e){if(!1===r.call(n,t))return e()},{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),at({target:"Set",proto:!0,real:!0,forced:G},{isSupersetOf:function(t){var n=m(this),r=Gt(n.has);return!oe(t,function(t,e){if(!1===r.call(n,t))return e()},{INTERRUPTED:!0}).stopped}}),at({target:"Set",proto:!0,real:!0,forced:G},{join:function(t){var e=m(this),n=zi(e),e=void 0===t?",":String(t),t=[];return oe(n,t.push,{that:t,IS_ITERATOR:!0}),t.join(e)}}),at({target:"Set",proto:!0,real:!0,forced:G},{map:function(t){var e=m(this),n=zi(e),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ee(e,et("Set"))),o=Gt(i.add);return oe(n,function(t){o.call(i,r(t,t,e))},{IS_ITERATOR:!0}),i}}),at({target:"Set",proto:!0,real:!0,forced:G},{reduce:function(e){var n=m(this),t=zi(n),r=arguments.length<2,i=r?void 0:arguments[1];if(Gt(e),oe(t,function(t){i=r?(r=!1,t):e(i,t,t,n)},{IS_ITERATOR:!0}),r)throw TypeError("Reduce of empty set with no initial value");return i}}),at({target:"Set",proto:!0,real:!0,forced:G},{some:function(t){var n=m(this),e=zi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3);return oe(e,function(t,e){if(r(t,t,n))return e()},{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),at({target:"Set",proto:!0,real:!0,forced:G},{symmetricDifference:function(t){var e=m(this),n=new(Ee(e,et("Set")))(e),r=Gt(n.delete),i=Gt(n.add);return oe(t,function(t){r.call(n,t)||i.call(n,t)}),n}}),at({target:"Set",proto:!0,real:!0,forced:G},{union:function(t){var e=m(this),e=new(Ee(e,et("Set")))(e);return oe(t,Gt(e.add),{that:e}),e}});var Qi=Math.floor;at({target:"Number",stat:!0},{isInteger:function(t){return!y(t)&&isFinite(t)&&Qi(t)===t}});pt.Number.isInteger;at({target:"Number",stat:!0},{isNaN:function(t){return t!=t}});pt.Number.isNaN;var Yi=function(t,e){return(Yi=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 Xi(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Yi(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Ji=function(){return(Ji=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 $i(t,a,s,u){return new(s=s||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 s?e:new s(function(t){t(e)})).then(r,i)}o((u=u.apply(t,a||[])).next())})}function Zi(n,r){var i,o,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(;s;)try{if(i=1,o&&(a=2&e[0]?o.return:e[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,e[1])).done)return a;switch(o=0,(e=a?[2&e[0],a.value]:e)[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,o=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=r.call(n,s)}catch(t){e=[6,t],o=0}finally{i=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}function to(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{value:(t=t&&r>=t.length?void 0: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),a=[];try{for(;(void 0===e||0<e--)&&!(r=o.next()).done;)a.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 a}function no(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t}function ro(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 io(t){try{return uo.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}var oo={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},ao=function(t,e){if(!t)throw so(e)},so=function(t){return new Error("Firebase Database ("+oo.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},uo={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],a=i+1<t.length,s=a?t[i+1]:0,u=i+2<t.length,c=u?t[i+2]:0,h=o>>2,o=(3&o)<<4|s>>4,s=(15&s)<<2|c>>6,c=63&c;u||(c=64,a||(s=64)),r.push(n[h],n[o],n[s],n[c])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(ro(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,a,s=t[n++];s<128?e[r++]=String.fromCharCode(s):191<s&&s<224?(o=t[n++],e[r++]=String.fromCharCode((31&s)<<6|63&o)):239<s&&s<365?(i=((7&s)<<18|(63&(o=t[n++]))<<12|(63&(a=t[n++]))<<6|63&t[n++])-65536,e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))):(o=t[n++],a=t[n++],e[r++]=String.fromCharCode((15&s)<<12|(63&o)<<6|63&a))}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<t.length;){var o=n[t.charAt(i++)],a=i<t.length?n[t.charAt(i)]:0,s=++i<t.length?n[t.charAt(i)]:64,u=++i<t.length?n[t.charAt(i)]:64;if(++i,null==o||null==a||null==s||null==u)throw Error();o=o<<2|a>>4;r.push(o),64!==s&&(a=a<<4&240|s>>2,r.push(a),64!==u&&(u=s<<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 co(t){return ho(void 0,t)}function ho(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)&&"__proto__"!==n&&(t[n]=ho(t[n],e[n]));return t}var lo=(fo.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))}},fo);function fo(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}function po(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function vo(){return"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(po())}function go(){var t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}function yo(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function mo(){return!0===oo.NODE_ADMIN}function bo(){return"indexedDB"in self&&null!=indexedDB}function _o(){return new Promise(function(t,e){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=function(){i.result.close(),n||self.indexedDB.deleteDatabase(r),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 wo(){return!(!navigator||!navigator.cookieEnabled)}var Io,To="FirebaseError",Eo=(Xi(So,Io=Error),So);function So(t,e,n){e=Io.call(this,e)||this;return e.code=t,e.customData=n,e.name=To,Object.setPrototypeOf(e,So.prototype),Error.captureStackTrace&&Error.captureStackTrace(e,Co.prototype.create),e}var Co=(ko.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r,i=e[0]||{},o=this.service+"/"+t,t=this.errors[t],t=t?(r=i,t.replace(No,function(t,e){var n=r[e];return null!=n?String(n):"<"+e+"?>"})):"Error",t=this.serviceName+": "+t+" ("+o+").";return new Eo(o,t,i)},ko);function ko(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var No=/\{\$([^}]+)}/g;function Ao(t){return JSON.parse(t)}function Ro(t){return JSON.stringify(t)}function Oo(t){var e={},n={},r={},i="";try{var o=t.split("."),e=Ao(io(o[0])||""),n=Ao(io(o[1])||""),i=o[2],r=n.d||{};delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}}function Po(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Do(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]}function xo(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Lo(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}function Mo(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("&"):""}var Fo=(Uo.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},Uo.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,a=this.chain_[0],s=this.chain_[1],u=this.chain_[2],c=this.chain_[3],h=this.chain_[4],r=0;r<80;r++)var l=r<40?r<20?(o=c^s&(u^c),1518500249):(o=s^u^c,1859775393):r<60?(o=s&u|c&(s|u),2400959708):(o=s^u^c,3395469782),i=(a<<5|a>>>27)+o+h+l+n[r]&4294967295,h=c,c=u,u=4294967295&(s<<30|s>>>2),s=a,a=i;this.chain_[0]=this.chain_[0]+a&4294967295,this.chain_[1]=this.chain_[1]+s&4294967295,this.chain_[2]=this.chain_[2]+u&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295},Uo.prototype.update=function(t,e){if(null!=t){for(var n=(e=void 0===e?t.length: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}},Uo.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},Uo);function Uo(){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 jo(t,e){e=new qo(t,e);return e.subscribe.bind(e)}var qo=(Vo.prototype.next=function(e){this.forEachObserver(function(t){t.next(e)})},Vo.prototype.error=function(e){this.forEachObserver(function(t){t.error(e)}),this.close(e)},Vo.prototype.complete=function(){this.forEachObserver(function(t){t.complete()}),this.close()},Vo.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=Bo),void 0===r.error&&(r.error=Bo),void 0===r.complete&&(r.complete=Bo);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},Vo.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))},Vo.prototype.forEachObserver=function(t){if(!this.finalized)for(var e=0;e<this.observers.length;e++)this.sendOne(e,t)},Vo.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)}})},Vo.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}))},Vo);function Vo(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 Bo(){}function Ko(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 Wo(t,e){return t+" failed: "+e+" argument "}function Ho(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(Wo(t,e)+"must be a valid function.")}function Go(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(Wo(t,e)+"must be a valid context object.")}function zo(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 Qo=1e3,Yo=2,Xo=144e5,Jo=.5;function $o(t,e,n){void 0===n&&(n=Yo);n=(e=void 0===e?Qo:e)*Math.pow(n,t),t=Math.round(Jo*n*(Math.random()-.5)*2);return Math.min(Xo,n+t)}function Zo(t){return t&&t._delegate?t._delegate:t}var ta=(ea.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},ea.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},ea.prototype.setServiceProps=function(t){return this.serviceProps=t,this},ea.prototype.setInstanceCreatedCallback=function(t){return this.onInstanceCreated=t,this},ea);function ea(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}var na="[DEFAULT]",ra=(ia.prototype.get=function(t){void 0===t&&(t=na);var e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){var n=new lo;if(this.instancesDeferred.set(e,n),this.isInitialized(e)||this.shouldAutoInitialize())try{var r=this.getOrInitializeService({instanceIdentifier:e});r&&n.resolve(r)}catch(t){}}return this.instancesDeferred.get(e).promise},ia.prototype.getImmediate=function(t){var e=Ji({identifier:na,optional:!1},t),t=e.identifier,e=e.optional,n=this.normalizeInstanceIdentifier(t);if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(e)return null;throw Error("Service "+this.name+" is not available")}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(e)return null;throw t}},ia.prototype.getComponent=function(){return this.component},ia.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(this.component=t,this.shouldAutoInitialize()){if("EAGER"===t.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:na})}catch(t){}try{for(var r=to(this.instancesDeferred.entries()),i=r.next();!i.done;i=r.next()){var o=eo(i.value,2),a=o[0],s=o[1],u=this.normalizeInstanceIdentifier(a);try{var c=this.getOrInitializeService({instanceIdentifier:u});s.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}}}},ia.prototype.clearInstance=function(t){void 0===t&&(t=na),this.instancesDeferred.delete(t),this.instances.delete(t)},ia.prototype.delete=function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=Array.from(this.instances.values()),[4,Promise.all(no(no([],eo(e.filter(function(t){return"INTERNAL"in t}).map(function(t){return t.INTERNAL.delete()}))),eo(e.filter(function(t){return"_delete"in t}).map(function(t){return t._delete()}))))];case 1:return t.sent(),[2]}})})},ia.prototype.isComponentSet=function(){return null!=this.component},ia.prototype.isInitialized=function(t){return void 0===t&&(t=na),this.instances.has(t)},ia.prototype.initialize=function(t){var e,n,r=(t=void 0===t?{}:t).instanceIdentifier,r=void 0===r?na:r,t=t.options,t=void 0===t?{}:t,i=this.normalizeInstanceIdentifier(r);if(this.isInitialized(i))throw Error(this.name+"("+i+") has already been initialized");if(!this.isComponentSet())throw Error("Component "+this.name+" has not been registered yet");var o=this.getOrInitializeService({instanceIdentifier:i,options:t});try{for(var a=to(this.instancesDeferred.entries()),s=a.next();!s.done;s=a.next()){var u=eo(s.value,2),c=u[0],u=u[1];i===this.normalizeInstanceIdentifier(c)&&u.resolve(o)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return o},ia.prototype.getOrInitializeService=function(t){var e=t.instanceIdentifier,n=t.options,t=void 0===n?{}:n,r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e)===na?void 0:n,options:t}),this.instances.set(e,r),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch(t){}return r||null},ia.prototype.normalizeInstanceIdentifier=function(t){return!this.component||this.component.multipleInstances?t:na},ia.prototype.shouldAutoInitialize=function(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode},ia);function ia(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}var oa=(aa.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)},aa.prototype.addOrOverwriteComponent=function(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)},aa.prototype.getProvider=function(t){if(this.providers.has(t))return this.providers.get(t);var e=new ra(t,this);return this.providers.set(t,e),e},aa.prototype.getProviders=function(){return Array.from(this.providers.values())},aa);function aa(t){this.name=t,this.providers=new Map}var sa,ua=[];(Sn=sa=sa||{})[Sn.DEBUG=0]="DEBUG",Sn[Sn.VERBOSE=1]="VERBOSE",Sn[Sn.INFO=2]="INFO",Sn[Sn.WARN=3]="WARN",Sn[Sn.ERROR=4]="ERROR",Sn[Sn.SILENT=5]="SILENT";function ca(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(e<t.logLevel)){var i=(new Date).toISOString(),o=fa[e];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+e+")");console[o].apply(console,no(["["+i+"]  "+t.name+":"],n))}}var ha={debug:sa.DEBUG,verbose:sa.VERBOSE,info:sa.INFO,warn:sa.WARN,error:sa.ERROR,silent:sa.SILENT},la=sa.INFO,fa=((z={})[sa.DEBUG]="log",z[sa.VERBOSE]="log",z[sa.INFO]="info",z[sa.WARN]="warn",z[sa.ERROR]="error",z),pa=(Object.defineProperty(da.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in sa))throw new TypeError('Invalid value "'+t+'" assigned to `logLevel`');this._logLevel=t},enumerable:!1,configurable:!0}),da.prototype.setLogLevel=function(t){this._logLevel="string"==typeof t?ha[t]:t},Object.defineProperty(da.prototype,"logHandler",{get:function(){return this._logHandler},set:function(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t},enumerable:!1,configurable:!0}),Object.defineProperty(da.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!1,configurable:!0}),da.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,no([this,sa.DEBUG],t)),this._logHandler.apply(this,no([this,sa.DEBUG],t))},da.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,no([this,sa.VERBOSE],t)),this._logHandler.apply(this,no([this,sa.VERBOSE],t))},da.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,no([this,sa.INFO],t)),this._logHandler.apply(this,no([this,sa.INFO],t))},da.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,no([this,sa.WARN],t)),this._logHandler.apply(this,no([this,sa.WARN],t))},da.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,no([this,sa.ERROR],t)),this._logHandler.apply(this,no([this,sa.ERROR],t))},da);function da(t){this.name=t,this._logLevel=la,this._logHandler=ca,this._userLogHandler=null,ua.push(this)}function va(e){ua.forEach(function(t){t.setLogLevel(e)})}function ga(a,e){for(var t=0,n=ua;t<n.length;t++)!function(t){var o=null;e&&e.level&&(o=ha[e.level]),t.userLogHandler=null===a?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)&&a({level:sa[e].toLowerCase(),message:i,args:n,type:t.name})}}(n[t])}var Sn=((G={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",G["bad-app-name"]="Illegal App name: '{$appName}",G["duplicate-app"]="Firebase App named '{$appName}' already exists",G["app-deleted"]="Firebase App named '{$appName}' already deleted",G["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",G["invalid-log-argument"]="First argument to `onLog` must be null or a function.",G),ya=new Co("app","Firebase",Sn),ma="@firebase/app",ba="[DEFAULT]",_a=((z={})[ma]="fire-core",z["@firebase/analytics"]="fire-analytics",z["@firebase/auth"]="fire-auth",z["@firebase/database"]="fire-rtdb",z["@firebase/functions"]="fire-fn",z["@firebase/installations"]="fire-iid",z["@firebase/messaging"]="fire-fcm",z["@firebase/performance"]="fire-perf",z["@firebase/remote-config"]="fire-rc",z["@firebase/storage"]="fire-gcs",z["@firebase/firestore"]="fire-fst",z["fire-js"]="fire-js",z["firebase-wrapper"]="fire-js-all",z),wa=new pa("@firebase/app"),Ia=(Object.defineProperty(Ta.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(t){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=t},enumerable:!1,configurable:!0}),Object.defineProperty(Ta.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(Ta.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),Ta.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})},Ta.prototype._getService=function(t,e){return void 0===e&&(e=ba),this.checkDestroyed_(),this.container.getProvider(t).getImmediate({identifier:e})},Ta.prototype._removeServiceInstance=function(t,e){void 0===e&&(e=ba),this.container.getProvider(t).clearInstance(e)},Ta.prototype._addComponent=function(e){try{this.container.addComponent(e)}catch(t){wa.debug("Component "+e.name+" failed to register with FirebaseApp "+this.name,t)}},Ta.prototype._addOrOverwriteComponent=function(t){this.container.addOrOverwriteComponent(t)},Ta.prototype.toJSON=function(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}},Ta.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw ya.create("app-deleted",{appName:this.name_})},Ta);function Ta(t,e,n){var r=this;this.firebase_=n,this.isDeleted_=!1,this.name_=e.name,this.automaticDataCollectionEnabled_=e.automaticDataCollectionEnabled||!1,this.options_=co(t),this.container=new oa(e.name),this._addComponent(new ta("app",function(){return r},"PUBLIC")),this.firebase_.INTERNAL.components.forEach(function(t){return r._addComponent(t)})}Ia.prototype.name&&Ia.prototype.options||Ia.prototype.delete||console.log("dc");var Ea="8.4.2";function Sa(a){var s={},u=new Map,c={__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=ba);e=n.name;if("string"!=typeof e||!e)throw ya.create("bad-app-name",{appName:String(e)});if(Po(s,e))throw ya.create("duplicate-app",{appName:e});n=new a(t,n,c);return s[e]=n},app:h,registerVersion:function(t,e,n){var r=null!==(i=_a[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 wa.warn(n.join(" "))}o(new ta(r+"-version",function(){return{library:r,version:e}},"VERSION"))},setLogLevel:va,onLog:function(t,e){if(null!==t&&"function"!=typeof t)throw ya.create("invalid-log-argument");ga(t,e)},apps:null,SDK_VERSION:Ea,INTERNAL:{registerComponent:o,removeApp:function(t){delete s[t]},components:u,useAsService:function(t,e){if("serverAuth"===e)return null;return e}}};function h(t){if(!Po(s,t=t||ba))throw ya.create("no-app",{appName:t});return s[t]}function o(n){var t,r=n.name;if(u.has(r))return wa.debug("There were multiple attempts to register component "+r+"."),"PUBLIC"===n.type?c[r]:null;u.set(r,n),"PUBLIC"===n.type&&(t=function(t){if("function"!=typeof(t=void 0===t?h():t)[r])throw ya.create("invalid-app-argument",{appName:r});return t[r]()},void 0!==n.serviceProps&&ho(t,n.serviceProps),c[r]=t,a.prototype[r]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._getService.bind(this,r).apply(this,n.multipleInstances?t:[])});for(var e=0,i=Object.keys(s);e<i.length;e++){var o=i[e];s[o]._addComponent(n)}return"PUBLIC"===n.type?c[r]:null}return c.default=c,Object.defineProperty(c,"apps",{get:function(){return Object.keys(s).map(function(t){return s[t]})}}),h.App=a,c}var G=function t(){var e=Sa(Ia);return e.INTERNAL=Ji(Ji({},e.INTERNAL),{createFirebaseNamespace:t,extendNamespace:function(t){ho(e,t)},createSubscribe:jo,ErrorFactory:Co,deepExtend:ho}),e}(),Ca=(ka.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(" ")},ka);function ka(t){this.container=t}"object"==typeof self&&self.self===self&&void 0!==self.firebase&&(wa.warn("\n    Warning: Firebase is already defined in the global scope. Please make sure\n    Firebase library is only loaded once.\n  "),(Hs=self.firebase.SDK_VERSION)&&0<=Hs.indexOf("LITE")&&wa.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 Na=G.initializeApp;G.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}}()&&wa.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      '),Na.apply(void 0,t)};var Aa,Ra,Xl=G;(Aa=Xl).INTERNAL.registerComponent(new ta("platform-logger",function(t){return new Ca(t)},"PRIVATE")),Aa.registerVersion(ma,"0.6.20",Ra),Aa.registerVersion("fire-js","");Xl.registerVersion("firebase","8.4.2","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 a(t){this.b=0,this.c=void 0,this.a=[];var e=this.f();try{t(e.resolve,e.reject)}catch(t){e.reject(t)}}function e(){this.a=null}function s(e){return e instanceof a?e:new a(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})},a.prototype.f=function(){function t(e){return function(t){r||(r=!0,e.call(n,t))}}var n=this,r=!1;return{resolve:t(this.m),reject:t(this.g)}},a.prototype.m=function(t){if(t===this)this.g(new TypeError("A Promise cannot resolve to itself"));else if(t instanceof a)this.s(t);else{t:switch(typeof t){case"object":var e=null!=t;break t;case"function":e=!0;break t;default:e=!1}e?this.v(t):this.h(t)}},a.prototype.v=function(t){var e=void 0;try{e=t.then}catch(t){return void this.g(t)}"function"==typeof e?this.u(e,t):this.h(t)},a.prototype.g=function(t){this.i(2,t)},a.prototype.h=function(t){this.i(1,t)},a.prototype.i=function(t,e){if(0!=this.b)throw Error("Cannot settle("+t+", "+e+"): Promise already settled in state"+this.b);this.b=t,this.c=e,this.l()},a.prototype.l=function(){if(null!=this.a){for(var t=0;t<this.a.length;++t)i.b(this.a[t]);this.a=null}};var i=new e;return a.prototype.s=function(t){var e=this.f();t.Qa(e.resolve,e.reject)},a.prototype.u=function(t,e){var n=this.f();try{t.call(e,n.resolve,n.reject)}catch(t){n.reject(t)}},a.prototype.then=function(t,e){function n(e,t){return"function"==typeof e?function(t){try{r(e(t))}catch(t){i(t)}}:t}var r,i,o=new a(function(t,e){r=t,i=e});return this.Qa(n(t,r),n(e,i)),o},a.prototype.catch=function(t){return this.then(void 0,t)},a.prototype.Qa=function(t,e){function n(){switch(r.b){case 1:t(r.c);break;case 2:e(r.c);break;default:throw Error("Unexpected state: "+r.b)}}var r=this;null==this.a?i.b(n):this.a.push(n)},a.resolve=s,a.reject=function(n){return new a(function(t,e){e(n)})},a.race=function(i){return new a(function(t,e){for(var n=c(i),r=n.next();!r.done;r=n.next())s(r.value).Qa(t,e)})},a.all=function(t){var e=c(t),o=e.next();return o.done?s([]):new a(function(n,t){for(var r=[],i=0;r.push(void 0),i++,s(o.value).Qa(function(e){return function(t){r[e]=t,0==--i&&n(r)}}(r.length-1),t),o=e.next(),!o.done;);})},a});var h=h||{},l=this||self,e=/^[\w+/_-]+[=]{0,2}$/,s=null;function f(t){return(t=t.querySelector&&t.querySelector("script[nonce]"))&&(t=t.nonce||t.getAttribute("nonce"))&&e.test(t)?t:""}function a(){}function p(t){var e=typeof t;return"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}function d(t){var e=p(t);return"array"==e||"object"==e&&"number"==typeof t.length}function v(t){return"function"==p(t)}function g(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var n="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 m(t,e,n){return(m=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?i:y).apply(null,arguments)}function b(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)}}function _(t,e){function n(){}n.prototype=e.prototype,t.ab=e.prototype,t.prototype=new n,t.prototype.constructor=t}function w(t){return t}function I(t,e,n){this.code=S+t,this.message=e||C[t]||"",this.a=n||null}function T(t){var e=t&&t.code;return e?new I(e.substring(S.length),t.message,t.serverResponse):null}_(I,Error),I.prototype.w=function(){var t={code:this.code,message:this.message};return this.a&&(t.serverResponse=this.a),t},I.prototype.toJSON=function(){return this.w()};var E,S="auth/",C={"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."},k={ld:{Ta:"https://staging-identitytoolkit.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",Za:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Wa:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"b"},sd:{Ta:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",Za:"https://securetoken.googleapis.com/v1/token",Wa:"https://identitytoolkit.googleapis.com/v2/",id:"p"},ud:{Ta:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",Za:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Wa:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"s"},vd:{Ta:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",Za:"https://test-securetoken.sandbox.googleapis.com/v1/token",Wa:"https://test-identitytoolkit.sandbox.googleapis.com/v2/",id:"t"}};function N(t){for(var e in k)if(k[e].id===t)return t=k[e],{firebaseEndpoint:t.Ta,secureTokenEndpoint:t.Za,identityPlatformEndpoint:t.Wa};return null}function A(t){if(t)try{return t.$goog_Thenable}catch(t){return}}function R(t){var e;Error.captureStackTrace?Error.captureStackTrace(this,R):(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");R.call(this,n+t[r])}function P(t){throw new O("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1))}function D(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function x(t,e){t.f(e),t.b<100&&(t.b++,e.next=t.a,t.a=e)}function L(){this.b=this.a=null}E=N("__EID__")?"__EID__":void 0,_(R,Error),R.prototype.name="CustomError",_(O,R),O.prototype.name="AssertionError",D.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 M=new D(function(){return new F},function(t){t.reset()});function F(){this.next=this.b=this.a=null}L.prototype.add=function(t,e){var n=M.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},F.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},F.prototype.reset=function(){this.next=this.b=this.a=null};var U=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},j=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 q=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,a="string"==typeof t?t.split(""):t,s=0;s<r;s++)s in a&&(n=a[s],e.call(void 0,n,s,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},B=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 K(t,e){return 0<=U(t,e)}function W(t,e){var n;return(n=0<=(e=U(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 z(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}var Q,Y=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]},X=/&/g,J=/</g,$=/>/g,Z=/"/g,tt=/'/g,et=/\x00/g,nt=/[\x00&<>"']/;function rt(t,e){return-1!=t.indexOf(e)}function it(t,e){return t<e?-1:e<t?1:0}t:{var ot=l.navigator;if(ot){ot=ot.userAgent;if(ot){Q=ot;break t}}Q=""}function at(t){return rt(Q,t)}function st(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function ut(t){for(var e in t)return;return 1}function ct(t){var e,n={};for(e in t)n[e]=t[e];return n}var ht="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function lt(t){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<ht.length;i++)e=ht[i],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function ft(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(g(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;P("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,i)}}function pt(t,e){this.a=t===yt&&e||"",this.b=gt}function dt(t){return t instanceof pt&&t.constructor===pt&&t.b===gt?t.a:(P("expected object of type Const, got '"+t+"'"),"type_error:Const")}pt.prototype.sa=!0,pt.prototype.ra=function(){return this.a},pt.prototype.toString=function(){return"Const{"+this.a+"}"};var vt,gt={},yt={};function mt(){if(void 0===vt){var t=null,e=l.trustedTypes;if(e&&e.createPolicy){try{t=e.createPolicy("goog#html",{createHTML:w,createScript:w,createScriptURL:w})}catch(t){l.console&&l.console.error(t.message)}vt=t}else vt=t}return vt}function bt(t,e){this.a=e===Et?t:""}function _t(t){return t instanceof bt&&t.constructor===bt?t.a:(P("expected object of type TrustedResourceUrl, got '"+t+"' of type "+p(t)),"type_error:TrustedResourceUrl")}function wt(t,n){var e,r=dt(t);if(!Tt.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return t=r.replace(It,function(t,e){if(!Object.prototype.hasOwnProperty.call(n,e))throw Error('Found marker, "'+e+'", in format string, "'+r+'", but no valid label mapping found in args: '+JSON.stringify(n));return(t=n[e])instanceof pt?dt(t):encodeURIComponent(String(t))}),e=t,t=mt(),new bt(e=t?t.createScriptURL(e):e,Et)}bt.prototype.sa=!0,bt.prototype.ra=function(){return this.a.toString()},bt.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var It=/%{(\w+)}/g,Tt=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,Et={};function St(t,e){this.a=e===Pt?t:""}function Ct(t){return t instanceof St&&t.constructor===St?t.a:(P("expected object of type SafeUrl, got '"+t+"' of type "+p(t)),"type_error:SafeUrl")}St.prototype.sa=!0,St.prototype.ra=function(){return this.a.toString()},St.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var kt=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|font\/\w+|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i,Nt=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,At=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function Rt(t){return t instanceof St?t:(t="object"==typeof t&&t.sa?t.ra():String(t),t=At.test(t)||(e=(t=(t=String(t)).replace(/(%0A|%0D)/g,"")).match(Nt))&&kt.test(e[1])?new St(t,Pt):null);var e}function Ot(t){return t instanceof St?t:(t="object"==typeof t&&t.sa?t.ra():String(t),new St(t=!At.test(t)?"about:invalid#zClosurez":t,Pt))}var Pt={},Dt=new St("about:invalid#zClosurez",Pt);function xt(t,e,n){this.a=n===Lt?t:""}xt.prototype.sa=!0,xt.prototype.ra=function(){return this.a.toString()},xt.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Lt={};function Mt(t,e,n,r){return t=t instanceof St?t:Ot(t),e=e||l,n=n instanceof pt?dt(n):n||"",e.open(Ct(t),n,r,void 0)}function Ft(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 Ut(t){return nt.test(t)&&(-1!=(t=-1!=(t=-1!=(t=-1!=(t=-1!=(t=-1!=t.indexOf("&")?t.replace(X,"&amp;"):t).indexOf("<")?t.replace(J,"&lt;"):t).indexOf(">")?t.replace($,"&gt;"):t).indexOf('"')?t.replace(Z,"&quot;"):t).indexOf("'")?t.replace(tt,"&#39;"):t).indexOf("\0")&&(t=t.replace(et,"&#0;"))),t}function jt(t){return jt[" "](t),t}jt[" "]=a;var qt,Vt=at("Opera"),Bt=at("Trident")||at("MSIE"),Kt=at("Edge"),Wt=Kt||Bt,Ht=at("Gecko")&&!(rt(Q.toLowerCase(),"webkit")&&!at("Edge"))&&!(at("Trident")||at("MSIE"))&&!at("Edge"),Gt=rt(Q.toLowerCase(),"webkit")&&!at("Edge");function zt(){var t=l.document;return t?t.documentMode:void 0}t:{var Qt="",Yt=(Yt=Q,Ht?/rv:([^\);]+)(\)|;)/.exec(Yt):Kt?/Edge\/([\d\.]+)/.exec(Yt):Bt?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Yt):Gt?/WebKit\/(\S+)/.exec(Yt):Vt?/(?:Version)[ \/]?(\S+)/.exec(Yt):void 0);if(Yt&&(Qt=Yt?Yt[1]:""),Bt){Yt=zt();if(null!=Yt&&Yt>parseFloat(Qt)){qt=String(Yt);break t}}qt=Qt}var Xt={};function Jt(s){return t=s,e=function(){for(var t=0,e=Y(String(qt)).split("."),n=Y(String(s)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++)for(var o=e[i]||"",a=n[i]||"";o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],a=/(\d*)(\D*)(.*)/.exec(a)||["","","",""],(0!=o[0].length||0!=a[0].length)&&(t=it(0==o[1].length?0:parseInt(o[1],10),0==a[1].length?0:parseInt(a[1],10))||it(0==o[2].length,0==a[2].length)||it(o[2],a[2]),o=o[3],a=a[3],0==t););return 0<=t},n=Xt,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}var $t=l.document&&Bt&&(zt()||parseInt(qt,10))||void 0;try{new self.OffscreenCanvas(0,0).getContext("2d")}catch(t){}var Zt=!Bt||9<=Number($t);function te(t){var e=document;return"string"==typeof t?e.getElementById(t):t}function ee(n,t){st(t,function(t,e){t&&"object"==typeof t&&t.sa&&(t=t.ra()),"style"==e?n.style.cssText=t:"class"==e?n.className=t:"for"==e?n.htmlFor=t:ie.hasOwnProperty(e)?n.setAttribute(ie[e],t):0==e.lastIndexOf("aria-",0)||0==e.lastIndexOf("data-",0)?n.setAttribute(e,t):n[e]=t})}var ne,re,ie={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 oe(){var t,e=arguments,n=document,r=String(e[0]),i=e[1];return!Zt&&i&&(i.name||i.type)&&(r=["<",r],i.name&&r.push(' name="',Ut(i.name),'"'),i.type&&(r.push(' type="',Ut(i.type),'"'),lt(t={},i),delete t.type,i=t),r.push(">"),r=r.join("")),r=ae(n,r),i&&("string"==typeof i?r.className=i:Array.isArray(i)?r.className=i.join(" "):ee(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];if(!d(o)||g(o)&&0<o.nodeType)r(o);else{t:{if(o&&"number"==typeof o.length){if(g(o)){var a="function"==typeof o.item||"string"==typeof o.item;break t}if(v(o)){a="function"==typeof o.item;break t}}a=!1}j(a?z(o):o,r)}}}(n,r,e),r}function ae(t,e){return e=String(e),"application/xhtml+xml"===t.contentType&&(e=e.toLowerCase()),t.createElement(e)}function se(t){l.setTimeout(function(){throw t},0)}function ue(t,e){re||function(){{var t;re=l.Promise&&l.Promise.resolve?(t=l.Promise.resolve(void 0),function(){t.then(le)}):function(){var t=le;!v(l.setImmediate)||l.Window&&l.Window.prototype&&!at("Edge")&&l.Window.prototype.setImmediate==l.setImmediate?(ne=ne||function(){var t=l.MessageChannel;if(void 0===(t=void 0===t&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!at("Presto")?function(){var t=ae(document,"IFRAME");t.style.display="none",document.documentElement.appendChild(t);var e=t.contentWindow;(t=e.document).open(),t.close();var n="callImmediate"+Math.random(),r="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host;t=m(function(t){"*"!=r&&t.origin!=r||t.data!=n||this.port1.onmessage()},this),e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,r)}}}:t)||at("Trident")||at("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).Gb,n.Gb=null,t())},function(t){r.next={Gb:t},r=r.next,e.port2.postMessage(0)}}())(t):l.setImmediate(t)}}}(),ce||(re(),ce=!0),he.add(t,e)}var ce=!1,he=new L;function le(){for(var t,e,n;n=e=void 0,n=null,(e=he).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){se(t)}x(M,t)}ce=!1}function fe(t,e){if(this.a=pe,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,t!=a)try{var n=this;t.call(e,function(t){Se(n,de,t)},function(t){if(!(t instanceof Pe))try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(t){}Se(n,ve,t)})}catch(t){Se(this,ve,t)}}var pe=0,de=2,ve=3;function ge(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}ge.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var ye=new D(function(){return new ge},function(t){t.reset()});function me(t,e,n){var r=ye.get();return r.g=t,r.b=e,r.f=n,r}function be(t){if(t instanceof fe)return t;var e=new fe(a);return Se(e,de,t),e}function _e(n){return new fe(function(t,e){e(n)})}function we(t,e,n){Ce(t,e,n,null)||ue(b(e,t))}function Ie(n){return new fe(function(r){var i=n.length,o=[];if(i)for(var t=function(t,e,n){i--,o[t]=e?{Pb:!0,value:n}:{Pb:!1,reason:n},0==i&&r(o)},e=0;e<n.length;e++)we(n[e],b(t,e,!0),b(t,e,!1));else r(o)})}function Te(t,e){t.b||t.a!=de&&t.a!=ve||ke(t),t.f?t.f.next=e:t.b=e,t.f=e}function Ee(t,i,o,a){var e=me(null,null,null);return e.a=new fe(function(n,r){e.g=i?function(t){try{var e=i.call(a,t);n(e)}catch(t){r(t)}}:n,e.b=o?function(t){try{var e=o.call(a,t);void 0===e&&t instanceof Pe?r(t):n(e)}catch(t){r(t)}}:r}),Te(e.a.c=t,e),e.a}function Se(t,e,n){var r,i;t.a==pe&&(t===n&&(e=ve,n=new TypeError("Promise cannot resolve to itself")),t.a=1,Ce(n,t.$c,t.ad,t)||(t.i=n,t.a=e,t.c=null,ke(t),e!=ve||n instanceof Pe||(i=n,(r=t).g=!0,ue(function(){r.g&&Oe.call(null,i)}))))}function Ce(t,e,n,r){if(t instanceof fe)return Te(t,me(e||a,n||null,r)),1;if(A(t))return t.then(e,n,r),1;if(g(t))try{var i=t.then;if(v(i))return function(t,e,n,r,i){function o(t){a||(a=!0,r.call(i,t))}var a=!1;try{e.call(t,function(t){a||(a=!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 ke(t){t.h||(t.h=!0,ue(t.gc,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==ve&&e.b&&!e.c)for(;t&&t.g;t=t.c)t.g=!1;if(e.a)e.a.c=null,Re(e,n,r);else try{e.c?e.g.call(e.f):Re(e,n,r)}catch(t){Oe.call(null,t)}x(ye,e)}function Re(t,e,n){e==de?t.g.call(t.f,n):t.b&&t.b.call(t.f,n)}fe.prototype.then=function(t,e,n){return Ee(this,v(t)?t:null,v(e)?e:null,n)},fe.prototype.$goog_Thenable=!0,(t=fe.prototype).oa=function(t,e){return(t=me(t,t,e)).c=!0,Te(this,t),this},t.o=function(t,e){return Ee(this,null,t,e)},t.cancel=function(t){var e;this.a==pe&&(e=new Pe(t),ue(function(){!function t(e,n){if(e.a==pe)if(e.c){var r=e.c;if(r.b){for(var i=0,o=null,a=null,s=r.b;s&&(s.c||(i++,!((o=s.a==e?s:o)&&1<i)));s=s.next)o||(a=s);o&&(r.a==pe&&1==i?t(r,n):(a?((i=a).next==r.f&&(r.f=i),i.next=i.next.next):Ne(r),Ae(r,o,ve,n)))}e.c=null}else Se(e,ve,n)}(this,e)},this))},t.$c=function(t){this.a=pe,Se(this,de,t)},t.ad=function(t){this.a=pe,Se(this,ve,t)},t.gc=function(){for(var t;t=Ne(this);)Ae(this,t,this.a,this.i);this.h=!1};var Oe=se;function Pe(t){R.call(this,t)}function De(){this.xa=this.xa,this.pa=this.pa}_(Pe,R);var xe=0;function Le(t){t.xa||(t.xa=!0,t.Da(),0==xe)||(t=t,Object.prototype.hasOwnProperty.call(t,n)&&t[n]||(t[n]=++r))}De.prototype.xa=!(Pe.prototype.name="cancel"),De.prototype.Da=function(){if(this.pa)for(;this.pa.length;)this.pa.shift()()};var Me=Object.freeze||function(t){return t},Fe=!Bt||9<=Number($t),Ue=Bt&&!Jt("9"),je=function(){if(!l.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{l.addEventListener("test",a,e),l.removeEventListener("test",a,e)}catch(t){}return t}();function qe(t,e){this.type=t,this.b=this.target=e,this.defaultPrevented=!1}function Ve(t,e){if(qe.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(Ht){t:{try{jt(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:Be[t.pointerType]||"",(this.a=t).defaultPrevented&&this.preventDefault()}}qe.prototype.preventDefault=function(){this.defaultPrevented=!0},_(Ve,qe);var Be=Me({2:"touch",3:"pen",4:"mouse"});Ve.prototype.preventDefault=function(){Ve.ab.preventDefault.call(this);var t=this.a;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,Ue)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}},Ve.prototype.g=function(){return this.a};var Ke="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.Va=i,this.key=++We,this.va=this.Pa=!1}function Ge(t){t.va=!0,t.listener=null,t.proxy=null,t.src=null,t.Va=null}function ze(t){this.src=t,this.a={},this.b=0}function Qe(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 Ye(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.va&&o.listener==e&&o.capture==!!n&&o.Va==r)return i}return-1}ze.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var a=Ye(t,e,r,i);return-1<a?(e=t[a],n||(e.Pa=!1)):((e=new He(e,this.src,o,!!r,i)).Pa=n,t.push(e)),e};var Xe="closure_lm_"+(1e6*Math.random()|0),Je={};function $e(t,e,n,r,i){if(r&&r.once)tn(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=hn(n),t&&t[Ke]?fn(t,e,n,g(r)?!!r.capture:!!r,i):Ze(t,e,n,!1,r,i)}function Ze(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var a,s,u=g(i)?!!i.capture:!!i,c=un(t);if(c||(t[Xe]=c=new ze(t)),!(n=c.add(e,n,r,u,o)).proxy)if(a=sn,r=s=Fe?function(t){return a.call(s.src,s.listener,t)}:function(t){if(!(t=a.call(s.src,s.listener,t)))return t},(n.proxy=r).src=t,r.listener=n,t.addEventListener)void 0===(i=!je?u:i)&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(rn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}}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 n=hn(n),t&&t[Ke]?pn(t,e,n,g(r)?!!r.capture:!!r,i):Ze(t,e,n,!0,r,i)}function en(t,e,n,r,i){if(Array.isArray(e))for(var o=0;o<e.length;o++)en(t,e[o],n,r,i);else r=g(r)?!!r.capture:!!r,n=hn(n),t&&t[Ke]?(t=t.v,(e=String(e).toString())in t.a&&(-1<(n=Ye(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&&un(t))&&(e=t.a[e.toString()],(n=(t=-1)<(t=e?Ye(e,n,r,i):t)?e[t]:null)&&nn(n))}function nn(t){var e,n,r;"number"!=typeof t&&t&&!t.va&&((e=t.src)&&e[Ke]?Qe(e.v,t):(n=t.type,r=t.proxy,e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(rn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=un(e))?(Qe(n,t),0==n.b&&(n.src=null,e[Xe]=null)):Ge(t)))}function rn(t){return t in Je?Je[t]:Je[t]="on"+t}function on(t,e,n,r){var i=!0;if((t=un(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.va&&(o=an(o,r),i=i&&!1!==o)}return i}function an(t,e){var n=t.listener,r=t.Va||t.src;return t.Pa&&nn(t),n.call(r,e)}function sn(t,e){if(t.va)return!0;if(Fe)return an(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=on(r[i],t,!0,e),n=n&&o}for(i=0;i<r.length;i++)e.b=r[i],o=on(r[i],t,!1,e),n=n&&o}return n}function un(t){return(t=t[Xe])instanceof ze?t:null}var cn="__closure_events_fn_"+(1e9*Math.random()>>>0);function hn(e){return v(e)?e:(e[cn]||(e[cn]=function(t){return e.handleEvent(t)}),e[cn])}function ln(){De.call(this),this.v=new ze(this),(this.ac=this).gb=null}function fn(t,e,n,r,i){t.v.add(String(e),n,!1,r,i)}function pn(t,e,n,r,i){t.v.add(String(e),n,!0,r,i)}function dn(t,e,n,r){if(!(e=t.v.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var a,s,u=e[o];u&&!u.va&&u.capture==n&&(a=u.listener,s=u.Va||u.src,u.Pa&&Qe(t.v,u),i=!1!==a.call(s,r)&&i)}return i&&!r.defaultPrevented}function vn(t,e,n){if(v(t))n&&(t=m(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=m(t.handleEvent,t)}return 2147483647<Number(e)?-1:l.setTimeout(t,e||0)}function gn(n){var r=null;return new fe(function(t,e){-1==(r=vn(function(){t(void 0)},n))&&e(Error("Failed to schedule timer."))}).o(function(t){throw l.clearTimeout(r),t})}function yn(t){if(t.W&&"function"==typeof t.W)return t.W();if("string"==typeof t)return t.split("");if(d(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 mn(t){if(t.Y&&"function"==typeof t.Y)return t.Y();if(!t.W||"function"!=typeof t.W){if(d(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 bn(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 bn)for(n=t.Y(),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 _n(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];wn(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;)wn(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function wn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}_(ln,De),ln.prototype[Ke]=!0,ln.prototype.addEventListener=function(t,e,n,r){$e(this,t,e,n,r)},ln.prototype.removeEventListener=function(t,e,n,r){en(this,t,e,n,r)},ln.prototype.dispatchEvent=function(t){var e;if(n=this.gb)for(e=[];n;n=n.gb)e.push(n);var n=this.ac,r=t.type||t;if("string"==typeof t?t=new qe(t,n):t instanceof qe?t.target=t.target||n:(a=t,lt(t=new qe(r,n),a)),a=!0,e)for(var i=e.length-1;0<=i;i--)var o=t.b=e[i],a=dn(o,r,!0,t)&&a;if(a=dn(o=t.b=n,r,!0,t)&&a,a=dn(o,r,!1,t)&&a,e)for(i=0;i<e.length;i++)a=dn(o=t.b=e[i],r,!1,t)&&a;return a},ln.prototype.Da=function(){if(ln.ab.Da.call(this),this.v){var t,e=this.v;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.gb=null},(t=bn.prototype).W=function(){_n(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},t.Y=function(){return _n(this),this.a.concat()},t.clear=function(){this.b={},this.c=this.a.length=0},t.get=function(t,e){return wn(this.b,t)?this.b[t]:e},t.set=function(t,e){wn(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},t.forEach=function(t,e){for(var n=this.Y(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var In=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Tn(t,e){var n;this.a=this.l=this.c="",this.g=null,this.h=this.f="",this.i=!1,t instanceof Tn?(this.i=void 0!==e?e:t.i,En(this,t.c),this.l=t.l,this.a=t.a,Sn(this,t.g),this.f=t.f,Cn(this,Hn(t.b)),this.h=t.h):t&&(n=String(t).match(In))?(this.i=!!e,En(this,n[1]||"",!0),this.l=On(n[2]||""),this.a=On(n[3]||"",!0),Sn(this,n[4]),this.f=On(n[5]||"",!0),Cn(this,n[6]||"",!0),this.h=On(n[7]||"")):(this.i=!!e,this.b=new jn(null,this.i))}function En(t,e,n){t.c=n?On(e,!0):e,t.c&&(t.c=t.c.replace(/:$/,""))}function Sn(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.g=e}else t.g=null}function Cn(t,e,n){var r,i;e instanceof jn?(t.b=e,r=t.b,(i=t.i)&&!r.f&&(qn(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Bn(this,e),Wn(this,n,t))},r)),r.f=i):(n||(e=Pn(e,Fn)),t.b=new jn(e,t.i))}function kn(t,e,n){t.b.set(e,n)}function Nn(t,e){return t.b.get(e)}function An(t){return t instanceof Tn?new Tn(t):new Tn(t,void 0)}function Rn(t,e,n,r){var i=new Tn(null,void 0);return t&&En(i,t),e&&(i.a=e),n&&Sn(i,n),r&&(i.f=r),i}function On(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Pn(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Dn),t=n?t.replace(/%25([0-9a-fA-F]{2})/g,"%$1"):t):null}function Dn(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Tn.prototype.toString=function(){var t=[],e=this.c;e&&t.push(Pn(e,xn,!0),":");var n=this.a;return!n&&"file"!=e||(t.push("//"),(e=this.l)&&t.push(Pn(e,xn,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.g)&&t.push(":",String(n))),(n=this.f)&&(this.a&&"/"!=n.charAt(0)&&t.push("/"),t.push(Pn(n,"/"==n.charAt(0)?Mn:Ln,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.h)&&t.push("#",Pn(n,Un)),t.join("")},Tn.prototype.resolve=function(t){var e=new Tn(this),n=!!t.c;n?En(e,t.c):n=!!t.l,n?e.l=t.l:n=!!t.a,n?e.a=t.a:n=null!=t.g;var r=t.f;if(n)Sn(e,t.g);else if(n=!!t.f)if("/"!=r.charAt(0)&&(this.a&&!this.f?r="/"+r:-1!=(i=e.f.lastIndexOf("/"))&&(r=e.f.substr(0,i+1)+r)),".."==(i=r)||"."==i)r="";else if(rt(i,"./")||rt(i,"/.")){for(var r=0==i.lastIndexOf("/",0),i=i.split("/"),o=[],a=0;a<i.length;){var s=i[a++];"."==s?r&&a==i.length&&o.push(""):".."==s?((1<o.length||1==o.length&&""!=o[0])&&o.pop(),r&&a==i.length&&o.push("")):(o.push(s),r=!0)}r=o.join("/")}else r=i;return n?e.f=r:n=""!==t.b.toString(),n?Cn(e,Hn(t.b)):n=!!t.h,n&&(e.h=t.h),e};var xn=/[#\/\?@]/g,Ln=/[#\?:]/g,Mn=/[#\?]/g,Fn=/[#\?@]/g,Un=/#/g;function jn(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function qn(n){n.a||(n.a=new bn,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=mn(t);if(void 0===e)throw Error("Keys are undefined");var n=new jn(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 Bn(t,e){qn(t),e=Gn(t,e),wn(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,wn((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&_n(t)))}function Kn(t,e){return qn(t),e=Gn(t,e),wn(t.a.b,e)}function Wn(t,e,n){Bn(t,e),0<n.length&&(t.c=null,t.a.set(Gn(t,e),z(n)),t.b+=n.length)}function Hn(t){var e=new jn;return e.c=t.c,t.a&&(e.a=new bn(t.a),e.b=t.b),e}function Gn(t,e){return e=String(e),e=t.f?e.toLowerCase():e}function zn(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="",a=0;a<n;a++)r.push(o),t(e,i[a],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)&&(a=n[i],"function"!=typeof a&&(r.push(o),Jn(i,r),r.push(":"),t(e,a,r),o=","));return void r.push("}")}n=n.valueOf()}switch(typeof n){case"string":Jn(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 Qn,t,e),e.join("")}function Qn(){}(t=jn.prototype).add=function(t,e){qn(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){qn(this),this.a.forEach(function(t,e){j(t,function(t){n.call(r,t,e,this)},this)},this)},t.Y=function(){qn(this);for(var t=this.a.W(),e=this.a.Y(),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.W=function(t){qn(this);var e=[];if("string"==typeof t)Kn(this,t)&&(e=G(e,this.a.get(Gn(this,t))));else{t=this.a.W();for(var n=0;n<t.length;n++)e=G(e,t[n])}return e},t.set=function(t,e){return qn(this),this.c=null,Kn(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.W(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.Y(),n=0;n<e.length;n++)for(var r=e[n],i=encodeURIComponent(String(r)),r=this.W(r),o=0;o<r.length;o++){var a=i;""!==r[o]&&(a+="="+encodeURIComponent(String(r[o]))),t.push(a)}return this.c=t.join("&")};var Yn={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},Xn=/\uffff/.test("")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g;function Jn(t,e){e.push('"',t.replace(Xn,function(t){var e=Yn[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),Yn[t]=e),e}),'"')}function $n(){var t=yr();return Bt&&$t&&11==$t||/Edge\/\d+/.test(t)}function Zn(){return l.window&&l.window.location.href||self&&self.location&&self.location.href||""}function tr(t,e){e=e||l.window;var n="about:blank";t&&(n=Ct(Rt(t)||Dt)),e.location.href=n}function er(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 nr(t){t=t||l.window;try{t.close()}catch(t){}}function rr(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(a 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,rt(n,"crios/")&&(e.target="_blank")),dr(yr())==fr&&(t=t||"http://localhost",e.scrollbars=!0),n=t||"",(t=e)||(t={}),r=window,e=n instanceof St?n:Rt(void 0!==n.href?n.href:String(n))||Dt,n=t.target||n.target,i=[],t)switch(a){case"width":case"height":case"top":case"left":i.push(a+"="+t[a]);break;case"target":case"noopener":case"noreferrer":break;default:i.push(a+"="+(t[a]?1:0))}var a=i.join(",");if((at("iPhone")&&!at("iPod")&&!at("iPad")||at("iPad")||at("iPod"))&&r.navigator&&r.navigator.standalone&&n&&"_self"!=n?(ft(a=ae(document,"A"),"HTMLAnchorElement"),e=e instanceof St?e:Ot(e),a.href=Ct(e),a.setAttribute("target",n),t.noreferrer&&a.setAttribute("rel","noreferrer"),(t=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,r,1),a.dispatchEvent(t),a={}):t.noreferrer?(a=Mt("",r,n,a),t=Ct(e),a&&(Wt&&rt(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),a.opener=null,t='<meta name="referrer" content="no-referrer"><meta http-equiv="refresh" content="0; url='+Ut(t)+'">',t=new xt(t=(r=mt())?r.createHTML(t):t,0,Lt),r=a.document)&&(r.write((o=t)instanceof xt&&o.constructor===xt?o.a:(P("expected object of type SafeHtml, got '"+o+"' of type "+p(o)),"type_error:SafeHtml")),r.close())):(a=Mt(e,r,n,a))&&t.noopener&&(a.opener=null),a)try{a.focus()}catch(t){}return a}var ir=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,or=/^[^@]+@[^@]+$/;function ar(){var e=null;return new fe(function(t){"complete"==l.document.readyState?t():(e=function(){t()},tn(window,"load",e))}).o(function(t){throw en(window,"load",e),t})}function sr(t){return t=t||yr(),!("file:"!==Ir()&&"ionic:"!==Ir()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function ur(){var t=l.window;try{return t&&t!=t.top}catch(t){return}}function cr(){return void 0!==l.WorkerGlobalScope&&"function"==typeof l.importScripts}function hr(){return Xl.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":Xl.INTERNAL.hasOwnProperty("node")?"Node":cr()?"Worker":"Browser"}function lr(){var t=hr();return"ReactNative"===t||"Node"===t}var fr="Firefox",pr="Chrome";function dr(t){var e=t.toLowerCase();return rt(e,"opera/")||rt(e,"opr/")||rt(e,"opios/")?"Opera":rt(e,"iemobile")?"IEMobile":rt(e,"msie")||rt(e,"trident/")?"IE":rt(e,"edge/")?"Edge":rt(e,"firefox/")?fr:rt(e,"silk/")?"Silk":rt(e,"blackberry")?"Blackberry":rt(e,"webos")?"Webos":!rt(e,"safari/")||rt(e,"chrome/")||rt(e,"crios/")||rt(e,"android")?!rt(e,"chrome/")&&!rt(e,"crios/")||rt(e,"edge/")?rt(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":pr:"Safari"}var vr={md:"FirebaseCore-web",od:"FirebaseUI-web"};function gr(t,e){e=e||[];var n,r=[],i={};for(n in vr)i[vr[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=hr())?r=dr(i=yr()):"Worker"===r&&(r=dr(i=yr())+"-"+r),r+"/JsCore/"+t+"/"+e.join(",")}function yr(){return l.navigator&&l.navigator.userAgent||""}function mr(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 e=n!=t.length?void 0:e}function br(){try{var t=l.localStorage,e=kr();if(t)return t.setItem(e,"1"),t.removeItem(e),!$n()||!!l.indexedDB}catch(t){return cr()&&!!l.indexedDB}return!1}function _r(){return(wr()||"chrome-extension:"===Ir()||sr())&&!lr()&&br()&&!cr()}function wr(){return"http:"===Ir()||"https:"===Ir()}function Ir(){return l.location&&l.location.protocol||null}function Tr(t){return!er(t=t||yr())&&dr(t)!=fr}function Er(t){return void 0===t?null:zn(t)}function Sr(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 Cr(t){if(null!==t)return JSON.parse(t)}function kr(t){return t||Math.floor(1e9*Math.random()).toString()}function Nr(t){return"Safari"!=dr(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 Rr(t,e){if(e<t)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=yr(),e=hr(),this.b=er(t)||"ReactNative"===e}function Or(){var t=l.document;return!t||void 0===t.visibilityState||"visible"==t.visibilityState}function Pr(){var e=l.document,n=null;return Or()||!e?be():new fe(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})}function Dr(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 xr(){return mr("fireauth.oauthhelper",l)||mr("fireauth.iframe",l)}Rr.prototype.get=function(){var t=l.navigator;return!t||"boolean"!=typeof t.onLine||!wr()&&"chrome-extension:"!==Ir()&&void 0===t.connection||t.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var Lr,Mr={};function Fr(t){Mr[t]||(Mr[t]=!0,"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(t))}try{var Ur={};Object.defineProperty(Ur,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(Ur,"abcd",{configurable:!0,enumerable:!0,value:2}),Lr=2==Ur.abcd}catch(t){Lr=!1}function jr(t,e,n){Lr?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function qr(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&jr(t,n,e[n])}function Vr(t){var e={};return qr(e,t),e}function Br(t){var e=t;if("object"==typeof t&&null!=t)for(var n in e="length"in t?[]:{},t)jr(e,n,Br(t[n]));return e}function Kr(t){var e=t&&(t[Qr]?"phone":null);if(!(e&&t&&t[zr]))throw new I("internal-error","Internal assert: invalid MultiFactorInfo object");jr(this,"uid",t[zr]),jr(this,"displayName",t[Hr]||null);var n=null;jr(this,"enrollmentTime",n=t[Gr]?new Date(t[Gr]).toUTCString():n),jr(this,"factorId",e)}function Wr(t){try{var e=new Yr(t)}catch(t){e=null}return e}Kr.prototype.w=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};var Hr="displayName",Gr="enrolledAt",zr="mfaEnrollmentId",Qr="phoneInfo";function Yr(t){Kr.call(this,t),jr(this,"phoneNumber",t[Qr])}function Xr(t){var e={},n=t[ti],r=t[ni],i=t[ri];if(t=Wr(t[ei]),!i||i!=$r&&i!=Zr&&!n||i==Zr&&!r||i==Jr&&!t)throw Error("Invalid checkActionCode response!");i==Zr?(e[oi]=n||null,e[si]=n||null,e[ii]=r):(e[oi]=r||null,e[si]=r||null,e[ii]=n||null),e[ai]=t||null,jr(this,ci,i),jr(this,ui,Br(e))}_(Yr,Kr),Yr.prototype.w=function(){var t=Yr.ab.w.call(this);return t.phoneNumber=this.phoneNumber,t};var Jr="REVERT_SECOND_FACTOR_ADDITION",$r="EMAIL_SIGNIN",Zr="VERIFY_AND_CHANGE_EMAIL",ti="email",ei="mfaInfo",ni="newEmail",ri="requestType",ii="email",oi="fromEmail",ai="multiFactorInfo",si="previousEmail",ui="data",ci="operation";function hi(t){var e=Nn(t=An(t),li)||null,n=Nn(t,fi)||null,r=(r=Nn(t,vi)||null)&&yi[r]||null;if(!e||!n||!r)throw new I("argument-error",li+", "+fi+"and "+vi+" are required in a valid action code URL.");qr(this,{apiKey:e,operation:r,code:n,continueUrl:Nn(t,pi)||null,languageCode:Nn(t,di)||null,tenantId:Nn(t,gi)||null})}var li="apiKey",fi="oobCode",pi="continueUrl",di="languageCode",vi="mode",gi="tenantId",yi={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:Jr,signIn:$r,verifyAndChangeEmail:Zr,verifyEmail:"VERIFY_EMAIL"};function mi(t){try{return new hi(t)}catch(t){return null}}function bi(t){if(void 0===(e=t[Ei]))throw new I("missing-continue-uri");if("string"!=typeof e||"string"==typeof e&&!e.length)throw new I("invalid-continue-uri");if(this.h=e,this.b=this.a=null,this.g=!1,(r=t[_i])&&"object"==typeof r){var e=r[ki],n=r[Si],r=r[Ci];if("string"==typeof e&&e.length){if(this.a=e,void 0!==n&&"boolean"!=typeof n)throw new I("argument-error",Si+" property must be a boolean when specified.");if(this.g=!!n,void 0!==r&&("string"!=typeof r||"string"==typeof r&&!r.length))throw new I("argument-error",Ci+" property must be a non empty string when specified.");this.b=r||null}else{if(void 0!==e)throw new I("argument-error",ki+" property must be a non empty string when specified.");if(void 0!==n||void 0!==r)throw new I("missing-android-pkg-name")}}else if(void 0!==r)throw new I("argument-error",_i+" property must be a non null object when specified.");if(this.f=null,(e=t[Ti])&&"object"==typeof e){if("string"==typeof(e=e[Ni])&&e.length)this.f=e;else if(void 0!==e)throw new I("argument-error",Ni+" property must be a non empty string when specified.")}else if(void 0!==e)throw new I("argument-error",Ti+" property must be a non null object when specified.");if(void 0!==(e=t[Ii])&&"boolean"!=typeof e)throw new I("argument-error",Ii+" property must be a boolean when specified.");if(this.c=!!e,void 0!==(t=t[wi])&&("string"!=typeof t||"string"==typeof t&&!t.length))throw new I("argument-error",wi+" property must be a non empty string when specified.");this.i=t||null}var _i="android",wi="dynamicLinkDomain",Ii="handleCodeInApp",Ti="iOS",Ei="url",Si="installApp",Ci="minimumVersion",ki="packageName",Ni="bundleId";function Ai(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 Ri=null;function Oi(t){var e=[];return function(r,t){function e(t){for(;i<r.length;){var e=r.charAt(i++),n=Ri[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return t}!function(){if(!Ri){Ri={};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===Ri[o]&&(Ri[o]=i)}}}();for(var i=0;;){var n=e(-1),o=e(0),a=e(64),s=e(64);if(64===s&&-1===n)break;t(n<<2|o>>4),64!=a&&(t(o<<4&240|a>>2),64!=s&&t(a<<6&192|s))}}(t,function(t){e.push(t)}),e}function Pi(t){var e=xi(t);if(!(e&&e.sub&&e.iss&&e.aud&&e.exp))throw Error("Invalid JWT");this.h=t,this.a=e.exp,this.i=e.sub,t=Date.now()/1e3,this.g=e.iat||(t>this.a?this.a:t),this.b=e.provider_id||e.firebase&&e.firebase.sign_in_provider||null,this.f=e.firebase&&e.firebase.tenant||null,this.c=!!e.is_anonymous||"anonymous"==this.b}function Di(t){try{return new Pi(t)}catch(t){return null}}function xi(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{var r=Oi(t);for(t=[],n=e=0;e<r.length;){var i,o,a,s=r[e++];s<128?t[n++]=String.fromCharCode(s):191<s&&s<224?(i=r[e++],t[n++]=String.fromCharCode((31&s)<<6|63&i)):239<s&&s<365?(a=((7&s)<<18|(63&(i=r[e++]))<<12|(63&(o=r[e++]))<<6|63&r[e++])-65536,t[n++]=String.fromCharCode(55296+(a>>10)),t[n++]=String.fromCharCode(56320+(1023&a))):(i=r[e++],o=r[e++],t[n++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o))}return JSON.parse(t.join(""))}catch(t){}return null}Pi.prototype.T=function(){return this.f},Pi.prototype.l=function(){return this.c},Pi.prototype.toString=function(){return this.h};var Li="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),Mi=["client_id","response_type","scope","redirect_uri","state"],Fi={nd:{Ja:"locale",ua:700,ta:600,fa:"facebook.com",Xa:Mi},pd:{Ja:null,ua:500,ta:750,fa:"github.com",Xa:Mi},qd:{Ja:"hl",ua:515,ta:680,fa:"google.com",Xa:Mi},wd:{Ja:"lang",ua:485,ta:705,fa:"twitter.com",Xa:Li},kd:{Ja:"locale",ua:640,ta:600,fa:"apple.com",Xa:[]}};function Ui(t){for(var e in Fi)if(Fi[e].fa==t)return Fi[e];return null}function ji(t){var e={};e["facebook.com"]=Wi,e["google.com"]=Gi,e["github.com"]=Hi,e["twitter.com"]=zi;var n=t&&t[Vi];try{if(n)return new(e[n]||Ki)(t);if(void 0!==t[qi])return new Bi(t)}catch(t){}return null}var qi="idToken",Vi="providerId";function Bi(t){var e,n=t[Vi];if(n||!t[qi]||(e=Di(t[qi]))&&e.b&&(n=e.b),!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),jr(this,"providerId",n),jr(this,"isNewUser",e)}function Ki(t){Bi.call(this,t),jr(this,"profile",Br((t=Cr(t.rawUserInfo||"{}"))||{}))}function Wi(t){if(Ki.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function Hi(t){if(Ki.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");jr(this,"username",this.profile&&this.profile.login||null)}function Gi(t){if(Ki.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function zi(t){if(Ki.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");jr(this,"username",t.screenName||null)}function Qi(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 Yi(t,e){if(!t&&!e)throw new I("internal-error","Internal assert: no raw session string available");if(t&&e)throw new I("internal-error","Internal assert: unable to determine the session type");this.a=t||null,this.b=e||null,this.type=this.a?Xi:Ji}_(Ki,Bi),_(Wi,Ki),_(Hi,Ki),_(Gi,Ki),_(zi,Ki);var Xi="enroll",Ji="signin";function $i(){}function Zi(t,n){return t.then(function(t){if(t[Ba]){var e=Di(t[Ba]);if(!e||n!=e.i)throw new I("user-mismatch");return t}throw new I("user-mismatch")}).o(function(t){throw t&&t.code&&t.code==S+"user-not-found"?new I("user-mismatch"):t})}function to(t,e){if(!e)throw new I("internal-error","failed to construct a credential");this.a=e,jr(this,"providerId",t),jr(this,"signInMethod",t)}function eo(t){return{pendingToken:t.a,requestUri:"http://localhost"}}function no(t){if(t&&t.providerId&&t.signInMethod&&0==t.providerId.indexOf("saml.")&&t.pendingToken)try{return new to(t.providerId,t.pendingToken)}catch(t){}return null}function ro(t,e,n){if(this.a=null,e.idToken||e.accessToken)e.idToken&&jr(this,"idToken",e.idToken),e.accessToken&&jr(this,"accessToken",e.accessToken),e.nonce&&!e.pendingToken&&jr(this,"nonce",e.nonce),e.pendingToken&&(this.a=e.pendingToken);else{if(!e.oauthToken||!e.oauthTokenSecret)throw new I("internal-error","failed to construct a credential");jr(this,"accessToken",e.oauthToken),jr(this,"secret",e.oauthTokenSecret)}jr(this,"providerId",t),jr(this,"signInMethod",n)}function io(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 oo(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 ro(t.providerId,e,t.signInMethod)}catch(t){}}return null}function ao(t,e){this.Qc=e||[],qr(this,{providerId:t,isOAuthProvider:!0}),this.Ib={},this.pb=(Ui(t)||{}).Ja||null,this.ob=null}function so(t){if("string"!=typeof t||0!=t.indexOf("saml."))throw new I("argument-error",'SAML provider IDs must be prefixed with "saml."');ao.call(this,t,[])}function uo(t){ao.call(this,t,Mi),this.a=[]}function co(){uo.call(this,"facebook.com")}function ho(t){if(!t)throw new I("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return g(t)&&(e=t.accessToken),(new co).credential({accessToken:e})}function lo(){uo.call(this,"github.com")}function fo(t){if(!t)throw new I("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return g(t)&&(e=t.accessToken),(new lo).credential({accessToken:e})}function po(){uo.call(this,"google.com"),this.Ca("profile")}function vo(t,e){var n=t;return g(t)&&(n=t.idToken,e=t.accessToken),(new po).credential({idToken:n,accessToken:e})}function go(){ao.call(this,"twitter.com",Li)}function yo(t,e){var n=t;if(!(n=!g(n)?{oauthToken:t,oauthTokenSecret:e}:n).oauthToken||!n.oauthTokenSecret)throw new I("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new ro("twitter.com",n,"twitter.com")}function mo(t,e,n){this.a=t,this.f=e,jr(this,"providerId","password"),jr(this,"signInMethod",n===_o.EMAIL_LINK_SIGN_IN_METHOD?_o.EMAIL_LINK_SIGN_IN_METHOD:_o.EMAIL_PASSWORD_SIGN_IN_METHOD)}function bo(t){return t&&t.email&&t.password?new mo(t.email,t.password,t.signInMethod):null}function _o(){qr(this,{providerId:"password",isOAuthProvider:!1})}function wo(t,e){if(!(e=Io(e)))throw new I("argument-error","Invalid email link!");return new mo(t,e.code,_o.EMAIL_LINK_SIGN_IN_METHOD)}function Io(t){return(t=mi(t=Qi(t)))&&t.operation===$r?t:null}function To(t){if(!(t.eb&&t.cb||t.La&&t.ea))throw new I("internal-error");this.a=t,jr(this,"providerId","phone"),this.fa="phone",jr(this,"signInMethod","phone")}function Eo(e){if(e&&"phone"===e.providerId&&(e.verificationId&&e.verificationCode||e.temporaryProof&&e.phoneNumber)){var n={};return j(["verificationId","verificationCode","temporaryProof","phoneNumber"],function(t){e[t]&&(n[t]=e[t])}),new To(n)}return null}function So(t){return t.a.La&&t.a.ea?{temporaryProof:t.a.La,phoneNumber:t.a.ea}:{sessionInfo:t.a.eb,code:t.a.cb}}function Co(t){try{this.a=t||Xl.auth()}catch(t){throw new I("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().")}qr(this,{providerId:"phone",isOAuthProvider:!1})}function ko(t,e){if(!t)throw new I("missing-verification-id");if(!e)throw new I("missing-verification-code");return new To({eb:t,cb:e})}function No(t){if(t.temporaryProof&&t.phoneNumber)return new To({La:t.temporaryProof,ea: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,a=t&&t.pendingToken;try{switch(e){case"google.com":return vo(o,n);case"facebook.com":return ho(n);case"github.com":return fo(n);case"twitter.com":return yo(n,r);default:return n||r||o||a?a?0==e.indexOf("saml.")?new to(e,a):new ro(e,{pendingToken:a,idToken:t.oauthIdToken,accessToken:t.oauthAccessToken},e):new uo(e).credential({idToken:o,accessToken:n,rawNonce:i}):null}}catch(t){return null}}function Ao(t){if(!t.isOAuthProvider)throw new I("invalid-oauth-provider")}function Ro(t,e,n,r,i,o,a){if(this.c=t,this.b=e||null,this.g=n||null,this.f=r||null,this.i=o||null,this.h=a||null,this.a=i||null,!this.g&&!this.a)throw new I("invalid-auth-event");if(this.g&&this.a)throw new I("invalid-auth-event");if(this.g&&!this.f)throw new I("invalid-auth-event")}function Oo(t){return(t=t||{}).type?new Ro(t.type,t.eventId,t.urlResponse,t.sessionId,t.error&&T(t.error),t.postBody,t.tenantId):null}function Po(){this.b=null,this.a=[]}Yi.prototype.Ha=function(){return this.a?be(this.a):be(this.b)},Yi.prototype.w=function(){return this.type==Xi?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}},$i.prototype.ka=function(){},$i.prototype.b=function(){},$i.prototype.c=function(){},$i.prototype.w=function(){},to.prototype.ka=function(t){return hs(t,eo(this))},to.prototype.b=function(t,e){var n=eo(this);return n.idToken=e,ls(t,n)},to.prototype.c=function(t,e){return Zi(fs(t,eo(this)),e)},to.prototype.w=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}},ro.prototype.ka=function(t){return hs(t,io(this))},ro.prototype.b=function(t,e){var n=io(this);return n.idToken=e,ls(t,n)},ro.prototype.c=function(t,e){return Zi(fs(t,io(this)),e)},ro.prototype.w=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},ao.prototype.Ka=function(t){return this.Ib=ct(t),this},_(so,ao),_(uo,ao),uo.prototype.Ca=function(t){return K(this.a,t)||this.a.push(t),this},uo.prototype.Qb=function(){return z(this.a)},uo.prototype.credential=function(t,e){e=g(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 I("argument-error","credential failed: must provide the ID token and/or the access token.");return new ro(this.providerId,e,this.providerId)},_(co,uo),jr(co,"PROVIDER_ID","facebook.com"),jr(co,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),_(lo,uo),jr(lo,"PROVIDER_ID","github.com"),jr(lo,"GITHUB_SIGN_IN_METHOD","github.com"),_(po,uo),jr(po,"PROVIDER_ID","google.com"),jr(po,"GOOGLE_SIGN_IN_METHOD","google.com"),_(go,ao),jr(go,"PROVIDER_ID","twitter.com"),jr(go,"TWITTER_SIGN_IN_METHOD","twitter.com"),mo.prototype.ka=function(t){return this.signInMethod==_o.EMAIL_LINK_SIGN_IN_METHOD?zs(t,_s,{email:this.a,oobCode:this.f}):zs(t,Bs,{email:this.a,password:this.f})},mo.prototype.b=function(t,e){return this.signInMethod==_o.EMAIL_LINK_SIGN_IN_METHOD?zs(t,ws,{idToken:e,email:this.a,oobCode:this.f}):zs(t,xs,{idToken:e,email:this.a,password:this.f})},mo.prototype.c=function(t,e){return Zi(this.ka(t),e)},mo.prototype.w=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}},qr(_o,{PROVIDER_ID:"password"}),qr(_o,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),qr(_o,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),To.prototype.ka=function(t){return t.fb(So(this))},To.prototype.b=function(t,e){var n=So(this);return n.idToken=e,zs(t,Ws,n)},To.prototype.c=function(t,e){var n=So(this);return n.operation="REAUTH",Zi(t=zs(t,Hs,n),e)},To.prototype.w=function(){var t={providerId:"phone"};return this.a.eb&&(t.verificationId=this.a.eb),this.a.cb&&(t.verificationCode=this.a.cb),this.a.La&&(t.temporaryProof=this.a.La),this.a.ea&&(t.phoneNumber=this.a.ea),t},Co.prototype.fb=function(r,i){var o=this.a.a;return be(i.verify()).then(function(n){if("string"!=typeof n)throw new I("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 I("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.');var t=g(r)?r.session:null,e=g(r)?r.phoneNumber:r,t=t&&t.type==Xi?t.Ha().then(function(t){return zs(o,Ms,{idToken:t,phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:n}}).then(function(t){return t.phoneSessionInfo.sessionInfo})}):t&&t.type==Ji?t.Ha().then(function(t){return e=o,t={mfaPendingCredential:t,mfaEnrollmentId:r.multiFactorHint&&r.multiFactorHint.uid||r.multiFactorUid,phoneSignInInfo:{recaptchaToken:n}},zs(e,Fs,t).then(function(t){return t.phoneResponseInfo.sessionInfo});var e}):zs(o,Ps,{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})})},qr(Co,{PROVIDER_ID:"phone"}),qr(Co,{PHONE_SIGN_IN_METHOD:"phone"}),Ro.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("-")},Ro.prototype.T=function(){return this.h},Ro.prototype.w=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.w()}};var Do,xo=null;function Lo(t){var e="unauthorized-domain",n=void 0,r=An(t);t=r.a,"chrome-extension"==(r=r.c)?n=Ft("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=Ft("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",I.call(this,e,n)}function Mo(t,e,n){I.call(this,t,n),(t=e||{}).Jb&&jr(this,"email",t.Jb),t.ea&&jr(this,"phoneNumber",t.ea),t.credential&&jr(this,"credential",t.credential),t.Zb&&jr(this,"tenantId",t.Zb)}function Fo(t){if(t.code){var e=t.code||"";0==e.indexOf(S)&&(e=e.substring(S.length));var n={credential:No(t),Zb:t.tenantId};if(t.email)n.Jb=t.email;else if(t.phoneNumber)n.ea=t.phoneNumber;else if(!n.credential)return new I(e,t.message||void 0);return new Mo(e,n,t.message)}return null}function Uo(){}function jo(t){return t.c||(t.c=t.b())}function qo(){}function Vo(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 Bo(){}function Ko(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseType=this.responseText=this.response="",this.status=-1,this.statusText="",this.a.onload=m(this.qc,this),this.a.onerror=m(this.Sb,this),this.a.onprogress=m(this.rc,this),this.a.ontimeout=m(this.vc,this)}function Wo(t,e){t.readyState=e,t.onreadystatechange&&t.onreadystatechange()}function Ho(t,e,n){this.reset(t,e,n,void 0,void 0)}function Go(t){this.f=t,this.b=this.c=this.a=null}function zo(t,e){this.name=t,this.value=e}_(Lo,I),_(Mo,I),Mo.prototype.w=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.w();return e&&lt(t,e),t},Mo.prototype.toJSON=function(){return this.w()},Uo.prototype.c=null,_(qo,Uo),qo.prototype.a=function(){var t=Vo(this);return t?new ActiveXObject(t):new XMLHttpRequest},qo.prototype.b=function(){var t={};return Vo(this)&&(t[0]=!0,t[1]=!0),t},Do=new qo,_(Bo,Uo),Bo.prototype.a=function(){var t=new XMLHttpRequest;if("withCredentials"in t)return t;if("undefined"!=typeof XDomainRequest)return new Ko;throw Error("Unsupported browser")},Bo.prototype.b=function(){return{}},(t=Ko.prototype).open=function(t,e,n){if(null!=n&&!n)throw Error("Only async requests are supported.");this.a.open(t,e)},t.send=function(t){if(t){if("string"!=typeof t)throw Error("Only string data is supported");this.a.send(t)}else this.a.send()},t.abort=function(){this.a.abort()},t.setRequestHeader=function(){},t.getResponseHeader=function(t){return"content-type"==t.toLowerCase()?this.a.contentType:""},t.qc=function(){this.status=200,this.response=this.responseText=this.a.responseText,Wo(this,4)},t.Sb=function(){this.status=500,this.response=this.responseText="",Wo(this,4)},t.vc=function(){this.Sb()},t.rc=function(){this.status=200,Wo(this,1)},t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType},Ho.prototype.a=null,Ho.prototype.reset=function(t,e,n,r,i){delete this.a},zo.prototype.toString=function(){return this.name};var Qo=new zo("SEVERE",1e3),Yo=new zo("WARNING",900),Xo=new zo("CONFIG",700),Jo=new zo("FINE",500);Go.prototype.log=function(t,e,n){if(t.value>=function t(e){return e.c||(e.a?t(e.a):(P("Root logger has no level set."),null))}(this).value)for(v(e)&&(e=e()),t=new Ho(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var $o,Zo={},ta=null;function ea(t){var e,n,r;return ta||(ta=new Go(""),(Zo[""]=ta).c=Xo),(e=Zo[t])||(e=new Go(t),r=t.lastIndexOf("."),n=t.substr(r+1),(r=ea(t.substr(0,r))).b||(r.b={}),(r.b[n]=e).a=r,Zo[t]=e),e}function na(t,e){t&&t.log(Jo,e,void 0)}function ra(t){this.f=t}function ia(t){ln.call(this),this.u=t,this.h=void 0,this.readyState=oa,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.l=new Headers,this.b=null,this.s="GET",this.f="",this.a=!1,this.i=ea("goog.net.FetchXmlHttp"),this.m=this.c=this.g=null}_(ra,Uo),ra.prototype.a=function(){return new ia(this.f)},ra.prototype.b=($o={},function(){return $o}),_(ia,ln);var oa=0;function aa(t){t.c.read().then(t.pc.bind(t)).catch(t.Ua.bind(t))}function sa(t){t.readyState=4,t.g=null,t.c=null,t.m=null,ua(t)}function ua(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function ca(t){ln.call(this),this.headers=new bn,this.D=t||null,this.c=!1,this.C=this.a=null,this.h=this.R=this.l="",this.f=this.O=this.i=this.J=!1,this.g=0,this.s=null,this.m=ha,this.u=this.S=!1}(t=ia.prototype).open=function(t,e){if(this.readyState!=oa)throw this.abort(),Error("Error reopening a connection");this.s=t,this.f=e,this.readyState=1,ua(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.l,method:this.s,credentials:this.h,cache:void 0};t&&(e.body=t),this.u.fetch(new Request(this.f,e)).then(this.uc.bind(this),this.Ua.bind(this))},t.abort=function(){this.response=this.responseText="",this.l=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,sa(this)),this.readyState=oa},t.uc=function(t){this.a&&(this.g=t,this.b||(this.status=this.g.status,this.statusText=this.g.statusText,this.b=t.headers,this.readyState=2,ua(this)),this.a&&(this.readyState=3,ua(this),this.a&&("arraybuffer"===this.responseType?t.arrayBuffer().then(this.sc.bind(this),this.Ua.bind(this)):void 0!==l.ReadableStream&&"body"in t?(this.response=this.responseText="",this.c=t.body.getReader(),this.m=new TextDecoder,aa(this)):t.text().then(this.tc.bind(this),this.Ua.bind(this)))))},t.pc=function(t){var e;this.a&&((e=this.m.decode(t.value||new Uint8Array(0),{stream:!t.done}))&&(this.response=this.responseText+=e),(t.done?sa:ua)(this),3==this.readyState&&aa(this))},t.tc=function(t){this.a&&(this.response=this.responseText=t,sa(this))},t.sc=function(t){this.a&&(this.response=t,sa(this))},t.Ua=function(t){var e=this.i;e&&e.log(Yo,"Failed to fetch url "+this.f,t instanceof Error?t:Error(t)),this.a&&sa(this)},t.setRequestHeader=function(t,e){this.l.append(t,e)},t.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.i)&&t.log(Yo,"Attempting to get response header but no headers have been received for url: "+this.f,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var t=this.i;return t&&t.log(Yo,"Attempting to get all response headers but no headers have been received for url: "+this.f,void 0),""}for(var t=[],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")},Object.defineProperty(ia.prototype,"withCredentials",{get:function(){return"include"===this.h},set:function(t){this.h=t?"include":"same-origin"}}),_(ca,ln);var ha="";ca.prototype.b=ea("goog.net.XhrIo");var la=/^https?$/i,fa=["POST","PUT"];function pa(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.R=n,e.J=!1,e.c=!0,e.a=(e.D||Do).a(),e.C=e.D?jo(e.D):jo(Do),e.a.onreadystatechange=m(e.Vb,e);try{na(e.b,Ia(e,"Opening Xhr")),e.O=!0,e.a.open(n,String(t),!0),e.O=!1}catch(t){return na(e.b,Ia(e,"Error opening Xhr: "+t.message)),void va(e,t)}t=r||"";var o,a=new bn(e.headers);i&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(d(t)||"string"==typeof t)j(t,e,void 0);else for(var n=mn(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){a.set(e,t)}),i=function(t){t:{for(var e=da,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]}(a.Y()),r=l.FormData&&t instanceof l.FormData,!K(fa,n)||i||r||a.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),a.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.S&&(e.a.withCredentials=e.S);try{ba(e),0<e.g&&(e.u=(o=e.a,Bt&&Jt(9)&&"number"==typeof o.timeout&&void 0!==o.ontimeout),na(e.b,Ia(e,"Will abort after "+e.g+"ms if incomplete, xhr2 "+e.u)),e.u?(e.a.timeout=e.g,e.a.ontimeout=m(e.Ma,e)):e.s=vn(e.Ma,e.g,e)),na(e.b,Ia(e,"Sending request")),e.i=!0,e.a.send(t),e.i=!1}catch(t){na(e.b,Ia(e,"Send error: "+t.message)),va(e,t)}}function da(t){return"content-type"==t.toLowerCase()}function va(t,e){t.c=!1,t.a&&(t.f=!0,t.a.abort(),t.f=!1),t.h=e,ga(t),ma(t)}function ga(t){t.J||(t.J=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function ya(e){if(e.c&&void 0!==h)if(e.C[1]&&4==_a(e)&&2==wa(e))na(e.b,Ia(e,"Local request error detected and ignored"));else if(e.i&&4==_a(e))vn(e.Vb,0,e);else if(e.dispatchEvent("readystatechange"),4==_a(e)){na(e.b,Ia(e,"Request complete")),e.c=!1;try{var t,n,r,i,o=wa(e);t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var a=!0;break t;default:a=!1}if((t=a)||((n=0===o)&&(!(i=String(e.l).match(In)[1]||null)&&l.self&&l.self.location&&(i=(r=l.self.location.protocol).substr(0,r.length-1)),n=!la.test(i?i.toLowerCase():"")),t=n),t)e.dispatchEvent("complete"),e.dispatchEvent("success");else{try{var s=2<_a(e)?e.a.statusText:""}catch(t){na(e.b,"Can not get status: "+t.message),s=""}e.h=s+" ["+wa(e)+"]",ga(e)}}finally{ma(e)}}}function ma(e,t){if(e.a){ba(e);var n=e.a,r=e.C[0]?a:null;e.a=null,e.C=null,t||e.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){(e=e.b)&&e.log(Qo,"Problem encountered resetting onreadystatechange: "+t.message,void 0)}}}function ba(t){t.a&&t.u&&(t.a.ontimeout=null),t.s&&(l.clearTimeout(t.s),t.s=null)}function _a(t){return t.a?t.a.readyState:0}function wa(t){try{return 2<_a(t)?t.a.status:-1}catch(t){return-1}}function Ia(t,e){return e+" ["+t.R+" "+t.l+" "+wa(t)+"]"}function Ta(t){var e=xa;this.g=[],this.u=e,this.s=t||null,this.f=this.a=!1,this.c=void 0,this.v=this.C=this.i=!1,this.h=0,this.b=null,this.l=0}function Ea(t,e,n){t.a=!0,t.c=n,t.f=!e,Na(t)}function Sa(t){if(t.a){if(!t.v)throw new Aa;t.v=!1}}function Ca(t,e,n,r){t.g.push([e,n,r]),t.a&&Na(t)}function ka(t){return B(t.g,function(t){return v(t[1])})}function Na(e){var n;e.h&&e.a&&ka(e)&&(r=e.h,(n=Pa[r])&&(l.clearTimeout(n.a),delete Pa[r]),e.h=0),e.b&&(e.b.l--,delete e.b);for(var r=e.c,t=n=!1;e.g.length&&!e.i;){var i=(a=e.g.shift())[0],o=a[1],a=a[2];if(i=e.f?o:i)try{var s=i.call(a||e.s,r);void 0!==s&&(e.f=e.f&&(s==r||s instanceof Error),e.c=r=s),(A(r)||"function"==typeof l.Promise&&r instanceof l.Promise)&&(t=!0,e.i=!0)}catch(t){r=t,e.f=!0,ka(e)||(n=!0)}}e.c=r,t&&(s=m(e.m,e,!0),t=m(e.m,e,!1),r instanceof Ta?(Ca(r,s,t),r.C=!0):r.then(s,t)),n&&(r=new Oa(r),Pa[r.a]=r,e.h=r.a)}function Aa(){R.call(this)}function Ra(){R.call(this)}function Oa(t){this.a=l.setTimeout(m(this.c,this),0),this.b=t}(t=ca.prototype).Ma=function(){void 0!==h&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",na(this.b,Ia(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},t.abort=function(){this.a&&this.c&&(na(this.b,Ia(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),ma(this))},t.Da=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),ma(this,!0)),ca.ab.Da.call(this)},t.Vb=function(){this.xa||(this.O||this.i||this.f?ya(this):this.Jc())},t.Jc=function(){ya(this)},t.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.m){case ha: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(Qo,"Response type "+this.m+" is not supported on this browser",void 0),null}catch(t){return na(this.b,"Can not get response: "+t.message),null}},Ta.prototype.cancel=function(t){var e;this.a?this.c instanceof Ta&&this.c.cancel():(this.b&&(e=this.b,delete this.b,t?e.cancel(t):(e.l--,e.l<=0&&e.cancel())),this.u?this.u.call(this.s,this):this.v=!0,this.a||(t=new Ra,Sa(this),Ea(this,!1,t)))},Ta.prototype.m=function(t,e){this.i=!1,Ea(this,t,e)},Ta.prototype.then=function(t,e,n){var r,i,o=new fe(function(t,e){r=t,i=e});return Ca(this,r,function(t){t instanceof Ra?o.cancel():i(t)}),o.then(t,e,n)},Ta.prototype.$goog_Thenable=!0,_(Aa,R),Aa.prototype.message="Deferred has already fired",Aa.prototype.name="AlreadyCalledError",_(Ra,R),Ra.prototype.message="Deferred was canceled",Ra.prototype.name="CanceledError",Oa.prototype.c=function(){throw delete Pa[this.a],this.b};var Pa={};function Da(t){var e=document,n=_t(t).toString(),r=ae(document,"SCRIPT"),i={Wb:r,Ma:void 0},o=new Ta(i),a=window.setTimeout(function(){La(r,!0);var t=new Ua(Fa,"Timeout reached for loading script "+n);Sa(o),Ea(o,!1,t)},5e3);return i.Ma=a,r.onload=r.onreadystatechange=function(){r.readyState&&"loaded"!=r.readyState&&"complete"!=r.readyState||(La(r,!1,a),Sa(o),Ea(o,!0,null))},r.onerror=function(){La(r,!0,a);var t=new Ua(Ma,"Error while loading script "+n);Sa(o),Ea(o,!1,t)},lt(i={},{type:"text/javascript",charset:"UTF-8"}),ee(r,i),i=t,ft(t=r,"HTMLScriptElement"),t.src=_t(i),(i=(i=t.ownerDocument&&t.ownerDocument.defaultView)&&i!=l?f(i.document):s=null===s?f(l.document):s)&&t.setAttribute("nonce",i),((e=((i=e)||document).getElementsByTagName("HEAD"))&&0!=e.length?e[0]:i.documentElement).appendChild(r),o}function xa(){var t;this&&this.Wb&&((t=this.Wb)&&"SCRIPT"==t.tagName&&La(t,!0,this.Ma))}function La(t,e,n){null!=n&&l.clearTimeout(n),t.onload=a,t.onerror=a,t.onreadystatechange=a,e&&window.setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},0)}var Ma=0,Fa=1;function Ua(t,e){var n="Jsloader error (code #"+t+")";e&&(n+=": "+e),R.call(this,n),this.code=t}function ja(t){this.f=t}function qa(t,e,n){if(this.c=t,t=e||{},this.l=t.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token",this.m=t.secureTokenTimeout||Ka,this.g=ct(t.secureTokenHeaders||Wa),this.h=t.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.i=t.identityPlatformEndpoint||"https://identitytoolkit.googleapis.com/v2/",this.v=t.firebaseTimeout||Ha,this.a=ct(t.firebaseHeaders||Ga),n&&(this.a["X-Client-Version"]=n,this.g["X-Client-Version"]=n),n="Node"==hr(),!(n=l.XMLHttpRequest||n&&Xl.INTERNAL.node&&Xl.INTERNAL.node.XMLHttpRequest)&&!cr())throw new I("internal-error","The XMLHttpRequest compatibility library was not found.");this.f=void 0,cr()?this.f=new ra(self):lr()?this.f=new ja(n):this.f=new Bo,this.b=null}_(Ua,R),_(ja,Uo),ja.prototype.a=function(){return new this.f},ja.prototype.b=function(){return{}};var Va,Ba="idToken",Ka=new Rr(3e4,6e4),Wa={"Content-Type":"application/x-www-form-urlencoded"},Ha=new Rr(3e4,6e4),Ga={"Content-Type":"application/json"};function za(t,e){e?t.a["X-Firebase-Locale"]=e:delete t.a["X-Firebase-Locale"]}function Qa(t,e){e&&(t.l=Ya("https://securetoken.googleapis.com/v1/token",e),t.h=Ya("https://www.googleapis.com/identitytoolkit/v3/relyingparty/",e),t.i=Ya("https://identitytoolkit.googleapis.com/v2/",e))}function Ya(t,e){return t=An(t),e=An(e.url),t.f=t.a+t.f,En(t,e.c),t.a=e.a,Sn(t,e.g),t.toString()}function Xa(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 Ja(t,e,n,r,i,o,a){var s;(t=((s=dr(s=yr())==pr&&(s=s.match(/\sChrome\/(\d+)/i))&&2==s.length?parseInt(s[1],10):null)&&s<30||Bt&&$t&&!(9<$t))&&!cr()?(Va=Va||new fe(function(t,e){var n,r;n=t,r=e,((window.gapi||{}).client||{}).request?n():(l[Za]=function(){((window.gapi||{}).client||{}).request?n():r(Error("CORS_UNSUPPORTED"))},function(t,e){Ca(t,null,e,void 0)}(Da(wt($a,{onload:Za})),function(){r(Error("CORS_UNSUPPORTED"))}))}),m(t.s,t)):m(t.u,t))(e,n,r,i,o,a)}qa.prototype.T=function(){return this.b},qa.prototype.u=function(t,n,e,r,i,o){if(cr()&&(void 0===l.fetch||void 0===l.Headers||void 0===l.Request))throw new I("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 a,s=new ca(this.f);o&&(s.g=Math.max(0,o),a=setTimeout(function(){s.dispatchEvent("timeout")},o)),fn(s,"complete",function(){a&&clearTimeout(a);var e=null;try{e=JSON.parse(function(e){try{return e.a?e.a.responseText:""}catch(t){return na(e.b,"Can not get responseText: "+t.message),""}}(this))||null}catch(t){e=null}n&&n(e)}),pn(s,"ready",function(){a&&clearTimeout(a),Le(this)}),pn(s,"timeout",function(){a&&clearTimeout(a),Le(this),n&&n(null)}),pa(s,t,e,r,i)};var $a=new pt(yt,"https://apis.google.com/js/client.js?onload=%{onload}"),Za="__fcb"+Math.floor(1e6*Math.random()).toString();function ts(t,e,n,r,i,o,a){var s=An(e+n);kn(s,"key",t.c),a&&kn(s,"cb",Date.now().toString());var u="GET"==r;if(u)for(var c in i)i.hasOwnProperty(c)&&kn(s,c,i[c]);return new fe(function(e,n){Ja(t,s.toString(),function(t){t?t.error?n(Ys(t,o||{})):e(t):n(new I("network-request-failed"))},r,u?void 0:zn(Sr(i)),t.a,t.v.get())})}function es(t){if("string"!=typeof(t=t.email)||!or.test(t))throw new I("invalid-email")}function ns(t){"email"in t&&es(t)}function rs(t){if(!t[Ba]){if(t.mfaPendingCredential)throw new I("multi-factor-auth-required",null,ct(t));throw new I("internal-error")}}function is(t){if(t.phoneNumber||t.temporaryProof){if(!t.phoneNumber||!t.temporaryProof)throw new I("internal-error")}else{if(!t.sessionInfo)throw new I("missing-verification-id");if(!t.code)throw new I("missing-verification-code")}}qa.prototype.s=function(t,n,r,i,o){var a=this;Va.then(function(){window.gapi.client.setApiKey(a.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"}})})},qa.prototype.zb=function(){return zs(this,Ls,{})},qa.prototype.Bb=function(t,e){return zs(this,Ds,{idToken:t,email:e})},qa.prototype.Cb=function(t,e){return zs(this,xs,{idToken:t,password:e})};var os={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};function as(t){if(!t.phoneVerificationInfo)throw new I("internal-error");if(!t.phoneVerificationInfo.sessionInfo)throw new I("missing-verification-id");if(!t.phoneVerificationInfo.code)throw new I("missing-verification-code")}function ss(t){if(!t.requestUri||!t.sessionId&&!t.postBody&&!t.pendingToken)throw new I("internal-error")}function us(t,e){return e.oauthIdToken&&e.providerId&&0==e.providerId.indexOf("oidc.")&&!e.pendingToken&&(t.sessionId?e.nonce=t.sessionId:t.postBody&&(Kn(t=new jn(t.postBody),"nonce")&&(e.nonce=t.get("nonce")))),e}function cs(t){var e=null;if(t.needConfirmation?(t.code="account-exists-with-different-credential",e=Fo(t)):"FEDERATED_USER_ID_ALREADY_LINKED"==t.errorMessage?(t.code="credential-already-in-use",e=Fo(t)):"EMAIL_EXISTS"==t.errorMessage?(t.code="email-already-in-use",e=Fo(t)):t.errorMessage&&(e=Qs(t.errorMessage)),e)throw e;rs(t)}function hs(t,e){return e.returnIdpCredential=!0,zs(t,Us,e)}function ls(t,e){return e.returnIdpCredential=!0,zs(t,qs,e)}function fs(t,e){return e.returnIdpCredential=!0,e.autoCreate=!1,zs(t,js,e)}function ps(t){if(!t.oobCode)throw new I("invalid-action-code")}(t=qa.prototype).Db=function(t,r){var i={idToken:t},o=[];return st(os,function(t,e){var n=r[e];null===n?o.push(t):e in r&&(i[e]=n)}),o.length&&(i.deleteAttribute=o),zs(this,Ds,i)},t.vb=function(t,e){return lt(t={requestType:"PASSWORD_RESET",email:t},e),zs(this,Ns,t)},t.wb=function(t,e){return lt(t={requestType:"EMAIL_SIGNIN",email:t},e),zs(this,Ss,t)},t.ub=function(t,e){return lt(t={requestType:"VERIFY_EMAIL",idToken:t},e),zs(this,Cs,t)},t.Eb=function(t,e,n){return lt(t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:t,newEmail:e},n),zs(this,ks,t)},t.fb=function(t){return zs(this,Ks,t)},t.nb=function(t,e){return zs(this,Os,{oobCode:t,newPassword:e})},t.Ra=function(t){return zs(this,vs,{oobCode:t})},t.jb=function(t){return zs(this,ds,{oobCode:t})};var ds={endpoint:"setAccountInfo",A:ps,Z:"email",B:!0},vs={endpoint:"resetPassword",A:ps,G:function(t){var e=t.requestType;if(!e||!t.email&&"EMAIL_SIGNIN"!=e&&"VERIFY_AND_CHANGE_EMAIL"!=e)throw new I("internal-error")},B:!0},gs={endpoint:"signupNewUser",A:function(t){if(es(t),!t.password)throw new I("weak-password")},G:rs,V:!0,B:!0},ys={endpoint:"createAuthUri",B:!0},ms={endpoint:"deleteAccount",N:["idToken"]},bs={endpoint:"setAccountInfo",N:["idToken","deleteProvider"],A:function(t){if(!Array.isArray(t.deleteProvider))throw new I("internal-error")}},_s={endpoint:"emailLinkSignin",N:["email","oobCode"],A:es,G:rs,V:!0,B:!0},ws={endpoint:"emailLinkSignin",N:["idToken","email","oobCode"],A:es,G:rs,V:!0},Is={endpoint:"accounts/mfaEnrollment:finalize",N:["idToken","phoneVerificationInfo"],A:as,G:rs,B:!0,Na:!0},Ts={endpoint:"accounts/mfaSignIn:finalize",N:["mfaPendingCredential","phoneVerificationInfo"],A:as,G:rs,B:!0,Na:!0},Es={endpoint:"getAccountInfo"},Ss={endpoint:"getOobConfirmationCode",N:["requestType"],A:function(t){if("EMAIL_SIGNIN"!=t.requestType)throw new I("internal-error");es(t)},Z:"email",B:!0},Cs={endpoint:"getOobConfirmationCode",N:["idToken","requestType"],A:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new I("internal-error")},Z:"email",B:!0},ks={endpoint:"getOobConfirmationCode",N:["idToken","newEmail","requestType"],A:function(t){if("VERIFY_AND_CHANGE_EMAIL"!=t.requestType)throw new I("internal-error")},Z:"email",B:!0},Ns={endpoint:"getOobConfirmationCode",N:["requestType"],A:function(t){if("PASSWORD_RESET"!=t.requestType)throw new I("internal-error");es(t)},Z:"email",B:!0},As={lb:!0,endpoint:"getProjectConfig",Ub:"GET"},Rs={lb:!0,endpoint:"getRecaptchaParam",Ub:"GET",G:function(t){if(!t.recaptchaSiteKey)throw new I("internal-error")}},Os={endpoint:"resetPassword",A:ps,Z:"email",B:!0},Ps={endpoint:"sendVerificationCode",N:["phoneNumber","recaptchaToken"],Z:"sessionInfo",B:!0},Ds={endpoint:"setAccountInfo",N:["idToken"],A:ns,V:!0},xs={endpoint:"setAccountInfo",N:["idToken"],A:function(t){if(ns(t),!t.password)throw new I("weak-password")},G:rs,V:!0},Ls={endpoint:"signupNewUser",G:rs,V:!0,B:!0},Ms={endpoint:"accounts/mfaEnrollment:start",N:["idToken","phoneEnrollmentInfo"],A:function(t){if(!t.phoneEnrollmentInfo)throw new I("internal-error");if(!t.phoneEnrollmentInfo.phoneNumber)throw new I("missing-phone-number");if(!t.phoneEnrollmentInfo.recaptchaToken)throw new I("missing-app-credential")},G:function(t){if(!t.phoneSessionInfo||!t.phoneSessionInfo.sessionInfo)throw new I("internal-error")},B:!0,Na:!0},Fs={endpoint:"accounts/mfaSignIn:start",N:["mfaPendingCredential","mfaEnrollmentId","phoneSignInInfo"],A:function(t){if(!t.phoneSignInInfo||!t.phoneSignInInfo.recaptchaToken)throw new I("missing-app-credential")},G:function(t){if(!t.phoneResponseInfo||!t.phoneResponseInfo.sessionInfo)throw new I("internal-error")},B:!0,Na:!0},Us={endpoint:"verifyAssertion",A:ss,Ya:us,G:cs,V:!0,B:!0},js={endpoint:"verifyAssertion",A:ss,Ya:us,G:function(t){if(t.errorMessage&&"USER_NOT_FOUND"==t.errorMessage)throw new I("user-not-found");if(t.errorMessage)throw Qs(t.errorMessage);rs(t)},V:!0,B:!0},qs={endpoint:"verifyAssertion",A:function(t){if(ss(t),!t.idToken)throw new I("internal-error")},Ya:us,G:cs,V:!0},Vs={endpoint:"verifyCustomToken",A:function(t){if(!t.token)throw new I("invalid-custom-token")},G:rs,V:!0,B:!0},Bs={endpoint:"verifyPassword",A:function(t){if(es(t),!t.password)throw new I("wrong-password")},G:rs,V:!0,B:!0},Ks={endpoint:"verifyPhoneNumber",A:is,G:rs,B:!0},Ws={endpoint:"verifyPhoneNumber",A:function(t){if(!t.idToken)throw new I("internal-error");is(t)},G:function(t){if(t.temporaryProof)throw t.code="credential-already-in-use",Fo(t);rs(t)}},Hs={Hb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:is,G:rs,B:!0},Gs={endpoint:"accounts/mfaEnrollment:withdraw",N:["idToken","mfaEnrollmentId"],G:function(t){if(!!t[Ba]^!!t.refreshToken)throw new I("internal-error")},B:!0,Na:!0};function zs(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.N))return _e(new I("internal-error"));var r,i=!!e.Na,o=e.Ub||"POST";return be(n).then(e.A).then(function(){return e.V&&(n.returnSecureToken=!0),e.B&&t.b&&void 0===n.tenantId&&(n.tenantId=t.b),ts(t,i?t.i:t.h,e.endpoint,o,n,e.Hb,e.lb||!1)}).then(function(t){return r=t,e.Ya?e.Ya(n,r):r}).then(e.G).then(function(){if(!e.Z)return r;if(!(e.Z in r))throw new I("internal-error");return r[e.Z]})}function Qs(t){return Ys({error:{errors:[{message:t}],code:400,message:t}})}function Ys(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 I(i[r]):null)return r;for(n in r=t.error&&t.error.message||"",lt(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 I(i[n],e);return new I("internal-error",e=!e&&t?Er(t):e)}function Xs(t){var o;this.b=t,this.a=null,this.rb=(o=this,(tu=tu||new fe(function(t,e){function n(){Ar(),mr("gapi.load")("gapi.iframes",{callback:t,ontimeout:function(){Ar(),e(Error("Network Error"))},timeout:$s.get()})}var r;mr("gapi.iframes.Iframe")?t():mr("gapi.load")?n():(r="__iframefcb"+Math.floor(1e6*Math.random()).toString(),l[r]=function(){mr("gapi.load")?n():e(Error("Network Error"))},be(Da(r=wt(Js,{onload:r}))).o(function(){e(Error("Network Error"))}))}).o(function(t){throw tu=null,t})).then(function(){return new fe(function(r,i){mr("gapi.iframes.getContext")().open({where:document.body,url:o.b,messageHandlersFilter:mr("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"))},Zs.get());t.ping(e).then(e,function(){i(Error("Network Error"))})})})}))}var Js=new pt(yt,"https://apis.google.com/js/api.js?onload=%{onload}"),$s=new Rr(3e4,6e4),Zs=new Rr(5e3,15e3),tu=null;function eu(t,e,n,r){this.l=t,this.h=e,this.i=n,this.g=r,this.f=null,t=this.g?Rn((t=An(this.g.url)).c,t.a,t.g,"/emulator/auth/iframe"):Rn("https",this.l,null,"/__/auth/iframe"),this.a=t,kn(this.a,"apiKey",this.h),kn(this.a,"appName",this.i),this.b=null,this.c=[]}function nu(t,e,n,r,i,o){this.u=t,this.s=e,this.c=n,this.m=r,this.v=o,this.i=this.g=this.l=null,this.a=i,this.h=this.f=null}function ru(t){try{return Xl.app(t).auth().Ga()}catch(t){return[]}}function iu(t,e,n,r,i,o){this.s=t,this.g=e,this.b=n,this.f=o,this.c=r||null,this.i=i||null,this.l=this.u=this.C=null,this.h=[],this.m=this.a=null}function ou(t){var s=Zn();return zs(t,As,{}).then(function(t){return t.authorizedDomains||[]}).then(function(t){t:{for(var e=(n=An(s)).c,n=n.a,r=0;r<t.length;r++){var i=t[r],o=n,a=e;if(o=0==i.indexOf("chrome-extension://")?An(i).a==o&&"chrome-extension"==a:("http"==a||"https"==a)&&(ir.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 Lo(Zn())})}function au(i){return i.m||(i.m=ar().then(function(){var t,e,n,r;i.u||(t=i.c,e=i.i,n=ru(i.b),(r=new eu(i.s,i.g,i.b,i.f)).f=t,r.b=e,r.c=z(n||[]),i.u=r.toString()),i.v=new Xs(i.u),function(r){if(!r.v)throw Error("IfcHandler must be initialized!");!function(t,e){t.rb.then(function(){t.a.register("authEvent",e,mr("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}(r.v,function(t){var e={};if(t&&t.authEvent){var n=!1;for(t=Oo(t.authEvent),e=0;e<r.h.length;e++)n=r.h[e](t)||n;return(e={}).status=n?"ACK":"ERROR",be(e)}return e.status="ERROR",be(e)})}(i)}),i.m)}function su(t){return t.l||(t.C=t.c?gr(t.c,ru(t.b)):null,t.l=new qa(t.g,N(t.i),t.C),t.f&&Qa(t.l,t.f)),t.l}function uu(t,e,n,r,i,o,a,s,u,c,h,l){return(t=new nu(t,e,n,r,i,l)).l=o,t.g=a,t.i=s,t.b=ct(u||null),t.f=c,t.yb(h).toString()}function cu(t){if(this.a=t||Xl.INTERNAL.reactNative&&Xl.INTERNAL.reactNative.AsyncStorage,!this.a)throw new I("internal-error","The React Native compatibility library was not found.");this.type="asyncStorage"}function hu(t){this.b=t,this.a={},this.f=m(this.c,this)}eu.prototype.toString=function(){return this.f?kn(this.a,"v",this.f):Bn(this.a.b,"v"),this.b?kn(this.a,"eid",this.b):Bn(this.a.b,"eid"),this.c.length?kn(this.a,"fw",this.c.join(",")):Bn(this.a.b,"fw"),this.a.toString()},nu.prototype.yb=function(t){return this.h=t,this},nu.prototype.toString=function(){var t;if(kn(t=this.v?Rn((t=An(this.v.url)).c,t.a,t.g,"/emulator/auth/handler"):Rn("https",this.u,null,"/__/auth/handler"),"apiKey",this.s),kn(t,"appName",this.c),kn(t,"authType",this.m),this.a.isOAuthProvider){var e=this.a;try{var n=Xl.app(this.c).auth().la()}catch(t){n=null}for(r in e.ob=n,kn(t,"providerId",this.a.providerId),e=Sr((n=this.a).Ib))e[r]=e[r].toString();for(var r=n.Qc,e=ct(e),i=0;i<r.length;i++){var o=r[i];o in e&&delete e[o]}n.pb&&n.ob&&!e[n.pb]&&(e[n.pb]=n.ob),ut(e)||kn(t,"customParameters",Er(e))}if("function"==typeof this.a.Qb&&((n=this.a.Qb()).length&&kn(t,"scopes",n.join(","))),this.l?kn(t,"redirectUrl",this.l):Bn(t.b,"redirectUrl"),this.g?kn(t,"eventId",this.g):Bn(t.b,"eventId"),this.i?kn(t,"v",this.i):Bn(t.b,"v"),this.b)for(var a in this.b)this.b.hasOwnProperty(a)&&!Nn(t,a)&&kn(t,a,this.b[a]);return this.h?kn(t,"tid",this.h):Bn(t.b,"tid"),this.f?kn(t,"eid",this.f):Bn(t.b,"eid"),(a=ru(this.c)).length&&kn(t,"fw",a.join(",")),t.toString()},(t=iu.prototype).Ob=function(e,n,t){var r=new I("popup-closed-by-user"),i=new I("web-storage-unsupported"),o=this,a=!1;return this.ma().then(function(){var t,r;r={type:"webStorageSupport"},au(t=o).then(function(){return e=t.v,n=r,e.rb.then(function(){return new fe(function(t){e.a.send(n.type,n,t,mr("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&&nr(e),n(i),a=!0)})}).o(function(){}).then(function(){if(!a)return n=e,new fe(function(e){return function t(){gn(2e3).then(function(){return n&&!n.closed?t():void e()})}()});var n}).then(function(){if(!a)return gn(t).then(function(){n(r)})})},t.Xb=function(){var t=yr();return!Tr(t)&&!Nr(t)},t.Tb=function(){return!1},t.Mb=function(e,t,n,r,i,o,a,s){if(!e)return _e(new I("popup-blocked"));if(a&&!Tr())return this.ma().o(function(t){nr(e),i(t)}),r(),be();this.a||(this.a=ou(su(this)));var u=this;return this.a.then(function(){var t=u.ma().o(function(t){throw nr(e),i(t),t});return r(),t}).then(function(){Ao(n),a||tr(uu(u.s,u.g,u.b,t,n,null,o,u.c,void 0,u.i,s,u.f),e)}).o(function(t){throw"auth/network-request-failed"==t.code&&(u.a=null),t})},t.Nb=function(t,e,n,r){this.a||(this.a=ou(su(this)));var i=this;return this.a.then(function(){Ao(e),tr(uu(i.s,i.g,i.b,t,e,Zn(),n,i.c,void 0,i.i,r,i.f))}).o(function(t){throw"auth/network-request-failed"==t.code&&(i.a=null),t})},t.ma=function(){var t=this;return au(this).then(function(){return t.v.rb}).o(function(){throw t.a=null,new I("network-request-failed")})},t.$b=function(){return!0},t.Ea=function(t){this.h.push(t)},t.Sa=function(e){H(this.h,function(t){return t==e})},(t=cu.prototype).get=function(t){return be(this.a.getItem(t)).then(function(t){return t&&Cr(t)})},t.set=function(t,e){return be(this.a.setItem(t,Er(e)))},t.U=function(t){return be(this.a.removeItem(t))},t.ca=function(){},t.ia=function(){};var lu,fu=[];function pu(t,e,n){ut(t.a)&&t.b.addEventListener("message",t.f),void 0===t.a[e]&&(t.a[e]=[]),t.a[e].push(n)}function du(t){this.a=t}function vu(t){this.c=t,this.b=!1,this.a=[]}function gu(r,t,e,n){var i,o,a,s,u=e||{},c=null;if(r.b)return _e(Error("connection_unavailable"));var h=n?800:50,l="undefined"!=typeof MessageChannel?new MessageChannel:null;return new fe(function(e,n){l?(i=Math.floor(Math.random()*Math.pow(10,20)).toString(),l.port1.start(),a=setTimeout(function(){n(Error("unsupported_event"))},h),c={messageChannel:l,onMessage:o=function(t){t.data.eventId===i&&("ack"===t.data.status?(clearTimeout(a),s=setTimeout(function(){n(Error("timeout"))},3e3)):"done"===t.data.status?(clearTimeout(s),void 0!==t.data.response?e(t.data.response):n(Error("unknown_error"))):(clearTimeout(a),clearTimeout(s),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 yu(r,c),t}).o(function(t){throw yu(r,c),t})}function yu(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 mu(){if(!Iu())throw new I("web-storage-unsupported");this.c={},this.a=[],this.b=0,this.m=l.indexedDB,this.type="indexedDB",this.g=this.v=this.f=this.l=null,this.s=!1,this.h=null;var t,e,n,r=this;cr()&&self?(this.v=(n=cr()?self:null,j(fu,function(t){t.b==n&&(e=t)}),e||(e=new hu(n),fu.push(e)),e),pu(this.v,"keyChanged",function(t,n){return ku(r).then(function(e){return 0<e.length&&j(r.a,function(t){t(e)}),{keyProcessed:K(e,n.key)}})}),pu(this.v,"ping",function(){return be(["keyChanged"])})):((t=l.navigator)&&t.serviceWorker?be().then(function(){return t.serviceWorker.ready}).then(function(t){return t.active||null}).o(function(){return null}):be(null)).then(function(t){(r.h=t)&&(r.g=new vu(new du(t)),gu(r.g,"ping",null,!0).then(function(t){t[0].fulfilled&&K(t[0].value,"keyChanged")&&(r.s=!0)}).o(function(){}))})}function bu(i){return new fe(function(e,n){var t=i.m.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 fe(function(t,e){var n=r.m.deleteDatabase("firebaseLocalStorageDb");n.onsuccess=function(){t()},n.onerror=function(t){e(Error(t.target.error))}}).then(function(){return bu(i)}).then(function(t){e(t)}).o(function(t){n(t)}))}})}function _u(t){return t.i||(t.i=bu(t)),t.i}function wu(i,t){var o=0;return new fe(function e(n,r){_u(i).then(t).then(n).o(function(t){return 3<++o?void r(t):_u(i).then(function(t){return t.close(),i.i=void 0,e(n,r)}).o(function(t){r(t)})})})}function Iu(){try{return l.indexedDB}catch(t){return}}function Tu(t){return t.objectStore("firebaseLocalStorage")}function Eu(t,e){return t.transaction(["firebaseLocalStorage"],e?"readwrite":"readonly")}function Su(t){return new fe(function(e,n){t.onsuccess=function(t){t&&t.target?e(t.target.result):e()},t.onerror=function(t){n(t.target.error)}})}function Cu(t,e){return t.g&&t.h&&((n=l.navigator)&&n.serviceWorker&&n.serviceWorker.controller||null)===t.h?gu(t.g,"keyChanged",{key:e},t.s).then(function(){}).o(function(){}):be();var n}function ku(r){return _u(r).then(function(t){var i=Tu(Eu(t,!1));return i.getAll?Su(i.getAll()):new fe(function(e,n){var r=[],t=i.openCursor();t.onsuccess=function(t){(t=t.target.result)?(r.push(t.value),t.continue()):e(r)},t.onerror=function(t){n(t.target.error)}})}).then(function(t){var e={},n=[];if(0==r.b){for(n=0;n<t.length;n++)e[t[n].fbase_key]=t[n].value;n=function t(e,n){var r,i=[];for(r in e)r in n&&typeof e[r]==typeof n[r]?"object"==typeof e[r]&&null!=e[r]&&null!=n[r]?0<t(e[r],n[r]).length&&i.push(r):e[r]!==n[r]&&i.push(r):i.push(r);for(r in n)r in e||i.push(r);return i}(r.c,e),r.c=e}return n})}function Nu(t){t.l&&t.l.cancel("STOP_EVENT"),t.f&&(clearTimeout(t.f),t.f=null)}function Au(t){var r=this,i=null;this.a=[],this.type="indexedDB",this.c=t,this.b=be().then(function(){if(Iu()){var e=kr(),n="__sak"+e;return lu=lu||new mu,(i=lu).set(n,e).then(function(){return i.get(n)}).then(function(t){if(t!==e)throw Error("indexedDB not supported!");return i.U(n)}).then(function(){return i}).o(function(){return r.c})}return r.c}).then(function(t){return r.type=t.type,t.ca(function(e){j(r.a,function(t){t(e)})}),t})}function Ru(){this.a={},this.type="inMemory"}function Ou(){if(!function(){var t="Node"==hr();if(!(t=Pu()||t&&Xl.INTERNAL.node&&Xl.INTERNAL.node.localStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==hr())throw new I("internal-error","The LocalStorage compatibility library was not found.");throw new I("web-storage-unsupported")}this.a=Pu()||Xl.INTERNAL.node.localStorage,this.type="localStorage"}function Pu(){try{var t=l.localStorage,e=kr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Du(){this.type="nullStorage"}function xu(){if(!function(){var t="Node"==hr();if(!(t=Lu()||t&&Xl.INTERNAL.node&&Xl.INTERNAL.node.sessionStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==hr())throw new I("internal-error","The SessionStorage compatibility library was not found.");throw new I("web-storage-unsupported")}this.a=Lu()||Xl.INTERNAL.node.sessionStorage,this.type="sessionStorage"}function Lu(){try{var t=l.sessionStorage,e=kr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Mu(){var t={};t.Browser=ju,t.Node=qu,t.ReactNative=Vu,t.Worker=Bu,this.a=t[hr()]}hu.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=[],j(t,function(t){e.push(be().then(function(){return t(n.origin,n.data.data)}))}),Ie(e).then(function(t){var e=[];j(t,function(t){e.push({fulfilled:t.Pb,value:t.value,reason:t.reason?t.reason.message:void 0})}),j(e,function(t){for(var e in t)void 0===t[e]&&delete t[e]}),n.ports[0].postMessage({status:"done",eventId:i,eventType:r,response:e})}))},du.prototype.postMessage=function(t,e){this.a.postMessage(t,e)},vu.prototype.close=function(){for(;0<this.a.length;)yu(this,this.a[0]);this.b=!0},(t=mu.prototype).set=function(r,i){var o=this,a=!1;return wu(this,function(t){return Su((t=Tu(Eu(t,!0))).get(r))}).then(function(n){return wu(o,function(t){if(t=Tu(Eu(t,!0)),n)return n.value=i,Su(t.put(n));o.b++,a=!0;var e={};return e.fbase_key=r,e.value=i,Su(t.add(e))})}).then(function(){return o.c[r]=i,Cu(o,r)}).oa(function(){a&&o.b--})},t.get=function(e){return wu(this,function(t){return Su(Tu(Eu(t,!1)).get(e))}).then(function(t){return t&&t.value})},t.U=function(e){var n=this,r=!1;return wu(this,function(t){return r=!0,n.b++,Su(Tu(Eu(t,!0)).delete(e))}).then(function(){return delete n.c[e],Cu(n,e)}).oa(function(){r&&n.b--})},t.ca=function(t){var n;0==this.a.length&&(Nu(n=this),function e(){n.f=setTimeout(function(){n.l=ku(n).then(function(e){0<e.length&&j(n.a,function(t){t(e)})}).then(function(){e()}).o(function(t){"STOP_EVENT"!=t.message&&e()})},800)}()),this.a.push(t)},t.ia=function(e){H(this.a,function(t){return t==e}),0==this.a.length&&Nu(this)},(t=Au.prototype).get=function(e){return this.b.then(function(t){return t.get(e)})},t.set=function(e,n){return this.b.then(function(t){return t.set(e,n)})},t.U=function(e){return this.b.then(function(t){return t.U(e)})},t.ca=function(t){this.a.push(t)},t.ia=function(e){H(this.a,function(t){return t==e})},(t=Ru.prototype).get=function(t){return be(this.a[t])},t.set=function(t,e){return this.a[t]=e,be()},t.U=function(t){return delete this.a[t],be()},t.ca=function(){},t.ia=function(){},(t=Ou.prototype).get=function(t){var e=this;return be().then(function(){return Cr(e.a.getItem(t))})},t.set=function(e,n){var r=this;return be().then(function(){var t=Er(n);null===t?r.U(e):r.a.setItem(e,t)})},t.U=function(t){var e=this;return be().then(function(){e.a.removeItem(t)})},t.ca=function(t){l.window&&$e(l.window,"storage",t)},t.ia=function(t){l.window&&en(l.window,"storage",t)},(t=Du.prototype).get=function(){return be(null)},t.set=function(){return be()},t.U=function(){return be()},t.ca=function(){},t.ia=function(){},(t=xu.prototype).get=function(t){var e=this;return be().then(function(){return Cr(e.a.getItem(t))})},t.set=function(e,n){var r=this;return be().then(function(){var t=Er(n);null===t?r.U(e):r.a.setItem(e,t)})},t.U=function(t){var e=this;return be().then(function(){e.a.removeItem(t)})},t.ca=function(){},t.ia=function(){};var Fu,Uu,ju={F:Ou,bb:xu},qu={F:Ou,bb:xu},Vu={F:cu,bb:Du},Bu={F:Ou,bb:Du},Ku={rd:"local",NONE:"none",td:"session"};function Wu(){var t=!(Nr(yr())||!ur()),e=Tr(),n=br();this.m=t,this.h=e,this.l=n,this.a={},t=Fu=Fu||new Mu;try{this.g=!$n()&&xr()||!l.indexedDB?new t.a.F:new Au(new(cr()?Ru:t.a.F))}catch(t){this.g=new Ru,this.h=!0}try{this.i=new t.a.bb}catch(t){this.i=new Ru}this.v=new Ru,this.f=m(this.Yb,this),this.b={}}function Hu(){return Uu=Uu||new Wu}function Gu(t,e){switch(e){case"session":return t.i;case"none":return t.v;default:return t.g}}function zu(t,e){return"firebase:"+t.name+(e?":"+e:"")}function Qu(t,e,n){return n=zu(e,n),"local"==e.F&&(t.b[n]=null),Gu(t,e.F).U(n)}function Yu(t){t.c&&(clearInterval(t.c),t.c=null)}function Xu(t){this.a=t,this.b=Hu()}(t=Wu.prototype).get=function(t,e){return Gu(this,t.F).get(zu(t,e))},t.set=function(e,t,n){var r=zu(e,n),i=this,o=Gu(this,e.F);return o.set(r,t).then(function(){return o.get(r)}).then(function(t){"local"==e.F&&(i.b[r]=t)})},t.addListener=function(t,e,n){var r;t=zu(t,e),this.l&&(this.b[t]=l.localStorage.getItem(t)),ut(this.a)&&(Gu(this,"local").ca(this.f),this.h||($n()||!xr())&&l.indexedDB||!this.l||(Yu(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.Yb(e))}},1e3))),this.a[t]||(this.a[t]=[]),this.a[t].push(n)},t.removeListener=function(t,e,n){t=zu(t,e),this.a[t]&&(H(this.a[t],function(t){return t==n}),0==this.a[t].length&&delete this.a[t]),ut(this.a)&&(Gu(this,"local").ia(this.f),Yu(this))},t.Yb=function(t){if(t&&t.g){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.mb(n))}else if(0==e.indexOf("firebase:")&&this.a[e]){if(void 0!==t.a.a?Gu(this,"local").ia(this.f):Yu(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.mb(e))};Bt&&$t&&10==$t&&l.localStorage.getItem(e)!==t.a.newValue&&t.a.newValue!==t.a.oldValue?setTimeout(n,10):n()}}else j(t,m(this.mb,this))},t.mb=function(t){this.a[t]&&j(this.a[t],function(t){t()})};var Ju,$u={name:"authEvent",F:"local"};function Zu(){this.a=Hu()}function tc(t,e){this.b=ec,this.f=l.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=t,this.h=e,this.l=l.Int32Array?new Int32Array(64):Array(64),void 0===Ju&&(Ju=l.Int32Array?new Int32Array(uc):uc),this.reset()}_(tc,function(){this.b=-1});for(var ec=64,nc=ec-1,rc=[],ic=0;ic<nc;ic++)rc[ic]=0;var oc=G(128,rc);function ac(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++){var i=0|n[e-15],r=0|n[e-2],o=(0|n[e-16])+((i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3)|0,a=(0|n[e-7])+((r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)|0;n[e]=o+a|0}r=0|t.a[0],i=0|t.a[1];var s=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&s^i&s)|0;a=(o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0)+((a=(a=c&h^~c&l)+(0|Ju[e])|0)+(0|n[e])|0)|0,o=l,l=h,h=c,c=u+a|0,u=s,s=i,i=r,r=a+f|0}t.a[0]=t.a[0]+r|0,t.a[1]=t.a[1]+i|0,t.a[2]=t.a[2]+s|0,t.a[3]=t.a[3]+u|0,t.a[4]=t.a[4]+c|0,t.a[5]=t.a[5]+h|0,t.a[6]=t.a[6]+l|0,t.a[7]=t.a[7]+o|0}function sc(t,e,n){void 0===n&&(n=e.length);var r=0,i=t.c;if("string"==typeof e)for(;r<n;)t.f[i++]=e.charCodeAt(r++),i==t.b&&(ac(t),i=0);else{if(!d(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&&(ac(t),i=0)}}t.c=i,t.g+=n}tc.prototype.reset=function(){this.g=this.c=0,this.a=l.Int32Array?new Int32Array(this.h):z(this.h)};var uc=[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 cc(){tc.call(this,8,hc)}_(cc,tc);var hc=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function lc(t,e,n,r,i,o){this.v=t,this.i=e,this.l=n,this.m=r||null,this.u=i||null,this.s=o,this.h=e+":"+n,this.C=new Zu,this.g=new Xu(this.h),this.f=null,this.b=[],this.a=this.c=null}function fc(t){return new I("invalid-cordova-configuration",t)}function pc(t){var e=new cc;sc(e,t),t=[];var n=8*e.g;e.c<56?sc(e,oc,56-e.c):sc(e,oc,e.b-(e.c-56));for(var r=63;56<=r;r--)e.f[r]=255&n,n/=256;for(ac(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 dc(t,e){for(var n=0;n<t.b.length;n++)try{t.b[n](e)}catch(t){}}function vc(s){return s.f||(s.f=s.ma().then(function(){return new fe(function(n){function e(r){t=!0,a&&a.cancel(),gc(i).then(function(t){var e,n=o;t&&r&&r.url&&(e=null,n=(e=-1!=(n=Qi(r.url)).indexOf("/__/auth/callback")?(e="object"==typeof(e=Cr(Nn(e=An(n),"firebaseError")||null))?T(e):null)?new Ro(t.c,t.b,null,null,e,null,t.T()):new Ro(t.c,t.b,n,t.f,null,null,t.T()):e)||o),dc(i,n)})}var i,o,t,a,r;s.Ea(function t(e){return n(e),s.Sa(t),!1}),i=s,o=new Ro("unknown",null,null,null,new I("no-auth-event")),t=!1,a=gn(500).then(function(){return gc(i).then(function(){t||dc(i,o)})}),r=l.handleOpenURL,l.handleOpenURL=function(t){if(0==t.toLowerCase().indexOf(mr("BuildInfo.packageName",l).toLowerCase()+"://")&&e({url:t}),"function"==typeof r)try{r(t)}catch(t){console.error(t)}},xo=xo||new Po,function(t){var n=xo;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=mr("universalLinks.subscribe",l))&&t(null,n.b))}(e)})})),s.f}function gc(e){var t,n=null;return(t=e.g).b.get($u,t.a).then(Oo).then(function(t){return n=t,Qu((t=e.g).b,$u,t.a)}).then(function(){return n})}function yc(t){this.a=t,this.b=Hu()}(t=lc.prototype).ma=function(){return this.Ia||(this.Ia=(sr(void 0)?ar().then(function(){return new fe(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)})}):_e(Error("Cordova must run in an Android or iOS file scheme."))).then(function(){if("function"!=typeof mr("universalLinks.subscribe",l))throw fc("cordova-universal-links-plugin-fix is not installed");if(void 0===mr("BuildInfo.packageName",l))throw fc("cordova-plugin-buildinfo is not installed");if("function"!=typeof mr("cordova.plugins.browsertab.openUrl",l))throw fc("cordova-plugin-browsertab is not installed");if("function"!=typeof mr("cordova.InAppBrowser.open",l))throw fc("cordova-plugin-inappbrowser is not installed")},function(){throw new I("cordova-not-ready")}))},t.Ob=function(t,e){return e(new I("operation-not-supported-in-this-environment")),be()},t.Mb=function(){return _e(new I("operation-not-supported-in-this-environment"))},t.$b=function(){return!1},t.Xb=function(){return!0},t.Tb=function(){return!0},t.Nb=function(t,e,n,r){if(this.c)return _e(new I("redirect-operation-pending"));var i=this,o=l.document,a=null,s=null,u=null,c=null;return this.c=be().then(function(){return Ao(e),vc(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("")}(),a=new Ro(t,r,null,o,new I("no-auth-event"),null,i),s=mr("BuildInfo.packageName",l);if("string"!=typeof s)throw new I("invalid-cordova-configuration");var u=mr("BuildInfo.displayName",l),c={};if(yr().toLowerCase().match(/iphone|ipad|ipod/))c.ibi=s;else{if(!yr().toLowerCase().match(/android/))return _e(new I("operation-not-supported-in-this-environment"));c.apn=s}u&&(c.appDisplayName=u),o=pc(o),c.sessionId=o;var h=uu(n.v,n.i,n.l,t,e,null,r,n.m,c,n.u,i,n.s);return n.ma().then(function(){var t=n.h;return n.C.a.set($u,a.w(),t)}).then(function(){var t=mr("cordova.plugins.browsertab.isAvailable",l);if("function"!=typeof t)throw new I("invalid-cordova-configuration");var e=null;t(function(t){if(t){if("function"!=typeof(e=mr("cordova.plugins.browsertab.openUrl",l)))throw new I("invalid-cordova-configuration");e(h)}else{if("function"!=typeof(e=mr("cordova.InAppBrowser.open",l)))throw new I("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 fe(function(e,t){s=function(){var t=mr("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.Ea(s),u=function(){a=a||gn(2e3).then(function(){t(new I("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 gc(i).then(function(){throw t})})}).oa(function(){u&&o.removeEventListener("resume",u,!1),c&&o.removeEventListener("visibilitychange",c,!1),a&&a.cancel(),s&&i.Sa(s),i.c=null})},t.Ea=function(e){this.b.push(e),vc(this).o(function(t){"auth/invalid-cordova-configuration"===t.code&&(t=new Ro("unknown",null,null,null,new I("no-auth-event")),e(t))})},t.Sa=function(e){H(this.b,function(t){return t==e})};var mc={name:"pendingRedirect",F:"session"};function bc(t){return Qu(t.b,mc,t.a)}function _c(t,e,n,r){this.i={},this.u=0,this.D=t,this.v=e,this.m=n,this.J=r,this.h=[],this.f=!1,this.l=m(this.s,this),this.b=new Lc,this.C=new qc,this.g=new yc(Dc(this.v,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.C,this.c.linkViaPopup=this.C,this.c.reauthViaPopup=this.C,this.a=wc(this.D,this.v,this.m,E,this.J)}function wc(t,e,n,r,i){var o=Xl.SDK_VERSION||null;return new(sr()?lc:iu)(t,e,n,o,r,i)}function Ic(e){e.f||(e.f=!0,e.a.Ea(e.l));var n=e.a;return e.a.ma().o(function(t){throw e.a==n&&e.reset(),t})}function Tc(n){n.a.Xb()&&Ic(n).o(function(t){var e=new Ro("unknown",null,null,null,new I("operation-not-supported-in-this-environment"));Ac(t)&&n.s(e)}),n.a.Tb()||Mc(n.b)}function Ec(n,t){K(n.h,t)||n.h.push(t),n.f||(t=n.g).b.get(mc,t.a).then(function(t){return"pending"==t}).then(function(t){t?bc(n.g).then(function(){Ic(n).o(function(t){var e=new Ro("unknown",null,null,null,new I("operation-not-supported-in-this-environment"));Ac(t)&&n.s(e)})}):Tc(n)}).o(function(){Tc(n)})}function Sc(t,e){H(t.h,function(t){return t==e})}_c.prototype.reset=function(){this.f=!1,this.a.Sa(this.l),this.a=wc(this.D,this.v,this.m,null,this.J),this.i={}},_c.prototype.s=function(t){if(!t)throw new I("invalid-auth-event");if(6e5<=Date.now()-this.u&&(this.i={},this.u=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.Fb(t.c,t.b)){(e=this.c[t.c])&&(e.h(t,r),t&&(t.f||t.b)&&(this.i[t.getUid()]=!0,this.u=Date.now())),e=!0;break}}return Mc(this.b),e};var Cc=new Rr(2e3,1e4),kc=new Rr(3e4,6e4);function Nc(t,e,n,r,i,o,a){return t.a.Mb(e,n,r,function(){t.f||(t.f=!0,t.a.Ea(t.l))},function(){t.reset()},i,o,a)}function Ac(t){return!(!t||"auth/cordova-not-ready"!=t.code)}function Rc(e,t,n,r,i){var o,a;return(a=e.g).b.set(mc,"pending",a.a).then(function(){return e.a.Nb(t,n,r,i).o(function(t){if(Ac(t))throw new I("operation-not-supported-in-this-environment");return o=t,bc(e.g).then(function(){throw o})}).then(function(){return e.a.$b()?new fe(function(){}):bc(e.g).then(function(){return e.qa()}).then(function(){}).o(function(){})})})}function Oc(t,e,n,r,i){return t.a.Ob(r,function(t){e.na(n,null,t,i)},Cc.get())}_c.prototype.qa=function(){return this.b.qa()};var Pc={};function Dc(t,e,n){return t=t+":"+e,t=n?t+":"+n.url:t}function xc(t,e,n,r){var i=Dc(e,n,r);return Pc[i]||(Pc[i]=new _c(t,e,n,r)),Pc[i]}function Lc(){this.b=null,this.f=[],this.c=[],this.a=null,this.i=this.g=!1}function Mc(t){t.g||(t.g=!0,jc(t,!1,null,null))}function Fc(t){t.g&&!t.i&&jc(t,!1,null,null)}function Uc(t,e){if(t.b=function(){return be(e)},t.f.length)for(var n=0;n<t.f.length;n++)t.f[n](e)}function jc(t,e,n,r){e?r?function(t,e){if(t.b=function(){return _e(e)},t.c.length)for(var n=0;n<t.c.length;n++)t.c[n](e)}(t,r):Uc(t,n):Uc(t,{user:null}),t.f=[],t.c=[]}function qc(){}function Vc(){this.ib=!1,Object.defineProperty(this,"appVerificationDisabled",{get:function(){return this.ib},set:function(t){this.ib=t},enumerable:!1})}function Bc(t,e){this.a=e,jr(this,"verificationId",t)}function Kc(t,e,n,r){return new Co(t).fb(e,n).then(function(t){return new Bc(t,r)})}function Wc(t){var e=xi(t);if(!(e&&e.exp&&e.auth_time&&e.iat))throw new I("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");qr(this,{token:t,expirationTime:Dr(1e3*e.exp),authTime:Dr(1e3*e.auth_time),issuedAtTime:Dr(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 Hc(t,e,n){var r=e&&e[zc];if(!r)throw new I("argument-error","Internal assert: Invalid MultiFactorResolver");this.a=t,this.f=ct(e),this.g=n,this.c=new Yi(null,r),this.b=[];var i=this;j(e[Gc]||[],function(t){(t=Wr(t))&&i.b.push(t)}),jr(this,"auth",this.a),jr(this,"session",this.c),jr(this,"hints",this.b)}Lc.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},Lc.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?(jc(this,!0,null,t.a),be()):e.Fa(n,r)?function(e,t,n){n=n.Fa(t.c,t.b);var r=t.g,i=t.f,o=t.i,a=t.T(),s=!!t.c.match(/Redirect$/);n(r,i,a,o).then(function(t){jc(e,s,t,null)}).o(function(t){jc(e,s,null,t)})}(this,t,e):_e(new I("invalid-auth-event")):(jc(this,!1,null,null),be())):_e(new I("invalid-auth-event"))},Lc.prototype.qa=function(){var i=this;return new fe(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 I("timeout"),n.a&&n.a.cancel(),n.a=gn(kc.get()).then(function(){n.b||(n.g=!0,jc(n,!0,null,r))}))})},qc.prototype.h=function(t,e){var n,r,i,o,a;t?(n=t.c,r=t.b,t.a?(e.na(t.c,null,t.a,t.b),be()):e.Fa(n,r)?(i=e,o=(t=t).b,a=t.c,i.Fa(a,o)(t.g,t.f,t.T(),t.i).then(function(t){i.na(a,t,null,o)}).o(function(t){i.na(a,null,t,o)})):_e(new I("invalid-auth-event"))):_e(new I("invalid-auth-event"))},Bc.prototype.confirm=function(t){return t=ko(this.verificationId,t),this.a(t)};var Gc="mfaInfo",zc="mfaPendingCredential";function Qc(t,e,n,r){I.call(this,"multi-factor-auth-required",r,e),this.b=new Hc(t,e,n),jr(this,"resolver",this.b)}function Yc(t,e,n){if(t&&g(t.serverResponse)&&"auth/multi-factor-auth-required"===t.code)try{return new Qc(e,t.serverResponse,n,t.message)}catch(t){}return null}function Xc(){}function Jc(t){jr(this,"factorId",t.fa),this.a=t}function $c(t){if(Jc.call(this,t),this.a.fa!=Co.PROVIDER_ID)throw new I("argument-error","firebase.auth.PhoneMultiFactorAssertion requires a valid firebase.auth.PhoneAuthCredential")}function Zc(t,e){for(var n in qe.call(this,t),e)this[n]=e[n]}function th(t,e){this.a=t,this.b=[],this.c=m(this.yc,this),$e(this.a,"userReloaded",this.c);var r=[];e&&e.multiFactor&&e.multiFactor.enrolledFactors&&j(e.multiFactor.enrolledFactors,function(t){var e=null,n={};if(t){t.uid&&(n[zr]=t.uid),t.displayName&&(n[Hr]=t.displayName),t.enrollmentTime&&(n[Gr]=new Date(t.enrollmentTime).toISOString()),t.phoneNumber&&(n[Qr]=t.phoneNumber);try{e=new Yr(n)}catch(t){}t=e}else t=null;t&&r.push(t)}),eh(this,r)}function eh(t,e){t.b=e,jr(t,"enrolledFactors",e)}function nh(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 rh(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 ih(t){this.f=t,this.b=this.a=null,this.c=Date.now()}function oh(t,e){void 0===e&&(e=t.b?(e=t.b).a-e.g:0),t.c=Date.now()+1e3*e}function ah(t,e){t.b=Di(e[Ba]||""),t.a=e.refreshToken,oh(t,void 0!==(e=e.expiresIn)?Number(e):void 0)}function sh(e,t){return r=e.f,i=t,new fe(function(e,n){"refresh_token"==i.grant_type&&i.refresh_token||"authorization_code"==i.grant_type&&i.code?Ja(r,r.l+"?key="+encodeURIComponent(r.c),function(t){t?t.error?n(Ys(t)):t.access_token&&t.refresh_token?e(t):n(new I("internal-error")):n(new I("network-request-failed"))},"POST",Vn(i).toString(),r.g,r.m.get()):n(new I("internal-error"))}).then(function(t){return e.b=Di(t.access_token),e.a=t.refresh_token,oh(e,t.expires_in),{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 uh(t,e){this.a=t||null,this.b=e||null,qr(this,{lastSignInTime:Dr(e||null),creationTime:Dr(t||null)})}function ch(t,e,n,r,i,o){qr(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}function hh(t,e,n){this.J=[],this.l=t.apiKey,this.m=t.appName,this.s=t.authDomain||null;var r,i=Xl.SDK_VERSION?gr(Xl.SDK_VERSION):null;this.a=new qa(this.l,N(E),i),t.emulatorConfig&&Qa(this.a,t.emulatorConfig),this.b=new ih(this.a),mh(this,e[Ba]),ah(this.b,e),jr(this,"refreshToken",this.b.a),wh(this,n||{}),ln.call(this),this.R=!1,this.s&&_r()&&(this.i=xc(this.s,this.l,this.m)),this.S=[],this.h=null,this.u=(r=this,new nh(function(){return r.I(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var t=r.b.c-Date.now()-3e5;return 0<t?t:0})),this.aa=m(this.hb,this);var o=this;this.ya=null,this.Oa=function(t){o.wa(t.h)},this.ja=null,this.Aa=function(t){Qa(o.a,t.c)},this.X=null,this.$=[],this.Ba=function(t){ph(o,t.f)},this.ba=null,this.O=new th(this,n),jr(this,"multiFactor",this.O)}function lh(t,e){t.ja&&en(t.ja,"languageCodeChanged",t.Oa),(t.ja=e)&&$e(e,"languageCodeChanged",t.Oa)}function fh(t,e){t.X&&en(t.X,"emulatorConfigChanged",t.Aa),(t.X=e)&&$e(e,"emulatorConfigChanged",t.Aa)}function ph(t,e){t.$=e,Xa(t.a,Xl.SDK_VERSION?gr(Xl.SDK_VERSION,t.$):null)}function dh(t,e){t.ba&&en(t.ba,"frameworkChanged",t.Ba),(t.ba=e)&&$e(e,"frameworkChanged",t.Ba)}function vh(e){try{return Xl.app(e.m).auth()}catch(t){throw new I("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+e.m+"'!")}}function gh(t){t.D||t.u.b||(t.u.start(),en(t,"tokenChanged",t.aa),$e(t,"tokenChanged",t.aa))}function yh(t){en(t,"tokenChanged",t.aa),t.u.stop()}function mh(t,e){t.za=e,jr(t,"_lat",e)}function bh(t){for(var e=[],n=0;n<t.S.length;n++)e.push(t.S[n](t));return Ie(e).then(function(){return t})}function _h(t){t.i&&!t.R&&(t.R=!0,Ec(t.i,t))}function wh(t,e){qr(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 uh(e.createdAt,e.lastLoginAt),providerData:[]}),t.a.b=t.tenantId}function Ih(){}function Th(t){return be().then(function(){if(t.D)throw new I("app-deleted")})}function Eh(t){return V(t.providerData,function(t){return t.providerId})}function Sh(t,e){e&&(Ch(t,e.providerId),t.providerData.push(e))}function Ch(t,e){H(t.providerData,function(t){return t.providerId==e})}function kh(t,e,n){("uid"!=e||n)&&t.hasOwnProperty(e)&&jr(t,e,n)}function Nh(e,t){var n,r;e!=t&&(qr(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?jr(e,"metadata",new uh((r=t.metadata).a,r.b)):jr(e,"metadata",new uh),j(t.providerData,function(t){Sh(e,t)}),n=e.b,r=t.b,n.b=r.b,n.a=r.a,n.c=r.c,jr(e,"refreshToken",e.b.a),eh(e.O,t.O.b))}function Ah(i){return i.I().then(function(t){var e,n,r=i.isAnonymous;return n=t,zs((e=i).a,Es,{idToken:n}).then(m(e.Kc,e)).then(function(){return r||kh(i,"isAnonymous",!1),t})})}function Rh(t,e){e[Ba]&&t.za!=e[Ba]&&(ah(t.b,e),t.dispatchEvent(new Zc("tokenChanged")),mh(t,e[Ba]),kh(t,"refreshToken",t.b.a))}function Oh(t,e){return Ah(t).then(function(){if(K(Eh(t),e))return bh(t).then(function(){throw new I("provider-already-linked")})})}function Ph(t,e,n){return Vr({user:t,credential:No(e),additionalUserInfo:e=ji(e),operationType:n})}function Dh(t,e){return Rh(t,e),t.reload().then(function(){return t})}function xh(n,r,t,e,i){if(!_r())return _e(new I("operation-not-supported-in-this-environment"));if(n.h&&!i)return _e(n.h);var o=Ui(t.providerId),a=kr(n.uid+":::"),s=null,u=rr(s=(!Tr()||ur())&&n.s&&t.isOAuthProvider?uu(n.s,n.l,n.m,r,t,null,a,Xl.SDK_VERSION||null,null,null,n.tenantId):s,o&&o.ua,o&&o.ta);return e=e().then(function(){if(Mh(n),!i)return n.I().then(function(){})}).then(function(){return Nc(n.i,u,r,t,a,!!s,n.tenantId)}).then(function(){return new fe(function(t,e){n.na(r,null,new I("cancelled-popup-request"),n.g||null),n.f=t,n.C=e,n.g=a,n.c=Oc(n.i,n,r,u,a)})}).then(function(t){return u&&nr(u),t?Vr(t):null}).o(function(t){throw u&&nr(u),t}),Fh(n,e,i)}function Lh(e,t,n,r,i){if(!_r())return _e(new I("operation-not-supported-in-this-environment"));if(e.h&&!i)return _e(e.h);var o=null,a=kr(e.uid+":::");return r=r().then(function(){if(Mh(e),!i)return e.I().then(function(){})}).then(function(){return e.ga=a,bh(e)}).then(function(t){return t=e.ha?(t=e.ha).b.set(qh,e.w(),t.a):t}).then(function(){return Rc(e.i,t,n,a,e.tenantId)}).o(function(t){if(o=t,e.ha)return Vh(e.ha);throw o}).then(function(){if(o)throw o}),Fh(e,r,i)}function Mh(t){if(!t.i||!t.R){if(t.i&&!t.R)throw new I("internal-error");throw new I("auth-domain-config-required")}}function Fh(n,t,e){var r,i=(t=t,e=e,(r=n).h&&!e?(t.cancel(),_e(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.J.push(i),i.oa(function(){W(n.J,i)}),i.o(function(t){var e=null;throw(e=t&&"auth/multi-factor-auth-required"===t.code?Yc(t.w(),vh(n),m(n.jc,n)):e)||t})}function Uh(t){if(!t.apiKey)return null;var e={apiKey:t.apiKey,authDomain:t.authDomain,appName:t.appName,emulatorConfig:t.emulatorConfig},n={};if(!t.stsTokenManager||!t.stsTokenManager.accessToken)return null;n[Ba]=t.stsTokenManager.accessToken,n.refreshToken=t.stsTokenManager.refreshToken||null;var r=t.stsTokenManager.expirationTime;r&&(n.expiresIn=(r-Date.now())/1e3);var i=new hh(e,n,t);return t.providerData&&j(t.providerData,function(t){t&&Sh(i,Vr(t))}),t.redirectEventId&&(i.ga=t.redirectEventId),i}function jh(t){this.a=t,this.b=Hu()}Hc.prototype.Rc=function(t){var n=this;return t.sb(this.a.a,this.c).then(function(t){var e=ct(n.f);return delete e[Gc],delete e[zc],lt(e,t),n.g(e)})},_(Qc,I),Xc.prototype.sb=function(t,e,n){return e.type==Xi?(o=this,a=t,s=n,e.Ha().then(function(t){return t={idToken:t},void 0!==s&&(t.displayName=s),lt(t,{phoneVerificationInfo:So(o.a)}),zs(a,Is,t)})):(r=this,i=t,e.Ha().then(function(t){return lt(t={mfaPendingCredential:t},{phoneVerificationInfo:So(r.a)}),zs(i,Ts,t)}));var r,i,o,a,s},_(Jc,Xc),_($c,Jc),_(Zc,qe),(t=th.prototype).yc=function(t){var e;eh(this,(t=t.hd,e=[],j(t.mfaInfo||[],function(t){(t=Wr(t))&&e.push(t)}),e))},t.Rb=function(){return this.a.I().then(function(t){return new Yi(t,null)})},t.fc=function(e,n){var r=this,i=this.a.a;return this.Rb().then(function(t){return e.sb(i,t,n)}).then(function(t){return Rh(r.a,t),r.a.reload()})},t.bd=function(t){var n=this,r="string"==typeof t?t:t.uid,e=this.a.a;return this.a.I().then(function(t){return zs(e,Gs,{idToken:t,mfaEnrollmentId:r})}).then(function(t){var e=q(n.b,function(t){return t.uid!=r});return eh(n,e),Rh(n.a,t),n.a.reload().o(function(t){if("auth/user-token-expired"!=t.code)throw t})})},t.w=function(){return{multiFactor:{enrolledFactors:V(this.b,function(t){return t.w()})}}},nh.prototype.start=function(){this.a=this.c,function e(n,t){n.stop();n.b=gn(rh(n,t)).then(Pr).then(function(){return n.h()}).then(function(){e(n,!0)}).o(function(t){n.i(t)&&e(n,!1)})}(this,!0)},nh.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},ih.prototype.w=function(){return{apiKey:this.f.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:this.c}},ih.prototype.getToken=function(t){return t=!!t,this.b&&!this.a?_e(new I("user-token-expired")):t||!this.b||Date.now()>this.c-3e4?this.a?sh(this,{grant_type:"refresh_token",refresh_token:this.a}):be(null):be({accessToken:this.b.toString(),refreshToken:this.a})},uh.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}},_(hh,ln),hh.prototype.wa=function(t){this.ya=t,za(this.a,t)},hh.prototype.la=function(){return this.ya},hh.prototype.Ga=function(){return z(this.$)},hh.prototype.hb=function(){this.u.b&&(this.u.stop(),this.u.start())},jr(hh.prototype,"providerId","firebase"),(t=hh.prototype).reload=function(){var t=this;return Fh(this,Th(this).then(function(){return Ah(t).then(function(){return bh(t)}).then(Ih)}))},t.oc=function(t){return this.I(t).then(function(t){return new Wc(t)})},t.I=function(t){var e=this;return Fh(this,Th(this).then(function(){return e.b.getToken(t)}).then(function(t){if(!t)throw new I("internal-error");return t.accessToken!=e.za&&(mh(e,t.accessToken),e.dispatchEvent(new Zc("tokenChanged"))),kh(e,"refreshToken",t.refreshToken),t.accessToken}))},t.Kc=function(t){if(!(t=t.users)||!t.length)throw new I("internal-error");wh(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 ch(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[],r=0;r<n.length;r++)Sh(this,n[r]);kh(this,"isAnonymous",!(this.email&&t.passwordHash||this.providerData&&this.providerData.length)),this.dispatchEvent(new Zc("userReloaded",{hd:t}))},t.Lc=function(t){return Fr("firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.reauthenticateWithCredential instead."),this.tb(t)},t.tb=function(t){var e=this,n=null;return Fh(this,t.c(this.a,this.uid).then(function(t){return Rh(e,t),n=Ph(e,t,"reauthenticate"),e.h=null,e.reload()}).then(function(){return n}),!0)},t.Cc=function(t){return Fr("firebase.User.prototype.linkAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.linkWithCredential instead."),this.qb(t)},t.qb=function(e){var n=this,r=null;return Fh(this,Oh(this,e.providerId).then(function(){return n.I()}).then(function(t){return e.b(n.a,t)}).then(function(t){return r=Ph(n,t,"link"),Dh(n,t)}).then(function(){return r}))},t.Dc=function(t,e){var n=this;return Fh(this,Oh(this,"phone").then(function(){return Kc(vh(n),t,e,m(n.qb,n))}))},t.Mc=function(t,e){var n=this;return Fh(this,be().then(function(){return Kc(vh(n),t,e,m(n.tb,n))}),!0)},t.Bb=function(e){var n=this;return Fh(this,this.I().then(function(t){return n.a.Bb(t,e)}).then(function(t){return Rh(n,t),n.reload()}))},t.ed=function(e){var n=this;return Fh(this,this.I().then(function(t){return e.b(n.a,t)}).then(function(t){return Rh(n,t),n.reload()}))},t.Cb=function(e){var n=this;return Fh(this,this.I().then(function(t){return n.a.Cb(t,e)}).then(function(t){return Rh(n,t),n.reload()}))},t.Db=function(e){if(void 0===e.displayName&&void 0===e.photoURL)return Th(this);var n=this;return Fh(this,this.I().then(function(t){return n.a.Db(t,{displayName:e.displayName,photoUrl:e.photoURL})}).then(function(t){return Rh(n,t),kh(n,"displayName",t.displayName||null),kh(n,"photoURL",t.photoUrl||null),j(n.providerData,function(t){"password"===t.providerId&&(jr(t,"displayName",n.displayName),jr(t,"photoURL",n.photoURL))}),bh(n)}).then(Ih))},t.cd=function(e){var n=this;return Fh(this,Ah(this).then(function(t){return K(Eh(n),e)?zs(n.a,bs,{idToken:t,deleteProvider:[e]}).then(function(t){var e={};return j(t.providerUserInfo||[],function(t){e[t.providerId]=!0}),j(Eh(n),function(t){e[t]||Ch(n,t)}),e[Co.PROVIDER_ID]||jr(n,"phoneNumber",null),bh(n)}):bh(n).then(function(){throw new I("no-such-provider")})}))},t.delete=function(){var e=this;return Fh(this,this.I().then(function(t){return zs(e.a,ms,{idToken:t})}).then(function(){e.dispatchEvent(new Zc("userDeleted"))})).then(function(){for(var t=0;t<e.J.length;t++)e.J[t].cancel("app-deleted");lh(e,null),fh(e,null),dh(e,null),e.J=[],e.D=!0,yh(e),jr(e,"refreshToken",null),e.i&&Sc(e.i,e)})},t.Fb=function(t,e){return!!("linkViaPopup"==t&&(this.g||null)==e&&this.f||"reauthViaPopup"==t&&(this.g||null)==e&&this.f||"linkViaRedirect"==t&&(this.ga||null)==e||"reauthViaRedirect"==t&&(this.ga||null)==e)},t.na=function(t,e,n,r){"linkViaPopup"!=t&&"reauthViaPopup"!=t||r!=(this.g||null)||(n&&this.C?this.C(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.C)},t.Fa=function(t,e){return"linkViaPopup"==t&&e==(this.g||null)?m(this.Kb,this):"reauthViaPopup"==t&&e==(this.g||null)?m(this.Lb,this):"linkViaRedirect"==t&&(this.ga||null)==e?m(this.Kb,this):"reauthViaRedirect"==t&&(this.ga||null)==e?m(this.Lb,this):null},t.Ec=function(t){var e=this;return xh(this,"linkViaPopup",t,function(){return Oh(e,t.providerId).then(function(){return bh(e)})},!1)},t.Nc=function(t){return xh(this,"reauthViaPopup",t,function(){return be()},!0)},t.Fc=function(t){var e=this;return Lh(this,"linkViaRedirect",t,function(){return Oh(e,t.providerId)},!1)},t.Oc=function(t){return Lh(this,"reauthViaRedirect",t,function(){return be()},!0)},t.Kb=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 ls(i.a,{requestUri:e,postBody:r,sessionId:n,idToken:t})}).then(function(t){return o=Ph(i,t,"link"),Dh(i,t)}).then(function(){return o}),Fh(this,t)},t.Lb=function(t,e,n,r){var i=this;this.c&&(this.c.cancel(),this.c=null);var o=null;return Fh(this,be().then(function(){return Zi(fs(i.a,{requestUri:t,sessionId:e,postBody:r,tenantId:n}),i.uid)}).then(function(t){return o=Ph(i,t,"reauthenticate"),Rh(i,t),i.h=null,i.reload()}).then(function(){return o}),!0)},t.ub=function(e){var n=this,r=null;return Fh(this,this.I().then(function(t){return r=t,void 0===e||ut(e)?{}:Ai(new bi(e))}).then(function(t){return n.a.ub(r,t)}).then(function(t){if(n.email!=t)return n.reload()}).then(function(){}))},t.Eb=function(e,n){var r=this,i=null;return Fh(this,this.I().then(function(t){return i=t,void 0===n||ut(n)?{}:Ai(new bi(n))}).then(function(t){return r.a.Eb(i,e,t)}).then(function(t){if(r.email!=t)return r.reload()}).then(function(){}))},t.jc=function(t){var e=null,n=this;return Fh(this,t=Zi(be(t),n.uid).then(function(t){return e=Ph(n,t,"reauthenticate"),Rh(n,t),n.h=null,n.reload()}).then(function(){return e}),!0)},t.toJSON=function(){return this.w()},t.w=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.w(),redirectEventId:this.ga||null};return this.metadata&&lt(e,this.metadata.w()),j(this.providerData,function(t){e.providerData.push(function(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}(t))}),lt(e,this.O.w()),e};var qh={name:"redirectUser",F:"session"};function Vh(t){return Qu(t.b,qh,t.a)}function Bh(t){var e,n,r,i;this.a=t,this.b=Hu(),this.c=null,this.f=(n=Hh("local"),r=Hh("session"),i=Hh("none"),function(n,r,i){var o=zu(r,i),a=Gu(n,r.F);return n.get(r,i).then(function(t){var e=null;try{e=Cr(l.localStorage.getItem(o))}catch(t){}if(e&&!t)return l.localStorage.removeItem(o),n.set(r,e,i);e&&t&&"localStorage"!=a.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(Wh,e.a).then(function(t){return t?Hh(t):n})})})}).then(function(t){return e.c=t,Kh(e,t.F)}).o(function(){e.c||(e.c=n)})),this.b.addListener(Hh("local"),this.a,m(this.g,this))}function Kh(t,e){var n,s,r=[];for(n in Ku)Ku[n]!==e&&r.push(Qu(t.b,Hh(Ku[n]),t.a));return r.push(Qu(t.b,Wh,t.a)),s=r,new fe(function(n,e){var r=s.length,i=[];if(r)for(var t=function(t,e){r--,i[t]=e,0==r&&n(i)},o=function(t){e(t)},a=0;a<s.length;a++)we(s[a],b(t,a),o);else n(i)})}Bh.prototype.g=function(){var e=this,n=Hh("local");Yh(this,function(){return be().then(function(){return e.c&&"local"!=e.c.F?e.b.get(n,e.a):null}).then(function(t){if(t)return Kh(e,"local").then(function(){e.c=n})})})};var Wh={name:"persistence",F:"session"};function Hh(t){return{name:"authUser",F:t}}function Gh(t,e){return Yh(t,function(){return t.b.set(t.c,e.w(),t.a)})}function zh(t){return Yh(t,function(){return Qu(t.b,t.c,t.a)})}function Qh(t,e,n){return Yh(t,function(){return t.b.get(t.c,t.a).then(function(t){return t&&e&&(t.authDomain=e),t&&n&&(t.emulatorConfig=n),Uh(t||{})})})}function Yh(t,e){return t.f=t.f.then(e,e),t.f}function Xh(t){if(this.l=!1,jr(this,"settings",new Vc),jr(this,"app",t),!this.app.options||!this.app.options.apiKey)throw new I("invalid-api-key");var n,e,r,i,o,a;t=Xl.SDK_VERSION?gr(Xl.SDK_VERSION):null,this.a=new qa(this.app.options&&this.app.options.apiKey,N(E),t),this.R=[],this.s=[],this.O=[],this.hb=Xl.INTERNAL.createSubscribe(m(this.zc,this)),this.X=void 0,this.bc=Xl.INTERNAL.createSubscribe(m(this.Ac,this)),rl(this,null),this.i=new Bh(this.app.options.apiKey+":"+this.app.name),this.D=new jh(this.app.options.apiKey+":"+this.app.name),this.$=ul(this,(e=(n=this).app.options.authDomain,t=function(e){var t=function(t,e){return t.b.get(qh,t.a).then(function(t){return t&&e&&(t.authDomain=e),Uh(t||{})})}(e.D,e.app.options.authDomain).then(function(t){return(e.m=t)&&(t.ha=e.D),Vh(e.D)});return ul(e,t)}(n).then(function(){return Qh(n.i,e,n.P)}).then(function(e){return e?(e.ha=n.D,n.m&&(n.m.ga||null)==(e.ga||null)?e:e.reload().then(function(){return Gh(n.i,e).then(function(){return e})}).o(function(t){return"auth/network-request-failed"==t.code?e:zh(n.i)})):null}).then(function(t){rl(n,t||null)}),ul(n,t))),this.h=ul(this,(r=this).$.then(function(){return el(r)}).o(function(){}).then(function(){if(!r.l)return r.ja()}).o(function(){}).then(function(){var t;r.l||(r.ba=!0,(t=r.i).b.addListener(Hh("local"),t.a,r.ja))})),this.ba=!1,this.ja=m(this.Zc,this),this.Ba=m(this.da,this),this.ya=m(this.mc,this),this.za=m(this.wc,this),this.Aa=m(this.xc,this),this.b=null,o=(i=this).app.options.authDomain,a=i.app.options.apiKey,o&&_r()&&(i.Oa=i.$.then(function(){var t;if(!i.l)return i.b=xc(o,a,i.app.name,i.P),Ec(i.b,i),ol(i)&&_h(ol(i)),i.m&&(_h(i.m),(t=i.m).wa(i.la()),lh(t,i),ph(t=i.m,i.J),dh(t,i),Qa((t=i.m).a,i.P),fh(t,i),i.m=null),i.b})),this.INTERNAL={},this.INTERNAL.delete=m(this.delete,this),this.INTERNAL.logFramework=m(this.Gc,this),this.u=0,ln.call(this),t=this,Object.defineProperty(t,"lc",{get:function(){return this.la()},set:function(t){this.wa(t)},enumerable:!1}),t.aa=null,Object.defineProperty(t,"ti",{get:function(){return this.T()},set:function(t){this.yb(t)},enumerable:!1}),t.S=null,Object.defineProperty(t,"emulatorConfig",{get:function(){var t;return t=this.P?Vr({protocol:(t=An(this.P.url)).c,host:t.a,port:t.g,options:Vr({disableWarnings:this.P.ec})}):null},enumerable:!1}),this.J=[],this.P=null}function Jh(t){qe.call(this,"languageCodeChanged"),this.h=t}function $h(t){qe.call(this,"emulatorConfigChanged"),this.c=t}function Zh(t){qe.call(this,"frameworkChanged"),this.f=t}function tl(t){return t.Oa||_e(new I("auth-domain-config-required"))}function el(t){if(!_r())return _e(new I("operation-not-supported-in-this-environment"));var e=tl(t).then(function(){return t.b.qa()}).then(function(t){return t?Vr(t):null});return ul(t,e)}function nl(o,a){var s={};return s.apiKey=o.app.options.apiKey,s.authDomain=o.app.options.authDomain,s.appName=o.app.name,o.P&&(s.emulatorConfig=o.P),o.$.then(function(){return t=s,e=a,n=o.D,r=o.Ga(),i=new hh(t,e),n&&(i.ha=n),r&&ph(i,r),i.reload().then(function(){return i});var t,e,n,r,i}).then(function(t){return ol(o)&&t.uid==ol(o).uid?Nh(ol(o),t):(rl(o,t),_h(t)),o.da(t)}).then(function(){sl(o)})}function rl(t,e){var n,r;ol(t)&&(n=ol(t),r=t.Ba,H(n.S,function(t){return t==r}),en(ol(t),"tokenChanged",t.ya),en(ol(t),"userDeleted",t.za),en(ol(t),"userInvalidated",t.Aa),yh(ol(t))),e&&(e.S.push(t.Ba),$e(e,"tokenChanged",t.ya),$e(e,"userDeleted",t.za),$e(e,"userInvalidated",t.Aa),0<t.u&&gh(e)),jr(t,"currentUser",e),e&&(e.wa(t.la()),lh(e,t),ph(e,t.J),dh(e,t),Qa(e.a,t.P),fh(e,t))}function il(n,t){var e=null,r=null;return ul(n,t.then(function(t){return e=No(t),r=ji(t),nl(n,t)},function(t){var e=null;throw(e=t&&"auth/multi-factor-auth-required"===t.code?Yc(t.w(),n,m(n.kc,n)):e)||t}).then(function(){return Vr({user:ol(n),credential:e,additionalUserInfo:r,operationType:"signIn"})}))}function ol(t){return t.currentUser}function al(t){return ol(t)&&ol(t)._lat||null}function sl(t){if(t.ba){for(var e=0;e<t.s.length;e++)t.s[e]&&t.s[e](al(t));if(t.X!==t.getUid()&&t.O.length)for(t.X=t.getUid(),e=0;e<t.O.length;e++)t.O[e]&&t.O[e](al(t))}}function ul(t,e){return t.R.push(e),e.oa(function(){W(t.R,e)}),e}function cl(){}function hl(){this.a={},this.b=1e12}Bh.prototype.xb=function(e){var n=null,r=this;return function(t){var e=new I("invalid-persistence-type"),n=new I("unsupported-persistence-type");t:{for(r in Ku)if(Ku[r]==t){var r=!0;break t}r=!1}if(!r||"string"!=typeof t)throw e;switch(hr()){case"ReactNative":if("session"===t)throw n;break;case"Node":if("none"!==t)throw n;break;case"Worker":if("session"===t||!Iu()&&"none"!==t)throw n;break;default:if(!br()&&"none"!==t)throw n}}(e),Yh(this,function(){return e!=r.c.F?r.b.get(r.c,r.a).then(function(t){return n=t,Kh(r,e)}).then(function(){if(r.c=Hh(e),n)return r.b.set(r.c,n,r.a)}):be()})},_(Xh,ln),_(Jh,qe),_($h,qe),_(Zh,qe),(t=Xh.prototype).xb=function(t){return t=this.i.xb(t),ul(this,t)},t.wa=function(t){this.aa===t||this.l||(this.aa=t,za(this.a,this.aa),this.dispatchEvent(new Jh(this.la())))},t.la=function(){return this.aa},t.fd=function(){var t=l.navigator;this.wa(t&&(t.languages&&t.languages[0]||t.language||t.userLanguage)||null)},t.gd=function(t,e){if(!this.P){if(!/^https?:\/\//.test(t))throw new I("argument-error","Emulator URL must start with a valid scheme (http:// or https://).");e=!!e&&!!e.disableWarnings,n=e,"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials."),l.document&&!n&&ar().then(function(){var t=l.document.createElement("div");t.innerText="Running in emulator mode. Do not use with production credentials.",t.style.position="fixed",t.style.width="100%",t.style.backgroundColor="#ffffff",t.style.border=".1em solid #000000",t.style.color="#ff0000",t.style.bottom="0px",t.style.left="0px",t.style.margin="0px",t.style.zIndex=1e4,t.style.textAlign="center",t.classList.add("firebase-emulator-warning"),l.document.body.appendChild(t)}),this.P={url:t,ec:e},this.settings.ib=!0,Qa(this.a,this.P),this.dispatchEvent(new $h(this.P))}var n},t.Gc=function(t){this.J.push(t),Xa(this.a,Xl.SDK_VERSION?gr(Xl.SDK_VERSION,this.J):null),this.dispatchEvent(new Zh(this.J))},t.Ga=function(){return z(this.J)},t.yb=function(t){this.S===t||this.l||(this.S=t,this.a.b=this.S)},t.T=function(){return this.S},t.toJSON=function(){return{apiKey:this.app.options.apiKey,authDomain:this.app.options.authDomain,appName:this.app.name,currentUser:ol(this)&&ol(this).w()}},t.Fb=function(t,e){switch(t){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==e&&!!this.f;default:return!1}},t.na=function(t,e,n,r){"signInViaPopup"==t&&this.g==r&&(n&&this.C?this.C(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.C)},t.Fa=function(t,e){return"signInViaRedirect"==t||"signInViaPopup"==t&&this.g==e&&this.f?m(this.ic,this):null},t.ic=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.$.then(function(){return il(i,hs(i.a,o))})},t.Xc=function(e){if(!_r())return _e(new I("operation-not-supported-in-this-environment"));var n=this,t=Ui(e.providerId),r=kr(),i=null,o=rr(i=(!Tr()||ur())&&this.app.options.authDomain&&e.isOAuthProvider?uu(this.app.options.authDomain,this.app.options.apiKey,this.app.name,"signInViaPopup",e,null,r,Xl.SDK_VERSION||null,null,null,this.T(),this.P):i,t&&t.ua,t&&t.ta);return ul(this,t=tl(this).then(function(t){return Nc(t,o,"signInViaPopup",e,r,!!i,n.T())}).then(function(){return new fe(function(t,e){n.na("signInViaPopup",null,new I("cancelled-popup-request"),n.g),n.f=t,n.C=e,n.g=r,n.c=Oc(n.b,n,"signInViaPopup",o,r)})}).then(function(t){return o&&nr(o),t?Vr(t):null}).o(function(t){throw o&&nr(o),t}))},t.Yc=function(t){if(!_r())return _e(new I("operation-not-supported-in-this-environment"));var e=this;return ul(this,tl(this).then(function(){return Yh(t=e.i,function(){return t.b.set(Wh,t.c.F,t.a)});var t}).then(function(){return Rc(e.b,"signInViaRedirect",t,void 0,e.T())}))},t.qa=function(){var e=this;return el(this).then(function(t){return e.b&&Fc(e.b.b),t}).o(function(t){throw e.b&&Fc(e.b.b),t})},t.dd=function(t){if(!t)return _e(new I("null-user"));if(this.S!=t.tenantId)return _e(new I("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,a,s,u=(r=t,i=n,o=e.D,a=e.Ga(),s=r.b,(n={})[Ba]=s.b&&s.b.toString(),n.refreshToken=s.a,i=new hh(i||{apiKey:r.l,authDomain:r.s,appName:r.m},n),o&&(i.ha=o),a&&ph(i,a),Nh(i,r),i);return ul(this,this.h.then(function(){if(e.app.options.apiKey!=t.l)return u.reload()}).then(function(){return ol(e)&&t.uid==ol(e).uid?(Nh(ol(e),t),e.da(t)):(rl(e,u),_h(u),e.da(u))}).then(function(){sl(e)}))},t.Ab=function(){var t=this,e=this.h.then(function(){return t.b&&Fc(t.b.b),ol(t)?(rl(t,null),zh(t.i).then(function(){sl(t)})):be()});return ul(this,e)},t.Zc=function(){var r=this;return Qh(this.i,this.app.options.authDomain).then(function(t){if(!r.l){var e,n;if((e=ol(r)&&t)&&(e=ol(r).uid,n=t.uid,e=null!=e&&""!==e&&null!=n&&""!==n&&e==n),e)return Nh(ol(r),t),ol(r).I();(ol(r)||t)&&(rl(r,t),t&&(_h(t),t.ha=r.D),r.b&&Ec(r.b,r),sl(r))}})},t.da=function(t){return Gh(this.i,t)},t.mc=function(){sl(this),this.da(ol(this))},t.wc=function(){this.Ab()},t.xc=function(){this.Ab()},t.kc=function(t){var e=this;return this.h.then(function(){return il(e,be(t))})},t.zc=function(t){var e=this;this.addAuthTokenListener(function(){t.next(ol(e))})},t.Ac=function(t){var e,n,r=this;n=function(){t.next(ol(r))},(e=this).O.push(n),ul(e,e.h.then(function(){!e.l&&K(e.O,n)&&e.X!==e.getUid()&&(e.X=e.getUid(),n(al(e)))}))},t.Ic=function(t,e,n){var r=this;return this.ba&&Promise.resolve().then(function(){"function"==typeof t?t(ol(r)):"function"==typeof t.next&&t.next(ol(r))}),this.hb(t,e,n)},t.Hc=function(t,e,n){var r=this;return this.ba&&Promise.resolve().then(function(){r.X=r.getUid(),"function"==typeof t?t(ol(r)):"function"==typeof t.next&&t.next(ol(r))}),this.bc(t,e,n)},t.nc=function(t){var e=this,n=this.h.then(function(){return ol(e)?ol(e).I(t).then(function(t){return{accessToken:t}}):null});return ul(this,n)},t.Tc=function(t){var n=this;return this.h.then(function(){return il(n,zs(n.a,Vs,{token:t}))}).then(function(t){var e=t.user;return kh(e,"isAnonymous",!1),n.da(e),t})},t.Uc=function(t,e){var n=this;return this.h.then(function(){return il(n,zs(n.a,Bs,{email:t,password:e}))})},t.dc=function(t,e){var n=this;return this.h.then(function(){return il(n,zs(n.a,gs,{email:t,password:e}))})},t.$a=function(t){var e=this;return this.h.then(function(){return il(e,t.ka(e.a))})},t.Sc=function(t){return Fr("firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential is deprecated. Please use firebase.auth.Auth.prototype.signInWithCredential instead."),this.$a(t)},t.zb=function(){var n=this;return this.h.then(function(){var t=ol(n);if(t&&t.isAnonymous){var e=Vr({providerId:null,isNewUser:!1});return Vr({user:t,credential:null,additionalUserInfo:e,operationType:"signIn"})}return il(n,n.a.zb()).then(function(t){var e=t.user;return kh(e,"isAnonymous",!0),n.da(e),t})})},t.getUid=function(){return ol(this)&&ol(this).uid||null},t.cc=function(t){this.addAuthTokenListener(t),this.u++,0<this.u&&ol(this)&&gh(ol(this))},t.Pc=function(e){var n=this;j(this.s,function(t){t==e&&n.u--}),this.u<0&&(this.u=0),0==this.u&&ol(this)&&yh(ol(this)),this.removeAuthTokenListener(e)},t.addAuthTokenListener=function(t){var e=this;this.s.push(t),ul(this,this.h.then(function(){e.l||K(e.s,t)&&t(al(e))}))},t.removeAuthTokenListener=function(e){H(this.s,function(t){return t==e})},t.delete=function(){this.l=!0;for(var t=0;t<this.R.length;t++)this.R[t].cancel("app-deleted");return this.R=[],this.i&&(t=this.i).b.removeListener(Hh("local"),t.a,this.ja),this.b&&(Sc(this.b,this),Fc(this.b.b)),Promise.resolve()},t.hc=function(t){return ul(this,zs(this.a,ys,{identifier:t,continueUri:wr()?Zn():"http://localhost"}).then(function(t){return t.signinMethods||[]}))},t.Bc=function(t){return!!Io(t)},t.wb=function(e,n){var r=this;return ul(this,be().then(function(){var t=new bi(n);if(!t.c)throw new I("argument-error",Ii+" must be true when sending sign in link to email");return Ai(t)}).then(function(t){return r.a.wb(e,t)}).then(function(){}))},t.jd=function(t){return this.Ra(t).then(function(t){return t.data.email})},t.nb=function(t,e){return ul(this,this.a.nb(t,e).then(function(){}))},t.Ra=function(t){return ul(this,this.a.Ra(t).then(function(t){return new Xr(t)}))},t.jb=function(t){return ul(this,this.a.jb(t).then(function(){}))},t.vb=function(e,t){var n=this;return ul(this,be().then(function(){return void 0===t||ut(t)?{}:Ai(new bi(t))}).then(function(t){return n.a.vb(e,t)}).then(function(){}))},t.Wc=function(t,e){return ul(this,Kc(this,t,e,m(this.$a,this)))},t.Vc=function(n,r){var i=this;return ul(this,be().then(function(){var t=r||Zn(),e=wo(n,t);if(!(t=Io(t)))throw new I("argument-error","Invalid email link!");if(t.tenantId!==i.T())throw new I("tenant-id-mismatch");return i.$a(e)}))},cl.prototype.render=function(){},cl.prototype.reset=function(){},cl.prototype.getResponse=function(){},cl.prototype.execute=function(){};var ll=null;function fl(t,e){return(e=pl(e))&&t.a[e]||null}function pl(t){return(t=void 0===t?1e12:t)?t.toString():null}function dl(t,e){this.g=!1,this.c=e,this.a=this.b=null,this.h="invisible"!==this.c.size,this.f=te(t);var n=this;this.i=function(){n.execute()},this.h?this.execute():$e(this.f,"click",this.i)}function vl(t){if(t.g)throw Error("reCAPTCHA mock was already deleted!")}function gl(){}function yl(){}hl.prototype.render=function(t,e){return this.a[this.b.toString()]=new dl(t,e),this.b++},hl.prototype.reset=function(t){var e=fl(this,t);t=pl(t),e&&t&&(e.delete(),delete this.a[t])},hl.prototype.getResponse=function(t){return(t=fl(this,t))?t.getResponse():null},hl.prototype.execute=function(t){(t=fl(this,t))&&t.execute()},dl.prototype.getResponse=function(){return vl(this),this.b},dl.prototype.execute=function(){vl(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))},dl.prototype.delete=function(){vl(this),this.g=!0,clearTimeout(this.a),this.a=null,en(this.f,"click",this.i)},jr(gl,"FACTOR_ID","phone"),yl.prototype.g=function(){return be(ll=ll||new hl)},yl.prototype.c=function(){};var ml=null;function bl(){this.b=l.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var _l=new pt(yt,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),wl=new Rr(3e4,6e4);bl.prototype.g=function(i){var o=this;return new fe(function(t,e){var r=setTimeout(function(){e(new I("network-request-failed"))},wl.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 I("internal-error"))),delete l[o.a]},be(Da(wt(_l,{onload:o.a,hl:i||""}))).o(function(){clearTimeout(r),e(new I("internal-error","Unable to load external reCAPTCHA dependencies!"))})):(clearTimeout(r),t(l.grecaptcha))})},bl.prototype.c=function(){this.b--};var Il=null;function Tl(t,e,n,r,i,o,a){if(jr(this,"type","recaptcha"),this.c=this.f=null,this.D=!1,this.v=e,this.g=null,a=a?ml=ml||new yl:Il=Il||new bl,this.m=a,this.a=n||{theme:"light",type:"image"},this.h=[],this.a[Cl])throw new I("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i="invisible"===this.a[kl],!l.document)throw new I("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!te(e)||!this.i&&te(e).hasChildNodes())throw new I("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.s=new qa(t,o||null,i||null),this.u=r||function(){return null};var s=this;this.l=[];var u=this.a[El];this.a[El]=function(t){var e;Nl(s,t),"function"==typeof u?u(t):"string"!=typeof u||"function"==typeof(e=mr(u,l))&&e(t)};var c=this.a[Sl];this.a[Sl]=function(){var t;Nl(s,null),"function"==typeof c?c():"string"!=typeof c||"function"==typeof(t=mr(c,l))&&t()}}var El="callback",Sl="expired-callback",Cl="sitekey",kl="size";function Nl(t,e){for(var n=0;n<t.l.length;n++)try{t.l[n](e)}catch(t){}}function Al(t,e){return t.h.push(e),e.oa(function(){W(t.h,e)}),e}function Rl(t){if(t.D)throw new I("internal-error","RecaptchaVerifier instance has been destroyed.")}function Ol(t,e,n){var r=!1;try{this.b=n||Xl.app()}catch(t){throw new I("argument-error","No firebase.app.App instance is currently initialized.")}if(!this.b.options||!this.b.options.apiKey)throw new I("invalid-api-key");n=this.b.options.apiKey;var i=this,o=null;try{o=this.b.auth().Ga()}catch(t){}try{r=this.b.auth().settings.appVerificationDisabledForTesting}catch(t){}o=Xl.SDK_VERSION?gr(Xl.SDK_VERSION,o):null,Tl.call(this,n,t,e,function(){try{var e=i.b.auth().la()}catch(t){e=null}return e},o,N(E),r)}function Pl(t,e,n,r){t:{n=Array.prototype.slice.call(n);for(var i=0,o=!1,a=0;a<e.length;a++)if(e[a].optional)o=!0;else{if(o)throw new I("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].M(n[i])&&!o){if(e=e[i],i<0||i>=Dl.length)throw new I("internal-error","Argument validator received an unsupported number of arguments.");n=Dl[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.K+".";break t}r=null}}if(r)throw new I("argument-error",t+" failed: "+r)}(t=Tl.prototype).Ia=function(){var e=this;return this.f||(this.f=Al(this,be().then(function(){if(wr()&&!cr())return ar();throw new I("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return e.m.g(e.u())}).then(function(t){return e.g=t,zs(e.s,Rs,{})}).then(function(t){e.a[Cl]=t.recaptchaSiteKey}).o(function(t){throw e.f=null,t})))},t.render=function(){Rl(this);var n=this;return Al(this,this.Ia().then(function(){var t,e;return null===n.c&&(e=n.v,n.i||(t=te(e),e=oe("DIV"),t.appendChild(e)),n.c=n.g.render(e,n.a)),n.c}))},t.verify=function(){Rl(this);var i=this;return Al(this,this.render().then(function(e){return new fe(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(){Rl(this),null!==this.c&&this.g.reset(this.c)},t.clear=function(){Rl(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=te(this.v);for(;t=e.firstChild;)e.removeChild(t)}},_(Ol,Tl);var Dl="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function xl(t,e){return{name:t||"",K:"a valid string",optional:!!e,M:function(t){return"string"==typeof t}}}function Ll(t,e){return{name:t||"",K:"a boolean",optional:!!e,M:function(t){return"boolean"==typeof t}}}function Ml(t,e){return{name:t||"",K:"a valid object",optional:!!e,M:g}}function Fl(t,e){return{name:t||"",K:"a function",optional:!!e,M:function(t){return"function"==typeof t}}}function Ul(t,e){return{name:t||"",K:"null",optional:!!e,M:function(t){return null===t}}}function jl(n){return{name:n?n+"Credential":"credential",K:n?"a valid "+n+" credential":"a valid credential",optional:!1,M:function(t){if(!t)return!1;var e=!n||t.providerId===n;return!(!t.ka||!e)}}}function ql(){return{name:"multiFactorAssertion",K:"a valid multiFactorAssertion",optional:!1,M:function(t){return!!t&&!!t.sb}}}function Vl(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}}function Bl(t,e){return g(t)&&"string"==typeof t.type&&t.type===e&&"function"==typeof t.Ha}function Kl(t){return g(t)&&"string"==typeof t.uid}function Wl(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(t){return!(!t||"string"!=typeof t.type||"function"!=typeof t.verify)}}}function Hl(e,n,t,r){return{name:t||"",K:e.K+" or "+n.K,optional:!!r,M:function(t){return e.M(t)||n.M(t)}}}function Gl(t,e){for(var n in e){var r=e[n].name;t[r]=Yl(r,t[n],e[n].j)}}function zl(t,e){for(var n in e){var r=e[n].name;r!==n&&Object.defineProperty(t,r,{get:b(function(t){return this[t]},n),set:b(function(t,e,n,r){Pl(t,[n],[r],!0),this[e]=r},r,n,e[n].kb),enumerable:!0})}}function Ql(t,e,n,r){t[e]=Yl(e,n,r)}function Yl(t,e,n){function r(){var t=Array.prototype.slice.call(arguments);return Pl(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}Gl(Xh.prototype,{jb:{name:"applyActionCode",j:[xl("code")]},Ra:{name:"checkActionCode",j:[xl("code")]},nb:{name:"confirmPasswordReset",j:[xl("code"),xl("newPassword")]},dc:{name:"createUserWithEmailAndPassword",j:[xl("email"),xl("password")]},hc:{name:"fetchSignInMethodsForEmail",j:[xl("email")]},qa:{name:"getRedirectResult",j:[]},Bc:{name:"isSignInWithEmailLink",j:[xl("emailLink")]},Hc:{name:"onAuthStateChanged",j:[Hl(Ml(),Fl(),"nextOrObserver"),Fl("opt_error",!0),Fl("opt_completed",!0)]},Ic:{name:"onIdTokenChanged",j:[Hl(Ml(),Fl(),"nextOrObserver"),Fl("opt_error",!0),Fl("opt_completed",!0)]},vb:{name:"sendPasswordResetEmail",j:[xl("email"),Hl(Ml("opt_actionCodeSettings",!0),Ul(null,!0),"opt_actionCodeSettings",!0)]},wb:{name:"sendSignInLinkToEmail",j:[xl("email"),Ml("actionCodeSettings")]},xb:{name:"setPersistence",j:[xl("persistence")]},Sc:{name:"signInAndRetrieveDataWithCredential",j:[jl()]},zb:{name:"signInAnonymously",j:[]},$a:{name:"signInWithCredential",j:[jl()]},Tc:{name:"signInWithCustomToken",j:[xl("token")]},Uc:{name:"signInWithEmailAndPassword",j:[xl("email"),xl("password")]},Vc:{name:"signInWithEmailLink",j:[xl("email"),xl("emailLink",!0)]},Wc:{name:"signInWithPhoneNumber",j:[xl("phoneNumber"),Wl()]},Xc:{name:"signInWithPopup",j:[Vl()]},Yc:{name:"signInWithRedirect",j:[Vl()]},dd:{name:"updateCurrentUser",j:[Hl({name:"user",K:"an instance of Firebase User",optional:!1,M:function(t){return!!(t&&t instanceof hh)}},Ul(),"user")]},Ab:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[xl(null,!0)]},fd:{name:"useDeviceLanguage",j:[]},gd:{name:"useEmulator",j:[xl("url"),Ml("options",!0)]},jd:{name:"verifyPasswordResetCode",j:[xl("code")]}}),zl(Xh.prototype,{lc:{name:"languageCode",kb:Hl(xl(),Ul(),"languageCode")},ti:{name:"tenantId",kb:Hl(xl(),Ul(),"tenantId")}}),(Xh.Persistence=Ku).LOCAL="local",Xh.Persistence.SESSION="session",Xh.Persistence.NONE="none",Gl(hh.prototype,{delete:{name:"delete",j:[]},oc:{name:"getIdTokenResult",j:[Ll("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[Ll("opt_forceRefresh",!0)]},Cc:{name:"linkAndRetrieveDataWithCredential",j:[jl()]},qb:{name:"linkWithCredential",j:[jl()]},Dc:{name:"linkWithPhoneNumber",j:[xl("phoneNumber"),Wl()]},Ec:{name:"linkWithPopup",j:[Vl()]},Fc:{name:"linkWithRedirect",j:[Vl()]},Lc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[jl()]},tb:{name:"reauthenticateWithCredential",j:[jl()]},Mc:{name:"reauthenticateWithPhoneNumber",j:[xl("phoneNumber"),Wl()]},Nc:{name:"reauthenticateWithPopup",j:[Vl()]},Oc:{name:"reauthenticateWithRedirect",j:[Vl()]},reload:{name:"reload",j:[]},ub:{name:"sendEmailVerification",j:[Hl(Ml("opt_actionCodeSettings",!0),Ul(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[xl(null,!0)]},cd:{name:"unlink",j:[xl("provider")]},Bb:{name:"updateEmail",j:[xl("email")]},Cb:{name:"updatePassword",j:[xl("password")]},ed:{name:"updatePhoneNumber",j:[jl("phone")]},Db:{name:"updateProfile",j:[Ml("profile")]},Eb:{name:"verifyBeforeUpdateEmail",j:[xl("email"),Hl(Ml("opt_actionCodeSettings",!0),Ul(null,!0),"opt_actionCodeSettings",!0)]}}),Gl(hl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Gl(cl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Gl(fe.prototype,{oa:{name:"finally"},o:{name:"catch"},then:{name:"then"}}),zl(Vc.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",kb:Ll("appVerificationDisabledForTesting")}}),Gl(Bc.prototype,{confirm:{name:"confirm",j:[xl("verificationCode")]}}),Ql($i,"fromJSON",function(t){t="string"==typeof t?JSON.parse(t):t;for(var e,n=[oo,bo,Eo,no],r=0;r<n.length;r++)if(e=n[r](t))return e;return null},[Hl(xl(),Ml(),"json")]),Ql(_o,"credential",function(t,e){return new mo(t,e)},[xl("email"),xl("password")]),Gl(mo.prototype,{w:{name:"toJSON",j:[xl(null,!0)]}}),Gl(co.prototype,{Ca:{name:"addScope",j:[xl("scope")]},Ka:{name:"setCustomParameters",j:[Ml("customOAuthParameters")]}}),Ql(co,"credential",ho,[Hl(xl(),Ml(),"token")]),Ql(_o,"credentialWithLink",wo,[xl("email"),xl("emailLink")]),Gl(lo.prototype,{Ca:{name:"addScope",j:[xl("scope")]},Ka:{name:"setCustomParameters",j:[Ml("customOAuthParameters")]}}),Ql(lo,"credential",fo,[Hl(xl(),Ml(),"token")]),Gl(po.prototype,{Ca:{name:"addScope",j:[xl("scope")]},Ka:{name:"setCustomParameters",j:[Ml("customOAuthParameters")]}}),Ql(po,"credential",vo,[Hl(xl(),Hl(Ml(),Ul()),"idToken"),Hl(xl(),Ul(),"accessToken",!0)]),Gl(go.prototype,{Ka:{name:"setCustomParameters",j:[Ml("customOAuthParameters")]}}),Ql(go,"credential",yo,[Hl(xl(),Ml(),"token"),xl("secret",!0)]),Gl(uo.prototype,{Ca:{name:"addScope",j:[xl("scope")]},credential:{name:"credential",j:[Hl(xl(),Hl(Ml(),Ul()),"optionsOrIdToken"),Hl(xl(),Ul(),"accessToken",!0)]},Ka:{name:"setCustomParameters",j:[Ml("customOAuthParameters")]}}),Gl(ro.prototype,{w:{name:"toJSON",j:[xl(null,!0)]}}),Gl(to.prototype,{w:{name:"toJSON",j:[xl(null,!0)]}}),Ql(Co,"credential",ko,[xl("verificationId"),xl("verificationCode")]),Gl(Co.prototype,{fb:{name:"verifyPhoneNumber",j:[Hl(xl(),{name:"phoneInfoOptions",K:"valid phone info options",optional:!1,M:function(t){return!!t&&(t.session&&t.phoneNumber?Bl(t.session,Xi)&&"string"==typeof t.phoneNumber:t.session&&t.multiFactorHint?Bl(t.session,Ji)&&Kl(t.multiFactorHint):t.session&&t.multiFactorUid?Bl(t.session,Ji)&&"string"==typeof t.multiFactorUid:!!t.phoneNumber&&"string"==typeof t.phoneNumber)}},"phoneInfoOptions"),Wl()]}}),Gl(To.prototype,{w:{name:"toJSON",j:[xl(null,!0)]}}),Gl(I.prototype,{toJSON:{name:"toJSON",j:[xl(null,!0)]}}),Gl(Mo.prototype,{toJSON:{name:"toJSON",j:[xl(null,!0)]}}),Gl(Lo.prototype,{toJSON:{name:"toJSON",j:[xl(null,!0)]}}),Gl(Qc.prototype,{toJSON:{name:"toJSON",j:[xl(null,!0)]}}),Gl(Hc.prototype,{Rc:{name:"resolveSignIn",j:[ql()]}}),Gl(th.prototype,{Rb:{name:"getSession",j:[]},fc:{name:"enroll",j:[ql(),xl("displayName",!0)]},bd:{name:"unenroll",j:[Hl({name:"multiFactorInfo",K:"a valid multiFactorInfo",optional:!1,M:Kl},xl(),"multiFactorInfoIdentifier")]}}),Gl(Ol.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}),Ql(hi,"parseLink",mi,[xl("link")]),Ql(gl,"assertion",function(t){return new $c(t)},[jl("phone")]),function(){if(void 0===Xl||!Xl.INTERNAL||!Xl.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:$r,PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:Jr,VERIFY_AND_CHANGE_EMAIL:Zr,VERIFY_EMAIL:"VERIFY_EMAIL"}},Auth:Xh,AuthCredential:$i,Error:I};Ql(t,"EmailAuthProvider",_o,[]),Ql(t,"FacebookAuthProvider",co,[]),Ql(t,"GithubAuthProvider",lo,[]),Ql(t,"GoogleAuthProvider",po,[]),Ql(t,"TwitterAuthProvider",go,[]),Ql(t,"OAuthProvider",uo,[xl("providerId")]),Ql(t,"SAMLAuthProvider",so,[xl("providerId")]),Ql(t,"PhoneAuthProvider",Co,[{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(t){return!!(t&&t instanceof Xh)}}]),Ql(t,"RecaptchaVerifier",Ol,[Hl(xl(),{name:"",K:"an HTML element",optional:!1,M:function(t){return!!(t&&t instanceof Element)}},"recaptchaContainer"),Ml("recaptchaParameters",!0),{name:"app",K:"an instance of Firebase App",optional:!0,M:function(t){return!!(t&&t instanceof Xl.app.App)}}]),Ql(t,"ActionCodeURL",hi,[]),Ql(t,"PhoneMultiFactorGenerator",gl,[]),Xl.INTERNAL.registerComponent({name:"auth",instanceFactory:function(t){return new Xh(t=t.getProvider("app").getImmediate())},multipleInstances:!1,serviceProps:t,instantiationMode:"LAZY",type:"PUBLIC"}),Xl.INTERNAL.registerComponent({name:"auth-internal",instanceFactory:function(t){return{getUid:m((t=t.getProvider("auth").getImmediate()).getUid,t),getToken:m(t.nc,t),addAuthTokenListener:m(t.cc,t),removeAuthTokenListener:m(t.Pc,t)}},multipleInstances:!1,instantiationMode:"LAZY",type:"PRIVATE"}),Xl.registerVersion("@firebase/auth","0.16.5"),Xl.INTERNAL.extendNamespace({User:hh})}()}.apply("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Oa=(Pa.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),Ro(e))},Pa.prototype.get=function(t){t=this.domStorage_.getItem(this.prefixedName_(t));return null==t?null:Ao(t)},Pa.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},Pa.prototype.prefixedName_=function(t){return this.prefix_+t},Pa.prototype.toString=function(){return this.domStorage_.toString()},Pa);function Pa(t){this.domStorage_=t,this.prefix_="firebase:"}var Da=(xa.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},xa.prototype.get=function(t){return Po(this.cache_,t)?this.cache_[t]:null},xa.prototype.remove=function(t){delete this.cache_[t]},xa);function xa(){this.cache_={},this.isInMemoryStorage=!0}function La(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 Fo).update(e),t=t.digest(),uo.encodeByteArray(t)}function Ma(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE INTERNAL ERROR: "+Ga.apply(void 0,no([],eo(t)));Wa.error(n)}function Fa(t){return"number"==typeof t&&(t!=t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)}function Ua(t,e){return t===e?0:t<e?-1:1}function ja(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+Ro(e))}function qa(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 Va,Sn=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 Oa(e)}}catch(t){}return new Da},Ba=Sn("localStorage"),Ka=Sn("sessionStorage"),Wa=new pa("@firebase/database"),Ha=(Va=1,function(){return Va++}),Ga=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+=Ga.apply(null,i):n+="object"==typeof i?Ro(i):i,n+=" "}return n},za=null,Qa=!0,Ya=function(t,e){ao(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(Wa.logLevel=sa.VERBOSE,za=Wa.log.bind(Wa),e&&Ka.set("logging_enabled",!0)):"function"==typeof t?za=t:(za=null,Ka.remove("logging_enabled"))},Xa=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];!0===Qa&&(Qa=!1,null===za&&!0===Ka.get("logging_enabled")&&Ya(!0)),za&&(t=Ga.apply(null,e),za(t))},Ja=function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];Xa.apply(void 0,no([n],eo(t)))}},$a=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE FATAL ERROR: "+Ga.apply(void 0,no([],eo(t)));throw Wa.error(n),new Error(n)},Za=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE WARNING: "+Ga.apply(void 0,no([],eo(t)));Wa.warn(n)},ts="[MIN_NAME]",es="[MAX_NAME]",ns=function(t,e){if(t===e)return 0;if(t===ts||e===es)return-1;if(e===ts||t===es)return 1;var n=hs(t),r=hs(e);return null!==n?null!==r?n-r==0?t.length-e.length:n-r:-1:null===r&&t<e?-1:1},rs=function(t){if("object"!=typeof t||null===t)return Ro(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+=Ro(n[i]),r+=":",r+=rs(t[n[i]]);return r+="}"};function is(t,e){for(var n in t)t.hasOwnProperty(n)&&e(n,t[n])}function os(t){var e,n,r,i;ao(!Fa(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=[],a=52;a;--a)o.push(r%2?1:0),r=Math.floor(r/2);for(a=11;a;--a)o.push(n%2?1:0),n=Math.floor(n/2);o.push(e?1:0),o.reverse();var s=o.join(""),u="";for(a=0;a<64;a+=8){var c=parseInt(s.substr(a,8),2).toString(16);u+=c=1===c.length?"0"+c:c}return u.toLowerCase()}function as(t,e){return"object"==typeof(e=setTimeout(t,e))&&e.unref&&e.unref(),e}var ss=new RegExp("^-?(0*)\\d{1,10}$"),us=-2147483648,cs=2147483647,hs=function(t){if(ss.test(t)){t=Number(t);if(us<=t&&t<=cs)return t}return null},ls=function(t){try{t()}catch(e){setTimeout(function(){var t=e.stack||"";throw Za("Exception was thrown by user callback.",t),e},Math.floor(0))}},fs=(ps.prototype.getToken=function(t){return this.auth_?this.auth_.getToken(t).catch(function(t){return t&&"auth/token-not-initialized"===t.code?(Xa("Got auth/token-not-initialized error.  Treating as null token."),null):Promise.reject(t)}):Promise.resolve(null)},ps.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)}))},ps.prototype.removeTokenChangeListener=function(e){this.authProvider_.get().then(function(t){return t.removeAuthTokenListener(e)})},ps.prototype.notifyForInvalidToken=function(){var t='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?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.firebaseOptions_?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/.',Za(t)},ps);function ps(t,e,n){var r=this;this.appName_=t,this.firebaseOptions_=e,this.authProvider_=n,this.auth_=null,this.auth_=n.getImmediate({optional:!0}),this.auth_||n.get().then(function(t){return r.auth_=t})}var ds=(vs.prototype.getToken=function(t){return Promise.resolve({accessToken:vs.EMULATOR_AUTH_TOKEN})},vs.prototype.addTokenChangeListener=function(t){t(vs.EMULATOR_AUTH_TOKEN)},vs.prototype.removeTokenChangeListener=function(t){},vs.prototype.notifyForInvalidToken=function(){},vs.EMULATOR_AUTH_TOKEN="owner",vs);function vs(){}var gs=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,ys="websocket",ms="long_polling",bs=(_s.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},_s.prototype.isCustomHost=function(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain},Object.defineProperty(_s.prototype,"host",{get:function(){return this._host},set:function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&Ba.set("host:"+this._host,this.internalHost))},enumerable:!1,configurable:!0}),_s.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},_s.prototype.toURLString=function(){var t=this.secure?"https://":"http://",e=this.includeNamespaceInQueryParams?"?ns="+this.namespace:"";return t+this.host+"/"+e},_s);function _s(t,e,n,r,i,o,a){void 0===i&&(i=!1),void 0===o&&(o=""),void 0===a&&(a=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=o,this.includeNamespaceInQueryParams=a,this._host=t.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=Ba.get("host:"+t)||this._host}function ws(t,e,n){var r;if(ao("string"==typeof e,"typeof type must == string"),ao("object"==typeof n,"typeof params must == object"),e===ys)r=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else{if(e!==ms)throw new Error("Unknown connection type: "+e);r=(t.secure?"https://":"http://")+t.internalHost+"/.lp?"}((e=t).host!==e.internalHost||e.isCustomHost()||e.includeNamespaceInQueryParams)&&(n.ns=t.namespace);var i=[];return is(n,function(t,e){i.push(t+"="+e)}),r+i.join("&")}var Is=(Ts.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),Po(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},Ts.prototype.get=function(){return co(this.counters_)},Ts);function Ts(){this.counters_={}}var Es={},Ss={};function Cs(t){t=t.toString();return Es[t]||(Es[t]=new Is),Es[t]}var ks=(Ns.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},Ns.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]&&ls(function(){n.onMessage_(e[t])})}(t);if(r.currentResponseNum===r.closeAfterResponse)return r.onClose&&(r.onClose(),r.onClose=null),"break";r.currentResponseNum++}())break},Ns);function Ns(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}var As="pLPCommand",Rs="pRTLPCB",Os=(Ps.prototype.open=function(t,e){var n,r,i,a=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new ks(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(function(){a.log_("Timed out trying to connect."),a.onClosed_(),a.connectTimeoutTimer_=null},Math.floor(3e4)),n=function(){var t;a.isClosed_||(a.scriptTagHolder=new Ds(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(a.incrementIncomingBytes_(t),a.scriptTagHolder)if(a.connectTimeoutTimer_&&(clearTimeout(a.connectTimeoutTimer_),a.connectTimeoutTimer_=null),a.everConnected_=!0,"start"===r)a.id=i,a.password=o;else{if("close"!==r)throw new Error("Unrecognized command received: "+r);i?(a.scriptTagHolder.sendNewPolls=!1,a.myPacketOrderer.closeAfter(i,function(){a.onClosed_()})):a.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];a.incrementIncomingBytes_(t),a.myPacketOrderer.handleResponse(r,n)},function(){a.onClosed_()},a.urlFn),(t={start:"t"}).ser=Math.floor(1e8*Math.random()),a.scriptTagHolder.uniqueCallbackIdentifier&&(t.cb=a.scriptTagHolder.uniqueCallbackIdentifier),t.v="5",a.transportSessionId&&(t.s=a.transportSessionId),a.lastSessionId&&(t.ls=a.lastSessionId),a.applicationId&&(t.p=a.applicationId),"undefined"!=typeof location&&location.hostname&&gs.test(location.hostname)&&(t.r="f"),t=a.urlFn(t),a.log_("Connecting via long-poll to "+t),a.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)))},Ps.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},Ps.forceAllow=function(){Ps.forceAllow_=!0},Ps.forceDisallow=function(){Ps.forceDisallow_=!0},Ps.isAvailable=function(){return!!Ps.forceAllow_||!(Ps.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)},Ps.prototype.markConnectionHealthy=function(){},Ps.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)},Ps.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},Ps.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},Ps.prototype.send=function(t){t=Ro(t);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);for(var t=function(t){t=ro(t);return uo.encodeByteArray(t,!0)}(t),e=qa(t,1840),n=0;n<e.length;n++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,e.length,e[n]),this.curSegmentNum++},Ps.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)},Ps.prototype.incrementIncomingBytes_=function(t){t=Ro(t).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)},Ps);function Ps(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_=Ja(t),this.stats_=Cs(e),this.urlFn=function(t){return ws(e,ms,t)}}var Ds=(xs.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||Xa("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},xs.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())},xs.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},xs.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},xs.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},xs.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()})},xs.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(){Xa("Long-poll script failed to load: "+t),r.sendNewPolls=!1,r.close()},r.myIFrame.doc.body.appendChild(e)}catch(t){}},Math.floor(1))},xs);function xs(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=Ha(),window[As+this.uniqueCallbackIdentifier]=t,window[Rs+this.uniqueCallbackIdentifier]=e,this.myIFrame=xs.createIFrame_();var e="",i="<html><body>"+(e=this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length)?'<script>document.domain="'+document.domain+'";<\/script>':e)+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(i),this.myIFrame.doc.close()}catch(t){Xa("frame writing exception"),t.stack&&Xa(t.stack),Xa(t)}}var Ls="";function Ms(t){Ls=t}var Fs=null;"undefined"!=typeof MozWebSocket?Fs=MozWebSocket:"undefined"!=typeof WebSocket&&(Fs=WebSocket);var Us=(js.connectionURL_=function(t,e,n){var r={v:"5"};return"undefined"!=typeof location&&location.hostname&&gs.test(location.hostname)&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),ws(t,ys,r)},js.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,Ba.set("previous_websocket_failure",!0);try{mo()||(n={headers:{"X-Firebase-GMPID":this.applicationId||""}},this.mySock=new Fs(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_()}},js.prototype.start=function(){},js.forceDisallow=function(){js.forceDisallow_=!0},js.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!==Fs&&!js.forceDisallow_},js.previouslyFailed=function(){return Ba.isInMemoryStorage||!0===Ba.get("previous_websocket_failure")},js.prototype.markConnectionHealthy=function(){Ba.remove("previous_websocket_failure")},js.prototype.appendFrame_=function(t){this.frames.push(t),this.frames.length===this.totalFrames&&(t=this.frames.join(""),this.frames=null,t=Ao(t),this.onMessage(t))},js.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},js.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},js.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))},js.prototype.send=function(t){this.resetKeepAlive();t=Ro(t);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);var e=qa(t,16384);1<e.length&&this.sendString_(String(e.length));for(var n=0;n<e.length;n++)this.sendString_(e[n])},js.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},js.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},js.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},js.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(function(){t.mySock&&t.sendString_("0"),t.resetKeepAlive()},Math.floor(45e3))},js.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)}},js.responsesRequiredToBeHealthy=2,js.healthyTimeout=3e4,js);function js(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_=Ja(this.connId),this.stats_=Cs(e),this.connURL=js.connectionURL_(e,r,i),this.nodeAdmin=e.nodeAdmin}var qs=(Object.defineProperty(Vs,"ALL_TRANSPORTS",{get:function(){return[Os,Us]},enumerable:!1,configurable:!0}),Vs.prototype.initTransports_=function(t){var e,n,r=Us&&Us.isAvailable(),i=r&&!Us.previouslyFailed();if(t.webSocketOnly&&(r||Za("wss:// URL used, but browser isn't known to support websockets.  Trying anyway."),i=!0),i)this.transports_=[Us];else{var o=this.transports_=[];try{for(var a=to(Vs.ALL_TRANSPORTS),s=a.next();!s.done;s=a.next()){var u=s.value;u&&u.isAvailable()&&o.push(u)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}}},Vs.prototype.initialTransport=function(){if(0<this.transports_.length)return this.transports_[0];throw new Error("No transports available")},Vs.prototype.upgradeTransport=function(){return 1<this.transports_.length?this.transports_[1]:null},Vs);function Vs(t){this.initTransports_(t)}var Bs=(Ks.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_=as(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)))},Ks.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},Ks.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")}},Ks.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"))}},Ks.prototype.sendRequest=function(t){t={t:"d",d:t};this.sendData_(t)},Ks.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)},Ks.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_()))},Ks.prototype.onSecondaryMessageReceived_=function(t){var e=ja("t",t),t=ja("d",t);if("c"===e)this.onSecondaryControl_(t);else{if("d"!==e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(t)}},Ks.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:{}}}))},Ks.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()},Ks.prototype.onPrimaryMessageReceived_=function(t){var e=ja("t",t),t=ja("d",t);"c"===e?this.onControl_(t):"d"===e&&this.onDataMessage_(t)},Ks.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},Ks.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},Ks.prototype.onControl_=function(t){var e=ja("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?Ma("Server Error: "+t):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):Ma("Unknown control packet command: "+e)}},Ks.prototype.onHandshake_=function(t){var e=t.ts,n=t.v,r=t.h;this.sessionId=t.s,this.repoInfo_.host=r,0===this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,e),"5"!==n&&Za("Protocol version mismatch detected"),this.tryStartUpgrade_())},Ks.prototype.tryStartUpgrade_=function(){var t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)},Ks.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),as(function(){e.secondaryConn_&&(e.log_("Timed out trying to upgrade."),e.secondaryConn_.close())},Math.floor(6e4))},Ks.prototype.onReset_=function(t){this.log_("Reset packet received.  New host: "+t),this.repoInfo_.host=t,1===this.state_?this.close():(this.closeConnections_(),this.start_())},Ks.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):as(function(){n.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))},Ks.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},Ks.prototype.onSecondaryConnectionLost_=function(){var t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()},Ks.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()&&(Ba.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()},Ks.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()},Ks.prototype.sendData_=function(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)},Ks.prototype.close=function(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))},Ks.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)},Ks);function Ks(t,e,n,r,i,o,a,s){this.id=t,this.repoInfo_=e,this.applicationId_=n,this.onMessage_=r,this.onReady_=i,this.onDisconnect_=o,this.onKill_=a,this.lastSessionId=s,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=Ja("c:"+this.id+":"),this.transportManager_=new qs(e),this.log_("Connection created"),this.start_()}Ws.prototype.put=function(t,e,n,r){},Ws.prototype.merge=function(t,e,n,r){},Ws.prototype.refreshAuthToken=function(t){},Ws.prototype.onDisconnectPut=function(t,e,n){},Ws.prototype.onDisconnectMerge=function(t,e,n){},Ws.prototype.onDisconnectCancel=function(t,e){},Ws.prototype.reportStats=function(t){},z=Ws;function Ws(){}var Hs=(Gs.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=no([],eo(this.listeners_[t])),i=0;i<r.length;i++)r[i].callback.apply(r[i].context,e)},Gs.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)},Gs.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)},Gs.prototype.validateEventType_=function(e){ao(this.allowedEvents_.find(function(t){return t===e}),"Unknown event: "+e)},Gs);function Gs(t){this.allowedEvents_=t,this.listeners_={},ao(Array.isArray(t)&&0<t.length,"Requires a non-empty array")}var zs,Qs=(Xi(Ys,zs=Hs),Ys.getInstance=function(){return new Ys},Ys.prototype.getInitialEvent=function(t){return ao("online"===t,"Unknown event type: "+t),[this.online_]},Ys.prototype.currentlyOnline=function(){return this.online_},Ys);function Ys(){var t=zs.call(this,["online"])||this;return t.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||vo()||(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 Xs=32,Js=768,$s=(Zs.prototype.toString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"},Zs);function Zs(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}function tu(){return new $s("")}function eu(t){return t.pieceNum_>=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function nu(t){return t.pieces_.length-t.pieceNum_}function ru(t){var e=t.pieceNum_;return e<t.pieces_.length&&e++,new $s(t.pieces_,e)}function iu(t){return t.pieceNum_<t.pieces_.length?t.pieces_[t.pieces_.length-1]:null}function ou(t,e){return void 0===e&&(e=0),t.pieces_.slice(t.pieceNum_+e)}function au(t){if(t.pieceNum_>=t.pieces_.length)return null;for(var e=[],n=t.pieceNum_;n<t.pieces_.length-1;n++)e.push(t.pieces_[n]);return new $s(e,0)}function su(t,e){for(var n=[],r=t.pieceNum_;r<t.pieces_.length;r++)n.push(t.pieces_[r]);if(e instanceof $s)for(r=e.pieceNum_;r<e.pieces_.length;r++)n.push(e.pieces_[r]);else for(var i=e.split("/"),r=0;r<i.length;r++)0<i[r].length&&n.push(i[r]);return new $s(n,0)}function uu(t){return t.pieceNum_>=t.pieces_.length}function cu(t,e){var n=eu(t),r=eu(e);if(null===n)return e;if(n===r)return cu(ru(t),ru(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function hu(t,e){for(var n=ou(t,0),r=ou(e,0),i=0;i<n.length&&i<r.length;i++){var o=ns(n[i],r[i]);if(0!==o)return o}return n.length===r.length?0:n.length<r.length?-1:1}function lu(t,e){if(nu(t)!==nu(e))return!1;for(var n=t.pieceNum_,r=e.pieceNum_;n<=t.pieces_.length;n++,r++)if(t.pieces_[n]!==e.pieces_[r])return!1;return!0}function fu(t,e){var n=t.pieceNum_,r=e.pieceNum_;if(nu(t)>nu(e))return!1;for(;n<t.pieces_.length;){if(t.pieces_[n]!==e.pieces_[r])return!1;++n,++r}return!0}var pu=function(t,e){this.errorPrefix_=e,this.parts_=ou(t,0),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n<this.parts_.length;n++)this.byteLength_+=zo(this.parts_[n]);du(this)};function du(t){if(t.byteLength_>Js)throw new Error(t.errorPrefix_+"has a key path longer than "+Js+" bytes ("+t.byteLength_+").");if(t.parts_.length>Xs)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Xs+") or object contains a cycle "+vu(t))}function vu(t){return 0===t.parts_.length?"":"in property '"+t.parts_.join(".")+"'"}var gu,yu=(Xi(mu,gu=Hs),mu.getInstance=function(){return new mu},mu.prototype.getInitialEvent=function(t){return ao("visible"===t,"Unknown event type: "+t),[this.visible_]},mu);function mu(){var e,t,n=gu.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 bu,_u=1e3,wu=3e5,Iu=(Xi(Tu,bu=z),Tu.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,e={r:r,a:t,b:e};this.log_(Ro(e)),ao(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(e),n&&(this.requestCBHash_[r]=n)},Tu.prototype.get=function(t){var n=this,r=new lo,i={p:t._path.toString(),q:t._queryObject},e={action:"g",request:i,onComplete:function(t){var e=t.d;"ok"===t.s?(n.onDataUpdate_(i.p,e,!1,null),r.resolve(e)):r.reject(e)}};this.outstandingGets_.push(e),this.outstandingGetCount_++;var o=this.outstandingGets_.length-1;return this.connected_||setTimeout(function(){var t=n.outstandingGets_[o];void 0!==t&&e===t&&(delete n.outstandingGets_[o],n.outstandingGetCount_--,0===n.outstandingGetCount_&&(n.outstandingGets_=[]),n.log_("get "+o+" timed out on connection"),r.reject(new Error("Client is offline.")))},3e3),this.connected_&&this.sendGet_(o),r.promise},Tu.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._queryParams.isDefault()||!t._queryParams.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)},Tu.prototype.sendGet_=function(e){var n=this,r=this.outstandingGets_[e];this.sendRequest("g",r.request,function(t){delete n.outstandingGets_[e],n.outstandingGetCount_--,0===n.outstandingGetCount_&&(n.outstandingGets_=[]),r.onComplete&&r.onComplete(t)})},Tu.prototype.sendListen_=function(r){var i=this,o=r.query,a=o._path.toString(),s=o._queryIdentifier;this.log_("Listen on "+a+" for "+s);var t={p:a};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;Tu.warnOnListenWarnings_(e,o),(i.listens.get(a)&&i.listens.get(a).get(s))===r&&(i.log_("listen response",t),"ok"!==n&&i.removeListen_(a,s),r.onComplete&&r.onComplete(n,e))})},Tu.warnOnListenWarnings_=function(t,e){t&&"object"==typeof t&&Po(t,"w")&&(t=Do(t,"w"),Array.isArray(t)&&~t.indexOf("no_index")&&(t='".indexOn": "'+e._queryParams.getIndex().toString()+'"',e=e._path.toString(),Za("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.")))},Tu.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)},Tu.prototype.reduceReconnectDelayIfAdminCredential_=function(t){(t&&40===t.length||function(t){t=Oo(t).claims;return"object"==typeof t&&!0===t.admin}(t))&&(this.log_("Admin auth credential detected.  Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},Tu.prototype.tryAuth=function(){var n,t,e,r=this;this.connected_&&this.authToken_&&(t=function(t){t=Oo(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))}))},Tu.prototype.unlisten=function(t,e){var n=t._path.toString(),r=t._queryIdentifier;this.log_("Unlisten called for "+n+" "+r),ao(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,r)&&this.connected_&&this.sendUnlisten_(n,r,t._queryObject,e)},Tu.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)},Tu.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})},Tu.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})},Tu.prototype.onDisconnectCancel=function(t,e){this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},Tu.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))})},Tu.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},Tu.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},Tu.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)},Tu.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)})},Tu.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))}))},Tu.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+Ro(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)}},Tu.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):Ma("Unrecognized action received from server: "+Ro(t)+"\nAre you using the latest client?")},Tu.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)},Tu.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))},Tu.prototype.onVisible_=function(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible.  Reducing delay."),this.reconnectDelay_=_u,this.realtime_||this.scheduleConnect_(0)),this.visible_=t},Tu.prototype.onOnline_=function(t){t?(this.log_("Browser went online."),this.reconnectDelay_=_u,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline.  Killing connection."),this.realtime_&&this.realtime_.close())},Tu.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_=_u),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)},Tu.prototype.establishConnection_=function(){var e,n,r,i,o,a,s,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+":"+Tu.nextConnectionId_++,a=(o=this).lastSessionId,s=!1,u=null,c=function(){u?u.close():(s=!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){s?Xa("getToken() completed but was canceled"):(Xa("getToken() completed. Creating connection."),o.authToken_=t&&t.accessToken,u=new Bs(i,o.repoInfo_,o.applicationId_,e,n,r,function(t){Za(t+" ("+o.repoInfo_.toString()+")"),o.interrupt("server_kill")},a))}).then(null,function(t){o.log_("Failed to get token: "+t),s||(h.repoInfo_.nodeAdmin&&Za(t),c())}))},Tu.prototype.interrupt=function(t){Xa("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_())},Tu.prototype.resume=function(t){Xa("Resuming connection for reason: "+t),delete this.interruptReasons_[t],xo(this.interruptReasons_)&&(this.reconnectDelay_=_u,this.realtime_||this.scheduleConnect_(0))},Tu.prototype.handleTimestamp_=function(t){t-=(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:t})},Tu.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_=[])},Tu.prototype.onListenRevoked_=function(t,e){e=e?e.map(function(t){return rs(t)}).join("$"):"default",e=this.removeListen_(t,e);e&&e.onComplete&&e.onComplete("permission_denied")},Tu.prototype.removeListen_=function(t,e){var n,r=new $s(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},Tu.prototype.onAuthRevoked_=function(t,e){Xa("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()))},Tu.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},Tu.prototype.restoreState_=function(){var e,t,n,r;this.tryAuth();try{for(var i=to(this.listens.values()),o=i.next();!o.done;o=i.next()){var a=o.value;try{for(var s=(n=void 0,to(a.values())),u=s.next();!u.done;u=s.next()){var c=u.value;this.sendListen_(c)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}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)}for(h=0;h<this.outstandingGets_.length;h++)this.outstandingGets_[h]&&this.sendGet_(h)},Tu.prototype.sendConnectStats_=function(){var t={};t["sdk.js."+Ls.replace(/\./g,"-")]=1,vo()?t["framework.cordova"]=1:yo()&&(t["framework.reactnative"]=1),this.reportStats(t)},Tu.prototype.shouldReconnect_=function(){var t=Qs.getInstance().currentlyOnline();return xo(this.interruptReasons_)&&t},Tu.nextPersistentConnectionId_=0,Tu.nextConnectionId_=0,Tu);function Tu(t,e,n,r,i,o,a){var s=bu.call(this)||this;if(s.repoInfo_=t,s.applicationId_=e,s.onDataUpdate_=n,s.onConnectStatus_=r,s.onServerInfoUpdate_=i,s.authTokenProvider_=o,s.authOverride_=a,s.id=Tu.nextPersistentConnectionId_++,s.log_=Ja("p:"+s.id+":"),s.interruptReasons_={},s.listens=new Map,s.outstandingPuts_=[],s.outstandingGets_=[],s.outstandingPutCount_=0,s.outstandingGetCount_=0,s.onDisconnectRequestQueue_=[],s.connected_=!1,s.reconnectDelay_=_u,s.maxReconnectDelay_=wu,s.securityDebugCallback_=null,s.lastSessionId=null,s.establishConnectionTimer_=null,s.visible_=!1,s.requestCBHash_={},s.requestNumber_=0,s.realtime_=null,s.authToken_=null,s.forceTokenRefresh_=!1,s.invalidAuthTokenCount_=0,s.firstConnection_=!0,s.lastConnectionAttemptTime_=null,s.lastConnectionEstablishedTime_=null,a&&!mo())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");return s.scheduleConnect_(0),yu.getInstance().on("visible",s.onVisible_,s),-1===t.host.indexOf("fblocal")&&Qs.getInstance().on("online",s.onOnline_,s),s}var Eu=(Su.Wrap=function(t,e){return new Su(t,e)},Su);function Su(t,e){this.name=t,this.node=e}var Cu,G=(ku.prototype.getCompare=function(){return this.compare.bind(this)},ku.prototype.indexedValueChanged=function(t,e){t=new Eu(ts,t),e=new Eu(ts,e);return 0!==this.compare(t,e)},ku.prototype.minPost=function(){return Eu.MIN},ku);function ku(){}var Nu,Sn=(Xi(Au,Nu=G),Object.defineProperty(Au,"__EMPTY_NODE",{get:function(){return Cu},set:function(t){Cu=t},enumerable:!1,configurable:!0}),Au.prototype.compare=function(t,e){return ns(t.name,e.name)},Au.prototype.isDefinedOn=function(t){throw so("KeyIndex.isDefinedOn not expected to be called.")},Au.prototype.indexedValueChanged=function(t,e){return!1},Au.prototype.minPost=function(){return Eu.MIN},Au.prototype.maxPost=function(){return new Eu(es,Cu)},Au.prototype.makePost=function(t,e){return ao("string"==typeof t,"KeyIndex indexValue must always be a string."),new Eu(t,Cu)},Au.prototype.toString=function(){return".key"},Au);function Au(){return null!==Nu&&Nu.apply(this,arguments)||this}var Ru=new Sn,Ou=(Pu.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},Pu.prototype.hasNext=function(){return 0<this.nodeStack_.length},Pu.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}},Pu);function Pu(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 Du=(xu.prototype.copy=function(t,e,n,r,i){return new xu(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)},xu.prototype.count=function(){return this.left.count()+1+this.right.count()},xu.prototype.isEmpty=function(){return!1},xu.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)},xu.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},xu.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},xu.prototype.minKey=function(){return this.min_().key},xu.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},xu.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_()},xu.prototype.removeMin_=function(){if(this.left.isEmpty())return Fu.EMPTY_NODE;var t=this;return(t=(t=!t.left.isRed_()&&!t.left.left.isRed_()?t.moveRedLeft_():t).copy(null,null,null,t.left.removeMin_(),null)).fixUp_()},xu.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r=(r=!(r.left.isEmpty()||r.left.isRed_()||r.left.left.isRed_())?r.moveRedLeft_():r).copy(null,null,null,r.left.remove(t,e),null);else{if(0===e(t,(r=!((r=r.left.isRed_()?r.rotateRight_():r).right.isEmpty()||r.right.isRed_()||r.right.left.isRed_())?r.moveRedRight_():r).key)){if(r.right.isEmpty())return Fu.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_()},xu.prototype.isRed_=function(){return this.color},xu.prototype.fixUp_=function(){var t=this;return t=(t=(t=t.right.isRed_()&&!t.left.isRed_()?t.rotateLeft_():t).left.isRed_()&&t.left.left.isRed_()?t.rotateRight_():t).left.isRed_()&&t.right.isRed_()?t.colorFlip_():t},xu.prototype.moveRedLeft_=function(){var t=this.colorFlip_();return t=t.right.left.isRed_()?(t=(t=t.copy(null,null,null,null,t.right.rotateRight_())).rotateLeft_()).colorFlip_():t},xu.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t=t.left.left.isRed_()?(t=t.rotateRight_()).colorFlip_():t},xu.prototype.rotateLeft_=function(){var t=this.copy(null,null,xu.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},xu.prototype.rotateRight_=function(){var t=this.copy(null,null,xu.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},xu.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)},xu.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)<=this.count()+1},xu.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)},xu.RED=!0,xu.BLACK=!1,xu);function xu(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:xu.RED,this.left=null!=r?r:Fu.EMPTY_NODE,this.right=null!=i?i:Fu.EMPTY_NODE}Lu.prototype.copy=function(t,e,n,r,i){return this},Lu.prototype.insert=function(t,e,n){return new Du(t,e,null)},Lu.prototype.remove=function(t,e){return this},Lu.prototype.count=function(){return 0},Lu.prototype.isEmpty=function(){return!0},Lu.prototype.inorderTraversal=function(t){return!1},Lu.prototype.reverseTraversal=function(t){return!1},Lu.prototype.minKey=function(){return null},Lu.prototype.maxKey=function(){return null},Lu.prototype.check_=function(){return 0},Lu.prototype.isRed_=function(){return!1},Hs=Lu;function Lu(){}var Mu,Fu=(Uu.prototype.insert=function(t,e){return new Uu(this.comparator_,this.root_.insert(t,e,this.comparator_).copy(null,null,Du.BLACK,null,null))},Uu.prototype.remove=function(t){return new Uu(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,Du.BLACK,null,null))},Uu.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},Uu.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?")},Uu.prototype.isEmpty=function(){return this.root_.isEmpty()},Uu.prototype.count=function(){return this.root_.count()},Uu.prototype.minKey=function(){return this.root_.minKey()},Uu.prototype.maxKey=function(){return this.root_.maxKey()},Uu.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},Uu.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},Uu.prototype.getIterator=function(t){return new Ou(this.root_,null,this.comparator_,!1,t)},Uu.prototype.getIteratorFrom=function(t,e){return new Ou(this.root_,t,this.comparator_,!1,e)},Uu.prototype.getReverseIteratorFrom=function(t,e){return new Ou(this.root_,t,this.comparator_,!0,e)},Uu.prototype.getReverseIterator=function(t){return new Ou(this.root_,null,this.comparator_,!0,t)},Uu.EMPTY_NODE=new Hs,Uu);function Uu(t,e){void 0===e&&(e=Uu.EMPTY_NODE),this.comparator_=t,this.root_=e}function ju(t,e){return ns(t.name,e.name)}function qu(t,e){return ns(t,e)}function Vu(t){return"number"==typeof t?"number:"+os(t):"string:"+t}var Bu,Ku,Wu,Hu,Gu=function(t){var e;t.isLeafNode()?(e=t.val(),ao("string"==typeof e||"number"==typeof e||"object"==typeof e&&Po(e,".sv"),"Priority must be a string or number.")):ao(t===Mu||t.isEmpty(),"priority of unexpected type."),ao(t===Mu||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},zu=(Object.defineProperty(Qu,"__childrenNodeConstructor",{get:function(){return Bu},set:function(t){Bu=t},enumerable:!1,configurable:!0}),Qu.prototype.isLeafNode=function(){return!0},Qu.prototype.getPriority=function(){return this.priorityNode_},Qu.prototype.updatePriority=function(t){return new Qu(this.value_,t)},Qu.prototype.getImmediateChild=function(t){return".priority"===t?this.priorityNode_:Qu.__childrenNodeConstructor.EMPTY_NODE},Qu.prototype.getChild=function(t){return uu(t)?this:".priority"===eu(t)?this.priorityNode_:Qu.__childrenNodeConstructor.EMPTY_NODE},Qu.prototype.hasChild=function(){return!1},Qu.prototype.getPredecessorChildName=function(t,e){return null},Qu.prototype.updateImmediateChild=function(t,e){return".priority"===t?this.updatePriority(e):e.isEmpty()&&".priority"!==t?this:Qu.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,e).updatePriority(this.priorityNode_)},Qu.prototype.updateChild=function(t,e){var n=eu(t);return null===n?e:e.isEmpty()&&".priority"!==n?this:(ao(".priority"!==n||1===nu(t),".priority must be the last token in a path"),this.updateImmediateChild(n,Qu.__childrenNodeConstructor.EMPTY_NODE.updateChild(ru(t),e)))},Qu.prototype.isEmpty=function(){return!1},Qu.prototype.numChildren=function(){return 0},Qu.prototype.forEachChild=function(t,e){return!1},Qu.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},Qu.prototype.hash=function(){var t,e;return null===this.lazyHash_&&(t="",this.priorityNode_.isEmpty()||(t+="priority:"+Vu(this.priorityNode_.val())+":"),t+=(e=typeof this.value_)+":",t+="number"==e?os(this.value_):this.value_,this.lazyHash_=La(t)),this.lazyHash_},Qu.prototype.getValue=function(){return this.value_},Qu.prototype.compareTo=function(t){return t===Qu.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof Qu.__childrenNodeConstructor?-1:(ao(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))},Qu.prototype.compareToLeafNode_=function(t){var e=typeof t.value_,n=typeof this.value_,r=Qu.VALUE_TYPE_ORDER.indexOf(e),i=Qu.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},Qu.prototype.withIndex=function(){return this},Qu.prototype.isIndexed=function(){return!0},Qu.prototype.equals=function(t){return t===this||!!t.isLeafNode()&&(this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_))},Qu.VALUE_TYPE_ORDER=["object","boolean","number","string"],Qu);function Qu(t,e){void 0===e&&(e=Qu.__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."),Gu(this.priorityNode_)}function Yu(){return null!==Hu&&Hu.apply(this,arguments)||this}var Xu=new(Xi(Yu,Hu=G),Yu.prototype.compare=function(t,e){var n=t.node.getPriority(),r=e.node.getPriority(),r=n.compareTo(r);return 0===r?ns(t.name,e.name):r},Yu.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},Yu.prototype.indexedValueChanged=function(t,e){return!t.getPriority().equals(e.getPriority())},Yu.prototype.minPost=function(){return Eu.MIN},Yu.prototype.maxPost=function(){return new Eu(es,new zu("[PRIORITY-POST]",Wu))},Yu.prototype.makePost=function(t,e){t=Ku(t);return new Eu(e,new zu("[PRIORITY-POST]",t))},Yu.prototype.toString=function(){return".priority"},Yu),Ju=Math.log(2),$u=(Zu.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<<this.current_);return this.current_--,t},Zu);function Zu(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/Ju,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 tc,ec,nc=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 Du(i,r.node,Du.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 Du(i,r.node,Du.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 Du(n,r.node,e,null,t))},o=function(t){e=e?e.left=t:n=t},a=0;a<t.count;++a){var s=t.nextBitIsOne(),u=Math.pow(2,t.count-(a+1));s?r(u,Du.BLACK):(r(u,Du.BLACK),r(u,Du.RED))}return n}(new $u(c.length));return new Fu(e||t,n)},rc={},ic=(Object.defineProperty(oc,"Default",{get:function(){return ao(Xu,"ChildrenNode.ts has not been loaded"),tc=tc||new oc({".priority":rc},{".priority":Xu})},enumerable:!1,configurable:!0}),oc.prototype.get=function(t){var e=Do(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e instanceof Fu?e:null},oc.prototype.hasIndex=function(t){return Po(this.indexSet_,t.toString())},oc.prototype.addIndex=function(t,e){ao(t!==Ru,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var n=[],r=!1,i=e.getIterator(Eu.Wrap),o=i.getNext();o;)r=r||t.isDefinedOn(o.node),n.push(o),o=i.getNext();var a=r?nc(n,t.getCompare()):rc,s=t.toString(),u=Ji({},this.indexSet_);u[s]=t;e=Ji({},this.indexes_);return e[s]=a,new oc(e,u)},oc.prototype.addToIndexes=function(a,s){var u=this;return new oc(Lo(this.indexes_,function(t,e){var n=Do(u.indexSet_,e);if(ao(n,"Missing index implementation for "+e),t===rc){if(n.isDefinedOn(a.node)){for(var r=[],i=s.getIterator(Eu.Wrap),o=i.getNext();o;)o.name!==a.name&&r.push(o),o=i.getNext();return r.push(a),nc(r,n.getCompare())}return rc}n=s.get(a.name);return(t=n?t.remove(new Eu(a.name,n)):t).insert(a,a.node)}),this.indexSet_)},oc.prototype.removeFromIndexes=function(n,r){return new oc(Lo(this.indexes_,function(t){if(t===rc)return t;var e=r.get(n.name);return e?t.remove(new Eu(n.name,e)):t}),this.indexSet_)},oc);function oc(t,e){this.indexes_=t,this.indexSet_=e}var ac,sc=(Object.defineProperty(uc,"EMPTY_NODE",{get:function(){return ec=ec||new uc(new Fu(qu),null,ic.Default)},enumerable:!1,configurable:!0}),uc.prototype.isLeafNode=function(){return!1},uc.prototype.getPriority=function(){return this.priorityNode_||ec},uc.prototype.updatePriority=function(t){return this.children_.isEmpty()?this:new uc(this.children_,t,this.indexMap_)},uc.prototype.getImmediateChild=function(t){if(".priority"===t)return this.getPriority();t=this.children_.get(t);return null===t?ec:t},uc.prototype.getChild=function(t){var e=eu(t);return null===e?this:this.getImmediateChild(e).getChild(ru(t))},uc.prototype.hasChild=function(t){return null!==this.children_.get(t)},uc.prototype.updateImmediateChild=function(t,e){if(ao(e,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(e);var n=new Eu(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()?ec:this.priorityNode_;return new uc(r,n,i)},uc.prototype.updateChild=function(t,e){var n=eu(t);if(null===n)return e;ao(".priority"!==eu(t)||1===nu(t),".priority must be the last token in a path");e=this.getImmediateChild(n).updateChild(ru(t),e);return this.updateImmediateChild(n,e)},uc.prototype.isEmpty=function(){return this.children_.isEmpty()},uc.prototype.numChildren=function(){return this.children_.count()},uc.prototype.val=function(n){if(this.isEmpty())return null;var r={},i=0,o=0,a=!0;if(this.forEachChild(Xu,function(t,e){r[t]=e.val(n),i++,a&&uc.INTEGER_REGEXP_.test(t)?o=Math.max(o,Number(t)):a=!1}),!n&&a&&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},uc.prototype.hash=function(){var n;return null===this.lazyHash_&&(n="",this.getPriority().isEmpty()||(n+="priority:"+Vu(this.getPriority().val())+":"),this.forEachChild(Xu,function(t,e){e=e.hash();""!==e&&(n+=":"+t+":"+e)}),this.lazyHash_=""===n?"":La(n)),this.lazyHash_},uc.prototype.getPredecessorChildName=function(t,e,n){n=this.resolveIndex_(n);if(n){e=n.getPredecessorKey(new Eu(t,e));return e?e.name:null}return this.children_.getPredecessorKey(t)},uc.prototype.getFirstChildName=function(t){t=this.resolveIndex_(t);if(t){t=t.minKey();return t&&t.name}return this.children_.minKey()},uc.prototype.getFirstChild=function(t){t=this.getFirstChildName(t);return t?new Eu(t,this.children_.get(t)):null},uc.prototype.getLastChildName=function(t){t=this.resolveIndex_(t);if(t){t=t.maxKey();return t&&t.name}return this.children_.maxKey()},uc.prototype.getLastChild=function(t){t=this.getLastChildName(t);return t?new Eu(t,this.children_.get(t)):null},uc.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)},uc.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},uc.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,Eu.Wrap),i=r.peek();null!=i&&e.compare(i,t)<0;)r.getNext(),i=r.peek();return r},uc.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},uc.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,Eu.Wrap),i=r.peek();null!=i&&0<e.compare(i,t);)r.getNext(),i=r.peek();return r},uc.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===hc?-1:0},uc.prototype.withIndex=function(t){if(t===Ru||this.indexMap_.hasIndex(t))return this;t=this.indexMap_.addIndex(t,this.children_);return new uc(this.children_,this.priorityNode_,t)},uc.prototype.isIndexed=function(t){return t===Ru||this.indexMap_.hasIndex(t)},uc.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(Xu),n=t.getIterator(Xu),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},uc.prototype.resolveIndex_=function(t){return t===Ru?null:this.indexMap_.get(t.toString())},uc.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,uc);function uc(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&Gu(this.priorityNode_),this.children_.isEmpty()&&ao(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}function cc(){return ac.call(this,new Fu(qu),sc.EMPTY_NODE,ic.Default)||this}var hc=new(Xi(cc,ac=sc),cc.prototype.compareTo=function(t){return t===this?0:1},cc.prototype.equals=function(t){return t===this},cc.prototype.getPriority=function(){return this},cc.prototype.getImmediateChild=function(t){return sc.EMPTY_NODE},cc.prototype.isEmpty=function(){return!1},cc);Object.defineProperties(Eu,{MIN:{value:new Eu(ts,sc.EMPTY_NODE)},MAX:{value:new Eu(es,hc)}}),Sn.__EMPTY_NODE=sc.EMPTY_NODE,zu.__childrenNodeConstructor=sc,Mu=hc,Wu=hc;var lc=!0;function fc(n,t){if(void 0===t&&(t=null),null===n)return sc.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 zu(n,fc(t));if(n instanceof Array||!lc){var r=sc.EMPTY_NODE;return is(n,function(t,e){Po(n,t)&&"."!==t.substring(0,1)&&(!(e=fc(e)).isLeafNode()&&e.isEmpty()||(r=r.updateImmediateChild(t,e)))}),r.updatePriority(fc(t))}var i=[],o=!1;if(is(n,function(t,e){"."!==t.substring(0,1)&&((e=fc(e)).isEmpty()||(o=o||!e.getPriority().isEmpty(),i.push(new Eu(t,e))))}),0===i.length)return sc.EMPTY_NODE;var e=nc(i,ju,function(t){return t.name},qu);if(o){var a=nc(i,Xu.getCompare());return new sc(e,fc(t),new ic({".priority":a},{".priority":Xu}))}return new sc(e,fc(t),ic.Default)}Ku=fc;var pc,dc,vc=(Xi(gc,pc=G),gc.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},gc.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},gc.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),r=n.compareTo(r);return 0===r?ns(t.name,e.name):r},gc.prototype.makePost=function(t,e){t=fc(t),t=sc.EMPTY_NODE.updateChild(this.indexPath_,t);return new Eu(e,t)},gc.prototype.maxPost=function(){var t=sc.EMPTY_NODE.updateChild(this.indexPath_,hc);return new Eu(es,t)},gc.prototype.toString=function(){return ou(this.indexPath_,0).join("/")},gc);function gc(t){var e=pc.call(this)||this;return e.indexPath_=t,ao(!uu(t)&&".priority"!==eu(t),"Can't create PathIndex with empty path or .priority key"),e}function yc(){return null!==dc&&dc.apply(this,arguments)||this}function mc(t){if(t===""+cs)return"-";var e=hs(t);if(null!=e)return""+(e+1);for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t.charAt(r);if(n.length<786)return n.push("-"),n.join("");for(var i=n.length-1;0<=i&&"z"===n[i];)i--;return-1===i?es:(e=n[i],e=Tc.charAt(Tc.indexOf(e)+1),n[i]=e,n.slice(0,i+1).join(""))}function bc(t){if(t===""+us)return ts;var e=hs(t);if(null!=e)return""+(e-1);for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t.charAt(r);return"-"===n[n.length-1]?1===n.length?""+cs:(delete n[n.length-1],n.join("")):(n[n.length-1]=Tc.charAt(Tc.indexOf(n[n.length-1])-1),n.join("")+"z".repeat(786-n.length))}var _c,wc,Ic=new(Xi(yc,dc=G),yc.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?ns(t.name,e.name):n},yc.prototype.isDefinedOn=function(t){return!0},yc.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},yc.prototype.minPost=function(){return Eu.MIN},yc.prototype.maxPost=function(){return Eu.MAX},yc.prototype.makePost=function(t,e){t=fc(t);return new Eu(e,t)},yc.prototype.toString=function(){return".value"},yc),Tc="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",Ec=(_c=0,wc=[],function(t){var e=t===_c;_c=t;for(var n=new Array(8),r=7;0<=r;r--)n[r]=Tc.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===wc[r];r--)wc[r]=0;wc[r]++}else for(r=0;r<12;r++)wc[r]=Math.floor(64*Math.random());for(r=0;r<12;r++)i+=Tc.charAt(wc[r]);return ao(20===i.length,"nextPushId: Length should be 20."),i});function Sc(t){return{type:"value",snapshotNode:t}}function Cc(t,e){return{type:"child_added",snapshotNode:e,childName:t}}function kc(t,e){return{type:"child_removed",snapshotNode:e,childName:t}}function Nc(t,e,n){return{type:"child_changed",snapshotNode:e,childName:t,oldSnap:n}}var Ac=(Rc.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 a=t.getImmediateChild(e);return a.getChild(r).equals(n.getChild(r))&&a.isEmpty()===n.isEmpty()?t:(null!=o&&(n.isEmpty()?t.hasChild(e)?o.trackChildChange(kc(e,a)):ao(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?o.trackChildChange(Cc(e,n)):o.trackChildChange(Nc(e,n,a))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},Rc.prototype.updateFullNode=function(r,n,i){return null!=i&&(r.isLeafNode()||r.forEachChild(Xu,function(t,e){n.hasChild(t)||i.trackChildChange(kc(t,e))}),n.isLeafNode()||n.forEachChild(Xu,function(t,e){var n;r.hasChild(t)?(n=r.getImmediateChild(t)).equals(e)||i.trackChildChange(Nc(t,e,n)):i.trackChildChange(Cc(t,e))})),n.withIndex(this.index_)},Rc.prototype.updatePriority=function(t,e){return t.isEmpty()?sc.EMPTY_NODE:t.updatePriority(e)},Rc.prototype.filtersNodes=function(){return!1},Rc.prototype.getIndexedFilter=function(){return this},Rc.prototype.getIndex=function(){return this.index_},Rc);function Rc(t){this.index_=t}var Oc=(Pc.prototype.getStartPost=function(){return this.startPost_},Pc.prototype.getEndPost=function(){return this.endPost_},Pc.prototype.matches=function(t){return this.index_.compare(this.getStartPost(),t)<=0&&this.index_.compare(t,this.getEndPost())<=0},Pc.prototype.updateChild=function(t,e,n,r,i,o){return this.matches(new Eu(e,n))||(n=sc.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,r,i,o)},Pc.prototype.updateFullNode=function(t,e,n){e.isLeafNode()&&(e=sc.EMPTY_NODE);var r=(r=e.withIndex(this.index_)).updatePriority(sc.EMPTY_NODE),i=this;return e.forEachChild(Xu,function(t,e){i.matches(new Eu(t,e))||(r=r.updateImmediateChild(t,sc.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,r,n)},Pc.prototype.updatePriority=function(t,e){return t},Pc.prototype.filtersNodes=function(){return!0},Pc.prototype.getIndexedFilter=function(){return this.indexedFilter_},Pc.prototype.getIndex=function(){return this.index_},Pc.getStartPost_=function(t){if(t.hasStart()){var e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()},Pc.getEndPost_=function(t){if(t.hasEnd()){var e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()},Pc);function Pc(t){this.indexedFilter_=new Ac(t.getIndex()),this.index_=t.getIndex(),this.startPost_=Pc.getStartPost_(t),this.endPost_=Pc.getEndPost_(t)}var Dc=(xc.prototype.updateChild=function(t,e,n,r,i,o){return this.rangedFilter_.matches(new Eu(e,n))||(n=sc.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)},xc.prototype.updateFullNode=function(t,e,n){if(e.isLeafNode()||e.isEmpty())r=sc.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<e.numChildren()&&e.isIndexed(this.index_)){var r=sc.EMPTY_NODE.withIndex(this.index_),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 a=i.getNext();if(!(this.reverse_?this.index_.compare(this.rangedFilter_.getStartPost(),a)<=0:this.index_.compare(a,this.rangedFilter_.getEndPost())<=0))break;r=r.updateImmediateChild(a.name,a.node),o++}}else{r=(r=e.withIndex(this.index_)).updatePriority(sc.EMPTY_NODE);var s,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(),s=this.index_.getCompare(),function(t,e){return s(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();){a=i.getNext();(l=!l&&h(u,a)<=0?!0:l)&&o<this.limit_&&h(a,c)<=0?o++:r=r.updateImmediateChild(a.name,sc.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,r,n)},xc.prototype.updatePriority=function(t,e){return t},xc.prototype.filtersNodes=function(){return!0},xc.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},xc.prototype.getIndex=function(){return this.index_},xc.prototype.fullLimitUpdateChild_=function(t,e,n,r,i){var o,a;a=this.reverse_?(o=this.index_.getCompare(),function(t,e){return o(e,t)}):this.index_.getCompare();var s=t;ao(s.numChildren()===this.limit_,"");var u=new Eu(e,n),c=this.reverse_?s.getFirstChild(this.index_):s.getLastChild(this.index_),h=this.rangedFilter_.matches(u);if(s.hasChild(e)){for(var l=s.getImmediateChild(e),f=r.getChildAfterChild(this.index_,c,this.reverse_);null!=f&&(f.name===e||s.hasChild(f.name));)f=r.getChildAfterChild(this.index_,f,this.reverse_);var p=null==f?1:a(f,u);if(h&&!n.isEmpty()&&0<=p)return null!=i&&i.trackChildChange(Nc(e,n,l)),s.updateImmediateChild(e,n);null!=i&&i.trackChildChange(kc(e,l));l=s.updateImmediateChild(e,sc.EMPTY_NODE);return null!=f&&this.rangedFilter_.matches(f)?(null!=i&&i.trackChildChange(Cc(f.name,f.node)),l.updateImmediateChild(f.name,f.node)):l}return!n.isEmpty()&&h&&0<=a(c,u)?(null!=i&&(i.trackChildChange(kc(c.name,c.node)),i.trackChildChange(Cc(e,n))),s.updateImmediateChild(e,n).updateImmediateChild(c.name,sc.EMPTY_NODE)):t},xc);function xc(t){this.rangedFilter_=new Oc(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft()}var Lc=(Mc.prototype.hasStart=function(){return this.startSet_},Mc.prototype.hasStartAfter=function(){return this.startAfterSet_},Mc.prototype.hasEndBefore=function(){return this.endBeforeSet_},Mc.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:"l"===this.viewFrom_},Mc.prototype.getIndexStartValue=function(){return ao(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},Mc.prototype.getIndexStartName=function(){return ao(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:ts},Mc.prototype.hasEnd=function(){return this.endSet_},Mc.prototype.getIndexEndValue=function(){return ao(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},Mc.prototype.getIndexEndName=function(){return ao(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:es},Mc.prototype.hasLimit=function(){return this.limitSet_},Mc.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},Mc.prototype.getLimit=function(){return ao(this.limitSet_,"Only valid if limit has been set"),this.limit_},Mc.prototype.getIndex=function(){return this.index_},Mc.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},Mc.prototype.isDefault=function(){return this.loadsAllData()&&this.index_===Xu},Mc.prototype.copy=function(){var t=new Mc;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},Mc);function Mc(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Xu}function Fc(t,e,n){t=t.copy();return t.startSet_=!0,void 0===e&&(e=null),t.indexStartValue_=e,null!=n?(t.startNameSet_=!0,t.indexStartName_=n):(t.startNameSet_=!1,t.indexStartName_=""),t}function Uc(t,e,n){t=t.copy();return t.endSet_=!0,void 0===e&&(e=null),t.indexEndValue_=e,void 0!==n?(t.endNameSet_=!0,t.indexEndName_=n):(t.endNameSet_=!1,t.indexEndName_=""),t}function jc(t,e){t=t.copy();return t.index_=e,t}function qc(t){var e,n={};return t.isDefault()||(e=t.index_===Xu?"$priority":t.index_===Ic?"$value":t.index_===Ru?"$key":(ao(t.index_ instanceof vc,"Unrecognized index type!"),t.index_.toString()),n.orderBy=Ro(e),t.startSet_&&(n.startAt=Ro(t.indexStartValue_),t.startNameSet_&&(n.startAt+=","+Ro(t.indexStartName_))),t.endSet_&&(n.endAt=Ro(t.indexEndValue_),t.endNameSet_&&(n.endAt+=","+Ro(t.indexEndName_))),t.limitSet_&&(t.isViewFromLeft()?n.limitToFirst=t.limit_:n.limitToLast=t.limit_)),n}function Vc(t){var e,n={};return t.startSet_&&(n.sp=t.indexStartValue_,t.startNameSet_&&(n.sn=t.indexStartName_)),t.endSet_&&(n.ep=t.indexEndValue_,t.endNameSet_&&(n.en=t.indexEndName_)),t.limitSet_&&(n.l=t.limit_,""===(e=t.viewFrom_)&&(e=t.isViewFromLeft()?"l":"r"),n.vf=e),t.index_!==Xu&&(n.i=t.index_.toString()),n}var Bc,Kc=(Xi(Wc,Bc=z),Wc.prototype.reportStats=function(t){throw new Error("Method not implemented.")},Wc.getListenId_=function(t,e){return void 0!==e?"tag$"+e:(ao(t._queryParams.isDefault(),"should have a tag if it's not a default query."),t._path.toString())},Wc.prototype.listen=function(t,e,n,r){var i=this,o=t._path.toString();this.log_("Listen called for "+o+" "+t._queryIdentifier);var a=Wc.getListenId_(t,n),s={};this.listens_[a]=s;t=qc(t._queryParams);this.restRequest_(o+".json",t,function(t,e){null===(t=404===t?e=null:t)&&i.onDataUpdate_(o,e,!1,n),Do(i.listens_,a)===s&&r(t?401===t?"permission_denied":"rest_error:"+t:"ok",null)})},Wc.prototype.unlisten=function(t,e){e=Wc.getListenId_(t,e);delete this.listens_[e]},Wc.prototype.get=function(t){var n=this,e=qc(t._queryParams),r=t._path.toString(),i=new lo;return this.restRequest_(r+".json",e,function(t,e){null===(t=404===t?e=null:t)?(n.onDataUpdate_(r,e,!1,null),i.resolve(e)):i.reject(new Error(e))}),i.promise},Wc.prototype.refreshAuthToken=function(t){},Wc.prototype.restRequest_=function(r,i,o){var a=this;(i=void 0===i?{}:i).format="export",this.authTokenProvider_.getToken(!1).then(function(t){t=t&&t.accessToken;t&&(i.auth=t);var e=(a.repoInfo_.secure?"https://":"http://")+a.repoInfo_.host+r+"?ns="+a.repoInfo_.namespace+Mo(i);a.log_("Sending REST request for "+e);var n=new XMLHttpRequest;n.onreadystatechange=function(){if(o&&4===n.readyState){a.log_("REST Response for "+e+" received. status:",n.status,"response:",n.responseText);var t=null;if(200<=n.status&&n.status<300){try{t=Ao(n.responseText)}catch(t){Za("Failed to parse JSON response for "+e+": "+n.responseText)}o(null,t)}else 401!==n.status&&404!==n.status&&Za("Got unsuccessful REST response for "+e+" Status: "+n.status),o(n.status);o=null}},n.open("GET",e,!0),n.send()})},Wc);function Wc(t,e,n){var r=Bc.call(this)||this;return r.repoInfo_=t,r.onDataUpdate_=e,r.authTokenProvider_=n,r.log_=Ja("p:rest:"),r.listens_={},r}var Hc=(Gc.prototype.getNode=function(t){return this.rootNode_.getChild(t)},Gc.prototype.updateSnapshot=function(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)},Gc);function Gc(){this.rootNode_=sc.EMPTY_NODE}function zc(){return{value:null,children:new Map}}function Qc(t,e,n){var r;uu(e)?(t.value=n,t.children.clear()):null!==t.value?t.value=t.value.updateChild(e,n):(r=eu(e),t.children.has(r)||t.children.set(r,zc()),Qc(t.children.get(r),e=ru(e),n))}function Yc(t,n,r){var i;null!==t.value?r(n,t.value):(i=function(t,e){Yc(e,new $s(n.toString()+"/"+t),r)},t.children.forEach(function(t,e){i(e,t)}))}var Xc=(Jc.prototype.get=function(){var t=this.collection_.get(),n=Ji({},t);return this.last_&&is(this.last_,function(t,e){n[t]=n[t]-e}),this.last_=t,n},Jc);function Jc(t){this.collection_=t,this.last_=null}var $c,Zc=(th.prototype.reportStats_=function(){var n=this,t=this.statsListener_.get(),r={},i=!1;is(t,function(t,e){0<e&&Po(n.statsToReport_,t)&&(r[t]=e,i=!0)}),i&&this.server_.reportStats(r),as(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},th);function th(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new Xc(t);t=1e4+2e4*Math.random();as(this.reportStats_.bind(this),Math.floor(t))}function eh(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function nh(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function rh(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}(Hs=$c=$c||{})[Hs.OVERWRITE=0]="OVERWRITE",Hs[Hs.MERGE=1]="MERGE",Hs[Hs.ACK_USER_WRITE=2]="ACK_USER_WRITE",Hs[Hs.LISTEN_COMPLETE=3]="LISTEN_COMPLETE";var ih=(oh.prototype.operationForChild=function(t){if(uu(this.path)){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 $s(t));return new oh(tu(),e,this.revert)}return ao(eu(this.path)===t,"operationForChild called for unrelated child."),new oh(ru(this.path),this.affectedTree,this.revert)},oh);function oh(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=$c.ACK_USER_WRITE,this.source=eh()}var ah=(sh.prototype.operationForChild=function(t){return uu(this.path)?new sh(this.source,tu()):new sh(this.source,ru(this.path))},sh);function sh(t,e){this.source=t,this.path=e,this.type=$c.LISTEN_COMPLETE}var uh=(ch.prototype.operationForChild=function(t){return uu(this.path)?new ch(this.source,tu(),this.snap.getImmediateChild(t)):new ch(this.source,ru(this.path),this.snap)},ch);function ch(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=$c.OVERWRITE}var hh=(lh.prototype.operationForChild=function(t){if(uu(this.path)){var e=this.children.subtree(new $s(t));return e.isEmpty()?null:e.value?new uh(this.source,tu(),e.value):new lh(this.source,tu(),e)}return ao(eu(this.path)===t,"Can't get a merge for a child not on the path of the operation"),new lh(this.source,ru(this.path),this.children)},lh.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},lh);function lh(t,e,n){this.source=t,this.path=e,this.children=n,this.type=$c.MERGE}var fh=(ph.prototype.isFullyInitialized=function(){return this.fullyInitialized_},ph.prototype.isFiltered=function(){return this.filtered_},ph.prototype.isCompleteForPath=function(t){if(uu(t))return this.isFullyInitialized()&&!this.filtered_;t=eu(t);return this.isCompleteForChild(t)},ph.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},ph.prototype.getNode=function(){return this.node_},ph);function ph(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}var dh,vh=function(t){this.query_=t,this.index_=this.query_._queryParams.getIndex()};function gh(n,t,e,r){var i=[],o=[];return t.forEach(function(t){var e;"child_changed"===t.type&&n.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push((e=t.childName,{type:"child_moved",snapshotNode:t.snapshotNode,childName:e}))}),yh(n,i,"child_removed",t,r,e),yh(n,i,"child_added",t,r,e),yh(n,i,"child_moved",o,r,e),yh(n,i,"child_changed",t,r,e),yh(n,i,"value",t,r,e),i}function yh(o,a,e,t,s,u){t=t.filter(function(t){return t.type===e});t.sort(function(t,e){return function(t,e,n){if(null==e.childName||null==n.childName)throw so("Should only compare child_ events.");e=new Eu(e.childName,e.snapshotNode),n=new Eu(n.childName,n.snapshotNode);return t.index_.compare(e,n)}(o,t,e)}),t.forEach(function(e){var t,n,r,i=(t=o,r=u,"value"===(n=e).type||"child_removed"===n.type||(n.prevName=r.getPredecessorChildName(n.childName,n.snapshotNode,t.index_)),n);s.forEach(function(t){t.respondsTo(e.type)&&a.push(t.createEvent(i,o.query_))})})}function mh(t,e){return{eventCache:t,serverCache:e}}function bh(t,e,n,r){return mh(new fh(e,n,r),t.serverCache)}function _h(t,e,n,r){return mh(t.eventCache,new fh(e,n,r))}function wh(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function Ih(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}var Th=(Eh.fromObject=function(t){var n=new Eh(null);return is(t,function(t,e){n=n.set(new $s(t),e)}),n},Eh.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},Eh.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:tu(),value:this.value};if(uu(t))return null;var n=eu(t),r=this.children.get(n);if(null===r)return null;e=r.findRootMostMatchingPathAndValue(ru(t),e);return null==e?null:{path:su(new $s(n),e.path),value:e.value}},Eh.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},Eh.prototype.subtree=function(t){if(uu(t))return this;var e=eu(t),e=this.children.get(e);return null!==e?e.subtree(ru(t)):new Eh(null)},Eh.prototype.set=function(t,e){if(uu(t))return new Eh(e,this.children);var n=eu(t),e=(this.children.get(n)||new Eh(null)).set(ru(t),e),e=this.children.insert(n,e);return new Eh(this.value,e)},Eh.prototype.remove=function(t){if(uu(t))return this.children.isEmpty()?new Eh(null):new Eh(null,this.children);var e=eu(t),n=this.children.get(e);if(n){n=n.remove(ru(t)),t=void 0,t=n.isEmpty()?this.children.remove(e):this.children.insert(e,n);return null===this.value&&t.isEmpty()?new Eh(null):new Eh(this.value,t)}return this},Eh.prototype.get=function(t){if(uu(t))return this.value;var e=eu(t),e=this.children.get(e);return e?e.get(ru(t)):null},Eh.prototype.setTree=function(t,e){if(uu(t))return e;var n=eu(t),t=(this.children.get(n)||new Eh(null)).setTree(ru(t),e),e=void 0,e=t.isEmpty()?this.children.remove(n):this.children.insert(n,t);return new Eh(this.value,e)},Eh.prototype.fold=function(t){return this.fold_(tu(),t)},Eh.prototype.fold_=function(n,r){var i={};return this.children.inorderTraversal(function(t,e){i[t]=e.fold_(su(n,t),r)}),r(n,this.value,i)},Eh.prototype.findOnPath=function(t,e){return this.findOnPath_(t,tu(),e)},Eh.prototype.findOnPath_=function(t,e,n){var r=!!this.value&&n(e,this.value);if(r)return r;if(uu(t))return null;var i=eu(t),r=this.children.get(i);return r?r.findOnPath_(ru(t),su(e,i),n):null},Eh.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,tu(),e)},Eh.prototype.foreachOnPath_=function(t,e,n){if(uu(t))return this;this.value&&n(e,this.value);var r=eu(t),i=this.children.get(r);return i?i.foreachOnPath_(ru(t),su(e,r),n):new Eh(null)},Eh.prototype.foreach=function(t){this.foreach_(tu(),t)},Eh.prototype.foreach_=function(n,r){this.children.inorderTraversal(function(t,e){e.foreach_(su(n,t),r)}),this.value&&r(n,this.value)},Eh.prototype.foreachChild=function(n){this.children.inorderTraversal(function(t,e){e.value&&n(t,e.value)})},Eh);function Eh(t,e){void 0===e&&(e=dh=dh||new Fu(Ua)),this.value=t,this.children=e}var Sh=(Ch.empty=function(){return new Ch(new Th(null))},Ch);function Ch(t){this.writeTree_=t}function kh(t,e,n){if(uu(e))return new Sh(new Th(n));var r=t.writeTree_.findRootMostValueAndPath(e);if(null!=r){var i=r.path,o=r.value,r=cu(i,e),o=o.updateChild(r,n);return new Sh(t.writeTree_.set(i,o))}n=new Th(n),n=t.writeTree_.setTree(e,n);return new Sh(n)}function Nh(t,n,e){var r=t;return is(e,function(t,e){r=kh(r,su(n,t),e)}),r}function Ah(t,e){if(uu(e))return Sh.empty();e=t.writeTree_.setTree(e,new Th(null));return new Sh(e)}function Rh(t,e){return null!=Oh(t,e)}function Oh(t,e){var n=t.writeTree_.findRootMostValueAndPath(e);return null!=n?t.writeTree_.get(n.path).getChild(cu(n.path,e)):null}function Ph(t){var n=[],e=t.writeTree_.value;return null!=e?e.isLeafNode()||e.forEachChild(Xu,function(t,e){n.push(new Eu(t,e))}):t.writeTree_.children.inorderTraversal(function(t,e){null!=e.value&&n.push(new Eu(t,e.value))}),n}function Dh(t,e){if(uu(e))return t;var n=Oh(t,e);return new Sh(null!=n?new Th(n):t.writeTree_.subtree(e))}function xh(t){return t.writeTree_.isEmpty()}function Lh(t,e){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(su(r,t),e,i)}),i=!i.getChild(r).isEmpty()&&null!==o?i.updateChild(su(r,".priority"),o):i}}(tu(),t.writeTree_,e)}function Mh(t,e){return Qh(e,t)}function Fh(e,n){var t=e.allWrites.findIndex(function(t){return t.writeId===n});ao(0<=t,"removeWrite called with nonexistent writeId.");var r=e.allWrites[t];e.allWrites.splice(t,1);for(var i,o=r.visible,a=!1,s=e.allWrites.length-1;o&&0<=s;){var u=e.allWrites[s];u.visible&&(t<=s&&function(t,e){{if(t.snap)return fu(t.path,e);for(var n in t.children)if(t.children.hasOwnProperty(n)&&fu(su(t.path,n),e))return!0;return!1}}(u,r.path)?o=!1:fu(r.path,u.path)&&(a=!0)),s--}return!!o&&(a?((i=e).visibleWrites=jh(i.allWrites,Uh,tu()),0<i.allWrites.length?i.lastWriteId=i.allWrites[i.allWrites.length-1].writeId:i.lastWriteId=-1):r.snap?e.visibleWrites=Ah(e.visibleWrites,r.path):is(r.children,function(t){e.visibleWrites=Ah(e.visibleWrites,su(r.path,t))}),!0)}function Uh(t){return t.visible}function jh(t,e,n){for(var r=Sh.empty(),i=0;i<t.length;++i){var o=t[i];if(e(o)){var a=o.path,s=void 0;if(o.snap)fu(n,a)?r=kh(r,s=cu(n,a),o.snap):fu(a,n)&&(s=cu(a,n),r=kh(r,tu(),o.snap.getChild(s)));else{if(!o.children)throw so("WriteRecord should have .snap or .children");fu(n,a)?r=Nh(r,s=cu(n,a),o.children):fu(a,n)&&(uu(s=cu(a,n))?r=Nh(r,tu(),o.children):(o=Do(o.children,eu(s)))&&(s=o.getChild(ru(s)),r=kh(r,tu(),s)))}}}return r}function qh(t,e,n,r,i){if(r||i){var o=Dh(t.visibleWrites,e);if(!i&&xh(o))return n;if(i||null!=n||Rh(o,tu()))return Lh(jh(t.allWrites,function(t){return(t.visible||i)&&(!r||!~r.indexOf(t.writeId))&&(fu(t.path,e)||fu(e,t.path))},e),n||sc.EMPTY_NODE);return null}o=Oh(t.visibleWrites,e);if(null!=o)return o;t=Dh(t.visibleWrites,e);return xh(t)?n:null!=n||Rh(t,tu())?Lh(t,n||sc.EMPTY_NODE):null}function Vh(t,e,n,r){return qh(t.writeTree,t.treePath,e,n,r)}function Bh(t,e){return function(t,e,n){var r=sc.EMPTY_NODE,i=Oh(t.visibleWrites,e);if(i)return i.isLeafNode()||i.forEachChild(Xu,function(t,e){r=r.updateImmediateChild(t,e)}),r;if(n){var o=Dh(t.visibleWrites,e);return n.forEachChild(Xu,function(t,e){e=Lh(Dh(o,new $s(t)),e);r=r.updateImmediateChild(t,e)}),Ph(o).forEach(function(t){r=r.updateImmediateChild(t.name,t.node)}),r}return Ph(Dh(t.visibleWrites,e)).forEach(function(t){r=r.updateImmediateChild(t.name,t.node)}),r}(t.writeTree,t.treePath,e)}function Kh(t,e,n,r){return i=t.writeTree,t=t.treePath,e=e,r=r,ao(n||r,"Either existingEventSnap or existingServerSnap must exist"),t=su(t,e),Rh(i.visibleWrites,t)?null:xh(t=Dh(i.visibleWrites,t))?r.getChild(e):Lh(t,r.getChild(e));var i}function Wh(t,e){return n=t.writeTree,e=su(t.treePath,e),Oh(n.visibleWrites,e);var n}function Hh(t,e,n,r,i,o){return function(t,e,n,r,i,o,a){var s,t=Dh(t.visibleWrites,e);if(null!=(e=Oh(t,tu())))s=e;else{if(null==n)return[];s=Lh(t,n)}if((s=s.withIndex(a)).isEmpty()||s.isLeafNode())return[];for(var u=[],c=a.getCompare(),h=o?s.getReverseIteratorFrom(r,a):s.getIteratorFrom(r,a),l=h.getNext();l&&u.length<i;)0!==c(l,r)&&u.push(l),l=h.getNext();return u}(t.writeTree,t.treePath,e,n,r,i,o)}function Gh(t,e,n){return r=t.writeTree,i=t.treePath,t=n,e=su(i,n=e),null!=(i=Oh(r.visibleWrites,e))?i:t.isCompleteForChild(n)?Lh(Dh(r.visibleWrites,e),t.getNode().getImmediateChild(n)):null;var r,i}function zh(t,e){return Qh(su(t.treePath,e),t.writeTree)}function Qh(t,e){return{treePath:t,writeTree:e}}var Yh=(Xh.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;ao("child_added"===e||"child_changed"===e||"child_removed"===e,"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("child_added"===e&&"child_removed"===i)this.changeMap.set(n,Nc(n,t.snapshotNode,r.snapshotNode));else if("child_removed"===e&&"child_added"===i)this.changeMap.delete(n);else if("child_removed"===e&&"child_changed"===i)this.changeMap.set(n,kc(n,r.oldSnap));else if("child_changed"===e&&"child_added"===i)this.changeMap.set(n,Cc(n,t.snapshotNode));else{if("child_changed"!==e||"child_changed"!==i)throw so("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap.set(n,Nc(n,t.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,t)},Xh.prototype.getChanges=function(){return Array.from(this.changeMap.values())},Xh);function Xh(){this.changeMap=new Map}function Jh(){}var $h=new(Jh.prototype.getCompleteChild=function(t){return null},Jh.prototype.getChildAfterChild=function(t,e,n){return null},Jh),Zh=(tl.prototype.getCompleteChild=function(t){var e=this.viewCache_.eventCache;if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);e=null!=this.optCompleteServerCache_?new fh(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return Gh(this.writes_,t,e)},tl.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:Ih(this.viewCache_),t=Hh(this.writes_,r,e,1,n,t);return 0===t.length?null:t[0]},tl);function tl(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}function el(t,e,n,r,i){var o,a,s,u,c,h,l,f,p=new Yh;if(n.type===$c.OVERWRITE)var d=n,v=d.source.fromUser?il(t,e,d.path,d.snap,r,i,p):(ao(d.source.fromServer,"Unknown source."),o=d.source.tagged||e.serverCache.isFiltered()&&!uu(d.path),rl(t,e,d.path,d.snap,r,i,o,p));else if(n.type===$c.MERGE){var g=n;v=g.source.fromUser?(a=t,s=e,u=g.path,d=g.children,c=r,h=i,l=p,f=s,d.foreach(function(t,e){t=su(u,t);ol(s,eu(t))&&(f=il(a,f,t,e,c,h,l))}),d.foreach(function(t,e){t=su(u,t);ol(s,eu(t))||(f=il(a,f,t,e,c,h,l))}),f):(ao(g.source.fromServer,"Unknown source."),o=g.source.tagged||e.serverCache.isFiltered(),sl(t,e,g.path,g.children,r,i,o,p))}else if(n.type===$c.ACK_USER_WRITE){var y=n;v=y.revert?function(t,e,n,r,i,o){var a;{if(null!=Wh(r,n))return e;var s,u,c=new Zh(r,e,i),h=e.eventCache.getNode(),i=void 0;return uu(n)||".priority"===eu(n)?(u=void 0,u=e.serverCache.isFullyInitialized()?Vh(r,Ih(e)):(s=e.serverCache.getNode(),ao(s instanceof sc,"serverChildren would be complete if leaf node"),Bh(r,s)),i=t.filter.updateFullNode(h,u,o)):(s=eu(n),null==(u=Gh(r,s,e.serverCache))&&e.serverCache.isCompleteForChild(s)&&(u=h.getImmediateChild(s)),(i=null!=u?t.filter.updateChild(h,s,u,ru(n),c,o):e.eventCache.getNode().hasChild(s)?t.filter.updateChild(h,s,sc.EMPTY_NODE,ru(n),c,o):h).isEmpty()&&e.serverCache.isFullyInitialized()&&(a=Vh(r,Ih(e))).isLeafNode()&&(i=t.filter.updateFullNode(i,a,o))),a=e.serverCache.isFullyInitialized()||null!=Wh(r,tu()),bh(e,i,a,t.filter.filtersNodes())}}(t,e,y.path,r,i,p):function(t,e,r,n,i,o,a){if(null!=Wh(i,r))return e;var s=e.serverCache.isFiltered(),u=e.serverCache;{if(null!=n.value){if(uu(r)&&u.isFullyInitialized()||u.isCompleteForPath(r))return rl(t,e,r,u.getNode().getChild(r),i,o,s,a);if(uu(r)){var c=new Th(null);return u.getNode().forEachChild(Ru,function(t,e){c=c.set(new $s(t),e)}),sl(t,e,r,c,i,o,s,a)}return e}var h=new Th(null);return n.foreach(function(t,e){var n=su(r,t);u.isCompleteForPath(n)&&(h=h.set(t,u.getNode().getChild(n)))}),sl(t,e,r,h,i,o,s,a)}}(t,e,y.path,y.affectedTree,r,i,p)}else{if(n.type!==$c.LISTEN_COMPLETE)throw so("Unknown operation type: "+n.type);o=t,y=e,i=n.path,t=r,n=p,r=y.serverCache,r=_h(y,r.getNode(),r.isFullyInitialized()||uu(i),r.isFiltered()),v=nl(o,r,i,t,$h,n)}p=p.getChanges();return function(t,e,n){var r=e.eventCache;{var i,o;r.isFullyInitialized()&&(i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=wh(t),(0<n.length||!t.eventCache.isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(Sc(wh(e))))}}(e,v,p),{viewCache:v,changes:p}}function nl(t,e,n,r,i,o){var a=e.eventCache;if(null!=Wh(r,n))return e;var s,u,c,h,l=void 0,f=void 0;return l=uu(n)?(ao(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()?(s=Bh(r,(s=Ih(e))instanceof sc?s:sc.EMPTY_NODE),t.filter.updateFullNode(e.eventCache.getNode(),s,o)):(u=Vh(r,Ih(e)),t.filter.updateFullNode(e.eventCache.getNode(),u,o))):".priority"===(u=eu(n))?(ao(1===nu(n),"Can't have a priority with additional path components"),null!=(h=Kh(r,n,c=a.getNode(),f=e.serverCache.getNode()))?t.filter.updatePriority(c,h):a.getNode()):(c=ru(n),h=void 0,null!=(h=a.isCompleteForChild(u)?(f=e.serverCache.getNode(),null!=(f=Kh(r,n,a.getNode(),f))?a.getNode().getImmediateChild(u).updateChild(c,f):a.getNode().getImmediateChild(u)):Gh(r,u,e.serverCache))?t.filter.updateChild(a.getNode(),u,h,c,i,o):a.getNode()),bh(e,l,a.isFullyInitialized()||uu(n),t.filter.filtersNodes())}function rl(t,e,n,r,i,o,a,s){var u=e.serverCache,c=a?t.filter:t.filter.getIndexedFilter();if(uu(n))l=c.updateFullNode(u.getNode(),r,null);else if(c.filtersNodes()&&!u.isFiltered())var h=u.getNode().updateChild(n,r),l=c.updateFullNode(u.getNode(),h,null);else{a=eu(n);if(!u.isCompleteForPath(n)&&1<nu(n))return e;h=ru(n),r=u.getNode().getImmediateChild(a).updateChild(h,r);l=".priority"===a?c.updatePriority(u.getNode(),r):c.updateChild(u.getNode(),a,r,h,$h,null)}c=_h(e,l,u.isFullyInitialized()||uu(n),c.filtersNodes());return nl(t,c,n,i,new Zh(i,c,o),s)}function il(t,e,n,r,i,o,a){var s,u,c=e.eventCache,h=new Zh(i,e,o);return uu(n)?(u=t.filter.updateFullNode(e.eventCache.getNode(),r,a),bh(e,u,!0,t.filter.filtersNodes())):".priority"===(s=eu(n))?(u=t.filter.updatePriority(e.eventCache.getNode(),r),bh(e,u,c.isFullyInitialized(),c.isFiltered())):(i=ru(n),o=c.getNode().getImmediateChild(s),u=void 0,u=uu(i)?r:null!=(n=h.getCompleteChild(s))?".priority"===iu(i)&&n.getChild(au(i)).isEmpty()?n:n.updateChild(i,r):sc.EMPTY_NODE,o.equals(u)?e:bh(e,t.filter.updateChild(c.getNode(),s,u,i,h,a),c.isFullyInitialized(),t.filter.filtersNodes()))}function ol(t,e){return t.eventCache.isCompleteForChild(e)}function al(t,n,e){return e.foreach(function(t,e){n=n.updateChild(t,e)}),n}function sl(r,i,t,e,o,a,s,u){if(i.serverCache.getNode().isEmpty()&&!i.serverCache.isFullyInitialized())return i;var c=i,e=uu(t)?e:new Th(null).setTree(t,e),h=i.serverCache.getNode();return e.children.inorderTraversal(function(t,e){h.hasChild(t)&&(e=al(0,i.serverCache.getNode().getImmediateChild(t),e),c=rl(r,c,new $s(t),e,o,a,s,u))}),e.children.inorderTraversal(function(t,e){var n=!i.serverCache.isCompleteForChild(t)&&void 0===e.value;h.hasChild(t)||n||(e=al(0,i.serverCache.getNode().getImmediateChild(t),e),c=rl(r,c,new $s(t),e,o,a,s,u))}),c}var ul,cl=(Object.defineProperty(hl.prototype,"query",{get:function(){return this.query_},enumerable:!1,configurable:!0}),hl);function hl(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_._queryParams,r=new Ac(n.getIndex()),i=(o=n).loadsAllData()?new Ac(o.getIndex()):new(o.hasLimit()?Dc:Oc)(o);this.processor_={filter:i};var t=e.serverCache,n=e.eventCache,o=r.updateFullNode(sc.EMPTY_NODE,t.getNode(),null),e=i.updateFullNode(sc.EMPTY_NODE,n.getNode(),null),r=new fh(o,t.isFullyInitialized(),r.filtersNodes()),i=new fh(e,n.isFullyInitialized(),i.filtersNodes());this.viewCache_=mh(i,r),this.eventGenerator_=new vh(this.query_)}function ll(t){return 0===t.eventRegistrations_.length}function fl(t,e,n){var r,i=[];if(n&&(ao(null==e,"A cancel should cancel all event registrations."),r=t.query._path,t.eventRegistrations_.forEach(function(t){t=t.createCancelEvent(n,r);t&&i.push(t)})),e){for(var o=[],a=0;a<t.eventRegistrations_.length;++a){var s=t.eventRegistrations_[a];if(s.matches(e)){if(e.hasAnyCallback()){o=o.concat(t.eventRegistrations_.slice(a+1));break}}else o.push(s)}t.eventRegistrations_=o}else t.eventRegistrations_=[];return i}function pl(t,e,n,r){e.type===$c.MERGE&&null!==e.source.queryId&&(ao(Ih(t.viewCache_),"We should always have a full cache before handling merges"),ao(wh(t.viewCache_),"Missing event cache, even though we have a server cache"));var i=t.viewCache_,e=el(t.processor_,i,e,n,r);return n=t.processor_,r=e.viewCache,ao(r.eventCache.getNode().isIndexed(n.filter.getIndex()),"Event snap not indexed"),ao(r.serverCache.getNode().isIndexed(n.filter.getIndex()),"Server snap not indexed"),ao(e.viewCache.serverCache.isFullyInitialized()||!i.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=e.viewCache,dl(t,e.changes,e.viewCache.eventCache.getNode(),null)}function dl(t,e,n,r){r=r?[r]:t.eventRegistrations_;return gh(t.eventGenerator_,e,n,r)}var vl,gl=function(){this.views=new Map};function yl(t,e,n,r){var i,o,a=e.source.queryId;if(null!==a){var s=t.views.get(a);return ao(null!=s,"SyncTree gave us an op for an invalid query."),pl(s,e,n,r)}var u=[];try{for(var c=to(t.views.values()),h=c.next();!h.done;h=c.next())s=h.value,u=u.concat(pl(s,e,n,r))}catch(t){i={error:t}}finally{try{h&&!h.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}return u}function ml(t,e,n,r,i){var o=e._queryIdentifier,t=t.views.get(o);if(t)return t;o=Vh(n,i?r:null),t=!1,t=!!o||(o=r instanceof sc?Bh(n,r):sc.EMPTY_NODE,!1),i=mh(new fh(o,t,!1),new fh(r,i,!1));return new cl(e,i)}function bl(t,e,n,r,i,o){var a,o=ml(t,e,r,i,o);return t.views.has(e._queryIdentifier)||t.views.set(e._queryIdentifier,o),e=n,o.eventRegistrations_.push(e),e=n,o=(n=o).viewCache_.eventCache,a=[],o.getNode().isLeafNode()||o.getNode().forEachChild(Xu,function(t,e){a.push(Cc(t,e))}),o.isFullyInitialized()&&a.push(Sc(o.getNode())),dl(n,a,o.getNode(),e)}function _l(t,e,n,r){var i,o,a=e._queryIdentifier,s=[],u=[],c=Sl(t);if("default"===a)try{for(var h=to(t.views.entries()),l=h.next();!l.done;l=h.next()){var f=eo(l.value,2),p=f[0],d=f[1],u=u.concat(fl(d,n,r));ll(d)&&(t.views.delete(p),d.query._queryParams.loadsAllData()||s.push(d.query))}}catch(t){i={error:t}}finally{try{l&&!l.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}else(d=t.views.get(a))&&(u=u.concat(fl(d,n,r)),ll(d)&&(t.views.delete(a),d.query._queryParams.loadsAllData()||s.push(d.query)));return c&&!Sl(t)&&s.push((ao(ul,"Reference.ts has not been loaded"),new ul(e._repo,e._path))),{removed:s,events:u}}function wl(t){var e,n,r=[];try{for(var i=to(t.views.values()),o=i.next();!o.done;o=i.next()){var a=o.value;a.query._queryParams.loadsAllData()||r.push(a)}}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 Il(t,e){var n,r,i,o,a=null;try{for(var s=to(t.views.values()),u=s.next();!u.done;u=s.next())var c=u.value,a=a||(i=e,o=void 0,(o=Ih((c=c).viewCache_))&&(c.query._queryParams.loadsAllData()||!uu(i)&&!o.getImmediateChild(eu(i)).isEmpty())?o.getChild(i):null)}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return a}function Tl(t,e){if(e._queryParams.loadsAllData())return Cl(t);e=e._queryIdentifier;return t.views.get(e)}function El(t,e){return null!=Tl(t,e)}function Sl(t){return null!=Cl(t)}function Cl(t){var e,n;try{for(var r=to(t.views.values()),i=r.next();!i.done;i=r.next()){var o=i.value;if(o.query._queryParams.loadsAllData())return o}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return null}var kl=1,Nl=function(t){this.listenProvider_=t,this.syncPointTree_=new Th(null),this.pendingWriteTree_={visibleWrites:Sh.empty(),allWrites:[],lastWriteId:-1},this.tagToQueryMap=new Map,this.queryToTagMap=new Map};function Al(t,e,n,r,i){var o,a,s,u;return o=t.pendingWriteTree_,a=e,s=n,u=i,ao((r=r)>o.lastWriteId,"Stacking an older write on top of newer ones"),void 0===u&&(u=!0),o.allWrites.push({path:a,snap:s,writeId:r,visible:u}),u&&(o.visibleWrites=kh(o.visibleWrites,a,s)),o.lastWriteId=r,i?Fl(t,new uh(eh(),e,n)):[]}function Rl(t,e,n,r){var i,o,a;i=t.pendingWriteTree_,o=e,a=n,ao((r=r)>i.lastWriteId,"Stacking an older merge on top of newer ones"),i.allWrites.push({path:o,children:a,writeId:r,visible:!0}),i.visibleWrites=Nh(i.visibleWrites,o,a),i.lastWriteId=r;n=Th.fromObject(n);return Fl(t,new hh(eh(),e,n))}function Ol(t,e,n){void 0===n&&(n=!1);var r=function(t,e){for(var n=0;n<t.allWrites.length;n++){var r=t.allWrites[n];if(r.writeId===e)return r}return null}(t.pendingWriteTree_,e);if(Fh(t.pendingWriteTree_,e)){var i=new Th(null);return null!=r.snap?i=i.set(tu(),!0):is(r.children,function(t){i=i.set(new $s(t),!0)}),Fl(t,new ih(r.path,i,n))}return[]}function Pl(t,e,n){return Fl(t,new uh(nh(),e,n))}function Dl(n,t,e,r){var i=t._path,o=n.syncPointTree_.get(i),a=[];if(o&&("default"===t._queryIdentifier||El(o,t))){var s=_l(o,t,e,r);0===o.views.size&&(n.syncPointTree_=n.syncPointTree_.remove(i));e=s.removed,a=s.events,o=-1!==e.findIndex(function(t){return t._queryParams.loadsAllData()}),s=n.syncPointTree_.findOnPath(i,function(t,e){return Sl(e)});if(o&&!s){i=n.syncPointTree_.subtree(i);if(!i.isEmpty())for(var u=i.fold(function(t,e,n){if(e&&Sl(e))return[Cl(e)];var r=[];return e&&(r=wl(e)),is(n,function(t,e){r=r.concat(e)}),r}),c=0;c<u.length;++c){var h=u[c],l=h.query,h=jl(n,h);n.listenProvider_.startListening(Hl(l),ql(n,l),h.hashFn,h.onComplete)}}!s&&0<e.length&&!r&&(o?n.listenProvider_.stopListening(Hl(t),null):e.forEach(function(t){var e=n.queryToTagMap.get(Vl(t));n.listenProvider_.stopListening(Hl(t),e)})),function(t,e){for(var n=0;n<e.length;++n){var r,i=e[n];i._queryParams.loadsAllData()||(r=Vl(i),i=t.queryToTagMap.get(r),t.queryToTagMap.delete(r),t.tagToQueryMap.delete(i))}}(n,e)}return a}function xl(t,e,n){var r=e._path,i=null,o=!1;t.syncPointTree_.foreachOnPath(r,function(t,e){t=cu(t,r);i=i||Il(e,t),o=o||Sl(e)});var a=t.syncPointTree_.get(r);a?(o=o||Sl(a),i=i||Il(a,tu())):(a=new gl,t.syncPointTree_=t.syncPointTree_.set(r,a)),null!=i?h=!0:(h=!1,i=sc.EMPTY_NODE,t.syncPointTree_.subtree(r).foreachChild(function(t,e){e=Il(e,tu());e&&(i=i.updateImmediateChild(t,e))}));var s,u,c=El(a,e);c||e._queryParams.loadsAllData()||(s=Vl(e),ao(!t.queryToTagMap.has(s),"View does not exist, but we have a tag"),u=kl++,t.queryToTagMap.set(s,u),t.tagToQueryMap.set(u,s));var h=bl(a,e,n,Mh(t.pendingWriteTree_,r),i,h);return c||o||(a=Tl(a,e),h=h.concat(function(t,e,n){var r=e._path,i=ql(t,e),n=jl(t,n),n=t.listenProvider_.startListening(Hl(e),i,n.hashFn,n.onComplete),r=t.syncPointTree_.subtree(r);if(i)ao(!Sl(r.value),"If we're adding a query, it shouldn't be shadowed");else for(var o=r.fold(function(t,e,n){if(!uu(t)&&e&&Sl(e))return[Cl(e).query];var r=[];return e&&(r=r.concat(wl(e).map(function(t){return t.query}))),is(n,function(t,e){r=r.concat(e)}),r}),a=0;a<o.length;++a){var s=o[a];t.listenProvider_.stopListening(Hl(s),ql(t,s))}return n}(t,e,a))),h}function Ll(t,n,e){var r=t.pendingWriteTree_,t=t.syncPointTree_.findOnPath(n,function(t,e){t=Il(e,cu(t,n));if(t)return t});return qh(r,n,t,e,!0)}function Ml(t,e){var n=e._path,r=null;t.syncPointTree_.foreachOnPath(n,function(t,e){t=cu(t,n);r=r||Il(e,t)});var i=t.syncPointTree_.get(n);i?r=r||Il(i,tu()):(i=new gl,t.syncPointTree_=t.syncPointTree_.set(n,i));var o=null!=r,a=o?new fh(r,!0,!1):null,o=ml(i,e,Mh(t.pendingWriteTree_,e._path),o?a.getNode():sc.EMPTY_NODE,o);return wh(o.viewCache_)}function Fl(t,e){return function t(e,n,r,i){{if(uu(e.path))return Ul(e,n,r,i);var o=n.get(tu());null==r&&null!=o&&(r=Il(o,tu()));var a=[],s=eu(e.path),u=e.operationForChild(s),c=n.children.get(s);return c&&u&&(n=r?r.getImmediateChild(s):null,s=zh(i,s),a=a.concat(t(u,c,n,s))),a=o?a.concat(yl(o,e,i,r)):a}}(e,t.syncPointTree_,null,Mh(t.pendingWriteTree_,tu()))}function Ul(i,t,o,a){var e=t.get(tu());null==o&&null!=e&&(o=Il(e,tu()));var s=[];return t.children.inorderTraversal(function(t,e){var n=o?o.getImmediateChild(t):null,r=zh(a,t),t=i.operationForChild(t);t&&(s=s.concat(Ul(t,e,n,r)))}),s=e?s.concat(yl(e,i,a,o)):s}function jl(r,t){var i=t.query,o=ql(r,i);return{hashFn:function(){return(t.viewCache_.serverCache.getNode()||sc.EMPTY_NODE).hash()},onComplete:function(t){if("ok"===t)return o?function(t,e,n){var r=Bl(t,n);if(r){n=Kl(r),r=n.path,n=n.queryId,e=cu(r,e);return Wl(t,r,new ah(rh(n),e))}return[]}(r,i._path,o):(e=r,n=i._path,Fl(e,new ah(nh(),n)));var e,n,n=(n="Unknown Error","too_big"===(t=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 "+i._path.toString()+": "+n)).code=t.toUpperCase(),n);return Dl(r,i,null,n)}}}function ql(t,e){e=Vl(e);return t.queryToTagMap.get(e)}function Vl(t){return t._path.toString()+"$"+t._queryIdentifier}function Bl(t,e){return t.tagToQueryMap.get(e)}function Kl(t){var e=t.indexOf("$");return ao(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new $s(t.substr(0,e))}}function Wl(t,e,n){var r=t.syncPointTree_.get(e);return ao(r,"Missing sync point for query tag that we're tracking"),yl(r,n,Mh(t.pendingWriteTree_,e),null)}function Hl(t){return t._queryParams.loadsAllData()&&!t._queryParams.isDefault()?(ao(vl,"Reference.ts has not been loaded"),new vl(t._repo,t._path)):t}var Gl=(zl.prototype.getImmediateChild=function(t){return new zl(this.node_.getImmediateChild(t))},zl.prototype.node=function(){return this.node_},zl);function zl(t){this.node_=t}var Ql=(Yl.prototype.getImmediateChild=function(t){t=su(this.path_,t);return new Yl(this.syncTree_,t)},Yl.prototype.node=function(){return Ll(this.syncTree_,this.path_)},Yl);function Yl(t,e){this.syncTree_=t,this.path_=e}var Jl=function(t){return(t=t||{}).timestamp=t.timestamp||(new Date).getTime(),t},$l=function(t,e,n){return t&&"object"==typeof t?(ao(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?Zl(t[".sv"],e,n):"object"==typeof t[".sv"]?tf(t[".sv"],e):void ao(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},Zl=function(t,e,n){if("timestamp"===t)return n.timestamp;ao(!1,"Unexpected server value: "+t)},tf=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},ef=function(t,e,n,r){return rf(e,new Ql(n,t),r)},nf=function(t,e,n){return rf(t,new Gl(e),n)};function rf(t,r,i){var e=t.getPriority().val(),n=$l(e,r.getImmediateChild(".priority"),i);if(t.isLeafNode()){var o=t,e=$l(o.getValue(),r,i);return e!==o.getValue()||n!==o.getPriority().val()?new zu(e,fc(n)):t}var t=t,a=t;return n!==t.getPriority().val()&&(a=a.updatePriority(new zu(n))),t.forEachChild(Xu,function(t,e){var n=rf(e,r.getImmediateChild(t),i);n!==e&&(a=a.updateImmediateChild(t,n))}),a}var of=function(t,e,n){void 0===t&&(t=""),void 0===e&&(e=null),void 0===n&&(n={children:{},childCount:0}),this.name=t,this.parent=e,this.node=n};function af(t,e){for(var n=e instanceof $s?e:new $s(e),r=t,i=eu(n);null!==i;)var o=Do(r.node.children,i)||{children:{},childCount:0},r=new of(i,r,o),i=eu(n=ru(n));return r}function sf(t){return t.node.value}function uf(t,e){t.node.value=e,ff(t)}function cf(t){return 0<t.node.childCount}function hf(n,r){is(n.node.children,function(t,e){r(new of(t,n,e))})}function lf(t){return new $s(null===t.parent?t.name:lf(t.parent)+"/"+t.name)}function ff(t){var e,n,r,i;null!==t.parent&&(e=t.parent,n=t.name,i=function(t){return void 0===sf(t)&&!cf(t)}(r=t),t=Po(e.node.children,n),i&&t?(delete e.node.children[n],e.node.childCount--,ff(e)):i||t||(e.node.children[n]=r.node,e.node.childCount++,ff(e)))}function pf(t){return"string"==typeof t&&0!==t.length&&!mf.test(t)}function df(t){return"string"==typeof t&&0!==t.length&&!bf.test(t)}function vf(t,e,n,r){if(!r||void 0!==e){var i=Wo(t,"values");if(!e||"object"!=typeof e||Array.isArray(e))throw new Error(i+" must be an object containing the children to replace.");var o=[];is(e,function(t,e){t=new $s(t);if(Tf(i,e,su(n,t)),".priority"===iu(t)&&!wf(e))throw new Error(i+"contains an invalid value for '"+t.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");o.push(t)}),function(t,e){for(var n=0;n<e.length;n++)for(var r,i=ou(r=e[n]),o=0;o<i.length;o++)if((".priority"!==i[o]||o!==i.length-1)&&!pf(i[o]))throw new Error(t+"contains an invalid key ("+i[o]+") in path "+r.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');e.sort(hu);var a=null;for(n=0;n<e.length;n++){if(r=e[n],null!==a&&fu(a,r))throw new Error(t+"contains a path "+a.toString()+" that is ancestor of another path "+r.toString());a=r}}(i,o)}}function gf(t,e,n){if(!n||void 0!==e){if(Fa(e))throw new Error(Wo(t,"priority")+"is "+e.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!wf(e))throw new Error(Wo(t,"priority")+"must be a valid Firebase priority (a string, finite number, server value, or null).")}}function yf(t,e,n,r){if(!(r&&void 0===n||pf(n)))throw new Error(Wo(t,e)+'was an invalid key = "'+n+'".  Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')}var mf=/[\[\].#$\/\u0000-\u001F\u007F]/,bf=/[\[\].#$\u0000-\u001F\u007F]/,_f=10485760,wf=function(t){return null===t||"string"==typeof t||"number"==typeof t&&!Fa(t)||t&&"object"==typeof t&&Po(t,".sv")},If=function(t,e,n,r){r&&void 0===e||Tf(Wo(t,"value"),e,n)},Tf=function(r,t,e){var i=e instanceof $s?new pu(e,r):e;if(void 0===t)throw new Error(r+"contains undefined "+vu(i));if("function"==typeof t)throw new Error(r+"contains a function "+vu(i)+" with contents = "+t.toString());if(Fa(t))throw new Error(r+"contains "+t.toString()+" "+vu(i));if("string"==typeof t&&t.length>_f/3&&zo(t)>_f)throw new Error(r+"contains a string greater than "+_f+" utf8 bytes "+vu(i)+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){var o=!1,a=!1;if(is(t,function(t,e){if(".value"===t)o=!0;else if(".priority"!==t&&".sv"!==t&&(a=!0,!pf(t)))throw new Error(r+" contains an invalid key ("+t+") "+vu(i)+'.  Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');var n;n=t,0<(t=i).parts_.length&&(t.byteLength_+=1),t.parts_.push(n),t.byteLength_+=zo(n),du(t),Tf(r,e,i),e=(t=i).parts_.pop(),t.byteLength_-=zo(e),0<t.parts_.length&&--t.byteLength_}),o&&a)throw new Error(r+' contains ".value" child '+vu(i)+" in addition to actual children.")}},Ef=function(t,e,n,r){if(!(r&&void 0===n||df(n)))throw new Error(Wo(t,e)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},Sf=function(t,e,n,r){n=n&&n.replace(/^\/*\.info(\/|$)/,"/"),Ef(t,e,n,r)},Cf=function(t,e){if(".info"===eu(e))throw new Error(t+" failed = Can't modify data under /.info/")},kf=function(t,e){var n=e.path.toString();if("string"!=typeof e.repoInfo.host||0===e.repoInfo.host.length||!pf(e.repoInfo.namespace)&&"localhost"!==e.repoInfo.host.split(":")[0]||0!==n.length&&(n=(n=n)&&n.replace(/^\/*\.info(\/|$)/,"/"),!df(n)))throw new Error(Wo(t,"url")+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')},Nf=function(){this.eventLists_=[],this.recursionDepth_=0};function Af(t,e){for(var n=null,r=0;r<e.length;r++){var i=e[r],o=i.getPath();null===n||lu(o,n.path)||(t.eventLists_.push(n),n=null),(n=null===n?{events:[],path:o}:n).events.push(i)}n&&t.eventLists_.push(n)}function Rf(t,e,n){Af(t,n),Pf(t,function(t){return lu(t,e)})}function Of(t,e,n){Af(t,n),Pf(t,function(t){return fu(t,e)||fu(e,t)})}function Pf(t,e){t.recursionDepth_++;for(var n=!0,r=0;r<t.eventLists_.length;r++){var i=t.eventLists_[r];i&&(e(i.path)?(function(t){for(var e=0;e<t.events.length;e++){var n,r=t.events[e];null!==r&&(t.events[e]=null,n=r.getEventRunner(),za&&Xa("event: "+r.toString()),ls(n))}}(t.eventLists_[r]),t.eventLists_[r]=null):n=!1)}n&&(t.eventLists_=[]),t.recursionDepth_--}var Df="repo_interrupt",xf=25,Lf=(Mf.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},Mf);function Mf(t,e,n){this.repoInfo_=t,this.forceRestClient_=e,this.authTokenProvider_=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Nf,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=zc(),this.transactionQueueTree_=new of,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}function Ff(a,t,e){if(a.stats_=Cs(a.repoInfo_),a.forceRestClient_||0<=("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i))a.server_=new Kc(a.repoInfo_,function(t,e,n,r){qf(a,t,e,n,r)},a.authTokenProvider_),setTimeout(function(){return Vf(a,!0)},0);else{if(null!=e){if("object"!=typeof e)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{Ro(e)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}a.persistentConnection_=new Iu(a.repoInfo_,t,function(t,e,n,r){qf(a,t,e,n,r)},function(t){Vf(a,t)},function(t){var n;n=a,is(t,function(t,e){Bf(n,t,e)})},a.authTokenProvider_,e),a.server_=a.persistentConnection_}var n;a.authTokenProvider_.addTokenChangeListener(function(t){a.server_.refreshAuthToken(t)}),a.statsReporter_=(n=a.repoInfo_,t=function(){return new Zc(a.stats_,a.server_)},n=n.toString(),Ss[n]||(Ss[n]=t()),Ss[n]),a.infoData_=new Hc,a.infoSyncTree_=new Nl({startListening:function(t,e,n,r){var i=[],o=a.infoData_.getNode(t._path);return o.isEmpty()||(i=Pl(a.infoSyncTree_,t._path,o),setTimeout(function(){r("ok")},0)),i},stopListening:function(){}}),Bf(a,"connected",!1),a.serverSyncTree_=new Nl({startListening:function(n,t,e,r){return a.server_.listen(n,e,t,function(t,e){e=r(t,e);Of(a.eventQueue_,n._path,e)}),[]},stopListening:function(t,e){a.server_.unlisten(t,e)}})}function Uf(t){t=t.infoData_.getNode(new $s(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t}function jf(t){return Jl({timestamp:Uf(t)})}function qf(t,e,n,r,i){t.dataUpdateCount++;var o=new $s(e);n=t.interceptServerDataCallback_?t.interceptServerDataCallback_(e,n):n;var a,s,u,c=[],h=o;0<(c=i?r?(a=Lo(n,function(t){return fc(t)}),function(t,e,n,r){var i=Bl(t,r);if(i){r=Kl(i),i=r.path,r=r.queryId,e=cu(i,e),n=Th.fromObject(n);return Wl(t,i,new hh(rh(r),e,n))}return[]}(t.serverSyncTree_,o,a,i)):(e=fc(n),a=t.serverSyncTree_,s=o,u=e,null==(i=Bl(a,e=i))?[]:(e=Kl(i),i=e.path,e=e.queryId,s=cu(i,s),Wl(a,i,new uh(rh(e),s,u)))):r?(s=Lo(n,function(t){return fc(t)}),u=t.serverSyncTree_,r=o,s=s,s=Th.fromObject(s),Fl(u,new hh(nh(),r,s))):(n=fc(n),Pl(t.serverSyncTree_,o,n))).length&&(h=Zf(t,o)),Of(t.eventQueue_,h,c)}function Vf(t,e){Bf(t,"connected",e),!1===e&&function(n){Yf(n,"onDisconnectEvents");var r=jf(n),i=zc();Yc(n.onDisconnect_,tu(),function(t,e){e=ef(t,e,n.serverSyncTree_,r);Qc(i,t,e)});var o=[];Yc(i,tu(),function(t,e){o=o.concat(Pl(n.serverSyncTree_,t,e));t=rp(n,t);Zf(n,t)}),n.onDisconnect_=zc(),Of(n.eventQueue_,tu(),o)}(t)}function Bf(t,e,n){e=new $s("/.info/"+e),n=fc(n);t.infoData_.updateSnapshot(e,n);n=Pl(t.infoSyncTree_,e,n);Of(t.eventQueue_,e,n)}function Kf(t){return t.nextWriteId_++}function Wf(r,i,t,e,o){Yf(r,"set",{path:i.toString(),value:t,priority:e});var n=jf(r),t=fc(t,e),e=Ll(r.serverSyncTree_,i),n=nf(t,e,n),a=Kf(r),n=Al(r.serverSyncTree_,i,n,a,!0);Af(r.eventQueue_,n),r.server_.put(i.toString(),t.val(!0),function(t,e){var n="ok"===t;n||Za("set at "+i+" failed: "+t);n=Ol(r.serverSyncTree_,a,!n);Of(r.eventQueue_,i,n),Xf(0,o,t,e)});t=rp(r,i);Zf(r,t),Of(r.eventQueue_,t,[])}function Hf(n,r,i){n.server_.onDisconnectCancel(r.toString(),function(t,e){"ok"===t&&!function t(n,e){if(uu(e))return n.value=null,n.children.clear(),!0;if(null!==n.value){if(n.value.isLeafNode())return!1;var r=n.value;return n.value=null,r.forEachChild(Xu,function(t,e){Qc(n,new $s(t),e)}),t(n,e)}if(0<n.children.size)return r=eu(e),e=ru(e),n.children.has(r)&&t(n.children.get(r),e)&&n.children.delete(r),0===n.children.size;return!0}(n.onDisconnect_,r),Xf(0,i,t,e)})}function Gf(n,r,t,i){var o=fc(t);n.server_.onDisconnectPut(r.toString(),o.val(!0),function(t,e){"ok"===t&&Qc(n.onDisconnect_,r,o),Xf(0,i,t,e)})}function zf(t,e,n){n=".info"===eu(e._path)?Dl(t.infoSyncTree_,e,n):Dl(t.serverSyncTree_,e,n);Rf(t.eventQueue_,e._path,n)}function Qf(t){t.persistentConnection_&&t.persistentConnection_.interrupt(Df)}function Yf(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r="";t.persistentConnection_&&(r=t.persistentConnection_.id+":"),Xa.apply(void 0,no([r],eo(e)))}function Xf(t,n,r,i){n&&ls(function(){var t,e;"ok"===r?n(null):(e=t=(r||"error").toUpperCase(),i&&(e+=": "+i),(e=new Error(e)).code=t,n(e))})}function Jf(t,e,n){return Ll(t.serverSyncTree_,e,n)||sc.EMPTY_NODE}function $f(e,t){var n;(t=void 0===t?e.transactionQueueTree_:t)||np(e,t),sf(t)?(n=ep(e,t),ao(0<n.length,"Sending zero length transaction queue"),n.every(function(t){return 0===t.status})&&function(i,o,a){for(var t=a.map(function(t){return t.currentWriteId}),e=Jf(i,o,t),n=e,t=e.hash(),r=0;r<a.length;r++){var s=a[r];ao(0===s.status,"tryToSendTransactionQueue_: items in queue should all be run."),s.status=1,s.retryCount++;var u=cu(o,s.path);n=n.updateChild(u,s.currentOutputSnapshotRaw)}var e=n.val(!0),c=o;i.server_.put(c.toString(),e,function(t){Yf(i,"transaction put response",{path:c.toString(),status:t});var e=[];if("ok"===t){for(var n=[],r=0;r<a.length;r++)!function(t){a[t].status=2,e=e.concat(Ol(i.serverSyncTree_,a[t].currentWriteId)),a[t].onComplete&&n.push(function(){return a[t].onComplete(null,!0,a[t].currentOutputSnapshotResolved)}),a[t].unwatcher()}(r);np(i,af(i.transactionQueueTree_,o)),$f(i,i.transactionQueueTree_),Of(i.eventQueue_,o,e);for(r=0;r<n.length;r++)ls(n[r])}else{if("datastale"===t)for(r=0;r<a.length;r++)3===a[r].status?a[r].status=4:a[r].status=0;else{Za("transaction at "+c.toString()+" failed: "+t);for(r=0;r<a.length;r++)a[r].status=4,a[r].abortReason=t}Zf(i,o)}},t)}(e,lf(t),n)):cf(t)&&hf(t,function(t){$f(e,t)})}function Zf(t,e){var n=tp(t,e),e=lf(n);return function(u,c,h){if(0===c.length)return;for(var l=[],f=[],p=c.filter(function(t){return 0===t.status}).map(function(t){return t.currentWriteId}),t=0;t<c.length;t++)!function(t){var e,n,r,i,o=c[t],a=cu(h,o.path),s=!1;ao(null!==a,"rerunTransactionsUnderNode_: relativePath should not be null."),4===o.status?(s=!0,e=o.abortReason,f=f.concat(Ol(u.serverSyncTree_,o.currentWriteId,!0))):0===o.status&&(f=o.retryCount>=xf?(s=!0,e="maxretry",f.concat(Ol(u.serverSyncTree_,o.currentWriteId,!0))):(n=Jf(u,o.path,p),o.currentInputSnapshot=n,void 0!==(i=c[t].update(n.val()))?(Tf("transaction failed: Data returned ",i,o.path),r=fc(i),"object"==typeof i&&null!=i&&Po(i,".priority")||(r=r.updatePriority(n.getPriority())),a=o.currentWriteId,i=jf(u),i=nf(r,n,i),o.currentOutputSnapshotRaw=r,o.currentOutputSnapshotResolved=i,o.currentWriteId=Kf(u),p.splice(p.indexOf(a),1),(f=f.concat(Al(u.serverSyncTree_,o.path,i,o.currentWriteId,o.applyLocally))).concat(Ol(u.serverSyncTree_,a,!0))):(s=!0,e="nodata",f.concat(Ol(u.serverSyncTree_,o.currentWriteId,!0))))),Of(u.eventQueue_,h,f),f=[],s&&(c[t].status=2,s=c[t].unwatcher,setTimeout(s,Math.floor(0)),c[t].onComplete&&("nodata"===e?l.push(function(){return c[t].onComplete(null,!1,c[t].currentInputSnapshot)}):l.push(function(){return c[t].onComplete(new Error(e),!1,null)})))}(t);np(u,u.transactionQueueTree_);for(t=0;t<l.length;t++)ls(l[t]);$f(u,u.transactionQueueTree_)}(t,ep(t,n),e),e}function tp(t,e){for(var n=t.transactionQueueTree_,r=eu(e);null!==r&&void 0===sf(n);)n=af(n,r),r=eu(e=ru(e));return n}function ep(t,e){var n=[];return function e(n,t,r){var i=sf(t);if(i)for(var o=0;o<i.length;o++)r.push(i[o]);hf(t,function(t){e(n,t,r)})}(t,e,n),n.sort(function(t,e){return t.order-e.order}),n}function np(e,t){var n=sf(t);if(n){for(var r=0,i=0;i<n.length;i++)2!==n[i].status&&(n[r]=n[i],r++);n.length=r,uf(t,0<n.length?n:void 0)}hf(t,function(t){np(e,t)})}function rp(e,t){var n=lf(tp(e,t)),t=af(e.transactionQueueTree_,t);return function(t,e,n){for(var r=n?t:t.parent;null!==r;){if(e(r))return;r=r.parent}}(t,function(t){ip(e,t)}),ip(e,t),function e(t,n,r,i){r&&!i&&n(t),hf(t,function(t){e(t,n,!0,i)}),r&&i&&n(t)}(t,function(t){ip(e,t)}),n}function ip(t,e){var n=sf(e);if(n){for(var r=[],i=[],o=-1,a=0;a<n.length;a++)3===n[a].status||(1===n[a].status?(ao(o===a-1,"All SENT items should be at beginning of queue."),n[o=a].status=3,n[a].abortReason="set"):(ao(0===n[a].status,"Unexpected transaction status in abort"),n[a].unwatcher(),i=i.concat(Ol(t.serverSyncTree_,n[a].currentWriteId,!0)),n[a].onComplete&&r.push(n[a].onComplete.bind(null,new Error("set"),!1,null))));-1===o?uf(e,void 0):n.length=o+1,Of(t.eventQueue_,lf(e),i);for(a=0;a<r.length;a++)ls(r[a])}}var op=function(t,e){var n=ap(t),r=n.namespace;"firebase.com"===n.domain&&$a(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),r&&"undefined"!==r||"localhost"===n.domain||$a("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:")&&Za("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");t="ws"===n.scheme||"wss"===n.scheme;return{repoInfo:new bs(n.host,n.secure,r,e,t,"",r!==n.subdomain),path:new $s(n.pathString)}},ap=function(t){var e,n,r,i="",o="",a="",s="",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&&(s=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=to(t.split("&")),o=i.next();!o.done;o=i.next()){var a,s=o.value;0!==s.length&&(2===(a=s.split("=")).length?r[decodeURIComponent(a[0])]=decodeURIComponent(a[1]):Za("Invalid query segment '"+s+"' in query '"+t+"'"))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}(t.substring(Math.min(t.length,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("."),a=i.substring(0,r).toLowerCase(),o=i.substring(r+1),u=a),"ns"in n&&(u=n.ns)),{host:i,port:l,domain:o,subdomain:a,secure:c,scheme:h,pathString:s,namespace:u}},sp=(up.prototype.getPath=function(){var t=this.snapshot.ref;return("value"===this.eventType?t:t.parent)._path},up.prototype.getEventType=function(){return this.eventType},up.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},up.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+Ro(this.snapshot.exportVal())},up);function up(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}var cp=(hp.prototype.getPath=function(){return this.path},hp.prototype.getEventType=function(){return"cancel"},hp.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},hp.prototype.toString=function(){return this.path.toString()+":cancel"},hp);function hp(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}var lp=(fp.prototype.onValue=function(t,e){this.snapshotCallback.call(null,t,e)},fp.prototype.onCancel=function(t){return ao(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,t)},Object.defineProperty(fp.prototype,"hasCancelCallback",{get:function(){return!!this.cancelCallback},enumerable:!1,configurable:!0}),fp.prototype.matches=function(t){return this.snapshotCallback===t.snapshotCallback||this.snapshotCallback.userCallback===t.snapshotCallback.userCallback&&this.snapshotCallback.context===t.snapshotCallback.context},fp);function fp(t,e){this.snapshotCallback=t,this.cancelCallback=e}var pp=(dp.prototype.cancel=function(){var t=new lo;return Hf(this._repo,this._path,t.wrapCallback(function(){})),t.promise},dp.prototype.remove=function(){Cf("OnDisconnect.remove",this._path);var t=new lo;return Gf(this._repo,this._path,null,t.wrapCallback(function(){})),t.promise},dp.prototype.set=function(t){Cf("OnDisconnect.set",this._path),If("OnDisconnect.set",t,this._path,!1);var e=new lo;return Gf(this._repo,this._path,t,e.wrapCallback(function(){})),e.promise},dp.prototype.setWithPriority=function(t,e){Cf("OnDisconnect.setWithPriority",this._path),If("OnDisconnect.setWithPriority",t,this._path,!1),gf("OnDisconnect.setWithPriority",e,!1);var n,r,i,o,a=new lo;return n=this._repo,r=this._path,t=t,e=e,i=a.wrapCallback(function(){}),o=fc(t,e),n.server_.onDisconnectPut(r.toString(),o.val(!0),function(t,e){"ok"===t&&Qc(n.onDisconnect_,r,o),Xf(0,i,t,e)}),a.promise},dp.prototype.update=function(t){Cf("OnDisconnect.update",this._path),vf("OnDisconnect.update",t,this._path,!1);var e=new lo;return function(n,r,i,o){if(xo(i))return Xa("onDisconnect().update() called with empty data.  Don't do anything."),Xf(0,o,"ok",void 0);n.server_.onDisconnectMerge(r.toString(),i,function(t,e){"ok"===t&&is(i,function(t,e){e=fc(e);Qc(n.onDisconnect_,su(r,t),e)}),Xf(0,o,t,e)})}(this._repo,this._path,t,e.wrapCallback(function(){})),e.promise},dp);function dp(t,e){this._repo=t,this._path=e}var vp=(Object.defineProperty(gp.prototype,"key",{get:function(){return uu(this._path)?null:iu(this._path)},enumerable:!1,configurable:!0}),Object.defineProperty(gp.prototype,"ref",{get:function(){return new wp(this._repo,this._path)},enumerable:!1,configurable:!0}),Object.defineProperty(gp.prototype,"_queryIdentifier",{get:function(){var t=Vc(this._queryParams),t=rs(t);return"{}"===t?"default":t},enumerable:!1,configurable:!0}),Object.defineProperty(gp.prototype,"_queryObject",{get:function(){return Vc(this._queryParams)},enumerable:!1,configurable:!0}),gp.prototype.isEqual=function(t){if(!((t=Zo(t))instanceof gp))return!1;var e=this._repo===t._repo,n=lu(this._path,t._path),t=this._queryIdentifier===t._queryIdentifier;return e&&n&&t},gp.prototype.toJSON=function(){return this.toString()},gp.prototype.toString=function(){return this._repo.toString()+function(t){for(var e="",n=t.pieceNum_;n<t.pieces_.length;n++)""!==t.pieces_[n]&&(e+="/"+encodeURIComponent(String(t.pieces_[n])));return e||"/"}(this._path)},gp);function gp(t,e,n,r){this._repo=t,this._path=e,this._queryParams=n,this._orderByCalled=r}function yp(t,e){if(!0===t._orderByCalled)throw new Error(e+": You can't combine multiple orderBy calls.")}function mp(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===Ru){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(), startAfter(), endAt(), endBefore(), or equalTo() must be a string.";if(t.hasStart()){if(t.getIndexStartName()!==ts)throw new Error(r);if("string"!=typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!==es)throw new Error(r);if("string"!=typeof n)throw new Error(i)}}else if(t.getIndex()===Xu){if(null!=e&&!wf(e)||null!=n&&!wf(n))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), startAfter() endAt(), endBefore(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(ao(t.getIndex()instanceof vc||t.getIndex()===Ic,"unknown index type."),null!=e&&"object"==typeof e||null!=n&&"object"==typeof n)throw new Error("Query: First argument passed to startAt(), startAfter(), endAt(), endBefore(), or equalTo() cannot be an object.")}function bp(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), startAfter(), endAt(), endBefore(), and limit(). Use limitToFirst() or limitToLast() instead.")}var _p,wp=(Xi(Ip,_p=vp),Object.defineProperty(Ip.prototype,"parent",{get:function(){var t=au(this._path);return null===t?null:new Ip(this._repo,t)},enumerable:!1,configurable:!0}),Object.defineProperty(Ip.prototype,"root",{get:function(){for(var t=this;null!==t.parent;)t=t.parent;return t},enumerable:!1,configurable:!0}),Ip);function Ip(t,e){return _p.call(this,t,e,new Lc,!1)||this}var Tp=(Object.defineProperty(Ep.prototype,"priority",{get:function(){return this._node.getPriority().val()},enumerable:!1,configurable:!0}),Object.defineProperty(Ep.prototype,"key",{get:function(){return this.ref.key},enumerable:!1,configurable:!0}),Object.defineProperty(Ep.prototype,"size",{get:function(){return this._node.numChildren()},enumerable:!1,configurable:!0}),Ep.prototype.child=function(t){var e=new $s(t),t=kp(this.ref,t);return new Ep(this._node.getChild(e),t,Xu)},Ep.prototype.exists=function(){return!this._node.isEmpty()},Ep.prototype.exportVal=function(){return this._node.val(!0)},Ep.prototype.forEach=function(n){var r=this;return!this._node.isLeafNode()&&!!this._node.forEachChild(this._index,function(t,e){return n(new Ep(e,kp(r.ref,t),Xu))})},Ep.prototype.hasChild=function(t){t=new $s(t);return!this._node.getChild(t).isEmpty()},Ep.prototype.hasChildren=function(){return!this._node.isLeafNode()&&!this._node.isEmpty()},Ep.prototype.toJSON=function(){return this.exportVal()},Ep.prototype.val=function(){return this._node.val()},Ep);function Ep(t,e,n){this._node=t,this.ref=e,this._index=n}function Sp(t,e){return(t=Zo(t))._checkNotDeleted("ref"),void 0!==e?kp(t._root,e):t._root}function Cp(t,e){(t=Zo(t))._checkNotDeleted("refFromURL");var n=op(e,t._repo.repoInfo_.nodeAdmin);kf("refFromURL",n);e=n.repoInfo;return t._repo.repoInfo_.isCustomHost()||e.host===t._repo.repoInfo_.host||$a("refFromURL: Host name does not match the current database: (found "+e.host+" but expected "+t._repo.repoInfo_.host+")"),Sp(t,n.path.toString())}function kp(t,e){return(null===eu((t=Zo(t))._path)?Sf:Ef)("child","path",e,!1),new wp(t._repo,su(t._path,e))}function Np(t,e){t=Zo(t),Cf("set",t._path),If("set",e,t._path,!1);var n=new lo;return Wf(t._repo,t._path,e,null,n.wrapCallback(function(){})),n.promise}function Ap(t,e){vf("update",e,t._path,!1);var n=new lo;return function(i,o,t,a){Yf(i,"update",{path:o.toString(),value:t});var s,e,n=!0,r=jf(i),u={};is(t,function(t,e){n=!1,u[t]=ef(su(o,t),fc(e),i.serverSyncTree_,r)}),n?(Xa("update() called with empty data.  Don't do anything."),Xf(0,a,"ok",void 0)):(s=Kf(i),e=Rl(i.serverSyncTree_,o,u,s),Af(i.eventQueue_,e),i.server_.merge(o.toString(),t,function(t,e){var n="ok"===t;n||Za("update at "+o+" failed: "+t);var r=Ol(i.serverSyncTree_,s,!n),n=0<r.length?Zf(i,o):o;Of(i.eventQueue_,n,r),Xf(0,a,t,e)}),is(t,function(t){t=rp(i,su(o,t));Zf(i,t)}),Of(i.eventQueue_,o,[]))}(t._repo,t._path,e,n.wrapCallback(function(){})),n.promise}function Rp(e){return e=Zo(e),n=e._repo,r=e,(null!=(t=Ml(n.serverSyncTree_,r))?Promise.resolve(t):n.server_.get(r).then(function(t){var e=fc(t),t=Pl(n.serverSyncTree_,r._path,e);return Rf(n.eventQueue_,r._path,t),Promise.resolve(e)},function(t){return Yf(n,"get for query "+Ro(r)+" failed: "+t),Promise.reject(new Error(t))})).then(function(t){return new Tp(t,new wp(e._repo,e._path),e._queryParams.getIndex())});var n,r,t}var Op=(Pp.prototype.respondsTo=function(t){return"value"===t},Pp.prototype.createEvent=function(t,e){var n=e._queryParams.getIndex();return new sp("value",this,new Tp(t.snapshotNode,new wp(e._repo,e._path),n))},Pp.prototype.getEventRunner=function(t){var e=this;return"cancel"===t.getEventType()?function(){return e.callbackContext.onCancel(t.error)}:function(){return e.callbackContext.onValue(t.snapshot,null)}},Pp.prototype.createCancelEvent=function(t,e){return this.callbackContext.hasCancelCallback?new cp(this,t,e):null},Pp.prototype.matches=function(t){return t instanceof Pp&&(!t.callbackContext||!this.callbackContext||t.callbackContext.matches(this.callbackContext))},Pp.prototype.hasAnyCallback=function(){return null!==this.callbackContext},Pp);function Pp(t){this.callbackContext=t}var Dp=(xp.prototype.respondsTo=function(t){t="children_removed"===(t="children_added"===t?"child_added":t)?"child_removed":t;return Po(this.callbacks,t)},xp.prototype.createCancelEvent=function(t,e){return this.callbacks.cancel.hasCancelCallback?new cp(this,t,e):null},xp.prototype.createEvent=function(t,e){ao(null!=t.childName,"Child events should have a childName.");var n=kp(new wp(e._repo,e._path),t.childName),e=e._queryParams.getIndex();return new sp(t.type,this,new Tp(t.snapshotNode,n,e),t.prevName)},xp.prototype.getEventRunner=function(t){if("cancel"===t.getEventType()){var e=this.callbacks.cancel;return function(){return e.onCancel(t.error)}}var n=this.callbacks[t.eventType];return function(){return n.onValue(t.snapshot,t.prevName)}},xp.prototype.matches=function(e){var n=this;if(e instanceof xp){if(!this.callbacks||!e.callbacks)return!0;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].matches(n.callbacks[t])});t=t[0],r=r[0];return r===t&&(!e.callbacks[t]||!this.callbacks[r]||e.callbacks[t].matches(this.callbacks[r]))}}return!1},xp.prototype.hasAnyCallback=function(){return null!==this.callbacks},xp);function xp(t){this.callbacks=t}function Lp(n,t,e,r,i){var o;"object"==typeof r&&(s=void 0,i=r),"function"==typeof r&&(s=r),i&&i.onlyOnce&&((i=function(t,e){o(t,e),zf(n._repo,n,u)}).userCallback=(o=e).userCallback,i.context=e.context,e=i);var a,s=new lp(e,s||void 0),u="value"===t?new Op(s):new Dp(((a={})[t]=s,a));return t=n._repo,s=u,s=".info"===eu((a=n)._path)?xl(t.infoSyncTree_,a,s):xl(t.serverSyncTree_,a,s),Rf(t.eventQueue_,a._path,s),function(){return zf(n._repo,n,u)}}function Mp(t,e,n,r){return Lp(t,"value",e,n,r)}function Fp(t,e,n,r){return Lp(t,"child_added",e,n,r)}function Up(t,e,n,r){return Lp(t,"child_changed",e,n,r)}function jp(t,e,n,r){return Lp(t,"child_moved",e,n,r)}function qp(t,e,n,r){return Lp(t,"child_removed",e,n,r)}function Vp(t,e,n){var r=null,i=null,o=n?new lp(n):null;"value"===e?r=new Op(o):e&&(n&&((i={})[e]=o),r=new Dp(i)),zf(t._repo,t,r)}var Bp,Sn=function(){},Kp=(Xi(Wp,Bp=Sn),Wp.prototype._apply=function(t){If("endAt",this._value,t._path,!0);var e=Uc(t._queryParams,this._value,this._key);if(bp(e),mp(e),t._queryParams.hasEnd())throw new Error("endAt: Starting point was already set (by another call to endAt, endBefore or equalTo).");return new vp(t._repo,t._path,e,t._orderByCalled)},Wp);function Wp(t,e){var n=Bp.call(this)||this;return n._value=t,n._key=e,n}var Hp,Gp=(Xi(zp,Hp=Sn),zp.prototype._apply=function(t){If("endBefore",this._value,t._path,!1);var e,n,r,r=(e=t._queryParams,n=this._value,r=this._key,(r=e.index_===Ru?Uc(e,n="string"==typeof n?bc(n):n,r):Uc(e,n,null==r?ts:bc(r))).endBeforeSet_=!0,r);if(bp(r),mp(r),t._queryParams.hasEnd())throw new Error("endBefore: Starting point was already set (by another call to endAt, endBefore or equalTo).");return new vp(t._repo,t._path,r,t._orderByCalled)},zp);function zp(t,e){var n=Hp.call(this)||this;return n._value=t,n._key=e,n}var Qp,Yp=(Xi(Xp,Qp=Sn),Xp.prototype._apply=function(t){If("startAt",this._value,t._path,!0);var e=Fc(t._queryParams,this._value,this._key);if(bp(e),mp(e),t._queryParams.hasStart())throw new Error("startAt: Starting point was already set (by another call to startAt, startBefore or equalTo).");return new vp(t._repo,t._path,e,t._orderByCalled)},Xp);function Xp(t,e){var n=Qp.call(this)||this;return n._value=t,n._key=e,n}var Jp,$p=(Xi(Zp,Jp=Sn),Zp.prototype._apply=function(t){If("startAfter",this._value,t._path,!1);var e,n,r,r=(e=t._queryParams,n=this._value,r=this._key,(r=e.index_===Ru?Fc(e,n="string"==typeof n?mc(n):n,r):Fc(e,n,null==r?es:mc(r))).startAfterSet_=!0,r);if(bp(r),mp(r),t._queryParams.hasStart())throw new Error("startAfter: Starting point was already set (by another call to startAt, startAfter, or equalTo).");return new vp(t._repo,t._path,r,t._orderByCalled)},Zp);function Zp(t,e){var n=Jp.call(this)||this;return n._value=t,n._key=e,n}var td,ed=(Xi(nd,td=Sn),nd.prototype._apply=function(t){if(t._queryParams.hasLimit())throw new Error("limitToFirst: Limit was already set (by another call to limitToFirst or limitToLast).");return new vp(t._repo,t._path,(e=t._queryParams,n=this._limit,(e=e.copy()).limitSet_=!0,e.limit_=n,e.viewFrom_="l",e),t._orderByCalled);var e,n},nd);function nd(t){var e=td.call(this)||this;return e._limit=t,e}var rd,id=(Xi(od,rd=Sn),od.prototype._apply=function(t){if(t._queryParams.hasLimit())throw new Error("limitToLast: Limit was already set (by another call to limitToFirst or limitToLast).");return new vp(t._repo,t._path,(e=t._queryParams,n=this._limit,(e=e.copy()).limitSet_=!0,e.limit_=n,e.viewFrom_="r",e),t._orderByCalled);var e,n},od);function od(t){var e=rd.call(this)||this;return e._limit=t,e}var ad,sd=(Xi(ud,ad=Sn),ud.prototype._apply=function(t){yp(t,"orderByChild");var e=new $s(this._path);if(uu(e))throw new Error("orderByChild: cannot pass in empty path. Use orderByValue() instead.");e=new vc(e),e=jc(t._queryParams,e);return mp(e),new vp(t._repo,t._path,e,!0)},ud);function ud(t){var e=ad.call(this)||this;return e._path=t,e}var cd,hd=(Xi(ld,cd=Sn),ld.prototype._apply=function(t){yp(t,"orderByKey");var e=jc(t._queryParams,Ru);return mp(e),new vp(t._repo,t._path,e,!0)},ld);function ld(){return null!==cd&&cd.apply(this,arguments)||this}var fd,pd=(Xi(dd,fd=Sn),dd.prototype._apply=function(t){yp(t,"orderByPriority");var e=jc(t._queryParams,Xu);return mp(e),new vp(t._repo,t._path,e,!0)},dd);function dd(){return null!==fd&&fd.apply(this,arguments)||this}var vd,gd=(Xi(yd,vd=Sn),yd.prototype._apply=function(t){yp(t,"orderByValue");var e=jc(t._queryParams,Ic);return mp(e),new vp(t._repo,t._path,e,!0)},yd);function yd(){return null!==vd&&vd.apply(this,arguments)||this}var md,bd,_d,wd=(Xi(Id,md=Sn),Id.prototype._apply=function(t){if(If("equalTo",this._value,t._path,!1),t._queryParams.hasStart())throw new Error("equalTo: Starting point was already set (by another call to startAt/startAfter or equalTo).");if(t._queryParams.hasEnd())throw new Error("equalTo: Ending point was already set (by another call to endAt/endBefore or equalTo).");return new Kp(this._value,this._key)._apply(new Yp(this._value,this._key)._apply(t))},Id);function Id(t,e){var n=md.call(this)||this;return n._value=t,n._key=e,n}function Td(t){for(var e,n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=Zo(t);try{for(var a=to(r),s=a.next();!s.done;s=a.next())o=s.value._apply(o)}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return o}bd=wp,ao(!ul,"__referenceConstructor has already been defined"),ul=bd,_d=wp,ao(!vl,"__referenceConstructor has already been defined"),vl=_d;var Ed="FIREBASE_DATABASE_EMULATOR_HOST",Sd={},Cd=!1;function kd(t,e,n,r){var i=n||t.options.databaseURL;void 0===i&&(t.options.projectId||$a("Can't determine Firebase Database URL. Be sure to include  a Project ID when calling firebase.initializeApp()."),Xa("Using default host for project ",t.options.projectId),i=t.options.projectId+"-default-rtdb.firebaseio.com");var o,a=op(i,r),s=a.repoInfo,n=void 0;(n="undefined"!=typeof process?process.env[Ed]:n)?(o=!0,i="http://"+n+"?ns="+s.namespace,s=(a=op(i,r)).repoInfo):o=!a.repoInfo.secure;e=r&&o?new ds:new fs(t.name,t.options,e);kf("Invalid Firebase Database URL",a),uu(a.path)||$a("Database URL must point to the root of a Firebase Database (not including a child path).");e=function(t,e,n){var r=Sd[e.name];r||(r={},Sd[e.name]=r);e=r[t.toURLString()];e&&$a("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call.");return e=new Lf(t,Cd,n),r[t.toURLString()]=e}(s,t,e);return new Nd(e,t)}var Nd=(Object.defineProperty(Ad.prototype,"_repo",{get:function(){return this._instanceStarted||(Ff(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal},enumerable:!1,configurable:!0}),Object.defineProperty(Ad.prototype,"_root",{get:function(){return this._rootInternal||(this._rootInternal=new wp(this._repo,tu())),this._rootInternal},enumerable:!1,configurable:!0}),Ad.prototype._delete=function(){var t,e,n;return this._checkNotDeleted("delete"),t=this._repo,e=this.app.name,(n=Sd[e])&&n[t.key]===t||$a("Database "+e+"("+t.repoInfo_+") has already been deleted."),Qf(t),delete n[t.key],this._repoInternal=null,this._rootInternal=null,Promise.resolve()},Ad.prototype._checkNotDeleted=function(t){null===this._rootInternal&&$a("Cannot call "+t+" on a deleted database.")},Ad);function Ad(t,e){this._repoInternal=t,this.app=e,this.type="database",this._instanceStarted=!1}function Rd(t,e,n){(t=Zo(t))._checkNotDeleted("useEmulator"),t._instanceStarted&&$a("Cannot call useEmulator() after instance has already been initialized."),t=t._repo,e=e,n=n,t.repoInfo_=new bs(e+":"+n,!1,t.repoInfo_.namespace,t.repoInfo_.webSocketOnly,t.repoInfo_.nodeAdmin,t.repoInfo_.persistenceKey,t.repoInfo_.includeNamespaceInQueryParams),t.repoInfo_.nodeAdmin&&(t.authTokenProvider_=new ds)}function Od(t){(t=Zo(t))._checkNotDeleted("goOnline"),(t=t._repo).persistentConnection_&&t.persistentConnection_.resume(Df)}function Pd(t,e){Ya(t,e)}var Dd={".sv":"timestamp"};var xd=(Ld.prototype.toJSON=function(){return{committed:this.committed,snapshot:this.snapshot.toJSON()}},Ld);function Ld(t,e){this.committed=t,this.snapshot=e}function Md(i,t,e){if(i=Zo(i),Cf("Reference.transaction",i._path),".length"===i.key||".keys"===i.key)throw"Reference.transaction failed: "+i.key+" is a read-only object.";var e=null===(n=null==e?void 0:e.applyLocally)||void 0===n||n,o=new lo,n=Mp(i,function(){});return function(t,e,n,r,i,o){Yf(t,"transaction on "+e);var a={path:e,update:n,onComplete:r,status:null,order:Ha(),applyLocally:o,retryCount:0,unwatcher:i,abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},n=Jf(t,e,void 0);a.currentInputSnapshot=n,void 0===(r=a.update(n.val()))?(a.unwatcher(),a.currentOutputSnapshotRaw=null,a.currentOutputSnapshotResolved=null,a.onComplete&&a.onComplete(null,!1,a.currentInputSnapshot)):(Tf("transaction failed: Data returned ",r,a.path),a.status=0,(i=sf(o=af(t.transactionQueueTree_,e))||[]).push(a),uf(o,i),o=void 0,"object"==typeof r&&null!==r&&Po(r,".priority")?(o=Do(r,".priority"),ao(wf(o),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):o=(Ll(t.serverSyncTree_,e)||sc.EMPTY_NODE).getPriority().val(),i=jf(t),o=fc(r,o),i=nf(o,n,i),a.currentOutputSnapshotRaw=o,a.currentOutputSnapshotResolved=i,a.currentWriteId=Kf(t),a=Al(t.serverSyncTree_,e,i,a.currentWriteId,a.applyLocally),Of(t.eventQueue_,e,a),$f(t,t.transactionQueueTree_))}(i._repo,i._path,t,function(t,e,n){var r;t?o.reject(t):(r=new Tp(n,new wp(i._repo,i._path),Xu),o.resolve(new xd(e,r)))},n,e),o.promise}var Fd=(Ud.prototype.cancel=function(e){Ko("OnDisconnect.cancel",0,1,arguments.length),Ho("OnDisconnect.cancel","onComplete",e,!0);var t=this._delegate.cancel();return e&&t.then(function(){return e(null)},function(t){return e(t)}),t},Ud.prototype.remove=function(e){Ko("OnDisconnect.remove",0,1,arguments.length),Ho("OnDisconnect.remove","onComplete",e,!0);var t=this._delegate.remove();return e&&t.then(function(){return e(null)},function(t){return e(t)}),t},Ud.prototype.set=function(t,e){Ko("OnDisconnect.set",1,2,arguments.length),Ho("OnDisconnect.set","onComplete",e,!0);t=this._delegate.set(t);return e&&t.then(function(){return e(null)},function(t){return e(t)}),t},Ud.prototype.setWithPriority=function(t,e,n){Ko("OnDisconnect.setWithPriority",2,3,arguments.length),Ho("OnDisconnect.setWithPriority","onComplete",n,!0);e=this._delegate.setWithPriority(t,e);return n&&e.then(function(){return n(null)},function(t){return n(t)}),e},Ud.prototype.update=function(t,e){if(Ko("OnDisconnect.update",1,2,arguments.length),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,Za("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.")}Ho("OnDisconnect.update","onComplete",e,!0);var i=this._delegate.update(t);return e&&i.then(function(){return e(null)},function(t){return e(t)}),i},Ud);function Ud(t){this._delegate=t}var jd=(qd.prototype.toJSON=function(){return Ko("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},qd);function qd(t,e){this.committed=t,this.snapshot=e}var Vd=(Bd.prototype.val=function(){return Ko("DataSnapshot.val",0,0,arguments.length),this._delegate.val()},Bd.prototype.exportVal=function(){return Ko("DataSnapshot.exportVal",0,0,arguments.length),this._delegate.exportVal()},Bd.prototype.toJSON=function(){return Ko("DataSnapshot.toJSON",0,1,arguments.length),this._delegate.toJSON()},Bd.prototype.exists=function(){return Ko("DataSnapshot.exists",0,0,arguments.length),this._delegate.exists()},Bd.prototype.child=function(t){return Ko("DataSnapshot.child",0,1,arguments.length),t=String(t),Ef("DataSnapshot.child","path",t,!1),new Bd(this._database,this._delegate.child(t))},Bd.prototype.hasChild=function(t){return Ko("DataSnapshot.hasChild",1,1,arguments.length),Ef("DataSnapshot.hasChild","path",t,!1),this._delegate.hasChild(t)},Bd.prototype.getPriority=function(){return Ko("DataSnapshot.getPriority",0,0,arguments.length),this._delegate.priority},Bd.prototype.forEach=function(e){var n=this;return Ko("DataSnapshot.forEach",1,1,arguments.length),Ho("DataSnapshot.forEach","action",e,!1),this._delegate.forEach(function(t){return e(new Bd(n._database,t))})},Bd.prototype.hasChildren=function(){return Ko("DataSnapshot.hasChildren",0,0,arguments.length),this._delegate.hasChildren()},Object.defineProperty(Bd.prototype,"key",{get:function(){return this._delegate.key},enumerable:!1,configurable:!0}),Bd.prototype.numChildren=function(){return Ko("DataSnapshot.numChildren",0,0,arguments.length),this._delegate.size},Bd.prototype.getRef=function(){return Ko("DataSnapshot.ref",0,0,arguments.length),new Gd(this._database,this._delegate.ref)},Object.defineProperty(Bd.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),Bd);function Bd(t,e){this._database=t,this._delegate=e}var Kd=(Wd.prototype.on=function(t,n,e,r){var i=this;Ko("Query.on",2,4,arguments.length),Ho("Query.on","callback",n,!1);function o(t,e){n.call(a.context,new Vd(i.database,t),e)}var a=Wd.getCancelAndContextArgs_("Query.on",e,r);o.userCallback=n,o.context=a.context;var s=null===(r=a.cancel)||void 0===r?void 0:r.bind(a.context);switch(t){case"value":return Mp(this._delegate,o,s),n;case"child_added":return Fp(this._delegate,o,s),n;case"child_removed":return qp(this._delegate,o,s),n;case"child_changed":return Up(this._delegate,o,s),n;case"child_moved":return jp(this._delegate,o,s),n;default:throw new Error(Wo("Query.on","eventType")+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}},Wd.prototype.off=function(t,e,n){var r;Ko("Query.off",0,3,arguments.length),function(t,e,n){if(!n||void 0!==e)switch(e){case"value":case"child_added":case"child_removed":case"child_changed":case"child_moved":break;default:throw new Error(Wo(t,"eventType")+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}}("Query.off",t,!0),Ho("Query.off","callback",e,!0),Go("Query.off","context",n,!0),e?((r=function(){}).userCallback=e,r.context=n,Vp(this._delegate,t,r)):Vp(this._delegate,t)},Wd.prototype.get=function(){var e=this;return Rp(this._delegate).then(function(t){return new Vd(e.database,t)})},Wd.prototype.once=function(t,n,e,r){var i=this;Ko("Query.once",1,4,arguments.length),Ho("Query.once","callback",n,!0);function o(t,e){t=new Vd(i.database,t),n&&n.call(a.context,t,e),s.resolve(t)}var a=Wd.getCancelAndContextArgs_("Query.on",e,r),s=new lo;o.userCallback=n,o.context=a.context;function u(t){a.cancel&&a.cancel.call(a.context,t),s.reject(t)}switch(t){case"value":Mp(this._delegate,o,u,{onlyOnce:!0});break;case"child_added":Fp(this._delegate,o,u,{onlyOnce:!0});break;case"child_removed":qp(this._delegate,o,u,{onlyOnce:!0});break;case"child_changed":Up(this._delegate,o,u,{onlyOnce:!0});break;case"child_moved":jp(this._delegate,o,u,{onlyOnce:!0});break;default:throw new Error(Wo("Query.once","eventType")+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}return s.promise},Wd.prototype.limitToFirst=function(t){return Ko("Query.limitToFirst",1,1,arguments.length),new Wd(this.database,Td(this._delegate,function(t){if("number"!=typeof t||Math.floor(t)!==t||t<=0)throw new Error("limitToFirst: First argument must be a positive integer.");return new ed(t)}(t)))},Wd.prototype.limitToLast=function(t){return Ko("Query.limitToLast",1,1,arguments.length),new Wd(this.database,Td(this._delegate,function(t){if("number"!=typeof t||Math.floor(t)!==t||t<=0)throw new Error("limitToLast: First argument must be a positive integer.");return new id(t)}(t)))},Wd.prototype.orderByChild=function(t){return Ko("Query.orderByChild",1,1,arguments.length),new Wd(this.database,Td(this._delegate,function(t){if("$key"===t)throw new Error('orderByChild: "$key" is invalid.  Use orderByKey() instead.');if("$priority"===t)throw new Error('orderByChild: "$priority" is invalid.  Use orderByPriority() instead.');if("$value"===t)throw new Error('orderByChild: "$value" is invalid.  Use orderByValue() instead.');return Ef("orderByChild","path",t,!1),new sd(t)}(t)))},Wd.prototype.orderByKey=function(){return Ko("Query.orderByKey",0,0,arguments.length),new Wd(this.database,Td(this._delegate,new hd))},Wd.prototype.orderByPriority=function(){return Ko("Query.orderByPriority",0,0,arguments.length),new Wd(this.database,Td(this._delegate,new pd))},Wd.prototype.orderByValue=function(){return Ko("Query.orderByValue",0,0,arguments.length),new Wd(this.database,Td(this._delegate,new gd))},Wd.prototype.startAt=function(t,e){return void 0===t&&(t=null),Ko("Query.startAt",0,2,arguments.length),new Wd(this.database,Td(this._delegate,(void 0===(t=t)&&(t=null),yf("startAt","key",e=e,!0),new Yp(t,e))))},Wd.prototype.startAfter=function(t,e){return void 0===t&&(t=null),Ko("Query.startAfter",0,2,arguments.length),new Wd(this.database,Td(this._delegate,(t=t,yf("startAfter","key",e=e,!0),new $p(t,e))))},Wd.prototype.endAt=function(t,e){return void 0===t&&(t=null),Ko("Query.endAt",0,2,arguments.length),new Wd(this.database,Td(this._delegate,(t=t,yf("endAt","key",e=e,!0),new Kp(t,e))))},Wd.prototype.endBefore=function(t,e){return void 0===t&&(t=null),Ko("Query.endBefore",0,2,arguments.length),new Wd(this.database,Td(this._delegate,(t=t,yf("endBefore","key",e=e,!0),new Gp(t,e))))},Wd.prototype.equalTo=function(t,e){return Ko("Query.equalTo",1,2,arguments.length),new Wd(this.database,Td(this._delegate,(t=t,yf("equalTo","key",e=e,!0),new wd(t,e))))},Wd.prototype.toString=function(){return Ko("Query.toString",0,0,arguments.length),this._delegate.toString()},Wd.prototype.toJSON=function(){return Ko("Query.toJSON",0,1,arguments.length),this._delegate.toJSON()},Wd.prototype.isEqual=function(t){if(Ko("Query.isEqual",1,1,arguments.length),t instanceof Wd)return this._delegate.isEqual(t._delegate);throw new Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.")},Wd.getCancelAndContextArgs_=function(t,e,n){var r={cancel:void 0,context:void 0};if(e&&n)r.cancel=e,Ho(t,"cancel",r.cancel,!0),r.context=n,Go(t,"context",r.context,!0);else if(e)if("object"==typeof e&&null!==e)r.context=e;else{if("function"!=typeof e)throw new Error(Wo(t,"cancelOrContext")+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(Wd.prototype,"ref",{get:function(){return new Gd(this.database,new wp(this._delegate._repo,this._delegate._path))},enumerable:!1,configurable:!0}),Wd);function Wd(t,e){this.database=t,this._delegate=e}var Hd,Gd=(Xi(zd,Hd=Kd),zd.prototype.getKey=function(){return Ko("Reference.key",0,0,arguments.length),this._delegate.key},zd.prototype.child=function(t){return Ko("Reference.child",1,1,arguments.length),"number"==typeof t&&(t=String(t)),new zd(this.database,kp(this._delegate,t))},zd.prototype.getParent=function(){Ko("Reference.parent",0,0,arguments.length);var t=this._delegate.parent;return t?new zd(this.database,t):null},zd.prototype.getRoot=function(){return Ko("Reference.root",0,0,arguments.length),new zd(this.database,this._delegate.root)},zd.prototype.set=function(t,e){Ko("Reference.set",1,2,arguments.length),Ho("Reference.set","onComplete",e,!0);t=Np(this._delegate,t);return e&&t.then(function(){return e(null)},function(t){return e(t)}),t},zd.prototype.update=function(t,e){if(Ko("Reference.update",1,2,arguments.length),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,Za("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.")}Cf("Reference.update",this._delegate._path),Ho("Reference.update","onComplete",e,!0);var i=Ap(this._delegate,t);return e&&i.then(function(){return e(null)},function(t){return e(t)}),i},zd.prototype.setWithPriority=function(t,e,n){Ko("Reference.setWithPriority",2,3,arguments.length),Ho("Reference.setWithPriority","onComplete",n,!0);e=function(t,e,n){if(Cf("setWithPriority",t._path),If("setWithPriority",e,t._path,!1),gf("setWithPriority",n,!1),".length"===t.key||".keys"===t.key)throw"setWithPriority failed: "+t.key+" is a read-only object.";var r=new lo;return Wf(t._repo,t._path,e,n,r.wrapCallback(function(){})),r.promise}(this._delegate,t,e);return n&&e.then(function(){return n(null)},function(t){return n(t)}),e},zd.prototype.remove=function(e){Ko("Reference.remove",0,1,arguments.length),Ho("Reference.remove","onComplete",e,!0);var t,t=(t=this._delegate,Cf("remove",t._path),Np(t,null));return e&&t.then(function(){return e(null)},function(t){return e(t)}),t},zd.prototype.transaction=function(t,e,n){var r=this;Ko("Reference.transaction",1,3,arguments.length),Ho("Reference.transaction","transactionUpdate",t,!1),Ho("Reference.transaction","onComplete",e,!0),function(t,e,n,r){if((!r||void 0!==n)&&"boolean"!=typeof n)throw new Error(Wo(t,e)+"must be a boolean.")}("Reference.transaction","applyLocally",n,!0);n=Md(this._delegate,t,{applyLocally:n}).then(function(t){return new jd(t.committed,new Vd(r.database,t.snapshot))});return e&&n.then(function(t){return e(null,t.committed,t.snapshot)},function(t){return e(t,!1,null)}),n},zd.prototype.setPriority=function(t,e){Ko("Reference.setPriority",1,2,arguments.length),Ho("Reference.setPriority","onComplete",e,!0);t=function(t,e){t=Zo(t),Cf("setPriority",t._path),gf("setPriority",e,!1);var n=new lo;return Wf(t._repo,su(t._path,".priority"),e,null,n.wrapCallback(function(){})),n.promise}(this._delegate,t);return e&&t.then(function(){return e(null)},function(t){return e(t)}),t},zd.prototype.push=function(t,e){var n=this;Ko("Reference.push",0,2,arguments.length),Ho("Reference.push","onComplete",e,!0);var r=function(t,e){t=Zo(t),Cf("push",t._path),If("push",e,t._path,!0);var n=Uf(t._repo),r=Ec(n),n=kp(t,r),i=kp(t,r),e=null!=e?Np(i,e).then(function(){return i}):Promise.resolve(i);return n.then=e.then.bind(e),n.catch=e.then.bind(e,void 0),n}(this._delegate,t),t=r.then(function(t){return new zd(n.database,t)});e&&t.then(function(){return e(null)},function(t){return e(t)});r=new zd(this.database,r);return r.then=t.then.bind(t),r.catch=t.catch.bind(t,void 0),r},zd.prototype.onDisconnect=function(){return Cf("Reference.onDisconnect",this._delegate._path),new Fd(new pp(this._delegate._repo,this._delegate._path))},Object.defineProperty(zd.prototype,"key",{get:function(){return this.getKey()},enumerable:!1,configurable:!0}),Object.defineProperty(zd.prototype,"parent",{get:function(){return this.getParent()},enumerable:!1,configurable:!0}),Object.defineProperty(zd.prototype,"root",{get:function(){return this.getRoot()},enumerable:!1,configurable:!0}),zd);function zd(t,e){var n=Hd.call(this,t,new vp(e._repo,e._path,new Lc,!1))||this;return n.database=t,n._delegate=e,n}var Qd=(Yd.prototype.useEmulator=function(t,e){Rd(this._delegate,t,e)},Yd.prototype.ref=function(t){if(Ko("database.ref",0,1,arguments.length),t instanceof Gd){var e=Cp(this._delegate,t.toString());return new Gd(this,e)}e=Sp(this._delegate,t);return new Gd(this,e)},Yd.prototype.refFromURL=function(t){Ko("database.refFromURL",1,1,arguments.length);t=Cp(this._delegate,t);return new Gd(this,t)},Yd.prototype.goOffline=function(){var t;Ko("database.goOffline",0,0,arguments.length),(t=Zo(t=this._delegate))._checkNotDeleted("goOffline"),Qf(t._repo)},Yd.prototype.goOnline=function(){return Ko("database.goOnline",0,0,arguments.length),Od(this._delegate)},Yd.ServerValue={TIMESTAMP:Dd,increment:function(t){return{".sv":{increment:t}}}},Yd);function Yd(t,e){var n=this;this._delegate=t,this.app=e,this.INTERNAL={delete:function(){return n._delegate._delete()}}}var Xd=Object.freeze({__proto__:null,forceLongPolling:function(){Us.forceDisallow(),Os.forceAllow()},forceWebSockets:function(){Os.forceDisallow()},isWebSocketsAvailable:function(){return Us.isAvailable()},setSecurityDebugCallback:function(t,e){t._delegate._repo.persistentConnection_.securityDebugCallback_=e},stats:function(t,e){var i;t=t._delegate._repo,void 0===(e=e)&&(e=!1),"undefined"!=typeof console&&(t=e?(t.statsListener_||(t.statsListener_=new Xc(t.stats_)),t.statsListener_.get()):t.stats_.get(),i=Object.keys(t).reduce(function(t,e){return Math.max(e.length,t)},0),is(t,function(t,e){for(var n=t,r=t.length;r<i+2;r++)n+=" ";console.log(n+e)}))},statsIncrementCounter:function(t,e){t=t._delegate._repo,e=e,t.stats_.incrementCounter(e),t=t.statsReporter_,e=e,t.statsToReport_[e]=!0},dataUpdateCount:function(t){return t._delegate._repo.dataUpdateCount},interceptServerData:function(t,e){t=t._delegate._repo,e=e,t.interceptServerDataCallback_=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 Ms(r),(r=new ra("auth-internal",new oa("database-standalone"))).setComponent(new ta("auth-internal",function(){return i},"PRIVATE")),{instance:new Qd(kd(e,r,n,t),e),namespace:o}}}),G=Iu;Iu.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},Iu.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};var Jd,$d=Object.freeze({__proto__:null,DataConnection:G,RealTimeConnection:Bs,hijackHash:function(i){var o=Iu.prototype.put;return Iu.prototype.put=function(t,e,n,r){void 0!==r&&(r=i()),o.call(this,t,e,n,r)},function(){Iu.prototype.put=o}},ConnectionTarget:bs,queryIdentifier:function(t){return t._delegate._queryIdentifier},forceRestClient:function(t){Cd=t}}),Zd=Qd.ServerValue;Ms((Jd=Xl).SDK_VERSION),Jd.INTERNAL.registerComponent(new ta("database",function(t,e){var n=e.instanceIdentifier,e=t.getProvider("app").getImmediate(),t=t.getProvider("auth-internal");return new Qd(kd(e,t,n),e)},"PUBLIC").setServiceProps({Reference:Gd,Query:Kd,Database:Qd,DataSnapshot:Vd,enableLogging:Pd,INTERNAL:Xd,ServerValue:Zd,TEST_ACCESS:$d}).setMultipleInstances(!0)),Jd.registerVersion("@firebase/database","0.9.11");var tv=function(t,e){return(tv=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 ev(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{value:(t=t&&r>=t.length?void 0:t)&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},nv={},rv=z||self;function iv(){}function ov(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function av(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var sv="closure_uid_"+(1e9*Math.random()>>>0),uv=0;function cv(t,e,n){return t.call.apply(t.bind,arguments)}function hv(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 lv(t,e,n){return(lv=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?cv:hv).apply(null,arguments)}function fv(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)}}function pv(){return Date.now()}function dv(t,o){function e(){}e.prototype=o.prototype,t.X=o.prototype,t.prototype=new e,(t.prototype.constructor=t).Kb=function(t,e,n){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return o.prototype[e].apply(t,r)}}function vv(){this.j=this.j,this.i=this.i}vv.prototype.j=!1,vv.prototype.ja=function(){var t;!this.j&&(this.j=!0,this.G(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,sv)&&t[sv]||(t[sv]=++uv))},vv.prototype.G=function(){if(this.i)for(;this.i.length;)this.i.shift()()};var gv=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},yv=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 mv(){return Array.prototype.concat.apply([],arguments)}function bv(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 _v(t){return/^[\s\xa0]*$/.test(t)}var wv,Iv=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Tv(t,e){return-1!=t.indexOf(e)}function Ev(t,e){return t<e?-1:e<t?1:0}t:{var Sv=rv.navigator;if(Sv){Sv=Sv.userAgent;if(Sv){wv=Sv;break t}}wv=""}function Cv(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function kv(t){var e,n={};for(e in t)n[e]=t[e];return n}var Nv="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Av(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<Nv.length;i++)e=Nv[i],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function Rv(t){return Rv[" "](t),t}Rv[" "]=iv;var Ov,Pv=Tv(wv,"Opera"),Dv=Tv(wv,"Trident")||Tv(wv,"MSIE"),xv=Tv(wv,"Edge"),Lv=xv||Dv,Mv=Tv(wv,"Gecko")&&!(Tv(wv.toLowerCase(),"webkit")&&!Tv(wv,"Edge"))&&!(Tv(wv,"Trident")||Tv(wv,"MSIE"))&&!Tv(wv,"Edge"),Fv=Tv(wv.toLowerCase(),"webkit")&&!Tv(wv,"Edge");function Uv(){var t=rv.document;return t?t.documentMode:void 0}t:{var jv="",qv=(qv=wv,Mv?/rv:([^\);]+)(\)|;)/.exec(qv):xv?/Edge\/([\d\.]+)/.exec(qv):Dv?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(qv):Fv?/WebKit\/(\S+)/.exec(qv):Pv?/(?:Version)[ \/]?(\S+)/.exec(qv):void 0);if(qv&&(jv=qv?qv[1]:""),Dv){qv=Uv();if(null!=qv&&qv>parseFloat(jv)){Ov=String(qv);break t}}Ov=jv}var Vv={};function Bv(s){return t=s,e=function(){for(var t=0,e=Iv(String(Ov)).split("."),n=Iv(String(s)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++)for(var o=e[i]||"",a=n[i]||"";o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],a=/(\d*)(\D*)(.*)/.exec(a)||["","","",""],(0!=o[0].length||0!=a[0].length)&&(t=Ev(0==o[1].length?0:parseInt(o[1],10),0==a[1].length?0:parseInt(a[1],10))||Ev(0==o[2].length,0==a[2].length)||Ev(o[2],a[2]),o=o[3],a=a[3],0==t););return 0<=t},n=Vv,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}var Kv=rv.document&&Dv&&(Uv()||parseInt(Ov,10))||void 0,Wv=!Dv||9<=Number(Kv),Hv=Dv&&!Bv("9"),Gv=function(){if(!rv.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{rv.addEventListener("test",iv,e),rv.removeEventListener("test",iv,e)}catch(t){}return t}();function zv(t,e){this.type=t,this.a=this.target=e,this.defaultPrevented=!1}function Qv(t,e){if(zv.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(Mv){t:{try{Rv(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:Yv[t.pointerType]||"",(this.c=t).defaultPrevented&&this.b()}}zv.prototype.b=function(){this.defaultPrevented=!0},dv(Qv,zv);var Yv={2:"touch",3:"pen",4:"mouse"};Qv.prototype.b=function(){Qv.X.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,Hv)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}};var Xv="closure_listenable_"+(1e6*Math.random()|0),Jv=0;function $v(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=++Jv,this.Y=this.Z=!1}function Zv(t){t.Y=!0,t.listener=null,t.proxy=null,t.src=null,t.ca=null}function tg(t){this.src=t,this.a={},this.b=0}function eg(t,e){var n,r,i,o=e.type;o in t.a&&(n=t.a[o],(i=0<=(r=gv(n,e)))&&Array.prototype.splice.call(n,r,1),i&&(Zv(e),0==t.a[o].length&&(delete t.a[o],t.b--)))}function ng(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}tg.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var a=ng(t,e,r,i);return-1<a?(e=t[a],n||(e.Z=!1)):((e=new $v(e,this.src,o,!!r,i)).Z=n,t.push(e)),e};var rg="closure_lm_"+(1e6*Math.random()|0),ig={};function og(t,e,n,r,i){if(r&&r.once)return function t(e,n,r,i,o){if(Array.isArray(n)){for(var a=0;a<n.length;a++)t(e,n[a],r,i,o);return null}r=pg(r);return e&&e[Xv]?e.wa(n,r,av(i)?!!i.capture:!!i,o):ag(e,n,r,!0,i,o)}(t,e,n,r,i);if(Array.isArray(e)){for(var o=0;o<e.length;o++)og(t,e[o],n,r,i);return null}return n=pg(n),t&&t[Xv]?t.va(e,n,av(r)?!!r.capture:!!r,i):ag(t,e,n,!1,r,i)}function ag(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var a=av(i)?!!i.capture:!!i;if(a&&!Wv)return null;var s,u,c=lg(t);if(c||(t[rg]=c=new tg(t)),(n=c.add(e,n,r,a,o)).proxy)return n;if(s=hg,r=u=Wv?function(t){return s.call(u.src,u.listener,t)}:function(t){if(!(t=s.call(u.src,u.listener,t)))return t},(n.proxy=r).src=t,r.listener=n,t.addEventListener)void 0===(i=!Gv?a:i)&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(ug(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function sg(t){var e,n,r;"number"!=typeof t&&t&&!t.Y&&((e=t.src)&&e[Xv]?eg(e.c,t):(n=t.type,r=t.proxy,e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(ug(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=lg(e))?(eg(n,t),0==n.b&&(n.src=null,e[rg]=null)):Zv(t)))}function ug(t){return t in ig?ig[t]:ig[t]="on"+t}function cg(t,e){var n=t.listener,r=t.ca||t.src;return t.Z&&sg(t),n.call(r,e)}function hg(t,e){if(t.Y)return!0;if(Wv)return cg(t,new Qv(e,this));if(!e)t:{e=["window","event"];for(var n=rv,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}return cg(t,e=new Qv(e,this))}function lg(t){return(t=t[rg])instanceof tg?t:null}var fg="__closure_events_fn_"+(1e9*Math.random()>>>0);function pg(e){return"function"==typeof e?e:(e[fg]||(e[fg]=function(t){return e.handleEvent(t)}),e[fg])}function dg(){vv.call(this),this.c=new tg(this),(this.J=this).C=null}function vg(t,e){var n,r=t.C;if(r)for(n=[];r;r=r.C)n.push(r);if(t=t.J,r=e.type||e,"string"==typeof e?e=new zv(e,t):e instanceof zv?e.target=e.target||t:(a=e,Av(e=new zv(r,t),a)),a=!0,n)for(var i=n.length-1;0<=i;i--)var o=e.a=n[i],a=gg(o,r,!0,e)&&a;if(a=gg(o=e.a=t,r,!0,e)&&a,a=gg(o,r,!1,e)&&a,n)for(i=0;i<n.length;i++)a=gg(o=e.a=n[i],r,!1,e)&&a}function gg(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 a,s,u=e[o];u&&!u.Y&&u.capture==n&&(a=u.listener,s=u.ca||u.src,u.Z&&eg(t.c,u),i=!1!==a.call(s,r)&&i)}return i&&!r.defaultPrevented}dv(dg,vv),dg.prototype[Xv]=!0,(Hs=dg.prototype).addEventListener=function(t,e,n,r){og(this,t,e,n,r)},Hs.removeEventListener=function(t,e,n,r){!function t(e,n,r,i,o){if(Array.isArray(n))for(var a=0;a<n.length;a++)t(e,n[a],r,i,o);else i=av(i)?!!i.capture:!!i,r=pg(r),e&&e[Xv]?(e=e.c,(n=String(n).toString())in e.a&&-1<(r=ng(a=e.a[n],r,i,o))&&(Zv(a[r]),Array.prototype.splice.call(a,r,1),0==a.length&&(delete e.a[n],e.b--))):(e=e&&lg(e))&&(n=e.a[n.toString()],(r=(e=-1)<(e=n?ng(n,r,i,o):e)?n[e]:null)&&sg(r))}(this,t,e,n,r)},Hs.G=function(){if(dg.X.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++)Zv(n[r]);delete e.a[t],e.b--}}this.C=null},Hs.va=function(t,e,n,r){return this.c.add(String(t),e,!1,n,r)},Hs.wa=function(t,e,n,r){return this.c.add(String(t),e,!0,n,r)};var yg=rv.JSON.stringify;function mg(){this.b=this.a=null}var bg,_g=(wg.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 wg(function(){return new Ig},function(t){t.reset()}));function wg(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function Ig(){this.next=this.b=this.a=null}function Tg(t,e){var n;bg||(n=rv.Promise.resolve(void 0),bg=function(){n.then(Cg)}),Eg||(bg(),Eg=!0),Sg.add(t,e)}mg.prototype.add=function(t,e){var n=_g.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},Ig.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null};var Eg=!(Ig.prototype.reset=function(){this.next=this.b=this.a=null}),Sg=new mg;function Cg(){for(var t,e;n=e=void 0,n=null,(e=Sg).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){rv.setTimeout(function(){throw t},0)}(t)}var n=_g;n.f(t),n.b<100&&(n.b++,t.next=n.a,n.a=t)}Eg=!1}function kg(t,e){dg.call(this),this.b=t||1,this.a=e||rv,this.f=lv(this.Za,this),this.g=pv()}function Ng(t){t.aa=!1,t.M&&(t.a.clearTimeout(t.M),t.M=null)}function Ag(t,e,n){if("function"==typeof t)n&&(t=lv(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=lv(t.handleEvent,t)}return 2147483647<Number(e)?-1:rv.setTimeout(t,e||0)}dv(kg,dg),(Hs=kg.prototype).aa=!1,Hs.M=null,Hs.Za=function(){var t;this.aa&&(0<(t=pv()-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),vg(this,"tick"),this.aa&&(Ng(this),this.start())))},Hs.start=function(){this.aa=!0,this.M||(this.M=this.a.setTimeout(this.f,this.b),this.g=pv())},Hs.G=function(){kg.X.G.call(this),Ng(this),delete this.a};var Rg,Og,Pg,Dg=(tv(Og=Lg,Pg=Rg=vv),Og.prototype=null===Pg?Object.create(Pg):(xg.prototype=Pg.prototype,new xg),Lg.prototype.f=function(t){this.b=arguments,this.a?this.c=!0:function t(e){e.a=Ag(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)},Lg.prototype.G=function(){Rg.prototype.G.call(this),this.a&&(rv.clearTimeout(this.a),this.a=null,this.c=!1,this.b=null)},Lg);function xg(){this.constructor=Og}function Lg(t,e){var n=Rg.call(this)||this;return n.g=t,n.h=e,n.b=null,n.c=!1,n.a=null,n}function Mg(t){vv.call(this),this.b=t,this.a={}}dv(Mg,vv);var Fg=[];function Ug(t,e,n,r){Array.isArray(n)||(n&&(Fg[0]=n.toString()),n=Fg);for(var i=0;i<n.length;i++){var o=og(e,n[i],r||t.handleEvent,!1,t.b||t);if(!o)break;t.a[o.key]=o}}function jg(t){Cv(t.a,function(t,e){this.a.hasOwnProperty(e)&&sg(t)},t),t.a={}}function qg(){this.a=!0}function Vg(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 yg(n)}catch(t){return e}}(t,n)+(r?" "+r:"")})}Mg.prototype.G=function(){Mg.X.G.call(this),jg(this)},Mg.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},qg.prototype.info=function(){};var Bg={},Kg=null;function Wg(){return Kg=Kg||new dg}function Hg(t){zv.call(this,Bg.Fa,t)}function Gg(t){var e=Wg();vg(e,new Hg(e))}function zg(t,e){zv.call(this,Bg.STAT_EVENT,t),this.stat=e}function Qg(t){var e=Wg();vg(e,new zg(e,t))}function Yg(t){zv.call(this,Bg.Ga,t)}function Xg(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return rv.setTimeout(function(){t()},e)}Bg.Fa="serverreachability",dv(Hg,zv),Bg.STAT_EVENT="statevent",dv(zg,zv),Bg.Ga="timingevent",dv(Yg,zv);Sn={NO_ERROR:0,$a:1,nb:2,mb:3,hb:4,lb:5,ob:6,Da:7,TIMEOUT:8,rb:9},G={fb:"complete",Bb:"success",Ea:"error",Da:"abort",tb:"ready",ub:"readystatechange",TIMEOUT:"timeout",pb:"incrementaldata",sb:"progress",ib:"downloadprogress",Jb:"uploadprogress"};function Jg(){}function $g(t){var e;return e=!(e=t.a)?t.a={}:e}function Zg(){}Jg.prototype.a=null;z={OPEN:"a",eb:"b",Ea:"c",qb:"d"};function ty(){zv.call(this,"d")}function ey(){zv.call(this,"c")}function ny(){}function ry(t,e,n,r){this.g=t,this.c=e,this.f=n,this.S=r||1,this.J=new Mg(this),this.P=oy,t=Lv?125:void 0,this.R=new kg(t),this.B=null,this.b=!1,this.j=this.l=this.i=this.H=this.u=this.T=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.V=this.C=this.U=this.I=!1}dv(ty,zv),dv(ey,zv),dv(ny,Jg);var iy=new ny,oy=45e3,ay={},sy={};function uy(t,e,n){t.H=1,t.i=Ay(Ty(e)),t.j=n,t.I=!0,cy(t,null)}function cy(t,e){t.u=pv(),ly(t),t.l=Ty(t.i);var a,s,u,c,h,l,n=t.l,r=t.S;Array.isArray(r)||(r=[String(r)]),By(n.b,"t",r),t.D=0,t.a=Lm(t.g,t.g.C?e:null),0<t.O&&(t.F=new Dg(lv(t.Ca,t,t.a),t.O)),Ug(t.J,t.a,"readystatechange",t.Xa),e=t.B?kv(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)),Gg(1),a=t.c,s=t.m,u=t.l,c=t.f,h=t.S,l=t.j,a.info(function(){if(a.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+"]: "+s+"\n"+u+"\n"+t})}function hy(t,e,n){for(var r,i,o,a=!0;!t.A&&t.D<n.length;){var s=(s=n,o=i=void 0,i=(r=t).D,-1==(o=s.indexOf("\n",i))?sy:(i=Number(s.substring(i,o)),isNaN(i)?ay:(o+=1)+i>s.length?sy:(s=s.substr(o,i),r.D=o+i,s)));if(s==sy){4==e&&(t.h=4,Qg(14),a=!1),Vg(t.c,t.f,null,"[Incomplete Response]");break}if(s==ay){t.h=4,Qg(15),Vg(t.c,t.f,n,"[Invalid Chunk]"),a=!1;break}Vg(t.c,t.f,s,null),gy(t,s)}4==e&&0==n.length&&(t.h=1,Qg(16),a=!1),t.b=t.b&&a,a?0<n.length&&!t.V&&(t.V=!0,(e=t.g).a==t&&e.U&&!e.F&&(e.c.info("Great, no buffering proxy detected. Bytes received: "+n.length),km(e),e.F=!0,Qg(11))):(Vg(t.c,t.f,n,"[Invalid Chunked Response]"),vy(t),dy(t))}function ly(t){t.T=pv()+t.P,fy(t,t.P)}function fy(t,e){if(null!=t.o)throw Error("WatchDog timer not null");t.o=Xg(lv(t.Va,t),e)}function py(t){t.o&&(rv.clearTimeout(t.o),t.o=null)}function dy(t){0==t.g.v||t.A||Rm(t.g,t)}function vy(t){py(t);var e=t.F;e&&"function"==typeof e.ja&&e.ja(),t.F=null,Ng(t.R),jg(t.J),t.a&&(e=t.a,t.a=null,e.abort(),e.ja())}function gy(t,e){try{var n,r,i,o,a,s=t.g;if(0!=s.v&&(s.a==t||Yy(s.b,t)))if(s.I=t.N,!t.C&&Yy(s.b,t)&&3==s.v){try{var u=s.ka.a.parse(e)}catch(t){u=null}if(Array.isArray(u)&&3==u.length){var c=u;if(0==c[0]){t:if(!s.j){if(s.a){if(!(s.a.u+3e3<t.u))break t;Am(s),mm(s)}Cm(s),Qg(18)}}else s.oa=c[1],0<s.oa-s.P&&c[2]<37500&&s.H&&0==s.o&&!s.m&&(s.m=Xg(lv(s.Sa,s),6e3));if(Qy(s.b)<=1&&s.ea){try{s.ea()}catch(t){}s.ea=void 0}}else Pm(s,11)}else if(!t.C&&s.a!=t||Am(s),!_v(e))for(e=u=s.ka.a.parse(e),u=0;u<e.length;u++)c=e[u],s.P=c[0],c=c[1],2==s.v?"c"==c[0]?(s.J=c[1],s.ga=c[2],null!=(r=c[3])&&(s.ha=r,s.c.info("VER="+s.ha)),null!=(o=c[4])&&(s.pa=o,s.c.info("SVER="+s.pa)),null!=(r=c[5])&&"number"==typeof r&&0<r&&(n=1.5*r,s.D=n,s.c.info("backChannelRequestTimeoutMs_="+n)),n=s,(o=t.a)&&(!(r=o.a?o.a.getResponseHeader("X-Client-Wire-Protocol"):null)||!(i=n.b).a&&(Tv(r,"spdy")||Tv(r,"quic")||Tv(r,"h2"))&&(i.f=i.g,i.a=new Set,i.b&&(Xy(i,i.b),i.b=null)),!n.A||(a=o.a?o.a.getResponseHeader("X-HTTP-Session-Id"):null)&&(n.na=a,Ny(n.B,n.A,a))),s.v=3,s.f&&s.f.ta(),s.U&&(s.N=pv()-t.u,s.c.info("Handshake RTT: "+s.N+"ms")),i=t,(n=s).la=xm(n,n.C?n.ga:null,n.fa),i.C?(Jy(n.b,i),o=i,(a=n.D)&&o.setTimeout(a),o.o&&(py(o),ly(o)),n.a=i):Sm(n),0<s.g.length&&wm(s)):"stop"!=c[0]&&"close"!=c[0]||Pm(s,7):3==s.v&&("stop"==c[0]||"close"==c[0]?"stop"==c[0]?Pm(s,7):ym(s):"noop"!=c[0]&&s.f&&s.f.sa(c),s.o=0);Gg(4)}catch(t){}}function yy(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(ov(t)||"string"==typeof t)yv(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(ov(t)||"string"==typeof t)for(var n=[],r=t.length,i=0;i<r;i++)n.push(i);else for(i in n=[],r=0,t)n[r++]=i;for(var i=(r=function(t){if(t.K&&"function"==typeof t.K)return t.K();if("string"==typeof t)return t.split("");if(ov(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,o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}}function my(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 my)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 by(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];_y(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;)_y(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function _y(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(Hs=ry.prototype).setTimeout=function(t){this.P=t},Hs.Xa=function(t){t=t.target;var e=this.F;e&&3==pm(t)?e.f():this.Ca(t)},Hs.Ca=function(t){try{if(t==this.a)t:{var e=pm(this.a),n=this.a.ua(),r=this.a.W();if(!(e<3||3==e&&!Lv&&!this.a.$())){this.A||4!=e||7==n||Gg(8==n||r<=0?3:2),py(this);var i=this.a.W();this.N=i;var o=this.a.$();if(this.b=200==i,r=this.c,u=this.m,c=this.l,h=this.f,l=this.S,f=e,p=i,r.info(function(){return"XMLHTTP RESP ("+h+") [ attempt "+l+"]: "+u+"\n"+c+"\n"+f+" "+p}),this.b){if(this.U&&!this.C){e:{if(this.a){var a=this.a;if((a=a.a?a.a.getResponseHeader("X-HTTP-Initial-Response"):null)&&!_v(a)){var s=a;break e}}s=null}if(!s){this.b=!1,this.h=3,Qg(12),vy(this),dy(this);break t}Vg(this.c,this.f,s,"Initial handshake response via X-HTTP-Initial-Response"),this.C=!0,gy(this,s)}this.I?(hy(this,e,o),Lv&&this.b&&3==e&&(Ug(this.J,this.R,"tick",this.Wa),this.R.start())):(Vg(this.c,this.f,o,null),gy(this,o)),4==e&&vy(this),this.b&&!this.A&&(4==e?Rm(this.g,this):(this.b=!1,ly(this)))}else 400==i&&0<o.indexOf("Unknown SID")?(this.h=3,Qg(12)):(this.h=0,Qg(13)),vy(this),dy(this)}}}catch(t){}var u,c,h,l,f,p},Hs.Wa=function(){var t,e;this.a&&(t=pm(this.a),e=this.a.$(),this.D<e.length&&(py(this),hy(this,t,e),this.b&&4!=t&&ly(this)))},Hs.cancel=function(){this.A=!0,vy(this)},Hs.Va=function(){this.o=null;var t,e,n=pv();0<=n-this.T?(t=this.c,e=this.l,t.info(function(){return"TIMEOUT: "+e}),2!=this.H&&(Gg(3),Qg(17)),vy(this),this.h=2,dy(this)):fy(this,this.T-n)},(Hs=my.prototype).K=function(){by(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},Hs.L=function(){return by(this),this.a.concat()},Hs.get=function(t,e){return _y(this.b,t)?this.b[t]:e},Hs.set=function(t,e){_y(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},Hs.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 wy=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Iy(t,e){var n;this.c=this.j=this.f="",this.h=null,this.i=this.g="",this.a=!1,t instanceof Iy?(this.a=void 0!==e?e:t.a,Ey(this,t.f),this.j=t.j,Sy(this,t.c),Cy(this,t.h),this.g=t.g,e=t.b,(n=new Uy).c=e.c,e.a&&(n.a=new my(e.a),n.b=e.b),ky(this,n),this.i=t.i):t&&(n=String(t).match(wy))?(this.a=!!e,Ey(this,n[1]||"",!0),this.j=Ry(n[2]||""),Sy(this,n[3]||"",!0),Cy(this,n[4]),this.g=Ry(n[5]||"",!0),ky(this,n[6]||"",!0),this.i=Ry(n[7]||"")):(this.a=!!e,this.b=new Uy(null,this.a))}function Ty(t){return new Iy(t)}function Ey(t,e,n){t.f=n?Ry(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function Sy(t,e,n){t.c=n?Ry(e,!0):e}function Cy(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 ky(t,e,n){var r,i;e instanceof Uy?(t.b=e,r=t.b,(i=t.a)&&!r.f&&(jy(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(qy(this,e),By(this,n,t))},r)),r.f=i):(n||(e=Oy(e,My)),t.b=new Uy(e,t.a))}function Ny(t,e,n){t.b.set(e,n)}function Ay(t){return Ny(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^pv()).toString(36)),t}function Ry(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Oy(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Py),t=n?t.replace(/%25([0-9a-fA-F]{2})/g,"%$1"):t):null}function Py(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Iy.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Oy(e,Dy,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(Oy(e,Dy,!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(Oy(n,"/"==n.charAt(0)?Ly:xy,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",Oy(n,Fy)),t.join("")};var Dy=/[#\/\?@]/g,xy=/[#\?:]/g,Ly=/[#\?]/g,My=/[#\?@]/g,Fy=/#/g;function Uy(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function jy(n){n.a||(n.a=new my,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 qy(t,e){jy(t),e=Ky(t,e),_y(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,_y((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&by(t)))}function Vy(t,e){return jy(t),e=Ky(t,e),_y(t.a.b,e)}function By(t,e,n){qy(t,e),0<n.length&&(t.c=null,t.a.set(Ky(t,e),bv(n)),t.b+=n.length)}function Ky(t,e){return e=String(e),e=t.f?e.toLowerCase():e}(Hs=Uy.prototype).add=function(t,e){jy(this),this.c=null,t=Ky(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},Hs.forEach=function(n,r){jy(this),this.a.forEach(function(t,e){yv(t,function(t){n.call(r,t,e,this)},this)},this)},Hs.L=function(){jy(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},Hs.K=function(t){jy(this);var e=[];if("string"==typeof t)Vy(this,t)&&(e=mv(e,this.a.get(Ky(this,t))));else{t=this.a.K();for(var n=0;n<t.length;n++)e=mv(e,t[n])}return e},Hs.set=function(t,e){return jy(this),this.c=null,Vy(this,t=Ky(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},Hs.get=function(t,e){return t&&0<(t=this.K(t)).length?String(t[0]):e},Hs.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 a=i;""!==r[o]&&(a+="="+encodeURIComponent(String(r[o]))),t.push(a)}return this.c=t.join("&")};var Wy=function(t,e){this.b=t,this.a=e};function Hy(t){this.g=t||Gy,t=rv.PerformanceNavigationTiming?0<(t=rv.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(rv.ia&&rv.ia.ya&&rv.ia.ya()&&rv.ia.ya().Lb),this.f=t?this.g:1,this.a=null,1<this.f&&(this.a=new Set),this.b=null,this.c=[]}var Gy=10;function zy(t){return t.b||t.a&&t.a.size>=t.f}function Qy(t){return t.b?1:t.a?t.a.size:0}function Yy(t,e){return t.b?t.b==e:t.a&&t.a.has(e)}function Xy(t,e){t.a?t.a.add(e):t.b=e}function Jy(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function $y(t){var e,n;if(null!=t.b)return t.c.concat(t.b.s);if(null==t.a||0===t.a.size)return bv(t.c);var r=t.c;try{for(var i=ev(t.a.values()),o=i.next();!o.done;o=i.next())var a=o.value,r=r.concat(a.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 Zy(){}function tm(){this.a=new Zy}function em(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}Hy.prototype.cancel=function(){var e,t;if(this.c=$y(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=ev(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()}},Zy.prototype.stringify=function(t){return rv.JSON.stringify(t,void 0)},Zy.prototype.parse=function(t){return rv.JSON.parse(t,void 0)};var nm=rv.JSON.parse;function rm(t){dg.call(this),this.headers=new my,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=im,this.D=this.F=!1}dv(rm,dg);var im="",om=/^https?$/i,am=["POST","PUT"];function sm(t){return"content-type"==t.toLowerCase()}function um(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,cm(t),lm(t)}function cm(t){t.u||(t.u=!0,vg(t,"complete"),vg(t,"error"))}function hm(t){if(t.b&&void 0!==nv&&(!t.s[1]||4!=pm(t)||2!=t.W()))if(t.l&&4==pm(t))Ag(t.za,0,t);else if(vg(t,"readystatechange"),4==pm(t)){t.b=!1;try{var e,n,r,i,o=t.W();t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var a=!0;break t;default:a=!1}(e=a)||((n=0===o)&&(!(i=String(t.B).match(wy)[1]||null)&&rv.self&&rv.self.location&&(i=(r=rv.self.location.protocol).substr(0,r.length-1)),n=!om.test(i?i.toLowerCase():"")),e=n);if(e)vg(t,"complete"),vg(t,"success");else{t.h=6;try{var s=2<pm(t)?t.a.statusText:""}catch(o){s=""}t.f=s+" ["+t.W()+"]",cm(t)}}finally{lm(t)}}}function lm(t,e){if(t.a){fm(t);var n=t.a,r=t.s[0]?iv:null;t.a=null,t.s=null,e||vg(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function fm(t){t.a&&t.D&&(t.a.ontimeout=null),t.m&&(rv.clearTimeout(t.m),t.m=null)}function pm(t){return t.a?t.a.readyState:0}function dm(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}var i;r||(i="",Cv(n,function(t,e){i+=e,i+=":",i+=t,i+="\r\n"}),n=i,"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Ny(t,e,n))}function vm(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function gm(t){this.pa=0,this.g=[],this.c=new qg,this.ga=this.la=this.B=this.fa=this.a=this.na=this.A=this.V=this.i=this.O=this.l=null,this.Oa=this.R=0,this.La=vm("failFast",!1,t),this.H=this.m=this.j=this.h=this.f=null,this.S=!0,this.I=this.oa=this.P=-1,this.T=this.o=this.u=0,this.Ha=vm("baseRetryDelayMs",5e3,t),this.Ra=vm("retryDelaySeedMs",1e4,t),this.Ma=vm("forwardChannelMaxRetries",2,t),this.ma=vm("forwardChannelRequestTimeoutMs",2e4,t),this.Na=t&&t.g||void 0,this.D=void 0,this.C=t&&t.supportsCrossDomainXhr||!1,this.J="",this.b=new Hy(t&&t.concurrentRequestLimit),this.ka=new tm,this.da=t&&t.fastHandshake||!1,this.Ia=t&&t.b||!1,t&&t.f&&(this.c.a=!1),t&&t.forceLongPolling&&(this.S=!1),this.U=!this.da&&this.S&&t&&t.detectBufferingProxy||!1,this.ea=void 0,this.N=0,this.F=!1,this.s=null,(this.Ka=t&&t.c||!1)&&this.c.info("Opt-in to enable Chrome Origin Trials.")}function ym(t){var e,n;bm(t),3==t.v&&(e=t.R++,Ny(n=Ty(t.B),"SID",t.J),Ny(n,"RID",e),Ny(n,"TYPE","terminate"),Tm(t,n),(e=new ry(t,t.c,e,void 0)).H=2,e.i=Ay(Ty(n)),n=!1,!(n=rv.navigator&&rv.navigator.sendBeacon?rv.navigator.sendBeacon(e.i.toString(),""):n)&&rv.Image&&((new Image).src=e.i,n=!0),n||(e.a=Lm(e.g,null),e.a.ba(e.i)),e.u=pv(),ly(e)),Dm(t)}function mm(t){t.a&&(km(t),t.a.cancel(),t.a=null)}function bm(t){mm(t),t.j&&(rv.clearTimeout(t.j),t.j=null),Am(t),t.b.cancel(),t.h&&("number"==typeof t.h&&rv.clearTimeout(t.h),t.h=null)}function _m(t,e){t.g.push(new Wy(t.Oa++,e)),3==t.v&&wm(t)}function wm(t){zy(t.b)||t.h||(t.h=!0,Tg(t.Ba,t),t.u=0)}function Im(t,e){var n=e?e.f:t.R++,r=Ty(t.B);Ny(r,"SID",t.J),Ny(r,"RID",n),Ny(r,"AID",t.P),Tm(t,r),t.i&&t.l&&dm(r,t.i,t.l),n=new ry(t,t.c,n,t.u+1),null===t.i&&(n.B=t.l),e&&(t.g=e.s.concat(t.g)),e=Em(t,n,1e3),n.setTimeout(Math.round(.5*t.ma)+Math.round(.5*t.ma*Math.random())),Xy(t.b,n),uy(n,r,e)}function Tm(t,n){t.f&&yy({},function(t,e){Ny(n,e,t)})}function Em(t,e,n){n=Math.min(t.g.length,n);var r=t.f?lv(t.f.Ja,t.f,t):null;t:for(var i=t.g,o=-1;;){var a=["count="+n];-1==o?0<n?(o=i[0].b,a.push("ofs="+o)):o=0:a.push("ofs="+o);for(var s=!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),s=!1;else try{!function(t,r,e){var i=e||"";try{yy(t,function(t,e){var n=t;av(t)&&(n=yg(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}(h,a,"req"+c+"_")}catch(t){r&&r(h)}}if(s){r=a.join("&");break t}}return t=t.g.splice(0,n),e.s=t,r}function Sm(t){t.a||t.j||(t.T=1,Tg(t.Aa,t),t.o=0)}function Cm(t){return!(t.a||t.j||3<=t.o)&&(t.T++,t.j=Xg(lv(t.Aa,t),Om(t,t.o)),t.o++,1)}function km(t){null!=t.s&&(rv.clearTimeout(t.s),t.s=null)}function Nm(t){t.a=new ry(t,t.c,"rpc",t.T),null===t.i&&(t.a.B=t.l),t.a.O=0;var e=Ty(t.la);Ny(e,"RID","rpc"),Ny(e,"SID",t.J),Ny(e,"CI",t.H?"0":"1"),Ny(e,"AID",t.P),Tm(t,e),Ny(e,"TYPE","xmlhttp"),t.i&&t.l&&dm(e,t.i,t.l),t.D&&t.a.setTimeout(t.D);var n=t.a;t=t.ga,n.H=1,n.i=Ay(Ty(e)),n.j=null,n.I=!0,cy(n,t)}function Am(t){null!=t.m&&(rv.clearTimeout(t.m),t.m=null)}function Rm(t,e){var n,r,i,o=null;if(t.a==e){Am(t),km(t),t.a=null;var a=2}else{if(!Yy(t.b,e))return;o=e.s,Jy(t.b,e),a=1}if(t.I=e.N,0!=t.v)if(e.b)1==a?(o=e.j?e.j.length:0,e=pv()-e.u,n=t.u,vg(a=Wg(),new Yg(a)),wm(t)):Sm(t);else if(3==(n=e.h)||0==n&&0<t.I||(1!=a||(i=e,Qy((r=t).b)>=r.b.f-(r.h?1:0)||(r.h?(r.g=i.s.concat(r.g),0):1==r.v||2==r.v||r.u>=(r.La?0:r.Ma)||(r.h=Xg(lv(r.Ba,r,i),Om(r,r.u)),r.u++,0))))&&(2!=a||!Cm(t)))switch(o&&0<o.length&&(e=t.b,e.c=e.c.concat(o)),n){case 1:Pm(t,5);break;case 4:Pm(t,10);break;case 3:Pm(t,6);break;default:Pm(t,2)}}function Om(t,e){var n=t.Ha+Math.floor(Math.random()*t.Ra);return t.f||(n*=2),n*e}function Pm(t,e){var n,r,i,o;t.c.info("Error code "+e),2==e?(r=null,t.f&&(r=null),o=lv(t.Ya,t),r||(r=new Iy("//www.google.com/images/cleardot.gif"),rv.location&&"http"==rv.location.protocol||Ey(r,"https"),Ay(r)),n=r.toString(),r=o,o=new qg,rv.Image?((i=new Image).onload=fv(em,o,i,"TestLoadImage: loaded",!0,r),i.onerror=fv(em,o,i,"TestLoadImage: error",!1,r),i.onabort=fv(em,o,i,"TestLoadImage: abort",!1,r),i.ontimeout=fv(em,o,i,"TestLoadImage: timeout",!1,r),rv.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=n):r(!1)):Qg(2),t.v=0,t.f&&t.f.ra(e),Dm(t),bm(t)}function Dm(t){t.v=0,t.I=-1,t.f&&(0==$y(t.b).length&&0==t.g.length||(t.b.c.length=0,bv(t.g),t.g.length=0),t.f.qa())}function xm(t,e,n){var r,i,o,a,s,u=(a=n)instanceof Iy?Ty(a):new Iy(a,void 0);return""!=u.c?(e&&Sy(u,e+"."+u.c),Cy(u,u.h)):(s=rv.location,r=s.protocol,i=e?e+"."+s.hostname:s.hostname,o=+s.port,a=n,s=new Iy(null,void 0),r&&Ey(s,r),i&&Sy(s,i),o&&Cy(s,o),a&&(s.g=a),u=s),t.V&&Cv(t.V,function(t,e){Ny(u,e,t)}),e=t.A,n=t.na,e&&n&&Ny(u,e,n),Ny(u,"VER",t.ha),Tm(t,u),u}function Lm(t,e){if(e&&!t.C)throw Error("Can't create secondary domain capable XhrIo object.");return(e=new rm(t.Na)).F=t.C,e}function Mm(){}function Fm(){if(Dv&&!(10<=Number(Kv)))throw Error("Environmental error: no available transport.")}function Um(t,e){dg.call(this),this.a=new gm(e),this.o=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)&&!_v(t)&&(this.a.i=t),this.m=e&&e.supportsCrossDomainXhr||!1,this.l=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!_v(e)&&(this.a.A=e,null!==(t=this.b)&&e in t&&(e in(t=this.b)&&delete t[e])),this.f=new Vm(this)}function jm(t){ty.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 qm(){ey.call(this),this.status=1}function Vm(t){this.a=t}(Hs=rm.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?$g(this.H):$g(iy),this.a.onreadystatechange=lv(this.za,this);try{this.A=!0,this.a.open(e,String(t),!0),this.A=!1}catch(t){return void um(this,t)}t=n||"";var i,o=new my(this.headers);r&&yy(r,function(t,e){o.set(e,t)}),r=function(t){t:{for(var e=sm,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=rv.FormData&&t instanceof rv.FormData,0<=gv(am,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{fm(this),0<this.o&&((this.D=(i=this.a,Dv&&Bv(9)&&"number"==typeof i.timeout&&void 0!==i.ontimeout))?(this.a.timeout=this.o,this.a.ontimeout=lv(this.xa,this)):this.m=Ag(this.xa,this.o,this)),this.l=!0,this.a.send(t),this.l=!1}catch(t){um(this,t)}},Hs.xa=function(){void 0!==nv&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,vg(this,"timeout"),this.abort(8))},Hs.abort=function(t){this.a&&this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1,this.h=t||7,vg(this,"complete"),vg(this,"abort"),lm(this))},Hs.G=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),lm(this,!0)),rm.X.G.call(this)},Hs.za=function(){this.j||(this.A||this.l||this.g?hm(this):this.Ua())},Hs.Ua=function(){hm(this)},Hs.W=function(){try{return 2<pm(this)?this.a.status:-1}catch(t){return-1}},Hs.$=function(){try{return this.a?this.a.responseText:""}catch(t){return""}},Hs.Pa=function(t){if(this.a){var e=this.a.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),nm(e)}},Hs.ua=function(){return this.h},Hs.Qa=function(){return"string"==typeof this.f?this.f:String(this.f)},(Hs=gm.prototype).ha=8,Hs.v=1,Hs.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 ry(this,this.c,t,void 0),r=this.l;if(this.O&&(r?Av(r=kv(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=Em(this,n,e),Ny(i=Ty(this.B),"RID",t),Ny(i,"CVER",22),this.A&&Ny(i,"X-HTTP-Session-Id",this.A),Tm(this,i),this.i&&r&&dm(i,this.i,r),Xy(this.b,n),this.Ia&&Ny(i,"TYPE","init"),this.da?(Ny(i,"$req",e),Ny(i,"SID","null"),n.U=!0,uy(n,i,null)):uy(n,i,e),this.v=2}}else 3==this.v&&(t?Im(this,t):0==this.g.length||zy(this.b)||Im(this))},Hs.Aa=function(){var t;this.j=null,Nm(this),this.U&&!(this.F||null==this.a||this.N<=0)&&(t=2*this.N,this.c.info("BP detection timer enabled: "+t),this.s=Xg(lv(this.Ta,this),t))},Hs.Ta=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,Qg(10),mm(this),Nm(this))},Hs.Sa=function(){null!=this.m&&(this.m=null,mm(this),Cm(this),Qg(19))},Hs.Ya=function(t){t?(this.c.info("Successfully pinged google.com"),Qg(2)):(this.c.info("Failed to ping google.com"),Qg(1))},(Hs=Mm.prototype).ta=function(){},Hs.sa=function(){},Hs.ra=function(){},Hs.qa=function(){},Hs.Ja=function(){},Fm.prototype.a=function(t,e){return new Um(t,e)},dv(Um,dg),Um.prototype.g=function(){this.a.f=this.f,this.m&&(this.a.C=!0);var t=this.a,e=this.o,n=this.b||void 0;Qg(0),t.fa=e,t.V=n||{},t.H=t.S,t.B=xm(t,null,t.fa),wm(t)},Um.prototype.close=function(){ym(this.a)},Um.prototype.h=function(t){var e;"string"==typeof t?((e={}).__data__=t,_m(this.a,e)):this.l?((e={}).__data__=yg(t),_m(this.a,e)):_m(this.a,t)},Um.prototype.G=function(){this.a.f=null,delete this.f,ym(this.a),delete this.a,Um.X.G.call(this)},dv(jm,ty),dv(qm,ey),dv(Vm,Mm),Vm.prototype.ta=function(){vg(this.a,"a")},Vm.prototype.sa=function(t){vg(this.a,new jm(t))},Vm.prototype.ra=function(t){vg(this.a,new qm)},Vm.prototype.qa=function(){vg(this.a,"b")},Fm.prototype.createWebChannel=Fm.prototype.a,Um.prototype.send=Um.prototype.h,Um.prototype.open=Um.prototype.g,Sn.NO_ERROR=0,Sn.TIMEOUT=8,Sn.HTTP_ERROR=6,G.COMPLETE="complete",(Zg.EventType=z).OPEN="a",z.CLOSE="b",z.ERROR="c",z.MESSAGE="d",dg.prototype.listen=dg.prototype.va,rm.prototype.listenOnce=rm.prototype.wa,rm.prototype.getLastError=rm.prototype.Qa,rm.prototype.getLastErrorCode=rm.prototype.ua,rm.prototype.getStatus=rm.prototype.W,rm.prototype.getResponseJson=rm.prototype.Pa,rm.prototype.getResponseText=rm.prototype.$,rm.prototype.send=rm.prototype.ba;var Bm=Wg,Km=Sn,Wm=G,Hm=Bg,Gm=10,zm=11,Qm=Zg,Ym=rm,Xm=(Jm.prototype.t=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},Jm.prototype.next=function(){var t=++this.previousValue;return this.i&&this.i(t),t},Jm);function Jm(t,e){var n=this;this.previousValue=t,e&&(e.sequenceNumberHandler=function(t){return n.t(t)},this.i=function(t){return e.writeSequenceNumber(t)})}Xm.o=-1;var $m,Zm={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"},tb=(Xi(nb,$m=Error),nb),eb=new pa("@firebase/firestore");function nb(t,e){var n=this;return(n=$m.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 rb(){return eb.logLevel}function ib(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];eb.logLevel<=sa.DEBUG&&(e=n.map(sb),eb.debug.apply(eb,no(["Firestore (8.4.2): "+t],e)))}function ob(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];eb.logLevel<=sa.ERROR&&(e=n.map(sb),eb.error.apply(eb,no(["Firestore (8.4.2): "+t],e)))}function ab(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];eb.logLevel<=sa.WARN&&(e=n.map(sb),eb.warn.apply(eb,no(["Firestore (8.4.2): "+t],e)))}function sb(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function ub(t){t="FIRESTORE (8.4.2) INTERNAL ASSERTION FAILED: "+(t=void 0===t?"Unexpected state":t);throw ob(t),new Error(t)}function cb(t){t||ub()}var hb=(lb.u=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},lb);function lb(){}function fb(t,e){return t<e?-1:e<t?1:0}function pb(t,n,r){return t.length===n.length&&t.every(function(t,e){return r(t,n[e])})}function db(t){return t+"\0"}var vb=(mb.now=function(){return mb.fromMillis(Date.now())},mb.fromDate=function(t){return mb.fromMillis(t.getTime())},mb.fromMillis=function(t){var e=Math.floor(t/1e3);return new mb(e,Math.floor(1e6*(t-1e3*e)))},mb.prototype.toDate=function(){return new Date(this.toMillis())},mb.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},mb.prototype._compareTo=function(t){return this.seconds===t.seconds?fb(this.nanoseconds,t.nanoseconds):fb(this.seconds,t.seconds)},mb.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},mb.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},mb.prototype.toJSON=function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}},mb.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},mb),gb=(yb.fromTimestamp=function(t){return new yb(t)},yb.min=function(){return new yb(new vb(0,0))},yb.prototype.compareTo=function(t){return this.timestamp._compareTo(t.timestamp)},yb.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},yb.prototype.toMicroseconds=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},yb.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},yb.prototype.toTimestamp=function(){return this.timestamp},yb);function yb(t){this.timestamp=t}function mb(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new tb(Zm.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new tb(Zm.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new tb(Zm.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new tb(Zm.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function bb(t){var e,n=0;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&n++;return n}function _b(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function wb(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var Ib,Tb,Sn=(Object.defineProperty(Db.prototype,"length",{get:function(){return this.len},enumerable:!1,configurable:!0}),Db.prototype.isEqual=function(t){return 0===Db.comparator(this,t)},Db.prototype.child=function(t){var e=this.segments.slice(this.offset,this.limit());return t instanceof Db?t.forEach(function(t){e.push(t)}):e.push(t),this.construct(e)},Db.prototype.limit=function(){return this.offset+this.length},Db.prototype.popFirst=function(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)},Db.prototype.popLast=function(){return this.construct(this.segments,this.offset,this.length-1)},Db.prototype.firstSegment=function(){return this.segments[this.offset]},Db.prototype.lastSegment=function(){return this.get(this.length-1)},Db.prototype.get=function(t){return this.segments[this.offset+t]},Db.prototype.isEmpty=function(){return 0===this.length},Db.prototype.isPrefixOf=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},Db.prototype.isImmediateParentOf=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},Db.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},Db.prototype.toArray=function(){return this.segments.slice(this.offset,this.limit())},Db.comparator=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},Db),Eb=(Xi(Pb,Tb=Sn),Pb.prototype.construct=function(t,e,n){return new Pb(t,e,n)},Pb.prototype.canonicalString=function(){return this.toArray().join("/")},Pb.prototype.toString=function(){return this.canonicalString()},Pb.fromString=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 tb(Zm.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 Pb(n)},Pb.emptyPath=function(){return new Pb([])},Pb),Sb=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Cb=(Xi(Ob,Ib=Sn),Ob.prototype.construct=function(t,e,n){return new Ob(t,e,n)},Ob.isValidIdentifier=function(t){return Sb.test(t)},Ob.prototype.canonicalString=function(){return this.toArray().map(function(t){return t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),t=!Ob.isValidIdentifier(t)?"`"+t+"`":t}).join(".")},Ob.prototype.toString=function(){return this.canonicalString()},Ob.prototype.isKeyField=function(){return 1===this.length&&"__name__"===this.get(0)},Ob.keyField=function(){return new Ob(["__name__"])},Ob.fromServerFormat=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new tb(Zm.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 a=t[r];if("\\"===a){if(r+1===t.length)throw new tb(Zm.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var s=t[r+1];if("\\"!==s&&"."!==s&&"`"!==s)throw new tb(Zm.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=s,r+=2}else"`"===a?o=!o:"."!==a||o?n+=a:i(),r++}if(i(),o)throw new tb(Zm.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new Ob(e)},Ob.emptyPath=function(){return new Ob([])},Ob),kb=(Rb.prototype.covers=function(t){for(var e=0,n=this.fields;e<n.length;e++)if(n[e].isPrefixOf(t))return!0;return!1},Rb.prototype.isEqual=function(t){return pb(this.fields,t.fields,function(t,e){return t.isEqual(e)})},Rb),Nb=(Ab.fromBase64String=function(t){return new Ab(atob(t))},Ab.fromUint8Array=function(t){return new Ab(function(t){for(var e="",n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t))},Ab.prototype.toBase64=function(){return t=this.binaryString,btoa(t);var t},Ab.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.binaryString)},Ab.prototype.approximateByteSize=function(){return 2*this.binaryString.length},Ab.prototype.compareTo=function(t){return fb(this.binaryString,t.binaryString)},Ab.prototype.isEqual=function(t){return this.binaryString===t.binaryString},Ab);function Ab(t){this.binaryString=t}function Rb(t){(this.fields=t).sort(Cb.comparator)}function Ob(){return null!==Ib&&Ib.apply(this,arguments)||this}function Pb(){return null!==Tb&&Tb.apply(this,arguments)||this}function Db(t,e,n){void 0===e?e=0:e>t.length&&ub(),void 0===n?n=t.length-e:n>t.length-e&&ub(),this.segments=t,this.offset=e,this.len=n}Nb.EMPTY_BYTE_STRING=new Nb("");var xb=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Lb(t){if(cb(!!t),"string"!=typeof t)return{seconds:Mb(t.seconds),nanos:Mb(t.nanos)};var e=0,n=xb.exec(t);cb(!!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 Mb(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Fb(t){return"string"==typeof t?Nb.fromBase64String(t):Nb.fromUint8Array(t)}function Ub(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 jb(t){t=Lb(t.mapValue.fields.__local_write_time__.timestampValue);return new vb(t.seconds,t.nanos)}function qb(t){return null==t}function Vb(t){return 0===t&&1/t==-1/0}function Bb(t){return"number"==typeof t&&Number.isInteger(t)&&!Vb(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var Kb=(Wb.fromPath=function(t){return new Wb(Eb.fromString(t))},Wb.fromName=function(t){return new Wb(Eb.fromString(t).popFirst(5))},Wb.prototype.hasCollectionId=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},Wb.prototype.isEqual=function(t){return null!==t&&0===Eb.comparator(this.path,t.path)},Wb.prototype.toString=function(){return this.path.toString()},Wb.comparator=function(t,e){return Eb.comparator(t.path,e.path)},Wb.isDocumentKey=function(t){return t.length%2==0},Wb.fromSegments=function(t){return new Wb(new Eb(t.slice()))},Wb);function Wb(t){this.path=t}function Hb(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?Ub(t)?4:10:ub()}function Gb(r,i){var t,e,n=Hb(r);if(n!==Hb(i))return!1;switch(n){case 0:return!0;case 1:return r.booleanValue===i.booleanValue;case 4:return jb(r).isEqual(jb(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=Lb(r.timestampValue),t=Lb(t.timestampValue);return e.seconds===t.seconds&&e.nanos===t.nanos}(i);case 5:return r.stringValue===i.stringValue;case 6:return e=i,Fb(r.bytesValue).isEqual(Fb(e.bytesValue));case 7:return r.referenceValue===i.referenceValue;case 8:return t=i,Mb((e=r).geoPointValue.latitude)===Mb(t.geoPointValue.latitude)&&Mb(e.geoPointValue.longitude)===Mb(t.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Mb(t.integerValue)===Mb(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){t=Mb(t.doubleValue),e=Mb(e.doubleValue);return t===e?Vb(t)===Vb(e):isNaN(t)&&isNaN(e)}return!1}(r,i);case 9:return pb(r.arrayValue.values||[],i.arrayValue.values||[],Gb);case 10:return function(){var t,e=r.mapValue.fields||{},n=i.mapValue.fields||{};if(bb(e)!==bb(n))return!1;for(t in e)if(e.hasOwnProperty(t)&&(void 0===n[t]||!Gb(e[t],n[t])))return!1;return!0}();default:return ub()}}function zb(t,e){return void 0!==(t.values||[]).find(function(t){return Gb(t,e)})}function Qb(t,e){var n,r,i,o=Hb(t),a=Hb(e);if(o!==a)return fb(o,a);switch(o){case 0:return 0;case 1:return fb(t.booleanValue,e.booleanValue);case 2:return r=e,i=Mb(t.integerValue||t.doubleValue),r=Mb(r.integerValue||r.doubleValue),i<r?-1:r<i?1:i===r?0:isNaN(i)?isNaN(r)?0:-1:1;case 3:return Yb(t.timestampValue,e.timestampValue);case 4:return Yb(jb(t),jb(e));case 5:return fb(t.stringValue,e.stringValue);case 6:return function(t,e){t=Fb(t),e=Fb(e);return t.compareTo(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=fb(n[i],r[i]);if(0!==o)return o}return fb(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return n=t.geoPointValue,i=e.geoPointValue,0!==(r=fb(Mb(n.latitude),Mb(i.latitude)))?r:fb(Mb(n.longitude),Mb(i.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=Qb(n[i],r[i]);if(o)return o}return fb(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 a=0;a<r.length&&a<o.length;++a){var s=fb(r[a],o[a]);if(0!==s)return s;s=Qb(n[r[a]],i[o[a]]);if(0!==s)return s}return fb(r.length,o.length)}(t.mapValue,e.mapValue);default:throw ub()}}function Yb(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return fb(t,e);var n=Lb(t),t=Lb(e),e=fb(n.seconds,t.seconds);return 0!==e?e:fb(n.nanos,t.nanos)}function Xb(t){return function a(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=Lb(t);return"time("+t.seconds+","+t.nanos+")"}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?Fb(t.bytesValue).toBase64():"referenceValue"in t?(e=t.referenceValue,Kb.fromName(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+=a(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+":"+a(t.fields[o])}return e+"}"}(t.mapValue):ub();var e}(t)}function Jb(t,e){return{referenceValue:"projects/"+t.projectId+"/databases/"+t.database+"/documents/"+e.path.canonicalString()}}function $b(t){return t&&"integerValue"in t}function Zb(t){return!!t&&"arrayValue"in t}function t_(t){return t&&"nullValue"in t}function e_(t){return t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function n_(t){return t&&"mapValue"in t}var r_=(i_.empty=function(){return new i_({mapValue:{}})},i_.prototype.field=function(t){return i_.extractNestedValue(this.buildProto(),t)},i_.prototype.toProto=function(){return this.field(Cb.emptyPath())},i_.prototype.set=function(t,e){this.setOverlay(t,e)},i_.prototype.setAll=function(t){var n=this;t.forEach(function(t,e){t?n.set(e,t):n.delete(e)})},i_.prototype.delete=function(t){this.setOverlay(t,null)},i_.prototype.isEqual=function(t){return Gb(this.buildProto(),t.buildProto())},i_.prototype.setOverlay=function(t,e){for(var n=this.overlayMap,r=0;r<t.length-1;++r)var i=t.get(r),o=n.get(i),n=(o instanceof Map||(o=o&&10===Hb(o)?new Map(Object.entries(o.mapValue.fields||{})):new Map,n.set(i,o)),o);n.set(t.lastSegment(),e)},i_.prototype.applyOverlay=function(r,t){var i=this,o=!1,e=i_.extractNestedValue(this.partialValue,r),a=n_(e)?Object.assign({},e.mapValue.fields):{};return t.forEach(function(t,e){var n;t instanceof Map?null!=(n=i.applyOverlay(r.child(e),t))&&(a[e]=n,o=!0):null!==t?(a[e]=t,o=!0):a.hasOwnProperty(e)&&(delete a[e],o=!0)}),o?{mapValue:{fields:a}}:null},i_.prototype.buildProto=function(){var t=this.applyOverlay(Cb.emptyPath(),this.overlayMap);return null!=t&&(this.partialValue=t,this.overlayMap.clear()),this.partialValue},i_.extractNestedValue=function(t,e){if(e.isEmpty())return t;for(var n=t,r=0;r<e.length-1;++r){if(!n.mapValue.fields)return null;if(!n_(n=n.mapValue.fields[e.get(r)]))return null}return(n=(n.mapValue.fields||{})[e.lastSegment()])||null},i_.prototype.clone=function(){return new i_(this.buildProto())},i_);function i_(t){this.overlayMap=new Map,this.partialValue=t}var o_=(s_.newInvalidDocument=function(t){return new s_(t,0,gb.min(),r_.empty(),0)},s_.newFoundDocument=function(t,e,n){return new s_(t,1,e,n,0)},s_.newNoDocument=function(t,e){return new s_(t,2,e,r_.empty(),0)},s_.newUnknownDocument=function(t,e){return new s_(t,3,e,r_.empty(),2)},s_.prototype.convertToFoundDocument=function(t,e){return this.version=t,this.documentType=1,this.data=e,this.documentState=0,this},s_.prototype.convertToNoDocument=function(t){return this.version=t,this.documentType=2,this.data=r_.empty(),this.documentState=0,this},s_.prototype.convertToUnknownDocument=function(t){return this.version=t,this.documentType=3,this.data=r_.empty(),this.documentState=2,this},s_.prototype.setHasCommittedMutations=function(){return this.documentState=2,this},s_.prototype.setHasLocalMutations=function(){return this.documentState=1,this},Object.defineProperty(s_.prototype,"hasLocalMutations",{get:function(){return 1===this.documentState},enumerable:!1,configurable:!0}),Object.defineProperty(s_.prototype,"hasCommittedMutations",{get:function(){return 2===this.documentState},enumerable:!1,configurable:!0}),Object.defineProperty(s_.prototype,"hasPendingWrites",{get:function(){return this.hasLocalMutations||this.hasCommittedMutations},enumerable:!1,configurable:!0}),s_.prototype.isValidDocument=function(){return 0!==this.documentType},s_.prototype.isFoundDocument=function(){return 1===this.documentType},s_.prototype.isNoDocument=function(){return 2===this.documentType},s_.prototype.isUnknownDocument=function(){return 3===this.documentType},s_.prototype.isEqual=function(t){return t instanceof s_&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)},s_.prototype.clone=function(){return new s_(this.key,this.documentType,this.version,this.data.clone(),this.documentState)},s_.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+JSON.stringify(this.data.toProto())+", {documentType: "+this.documentType+"}), {documentState: "+this.documentState+"})"},s_),a_=function(t,e,n,r,i,o,a){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===a&&(a=null),this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=a,this.h=null};function s_(t,e,n,r,i){this.key=t,this.documentType=e,this.version=n,this.data=r,this.documentState=i}function u_(t,e,n,r,i,o,a){return new a_(t,e=void 0===e?null:e,n=void 0===n?[]:n,r=void 0===r?[]:r,i=void 0===i?null:i,o=void 0===o?null:o,a=void 0===a?null:a)}function c_(t){var e=t;return null===e.h&&(t=e.path.canonicalString(),null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(function(t){return(t=t).field.canonicalString()+t.op.toString()+Xb(t.value)}).join(","),t+="|ob:",t+=e.orderBy.map(function(t){return(t=t).field.canonicalString()+t.dir}).join(","),qb(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=U_(e.startAt)),e.endAt&&(t+="|ub:",t+=U_(e.endAt)),e.h=t),e.h}function h_(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,a,s=0;s<t.filters.length;s++)if(o=t.filters[s],a=e.filters[s],o.op!==a.op||!o.field.isEqual(a.field)||!Gb(o.value,a.value))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!V_(t.startAt,e.startAt)&&V_(t.endAt,e.endAt)}function l_(t){return Kb.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}var f_,p_=(Xi(d_,f_=function(){}),d_.create=function(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.l(t,e,n):new m_(t,e,n):"array-contains"===e?new A_(t,n):"in"===e?new R_(t,n):"not-in"===e?new O_(t,n):"array-contains-any"===e?new P_(t,n):new d_(t,e,n)},d_.l=function(t,e,n){return new("in"===e?b_:__)(t,n)},d_.prototype.matches=function(t){t=t.data.field(this.field);return"!="===this.op?null!==t&&this.m(Qb(t,this.value)):null!==t&&Hb(this.value)===Hb(t)&&this.m(Qb(t,this.value))},d_.prototype.m=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 ub()}},d_.prototype.g=function(){return 0<=["<","<=",">",">=","!=","not-in"].indexOf(this.op)},d_);function d_(t,e,n){var r=this;return(r=f_.call(this)||this).field=t,r.op=e,r.value=n,r}var v_,g_,y_,m_=(Xi(T_,y_=p_),T_.prototype.matches=function(t){t=Kb.comparator(t.key,this.key);return this.m(t)},T_),b_=(Xi(I_,g_=p_),I_.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},I_),__=(Xi(w_,v_=p_),w_.prototype.matches=function(e){return!this.keys.some(function(t){return t.isEqual(e.key)})},w_);function w_(t,e){var n=this;return(n=v_.call(this,t,"not-in",e)||this).keys=E_(0,e),n}function I_(t,e){var n=this;return(n=g_.call(this,t,"in",e)||this).keys=E_(0,e),n}function T_(t,e,n){var r=this;return(r=y_.call(this,t,e,n)||this).key=Kb.fromName(n.referenceValue),r}function E_(t,e){return((null===(e=e.arrayValue)||void 0===e?void 0:e.values)||[]).map(function(t){return Kb.fromName(t.referenceValue)})}var S_,C_,k_,N_,A_=(Xi(F_,N_=p_),F_.prototype.matches=function(t){t=t.data.field(this.field);return Zb(t)&&zb(t.arrayValue,this.value)},F_),R_=(Xi(M_,k_=p_),M_.prototype.matches=function(t){t=t.data.field(this.field);return null!==t&&zb(this.value.arrayValue,t)},M_),O_=(Xi(L_,C_=p_),L_.prototype.matches=function(t){if(zb(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;t=t.data.field(this.field);return null!==t&&!zb(this.value.arrayValue,t)},L_),P_=(Xi(x_,S_=p_),x_.prototype.matches=function(t){var e=this,t=t.data.field(this.field);return!(!Zb(t)||!t.arrayValue.values)&&t.arrayValue.values.some(function(t){return zb(e.value.arrayValue,t)})},x_),D_=function(t,e){this.position=t,this.before=e};function x_(t,e){return S_.call(this,t,"array-contains-any",e)||this}function L_(t,e){return C_.call(this,t,"not-in",e)||this}function M_(t,e){return k_.call(this,t,"in",e)||this}function F_(t,e){return N_.call(this,t,"array-contains",e)||this}function U_(t){return(t.before?"b":"a")+":"+t.position.map(Xb).join(",")}var j_=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function q_(t,e,n){for(var r=0,i=0;i<t.position.length;i++){var o=e[i],a=t.position[i],r=o.field.isKeyField()?Kb.comparator(Kb.fromName(a.referenceValue),n.key):Qb(a,n.data.field(o.field));if("desc"===o.dir&&(r*=-1),0!==r)break}return t.before?r<=0:r<0}function V_(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(!Gb(t.position[n],e.position[n]))return!1;return!0}var B_=function(t,e,n,r,i,o,a,s){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===a&&(a=null),void 0===s&&(s=null),this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=o,this.startAt=a,this.endAt=s,this.p=null,this.T=null,this.startAt,this.endAt};function K_(t,e,n,r,i,o,a,s){return new B_(t,e,n,r,i,o,a,s)}function W_(t){return new B_(t)}function H_(t){return!qb(t.limit)&&"F"===t.limitType}function G_(t){return!qb(t.limit)&&"L"===t.limitType}function z_(t){return 0<t.explicitOrderBy.length?t.explicitOrderBy[0].field:null}function Q_(t){for(var e=0,n=t.filters;e<n.length;e++){var r=n[e];if(r.g())return r.field}return null}function Y_(t){return null!==t.collectionGroup}function X_(t){var e=t;if(null===e.p){e.p=[];var n=Q_(e),t=z_(e);if(null!==n&&null===t)n.isKeyField()||e.p.push(new j_(n)),e.p.push(new j_(Cb.keyField(),"asc"));else{for(var r=!1,i=0,o=e.explicitOrderBy;i<o.length;i++){var a=o[i];e.p.push(a),a.field.isKeyField()&&(r=!0)}r||(n=0<e.explicitOrderBy.length?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc",e.p.push(new j_(Cb.keyField(),n)))}}return e.p}function J_(t){var e=t;if(!e.T)if("F"===e.limitType)e.T=u_(e.path,e.collectionGroup,X_(e),e.filters,e.limit,e.startAt,e.endAt);else{for(var n=[],r=0,i=X_(e);r<i.length;r++){var o=i[r],a="desc"===o.dir?"asc":"desc";n.push(new j_(o.field,a))}var s=e.endAt?new D_(e.endAt.position,!e.endAt.before):null,t=e.startAt?new D_(e.startAt.position,!e.startAt.before):null;e.T=u_(e.path,e.collectionGroup,n,e.filters,e.limit,s,t)}return e.T}function $_(t,e,n){return new B_(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Z_(t,e){return h_(J_(t),J_(e))&&t.limitType===e.limitType}function tw(t){return c_(J_(t))+"|lt:"+t.limitType}function ew(t){return"Query(target="+(e=J_(t),n=e.path.canonicalString(),null!==e.collectionGroup&&(n+=" collectionGroup="+e.collectionGroup),0<e.filters.length&&(n+=", filters: ["+e.filters.map(function(t){return(t=t).field.canonicalString()+" "+t.op+" "+Xb(t.value)}).join(", ")+"]"),qb(e.limit)||(n+=", limit: "+e.limit),0<e.orderBy.length&&(n+=", orderBy: ["+e.orderBy.map(function(t){return(t=t).field.canonicalString()+" ("+t.dir+")"}).join(", ")+"]"),e.startAt&&(n+=", startAt: "+U_(e.startAt)),e.endAt&&(n+=", endAt: "+U_(e.endAt)),"Target("+n+")")+"; limitType="+t.limitType+")";var e,n}function nw(i,t){return t.isFoundDocument()&&(e=i,n=t.key.path,null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):Kb.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n))&&function(t){for(var e=0,n=i.explicitOrderBy;e<n.length;e++){var r=n[e];if(!r.field.isKeyField()&&null===t.data.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||q_(t.startAt,X_(t),n))&&(!t.endAt||!q_(t.endAt,X_(t),n)));var e,n}function rw(s){return function(t,e){for(var n=!1,r=0,i=X_(s);r<i.length;r++){var o=i[r],a=function(t,r,e){var n=t.field.isKeyField()?Kb.comparator(r.key,e.key):function(t,e){var n=r.data.field(t),t=e.data.field(t);return null!==n&&null!==t?Qb(n,t):ub()}(t.field,e);switch(t.dir){case"asc":return n;case"desc":return-1*n;default:return ub()}}(o,t,e);if(0!==a)return a;n=n||o.field.isKeyField()}return 0}}function iw(t,e){if(t.I){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Vb(e)?"-0":e}}function ow(t){return{integerValue:""+t}}function aw(t,e){return Bb(e)?ow(e):iw(t,e)}G=function(){this._=void 0};function sw(t,e){return t instanceof _w?$b(t=e)||t&&"doubleValue"in t?e:{integerValue:0}:null}var uw,cw,hw=(Xi(pw,cw=G),pw),lw=(Xi(fw,uw=G),fw);function fw(t){var e=this;return(e=uw.call(this)||this).elements=t,e}function pw(){return null!==cw&&cw.apply(this,arguments)||this}function dw(t,e){for(var n=Tw(e),r=0,i=t.elements;r<i.length;r++)!function(e){n.some(function(t){return Gb(t,e)})||n.push(e)}(i[r]);return{arrayValue:{values:n}}}var vw,gw=(Xi(yw,vw=G),yw);function yw(t){var e=this;return(e=vw.call(this)||this).elements=t,e}function mw(t,e){for(var n=Tw(e),r=0,i=t.elements;r<i.length;r++)!function(e){n=n.filter(function(t){return!Gb(t,e)})}(i[r]);return{arrayValue:{values:n}}}var bw,_w=(Xi(ww,bw=G),ww);function ww(t,e){var n=this;return(n=bw.call(this)||this).R=t,n.A=e,n}function Iw(t){return Mb(t.integerValue||t.doubleValue)}function Tw(t){return Zb(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function Ew(t,e){this.version=t,this.transformResults=e}var Sw=function(t,e){this.field=t,this.transform=e},Cw=(kw.none=function(){return new kw},kw.exists=function(t){return new kw(void 0,t)},kw.updateTime=function(t){return new kw(t)},Object.defineProperty(kw.prototype,"isNone",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!1,configurable:!0}),kw.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},kw);function kw(t,e){this.updateTime=t,this.exists=e}function Nw(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}Sn=function(){};function Aw(t,e,n){var r,i,o,a;t instanceof xw?(i=e,o=n,Nw((r=t).precondition,i)&&(a=r.value.clone(),o=qw(r.fieldTransforms,o,i),a.setAll(o),i.convertToFoundDocument(Ow(i),a).setHasLocalMutations())):t instanceof Lw?(o=e,i=n,Nw((a=t).precondition,o)&&(n=qw(a.fieldTransforms,i,o),(i=o.data).setAll(Uw(a)),i.setAll(n),o.convertToFoundDocument(Ow(o),i).setHasLocalMutations())):(e=e,Nw(t.precondition,e)&&e.convertToNoDocument(gb.min()))}function Rw(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&(n=t.fieldTransforms,r=e.fieldTransforms,!!(void 0===n&&void 0===r||n&&r&&pb(n,r,function(t,e){return e=e,(t=t).field.isEqual(e.field)&&(t=t.transform,e=e.transform,t instanceof lw&&e instanceof lw||t instanceof gw&&e instanceof gw?pb(t.elements,e.elements,Gb):t instanceof _w&&e instanceof _w?Gb(t.A,e.A):t instanceof hw&&e instanceof hw)})))&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask));var n,r}function Ow(t){return t.isFoundDocument()?t.version:gb.min()}var Pw,Dw,xw=(Xi(Fw,Dw=Sn),Fw),Lw=(Xi(Mw,Pw=Sn),Mw);function Mw(t,e,n,r,i){void 0===i&&(i=[]);var o=this;return(o=Pw.call(this)||this).key=t,o.data=e,o.fieldMask=n,o.precondition=r,o.fieldTransforms=i,o.type=1,o}function Fw(t,e,n,r){void 0===r&&(r=[]);var i=this;return(i=Dw.call(this)||this).key=t,i.value=e,i.precondition=n,i.fieldTransforms=r,i.type=0,i}function Uw(n){var r=new Map;return n.fieldMask.fields.forEach(function(t){var e;t.isEmpty()||(e=n.data.field(t),r.set(t,e))}),r}function jw(t,e,n){var r=new Map;cb(t.length===n.length);for(var i=0;i<n.length;i++){var o=t[i],a=o.transform,s=e.data.field(o.field);r.set(o.field,(o=a,a=s,s=n[i],o instanceof lw?dw(o,a):o instanceof gw?mw(o,a):s))}return r}function qw(t,e,n){for(var r,i=new Map,o=0,a=t;o<a.length;o++){var s=a[o],u=s.transform,c=n.data.field(s.field);i.set(s.field,(r=c,s=e,c=void 0,(u=u)instanceof hw?(c={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}},r&&(c.fields.__previous_value__=r),{mapValue:c}):u instanceof lw?dw(u,r):u instanceof gw?mw(u,r):(u=sw(c=u,r),r=Iw(u)+Iw(c.A),$b(u)&&$b(c.A)?ow(r):iw(c.R,r))))}return i}function Vw(t){this.count=t}var Bw,Kw,Ww,Hw=(Xi(Qw,Ww=Sn),Qw),Gw=(Xi(zw,Kw=Sn),zw);function zw(t,e){var n=this;return(n=Kw.call(this)||this).key=t,n.precondition=e,n.type=3,n.fieldTransforms=[],n}function Qw(t,e){var n=this;return(n=Ww.call(this)||this).key=t,n.precondition=e,n.type=2,n.fieldTransforms=[],n}function Yw(t){switch(t){case Zm.OK:return ub(),0;case Zm.CANCELLED:case Zm.UNKNOWN:case Zm.DEADLINE_EXCEEDED:case Zm.RESOURCE_EXHAUSTED:case Zm.INTERNAL:case Zm.UNAVAILABLE:case Zm.UNAUTHENTICATED:return;case Zm.INVALID_ARGUMENT:case Zm.NOT_FOUND:case Zm.ALREADY_EXISTS:case Zm.PERMISSION_DENIED:case Zm.FAILED_PRECONDITION:case Zm.ABORTED:case Zm.OUT_OF_RANGE:case Zm.UNIMPLEMENTED:case Zm.DATA_LOSS:return 1;default:return ub(),0}}function Xw(t){if(void 0===t)return ob("GRPC error has no .code"),Zm.UNKNOWN;switch(t){case Bw.OK:return Zm.OK;case Bw.CANCELLED:return Zm.CANCELLED;case Bw.UNKNOWN:return Zm.UNKNOWN;case Bw.DEADLINE_EXCEEDED:return Zm.DEADLINE_EXCEEDED;case Bw.RESOURCE_EXHAUSTED:return Zm.RESOURCE_EXHAUSTED;case Bw.INTERNAL:return Zm.INTERNAL;case Bw.UNAVAILABLE:return Zm.UNAVAILABLE;case Bw.UNAUTHENTICATED:return Zm.UNAUTHENTICATED;case Bw.INVALID_ARGUMENT:return Zm.INVALID_ARGUMENT;case Bw.NOT_FOUND:return Zm.NOT_FOUND;case Bw.ALREADY_EXISTS:return Zm.ALREADY_EXISTS;case Bw.PERMISSION_DENIED:return Zm.PERMISSION_DENIED;case Bw.FAILED_PRECONDITION:return Zm.FAILED_PRECONDITION;case Bw.ABORTED:return Zm.ABORTED;case Bw.OUT_OF_RANGE:return Zm.OUT_OF_RANGE;case Bw.UNIMPLEMENTED:return Zm.UNIMPLEMENTED;case Bw.DATA_LOSS:return Zm.DATA_LOSS;default:return ub()}}(G=Bw=Bw||{})[G.OK=0]="OK",G[G.CANCELLED=1]="CANCELLED",G[G.UNKNOWN=2]="UNKNOWN",G[G.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",G[G.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",G[G.NOT_FOUND=5]="NOT_FOUND",G[G.ALREADY_EXISTS=6]="ALREADY_EXISTS",G[G.PERMISSION_DENIED=7]="PERMISSION_DENIED",G[G.UNAUTHENTICATED=16]="UNAUTHENTICATED",G[G.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",G[G.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",G[G.ABORTED=10]="ABORTED",G[G.OUT_OF_RANGE=11]="OUT_OF_RANGE",G[G.UNIMPLEMENTED=12]="UNIMPLEMENTED",G[G.INTERNAL=13]="INTERNAL",G[G.UNAVAILABLE=14]="UNAVAILABLE",G[G.DATA_LOSS=15]="DATA_LOSS";var Jw=(nI.prototype.insert=function(t,e){return new nI(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,Zw.BLACK,null,null))},nI.prototype.remove=function(t){return new nI(this.comparator,this.root.remove(t,this.comparator).copy(null,null,Zw.BLACK,null,null))},nI.prototype.get=function(t){for(var e=this.root;!e.isEmpty();){var n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:0<n&&(e=e.right)}return null},nI.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.isEmpty();){var r=this.comparator(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},nI.prototype.isEmpty=function(){return this.root.isEmpty()},Object.defineProperty(nI.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),nI.prototype.minKey=function(){return this.root.minKey()},nI.prototype.maxKey=function(){return this.root.maxKey()},nI.prototype.inorderTraversal=function(t){return this.root.inorderTraversal(t)},nI.prototype.forEach=function(n){this.inorderTraversal(function(t,e){return n(t,e),!1})},nI.prototype.toString=function(){var n=[];return this.inorderTraversal(function(t,e){return n.push(t+":"+e),!1}),"{"+n.join(", ")+"}"},nI.prototype.reverseTraversal=function(t){return this.root.reverseTraversal(t)},nI.prototype.getIterator=function(){return new $w(this.root,null,this.comparator,!1)},nI.prototype.getIteratorFrom=function(t){return new $w(this.root,t,this.comparator,!1)},nI.prototype.getReverseIterator=function(){return new $w(this.root,null,this.comparator,!0)},nI.prototype.getReverseIteratorFrom=function(t){return new $w(this.root,t,this.comparator,!0)},nI),$w=(eI.prototype.getNext=function(){var t=this.nodeStack.pop(),e={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},eI.prototype.hasNext=function(){return 0<this.nodeStack.length},eI.prototype.peek=function(){if(0===this.nodeStack.length)return null;var t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}},eI),Zw=(tI.prototype.copy=function(t,e,n,r,i){return new tI(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)},tI.prototype.isEmpty=function(){return!1},tI.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)},tI.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},tI.prototype.min=function(){return this.left.isEmpty()?this:this.left.min()},tI.prototype.minKey=function(){return this.min().key},tI.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},tI.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()},tI.prototype.removeMin=function(){if(this.left.isEmpty())return tI.EMPTY;var t=this;return(t=(t=!t.left.isRed()&&!t.left.left.isRed()?t.moveRedLeft():t).copy(null,null,null,t.left.removeMin(),null)).fixUp()},tI.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r=(r=!(r.left.isEmpty()||r.left.isRed()||r.left.left.isRed())?r.moveRedLeft():r).copy(null,null,null,r.left.remove(t,e),null);else{if(0===e(t,(r=!((r=r.left.isRed()?r.rotateRight():r).right.isEmpty()||r.right.isRed()||r.right.left.isRed())?r.moveRedRight():r).key)){if(r.right.isEmpty())return tI.EMPTY;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()},tI.prototype.isRed=function(){return this.color},tI.prototype.fixUp=function(){var t=this;return t=(t=(t=t.right.isRed()&&!t.left.isRed()?t.rotateLeft():t).left.isRed()&&t.left.left.isRed()?t.rotateRight():t).left.isRed()&&t.right.isRed()?t.colorFlip():t},tI.prototype.moveRedLeft=function(){var t=this.colorFlip();return t=t.right.left.isRed()?(t=(t=t.copy(null,null,null,null,t.right.rotateRight())).rotateLeft()).colorFlip():t},tI.prototype.moveRedRight=function(){var t=this.colorFlip();return t=t.left.left.isRed()?(t=t.rotateRight()).colorFlip():t},tI.prototype.rotateLeft=function(){var t=this.copy(null,null,tI.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},tI.prototype.rotateRight=function(){var t=this.copy(null,null,tI.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},tI.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)},tI.prototype.checkMaxDepth=function(){var t=this.check();return Math.pow(2,t)<=this.size+1},tI.prototype.check=function(){if(this.isRed()&&this.left.isRed())throw ub();if(this.right.isRed())throw ub();var t=this.left.check();if(t!==this.right.check())throw ub();return t+(this.isRed()?0:1)},tI);function tI(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:tI.RED,this.left=null!=r?r:tI.EMPTY,this.right=null!=i?i:tI.EMPTY,this.size=this.left.size+1+this.right.size}function eI(t,e,n,r){this.isReverse=r,this.nodeStack=[];for(var i=1;!t.isEmpty();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.isReverse?t.left:t.right;else{if(0===i){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}function nI(t,e){this.comparator=t,this.root=e||Zw.EMPTY}function rI(){this.size=0}Zw.EMPTY=null,Zw.RED=!0,Zw.BLACK=!1,Zw.EMPTY=(Object.defineProperty(rI.prototype,"key",{get:function(){throw ub()},enumerable:!1,configurable:!0}),Object.defineProperty(rI.prototype,"value",{get:function(){throw ub()},enumerable:!1,configurable:!0}),Object.defineProperty(rI.prototype,"color",{get:function(){throw ub()},enumerable:!1,configurable:!0}),Object.defineProperty(rI.prototype,"left",{get:function(){throw ub()},enumerable:!1,configurable:!0}),Object.defineProperty(rI.prototype,"right",{get:function(){throw ub()},enumerable:!1,configurable:!0}),rI.prototype.copy=function(t,e,n,r,i){return this},rI.prototype.insert=function(t,e,n){return new Zw(t,e)},rI.prototype.remove=function(t,e){return this},rI.prototype.isEmpty=function(){return!0},rI.prototype.inorderTraversal=function(t){return!1},rI.prototype.reverseTraversal=function(t){return!1},rI.prototype.minKey=function(){return null},rI.prototype.maxKey=function(){return null},rI.prototype.isRed=function(){return!1},rI.prototype.checkMaxDepth=function(){return!0},rI.prototype.check=function(){return 0},new rI);var iI=(uI.prototype.has=function(t){return null!==this.data.get(t)},uI.prototype.first=function(){return this.data.minKey()},uI.prototype.last=function(){return this.data.maxKey()},Object.defineProperty(uI.prototype,"size",{get:function(){return this.data.size},enumerable:!1,configurable:!0}),uI.prototype.indexOf=function(t){return this.data.indexOf(t)},uI.prototype.forEach=function(n){this.data.inorderTraversal(function(t,e){return n(t),!1})},uI.prototype.forEachInRange=function(t,e){for(var n=this.data.getIteratorFrom(t[0]);n.hasNext();){var r=n.getNext();if(0<=this.comparator(r.key,t[1]))return;e(r.key)}},uI.prototype.forEachWhile=function(t,e){for(var n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return},uI.prototype.firstAfterOrEqual=function(t){t=this.data.getIteratorFrom(t);return t.hasNext()?t.getNext().key:null},uI.prototype.getIterator=function(){return new oI(this.data.getIterator())},uI.prototype.getIteratorFrom=function(t){return new oI(this.data.getIteratorFrom(t))},uI.prototype.add=function(t){return this.copy(this.data.remove(t).insert(t,!0))},uI.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},uI.prototype.isEmpty=function(){return this.data.isEmpty()},uI.prototype.unionWith=function(t){var e=this;return e.size<t.size&&(e=t,t=this),t.forEach(function(t){e=e.add(t)}),e},uI.prototype.isEqual=function(t){if(!(t instanceof uI))return!1;if(this.size!==t.size)return!1;for(var e=this.data.getIterator(),n=t.data.getIterator();e.hasNext();){var r=e.getNext().key,i=n.getNext().key;if(0!==this.comparator(r,i))return!1}return!0},uI.prototype.toArray=function(){var e=[];return this.forEach(function(t){e.push(t)}),e},uI.prototype.toString=function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"},uI.prototype.copy=function(t){var e=new uI(this.comparator);return e.data=t,e},uI),oI=(sI.prototype.getNext=function(){return this.iter.getNext().key},sI.prototype.hasNext=function(){return this.iter.hasNext()},sI),aI=new Jw(Kb.comparator);function sI(t){this.iter=t}function uI(t){this.comparator=t,this.data=new Jw(this.comparator)}var cI=new Jw(Kb.comparator);var hI=new Jw(Kb.comparator);var lI=new iI(Kb.comparator);function fI(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=lI,r=0,i=t;r<i.length;r++)var o=i[r],n=n.add(o);return n}var pI=new iI(fb);var dI=(EI.createSynthesizedRemoteEventForCurrentChange=function(t,e){var n=new Map;return n.set(t,vI.createSynthesizedTargetChangeForCurrentChange(t,e)),new EI(gb.min(),n,pI,aI,fI())},EI),vI=(TI.createSynthesizedTargetChangeForCurrentChange=function(t,e){return new TI(Nb.EMPTY_BYTE_STRING,e,fI(),fI(),fI())},TI),gI=function(t,e,n,r){this.v=t,this.removedTargetIds=e,this.key=n,this.P=r},yI=function(t,e){this.targetId=t,this.V=e},mI=function(t,e,n,r){void 0===n&&(n=Nb.EMPTY_BYTE_STRING),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r},bI=(Object.defineProperty(II.prototype,"current",{get:function(){return this.N},enumerable:!1,configurable:!0}),Object.defineProperty(II.prototype,"resumeToken",{get:function(){return this.C},enumerable:!1,configurable:!0}),Object.defineProperty(II.prototype,"k",{get:function(){return 0!==this.S},enumerable:!1,configurable:!0}),Object.defineProperty(II.prototype,"O",{get:function(){return this.F},enumerable:!1,configurable:!0}),II.prototype.$=function(t){0<t.approximateByteSize()&&(this.F=!0,this.C=t)},II.prototype.M=function(){var n=fI(),r=fI(),i=fI();return this.D.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:ub()}}),new vI(this.C,this.N,n,r,i)},II.prototype.L=function(){this.F=!1,this.D=CI()},II.prototype.B=function(t,e){this.F=!0,this.D=this.D.insert(t,e)},II.prototype.q=function(t){this.F=!0,this.D=this.D.remove(t)},II.prototype.U=function(){this.S+=1},II.prototype.K=function(){--this.S},II.prototype.j=function(){this.F=!0,this.N=!0},II),_I=(wI.prototype.X=function(t){for(var e=0,n=t.v;e<n.length;e++){var r=n[e];t.P&&t.P.isFoundDocument()?this.Z(r,t.P):this.tt(r,t.key,t.P)}for(var i=0,o=t.removedTargetIds;i<o.length;i++)r=o[i],this.tt(r,t.key,t.P)},wI.prototype.et=function(n){var r=this;this.forEachTarget(n,function(t){var e=r.nt(t);switch(n.state){case 0:r.st(t)&&e.$(n.resumeToken);break;case 1:e.K(),e.k||e.L(),e.$(n.resumeToken);break;case 2:e.K(),e.k||r.removeTarget(t);break;case 3:r.st(t)&&(e.j(),e.$(n.resumeToken));break;case 4:r.st(t)&&(r.it(t),e.$(n.resumeToken));break;default:ub()}})},wI.prototype.forEachTarget=function(t,n){var r=this;0<t.targetIds.length?t.targetIds.forEach(n):this.G.forEach(function(t,e){r.st(e)&&n(e)})},wI.prototype.rt=function(t){var e=t.targetId,n=t.V.count,t=this.ot(e);t&&(l_(t=t.target)?0===n?(t=new Kb(t.path),this.tt(e,t,o_.newNoDocument(t,gb.min()))):cb(1===n):this.ct(e)!==n&&(this.it(e),this.Y=this.Y.add(e)))},wI.prototype.ut=function(r){var i=this,o=new Map;this.G.forEach(function(t,e){var n=i.ot(e);n&&(t.current&&l_(n.target)&&(n=new Kb(n.target.path),null!==i.H.get(n)||i.at(e,n)||i.tt(e,n,o_.newNoDocument(n,r))),t.O&&(o.set(e,t.M()),t.L()))});var a=fI();this.J.forEach(function(t,e){var n=!0;e.forEachWhile(function(t){t=i.ot(t);return!t||2===t.purpose||(n=!1)}),n&&(a=a.add(t))});var t=new dI(r,o,this.Y,this.H,a);return this.H=aI,this.J=SI(),this.Y=new iI(fb),t},wI.prototype.Z=function(t,e){var n;this.st(t)&&(n=this.at(t,e.key)?2:0,this.nt(t).B(e.key,n),this.H=this.H.insert(e.key,e),this.J=this.J.insert(e.key,this.ht(e.key).add(t)))},wI.prototype.tt=function(t,e,n){var r;this.st(t)&&(r=this.nt(t),this.at(t,e)?r.B(e,1):r.q(e),this.J=this.J.insert(e,this.ht(e).delete(t)),n&&(this.H=this.H.insert(e,n)))},wI.prototype.removeTarget=function(t){this.G.delete(t)},wI.prototype.ct=function(t){var e=this.nt(t).M();return this.W.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size},wI.prototype.U=function(t){this.nt(t).U()},wI.prototype.nt=function(t){var e=this.G.get(t);return e||(e=new bI,this.G.set(t,e)),e},wI.prototype.ht=function(t){var e=this.J.get(t);return e||(e=new iI(fb),this.J=this.J.insert(t,e)),e},wI.prototype.st=function(t){var e=null!==this.ot(t);return e||ib("WatchChangeAggregator","Detected inactive target",t),e},wI.prototype.ot=function(t){var e=this.G.get(t);return e&&e.k?null:this.W.lt(t)},wI.prototype.it=function(e){var n=this;this.G.set(e,new bI),this.W.getRemoteKeysForTarget(e).forEach(function(t){n.tt(e,t,null)})},wI.prototype.at=function(t,e){return this.W.getRemoteKeysForTarget(t).has(e)},wI);function wI(t){this.W=t,this.G=new Map,this.H=aI,this.J=SI(),this.Y=new iI(fb)}function II(){this.S=0,this.D=CI(),this.C=Nb.EMPTY_BYTE_STRING,this.N=!1,this.F=!0}function TI(t,e,n,r,i){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}function EI(t,e,n,r,i){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}function SI(){return new Jw(Kb.comparator)}function CI(){return new Jw(Kb.comparator)}var kI={asc:"ASCENDING",desc:"DESCENDING"},NI={"<":"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"},AI=function(t,e){this.databaseId=t,this.I=e};function RI(t,e){return t.I?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function OI(t,e){return t.I?e.toBase64():e.toUint8Array()}function PI(t){return cb(!!t),gb.fromTimestamp((t=Lb(t),new vb(t.seconds,t.nanos)))}function DI(t,e){return new Eb(["projects",t.projectId,"databases",t.database]).child("documents").child(e).canonicalString()}function xI(t){t=Eb.fromString(t);return cb(tT(t)),t}function LI(t,e){return DI(t.databaseId,e.path)}function MI(t,e){e=xI(e);if(e.get(1)!==t.databaseId.projectId)throw new tb(Zm.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+e.get(1)+" vs "+t.databaseId.projectId);if(e.get(3)!==t.databaseId.database)throw new tb(Zm.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+e.get(3)+" vs "+t.databaseId.database);return new Kb(qI(e))}function FI(t,e){return DI(t.databaseId,e)}function UI(t){t=xI(t);return 4===t.length?Eb.emptyPath():qI(t)}function jI(t){return new Eb(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function qI(t){return cb(4<t.length&&"documents"===t.get(4)),t.popFirst(5)}function VI(t,e,n){return{name:LI(t,e),fields:n.toProto().mapValue.fields}}function BI(t,e,n){var r=MI(t,e.name),t=PI(e.updateTime),e=new r_({mapValue:{fields:e.fields}}),e=o_.newFoundDocument(r,t,e);return n&&e.setHasCommittedMutations(),n?e.setHasCommittedMutations():e}function KI(t,e){var n,r,i;if(e instanceof xw)n={update:VI(t,e.key,e.value)};else if(e instanceof Hw)n={delete:LI(t,e.key)};else if(e instanceof Lw)n={update:VI(t,e.key,e.data),updateMask:(i=e.fieldMask,r=[],i.fields.forEach(function(t){return r.push(t.canonicalString())}),{fieldPaths:r})};else{if(!(e instanceof Gw))return ub();n={verify:LI(t,e.key)}}return 0<e.fieldTransforms.length&&(n.updateTransforms=e.fieldTransforms.map(function(t){var e=t.transform;if(e instanceof hw)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(e instanceof lw)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:e.elements}};if(e instanceof gw)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:e.elements}};if(e instanceof _w)return{fieldPath:t.field.canonicalString(),increment:e.A};throw ub()})),e.precondition.isNone||(n.currentDocument=void 0!==(i=e.precondition).updateTime?{updateTime:(e=t,t=i.updateTime,RI(e,t.toTimestamp()))}:void 0!==i.exists?{exists:i.exists}:ub()),n}function WI(e,t){var n=t.currentDocument?void 0!==(a=t.currentDocument).updateTime?Cw.updateTime(PI(a.updateTime)):void 0!==a.exists?Cw.exists(a.exists):Cw.none():Cw.none(),r=t.updateTransforms?t.updateTransforms.map(function(t){return function(t,e){var n,r=null;"setToServerValue"in e?(cb("REQUEST_TIME"===e.setToServerValue),r=new hw):"appendMissingElements"in e?(n=e.appendMissingElements.values||[],r=new lw(n)):"removeAllFromArray"in e?(n=e.removeAllFromArray.values||[],r=new gw(n)):"increment"in e?r=new _w(t,e.increment):ub();e=Cb.fromServerFormat(e.fieldPath);return new Sw(e,r)}(e,t)}):[];if(t.update){t.update.name;var i=MI(e,t.update.name),o=new r_({mapValue:{fields:t.update.fields}});if(t.updateMask){var a=(a=t.updateMask.fieldPaths||[],new kb(a.map(function(t){return Cb.fromServerFormat(t)})));return new Lw(i,o,a,n,r)}return new xw(i,o,n,r)}if(t.delete){r=MI(e,t.delete);return new Hw(r,n)}if(t.verify){t=MI(e,t.verify);return new Gw(t,n)}return ub()}function HI(t,e){return{documents:[FI(t,e.path)]}}function GI(t,e){var n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=FI(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=FI(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);r=function(t){if(0!==t.length){t=t.map(function(t){if("=="===t.op){if(e_(t.value))return{unaryFilter:{field:XI(t.field),op:"IS_NAN"}};if(t_(t.value))return{unaryFilter:{field:XI(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(e_(t.value))return{unaryFilter:{field:XI(t.field),op:"IS_NOT_NAN"}};if(t_(t.value))return{unaryFilter:{field:XI(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:XI(t.field),op:(e=t.op,NI[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:XI((t=t).field),direction:(t=t.dir,kI[t])}})}(e.orderBy);r&&(n.structuredQuery.orderBy=r);r=e.limit,r=t.I||qb(r)?r:{value:r};return null!==r&&(n.structuredQuery.limit=r),e.startAt&&(n.structuredQuery.startAt=QI(e.startAt)),e.endAt&&(n.structuredQuery.endAt=QI(e.endAt)),n}function zI(t){var e=UI(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;0<r&&(cb(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?[ZI(t)]:void 0!==t.fieldFilter?[$I(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map(function(t){return e(t)}).reduce(function(t,e){return t.concat(e)}):ub():[]}(n.where));var a=[],t=null,r=null,s=null;return K_(e,i,a=n.orderBy?n.orderBy.map(function(t){return new j_(JI((e=t).field),function(){switch(e.direction){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}());var e}):a,o,t=n.limit?qb(o="object"==typeof(o=n.limit)?o.value:o)?null:o:t,"F",r=n.startAt?YI(n.startAt):r,s=n.endAt?YI(n.endAt):s)}function QI(t){return{before:t.before,values:t.position}}function YI(t){var e=!!t.before,t=t.values||[];return new D_(t,e)}function XI(t){return{fieldPath:t.canonicalString()}}function JI(t){return Cb.fromServerFormat(t.fieldPath)}function $I(t){return p_.create(JI(t.fieldFilter.field),function(){switch(t.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 ub()}}(),t.fieldFilter.value)}function ZI(t){switch(t.unaryFilter.op){case"IS_NAN":var e=JI(t.unaryFilter.field);return p_.create(e,"==",{doubleValue:NaN});case"IS_NULL":e=JI(t.unaryFilter.field);return p_.create(e,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var n=JI(t.unaryFilter.field);return p_.create(n,"!=",{doubleValue:NaN});case"IS_NOT_NULL":n=JI(t.unaryFilter.field);return p_.create(n,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return ub()}}function tT(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}function eT(t){for(var e="",n=0;n<t.length;n++)0<e.length&&(e=nT(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 nT(e)}function nT(t){return t+""}function rT(t){var e=t.length;if(cb(2<=e),2===e)return cb(""===t.charAt(0)&&""===t.charAt(1)),Eb.emptyPath();for(var n=e-2,r=[],i="",o=0;o<e;){var a=t.indexOf("",o);switch((a<0||n<a)&&ub(),t.charAt(a+1)){case"":var s=t.substring(o,a),u=void 0;0===i.length?u=s:(u=i+=s,i=""),r.push(u);break;case"":i+=t.substring(o,a),i+="\0";break;case"":i+=t.substring(o,a+1);break;default:ub()}o=a+2}return new Eb(r)}function iT(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n}var oT=function(t,e){this.seconds=t,this.nanoseconds=e};iT.store="owner",iT.key="owner";function aT(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n}aT.store="mutationQueues",aT.keyPath="userId";function sT(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i}sT.store="mutations",sT.keyPath="batchId",sT.userMutationsIndex="userMutationsIndex",sT.userMutationsKeyPath=["userId","batchId"];var uT=(cT.prefixForUser=function(t){return[t]},cT.prefixForPath=function(t,e){return[t,eT(e)]},cT.key=function(t,e,n){return[t,eT(e),n]},cT);function cT(){}uT.store="documentMutations",uT.PLACEHOLDER=new uT;function hT(t,e){this.path=t,this.readTime=e}function lT(t,e){this.path=t,this.version=e}var fT=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};fT.store="remoteDocuments",fT.readTimeIndex="readTimeIndex",fT.readTimeIndexPath="readTime",fT.collectionReadTimeIndex="collectionReadTimeIndex",fT.collectionReadTimeIndexPath=["parentPath","readTime"];function pT(t){this.byteSize=t}pT.store="remoteDocumentGlobal",pT.key="remoteDocumentGlobalKey";function dT(t,e,n,r,i,o,a){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.lastLimboFreeSnapshotVersion=o,this.query=a}dT.store="targets",dT.keyPath="targetId",dT.queryTargetsIndexName="queryTargetsIndex",dT.queryTargetsKeyPath=["canonicalId","targetId"];var vT=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};vT.store="targetDocuments",vT.keyPath=["targetId","path"],vT.documentTargetsIndex="documentTargetsIndex",vT.documentTargetsKeyPath=["path","targetId"];function gT(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r}gT.key="targetGlobalKey",gT.store="targetGlobal";function yT(t,e){this.collectionId=t,this.parent=e}yT.store="collectionParents",yT.keyPath=["collectionId","parent"];function mT(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r}mT.store="clientMetadata",mT.keyPath="clientId";function bT(t,e,n){this.bundleId=t,this.createTime=e,this.version=n}bT.store="bundles",bT.keyPath="bundleId";function _T(t,e,n){this.name=t,this.readTime=e,this.bundledQuery=n}_T.store="namedQueries",_T.keyPath="name";var wT,IT=no(no([],no(no([],no(no([],no(no([],[aT.store,sT.store,uT.store,fT.store,dT.store,iT.store,gT.store,vT.store]),[mT.store])),[pT.store])),[yT.store])),[bT.store,_T.store]),TT="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Sn=(LT.prototype.addOnCommittedListener=function(t){this.onCommittedListeners.push(t)},LT.prototype.raiseOnCommittedEvent=function(){this.onCommittedListeners.forEach(function(t){return t()})},LT),ET=function(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})},ST=(xT.prototype.catch=function(t){return this.next(void 0,t)},xT.prototype.next=function(r,i){var o=this;return this.callbackAttached&&ub(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(i,this.error):this.wrapSuccess(r,this.result):new xT(function(e,n){o.nextCallback=function(t){o.wrapSuccess(r,t).next(e,n)},o.catchCallback=function(t){o.wrapFailure(i,t).next(e,n)}})},xT.prototype.toPromise=function(){var n=this;return new Promise(function(t,e){n.next(t,e)})},xT.prototype.wrapUserFunction=function(t){try{var e=t();return e instanceof xT?e:xT.resolve(e)}catch(t){return xT.reject(t)}},xT.prototype.wrapSuccess=function(t,e){return t?this.wrapUserFunction(function(){return t(e)}):xT.resolve(e)},xT.prototype.wrapFailure=function(t,e){return t?this.wrapUserFunction(function(){return t(e)}):xT.reject(e)},xT.resolve=function(n){return new xT(function(t,e){t(n)})},xT.reject=function(n){return new xT(function(t,e){e(n)})},xT.waitFor=function(t){return new xT(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()})},xT.or=function(t){for(var n=xT.resolve(!1),e=0,r=t;e<r.length;e++)!function(e){n=n.next(function(t){return t?xT.resolve(t):e()})}(r[e]);return n},xT.forEach=function(t,n){var r=this,i=[];return t.forEach(function(t,e){i.push(n.call(r,t,e))}),this.waitFor(i)},xT),CT=(DT.open=function(t,e,n,r){try{return new DT(e,t.transaction(r,n))}catch(t){throw new AT(e,t)}},Object.defineProperty(DT.prototype,"dt",{get:function(){return this.ft.promise},enumerable:!1,configurable:!0}),DT.prototype.abort=function(t){t&&this.ft.reject(t),this.aborted||(ib("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},DT.prototype.store=function(t){t=this.transaction.objectStore(t);return new FT(t)},DT),kT=(PT.delete=function(t){return ib("SimpleDb","Removing database:",t),jT(window.indexedDB.deleteDatabase(t)).toPromise()},PT.yt=function(){if("undefined"==typeof indexedDB)return!1;if(PT.gt())return!0;var t=po(),e=PT._t(t),n=0<e&&e<10,e=PT.Et(t),e=0<e&&e<4.5;return!(0<t.indexOf("MSIE ")||0<t.indexOf("Trident/")||0<t.indexOf("Edge/")||n||e)},PT.gt=function(){var t;return"undefined"!=typeof process&&"YES"===(null===(t=process.env)||void 0===t?void 0:t.Tt)},PT.It=function(t,e){return t.store(e)},PT._t=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)},PT.Et=function(t){t=t.match(/Android ([\d.]+)/i),t=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(t)},PT.prototype.At=function(o){return $i(this,void 0,void 0,function(){var e,i=this;return Zi(this,function(t){switch(t.label){case 0:return this.db?[3,2]:(ib("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 AT(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 tb(Zm.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 AT(o,t))},r.onupgradeneeded=function(t){ib("SimpleDb",'Database "'+i.name+'" requires upgrade from version:',t.oldVersion);var e=t.target.result;i.wt.Rt(e,r.transaction,t.oldVersion,i.version).next(function(){ib("SimpleDb","Database upgrade to version "+i.version+" complete")})}})]);case 1:e.db=t.sent(),t.label=2;case 2:return[2,(this.bt&&(this.db.onversionchange=function(t){return i.bt(t)}),this.db)]}})})},PT.prototype.vt=function(e){this.bt=e,this.db&&(this.db.onversionchange=function(t){return e(t)})},PT.prototype.runTransaction=function(s,n,u,c){return $i(this,void 0,void 0,function(){var i,o,a,e;return Zi(this,function(t){switch(t.label){case 0:i="readonly"===n,o=0,e=function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:++o,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,a.At(s)];case 2:return a.db=t.sent(),e=CT.open(a.db,s,i?"readonly":"readwrite",u),n=c(e).catch(function(t){return e.abort(t),ST.reject(t)}).toPromise(),r={},n.catch(function(){}),[4,e.dt];case 3:return[2,(r.value=(t.sent(),n),r)];case 4:return n=t.sent(),r="FirebaseError"!==n.name&&o<3,ib("SimpleDb","Transaction failed with error:",n.message,"Retrying:",r),a.close(),r?[3,5]:[2,{value:Promise.reject(n)}];case 5:return[2]}})},a=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]}})})},PT.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},PT),NT=(Object.defineProperty(OT.prototype,"isDone",{get:function(){return this.Vt},enumerable:!1,configurable:!0}),Object.defineProperty(OT.prototype,"Dt",{get:function(){return this.St},enumerable:!1,configurable:!0}),Object.defineProperty(OT.prototype,"cursor",{set:function(t){this.Pt=t},enumerable:!1,configurable:!0}),OT.prototype.done=function(){this.Vt=!0},OT.prototype.Ct=function(t){this.St=t},OT.prototype.delete=function(){return jT(this.Pt.delete())},OT),AT=(Xi(RT,wT=tb),RT);function RT(t,e){var n=this;return(n=wT.call(this,Zm.UNAVAILABLE,"IndexedDB transaction '"+t+"' failed: "+e)||this).name="IndexedDbTransactionError",n}function OT(t){this.Pt=t,this.Vt=!1,this.St=null}function PT(t,e,n){this.name=t,this.version=e,this.wt=n,12.2===PT._t(po())&&ob("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 DT(e,t){var n=this;this.action=e,this.transaction=t,this.aborted=!1,this.ft=new ET,this.transaction.oncomplete=function(){n.ft.resolve()},this.transaction.onabort=function(){t.error?n.ft.reject(new AT(e,t.error)):n.ft.resolve()},this.transaction.onerror=function(t){t=VT(t.target.error);n.ft.reject(new AT(e,t))}}function xT(t){var e=this;this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(function(t){e.isDone=!0,e.result=t,e.nextCallback&&e.nextCallback(t)},function(t){e.isDone=!0,e.error=t,e.catchCallback&&e.catchCallback(t)})}function LT(){this.onCommittedListeners=[]}function MT(t){return"IndexedDbTransactionError"===t.name}var FT=(UT.prototype.put=function(t,e){t=void 0!==e?(ib("SimpleDb","PUT",this.store.name,t,e),this.store.put(e,t)):(ib("SimpleDb","PUT",this.store.name,"<auto-key>",t),this.store.put(t));return jT(t)},UT.prototype.add=function(t){return ib("SimpleDb","ADD",this.store.name,t,t),jT(this.store.add(t))},UT.prototype.get=function(e){var n=this;return jT(this.store.get(e)).next(function(t){return void 0===t&&(t=null),ib("SimpleDb","GET",n.store.name,e,t),t})},UT.prototype.delete=function(t){return ib("SimpleDb","DELETE",this.store.name,t),jT(this.store.delete(t))},UT.prototype.count=function(){return ib("SimpleDb","COUNT",this.store.name),jT(this.store.count())},UT.prototype.Nt=function(t,e){var e=this.cursor(this.options(t,e)),n=[];return this.xt(e,function(t,e){n.push(e)}).next(function(){return n})},UT.prototype.Ft=function(t,e){ib("SimpleDb","DELETE ALL",this.store.name);e=this.options(t,e);e.kt=!1;e=this.cursor(e);return this.xt(e,function(t,e,n){return n.delete()})},UT.prototype.Ot=function(t,e){e?n=t:(n={},e=t);var n=this.cursor(n);return this.xt(n,e)},UT.prototype.$t=function(r){var t=this.cursor({});return new ST(function(n,e){t.onerror=function(t){t=VT(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()}})},UT.prototype.xt=function(t,i){var o=[];return new ST(function(r,e){t.onerror=function(t){e(t.target.error)},t.onsuccess=function(t){var e,n=t.target.result;n?(e=new NT(n),(t=i(n.primaryKey,n.value,e))instanceof ST&&(t=t.catch(function(t){return e.done(),ST.reject(t)}),o.push(t)),e.isDone?r():null===e.Dt?n.continue():n.continue(e.Dt)):r()}}).next(function(){return ST.waitFor(o)})},UT.prototype.options=function(t,e){var n;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},UT.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.kt?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},UT);function UT(t){this.store=t}function jT(t){return new ST(function(e,n){t.onsuccess=function(t){t=t.target.result;e(t)},t.onerror=function(t){t=VT(t.target.error);n(t)}})}var qT=!1;function VT(t){var e=kT._t(po());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 tb("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 qT||(qT=!0,setTimeout(function(){throw n},0)),n}}return t}var BT,KT=(Xi(WT,BT=Sn),WT);function WT(t,e){var n=this;return(n=BT.call(this)||this).Mt=t,n.currentSequenceNumber=e,n}function HT(t,e){return kT.It(t.Mt,e)}var GT=($T.prototype.applyToRemoteDocument=function(t,e){for(var n,r,i,o,a,s,u=e.mutationResults,c=0;c<this.mutations.length;c++){var h=this.mutations[c];h.key.isEqual(t.key)&&(n=h,r=t,i=u[c],h=s=a=o=void 0,n instanceof xw?(a=r,s=i,h=(o=n).value.clone(),o=jw(o.fieldTransforms,a,s.transformResults),h.setAll(o),a.convertToFoundDocument(s.version,h).setHasCommittedMutations()):n instanceof Lw?(o=r,a=i,Nw((s=n).precondition,o)?(h=jw(s.fieldTransforms,o,a.transformResults),(n=o.data).setAll(Uw(s)),n.setAll(h),o.convertToFoundDocument(a.version,n).setHasCommittedMutations()):o.convertToUnknownDocument(a.version)):r.convertToNoDocument(i.version).setHasCommittedMutations())}},$T.prototype.applyToLocalView=function(t){for(var e=0,n=this.baseMutations;e<n.length;e++)(r=n[e]).key.isEqual(t.key)&&Aw(r,t,this.localWriteTime);for(var r,i=0,o=this.mutations;i<o.length;i++)(r=o[i]).key.isEqual(t.key)&&Aw(r,t,this.localWriteTime)},$T.prototype.applyToLocalDocumentSet=function(n){var r=this;this.mutations.forEach(function(t){var e=n.get(t.key),t=e;r.applyToLocalView(t),e.isValidDocument()||t.convertToNoDocument(gb.min())})},$T.prototype.keys=function(){return this.mutations.reduce(function(t,e){return t.add(e.key)},fI())},$T.prototype.isEqual=function(t){return this.batchId===t.batchId&&pb(this.mutations,t.mutations,Rw)&&pb(this.baseMutations,t.baseMutations,Rw)},$T),zT=(JT.from=function(t,e,n){cb(t.mutations.length===n.length);for(var r=hI,i=t.mutations,o=0;o<i.length;o++)r=r.insert(i[o].key,n[o].version);return new JT(t,e,n,r)},JT),QT=(XT.prototype.withSequenceNumber=function(t){return new XT(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)},XT.prototype.withResumeToken=function(t,e){return new XT(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)},XT.prototype.withLastLimboFreeSnapshotVersion=function(t){return new XT(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)},XT),YT=function(t){this.Lt=t};function XT(t,e,n,r,i,o,a){void 0===i&&(i=gb.min()),void 0===o&&(o=gb.min()),void 0===a&&(a=Nb.EMPTY_BYTE_STRING),this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a}function JT(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}function $T(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}function ZT(t,e){if(e.document)return BI(t.Lt,e.document,!!e.hasCommittedMutations);if(e.noDocument){var n=Kb.fromSegments(e.noDocument.path),r=iE(e.noDocument.readTime),n=o_.newNoDocument(n,r);return e.hasCommittedMutations?n.setHasCommittedMutations():n}if(e.unknownDocument){n=Kb.fromSegments(e.unknownDocument.path),r=iE(e.unknownDocument.version);return o_.newUnknownDocument(n,r)}return ub()}function tE(t,e,n){var r=eE(n),n=e.key.path.popLast().toArray();if(e.isFoundDocument()){var i={name:LI(o=t.Lt,(a=e).key),fields:a.data.toProto().mapValue.fields,updateTime:RI(o,a.version.toTimestamp())},o=e.hasCommittedMutations;return new fT(null,null,i,o,r,n)}if(e.isNoDocument()){var a=e.key.path.toArray(),i=rE(e.version),o=e.hasCommittedMutations;return new fT(null,new hT(a,i),null,o,r,n)}if(e.isUnknownDocument()){o=e.key.path.toArray(),e=rE(e.version);return new fT(new lT(o,e),null,null,!0,r,n)}return ub()}function eE(t){t=t.toTimestamp();return[t.seconds,t.nanoseconds]}function nE(t){t=new vb(t[0],t[1]);return gb.fromTimestamp(t)}function rE(t){t=t.toTimestamp();return new oT(t.seconds,t.nanoseconds)}function iE(t){t=new vb(t.seconds,t.nanoseconds);return gb.fromTimestamp(t)}function oE(e,t){for(var n=(t.baseMutations||[]).map(function(t){return WI(e.Lt,t)}),r=0;r<t.mutations.length-1;++r){var i,o=t.mutations[r];r+1<t.mutations.length&&void 0!==t.mutations[r+1].transform&&(i=t.mutations[r+1],o.updateTransforms=i.transform.fieldTransforms,t.mutations.splice(r+1,1),++r)}var a=t.mutations.map(function(t){return WI(e.Lt,t)}),s=vb.fromMillis(t.localWriteTimeMs);return new GT(t.batchId,s,n,a)}function aE(t){var e=iE(t.readTime),n=void 0!==t.lastLimboFreeSnapshotVersion?iE(t.lastLimboFreeSnapshotVersion):gb.min(),r=void 0!==t.query.documents?(cb(1===(r=t.query).documents.length),J_(W_(UI(r.documents[0])))):J_(zI(t.query));return new QT(r,t.targetId,0,t.lastListenSequenceNumber,e,n,Nb.fromBase64String(t.resumeToken))}function sE(t,e){var n=rE(e.snapshotVersion),r=rE(e.lastLimboFreeSnapshotVersion),i=(l_(e.target)?HI:GI)(t.Lt,e.target),t=e.resumeToken.toBase64();return new dT(e.targetId,c_(e.target),n,t,e.sequenceNumber,r,i)}function uE(t){var e=zI({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?$_(e,e.limit,"L"):e}var cE=(hE.prototype.getBundleMetadata=function(t,e){return lE(t).get(e).next(function(t){if(t)return{id:(t=t).bundleId,createTime:iE(t.createTime),version:t.version}})},hE.prototype.saveBundleMetadata=function(t,e){return lE(t).put({bundleId:(e=e).id,createTime:rE(PI(e.createTime)),version:e.version})},hE.prototype.getNamedQuery=function(t,e){return fE(t).get(e).next(function(t){if(t)return{name:(t=t).name,query:uE(t.bundledQuery),readTime:iE(t.readTime)}})},hE.prototype.saveNamedQuery=function(t,e){return fE(t).put({name:(e=e).name,readTime:rE(PI(e.readTime)),bundledQuery:e.bundledQuery})},hE);function hE(){}function lE(t){return HT(t,bT.store)}function fE(t){return HT(t,_T.store)}var pE=(mE.prototype.addToCollectionParentIndex=function(t,e){return this.Bt.add(e),ST.resolve()},mE.prototype.getCollectionParents=function(t,e){return ST.resolve(this.Bt.getEntries(e))},mE),dE=(yE.prototype.add=function(t){var e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new iI(Eb.comparator),t=!r.has(n);return this.index[e]=r.add(n),t},yE.prototype.has=function(t){var e=t.lastSegment(),t=t.popLast(),e=this.index[e];return e&&e.has(t)},yE.prototype.getEntries=function(t){return(this.index[t]||new iI(Eb.comparator)).toArray()},yE),vE=(gE.prototype.addToCollectionParentIndex=function(t,e){var n=this;if(this.qt.has(e))return ST.resolve();var r=e.lastSegment(),i=e.popLast();t.addOnCommittedListener(function(){n.qt.add(e)});i={collectionId:r,parent:eT(i)};return bE(t).put(i)},gE.prototype.getCollectionParents=function(t,i){var o=[],e=IDBKeyRange.bound([i,""],[db(i),""],!1,!0);return bE(t).Nt(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(rT(r.parent))}return o})},gE);function gE(){this.qt=new dE}function yE(){this.index={}}function mE(){this.Bt=new dE}function bE(t){return HT(t,yT.store)}var _E={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},wE=(IE.withCacheSize=function(t){return new IE(t,IE.DEFAULT_COLLECTION_PERCENTILE,IE.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)},IE);function IE(t,e,n){this.cacheSizeCollectionThreshold=t,this.percentileToCollect=e,this.maximumSequenceNumbersToCollect=n}function TE(t,e,n){var r=t.store(sT.store),i=t.store(uT.store),o=[],t=IDBKeyRange.only(n.batchId),a=0,t=r.Ot({range:t},function(t,e,n){return a++,n.delete()});o.push(t.next(function(){cb(1===a)}));for(var s=[],u=0,c=n.mutations;u<c.length;u++){var h=c[u],l=uT.key(e,h.key.path,n.batchId);o.push(i.delete(l)),s.push(h.key)}return ST.waitFor(o).next(function(){return s})}function EE(t){if(!t)return 0;var e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw ub();e=t.noDocument}return JSON.stringify(e).length}wE.DEFAULT_COLLECTION_PERCENTILE=10,wE.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,wE.DEFAULT=new wE(41943040,wE.DEFAULT_COLLECTION_PERCENTILE,wE.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),wE.DISABLED=new wE(-1,0,0);var SE=(CE.Kt=function(t,e,n,r){return cb(""!==t.uid),new CE(t.isAuthenticated()?t.uid:"",e,n,r)},CE.prototype.checkEmpty=function(t){var r=!0,e=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return NE(t).Ot({index:sT.userMutationsIndex,range:e},function(t,e,n){r=!1,n.done()}).next(function(){return r})},CE.prototype.addMutationBatch=function(d,v,g,y){var m=this,b=AE(d),_=NE(d);return _.add({}).next(function(t){cb("number"==typeof t);for(var e,n,r,i,o,a=new GT(t,v,g,y),s=(e=m.R,n=m.userId,i=(r=a).baseMutations.map(function(t){return KI(e.Lt,t)}),o=r.mutations.map(function(t){return KI(e.Lt,t)}),new sT(n,r.batchId,r.localWriteTime.toMillis(),i,o)),u=[],c=new iI(function(t,e){return fb(t.canonicalString(),e.canonicalString())}),h=0,l=y;h<l.length;h++){var f=l[h],p=uT.key(m.userId,f.key.path,t),c=c.add(f.key.path.popLast());u.push(_.put(s)),u.push(b.put(p,uT.PLACEHOLDER))}return c.forEach(function(t){u.push(m.Ut.addToCollectionParentIndex(d,t))}),d.addOnCommittedListener(function(){m.Qt[t]=a.keys()}),ST.waitFor(u).next(function(){return a})})},CE.prototype.lookupMutationBatch=function(t,e){var n=this;return NE(t).get(e).next(function(t){return t?(cb(t.userId===n.userId),oE(n.R,t)):null})},CE.prototype.jt=function(t,e){var n=this;return this.Qt[e]?ST.resolve(this.Qt[e]):this.lookupMutationBatch(t,e).next(function(t){if(t){t=t.keys();return n.Qt[e]=t}return null})},CE.prototype.getNextMutationBatchAfterBatchId=function(t,e){var r=this,i=e+1,e=IDBKeyRange.lowerBound([this.userId,i]),o=null;return NE(t).Ot({index:sT.userMutationsIndex,range:e},function(t,e,n){e.userId===r.userId&&(cb(e.batchId>=i),o=oE(r.R,e)),n.done()}).next(function(){return o})},CE.prototype.getHighestUnacknowledgedBatchId=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return NE(t).Ot({index:sT.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},CE.prototype.getAllMutationBatches=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return NE(t).Nt(sT.userMutationsIndex,n).next(function(t){return t.map(function(t){return oE(e.R,t)})})},CE.prototype.getAllMutationBatchesAffectingDocumentKey=function(o,a){var s=this,t=uT.prefixForPath(this.userId,a.path),t=IDBKeyRange.lowerBound(t),u=[];return AE(o).Ot({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=rT(i);if(r===s.userId&&a.path.isEqual(i))return NE(o).get(t).next(function(t){if(!t)throw ub();cb(t.userId===s.userId),u.push(oE(s.R,t))});n.done()}).next(function(){return u})},CE.prototype.getAllMutationBatchesAffectingDocumentKeys=function(e,t){var a=this,s=new iI(fb),n=[];return t.forEach(function(o){var t=uT.prefixForPath(a.userId,o.path),t=IDBKeyRange.lowerBound(t),t=AE(e).Ot({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=rT(i);r===a.userId&&o.path.isEqual(i)?s=s.add(t):n.done()});n.push(t)}),ST.waitFor(n).next(function(){return a.Wt(e,s)})},CE.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var o=this,a=e.path,s=a.length+1,e=uT.prefixForPath(this.userId,a),e=IDBKeyRange.lowerBound(e),u=new iI(fb);return AE(t).Ot({range:e},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=rT(i);r===o.userId&&a.isPrefixOf(i)?i.length===s&&(u=u.add(t)):n.done()}).next(function(){return o.Wt(t,u)})},CE.prototype.Wt=function(e,t){var n=this,r=[],i=[];return t.forEach(function(t){i.push(NE(e).get(t).next(function(t){if(null===t)throw ub();cb(t.userId===n.userId),r.push(oE(n.R,t))}))}),ST.waitFor(i).next(function(){return r})},CE.prototype.removeMutationBatch=function(e,n){var r=this;return TE(e.Mt,this.userId,n).next(function(t){return e.addOnCommittedListener(function(){r.Gt(n.batchId)}),ST.forEach(t,function(t){return r.referenceDelegate.markPotentiallyOrphaned(e,t)})})},CE.prototype.Gt=function(t){delete this.Qt[t]},CE.prototype.performConsistencyCheck=function(e){var i=this;return this.checkEmpty(e).next(function(t){if(!t)return ST.resolve();var t=IDBKeyRange.lowerBound(uT.prefixForUser(i.userId)),r=[];return AE(e).Ot({range:t},function(t,e,n){t[0]===i.userId?(t=rT(t[1]),r.push(t)):n.done()}).next(function(){cb(0===r.length)})})},CE.prototype.containsKey=function(t,e){return kE(t,this.userId,e)},CE.prototype.zt=function(t){var e=this;return RE(t).get(this.userId).next(function(t){return t||new aT(e.userId,-1,"")})},CE);function CE(t,e,n,r){this.userId=t,this.R=e,this.Ut=n,this.referenceDelegate=r,this.Qt={}}function kE(t,o,e){var e=uT.prefixForPath(o,e.path),a=e[1],e=IDBKeyRange.lowerBound(e),s=!1;return AE(t).Ot({range:e,kt:!0},function(t,e,n){var r=t[0],i=t[1];t[2],r===o&&i===a&&(s=!0),n.done()}).next(function(){return s})}function NE(t){return HT(t,sT.store)}function AE(t){return HT(t,uT.store)}function RE(t){return HT(t,aT.store)}var OE=(xE.prototype.next=function(){return this.Ht+=2,this.Ht},xE.Jt=function(){return new xE(0)},xE.Yt=function(){return new xE(-1)},xE),PE=(DE.prototype.allocateTargetId=function(n){var r=this;return this.Xt(n).next(function(t){var e=new OE(t.highestTargetId);return t.highestTargetId=e.next(),r.Zt(n,t).next(function(){return t.highestTargetId})})},DE.prototype.getLastRemoteSnapshotVersion=function(t){return this.Xt(t).next(function(t){return gb.fromTimestamp(new vb(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},DE.prototype.getHighestSequenceNumber=function(t){return this.Xt(t).next(function(t){return t.highestListenSequenceNumber})},DE.prototype.setTargetsMetadata=function(e,n,r){var i=this;return this.Xt(e).next(function(t){return t.highestListenSequenceNumber=n,r&&(t.lastRemoteSnapshotVersion=r.toTimestamp()),n>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.Zt(e,t)})},DE.prototype.addTargetData=function(e,n){var r=this;return this.te(e,n).next(function(){return r.Xt(e).next(function(t){return t.targetCount+=1,r.ee(n,t),r.Zt(e,t)})})},DE.prototype.updateTargetData=function(t,e){return this.te(t,e)},DE.prototype.removeTargetData=function(e,t){var n=this;return this.removeMatchingKeysForTargetId(e,t.targetId).next(function(){return LE(e).delete(t.targetId)}).next(function(){return n.Xt(e)}).next(function(t){return cb(0<t.targetCount),--t.targetCount,n.Zt(e,t)})},DE.prototype.removeTargets=function(n,r,i){var o=this,a=0,s=[];return LE(n).Ot(function(t,e){e=aE(e);e.sequenceNumber<=r&&null===i.get(e.targetId)&&(a++,s.push(o.removeTargetData(n,e)))}).next(function(){return ST.waitFor(s)}).next(function(){return a})},DE.prototype.forEachTarget=function(t,n){return LE(t).Ot(function(t,e){e=aE(e);n(e)})},DE.prototype.Xt=function(t){return ME(t).get(gT.key).next(function(t){return cb(null!==t),t})},DE.prototype.Zt=function(t,e){return ME(t).put(gT.key,e)},DE.prototype.te=function(t,e){return LE(t).put(sE(this.R,e))},DE.prototype.ee=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},DE.prototype.getTargetCount=function(t){return this.Xt(t).next(function(t){return t.targetCount})},DE.prototype.getTargetData=function(t,r){var e=c_(r),e=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),i=null;return LE(t).Ot({range:e,index:dT.queryTargetsIndexName},function(t,e,n){e=aE(e);h_(r,e.target)&&(i=e,n.done())}).next(function(){return i})},DE.prototype.addMatchingKeys=function(n,t,r){var i=this,o=[],a=FE(n);return t.forEach(function(t){var e=eT(t.path);o.push(a.put(new vT(r,e))),o.push(i.referenceDelegate.addReference(n,r,t))}),ST.waitFor(o)},DE.prototype.removeMatchingKeys=function(n,t,r){var i=this,o=FE(n);return ST.forEach(t,function(t){var e=eT(t.path);return ST.waitFor([o.delete([r,e]),i.referenceDelegate.removeReference(n,r,t)])})},DE.prototype.removeMatchingKeysForTargetId=function(t,e){t=FE(t),e=IDBKeyRange.bound([e],[e+1],!1,!0);return t.delete(e)},DE.prototype.getMatchingKeysForTargetId=function(t,e){var e=IDBKeyRange.bound([e],[e+1],!1,!0),t=FE(t),r=fI();return t.Ot({range:e,kt:!0},function(t,e,n){t=rT(t[1]),t=new Kb(t);r=r.add(t)}).next(function(){return r})},DE.prototype.containsKey=function(t,e){var e=eT(e.path),e=IDBKeyRange.bound([e],[db(e)],!1,!0),i=0;return FE(t).Ot({index:vT.documentTargetsIndex,kt:!0,range:e},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0<i})},DE.prototype.lt=function(t,e){return LE(t).get(e).next(function(t){return t?aE(t):null})},DE);function DE(t,e){this.referenceDelegate=t,this.R=e}function xE(t){this.Ht=t}function LE(t){return HT(t,dT.store)}function ME(t){return HT(t,gT.store)}function FE(t){return HT(t,vT.store)}function UE(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){if(e.code!==Zm.FAILED_PRECONDITION||e.message!==TT)throw e;return ib("LocalStore","Unexpectedly lost primary lease"),[2]})})}function jE(t,e){var n=t[0],r=t[1],t=e[0],e=e[1],t=fb(n,t);return 0===t?fb(r,e):t}var qE=(zE.prototype.ie=function(){return++this.se},zE.prototype.re=function(t){var e=[t,this.ie()];this.buffer.size<this.ne?this.buffer=this.buffer.add(e):jE(e,t=this.buffer.last())<0&&(this.buffer=this.buffer.delete(t).add(e))},Object.defineProperty(zE.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!1,configurable:!0}),zE),VE=(GE.prototype.start=function(t){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.ue(t)},GE.prototype.stop=function(){this.ce&&(this.ce.cancel(),this.ce=null)},Object.defineProperty(GE.prototype,"started",{get:function(){return null!==this.ce},enumerable:!1,configurable:!0}),GE.prototype.ue=function(n){var t=this,e=this.oe?3e5:6e4;ib("LruGarbageCollector","Garbage collection scheduled in "+e+"ms"),this.ce=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:this.ce=null,this.oe=!0,t.label=1;case 1:return t.trys.push([1,3,,7]),[4,n.collectGarbage(this.garbageCollector)];case 2:return t.sent(),[3,7];case 3:return MT(e=t.sent())?(ib("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",e),[3,6]):[3,4];case 4:return[4,UE(e)];case 5:t.sent(),t.label=6;case 6:return[3,7];case 7:return[4,this.ue(n)];case 8:return t.sent(),[2]}})})})},GE),BE=(HE.prototype.calculateTargetCount=function(t,e){return this.ae.he(t).next(function(t){return Math.floor(e/100*t)})},HE.prototype.nthSequenceNumber=function(t,e){var n=this;if(0===e)return ST.resolve(Xm.o);var r=new qE(e);return this.ae.forEachTarget(t,function(t){return r.re(t.sequenceNumber)}).next(function(){return n.ae.le(t,function(t){return r.re(t)})}).next(function(){return r.maxValue})},HE.prototype.removeTargets=function(t,e,n){return this.ae.removeTargets(t,e,n)},HE.prototype.removeOrphanedDocuments=function(t,e){return this.ae.removeOrphanedDocuments(t,e)},HE.prototype.collect=function(e,n){var r=this;return-1===this.params.cacheSizeCollectionThreshold?(ib("LruGarbageCollector","Garbage collection skipped; disabled"),ST.resolve(_E)):this.getCacheSize(e).next(function(t){return t<r.params.cacheSizeCollectionThreshold?(ib("LruGarbageCollector","Garbage collection skipped; Cache size "+t+" is lower than threshold "+r.params.cacheSizeCollectionThreshold),_E):r.fe(e,n)})},HE.prototype.getCacheSize=function(t){return this.ae.getCacheSize(t)},HE.prototype.fe=function(e,n){var r,i,o,a,s,u,c,h=this,l=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(function(t){return i=t>h.params.maximumSequenceNumbersToCollect?(ib("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.params.maximumSequenceNumbersToCollect+" from "+t),h.params.maximumSequenceNumbersToCollect):t,a=Date.now(),h.nthSequenceNumber(e,i)}).next(function(t){return r=t,s=Date.now(),h.removeTargets(e,r,n)}).next(function(t){return o=t,u=Date.now(),h.removeOrphanedDocuments(e,r)}).next(function(t){return c=Date.now(),rb()<=sa.DEBUG&&ib("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(a-l)+"ms\n\tDetermined least recently used "+i+" in "+(s-a)+"ms\n\tRemoved "+o+" targets in "+(u-s)+"ms\n\tRemoved "+t+" documents in "+(c-u)+"ms\nTotal Duration: "+(c-l)+"ms"),ST.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:o,documentsRemoved:t})})},HE),KE=(WE.prototype.he=function(t){var n=this.de(t);return this.db.getTargetCache().getTargetCount(t).next(function(e){return n.next(function(t){return e+t})})},WE.prototype.de=function(t){var e=0;return this.le(t,function(t){e++}).next(function(){return e})},WE.prototype.forEachTarget=function(t,e){return this.db.getTargetCache().forEachTarget(t,e)},WE.prototype.le=function(t,n){return this.we(t,function(t,e){return n(e)})},WE.prototype.addReference=function(t,e,n){return QE(t,n)},WE.prototype.removeReference=function(t,e,n){return QE(t,n)},WE.prototype.removeTargets=function(t,e,n){return this.db.getTargetCache().removeTargets(t,e,n)},WE.prototype.markPotentiallyOrphaned=QE,WE.prototype._e=function(t,e){return r=e,i=!1,RE(n=t).$t(function(t){return kE(n,t,r).next(function(t){return t&&(i=!0),ST.resolve(!t)})}).next(function(){return i});var n,r,i},WE.prototype.removeOrphanedDocuments=function(n,r){var i=this,o=this.db.getRemoteDocumentCache().newChangeBuffer(),a=[],s=0;return this.we(n,function(e,t){t<=r&&(t=i._e(n,e).next(function(t){if(!t)return s++,o.getEntry(n,e).next(function(){return o.removeEntry(e),FE(n).delete([0,eT(e.path)])})}),a.push(t))}).next(function(){return ST.waitFor(a)}).next(function(){return o.apply(n)}).next(function(){return s})},WE.prototype.removeTarget=function(t,e){e=e.withSequenceNumber(t.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(t,e)},WE.prototype.updateLimboDocument=QE,WE.prototype.we=function(t,r){var i,t=FE(t),o=Xm.o;return t.Ot({index:vT.documentTargetsIndex},function(t,e){var n=t[0],t=(t[1],e.path),e=e.sequenceNumber;0===n?(o!==Xm.o&&r(new Kb(rT(i)),o),o=e,i=t):o=Xm.o}).next(function(){o!==Xm.o&&r(new Kb(rT(i)),o)})},WE.prototype.getCacheSize=function(t){return this.db.getRemoteDocumentCache().getSize(t)},WE);function WE(t,e){this.db=t,this.garbageCollector=new BE(this,e)}function HE(t,e){this.ae=t,this.params=e}function GE(t,e){this.garbageCollector=t,this.asyncQueue=e,this.oe=!1,this.ce=null}function zE(t){this.ne=t,this.buffer=new iI(jE),this.se=0}function QE(t,e){return FE(t).put((t=t.currentSequenceNumber,new vT(0,eT(e.path),t)))}var YE,XE=(nS.prototype.get=function(t){var e=this.mapKeyFn(t),e=this.inner[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.equalsFn(o,t))return i}},nS.prototype.has=function(t){return void 0!==this.get(t)},nS.prototype.set=function(t,e){var n=this.mapKeyFn(t),r=this.inner[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(this.equalsFn(r[i][0],t))return void(r[i]=[t,e]);r.push([t,e])}else this.inner[n]=[[t,e]]},nS.prototype.delete=function(t){var e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(this.equalsFn(n[r][0],t))return 1===n.length?delete this.inner[e]:n.splice(r,1),!0;return!1},nS.prototype.forEach=function(a){_b(this.inner,function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],i=i[1];a(o,i)}})},nS.prototype.isEmpty=function(){return wb(this.inner)},nS),G=(eS.prototype.getReadTime=function(t){t=this.changes.get(t);return t?t.readTime:gb.min()},eS.prototype.addEntry=function(t,e){this.assertNotApplied(),this.changes.set(t.key,{document:t,readTime:e})},eS.prototype.removeEntry=function(t,e){void 0===e&&(e=null),this.assertNotApplied(),this.changes.set(t,{document:o_.newInvalidDocument(t),readTime:e})},eS.prototype.getEntry=function(t,e){this.assertNotApplied();var n=this.changes.get(e);return void 0!==n?ST.resolve(n.document):this.getFromCache(t,e)},eS.prototype.getEntries=function(t,e){return this.getAllFromCache(t,e)},eS.prototype.apply=function(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)},eS.prototype.assertNotApplied=function(){},eS),JE=(tS.prototype.addEntry=function(t,e,n){return iS(t).put(oS(e),n)},tS.prototype.removeEntry=function(t,e){t=iS(t),e=oS(e);return t.delete(e)},tS.prototype.updateMetadata=function(e,n){var r=this;return this.getMetadata(e).next(function(t){return t.byteSize+=n,r.me(e,t)})},tS.prototype.getEntry=function(t,e){var n=this;return iS(t).get(oS(e)).next(function(t){return n.ye(e,t)})},tS.prototype.ge=function(t,e){var n=this;return iS(t).get(oS(e)).next(function(t){return{document:n.ye(e,t),size:EE(t)}})},tS.prototype.getEntries=function(t,e){var n=this,r=aI;return this.pe(t,e,function(t,e){e=n.ye(t,e);r=r.insert(t,e)}).next(function(){return r})},tS.prototype.Ee=function(t,e){var r=this,i=aI,o=new Jw(Kb.comparator);return this.pe(t,e,function(t,e){var n=r.ye(t,e);i=i.insert(t,n),o=o.insert(t,EE(e))}).next(function(){return{documents:i,Te:o}})},tS.prototype.pe=function(t,e,i){if(e.isEmpty())return ST.resolve();var n=IDBKeyRange.bound(e.first().path.toArray(),e.last().path.toArray()),o=e.getIterator(),a=o.getNext();return iS(t).Ot({range:n},function(t,e,n){for(var r=Kb.fromSegments(t);a&&Kb.comparator(a,r)<0;)i(a,null),a=o.getNext();a&&a.isEqual(r)&&(i(a,e),a=o.hasNext()?o.getNext():null),a?n.Ct(a.path.toArray()):n.done()}).next(function(){for(;a;)i(a,null),a=o.hasNext()?o.getNext():null})},tS.prototype.getDocumentsMatchingQuery=function(t,r,e){var n,i=this,o=aI,a=r.path.length+1,s={};return e.isEqual(gb.min())?(n=r.path.toArray(),s.range=IDBKeyRange.lowerBound(n)):(n=r.path.toArray(),e=eE(e),s.range=IDBKeyRange.lowerBound([n,e],!0),s.index=fT.collectionReadTimeIndex),iS(t).Ot(s,function(t,e,n){t.length===a&&(e=ZT(i.R,e),r.path.isPrefixOf(e.key.path)?nw(r,e)&&(o=o.insert(e.key,e)):n.done())}).next(function(){return o})},tS.prototype.newChangeBuffer=function(t){return new $E(this,!!t&&t.trackRemovals)},tS.prototype.getSize=function(t){return this.getMetadata(t).next(function(t){return t.byteSize})},tS.prototype.getMetadata=function(t){return rS(t).get(pT.key).next(function(t){return cb(!!t),t})},tS.prototype.me=function(t,e){return rS(t).put(pT.key,e)},tS.prototype.ye=function(t,e){if(e){e=ZT(this.R,e);if(!e.isNoDocument()||!e.version.isEqual(gb.min()))return e}return o_.newInvalidDocument(t)},tS),$E=(Xi(ZE,YE=G),ZE.prototype.applyChanges=function(i){var o=this,a=[],s=0,u=new iI(function(t,e){return fb(t.canonicalString(),e.canonicalString())});return this.changes.forEach(function(t,e){var n,r=o.Ae.get(t);e.document.isValidDocument()?(n=tE(o.Ie.R,e.document,o.getReadTime(t)),u=u.add(t.path.popLast()),e=EE(n),s+=e-r,a.push(o.Ie.addEntry(i,t,n))):(s-=r,o.trackRemovals?(r=tE(o.Ie.R,o_.newNoDocument(t,gb.min()),o.getReadTime(t)),a.push(o.Ie.addEntry(i,t,r))):a.push(o.Ie.removeEntry(i,t)))}),u.forEach(function(t){a.push(o.Ie.Ut.addToCollectionParentIndex(i,t))}),a.push(this.Ie.updateMetadata(i,s)),ST.waitFor(a)},ZE.prototype.getFromCache=function(t,e){var n=this;return this.Ie.ge(t,e).next(function(t){return n.Ae.set(e,t.size),t.document})},ZE.prototype.getAllFromCache=function(t,e){var n=this;return this.Ie.Ee(t,e).next(function(t){var e=t.documents;return t.Te.forEach(function(t,e){n.Ae.set(t,e)}),e})},ZE);function ZE(t,e){var n=this;return(n=YE.call(this)||this).Ie=t,n.trackRemovals=e,n.Ae=new XE(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),n}function tS(t,e){this.R=t,this.Ut=e}function eS(){this.changes=new XE(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),this.changesApplied=!1}function nS(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={}}function rS(t){return HT(t,pT.store)}function iS(t){return HT(t,fT.store)}function oS(t){return t.path.toArray()}var aS=(sS.prototype.Rt=function(e,n,t,r){var i=this;cb(t<r&&0<=t&&r<=11);var o=new CT("createOrUpgrade",n);t<1&&1<=r&&(e.createObjectStore(iT.store),(a=e).createObjectStore(aT.store,{keyPath:aT.keyPath}),a.createObjectStore(sT.store,{keyPath:sT.keyPath,autoIncrement:!0}).createIndex(sT.userMutationsIndex,sT.userMutationsKeyPath,{unique:!0}),a.createObjectStore(uT.store),uS(e),e.createObjectStore(fT.store));var a,s=ST.resolve();return t<3&&3<=r&&(0!==t&&((a=e).deleteObjectStore(vT.store),a.deleteObjectStore(dT.store),a.deleteObjectStore(gT.store),uS(e)),s=s.next(function(){return t=o.store(gT.store),e=new gT(0,0,gb.min().toTimestamp(),0),t.put(gT.key,e);var t,e})),t<4&&4<=r&&(s=(s=0!==t?s.next(function(){return n=e,(r=o).store(sT.store).Nt().next(function(t){n.deleteObjectStore(sT.store),n.createObjectStore(sT.store,{keyPath:sT.keyPath,autoIncrement:!0}).createIndex(sT.userMutationsIndex,sT.userMutationsKeyPath,{unique:!0});var e=r.store(sT.store),t=t.map(function(t){return e.put(t)});return ST.waitFor(t)});var n,r}):s).next(function(){e.createObjectStore(mT.store,{keyPath:mT.keyPath})})),t<5&&5<=r&&(s=s.next(function(){return i.Re(o)})),t<6&&6<=r&&(s=s.next(function(){return e.createObjectStore(pT.store),i.be(o)})),t<7&&7<=r&&(s=s.next(function(){return i.ve(o)})),t<8&&8<=r&&(s=s.next(function(){return i.Pe(e,o)})),t<9&&9<=r&&(s=s.next(function(){var t;(t=e).objectStoreNames.contains("remoteDocumentChanges")&&t.deleteObjectStore("remoteDocumentChanges"),(t=n.objectStore(fT.store)).createIndex(fT.readTimeIndex,fT.readTimeIndexPath,{unique:!1}),t.createIndex(fT.collectionReadTimeIndex,fT.collectionReadTimeIndexPath,{unique:!1})})),t<10&&10<=r&&(s=s.next(function(){return i.Ve(o)})),s=t<11&&11<=r?s.next(function(){e.createObjectStore(bT.store,{keyPath:bT.keyPath}),e.createObjectStore(_T.store,{keyPath:_T.keyPath})}):s},sS.prototype.be=function(e){var n=0;return e.store(fT.store).Ot(function(t,e){n+=EE(e)}).next(function(){var t=new pT(n);return e.store(pT.store).put(pT.key,t)})},sS.prototype.Re=function(n){var r=this,t=n.store(aT.store),i=n.store(sT.store);return t.Nt().next(function(t){return ST.forEach(t,function(e){var t=IDBKeyRange.bound([e.userId,-1],[e.userId,e.lastAcknowledgedBatchId]);return i.Nt(sT.userMutationsIndex,t).next(function(t){return ST.forEach(t,function(t){cb(t.userId===e.userId);t=oE(r.R,t);return TE(n,e.userId,t).next(function(){})})})})})},sS.prototype.ve=function(t){var o=t.store(vT.store),e=t.store(fT.store);return t.store(gT.store).get(gT.key).next(function(r){var i=[];return e.Ot(function(t,e){var n=new Eb(t),t=[0,eT(n)];i.push(o.get(t).next(function(t){return t?ST.resolve():o.put(new vT(0,eT(n),r.highestListenSequenceNumber))}))}).next(function(){return ST.waitFor(i)})})},sS.prototype.Pe=function(t,e){t.createObjectStore(yT.store,{keyPath:yT.keyPath});function r(t){if(i.add(t)){var e=t.lastSegment(),t=t.popLast();return n.put({collectionId:e,parent:eT(t)})}}var n=e.store(yT.store),i=new dE;return e.store(fT.store).Ot({kt:!0},function(t,e){t=new Eb(t);return r(t.popLast())}).next(function(){return e.store(uT.store).Ot({kt:!0},function(t,e){t[0];var n=t[1],n=(t[2],rT(n));return r(n.popLast())})})},sS.prototype.Ve=function(t){var n=this,r=t.store(dT.store);return r.Ot(function(t,e){e=aE(e),e=sE(n.R,e);return r.put(e)})},sS);function sS(t){this.R=t}function uS(t){t.createObjectStore(vT.store,{keyPath:vT.keyPath}).createIndex(vT.documentTargetsIndex,vT.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(dT.store,{keyPath:dT.keyPath}).createIndex(dT.queryTargetsIndexName,dT.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(gT.store)}var cS="Failed to obtain exclusive access to the persistence layer. To allow shared access, multi-tab synchronization has to be enabled in all tabs. If you are using `experimentalForceOwningTab:true`, make sure that only one tab has persistence enabled at any given time.",hS=(lS.prototype.start=function(){var e=this;return this.je().then(function(){if(!e.isPrimary&&!e.allowTabSynchronization)throw new tb(Zm.FAILED_PRECONDITION,cS);return e.We(),e.Ge(),e.ze(),e.runTransaction("getHighestListenSequenceNumber","readonly",function(t){return e.qe.getHighestSequenceNumber(t)})}).then(function(t){e.Ne=new Xm(t,e.De)}).then(function(){e.xe=!0}).catch(function(t){return e.Be&&e.Be.close(),Promise.reject(t)})},lS.prototype.He=function(n){var t=this;return this.Me=function(e){return $i(t,void 0,void 0,function(){return Zi(this,function(t){return this.started?[2,n(e)]:[2]})})},n(this.isPrimary)},lS.prototype.setDatabaseDeletedListener=function(n){var t=this;this.Be.vt(function(e){return $i(t,void 0,void 0,function(){return Zi(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]}})})})},lS.prototype.setNetworkEnabled=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.Se.enqueueAndForget(function(){return $i(e,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.started?[4,this.je()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})}))},lS.prototype.je=function(){var n=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",function(e){return pS(e).put(new mT(n.clientId,Date.now(),n.networkEnabled,n.inForeground)).next(function(){if(n.isPrimary)return n.Je(e).next(function(t){t||(n.isPrimary=!1,n.Se.enqueueRetryable(function(){return n.Me(!1)}))})}).next(function(){return n.Ye(e)}).next(function(t){return n.isPrimary&&!t?n.Xe(e).next(function(){return!1}):!!t&&n.Ze(e).next(function(){return!0})})}).catch(function(t){if(MT(t))return ib("IndexedDbPersistence","Failed to extend owner lease: ",t),n.isPrimary;if(!n.allowTabSynchronization)throw t;return ib("IndexedDbPersistence","Releasing owner lease after error during lease refresh",t),!1}).then(function(t){n.isPrimary!==t&&n.Se.enqueueRetryable(function(){return n.Me(t)}),n.isPrimary=t})},lS.prototype.Je=function(t){var e=this;return fS(t).get(iT.key).next(function(t){return ST.resolve(e.tn(t))})},lS.prototype.en=function(t){return pS(t).delete(this.clientId)},lS.prototype.nn=function(){return $i(this,void 0,void 0,function(){var e,n,r,i,o=this;return Zi(this,function(t){switch(t.label){case 0:return!this.isPrimary||this.sn(this.$e,18e5)?[3,2]:(this.$e=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(t){var r=HT(t,mT.store);return r.Nt().next(function(t){var e=o.rn(t,18e5),n=t.filter(function(t){return-1===e.indexOf(t)});return ST.forEach(n,function(t){return r.delete(t.clientId)}).next(function(){return n})})}).catch(function(){return[]})]);case 1:if(e=t.sent(),this.Ke)for(n=0,r=e;n<r.length;n++)i=r[n],this.Ke.removeItem(this.on(i.clientId));t.label=2;case 2:return[2]}})})},lS.prototype.ze=function(){var t=this;this.Oe=this.Se.enqueueAfterDelay("client_metadata_refresh",4e3,function(){return t.je().then(function(){return t.nn()}).then(function(){return t.ze()})})},lS.prototype.tn=function(t){return!!t&&t.ownerId===this.clientId},lS.prototype.Ye=function(e){var r=this;return this.Ce?ST.resolve(!0):fS(e).get(iT.key).next(function(t){if(null!==t&&r.sn(t.leaseTimestampMs,5e3)&&!r.cn(t.ownerId)){if(r.tn(t)&&r.networkEnabled)return!0;if(!r.tn(t)){if(!t.allowTabSynchronization)throw new tb(Zm.FAILED_PRECONDITION,cS);return!1}}return!(!r.networkEnabled||!r.inForeground)||pS(e).Nt().next(function(t){return void 0===r.rn(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&&ib("IndexedDbPersistence","Client "+(t?"is":"is not")+" eligible for a primary lease."),t})},lS.prototype.shutdown=function(){return $i(this,void 0,void 0,function(){var n=this;return Zi(this,function(t){switch(t.label){case 0:return this.xe=!1,this.un(),this.Oe&&(this.Oe.cancel(),this.Oe=null),this.an(),this.hn(),[4,this.Be.runTransaction("shutdown","readwrite",[iT.store,mT.store],function(t){var e=new KT(t,Xm.o);return n.Xe(e).next(function(){return n.en(e)})})];case 1:return t.sent(),this.Be.close(),this.ln(),[2]}})})},lS.prototype.rn=function(t,e){var n=this;return t.filter(function(t){return n.sn(t.updateTimeMs,e)&&!n.cn(t.clientId)})},lS.prototype.fn=function(){var e=this;return this.runTransaction("getActiveClients","readonly",function(t){return pS(t).Nt().next(function(t){return e.rn(t,18e5).map(function(t){return t.clientId})})})},Object.defineProperty(lS.prototype,"started",{get:function(){return this.xe},enumerable:!1,configurable:!0}),lS.prototype.getMutationQueue=function(t){return SE.Kt(t,this.R,this.Ut,this.referenceDelegate)},lS.prototype.getTargetCache=function(){return this.qe},lS.prototype.getRemoteDocumentCache=function(){return this.Ue},lS.prototype.getIndexManager=function(){return this.Ut},lS.prototype.getBundleCache=function(){return this.Qe},lS.prototype.runTransaction=function(e,n,r){var i=this;ib("IndexedDbPersistence","Starting transaction:",e);var o,t="readonly"===n?"readonly":"readwrite";return this.Be.runTransaction(e,t,IT,function(t){return o=new KT(t,i.Ne?i.Ne.next():Xm.o),"readwrite-primary"===n?i.Je(o).next(function(t){return!!t||i.Ye(o)}).next(function(t){if(!t)throw ob("Failed to obtain primary lease for action '"+e+"'."),i.isPrimary=!1,i.Se.enqueueRetryable(function(){return i.Me(!1)}),new tb(Zm.FAILED_PRECONDITION,TT);return r(o)}).next(function(t){return i.Ze(o).next(function(){return t})}):i.dn(o).next(function(){return r(o)})}).then(function(t){return o.raiseOnCommittedEvent(),t})},lS.prototype.dn=function(t){var e=this;return fS(t).get(iT.key).next(function(t){if(null!==t&&e.sn(t.leaseTimestampMs,5e3)&&!e.cn(t.ownerId)&&!e.tn(t)&&!(e.Ce||e.allowTabSynchronization&&t.allowTabSynchronization))throw new tb(Zm.FAILED_PRECONDITION,cS)})},lS.prototype.Ze=function(t){var e=new iT(this.clientId,this.allowTabSynchronization,Date.now());return fS(t).put(iT.key,e)},lS.yt=function(){return kT.yt()},lS.prototype.Xe=function(t){var e=this,n=fS(t);return n.get(iT.key).next(function(t){return e.tn(t)?(ib("IndexedDbPersistence","Releasing primary lease."),n.delete(iT.key)):ST.resolve()})},lS.prototype.sn=function(t,e){var n=Date.now();return!(t<n-e||n<t&&(ob("Detected an update time that is in the future: "+t+" > "+n),1))},lS.prototype.We=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.ke=function(){t.Se.enqueueAndForget(function(){return t.inForeground="visible"===t.document.visibilityState,t.je()})},this.document.addEventListener("visibilitychange",this.ke),this.inForeground="visible"===this.document.visibilityState)},lS.prototype.an=function(){this.ke&&(this.document.removeEventListener("visibilitychange",this.ke),this.ke=null)},lS.prototype.Ge=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.Fe=function(){e.un(),e.Se.enqueueAndForget(function(){return e.shutdown()})},this.window.addEventListener("unload",this.Fe))},lS.prototype.hn=function(){this.Fe&&(this.window.removeEventListener("unload",this.Fe),this.Fe=null)},lS.prototype.cn=function(t){try{var e=null!==(null===(e=this.Ke)||void 0===e?void 0:e.getItem(this.on(t)));return ib("IndexedDbPersistence","Client '"+t+"' "+(e?"is":"is not")+" zombied in LocalStorage"),e}catch(t){return ob("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},lS.prototype.un=function(){if(this.Ke)try{this.Ke.setItem(this.on(this.clientId),String(Date.now()))}catch(t){ob("Failed to set zombie client id.",t)}},lS.prototype.ln=function(){if(this.Ke)try{this.Ke.removeItem(this.on(this.clientId))}catch(t){}},lS.prototype.on=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},lS);function lS(t,e,n,r,i,o,a,s,u,c){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.Se=i,this.window=o,this.document=a,this.De=u,this.Ce=c,this.Ne=null,this.xe=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Fe=null,this.inForeground=!1,this.ke=null,this.Oe=null,this.$e=Number.NEGATIVE_INFINITY,this.Me=function(t){return Promise.resolve()},!lS.yt())throw new tb(Zm.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new KE(this,r),this.Le=e+"main",this.R=new YT(s),this.Be=new kT(this.Le,11,new aS(this.R)),this.qe=new PE(this.referenceDelegate,this.R),this.Ut=new vE,this.Ue=(e=this.R,s=this.Ut,new JE(e,s)),this.Qe=new cE,this.window&&this.window.localStorage?this.Ke=this.window.localStorage:(this.Ke=null,!1===c&&ob("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}function fS(t){return HT(t,iT.store)}function pS(t){return HT(t,mT.store)}function dS(t,e){var n=t.projectId;return t.isDefaultDatabase||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}function vS(t,e){this.progress=t,this.wn=e}var gS=(TS.prototype.mn=function(e,n){var r=this;return this._n.getAllMutationBatchesAffectingDocumentKey(e,n).next(function(t){return r.yn(e,n,t)})},TS.prototype.yn=function(t,e,r){return this.Ue.getEntry(t,e).next(function(t){for(var e=0,n=r;e<n.length;e++)n[e].applyToLocalView(t);return t})},TS.prototype.gn=function(t,i){t.forEach(function(t,e){for(var n=0,r=i;n<r.length;n++)r[n].applyToLocalView(e)})},TS.prototype.pn=function(e,t){var n=this;return this.Ue.getEntries(e,t).next(function(t){return n.En(e,t).next(function(){return t})})},TS.prototype.En=function(t,e){var n=this;return this._n.getAllMutationBatchesAffectingDocumentKeys(t,e).next(function(t){return n.gn(e,t)})},TS.prototype.getDocumentsMatchingQuery=function(t,e,n){return r=e,Kb.isDocumentKey(r.path)&&null===r.collectionGroup&&0===r.filters.length?this.Tn(t,e.path):Y_(e)?this.In(t,e,n):this.An(t,e,n);var r},TS.prototype.Tn=function(t,e){return this.mn(t,new Kb(e)).next(function(t){var e=cI;return e=t.isFoundDocument()?e.insert(t.key,t):e})},TS.prototype.In=function(n,r,i){var o=this,a=r.collectionGroup,s=cI;return this.Ut.getCollectionParents(n,a).next(function(t){return ST.forEach(t,function(t){var e,e=(e=r,t=t.child(a),new B_(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt));return o.An(n,e,i).next(function(t){t.forEach(function(t,e){s=s.insert(t,e)})})}).next(function(){return s})})},TS.prototype.An=function(e,n,t){var c,h,r=this;return this.Ue.getDocumentsMatchingQuery(e,n,t).next(function(t){return c=t,r._n.getAllMutationBatchesAffectingQuery(e,n)}).next(function(t){return h=t,r.Rn(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 a=o[i],s=a.key,u=c.get(s);null==u&&(u=o_.newInvalidDocument(s),c=c.insert(s,u)),Aw(a,u,r.localWriteTime),u.isFoundDocument()||(c=c.remove(s))}})}).next(function(){return c.forEach(function(t,e){nw(n,e)||(c=c.remove(t))}),c})},TS.prototype.Rn=function(t,e,n){for(var r=fI(),i=0,o=e;i<o.length;i++)for(var a=0,s=o[i].mutations;a<s.length;a++){var u=s[a];u instanceof Lw&&null===n.get(u.key)&&(r=r.add(u.key))}var c=n;return this.Ue.getEntries(t,r).next(function(t){return t.forEach(function(t,e){e.isFoundDocument()&&(c=c.insert(t,e))}),c})},TS),yS=(IS.Pn=function(t,e){for(var n=fI(),r=fI(),i=0,o=e.docChanges;i<o.length;i++){var a=o[i];switch(a.type){case 0:n=n.add(a.doc.key);break;case 1:r=r.add(a.doc.key)}}return new IS(t,e.fromCache,n,r)},IS),mS=(wS.prototype.Vn=function(t){this.Sn=t},wS.prototype.getDocumentsMatchingQuery=function(e,r,i,o){var a=this;return 0===r.filters.length&&null===r.limit&&null==r.startAt&&null==r.endAt&&(0===r.explicitOrderBy.length||1===r.explicitOrderBy.length&&r.explicitOrderBy[0].field.isKeyField())||i.isEqual(gb.min())?this.Dn(e,r):this.Sn.pn(e,o).next(function(t){var n=a.Cn(r,t);return(H_(r)||G_(r))&&a.Nn(r.limitType,n,o,i)?a.Dn(e,r):(rb()<=sa.DEBUG&&ib("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),ew(r)),a.Sn.getDocumentsMatchingQuery(e,r,i).next(function(e){return n.forEach(function(t){e=e.insert(t.key,t)}),e}))})},wS.prototype.Cn=function(n,t){var r=new iI(rw(n));return t.forEach(function(t,e){nw(n,e)&&(r=r.add(e))}),r},wS.prototype.Nn=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.compareTo(r))},wS.prototype.Dn=function(t,e){return rb()<=sa.DEBUG&&ib("QueryEngine","Using full collection scan to execute query:",ew(e)),this.Sn.getDocumentsMatchingQuery(t,e,gb.min())},wS),bS=(_S.prototype.collectGarbage=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(t){return e.collect(t,n.Fn)})},_S);function _S(t,e,n,r){this.persistence=t,this.xn=e,this.R=r,this.Fn=new Jw(fb),this.kn=new XE(c_,h_),this.On=gb.min(),this._n=t.getMutationQueue(n),this.$n=t.getRemoteDocumentCache(),this.qe=t.getTargetCache(),this.Mn=new gS(this.$n,this._n,this.persistence.getIndexManager()),this.Qe=t.getBundleCache(),this.xn.Vn(this.Mn)}function wS(){}function IS(t,e,n,r){this.targetId=t,this.fromCache=e,this.bn=n,this.vn=r}function TS(t,e,n){this.Ue=t,this._n=e,this.Ut=n}function ES(t,e,n,r){return new bS(t,e,n,r)}function SS(i,o){return $i(this,void 0,void 0,function(){var e,n,m,r;return Zi(this,function(t){switch(t.label){case 0:return n=(e=i)._n,m=e.Mn,[4,e.persistence.runTransaction("Handle user change","readonly",function(g){var y;return e._n.getAllMutationBatches(g).next(function(t){return y=t,n=e.persistence.getMutationQueue(o),m=new gS(e.$n,n,e.persistence.getIndexManager()),n.getAllMutationBatches(g)}).next(function(t){for(var e=[],n=[],r=fI(),i=0,o=y;i<o.length;i++){var a=o[i];e.push(a.batchId);for(var s=0,u=a.mutations;s<u.length;s++)var c=u[s],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.pn(g,r).next(function(t){return{Ln:t,removedBatchIds:e,addedBatchIds:n}})})})];case 1:return r=t.sent(),[2,(e._n=n,e.Mn=m,e.xn.Vn(e.Mn),r)]}})})}function CS(t,h){var l=t;return l.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(t){var e,r,i,o,a,n,s,u=h.batch.keys(),c=l.$n.newChangeBuffer({trackRemovals:!0});return e=l,r=t,o=c,a=(i=h).batch,n=a.keys(),s=ST.resolve(),n.forEach(function(n){s=s.next(function(){return o.getEntry(r,n)}).next(function(t){var e=i.docVersions.get(n);cb(null!==e),t.version.compareTo(e)<0&&(a.applyToRemoteDocument(t,i),t.isValidDocument()&&o.addEntry(t,i.commitVersion))})}),s.next(function(){return e._n.removeMutationBatch(r,a)}).next(function(){return c.apply(t)}).next(function(){return l._n.performConsistencyCheck(t)}).next(function(){return l.Mn.pn(t,u)})})}function kS(t){var e=t;return e.persistence.runTransaction("Get last remote snapshot version","readonly",function(t){return e.qe.getLastRemoteSnapshotVersion(t)})}function NS(t,r){var u=t,c=r.snapshotVersion,h=u.Fn;return u.persistence.runTransaction("Apply remote event","readwrite-primary",function(a){var t=u.$n.newChangeBuffer({trackRemovals:!0});h=u.Fn;var s=[];r.targetChanges.forEach(function(t,e){var n,r,i,o=h.get(e);o&&(s.push(u.qe.removeMatchingKeys(a,t.removedDocuments,e).next(function(){return u.qe.addMatchingKeys(a,t.addedDocuments,e)})),0<(i=t.resumeToken).approximateByteSize()&&(n=o.withResumeToken(i,c).withSequenceNumber(a.currentSequenceNumber),h=h.insert(e,n),r=o,i=t,cb(0<(o=n).resumeToken.approximateByteSize()),(0===r.resumeToken.approximateByteSize()||3e8<=o.snapshotVersion.toMicroseconds()-r.snapshotVersion.toMicroseconds()||0<i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size)&&s.push(u.qe.updateTargetData(a,n))))});var e,n=aI;return r.documentUpdates.forEach(function(t,e){r.resolvedLimboDocuments.has(t)&&s.push(u.persistence.referenceDelegate.updateLimboDocument(a,t))}),s.push(AS(a,t,r.documentUpdates,c,void 0).next(function(t){n=t})),c.isEqual(gb.min())||(e=u.qe.getLastRemoteSnapshotVersion(a).next(function(t){return u.qe.setTargetsMetadata(a,a.currentSequenceNumber,c)}),s.push(e)),ST.waitFor(s).next(function(){return t.apply(a)}).next(function(){return u.Mn.En(a,n)}).next(function(){return n})}).then(function(t){return u.Fn=h,t})}function AS(t,a,e,s,u){var n=fI();return e.forEach(function(t){return n=n.add(t)}),a.getEntries(t,n).next(function(i){var o=aI;return e.forEach(function(t,e){var n=i.get(t),r=(null==u?void 0:u.get(t))||s;e.isNoDocument()&&e.version.isEqual(gb.min())?(a.removeEntry(t,r),o=o.insert(t,e)):!n.isValidDocument()||0<e.version.compareTo(n.version)||0===e.version.compareTo(n.version)&&n.hasPendingWrites?(a.addEntry(e,r),o=o.insert(t,e)):ib("LocalStore","Ignoring outdated watch update for ",t,". Current version:",n.version," Watch version:",e.version)}),o})}function RS(t,r){var i=t;return i.persistence.runTransaction("Allocate target","readwrite",function(e){var n;return i.qe.getTargetData(e,r).next(function(t){return t?(n=t,ST.resolve(n)):i.qe.allocateTargetId(e).next(function(t){return n=new QT(r,t,0,e.currentSequenceNumber),i.qe.addTargetData(e,n).next(function(){return n})})})}).then(function(t){var e=i.Fn.get(t.targetId);return(null===e||0<t.snapshotVersion.compareTo(e.snapshotVersion))&&(i.Fn=i.Fn.insert(t.targetId,t),i.kn.set(r,t.targetId)),t})}function OS(i,o,a){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:n=(e=i).Fn.get(o),r=a?"readwrite":"readwrite-primary",t.label=1;case 1:return t.trys.push([1,4,,5]),a?[3,3]:[4,e.persistence.runTransaction("Release target",r,function(t){return e.persistence.referenceDelegate.removeTarget(t,n)})];case 2:t.sent(),t.label=3;case 3:return[3,5];case 4:if(!MT(r=t.sent()))throw r;return ib("LocalStore","Failed to update sequence numbers for target "+o+": "+r),[3,5];case 5:return e.Fn=e.Fn.remove(o),e.kn.delete(n.target),[2]}})})}function PS(t,o,a){var s=t,u=gb.min(),c=fI();return s.persistence.runTransaction("Execute query","readonly",function(e){return t=s,n=e,r=J_(o),(void 0!==(t=(i=t).kn.get(r))?ST.resolve(i.Fn.get(t)):i.qe.getTargetData(n,r)).next(function(t){if(t)return u=t.lastLimboFreeSnapshotVersion,s.qe.getMatchingKeysForTargetId(e,t.targetId).next(function(t){c=t})}).next(function(){return s.xn.getDocumentsMatchingQuery(e,o,a?u:gb.min(),a?c:fI())}).next(function(t){return{documents:t,Bn:c}});var t,n,r,i})}function DS(t,e){var n=t,r=n.qe,t=n.Fn.get(e);return t?Promise.resolve(t.target):n.persistence.runTransaction("Get target data","readonly",function(t){return r.lt(t,e).next(function(t){return t?t.target:null})})}function xS(t){var a=t;return a.persistence.runTransaction("Get new document changes","readonly",function(t){return e=a.$n,n=t,t=a.On,r=e,i=aI,o=eE(t),t=iS(n),n=IDBKeyRange.lowerBound(o,!0),t.Ot({index:fT.readTimeIndex,range:n},function(t,e){var n=ZT(r.R,e);i=i.insert(n.key,n),o=e.readTime}).next(function(){return{wn:i,readTime:nE(o)}});var e,n,r,i,o}).then(function(t){var e=t.wn,t=t.readTime;return a.On=t,e})}function LS(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){return[2,(e=n).persistence.runTransaction("Synchronize last document change read time","readonly",function(t){return t=iS(t),r=gb.min(),t.Ot({index:fT.readTimeIndex,reverse:!0},function(t,e,n){e.readTime&&(r=nE(e.readTime)),n.done()}).next(function(){return r});var r}).then(function(t){e.On=t})]})})}var MS,FS,US=(oC.prototype.getBundleMetadata=function(t,e){return ST.resolve(this.Kn.get(e))},oC.prototype.saveBundleMetadata=function(t,e){return this.Kn.set(e.id,{id:e.id,version:e.version,createTime:PI(e.createTime)}),ST.resolve()},oC.prototype.getNamedQuery=function(t,e){return ST.resolve(this.jn.get(e))},oC.prototype.saveNamedQuery=function(t,e){return this.jn.set(e.name,{name:(e=e).name,query:uE(e.bundledQuery),readTime:PI(e.readTime)}),ST.resolve()},oC),jS=(iC.prototype.isEmpty=function(){return this.Wn.isEmpty()},iC.prototype.addReference=function(t,e){e=new qS(t,e);this.Wn=this.Wn.add(e),this.zn=this.zn.add(e)},iC.prototype.Jn=function(t,e){var n=this;t.forEach(function(t){return n.addReference(t,e)})},iC.prototype.removeReference=function(t,e){this.Yn(new qS(t,e))},iC.prototype.Xn=function(t,e){var n=this;t.forEach(function(t){return n.removeReference(t,e)})},iC.prototype.Zn=function(t){var e=this,n=new Kb(new Eb([])),r=new qS(n,t),t=new qS(n,t+1),i=[];return this.zn.forEachInRange([r,t],function(t){e.Yn(t),i.push(t.key)}),i},iC.prototype.ts=function(){var e=this;this.Wn.forEach(function(t){return e.Yn(t)})},iC.prototype.Yn=function(t){this.Wn=this.Wn.delete(t),this.zn=this.zn.delete(t)},iC.prototype.es=function(t){var e=new Kb(new Eb([])),n=new qS(e,t),t=new qS(e,t+1),r=fI();return this.zn.forEachInRange([n,t],function(t){r=r.add(t.key)}),r},iC.prototype.containsKey=function(t){var e=new qS(t,0),e=this.Wn.firstAfterOrEqual(e);return null!==e&&t.isEqual(e.key)},iC),qS=(rC.Gn=function(t,e){return Kb.comparator(t.key,e.key)||fb(t.ns,e.ns)},rC.Hn=function(t,e){return fb(t.ns,e.ns)||Kb.comparator(t.key,e.key)},rC),VS=(nC.prototype.checkEmpty=function(t){return ST.resolve(0===this._n.length)},nC.prototype.addMutationBatch=function(t,e,n,r){var i=this.ss;this.ss++,0<this._n.length&&this._n[this._n.length-1];n=new GT(i,e,n,r);this._n.push(n);for(var o=0,a=r;o<a.length;o++){var s=a[o];this.rs=this.rs.add(new qS(s.key,i)),this.Ut.addToCollectionParentIndex(t,s.key.path.popLast())}return ST.resolve(n)},nC.prototype.lookupMutationBatch=function(t,e){return ST.resolve(this.os(e))},nC.prototype.getNextMutationBatchAfterBatchId=function(t,e){e+=1,e=this.cs(e),e=e<0?0:e;return ST.resolve(this._n.length>e?this._n[e]:null)},nC.prototype.getHighestUnacknowledgedBatchId=function(){return ST.resolve(0===this._n.length?-1:this.ss-1)},nC.prototype.getAllMutationBatches=function(t){return ST.resolve(this._n.slice())},nC.prototype.getAllMutationBatchesAffectingDocumentKey=function(t,e){var n=this,r=new qS(e,0),e=new qS(e,Number.POSITIVE_INFINITY),i=[];return this.rs.forEachInRange([r,e],function(t){t=n.os(t.ns);i.push(t)}),ST.resolve(i)},nC.prototype.getAllMutationBatchesAffectingDocumentKeys=function(t,e){var n=this,r=new iI(fb);return e.forEach(function(t){var e=new qS(t,0),t=new qS(t,Number.POSITIVE_INFINITY);n.rs.forEachInRange([e,t],function(t){r=r.add(t.ns)})}),ST.resolve(this.us(r))},nC.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var n=e.path,r=n.length+1,e=n;Kb.isDocumentKey(e)||(e=e.child(""));var e=new qS(new Kb(e),0),i=new iI(fb);return this.rs.forEachWhile(function(t){var e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(i=i.add(t.ns)),!0)},e),ST.resolve(this.us(i))},nC.prototype.us=function(t){var e=this,n=[];return t.forEach(function(t){t=e.os(t);null!==t&&n.push(t)}),n},nC.prototype.removeMutationBatch=function(n,r){var i=this;cb(0===this.hs(r.batchId,"removed")),this._n.shift();var o=this.rs;return ST.forEach(r.mutations,function(t){var e=new qS(t.key,r.batchId);return o=o.delete(e),i.referenceDelegate.markPotentiallyOrphaned(n,t.key)}).next(function(){i.rs=o})},nC.prototype.Gt=function(t){},nC.prototype.containsKey=function(t,e){var n=new qS(e,0),n=this.rs.firstAfterOrEqual(n);return ST.resolve(e.isEqual(n&&n.key))},nC.prototype.performConsistencyCheck=function(t){return this._n.length,ST.resolve()},nC.prototype.hs=function(t,e){return this.cs(t)},nC.prototype.cs=function(t){return 0===this._n.length?0:t-this._n[0].batchId},nC.prototype.os=function(t){t=this.cs(t);return t<0||t>=this._n.length?null:this._n[t]},nC),BS=(eC.prototype.addEntry=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,i=this.ls(e);return this.docs=this.docs.insert(r,{document:e.clone(),size:i,readTime:n}),this.size+=i-o,this.Ut.addToCollectionParentIndex(t,r.path.popLast())},eC.prototype.removeEntry=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},eC.prototype.getEntry=function(t,e){var n=this.docs.get(e);return ST.resolve(n?n.document.clone():o_.newInvalidDocument(e))},eC.prototype.getEntries=function(t,e){var n=this,r=aI;return e.forEach(function(t){var e=n.docs.get(t);r=r.insert(t,e?e.document.clone():o_.newInvalidDocument(t))}),ST.resolve(r)},eC.prototype.getDocumentsMatchingQuery=function(t,e,n){for(var r=aI,i=new Kb(e.path.child("")),o=this.docs.getIteratorFrom(i);o.hasNext();){var a=o.getNext(),s=a.key,u=a.value,a=u.document,u=u.readTime;if(!e.path.isPrefixOf(s.path))break;u.compareTo(n)<=0||nw(e,a)&&(r=r.insert(a.key,a.clone()))}return ST.resolve(r)},eC.prototype.fs=function(t,e){return ST.forEach(this.docs,function(t){return e(t)})},eC.prototype.newChangeBuffer=function(t){return new KS(this)},eC.prototype.getSize=function(t){return ST.resolve(this.size)},eC),KS=(Xi(tC,FS=G),tC.prototype.applyChanges=function(n){var r=this,i=[];return this.changes.forEach(function(t,e){e.document.isValidDocument()?i.push(r.Ie.addEntry(n,e.document,r.getReadTime(t))):r.Ie.removeEntry(t)}),ST.waitFor(i)},tC.prototype.getFromCache=function(t,e){return this.Ie.getEntry(t,e)},tC.prototype.getAllFromCache=function(t,e){return this.Ie.getEntries(t,e)},tC),WS=(ZS.prototype.forEachTarget=function(t,n){return this.ds.forEach(function(t,e){return n(e)}),ST.resolve()},ZS.prototype.getLastRemoteSnapshotVersion=function(t){return ST.resolve(this.lastRemoteSnapshotVersion)},ZS.prototype.getHighestSequenceNumber=function(t){return ST.resolve(this.ws)},ZS.prototype.allocateTargetId=function(t){return this.highestTargetId=this.ys.next(),ST.resolve(this.highestTargetId)},ZS.prototype.setTargetsMetadata=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.ws&&(this.ws=e),ST.resolve()},ZS.prototype.te=function(t){this.ds.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.ys=new OE(e),this.highestTargetId=e),t.sequenceNumber>this.ws&&(this.ws=t.sequenceNumber)},ZS.prototype.addTargetData=function(t,e){return this.te(e),this.targetCount+=1,ST.resolve()},ZS.prototype.updateTargetData=function(t,e){return this.te(e),ST.resolve()},ZS.prototype.removeTargetData=function(t,e){return this.ds.delete(e.target),this._s.Zn(e.targetId),--this.targetCount,ST.resolve()},ZS.prototype.removeTargets=function(n,r,i){var o=this,a=0,s=[];return this.ds.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.ds.delete(t),s.push(o.removeMatchingKeysForTargetId(n,e.targetId)),a++)}),ST.waitFor(s).next(function(){return a})},ZS.prototype.getTargetCount=function(t){return ST.resolve(this.targetCount)},ZS.prototype.getTargetData=function(t,e){e=this.ds.get(e)||null;return ST.resolve(e)},ZS.prototype.addMatchingKeys=function(t,e,n){return this._s.Jn(e,n),ST.resolve()},ZS.prototype.removeMatchingKeys=function(e,t,n){this._s.Xn(t,n);var r=this.persistence.referenceDelegate,i=[];return r&&t.forEach(function(t){i.push(r.markPotentiallyOrphaned(e,t))}),ST.waitFor(i)},ZS.prototype.removeMatchingKeysForTargetId=function(t,e){return this._s.Zn(e),ST.resolve()},ZS.prototype.getMatchingKeysForTargetId=function(t,e){e=this._s.es(e);return ST.resolve(e)},ZS.prototype.containsKey=function(t,e){return ST.resolve(this._s.containsKey(e))},ZS),HS=($S.prototype.start=function(){return Promise.resolve()},$S.prototype.shutdown=function(){return this.xe=!1,Promise.resolve()},Object.defineProperty($S.prototype,"started",{get:function(){return this.xe},enumerable:!1,configurable:!0}),$S.prototype.setDatabaseDeletedListener=function(){},$S.prototype.setNetworkEnabled=function(){},$S.prototype.getIndexManager=function(){return this.Ut},$S.prototype.getMutationQueue=function(t){var e=this.gs[t.toKey()];return e||(e=new VS(this.Ut,this.referenceDelegate),this.gs[t.toKey()]=e),e},$S.prototype.getTargetCache=function(){return this.qe},$S.prototype.getRemoteDocumentCache=function(){return this.Ue},$S.prototype.getBundleCache=function(){return this.Qe},$S.prototype.runTransaction=function(t,e,n){var r=this;ib("MemoryPersistence","Starting transaction:",t);var i=new GS(this.Ne.next());return this.referenceDelegate.Es(),n(i).next(function(t){return r.referenceDelegate.Ts(i).next(function(){return t})}).toPromise().then(function(t){return i.raiseOnCommittedEvent(),t})},$S.prototype.Is=function(e,n){return ST.or(Object.values(this.gs).map(function(t){return function(){return t.containsKey(e,n)}}))},$S),GS=(Xi(JS,MS=Sn),JS),zS=(XS.bs=function(t){return new XS(t)},Object.defineProperty(XS.prototype,"vs",{get:function(){if(this.Rs)return this.Rs;throw ub()},enumerable:!1,configurable:!0}),XS.prototype.addReference=function(t,e,n){return this.As.addReference(n,e),this.vs.delete(n.toString()),ST.resolve()},XS.prototype.removeReference=function(t,e,n){return this.As.removeReference(n,e),this.vs.add(n.toString()),ST.resolve()},XS.prototype.markPotentiallyOrphaned=function(t,e){return this.vs.add(e.toString()),ST.resolve()},XS.prototype.removeTarget=function(t,e){var n=this;this.As.Zn(e.targetId).forEach(function(t){return n.vs.add(t.toString())});var r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(t,e.targetId).next(function(t){t.forEach(function(t){return n.vs.add(t.toString())})}).next(function(){return r.removeTargetData(t,e)})},XS.prototype.Es=function(){this.Rs=new Set},XS.prototype.Ts=function(n){var r=this,i=this.persistence.getRemoteDocumentCache().newChangeBuffer();return ST.forEach(this.vs,function(t){var e=Kb.fromPath(t);return r.Ps(n,e).next(function(t){t||i.removeEntry(e)})}).next(function(){return r.Rs=null,i.apply(n)})},XS.prototype.updateLimboDocument=function(t,e){var n=this;return this.Ps(t,e).next(function(t){t?n.vs.delete(e.toString()):n.vs.add(e.toString())})},XS.prototype.ps=function(t){return 0},XS.prototype.Ps=function(t,e){var n=this;return ST.or([function(){return ST.resolve(n.As.containsKey(e))},function(){return n.persistence.getTargetCache().containsKey(t,e)},function(){return n.persistence.Is(t,e)}])},XS),QS=(YS.prototype.isAuthenticated=function(){return null!=this.uid},YS.prototype.toKey=function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"},YS.prototype.isEqual=function(t){return t.uid===this.uid},YS);function YS(t){this.uid=t}function XS(t){this.persistence=t,this.As=new jS,this.Rs=null}function JS(t){var e=this;return(e=MS.call(this)||this).currentSequenceNumber=t,e}function $S(t,e){var n=this;this.gs={},this.Ne=new Xm(0),this.xe=!1,this.xe=!0,this.referenceDelegate=t(this),this.qe=new WS(this),this.Ut=new pE,this.Ue=(t=this.Ut,new BS(t,function(t){return n.referenceDelegate.ps(t)})),this.R=new YT(e),this.Qe=new US(this.R)}function ZS(t){this.persistence=t,this.ds=new XE(c_,h_),this.lastRemoteSnapshotVersion=gb.min(),this.highestTargetId=0,this.ws=0,this._s=new jS,this.targetCount=0,this.ys=OE.Jt()}function tC(t){var e=this;return(e=FS.call(this)||this).Ie=t,e}function eC(t,e){this.Ut=t,this.ls=e,this.docs=new Jw(Kb.comparator),this.size=0}function nC(t,e){this.Ut=t,this.referenceDelegate=e,this._n=[],this.ss=1,this.rs=new iI(qS.Gn)}function rC(t,e){this.key=t,this.ns=e}function iC(){this.Wn=new iI(qS.Gn),this.zn=new iI(qS.Hn)}function oC(t){this.R=t,this.Kn=new Map,this.jn=new Map}function aC(t,e){return"firestore_clients_"+t+"_"+e}function sC(t,e,n){n="firestore_mutations_"+t+"_"+n;return e.isAuthenticated()&&(n+="_"+e.uid),n}function uC(t,e){return"firestore_targets_"+t+"_"+e}QS.UNAUTHENTICATED=new QS(null),QS.GOOGLE_CREDENTIALS=new QS("google-credentials-uid"),QS.FIRST_PARTY=new QS("first-party-uid");var cC,hC=(DC.Vs=function(t,e,n){var r,i=JSON.parse(n),o="object"==typeof i&&-1!==["pending","acknowledged","rejected"].indexOf(i.state)&&(void 0===i.error||"object"==typeof i.error);return o&&i.error&&(o="string"==typeof i.error.message&&"string"==typeof i.error.code)&&(r=new tb(i.error.code,i.error.message)),o?new DC(t,e,i.state,r):(ob("SharedClientState","Failed to parse mutation state for ID '"+e+"': "+n),null)},DC.prototype.Ss=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)},DC),lC=(PC.Vs=function(t,e){var n,r=JSON.parse(e),i="object"==typeof r&&-1!==["not-current","current","rejected"].indexOf(r.state)&&(void 0===r.error||"object"==typeof r.error);return i&&r.error&&(i="string"==typeof r.error.message&&"string"==typeof r.error.code)&&(n=new tb(r.error.code,r.error.message)),i?new PC(t,r.state,n):(ob("SharedClientState","Failed to parse target state for ID '"+t+"': "+e),null)},PC.prototype.Ss=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)},PC),fC=(OC.Vs=function(t,e){for(var n=JSON.parse(e),r="object"==typeof n&&n.activeTargetIds instanceof Array,i=pI,o=0;r&&o<n.activeTargetIds.length;++o)r=Bb(n.activeTargetIds[o]),i=i.add(n.activeTargetIds[o]);return r?new OC(t,i):(ob("SharedClientState","Failed to parse client data for instance '"+t+"': "+e),null)},OC),pC=(RC.Vs=function(t){var e=JSON.parse(t);return"object"==typeof e&&-1!==["Unknown","Online","Offline"].indexOf(e.onlineState)&&"string"==typeof e.clientId?new RC(e.clientId,e.onlineState):(ob("SharedClientState","Failed to parse online state: "+t),null)},RC),dC=(AC.prototype.Ds=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},AC.prototype.Cs=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},AC.prototype.Ss=function(){var t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)},AC),vC=(NC.yt=function(t){return!(!t||!t.localStorage)},NC.prototype.start=function(){return $i(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,h,l=this;return Zi(this,function(t){switch(t.label){case 0:return[4,this.syncEngine.fn()];case 1:for(a=t.sent(),e=0,n=a;e<n.length;e++)(r=n[e])!==this.Ns&&(i=this.getItem(aC(this.persistenceKey,r)))&&(o=fC.Vs(r,i))&&(this.ks=this.ks.insert(o.clientId,o));for(this.Ks(),(a=this.storage.getItem(this.Us))&&(s=this.js(a))&&this.Ws(s),u=0,c=this.Os;u<c.length;u++)h=c[u],this.Fs(h);return this.Os=[],this.window.addEventListener("unload",function(){return l.shutdown()}),this.started=!0,[2]}})})},NC.prototype.writeSequenceNumber=function(t){this.setItem(this.Ms,JSON.stringify(t))},NC.prototype.getAllActiveQueryTargets=function(){return this.Gs(this.ks)},NC.prototype.isActiveQueryTarget=function(n){var r=!1;return this.ks.forEach(function(t,e){e.activeTargetIds.has(n)&&(r=!0)}),r},NC.prototype.addPendingMutation=function(t){this.zs(t,"pending")},NC.prototype.updateMutationState=function(t,e,n){this.zs(t,e,n),this.Hs(t)},NC.prototype.addLocalQueryTarget=function(t){var e,n="not-current";return this.isActiveQueryTarget(t)&&(!(e=this.storage.getItem(uC(this.persistenceKey,t)))||(e=lC.Vs(t,e))&&(n=e.state)),this.Js.Ds(t),this.Ks(),n},NC.prototype.removeLocalQueryTarget=function(t){this.Js.Cs(t),this.Ks()},NC.prototype.isLocalQueryTarget=function(t){return this.Js.activeTargetIds.has(t)},NC.prototype.clearQueryState=function(t){this.removeItem(uC(this.persistenceKey,t))},NC.prototype.updateQueryState=function(t,e,n){this.Ys(t,e,n)},NC.prototype.handleUserChange=function(t,e,n){var r=this;e.forEach(function(t){r.Hs(t)}),this.currentUser=t,n.forEach(function(t){r.addPendingMutation(t)})},NC.prototype.setOnlineState=function(t){this.Xs(t)},NC.prototype.notifyBundleLoaded=function(){this.Zs()},NC.prototype.shutdown=function(){this.started&&(this.window.removeEventListener("storage",this.xs),this.removeItem(this.$s),this.started=!1)},NC.prototype.getItem=function(t){var e=this.storage.getItem(t);return ib("SharedClientState","READ",t,e),e},NC.prototype.setItem=function(t,e){ib("SharedClientState","SET",t,e),this.storage.setItem(t,e)},NC.prototype.removeItem=function(t){ib("SharedClientState","REMOVE",t),this.storage.removeItem(t)},NC.prototype.Fs=function(t){var e=this,o=t;o.storageArea===this.storage&&(ib("SharedClientState","EVENT",o.key,o.newValue),o.key!==this.$s?this.Se.enqueueRetryable(function(){return $i(e,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){if(this.started){if(null!==o.key)if(this.Ls.test(o.key)){if(null==o.newValue)return e=this.ti(o.key),[2,this.ei(e,null)];if(e=this.ni(o.key,o.newValue))return[2,this.ei(e.clientId,e)]}else if(this.Bs.test(o.key)){if(null!==o.newValue&&(n=this.si(o.key,o.newValue)))return[2,this.ii(n)]}else if(this.qs.test(o.key)){if(null!==o.newValue&&(r=this.ri(o.key,o.newValue)))return[2,this.oi(r)]}else if(o.key===this.Us){if(null!==o.newValue&&(i=this.js(o.newValue)))return[2,this.Ws(i)]}else if(o.key===this.Ms)(i=function(t){var e=Xm.o;if(null!=t)try{var n=JSON.parse(t);cb("number"==typeof n),e=n}catch(t){ob("SharedClientState","Failed to read sequence number from WebStorage",t)}return e}(o.newValue))!==Xm.o&&this.sequenceNumberHandler(i);else if(o.key===this.Qs)return[2,this.syncEngine.ci()]}else this.Os.push(o);return[2]})})}):ob("Received WebStorage notification for local change. Another client might have garbage-collected our state"))},Object.defineProperty(NC.prototype,"Js",{get:function(){return this.ks.get(this.Ns)},enumerable:!1,configurable:!0}),NC.prototype.Ks=function(){this.setItem(this.$s,this.Js.Ss())},NC.prototype.zs=function(t,e,n){n=new hC(this.currentUser,t,e,n),t=sC(this.persistenceKey,this.currentUser,t);this.setItem(t,n.Ss())},NC.prototype.Hs=function(t){t=sC(this.persistenceKey,this.currentUser,t);this.removeItem(t)},NC.prototype.Xs=function(t){t={clientId:this.Ns,onlineState:t};this.storage.setItem(this.Us,JSON.stringify(t))},NC.prototype.Ys=function(t,e,n){var r=uC(this.persistenceKey,t),n=new lC(t,e,n);this.setItem(r,n.Ss())},NC.prototype.Zs=function(){this.setItem(this.Qs,"value-not-used")},NC.prototype.ti=function(t){t=this.Ls.exec(t);return t?t[1]:null},NC.prototype.ni=function(t,e){t=this.ti(t);return fC.Vs(t,e)},NC.prototype.si=function(t,e){var n=this.Bs.exec(t),t=Number(n[1]),n=void 0!==n[2]?n[2]:null;return hC.Vs(new QS(n),t,e)},NC.prototype.ri=function(t,e){t=this.qs.exec(t),t=Number(t[1]);return lC.Vs(t,e)},NC.prototype.js=function(t){return pC.Vs(t)},NC.prototype.ii=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return e.user.uid===this.currentUser.uid?[2,this.syncEngine.ui(e.batchId,e.state,e.error)]:(ib("SharedClientState","Ignoring mutation for non-active user "+e.user.uid),[2])})})},NC.prototype.oi=function(t){return this.syncEngine.ai(t.targetId,t.state,t.error)},NC.prototype.ei=function(t,e){var n=this,r=e?this.ks.insert(t,e):this.ks.remove(t),i=this.Gs(this.ks),o=this.Gs(r),a=[],s=[];return o.forEach(function(t){i.has(t)||a.push(t)}),i.forEach(function(t){o.has(t)||s.push(t)}),this.syncEngine.hi(a,s).then(function(){n.ks=r})},NC.prototype.Ws=function(t){this.ks.get(t.clientId)&&this.onlineStateHandler(t.onlineState)},NC.prototype.Gs=function(t){var n=pI;return t.forEach(function(t,e){n=n.unionWith(e.activeTargetIds)}),n},NC),gC=(kC.prototype.addPendingMutation=function(t){},kC.prototype.updateMutationState=function(t,e,n){},kC.prototype.addLocalQueryTarget=function(t){return this.li.Ds(t),this.fi[t]||"not-current"},kC.prototype.updateQueryState=function(t,e,n){this.fi[t]=e},kC.prototype.removeLocalQueryTarget=function(t){this.li.Cs(t)},kC.prototype.isLocalQueryTarget=function(t){return this.li.activeTargetIds.has(t)},kC.prototype.clearQueryState=function(t){delete this.fi[t]},kC.prototype.getAllActiveQueryTargets=function(){return this.li.activeTargetIds},kC.prototype.isActiveQueryTarget=function(t){return this.li.activeTargetIds.has(t)},kC.prototype.start=function(){return this.li=new dC,Promise.resolve()},kC.prototype.handleUserChange=function(t,e,n){},kC.prototype.setOnlineState=function(t){},kC.prototype.shutdown=function(){},kC.prototype.writeSequenceNumber=function(t){},kC.prototype.notifyBundleLoaded=function(){},kC),yC=(CC.prototype.di=function(t){},CC.prototype.shutdown=function(){},CC),mC=(SC.prototype.di=function(t){this.gi.push(t)},SC.prototype.shutdown=function(){window.removeEventListener("online",this.wi),window.removeEventListener("offline",this.mi)},SC.prototype.pi=function(){window.addEventListener("online",this.wi),window.addEventListener("offline",this.mi)},SC.prototype._i=function(){ib("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.gi;t<e.length;t++)(0,e[t])(0)},SC.prototype.yi=function(){ib("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.gi;t<e.length;t++)(0,e[t])(1)},SC.yt=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},SC),bC={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"},_C=(EC.prototype.Ii=function(t){this.Ai=t},EC.prototype.Ri=function(t){this.bi=t},EC.prototype.onMessage=function(t){this.vi=t},EC.prototype.close=function(){this.Ti()},EC.prototype.send=function(t){this.Ei(t)},EC.prototype.Pi=function(){this.Ai()},EC.prototype.Vi=function(t){this.bi(t)},EC.prototype.Si=function(t){this.vi(t)},EC),wC=(TC.prototype.Ni=function(e,t,n,r){var i=this.xi(e,t);ib("RestConnection","Sending: ",i,n);t={};return this.Fi(t,r),this.ki(e,i,t,n).then(function(t){return ib("RestConnection","Received: ",t),t},function(t){throw ab("RestConnection",e+" failed with error: ",t,"url: ",i,"request:",n),t})},TC.prototype.Oi=function(t,e,n,r){return this.Ni(t,e,n,r)},TC.prototype.Fi=function(t,e){if(t["X-Goog-Api-Client"]="gl-js/ fire/8.4.2",t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e)for(var n in e.authHeaders)e.authHeaders.hasOwnProperty(n)&&(t[n]=e.authHeaders[n])},TC.prototype.xi=function(t,e){t=bC[t];return this.Di+"/v1/"+e+":"+t},Xi(IC,cC=TC),IC.prototype.ki=function(o,e,a,s){return new Promise(function(n,r){var i=new Ym;i.listenOnce(Wm.COMPLETE,function(){try{switch(i.getLastErrorCode()){case Km.NO_ERROR:var t=i.getResponseJson();ib("Connection","XHR received:",JSON.stringify(t)),n(t);break;case Km.TIMEOUT:ib("Connection",'RPC "'+o+'" timed out'),r(new tb(Zm.DEADLINE_EXCEEDED,"Request time out"));break;case Km.HTTP_ERROR:var e=i.getStatus();ib("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(/_/g,"-"),e=0<=Object.values(Zm).indexOf(e)?e:Zm.UNKNOWN,r(new tb(e,t.message))):r(new tb(Zm.UNKNOWN,"Server responded with status "+i.getStatus())):r(new tb(Zm.UNAVAILABLE,"Connection failed."));break;default:ub()}}finally{ib("Connection",'RPC "'+o+'" completed.')}});var t=JSON.stringify(s);i.send(e,"POST",t,a,15)})},IC.prototype.$i=function(t,e){var n=[this.Di,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=new Fm,i=Bm(),t={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.Fi(t.initMessageHeaders,e),vo()||yo()||0<=po().indexOf("Electron/")||(0<=(e=po()).indexOf("MSIE ")||0<=e.indexOf("Trident/"))||0<=po().indexOf("MSAppHost/")||go()||(t.httpHeadersOverwriteParam="$httpHeaders");n=n.join("");ib("Connection","Creating WebChannel: "+n,t);var o=r.createWebChannel(n,t),a=!1,s=!1,u=new _C({Ei:function(t){s?ib("Connection","Not sending because WebChannel is closed:",t):(a||(ib("Connection","Opening WebChannel transport."),o.open(),a=!0),ib("Connection","WebChannel sending:",t),o.send(t))},Ti:function(){return o.close()}}),t=function(t,e,n){t.listen(e,function(t){try{n(t)}catch(t){setTimeout(function(){throw t},0)}})};return t(o,Qm.EventType.OPEN,function(){s||ib("Connection","WebChannel transport opened.")}),t(o,Qm.EventType.CLOSE,function(){s||(s=!0,ib("Connection","WebChannel transport closed"),u.Vi())}),t(o,Qm.EventType.ERROR,function(t){s||(s=!0,ab("Connection","WebChannel transport errored:",t),u.Vi(new tb(Zm.UNAVAILABLE,"The operation could not be completed")))}),t(o,Qm.EventType.MESSAGE,function(t){var e,n,r,i;s||(cb(!!(e=t.data[0])),(n=e.error||(null===(i=e[0])||void 0===i?void 0:i.error))?(ib("Connection","WebChannel received error:",n),r=n.status,t=function(){var t=Bw[r];if(void 0!==t)return Xw(t)}(),i=n.message,void 0===t&&(t=Zm.INTERNAL,i="Unknown error status: "+r+" with message "+n.message),s=!0,u.Vi(new tb(t,i)),o.close()):(ib("Connection","WebChannel received:",e),u.Si(e)))}),t(i,Hm.STAT_EVENT,function(t){t.stat===Gm?ib("Connection","Detected buffering proxy"):t.stat===zm&&ib("Connection","Detected no buffering proxy")}),setTimeout(function(){u.Pi()},0),u},IC);function IC(t){var e=this;return(e=cC.call(this,t)||this).forceLongPolling=t.forceLongPolling,e.autoDetectLongPolling=t.autoDetectLongPolling,e}function TC(t){this.databaseInfo=t,this.databaseId=t.databaseId;var e=t.ssl?"https":"http";this.Di=e+"://"+t.host,this.Ci="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}function EC(t){this.Ei=t.Ei,this.Ti=t.Ti}function SC(){var t=this;this.wi=function(){return t._i()},this.mi=function(){return t.yi()},this.gi=[],this.pi()}function CC(){}function kC(){this.li=new dC,this.fi={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}function NC(t,e,n,r,i){this.window=t,this.Se=e,this.persistenceKey=n,this.Ns=r,this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null,this.xs=this.Fs.bind(this),this.ks=new Jw(fb),this.started=!1,this.Os=[];n=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=i,this.$s=aC(this.persistenceKey,this.Ns),this.Ms="firestore_sequence_number_"+this.persistenceKey,this.ks=this.ks.insert(this.Ns,new dC),this.Ls=new RegExp("^firestore_clients_"+n+"_([^_]*)$"),this.Bs=new RegExp("^firestore_mutations_"+n+"_(\\d+)(?:_(.*))?$"),this.qs=new RegExp("^firestore_targets_"+n+"_(\\d+)$"),this.Us="firestore_online_state_"+this.persistenceKey,this.Qs="firestore_bundle_loaded_"+this.persistenceKey,this.window.addEventListener("storage",this.xs)}function AC(){this.activeTargetIds=pI}function RC(t,e){this.clientId=t,this.onlineState=e}function OC(t,e){this.clientId=t,this.activeTargetIds=e}function PC(t,e,n){this.targetId=t,this.state=e,this.error=n}function DC(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}function xC(){return"undefined"!=typeof window?window:null}function LC(){return"undefined"!=typeof document?document:null}function MC(t){return new AI(t,!0)}function FC(t,e,n,r,i){var o=this;this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.kr=[],this.Or=new Map,this.$r=new Set,this.Mr=[],this.Lr=i,this.Lr.di(function(t){n.enqueueAndForget(function(){return $i(o,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return ak(this)?(ib("RemoteStore","Restarting streams for network reachability change."),[4,function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return(e=n).$r.add(4),[4,ZC(e)];case 1:return t.sent(),e.Br.set("Unknown"),e.$r.delete(4),[4,$C(e)];case 2:return t.sent(),[2]}})})}(this)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}),this.Br=new HC(n,r)}var UC,jC,qC,VC=(JC.prototype.reset=function(){this.qi=0},JC.prototype.Ki=function(){this.qi=this.Bi},JC.prototype.ji=function(t){var e=this;this.cancel();var n=Math.floor(this.qi+this.Wi()),r=Math.max(0,Date.now()-this.Qi),i=Math.max(0,n-r);0<i&&ib("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.qi+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.Ui=this.Se.enqueueAfterDelay(this.timerId,i,function(){return e.Qi=Date.now(),t()}),this.qi*=this.Li,this.qi<this.Mi&&(this.qi=this.Mi),this.qi>this.Bi&&(this.qi=this.Bi)},JC.prototype.Gi=function(){null!==this.Ui&&(this.Ui.skipDelay(),this.Ui=null)},JC.prototype.cancel=function(){null!==this.Ui&&(this.Ui.cancel(),this.Ui=null)},JC.prototype.Wi=function(){return(Math.random()-.5)*this.qi},JC),G=(XC.prototype.tr=function(){return 1===this.state||2===this.state||4===this.state},XC.prototype.er=function(){return 2===this.state},XC.prototype.start=function(){3!==this.state?this.auth():this.nr()},XC.prototype.stop=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.tr()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},XC.prototype.sr=function(){this.state=0,this.Zi.reset()},XC.prototype.ir=function(){var t=this;this.er()&&null===this.Xi&&(this.Xi=this.Se.enqueueAfterDelay(this.zi,6e4,function(){return t.rr()}))},XC.prototype.cr=function(t){this.ur(),this.stream.send(t)},XC.prototype.rr=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return this.er()?[2,this.close(0)]:[2]})})},XC.prototype.ur=function(){this.Xi&&(this.Xi.cancel(),this.Xi=null)},XC.prototype.close=function(e,n){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.ur(),this.Zi.cancel(),this.Yi++,3!==e?this.Zi.reset():n&&n.code===Zm.RESOURCE_EXHAUSTED?(ob(n.toString()),ob("Using maximum backoff delay to prevent overloading the backend."),this.Zi.Ki()):n&&n.code===Zm.UNAUTHENTICATED&&this.Ji.invalidateToken(),null!==this.stream&&(this.ar(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.Ri(n)];case 1:return t.sent(),[2]}})})},XC.prototype.ar=function(){},XC.prototype.auth=function(){var n=this;this.state=1;var t=this.hr(this.Yi),e=this.Yi;this.Ji.getToken().then(function(t){n.Yi===e&&n.lr(t)},function(e){t(function(){var t=new tb(Zm.UNKNOWN,"Fetching auth token failed: "+e.message);return n.dr(t)})})},XC.prototype.lr=function(t){var e=this,n=this.hr(this.Yi);this.stream=this.wr(t),this.stream.Ii(function(){n(function(){return e.state=2,e.listener.Ii()})}),this.stream.Ri(function(t){n(function(){return e.dr(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},XC.prototype.nr=function(){var t=this;this.state=4,this.Zi.ji(function(){return $i(t,void 0,void 0,function(){return Zi(this,function(t){return this.state=0,this.start(),[2]})})})},XC.prototype.dr=function(t){return ib("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},XC.prototype.hr=function(e){var n=this;return function(t){n.Se.enqueueAndForget(function(){return n.Yi===e?t():(ib("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},XC),BC=(Xi(YC,qC=G),YC.prototype.wr=function(t){return this.Hi.$i("Listen",t)},YC.prototype.onMessage=function(t){this.Zi.reset();var e=function(t,e){if("targetChange"in e){e.targetChange;var n="NO_CHANGE"===(o=e.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===o?1:"REMOVE"===o?2:"CURRENT"===o?3:"RESET"===o?4:ub(),r=e.targetChange.targetIds||[],i=(a=e.targetChange.resumeToken,t.I?(cb(void 0===a||"string"==typeof a),Nb.fromBase64String(a||"")):(cb(void 0===a||a instanceof Uint8Array),Nb.fromUint8Array(a||new Uint8Array))),o=(s=e.targetChange.cause)&&(u=void 0===(c=s).code?Zm.UNKNOWN:Xw(c.code),new tb(u,c.message||"")),a=new mI(n,r,i,o||null)}else if("documentChange"in e){e.documentChange,(n=e.documentChange).document,n.document.name,n.document.updateTime;var r=MI(t,n.document.name),i=PI(n.document.updateTime),s=new r_({mapValue:{fields:n.document.fields}}),u=(o=o_.newFoundDocument(r,i,s),n.targetIds||[]),c=n.removedTargetIds||[];a=new gI(u,c,o.key,o)}else if("documentDelete"in e)e.documentDelete,(n=e.documentDelete).document,r=MI(t,n.document),i=n.readTime?PI(n.readTime):gb.min(),s=o_.newNoDocument(r,i),o=n.removedTargetIds||[],a=new gI([],o,s.key,s);else if("documentRemove"in e)e.documentRemove,(n=e.documentRemove).document,r=MI(t,n.document),i=n.removedTargetIds||[],a=new gI([],i,r,null);else{if(!("filter"in e))return ub();e.filter;e=e.filter;e.targetId,n=e.count||0,r=new Vw(n),i=e.targetId,a=new yI(i,r)}return a}(this.R,t),t=function(t){if(!("targetChange"in t))return gb.min();t=t.targetChange;return(!t.targetIds||!t.targetIds.length)&&t.readTime?PI(t.readTime):gb.min()}(t);return this.listener._r(e,t)},YC.prototype.mr=function(t){var e,n,r,i={};i.database=jI(this.R),i.addTarget=(e=this.R,(r=l_(r=(n=t).target)?{documents:HI(e,r)}:{query:GI(e,r)}).targetId=n.targetId,0<n.resumeToken.approximateByteSize()?r.resumeToken=OI(e,n.resumeToken):0<n.snapshotVersion.compareTo(gb.min())&&(r.readTime=RI(e,n.snapshotVersion.toTimestamp())),r);var o,t=(this.R,o=t,null==(t=function(){switch(o.purpose){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return ub()}}())?null:{"goog-listen-tags":t});t&&(i.labels=t),this.cr(i)},YC.prototype.yr=function(t){var e={};e.database=jI(this.R),e.removeTarget=t,this.cr(e)},YC),KC=(Xi(QC,jC=G),Object.defineProperty(QC.prototype,"pr",{get:function(){return this.gr},enumerable:!1,configurable:!0}),QC.prototype.start=function(){this.gr=!1,this.lastStreamToken=void 0,jC.prototype.start.call(this)},QC.prototype.ar=function(){this.gr&&this.Er([])},QC.prototype.wr=function(t){return this.Hi.$i("Write",t)},QC.prototype.onMessage=function(t){if(cb(!!t.streamToken),this.lastStreamToken=t.streamToken,this.gr){this.Zi.reset();var e=(n=t.writeResults,r=t.commitTime,n&&0<n.length?(cb(void 0!==r),n.map(function(t){return n=r,(t=(e=t).updateTime?PI(e.updateTime):PI(n)).isEqual(gb.min())&&(t=PI(n)),new Ew(t,e.transformResults||[]);var e,n})):[]),n=PI(t.commitTime);return this.listener.Tr(n,e)}var n,r;return cb(!t.writeResults||0===t.writeResults.length),this.gr=!0,this.listener.Ir()},QC.prototype.Ar=function(){var t={};t.database=jI(this.R),this.cr(t)},QC.prototype.Er=function(t){var e=this,t={streamToken:this.lastStreamToken,writes:t.map(function(t){return KI(e.R,t)})};this.cr(t)},QC),WC=(Xi(zC,UC=function(){}),zC.prototype.br=function(){if(this.Rr)throw new tb(Zm.FAILED_PRECONDITION,"The client has already been terminated.")},zC.prototype.Ni=function(e,n,r){var i=this;return this.br(),this.credentials.getToken().then(function(t){return i.Hi.Ni(e,n,r,t)}).catch(function(t){throw"FirebaseError"===t.name?(t.code===Zm.UNAUTHENTICATED&&i.credentials.invalidateToken(),t):new tb(Zm.UNKNOWN,t.toString())})},zC.prototype.Oi=function(e,n,r){var i=this;return this.br(),this.credentials.getToken().then(function(t){return i.Hi.Oi(e,n,r,t)}).catch(function(t){throw"FirebaseError"===t.name?(t.code===Zm.UNAUTHENTICATED&&i.credentials.invalidateToken(),t):new tb(Zm.UNKNOWN,t.toString())})},zC.prototype.terminate=function(){this.Rr=!0},zC),HC=(GC.prototype.Sr=function(){var t=this;0===this.vr&&(this.Dr("Unknown"),this.Pr=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,function(){return t.Pr=null,t.Cr("Backend didn't respond within 10 seconds."),t.Dr("Offline"),Promise.resolve()}))},GC.prototype.Nr=function(t){"Online"===this.state?this.Dr("Unknown"):(this.vr++,1<=this.vr&&(this.Fr(),this.Cr("Connection failed 1 times. Most recent error: "+t.toString()),this.Dr("Offline")))},GC.prototype.set=function(t){this.Fr(),this.vr=0,"Online"===t&&(this.Vr=!1),this.Dr(t)},GC.prototype.Dr=function(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))},GC.prototype.Cr=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.Vr?(ob(t),this.Vr=!1):ib("OnlineStateTracker",t)},GC.prototype.Fr=function(){null!==this.Pr&&(this.Pr.cancel(),this.Pr=null)},GC);function GC(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.vr=0,this.Pr=null,this.Vr=!0}function zC(t,e,n){var r=this;return(r=UC.call(this)||this).credentials=t,r.Hi=e,r.R=n,r.Rr=!1,r}function QC(t,e,n,r,i){var o=this;return(o=jC.call(this,t,"write_stream_connection_backoff","write_stream_idle",e,n,i)||this).R=r,o.gr=!1,o}function YC(t,e,n,r,i){var o=this;return(o=qC.call(this,t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i)||this).R=r,o}function XC(t,e,n,r,i,o){this.Se=t,this.zi=n,this.Hi=r,this.Ji=i,this.listener=o,this.state=0,this.Yi=0,this.Xi=null,this.stream=null,this.Zi=new VC(t,e)}function JC(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.Se=t,this.timerId=e,this.Mi=n,this.Li=r,this.Bi=i,this.qi=0,this.Ui=null,this.Qi=Date.now(),this.reset()}function $C(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:if(!ak(r))return[3,4];e=0,n=r.Mr,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 ZC(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:e=0,n=r.Mr,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 tk(t,e){t.Or.has(e.targetId)||(t.Or.set(e.targetId,e),ok(t)?ik(t):vk(t).er()&&nk(t,e))}function ek(t,e){var n=t,t=vk(n);n.Or.delete(e),t.er()&&rk(n,e),0===n.Or.size&&(t.er()?t.ir():ak(n)&&n.Br.set("Unknown"))}function nk(t,e){t.qr.U(e.targetId),vk(t).mr(e)}function rk(t,e){t.qr.U(e),vk(t).yr(e)}function ik(e){e.qr=new _I({getRemoteKeysForTarget:function(t){return e.remoteSyncer.getRemoteKeysForTarget(t)},lt:function(t){return e.Or.get(t)||null}}),vk(e).start(),e.Br.Sr()}function ok(t){return ak(t)&&!vk(t).tr()&&0<t.Or.size}function ak(t){return 0===t.$r.size}function sk(t){t.qr=void 0}function uk(a,s,u){return $i(this,void 0,void 0,function(){var n,o;return Zi(this,function(t){switch(t.label){case 0:if(a.Br.set("Online"),!(s instanceof mI&&2===s.state&&s.cause))return[3,6];t.label=1;case 1:return t.trys.push([1,3,,5]),[4,function(o,a){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:e=a.cause,n=0,r=a.targetIds,t.label=1;case 1:return n<r.length?(i=r[n],o.Or.has(i)?[4,o.remoteSyncer.rejectListen(i,e)]:[3,3]):[3,5];case 2:t.sent(),o.Or.delete(i),o.qr.removeTarget(i),t.label=3;case 3:t.label=4;case 4:return n++,[3,1];case 5:return[2]}})})}(a,s)];case 2:return t.sent(),[3,5];case 3:return n=t.sent(),ib("RemoteStore","Failed to remove targets %s: %s ",s.targetIds.join(","),n),[4,ck(a,n)];case 4:return t.sent(),[3,5];case 5:return[3,13];case 6:if(s instanceof gI?a.qr.X(s):s instanceof yI?a.qr.rt(s):a.qr.et(s),u.isEqual(gb.min()))return[3,13];t.label=7;case 7:return t.trys.push([7,11,,13]),[4,kS(a.localStore)];case 8:return o=t.sent(),0<=u.compareTo(o)?[4,(i=u,(e=(r=a).qr.ut(i)).targetChanges.forEach(function(t,e){var n;0<t.resumeToken.approximateByteSize()&&((n=r.Or.get(e))&&r.Or.set(e,n.withResumeToken(t.resumeToken,i)))}),e.targetMismatches.forEach(function(t){var e=r.Or.get(t);e&&(r.Or.set(t,e.withResumeToken(Nb.EMPTY_BYTE_STRING,e.snapshotVersion)),rk(r,t),e=new QT(e.target,t,1,e.sequenceNumber),nk(r,e))}),r.remoteSyncer.applyRemoteEvent(e))]:[3,10];case 9:t.sent(),t.label=10;case 10:return[3,13];case 11:return ib("RemoteStore","Failed to raise snapshot:",o=t.sent()),[4,ck(a,o)];case 12:return t.sent(),[3,13];case 13:return[2]}var r,i,e})})}function ck(n,r,i){return $i(this,void 0,void 0,function(){var e=this;return Zi(this,function(t){switch(t.label){case 0:if(!MT(r))throw r;return n.$r.add(1),[4,ZC(n)];case 1:return t.sent(),n.Br.set("Offline"),i=i||function(){return kS(n.localStore)},n.asyncQueue.enqueueRetryable(function(){return $i(e,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return ib("RemoteStore","Retrying IndexedDB access"),[4,i()];case 1:return t.sent(),n.$r.delete(1),[4,$C(n)];case 2:return t.sent(),[2]}})})}),[2]}})})}function hk(e,n){return n().catch(function(t){return ck(e,t,n)})}function lk(u){return $i(this,void 0,void 0,function(){var i,o,a,s;return Zi(this,function(t){switch(t.label){case 0:o=gk(i=u),a=0<i.kr.length?i.kr[i.kr.length-1].batchId:-1,t.label=1;case 1:if(!(ak(i)&&i.kr.length<10))return[3,7];t.label=2;case 2:return t.trys.push([2,4,,6]),[4,(e=i.localStore,n=a,(r=e).persistence.runTransaction("Get next mutation batch","readonly",function(t){return void 0===n&&(n=-1),r._n.getNextMutationBatchAfterBatchId(t,n)}))];case 3:return null===(s=t.sent())?(0===i.kr.length&&o.ir(),[3,7]):(a=s.batchId,function(t,e){t.kr.push(e);t=gk(t);t.er()&&t.pr&&t.Er(e.mutations)}(i,s),[3,6]);case 4:return s=t.sent(),[4,ck(i,s)];case 5:return t.sent(),[3,6];case 6:return[3,1];case 7:return fk(i)&&pk(i),[2]}var e,n,r})})}function fk(t){return ak(t)&&!gk(t).tr()&&0<t.kr.length}function pk(t){gk(t).start()}function dk(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=n,r?(e.$r.delete(2),[4,$C(e)]):[3,2];case 1:return t.sent(),[3,5];case 2:return r?[3,4]:(e.$r.add(2),[4,ZC(e)]);case 3:t.sent(),e.Br.set("Unknown"),t.label=4;case 4:t.label=5;case 5:return[2]}})})}function vk(n){var t,e,r,i=this;return n.Ur||(n.Ur=(t=n.datastore,e=n.asyncQueue,r={Ii:function(n){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return n.Or.forEach(function(t,e){nk(n,t)}),[2]})})}.bind(null,n),Ri:function(e,n){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return sk(e),ok(e)?(e.Br.Nr(n),ik(e)):e.Br.set("Unknown"),[2]})})}.bind(null,n),_r:uk.bind(null,n)},t.br(),new BC(e,t.Hi,t.credentials,t.R,r)),n.Mr.push(function(e){return $i(i,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return e?(n.Ur.sr(),ok(n)?ik(n):n.Br.set("Unknown"),[3,3]):[3,1];case 1:return[4,n.Ur.stop()];case 2:t.sent(),sk(n),t.label=3;case 3:return[2]}})})})),n.Ur}function gk(n){var t,e,r,i=this;return n.Qr||(n.Qr=(t=n.datastore,e=n.asyncQueue,r={Ii:function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return gk(e).Ar(),[2]})})}.bind(null,n),Ri:function(e,n){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return n&&gk(e).pr?[4,function(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return Yw(n=i.code)&&n!==Zm.ABORTED?(e=r.kr.shift(),gk(r).sr(),[4,hk(r,function(){return r.remoteSyncer.rejectFailedWrite(e.batchId,i)})]):[3,3];case 1:return t.sent(),[4,lk(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 fk(e)&&pk(e),[2]}})})}.bind(null,n),Ir:function(o){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){for(e=gk(o),n=0,r=o.kr;n<r.length;n++)i=r[n],e.Er(i.mutations);return[2]})})}.bind(null,n),Tr:function(r,i,o){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return e=r.kr.shift(),n=zT.from(e,i,o),[4,hk(r,function(){return r.remoteSyncer.applySuccessfulWrite(n)})];case 1:return t.sent(),[4,lk(r)];case 2:return t.sent(),[2]}})})}.bind(null,n)},t.br(),new KC(e,t.Hi,t.credentials,t.R,r)),n.Mr.push(function(e){return $i(i,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return e?(n.Qr.sr(),[4,lk(n)]):[3,2];case 1:return t.sent(),[3,4];case 2:return[4,n.Qr.stop()];case 3:t.sent(),0<n.kr.length&&(ib("RemoteStore","Stopping write stream with "+n.kr.length+" pending writes"),n.kr=[]),t.label=4;case 4:return[2]}})})})),n.Qr}var yk=(mk.createAndSchedule=function(t,e,n,r,i){i=new mk(t,e,Date.now()+n,r,i);return i.start(n),i},mk.prototype.start=function(t){var e=this;this.timerHandle=setTimeout(function(){return e.handleDelayElapsed()},t)},mk.prototype.skipDelay=function(){return this.handleDelayElapsed()},mk.prototype.cancel=function(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new tb(Zm.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},mk.prototype.handleDelayElapsed=function(){var e=this;this.asyncQueue.enqueueAndForget(function(){return null!==e.timerHandle?(e.clearTimeout(),e.op().then(function(t){return e.deferred.resolve(t)})):Promise.resolve()})},mk.prototype.clearTimeout=function(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)},mk);function mk(t,e,n,r,i){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new ET,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(function(t){})}function bk(t,e){if(ob("AsyncQueue",e+": "+t),MT(t))return new tb(Zm.UNAVAILABLE,e+": "+t);throw t}function _k(){this.queries=new XE(tw,Z_),this.onlineState="Unknown",this.Gr=new Set}var wk=(kk.emptySet=function(t){return new kk(t.comparator)},kk.prototype.has=function(t){return null!=this.keyedMap.get(t)},kk.prototype.get=function(t){return this.keyedMap.get(t)},kk.prototype.first=function(){return this.sortedSet.minKey()},kk.prototype.last=function(){return this.sortedSet.maxKey()},kk.prototype.isEmpty=function(){return this.sortedSet.isEmpty()},kk.prototype.indexOf=function(t){t=this.keyedMap.get(t);return t?this.sortedSet.indexOf(t):-1},Object.defineProperty(kk.prototype,"size",{get:function(){return this.sortedSet.size},enumerable:!1,configurable:!0}),kk.prototype.forEach=function(n){this.sortedSet.inorderTraversal(function(t,e){return n(t),!1})},kk.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))},kk.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this},kk.prototype.isEqual=function(t){if(!(t instanceof kk))return!1;if(this.size!==t.size)return!1;for(var e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();e.hasNext();){var r=e.getNext().key,i=n.getNext().key;if(!r.isEqual(i))return!1}return!0},kk.prototype.toString=function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n  "+e.join("  \n")+"\n)"},kk.prototype.copy=function(t,e){var n=new kk;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n},kk),Ik=(Ck.prototype.track=function(t){var e=t.doc.key,n=this.Kr.get(e);!n||0!==t.type&&3===n.type?this.Kr=this.Kr.insert(e,t):3===t.type&&1!==n.type?this.Kr=this.Kr.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Kr=this.Kr.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Kr=this.Kr.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Kr=this.Kr.remove(e):1===t.type&&2===n.type?this.Kr=this.Kr.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Kr=this.Kr.insert(e,{type:2,doc:t.doc}):ub()},Ck.prototype.jr=function(){var n=[];return this.Kr.inorderTraversal(function(t,e){n.push(e)}),n},Ck),Tk=(Sk.fromInitialDocuments=function(t,e,n,r){var i=[];return e.forEach(function(t){i.push({type:0,doc:t})}),new Sk(t,e,wk.emptySet(e),i,n,r,!0,!1)},Object.defineProperty(Sk.prototype,"hasPendingWrites",{get:function(){return!this.mutatedKeys.isEmpty()},enumerable:!1,configurable:!0}),Sk.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&Z_(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))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},Sk),Ek=function(){this.Wr=void 0,this.listeners=[]};function Sk(t,e,n,r,i,o,a,s){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=s}function Ck(){this.Kr=new Jw(Kb.comparator)}function kk(n){this.comparator=n?function(t,e){return n(t,e)||Kb.comparator(t.key,e.key)}:function(t,e){return Kb.comparator(t.key,e.key)},this.keyedMap=cI,this.sortedSet=new Jw(this.comparator)}function Nk(a,s){return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:if(e=a,n=s.query,r=!1,(i=e.queries.get(n))||(r=!0,i=new Ek),!r)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),o=i,[4,e.onListen(n)];case 2:return o.Wr=t.sent(),[3,4];case 3:return o=t.sent(),o=bk(o,"Initialization of query '"+ew(s.query)+"' failed"),[2,void s.onError(o)];case 4:return e.queries.set(n,i),i.listeners.push(s),s.zr(e.onlineState),i.Wr&&s.Hr(i.Wr)&&Rk(e),[2]}})})}function Ak(a,s){return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){return e=a,n=s.query,r=!1,(i=e.queries.get(n))&&0<=(o=i.listeners.indexOf(s))&&(i.listeners.splice(o,1),r=0===i.listeners.length),r?[2,(e.queries.delete(n),e.onUnlisten(n))]:[2]})})}function Rk(t){t.Gr.forEach(function(t){t.next()})}var Ok=(Uk.prototype.Hr=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 Tk(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0)}var o=!1;return this.Yr?this.Zr(t)&&(this.Jr.next(t),o=!0):this.eo(t,this.onlineState)&&(this.no(t),o=!0),this.Xr=t,o},Uk.prototype.onError=function(t){this.Jr.error(t)},Uk.prototype.zr=function(t){this.onlineState=t;var e=!1;return this.Xr&&!this.Yr&&this.eo(this.Xr,t)&&(this.no(this.Xr),e=!0),e},Uk.prototype.eo=function(t,e){if(!t.fromCache)return!0;var n="Offline"!==e;return!(this.options.so&&n||t.docs.isEmpty()&&"Offline"!==e)},Uk.prototype.Zr=function(t){if(0<t.docChanges.length)return!0;var e=this.Xr&&this.Xr.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges},Uk.prototype.no=function(t){t=Tk.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache),this.Yr=!0,this.Jr.next(t)},Uk),Pk=(Fk.prototype.io=function(){return"metadata"in this.payload},Fk),Dk=(Mk.prototype.qn=function(t){return MI(this.R,t)},Mk.prototype.Un=function(t){return t.metadata.exists?BI(this.R,t.document,!1):o_.newNoDocument(this.qn(t.metadata.name),this.Qn(t.metadata.readTime))},Mk.prototype.Qn=PI,Mk),xk=(Lk.prototype.oo=function(t){this.progress.bytesLoaded+=t.byteLength;var e=this.progress.documentsLoaded;return t.payload.namedQuery?this.queries.push(t.payload.namedQuery):t.payload.documentMetadata?(this.documents.push({metadata:t.payload.documentMetadata}),t.payload.documentMetadata.exists||++e):t.payload.document&&(this.documents[this.documents.length-1].document=t.payload.document,++e),e!==this.progress.documentsLoaded?(this.progress.documentsLoaded=e,Object.assign({},this.progress)):null},Lk.prototype.co=function(t){for(var e=new Map,n=new Dk(this.R),r=0,i=t;r<i.length;r++){var o=i[r];if(o.metadata.queries)for(var a=n.qn(o.metadata.name),s=0,u=o.metadata.queries;s<u.length;s++){var c=u[s],h=(e.get(c)||fI()).add(a);e.set(c,h)}}return e},Lk.prototype.complete=function(){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return[4,function(l,f,p,d){return $i(this,void 0,void 0,function(){var n,r,i,o,e,a,s,u,c,h;return Zi(this,function(t){switch(t.label){case 0:for(n=l,r=fI(),i=aI,o=hI,e=0,a=p;e<a.length;e++)s=a[e],u=f.qn(s.metadata.name),s.document&&(r=r.add(u)),i=i.insert(u,f.Un(s)),o=o.insert(u,f.Qn(s.metadata.readTime));return c=n.$n.newChangeBuffer({trackRemovals:!0}),[4,RS(n,J_(W_(Eb.fromString("__bundle__/docs/"+d))))];case 1:return h=t.sent(),[2,n.persistence.runTransaction("Apply bundle documents","readwrite",function(e){return AS(e,c,i,gb.min(),o).next(function(t){return c.apply(e),t}).next(function(t){return n.qe.removeMatchingKeysForTargetId(e,h.targetId).next(function(){return n.qe.addMatchingKeys(e,r,h.targetId)}).next(function(){return n.Mn.En(e,t)}).next(function(){return t})})})]}})})}(this.localStore,new Dk(this.R),this.documents,this.ro.id)];case 1:e=t.sent(),n=this.co(this.documents),r=0,i=this.queries,t.label=2;case 2:return r<i.length?(i=i[r],[4,function(e,i,o){return void 0===o&&(o=fI()),$i(this,void 0,void 0,function(){var n,r;return Zi(this,function(t){switch(t.label){case 0:return[4,RS(e,J_(uE(i.bundledQuery)))];case 1:return n=t.sent(),[2,(r=e).persistence.runTransaction("Save named query","readwrite",function(t){var e=PI(i.readTime);if(0<=n.snapshotVersion.compareTo(e))return r.Qe.saveNamedQuery(t,i);e=n.withResumeToken(Nb.EMPTY_BYTE_STRING,e);return r.Fn=r.Fn.insert(e.targetId,e),r.qe.updateTargetData(t,e).next(function(){return r.qe.removeMatchingKeysForTargetId(t,n.targetId)}).next(function(){return r.qe.addMatchingKeys(t,o,n.targetId)}).next(function(){return r.Qe.saveNamedQuery(t,i)})})]}})})}(this.localStore,i,n.get(i.name))]):[3,5];case 3:t.sent(),t.label=4;case 4:return r++,[3,2];case 5:return[2,(this.progress.taskState="Success",new vS(Object.assign({},this.progress),e))]}})})},Lk);function Lk(t,e,n){this.ro=t,this.localStore=e,this.R=n,this.queries=[],this.documents=[],this.progress=jk(t)}function Mk(t){this.R=t}function Fk(t,e){this.payload=t,this.byteLength=e}function Uk(t,e,n){this.query=t,this.Jr=e,this.Yr=!1,this.Xr=null,this.onlineState="Unknown",this.options=n||{}}function jk(t){return{taskState:"Running",documentsLoaded:0,bytesLoaded:0,totalDocuments:t.totalDocuments,totalBytes:t.totalBytes}}var qk=function(t){this.key=t},Vk=function(t){this.key=t},Bk=(Object.defineProperty(zk.prototype,"wo",{get:function(){return this.uo},enumerable:!1,configurable:!0}),zk.prototype._o=function(t,e){var a=this,s=e?e.mo:new Ik,u=(e||this).fo,c=(e||this).mutatedKeys,h=u,l=!1,f=H_(this.query)&&u.size===this.query.limit?u.last():null,p=G_(this.query)&&u.size===this.query.limit?u.first():null;if(t.inorderTraversal(function(t,e){var n=u.get(t),r=nw(a.query,e)?e:null,i=!!n&&a.mutatedKeys.has(n.key),o=!!r&&(r.hasLocalMutations||a.mutatedKeys.has(r.key)&&r.hasCommittedMutations),e=!1;n&&r?n.data.isEqual(r.data)?i!==o&&(s.track({type:3,doc:r}),e=!0):a.yo(n,r)||(s.track({type:2,doc:r}),e=!0,(f&&0<a.lo(r,f)||p&&a.lo(r,p)<0)&&(l=!0)):!n&&r?(s.track({type:0,doc:r}),e=!0):n&&!r&&(s.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)))}),H_(this.query)||G_(this.query))for(;h.size>this.query.limit;){var n=H_(this.query)?h.last():h.first(),h=h.delete(n.key),c=c.delete(n.key);s.track({type:1,doc:n})}return{fo:h,mo:s,Nn:l,mutatedKeys:c}},zk.prototype.yo=function(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations},zk.prototype.applyChanges=function(t,e,n){var o=this,r=this.fo;this.fo=t.fo,this.mutatedKeys=t.mutatedKeys;var i=t.mo.jr();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.lo(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 ub()}}var r,i}),this.po(n);var a=e?this.Eo():[],n=0===this.ho.size&&this.current?1:0,e=n!==this.ao;return this.ao=n,0!==i.length||e?{snapshot:new Tk(this.query,t.fo,r,i,t.mutatedKeys,0==n,e,!1),To:a}:{To:a}},zk.prototype.zr=function(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({fo:this.fo,mo:new Ik,mutatedKeys:this.mutatedKeys,Nn:!1},!1)):{To:[]}},zk.prototype.Io=function(t){return!this.uo.has(t)&&!!this.fo.has(t)&&!this.fo.get(t).hasLocalMutations},zk.prototype.po=function(t){var e=this;t&&(t.addedDocuments.forEach(function(t){return e.uo=e.uo.add(t)}),t.modifiedDocuments.forEach(function(t){}),t.removedDocuments.forEach(function(t){return e.uo=e.uo.delete(t)}),this.current=t.current)},zk.prototype.Eo=function(){var e=this;if(!this.current)return[];var n=this.ho;this.ho=fI(),this.fo.forEach(function(t){e.Io(t.key)&&(e.ho=e.ho.add(t.key))});var r=[];return n.forEach(function(t){e.ho.has(t)||r.push(new Vk(t))}),this.ho.forEach(function(t){n.has(t)||r.push(new qk(t))}),r},zk.prototype.Ao=function(t){this.uo=t.Bn,this.ho=fI();t=this._o(t.documents);return this.applyChanges(t,!0)},zk.prototype.Ro=function(){return Tk.fromInitialDocuments(this.query,this.fo,this.mutatedKeys,0===this.ao)},zk),Kk=function(t,e,n){this.query=t,this.targetId=e,this.view=n},Wk=function(t){this.key=t,this.bo=!1},Hk=(Object.defineProperty(Gk.prototype,"isPrimaryClient",{get:function(){return!0===this.Oo},enumerable:!1,configurable:!0}),Gk);function Gk(t,e,n,r,i,o){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.vo={},this.Po=new XE(tw,Z_),this.Vo=new Map,this.So=new Set,this.Do=new Jw(Kb.comparator),this.Co=new Map,this.No=new jS,this.xo={},this.Fo=new Map,this.ko=OE.Yt(),this.onlineState="Unknown",this.Oo=void 0}function zk(t,e){this.query=t,this.uo=e,this.ao=null,this.current=!1,this.ho=fI(),this.mutatedKeys=fI(),this.lo=rw(t),this.fo=new wk(this.lo)}function Qk(i,o,a,s){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return i.$o=function(t,e,n){return function(r,i,o,a){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return(e=i.view._o(o)).Nn?[4,PS(r.localStore,i.query,!1).then(function(t){t=t.documents;return i.view._o(t,e)})]:[3,2];case 1:e=t.sent(),t.label=2;case 2:return n=a&&a.targetChanges.get(i.targetId),n=i.view.applyChanges(e,r.isPrimaryClient,n),[2,(iN(r,i.targetId,n.To),n.snapshot)]}})})}(i,t,e,n)},[4,PS(i.localStore,o,!0)];case 1:return n=t.sent(),r=new Bk(o,n.Bn),e=r._o(n.documents),n=vI.createSynthesizedTargetChangeForCurrentChange(a,s&&"Offline"!==i.onlineState),n=r.applyChanges(e,i.isPrimaryClient,n),iN(i,a,n.To),r=new Kk(o,a,r),[2,(i.Po.set(o,r),i.Vo.has(a)?i.Vo.get(a).push(o):i.Vo.set(a,[o]),n.snapshot)]}})})}function Yk(f,p,d){return $i(this,void 0,void 0,function(){var a,l;return Zi(this,function(t){switch(t.label){case 0:l=pN(f),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,(i=l.localStore,s=p,c=i,h=vb.now(),o=s.reduce(function(t,e){return t.add(e.key)},fI()),c.persistence.runTransaction("Locally write mutations","readwrite",function(a){return c.Mn.pn(a,o).next(function(t){u=t;for(var e=[],n=0,r=s;n<r.length;n++){var i=r[n],o=function(t,e){for(var n=null,r=0,i=t.fieldTransforms;r<i.length;r++){var o=i[r],a=e.data.field(o.field),a=sw(o.transform,a||null);null!=a&&(n=null==n?r_.empty():n).set(o.field,a)}return n||null}(i,u.get(i.key));null!=o&&e.push(new Lw(i.key,o,function a(t){var s=[];return _b(t.fields||{},function(t,e){var n=new Cb([t]);if(n_(e))if(0===(e=a(e.mapValue).fields).length)s.push(n);else for(var r=0,i=e;r<i.length;r++){var o=i[r];s.push(n.child(o))}else s.push(n)}),new kb(s)}(o.toProto().mapValue),Cw.exists(!0)))}return c._n.addMutationBatch(a,h,e,s)})}).then(function(t){return t.applyToLocalDocumentSet(u),{batchId:t.batchId,changes:u}}))];case 2:return a=t.sent(),l.sharedClientState.addPendingMutation(a.batchId),e=l,n=a.batchId,r=d,i=(i=(i=e.xo[e.currentUser.toKey()])||new Jw(fb)).insert(n,r),e.xo[e.currentUser.toKey()]=i,[4,aN(l,a.changes)];case 3:return t.sent(),[4,lk(l.remoteStore)];case 4:return t.sent(),[3,6];case 5:return l=t.sent(),l=bk(l,"Failed to persist write"),d.reject(l),[3,6];case 6:return[2]}var e,n,r,i,s,u,c,h,o})})}function Xk(r,i){return $i(this,void 0,void 0,function(){var n,e;return Zi(this,function(t){switch(t.label){case 0:n=r,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,NS(n.localStore,i)];case 2:return e=t.sent(),i.targetChanges.forEach(function(t,e){e=n.Co.get(e);e&&(cb(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),0<t.addedDocuments.size?e.bo=!0:0<t.modifiedDocuments.size?cb(e.bo):0<t.removedDocuments.size&&(cb(e.bo),e.bo=!1))}),[4,aN(n,e,i)];case 3:return t.sent(),[3,6];case 4:return[4,UE(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}function Jk(t,n,e){var r,t=t;(t.isPrimaryClient&&0===e||!t.isPrimaryClient&&1===e)&&(r=[],t.Po.forEach(function(t,e){e=e.view.zr(n);e.snapshot&&r.push(e.snapshot)}),function(t,i){t.onlineState=i;var o=!1;t.queries.forEach(function(t,e){for(var n=0,r=e.listeners;n<r.length;n++)r[n].zr(i)&&(o=!0)}),o&&Rk(t)}(t.eventManager,n),r.length&&t.vo._r(r),t.onlineState=n,t.isPrimaryClient&&t.sharedClientState.setOnlineState(n))}function $k(a,s,u){return $i(this,void 0,void 0,function(){var n,o;return Zi(this,function(t){switch(t.label){case 0:n=a,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,(e=n.localStore,r=s,(i=e).persistence.runTransaction("Reject batch","readwrite-primary",function(e){var n;return i._n.lookupMutationBatch(e,r).next(function(t){return cb(null!==t),n=t.keys(),i._n.removeMutationBatch(e,t)}).next(function(){return i._n.performConsistencyCheck(e)}).next(function(){return i.Mn.pn(e,n)})}))];case 2:return o=t.sent(),eN(n,s,u),tN(n,s),n.sharedClientState.updateMutationState(s,"rejected",u),[4,aN(n,o)];case 3:return t.sent(),[3,6];case 4:return[4,UE(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}var e,r,i})})}function Zk(o,a){return $i(this,void 0,void 0,function(){var n,r,i;return Zi(this,function(t){switch(t.label){case 0:ak((n=o).remoteStore)||ib("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.localStore).persistence.runTransaction("Get highest unacknowledged batch id","readonly",function(t){return e._n.getHighestUnacknowledgedBatchId(t)})];case 2:return-1===(r=t.sent())?[2,void a.resolve()]:((i=n.Fo.get(r)||[]).push(a),n.Fo.set(r,i),[3,4]);case 3:return i=t.sent(),i=bk(i,"Initialization of waitForPendingWrites() operation failed"),a.reject(i),[3,4];case 4:return[2]}var e})})}function tN(t,e){(t.Fo.get(e)||[]).forEach(function(t){t.resolve()}),t.Fo.delete(e)}function eN(t,e,n){var r=t,i=r.xo[r.currentUser.toKey()];i&&((t=i.get(e))&&(n?t.reject(n):t.resolve(),i=i.remove(e)),r.xo[r.currentUser.toKey()]=i)}function nN(e,t,n){void 0===n&&(n=null),e.sharedClientState.removeLocalQueryTarget(t);for(var r=0,i=e.Vo.get(t);r<i.length;r++){var o=i[r];e.Po.delete(o),n&&e.vo.Mo(o,n)}e.Vo.delete(t),e.isPrimaryClient&&e.No.Zn(t).forEach(function(t){e.No.containsKey(t)||rN(e,t)})}function rN(t,e){t.So.delete(e.path.canonicalString());var n=t.Do.get(e);null!==n&&(ek(t.remoteStore,n),t.Do=t.Do.remove(e),t.Co.delete(n),oN(t))}function iN(t,e,n){for(var r,i,o,a=0,s=n;a<s.length;a++){var u=s[a];u instanceof qk?(t.No.addReference(u.key,e),r=t,o=void 0,i=(o=(i=u).key).path.canonicalString(),r.Do.get(o)||r.So.has(i)||(ib("SyncEngine","New document in limbo: "+o),r.So.add(i),oN(r))):u instanceof Vk?(ib("SyncEngine","Document no longer in limbo: "+u.key),t.No.removeReference(u.key,e),t.No.containsKey(u.key)||rN(t,u.key)):ub()}}function oN(t){for(;0<t.So.size&&t.Do.size<t.maxConcurrentLimboResolutions;){var e=t.So.values().next().value;t.So.delete(e);var n=new Kb(Eb.fromString(e)),e=t.ko.next();t.Co.set(e,new Wk(n)),t.Do=t.Do.insert(n,e),tk(t.remoteStore,new QT(J_(W_(n.path)),e,2,Xm.o))}}function aN(e,a,s){return $i(this,void 0,void 0,function(){var n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return r=[],i=[],o=[],(n=e).Po.isEmpty()?[3,3]:(n.Po.forEach(function(t,e){o.push(n.$o(e,a,s).then(function(t){t&&(n.isPrimaryClient&&n.sharedClientState.updateQueryState(e.targetId,t.fromCache?"not-current":"current"),r.push(t),t=yS.Pn(e.targetId,t),i.push(t))}))}),[4,Promise.all(o)]);case 1:return t.sent(),n.vo._r(r),[4,function(u,c){return $i(this,void 0,void 0,function(){var r,e,n,i,o,a,s;return Zi(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 ST.forEach(c,function(e){return ST.forEach(e.bn,function(t){return r.persistence.referenceDelegate.addReference(n,e.targetId,t)}).next(function(){return ST.forEach(e.vn,function(t){return r.persistence.referenceDelegate.removeReference(n,e.targetId,t)})})})})];case 2:return t.sent(),[3,4];case 3:if(!MT(e=t.sent()))throw e;return ib("LocalStore","Failed to update sequence numbers: "+e),[3,4];case 4:for(n=0,i=c;n<i.length;n++)s=i[n],o=s.targetId,s.fromCache||(a=r.Fn.get(o),s=a.snapshotVersion,s=a.withLastLimboFreeSnapshotVersion(s),r.Fn=r.Fn.insert(o,s));return[2]}})})}(n.localStore,i)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}function sN(i,o){return $i(this,void 0,void 0,function(){var n,r;return Zi(this,function(t){switch(t.label){case 0:return(n=i).currentUser.isEqual(o)?[3,3]:(ib("SyncEngine","User change. New user:",o.toKey()),[4,SS(n.localStore,o)]);case 1:return r=t.sent(),n.currentUser=o,(e=n).Fo.forEach(function(t){t.forEach(function(t){t.reject(new tb(Zm.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.Fo.clear(),n.sharedClientState.handleUserChange(o,r.removedBatchIds,r.addedBatchIds),[4,aN(n,r.Ln)];case 2:t.sent(),t.label=3;case 3:return[2]}var e})})}function uN(s,u,c,h){return $i(this,void 0,void 0,function(){var o,a;return Zi(this,function(t){switch(t.label){case 0:return[4,(e=(o=s).localStore,n=u,i=(r=e)._n,r.persistence.runTransaction("Lookup mutation documents","readonly",function(e){return i.jt(e,n).next(function(t){return t?r.Mn.pn(e,t):ST.resolve(null)})}))];case 1:return null===(a=t.sent())?[3,6]:"pending"!==c?[3,3]:[4,lk(o.remoteStore)];case 2:return t.sent(),[3,4];case 3:"acknowledged"===c||"rejected"===c?(eN(o,u,h||null),tN(o,u),o.localStore._n.Gt(u)):ub(),t.label=4;case 4:return[4,aN(o,a)];case 5:return t.sent(),[3,7];case 6:ib("SyncEngine","Cannot apply mutation batch with id: "+u),t.label=7;case 7:return[2]}var e,n,r,i})})}function cN(h,l){return $i(this,void 0,void 0,function(){var r,e,i,o,a,s,u,c;return Zi(this,function(t){switch(t.label){case 0:return fN(r=h),pN(r),!0!==l||!0===r.Oo?[3,3]:(e=r.sharedClientState.getAllActiveQueryTargets(),[4,hN(r,e.toArray())]);case 1:return i=t.sent(),r.Oo=!0,[4,dk(r.remoteStore,!0)];case 2:for(t.sent(),o=0,a=i;o<a.length;o++)s=a[o],tk(r.remoteStore,s);return[3,7];case 3:return!1!==l||!1===r.Oo?[3,7]:(u=[],c=Promise.resolve(),r.Vo.forEach(function(t,e){r.sharedClientState.isLocalQueryTarget(e)?u.push(e):c=c.then(function(){return nN(r,e),OS(r.localStore,e,!0)}),ek(r.remoteStore,e)}),[4,c]);case 4:return t.sent(),[4,hN(r,u)];case 5:return t.sent(),(n=r).Co.forEach(function(t,e){ek(n.remoteStore,e)}),n.No.ts(),n.Co=new Map,n.Do=new Jw(Kb.comparator),r.Oo=!1,[4,dk(r.remoteStore,!1)];case 6:t.sent(),t.label=7;case 7:return[2]}var n})})}function hN(p,d){return $i(this,void 0,void 0,function(){var e,n,r,i,o,a,s,u,c,h,l,f;return Zi(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?(a=o[i],s=void 0,(u=e.Vo.get(a))&&0!==u.length?[4,RS(e.localStore,J_(u[0]))]:[3,7]):[3,13];case 2:s=t.sent(),c=0,h=u,t.label=3;case 3:return c<h.length?(l=h[c],l=e.Po.get(l),[4,function(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,PS((e=r).localStore,i.query,!0)];case 1:return n=t.sent(),n=i.view.Ao(n),[2,(e.isPrimaryClient&&iN(e,i.targetId,n.To),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,DS(e.localStore,a)];case 8:return f=t.sent(),[4,RS(e.localStore,f)];case 9:return s=t.sent(),[4,Qk(e,lN(f),a,!1)];case 10:t.sent(),t.label=11;case 11:n.push(s),t.label=12;case 12:return i++,[3,1];case 13:return[2,(e.vo._r(r),n)]}})})}function lN(t){return K_(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)}function fN(t){return t.remoteStore.remoteSyncer.applyRemoteEvent=Xk.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=function(t,e){var n=t;if((t=n.Co.get(e))&&t.bo)return fI().add(t.key);var r=fI();if(!(e=n.Vo.get(e)))return r;for(var i=0,o=e;i<o.length;i++)var a=o[i],a=n.Po.get(a),r=r.unionWith(a.view.wo);return r}.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=function(o,a,s){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return(e=o).sharedClientState.updateQueryState(a,"rejected",s),i=e.Co.get(a),(n=i&&i.key)?(r=(r=new Jw(Kb.comparator)).insert(n,o_.newNoDocument(n,gb.min())),i=fI().add(n),i=new dI(gb.min(),new Map,new iI(fb),r,i),[4,Xk(e,i)]):[3,2];case 1:return t.sent(),e.Do=e.Do.remove(n),e.Co.delete(a),oN(e),[3,4];case 2:return[4,OS(e.localStore,a,!1).then(function(){return nN(e,a,s)}).catch(UE)];case 3:t.sent(),t.label=4;case 4:return[2]}})})}.bind(null,t),t.vo._r=function(t,e){for(var n=t,r=!1,i=0,o=e;i<o.length;i++){var a=o[i],s=a.query,s=n.queries.get(s);if(s){for(var u=0,c=s.listeners;u<c.length;u++)c[u].Hr(a)&&(r=!0);s.Wr=a}}r&&Rk(n)}.bind(null,t.eventManager),t.vo.Mo=function(t,e,n){var r=t;if(t=r.queries.get(e))for(var i=0,o=t.listeners;i<o.length;i++)o[i].onError(n);r.queries.delete(e)}.bind(null,t.eventManager),t}function pN(t){return t.remoteStore.remoteSyncer.applySuccessfulWrite=function(i,o){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(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,CS(e.localStore,o)];case 2:return r=t.sent(),eN(e,n,null),tN(e,n),e.sharedClientState.updateMutationState(n,"acknowledged"),[4,aN(e,r)];case 3:return t.sent(),[3,6];case 4:return[4,UE(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=$k.bind(null,t),t}function dN(t,e,n){var r=t;!function(f,p,d){return $i(this,void 0,void 0,function(){var s,u,c,h,l;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,14,,15]),[4,p.getMetadata()];case 1:return s=t.sent(),[4,(r=f.localStore,o=r,a=PI((i=s).createTime),o.persistence.runTransaction("hasNewerBundle","readonly",function(t){return o.Qe.getBundleMetadata(t,i.id)}).then(function(t){return!!t&&0<=t.createTime.compareTo(a)}))];case 2:return t.sent()?[4,p.close()]:[3,4];case 3:return[2,(t.sent(),void d._completeWith({taskState:"Success",documentsLoaded:s.totalDocuments,bytesLoaded:s.totalBytes,totalDocuments:s.totalDocuments,totalBytes:s.totalBytes}))];case 4:return d._updateProgress(jk(s)),u=new xk(s,f.localStore,p.R),[4,p.Lo()];case 5:c=t.sent(),t.label=6;case 6:return c?[4,u.oo(c)]:[3,10];case 7:return(h=t.sent())&&d._updateProgress(h),[4,p.Lo()];case 8:c=t.sent(),t.label=9;case 9:return[3,6];case 10:return[4,u.complete()];case 11:return l=t.sent(),[4,aN(f,l.wn,void 0)];case 12:return t.sent(),[4,(r=f.localStore,e=s,(n=r).persistence.runTransaction("Save bundle","readwrite",function(t){return n.Qe.saveBundleMetadata(t,e)}))];case 13:return t.sent(),d._completeWith(l.progress),[3,15];case 14:return ab("SyncEngine","Loading bundle failed with "+(l=t.sent())),d._failWith(l),[3,15];case 15:return[2]}var e,n,r,i,o,a})})}(r,e,n).then(function(){r.sharedClientState.notifyBundleLoaded()})}var vN,gN,yN=(EN.prototype.initialize=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.R=MC(e.databaseInfo.databaseId),this.sharedClientState=this.Bo(e),this.persistence=this.qo(e),[4,this.persistence.start()];case 1:return t.sent(),this.gcScheduler=this.Uo(e),this.localStore=this.Qo(e),[2]}})})},EN.prototype.Uo=function(t){return null},EN.prototype.Qo=function(t){return ES(this.persistence,new mS,t.initialUser,this.R)},EN.prototype.qo=function(t){return new HS(zS.bs,this.R)},EN.prototype.Bo=function(t){return new gC},EN.prototype.terminate=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return this.gcScheduler&&this.gcScheduler.stop(),[4,this.sharedClientState.shutdown()];case 1:return t.sent(),[4,this.persistence.shutdown()];case 2:return t.sent(),[2]}})})},EN),mN=(Xi(TN,gN=yN),TN.prototype.initialize=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,gN.prototype.initialize.call(this,e)];case 1:return t.sent(),[4,LS(this.localStore)];case 2:return t.sent(),[4,this.Ko.initialize(this,e)];case 3:return t.sent(),[4,pN(this.Ko.syncEngine)];case 4:return t.sent(),[4,lk(this.Ko.remoteStore)];case 5:return t.sent(),[2]}})})},TN.prototype.Qo=function(t){return ES(this.persistence,new mS,t.initialUser,this.R)},TN.prototype.Uo=function(t){var e=this.persistence.referenceDelegate.garbageCollector;return new VE(e,t.asyncQueue)},TN.prototype.qo=function(t){var e=dS(t.databaseInfo.databaseId,t.databaseInfo.persistenceKey),n=void 0!==this.cacheSizeBytes?wE.withCacheSize(this.cacheSizeBytes):wE.DEFAULT;return new hS(this.synchronizeTabs,e,t.clientId,n,t.asyncQueue,xC(),LC(),this.R,this.sharedClientState,!!this.forceOwnership)},TN.prototype.Bo=function(t){return new gC},TN),bN=(Xi(IN,vN=mN),IN.prototype.initialize=function(r){return $i(this,void 0,void 0,function(){var e,n=this;return Zi(this,function(t){switch(t.label){case 0:return[4,vN.prototype.initialize.call(this,r)];case 1:return t.sent(),e=this.Ko.syncEngine,this.sharedClientState instanceof vC?(this.sharedClientState.syncEngine={ui:uN.bind(null,e),ai:function(i,o,a,s){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return(e=i).Oo?(ib("SyncEngine","Ignoring unexpected query state notification."),[3,8]):[3,1];case 1:if(!e.Vo.has(o))return[3,8];switch(a){case"current":case"not-current":return[3,2];case"rejected":return[3,5]}return[3,7];case 2:return[4,xS(e.localStore)];case 3:return n=t.sent(),r=dI.createSynthesizedRemoteEventForCurrentChange(o,"current"===a),[4,aN(e,n,r)];case 4:return t.sent(),[3,8];case 5:return[4,OS(e.localStore,o,!0)];case 6:return t.sent(),nN(e,o,s),[3,8];case 7:ub(),t.label=8;case 8:return[2]}})})}.bind(null,e),hi:function(c,h,l){return $i(this,void 0,void 0,function(){var n,e,r,i,o,a,s,u;return Zi(this,function(t){switch(t.label){case 0:if(!(n=fN(c)).Oo)return[3,10];e=0,r=h,t.label=1;case 1:return e<r.length?(r=r[e],n.Vo.has(r)?(ib("SyncEngine","Adding an already active target "+r),[3,5]):[4,DS(n.localStore,r)]):[3,6];case 2:return i=t.sent(),[4,RS(n.localStore,i)];case 3:return o=t.sent(),[4,Qk(n,lN(i),o.targetId,!1)];case 4:t.sent(),tk(n.remoteStore,o),t.label=5;case 5:return e++,[3,1];case 6:a=function(e){return Zi(this,function(t){switch(t.label){case 0:return n.Vo.has(e)?[4,OS(n.localStore,e,!1).then(function(){ek(n.remoteStore,e),nN(n,e)}).catch(UE)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})},s=0,u=l,t.label=7;case 7:return s<u.length?(u=u[s],[5,a(u)]):[3,10];case 8:t.sent(),t.label=9;case 9:return s++,[3,7];case 10:return[2]}})})}.bind(null,e),fn:function(t){return t.localStore.persistence.fn()}.bind(null,e),ci:function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){return[2,xS((e=n).localStore).then(function(t){return aN(e,t)})]})})}.bind(null,e)},[4,this.sharedClientState.start()]):[3,3];case 2:t.sent(),t.label=3;case 3:return[4,this.persistence.He(function(e){return $i(n,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,cN(this.Ko.syncEngine,e)];case 1:return t.sent(),this.gcScheduler&&(e&&!this.gcScheduler.started?this.gcScheduler.start(this.localStore):e||this.gcScheduler.stop()),[2]}})})})];case 4:return t.sent(),[2]}})})},IN.prototype.Bo=function(t){var e=xC();if(!vC.yt(e))throw new tb(Zm.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var n=dS(t.databaseInfo.databaseId,t.databaseInfo.persistenceKey);return new vC(e,t.asyncQueue,n,t.clientId,t.initialUser)},IN),_N=(wN.prototype.initialize=function(n,r){return $i(this,void 0,void 0,function(){var e=this;return Zi(this,function(t){switch(t.label){case 0:return this.localStore?[3,2]:(this.localStore=n.localStore,this.sharedClientState=n.sharedClientState,this.datastore=this.createDatastore(r),this.remoteStore=this.createRemoteStore(r),this.eventManager=this.createEventManager(r),this.syncEngine=this.createSyncEngine(r,!n.synchronizeTabs),this.sharedClientState.onlineStateHandler=function(t){return Jk(e.syncEngine,t,1)},this.remoteStore.remoteSyncer.handleCredentialChange=sN.bind(null,this.syncEngine),[4,dk(this.remoteStore,this.syncEngine.isPrimaryClient)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},wN.prototype.createEventManager=function(t){return new _k},wN.prototype.createDatastore=function(t){var e=MC(t.databaseInfo.databaseId),n=(n=t.databaseInfo,new wC(n));return t=t.credentials,new WC(t,n,e)},wN.prototype.createRemoteStore=function(t){var e=this,n=this.localStore,r=this.datastore,i=t.asyncQueue,o=function(t){return Jk(e.syncEngine,t,0)},t=new(mC.yt()?mC:yC);return new FC(n,r,i,o,t)},wN.prototype.createSyncEngine=function(t,e){return function(t,e,n,r,i,o,a){o=new Hk(t,e,n,r,i,o);return a&&(o.Oo=!0),o}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)},wN.prototype.terminate=function(){return function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=n,ib("RemoteStore","RemoteStore shutting down."),e.$r.add(5),[4,ZC(e)];case 1:return t.sent(),e.Lr.shutdown(),e.Br.set("Unknown"),[2]}})})}(this.remoteStore)},wN);function wN(){}function IN(t,e){var n=this;return(n=vN.call(this,t,e,!1)||this).Ko=t,n.cacheSizeBytes=e,n.synchronizeTabs=!0,n}function TN(t,e,n){var r=this;return(r=gN.call(this)||this).Ko=t,r.cacheSizeBytes=e,r.forceOwnership=n,r.synchronizeTabs=!1,r}function EN(){this.synchronizeTabs=!1}function SN(n,r){void 0===r&&(r=10240);var i=0;return{read:function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){return i<n.byteLength?(e={value:n.slice(i,i+r),done:!1},[2,(i+=r,e)]):[2,{done:!0}]})})},cancel:function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return[2]})})},releaseLock:function(){},closed:Promise.reject("unimplemented")}}var CN=(LN.prototype.next=function(t){this.observer.next&&this.jo(this.observer.next,t)},LN.prototype.error=function(t){this.observer.error?this.jo(this.observer.error,t):console.error("Uncaught Error in snapshot listener:",t)},LN.prototype.Wo=function(){this.muted=!0},LN.prototype.jo=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},LN),kN=(xN.prototype.close=function(){return this.Go.cancel()},xN.prototype.getMetadata=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return[2,this.metadata.promise]})})},xN.prototype.Lo=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,this.getMetadata()];case 1:return[2,(t.sent(),this.Ho())]}})})},xN.prototype.Ho=function(){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return[4,this.Jo()];case 1:return null===(e=t.sent())?[2,null]:(r=this.zo.decode(e),n=Number(r),isNaN(n)&&this.Yo("length string ("+r+") is not valid number"),[4,this.Xo(n)]);case 2:return r=t.sent(),[2,new Pk(JSON.parse(r),e.length+n)]}})})},xN.prototype.Zo=function(){return this.buffer.findIndex(function(t){return t==="{".charCodeAt(0)})},xN.prototype.Jo=function(){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return this.Zo()<0?[4,this.tc()]:[3,3];case 1:if(t.sent())return[3,3];t.label=2;case 2:return[3,0];case 3:return 0===this.buffer.length?[2,null]:((e=this.Zo())<0&&this.Yo("Reached the end of bundle when a length string is expected."),n=this.buffer.slice(0,e),[2,(this.buffer=this.buffer.slice(e),n)])}})})},xN.prototype.Xo=function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return this.buffer.length<n?[4,this.tc()]:[3,3];case 1:t.sent()&&this.Yo("Reached the end of bundle when more is expected."),t.label=2;case 2:return[3,0];case 3:return e=this.zo.decode(this.buffer.slice(0,n)),[2,(this.buffer=this.buffer.slice(n),e)]}})})},xN.prototype.Yo=function(t){throw this.Go.cancel(),new Error("Invalid bundle format: "+t)},xN.prototype.tc=function(){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,this.Go.read()];case 1:return(e=t.sent()).done||((n=new Uint8Array(this.buffer.length+e.value.length)).set(this.buffer),n.set(e.value,this.buffer.length),this.buffer=n),[2,e.done]}})})},xN),NN=(DN.prototype.lookup=function(r){return $i(this,void 0,void 0,function(){var e,n=this;return Zi(this,function(t){switch(t.label){case 0:if(this.ensureCommitNotCalled(),0<this.mutations.length)throw new tb(Zm.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(a,s){return $i(this,void 0,void 0,function(){var n,e,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return e=jI((n=a).R)+"/documents",r={documents:s.map(function(t){return LI(n.R,t)})},[4,n.Oi("BatchGetDocuments",e,r)];case 1:return r=t.sent(),i=new Map,r.forEach(function(t){var e,t=(e=n.R,"found"in(t=t)?function(t,e){cb(!!e.found),e.found.name,e.found.updateTime;var n=MI(t,e.found.name),t=PI(e.found.updateTime),e=new r_({mapValue:{fields:e.found.fields}});return o_.newFoundDocument(n,t,e)}(e,t):"missing"in t?function(t,e){cb(!!e.missing),cb(!!e.readTime);t=MI(t,e.missing),e=PI(e.readTime);return o_.newNoDocument(t,e)}(e,t):ub());i.set(t.key.toString(),t)}),o=[],[2,(s.forEach(function(t){t=i.get(t.toString());cb(!!t),o.push(t)}),o)]}})})}(this.datastore,r)];case 1:return[2,((e=t.sent()).forEach(function(t){return n.recordVersion(t)}),e)]}})})},DN.prototype.set=function(t,e){this.write(e.toMutation(t,this.precondition(t))),this.writtenDocs.add(t.toString())},DN.prototype.update=function(t,e){try{this.write(e.toMutation(t,this.preconditionForUpdate(t)))}catch(t){this.lastWriteError=t}this.writtenDocs.add(t.toString())},DN.prototype.delete=function(t){this.write(new Hw(t,this.precondition(t))),this.writtenDocs.add(t.toString())},DN.prototype.commit=function(){return $i(this,void 0,void 0,function(){var e,n=this;return Zi(this,function(t){switch(t.label){case 0:if(this.ensureCommitNotCalled(),this.lastWriteError)throw this.lastWriteError;return e=this.readVersions,this.mutations.forEach(function(t){e.delete(t.key.toString())}),e.forEach(function(t,e){e=Kb.fromPath(e);n.mutations.push(new Gw(e,n.precondition(e)))}),[4,function(i,o){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return n=jI((e=i).R)+"/documents",r={writes:o.map(function(t){return KI(e.R,t)})},[4,e.Ni("Commit",n,r)];case 1:return t.sent(),[2]}})})}(this.datastore,this.mutations)];case 1:return t.sent(),this.committed=!0,[2]}})})},DN.prototype.recordVersion=function(t){var e;if(t.isFoundDocument())e=t.version;else{if(!t.isNoDocument())throw ub();e=gb.min()}var n=this.readVersions.get(t.key.toString());if(n){if(!e.isEqual(n))throw new tb(Zm.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(t.key.toString(),e)},DN.prototype.precondition=function(t){var e=this.readVersions.get(t.toString());return!this.writtenDocs.has(t.toString())&&e?Cw.updateTime(e):Cw.none()},DN.prototype.preconditionForUpdate=function(t){var e=this.readVersions.get(t.toString());if(this.writtenDocs.has(t.toString())||!e)return Cw.exists(!0);if(e.isEqual(gb.min()))throw new tb(Zm.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Cw.updateTime(e)},DN.prototype.write=function(t){this.ensureCommitNotCalled(),this.mutations.push(t)},DN.prototype.ensureCommitNotCalled=function(){},DN),AN=(PN.prototype.run=function(){this.nc()},PN.prototype.nc=function(){var t=this;this.Zi.ji(function(){return $i(t,void 0,void 0,function(){var e,n,r=this;return Zi(this,function(t){return e=new NN(this.datastore),(n=this.sc(e))&&n.then(function(t){r.asyncQueue.enqueueAndForget(function(){return e.commit().then(function(){r.deferred.resolve(t)}).catch(function(t){r.ic(t)})})}).catch(function(t){r.ic(t)}),[2]})})})},PN.prototype.sc=function(t){try{var e=this.updateFunction(t);return!qb(e)&&e.catch&&e.then?e:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.deferred.reject(t),null}},PN.prototype.ic=function(t){var e=this;0<this.ec&&this.rc(t)?(--this.ec,this.asyncQueue.enqueueAndForget(function(){return e.nc(),Promise.resolve()})):this.deferred.reject(t)},PN.prototype.rc=function(t){if("FirebaseError"!==t.name)return!1;t=t.code;return"aborted"===t||"failed-precondition"===t||!Yw(t)},PN),RN=(ON.prototype.getConfiguration=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,this.receivedInitialUser.promise];case 1:return[2,(t.sent(),{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,credentials:this.credentials,initialUser:this.user,maxConcurrentLimboResolutions:100})]}})})},ON.prototype.setCredentialChangeListener=function(t){var e=this;this.credentialListener=t,this.receivedInitialUser.promise.then(function(){return e.credentialListener(e.user)})},ON.prototype.verifyNotTerminated=function(){if(this.asyncQueue.isShuttingDown)throw new tb(Zm.FAILED_PRECONDITION,"The client has already been terminated.")},ON.prototype.terminate=function(){var t=this;this.asyncQueue.enterRestrictedMode();var n=new ET;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,5,,6]),this.onlineComponents?[4,this.onlineComponents.terminate()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.offlineComponents?[4,this.offlineComponents.terminate()]:[3,4];case 3:t.sent(),t.label=4;case 4:return this.credentials.removeChangeListener(),n.resolve(),[3,6];case 5:return e=t.sent(),e=bk(e,"Failed to shutdown persistence"),n.reject(e),[3,6];case 6:return[2]}})})}),n.promise},ON);function ON(t,e,n){var r=this;this.credentials=t,this.asyncQueue=e,this.databaseInfo=n,this.user=QS.UNAUTHENTICATED,this.clientId=hb.u(),this.credentialListener=function(){},this.receivedInitialUser=new ET,this.credentials.setChangeListener(function(t){ib("FirestoreClient","Received user=",t.uid),r.user=t,r.credentialListener(t),r.receivedInitialUser.resolve()})}function PN(t,e,n,r){this.asyncQueue=t,this.datastore=e,this.updateFunction=n,this.deferred=r,this.ec=5,this.Zi=new VC(this.asyncQueue,"transaction_retry")}function DN(t){this.datastore=t,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastWriteError=null,this.writtenDocs=new Set}function xN(t,e){var n=this;this.Go=t,this.R=e,this.metadata=new ET,this.buffer=new Uint8Array,this.zo=new TextDecoder("utf-8"),this.Ho().then(function(t){t&&t.io()?n.metadata.resolve(t.payload.metadata):n.metadata.reject(new Error("The first element of the bundle is not a metadata, it is\n             "+JSON.stringify(null==t?void 0:t.payload)))},function(t){return n.metadata.reject(t)})}function LN(t){this.observer=t,this.muted=!1}function MN(i,o){return $i(this,void 0,void 0,function(){var e,n,r=this;return Zi(this,function(t){switch(t.label){case 0:return i.asyncQueue.verifyOperationInProgress(),ib("FirestoreClient","Initializing OfflineComponentProvider"),[4,i.getConfiguration()];case 1:return e=t.sent(),[4,o.initialize(e)];case 2:return t.sent(),n=e.initialUser,i.setCredentialChangeListener(function(e){n.isEqual(e)||(n=e,i.asyncQueue.enqueueRetryable(function(){return $i(r,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,SS(o.localStore,e)];case 1:return t.sent(),[2]}})})}))}),o.persistence.setDatabaseDeletedListener(function(){return i.terminate()}),i.offlineComponents=o,[2]}})})}function FN(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return r.asyncQueue.verifyOperationInProgress(),[4,UN(r)];case 1:return e=t.sent(),ib("FirestoreClient","Initializing OnlineComponentProvider"),[4,r.getConfiguration()];case 2:return n=t.sent(),[4,i.initialize(e,n)];case 3:return t.sent(),r.setCredentialChangeListener(function(t){return r.asyncQueue.enqueueRetryable(function(){return function(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return(e=r).asyncQueue.verifyOperationInProgress(),ib("RemoteStore","RemoteStore received new credentials"),n=ak(e),e.$r.add(3),[4,ZC(e)];case 1:return t.sent(),n&&e.Br.set("Unknown"),[4,e.remoteSyncer.handleCredentialChange(i)];case 2:return t.sent(),e.$r.delete(3),[4,$C(e)];case 3:return t.sent(),[2]}})})}(i.remoteStore,t)})}),r.onlineComponents=i,[2]}})})}function UN(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return e.offlineComponents?[3,2]:(ib("FirestoreClient","Using default OfflineComponentProvider"),[4,MN(e,new yN)]);case 1:t.sent(),t.label=2;case 2:return[2,e.offlineComponents]}})})}function jN(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return e.onlineComponents?[3,2]:(ib("FirestoreClient","Using default OnlineComponentProvider"),[4,FN(e,new _N)]);case 1:t.sent(),t.label=2;case 2:return[2,e.onlineComponents]}})})}function qN(t){return UN(t).then(function(t){return t.persistence})}function VN(t){return UN(t).then(function(t){return t.localStore})}function BN(t){return jN(t).then(function(t){return t.remoteStore})}function KN(t){return jN(t).then(function(t){return t.syncEngine})}function WN(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,jN(r)];case 1:return e=t.sent(),[2,((n=e.eventManager).onListen=function(a,s){return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return e=fN(a),(o=e.Po.get(s))?(n=o.targetId,e.sharedClientState.addLocalQueryTarget(n),r=o.view.Ro(),[3,4]):[3,1];case 1:return[4,RS(e.localStore,J_(s))];case 2:return i=t.sent(),o=e.sharedClientState.addLocalQueryTarget(i.targetId),n=i.targetId,[4,Qk(e,s,n,"current"===o)];case 3:r=t.sent(),e.isPrimaryClient&&tk(e.remoteStore,i),t.label=4;case 4:return[2,r]}})})}.bind(null,e.syncEngine),n.onUnlisten=function(i,o){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return n=(e=i).Po.get(o),1<(r=e.Vo.get(n.targetId)).length?[2,(e.Vo.set(n.targetId,r.filter(function(t){return!Z_(t,o)})),void e.Po.delete(o))]:e.isPrimaryClient?(e.sharedClientState.removeLocalQueryTarget(n.targetId),e.sharedClientState.isActiveQueryTarget(n.targetId)?[3,2]:[4,OS(e.localStore,n.targetId,!1).then(function(){e.sharedClientState.clearQueryState(n.targetId),ek(e.remoteStore,n.targetId),nN(e,n.targetId)}).catch(UE)]):[3,3];case 1:t.sent(),t.label=2;case 2:return[3,5];case 3:return nN(e,n.targetId),[4,OS(e.localStore,n.targetId,!0)];case 4:t.sent(),t.label=5;case 5:return[2]}})})}.bind(null,e.syncEngine),n)]}})})}function HN(n,r,i){var t=this;void 0===i&&(i={});var o=new ET;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(n,r,i,o,a){var t=new CN({next:function(t){r.enqueueAndForget(function(){return Ak(n,s)});var e=t.docs.has(i);!e&&t.fromCache?a.reject(new tb(Zm.UNAVAILABLE,"Failed to get document because the client is offline.")):e&&t.fromCache&&o&&"server"===o.source?a.reject(new tb(Zm.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.)')):a.resolve(t)},error:function(t){return a.reject(t)}}),s=new Ok(W_(i.path),t,{includeMetadataChanges:!0,so:!0});return Nk(n,s)},[4,WN(n)];case 1:return[2,e.apply(void 0,[t.sent(),n.asyncQueue,r,i,o])]}})})}),o.promise}function GN(n,r,i){var t=this;void 0===i&&(i={});var o=new ET;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(e,n,t,r,i){var o=new CN({next:function(t){n.enqueueAndForget(function(){return Ak(e,a)}),t.fromCache&&"server"===r.source?i.reject(new tb(Zm.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)}}),a=new Ok(t,o,{includeMetadataChanges:!0,so:!0});return Nk(e,a)},[4,WN(n)];case 1:return[2,e.apply(void 0,[t.sent(),n.asyncQueue,r,i,o])]}})})}),o.promise}function zN(t,e){this.user=e,this.type="OAuth",this.authHeaders={},this.authHeaders.Authorization="Bearer "+t}var QN=function(t,e,n,r,i,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=o,this.autoDetectLongPolling=a},YN=(Object.defineProperty(oA.prototype,"isDefaultDatabase",{get:function(){return"(default)"===this.database},enumerable:!1,configurable:!0}),oA.prototype.isEqual=function(t){return t instanceof oA&&t.projectId===this.projectId&&t.database===this.database},oA),XN=new Map,JN=(iA.prototype.getToken=function(){return Promise.resolve(null)},iA.prototype.invalidateToken=function(){},iA.prototype.setChangeListener=function(t){(this.changeListener=t)(QS.UNAUTHENTICATED)},iA.prototype.removeChangeListener=function(){this.changeListener=null},iA),$N=(rA.prototype.getToken=function(){var e=this,n=this.cc,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(function(t){return e.cc!==n?(ib("FirebaseCredentialsProvider","getToken aborted due to token change."),e.getToken()):t?(cb("string"==typeof t.accessToken),new zN(t.accessToken,e.currentUser)):null}):Promise.resolve(null)},rA.prototype.invalidateToken=function(){this.forceRefresh=!0},rA.prototype.setChangeListener=function(t){this.changeListener=t,this.receivedInitialUser&&t(this.currentUser)},rA.prototype.removeChangeListener=function(){this.auth&&this.auth.removeAuthTokenListener(this.oc),this.oc=null,this.changeListener=null},rA.prototype.uc=function(){var t=this.auth&&this.auth.getUid();return cb(null===t||"string"==typeof t),new QS(t)},rA),ZN=(Object.defineProperty(nA.prototype,"authHeaders",{get:function(){var t={"X-Goog-AuthUser":this.hc},e=this.ac.auth.getAuthHeaderValueForFirstParty([]);return e&&(t.Authorization=e),this.lc&&(t["X-Goog-Iam-Authorization-Token"]=this.lc),t},enumerable:!1,configurable:!0}),nA),tA=(eA.prototype.getToken=function(){return Promise.resolve(new ZN(this.ac,this.hc,this.lc))},eA.prototype.setChangeListener=function(t){t(QS.FIRST_PARTY)},eA.prototype.removeChangeListener=function(){},eA.prototype.invalidateToken=function(){},eA);function eA(t,e,n){this.ac=t,this.hc=e,this.lc=n}function nA(t,e,n){this.ac=t,this.hc=e,this.lc=n,this.type="FirstParty",this.user=QS.FIRST_PARTY}function rA(t){var e=this;this.oc=null,this.currentUser=QS.UNAUTHENTICATED,this.receivedInitialUser=!1,this.cc=0,this.changeListener=null,this.forceRefresh=!1,this.oc=function(){e.cc++,e.currentUser=e.uc(),e.receivedInitialUser=!0,e.changeListener&&e.changeListener(e.currentUser)},this.cc=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.oc):(this.oc(null),t.get().then(function(t){e.auth=t,e.oc&&e.auth.addAuthTokenListener(e.oc)},function(){}))}function iA(){this.changeListener=null}function oA(t,e){this.projectId=t,this.database=e||"(default)"}function aA(t,e,n){if(!n)throw new tb(Zm.INVALID_ARGUMENT,"Function "+t+"() cannot be called with an empty "+e+".")}function sA(t,e){if(void 0===e)return{merge:!1};if(void 0!==e.mergeFields&&void 0!==e.merge)throw new tb(Zm.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');return e}function uA(t,e,n,r){if(!0===e&&!0===r)throw new tb(Zm.INVALID_ARGUMENT,t+" and "+n+" cannot be used together.")}function cA(t){if(!Kb.isDocumentKey(t))throw new tb(Zm.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t+" has "+t.length+".")}function hA(t){if(Kb.isDocumentKey(t))throw new tb(Zm.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t+" has "+t.length+".")}function lA(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":ub();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 fA(t,e){if((t="_delegate"in t?t._delegate:t)instanceof e)return t;if(e.name===t.constructor.name)throw new tb(Zm.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");t=lA(t);throw new tb(Zm.INVALID_ARGUMENT,"Expected type '"+e.name+"', but it was: "+t)}function pA(t,e){if(e<=0)throw new tb(Zm.INVALID_ARGUMENT,"Function "+t+"() requires a positive number, but it was: "+e+".")}var dA,vA=(EA.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},EA),gA=(Object.defineProperty(TA.prototype,"app",{get:function(){if(!this._app)throw new tb(Zm.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app},enumerable:!1,configurable:!0}),Object.defineProperty(TA.prototype,"_initialized",{get:function(){return this._settingsFrozen},enumerable:!1,configurable:!0}),Object.defineProperty(TA.prototype,"_terminated",{get:function(){return void 0!==this._terminateTask},enumerable:!1,configurable:!0}),TA.prototype._setSettings=function(t){if(this._settingsFrozen)throw new tb(Zm.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new vA(t),void 0!==t.credentials&&(this._credentials=function(t){if(!t)return new JN;switch(t.type){case"gapi":var e=t.client;return cb(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new tA(e,t.sessionIndex||"0",t.iamToken||null);case"provider":return t.client;default:throw new tb(Zm.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(t.credentials))},TA.prototype._getSettings=function(){return this._settings},TA.prototype._freezeSettings=function(){return this._settingsFrozen=!0,this._settings},TA.prototype._delete=function(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask},TA.prototype.toJSON=function(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}},TA.prototype._terminate=function(){return(t=XN.get(this))&&(ib("ComponentProvider","Removing Datastore"),XN.delete(this),t.terminate()),Promise.resolve();var t},TA),yA=(Object.defineProperty(IA.prototype,"_path",{get:function(){return this._key.path},enumerable:!1,configurable:!0}),Object.defineProperty(IA.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!1,configurable:!0}),Object.defineProperty(IA.prototype,"path",{get:function(){return this._key.path.canonicalString()},enumerable:!1,configurable:!0}),Object.defineProperty(IA.prototype,"parent",{get:function(){return new bA(this.firestore,this._converter,this._key.path.popLast())},enumerable:!1,configurable:!0}),IA.prototype.withConverter=function(t){return new IA(this.firestore,t,this._key)},IA),mA=(wA.prototype.withConverter=function(t){return new wA(this.firestore,t,this._query)},wA),bA=(Xi(_A,dA=mA),Object.defineProperty(_A.prototype,"id",{get:function(){return this._query.path.lastSegment()},enumerable:!1,configurable:!0}),Object.defineProperty(_A.prototype,"path",{get:function(){return this._query.path.canonicalString()},enumerable:!1,configurable:!0}),Object.defineProperty(_A.prototype,"parent",{get:function(){var t=this._path.popLast();return t.isEmpty()?null:new yA(this.firestore,null,new Kb(t))},enumerable:!1,configurable:!0}),_A.prototype.withConverter=function(t){return new _A(this.firestore,t,this._path)},_A);function _A(t,e,n){var r=this;return(r=dA.call(this,t,e,W_(n))||this)._path=n,r.type="collection",r}function wA(t,e,n){this._converter=e,this._query=n,this.type="query",this.firestore=t}function IA(t,e,n){this._converter=e,this._key=n,this.type="document",this.firestore=t}function TA(t,e){this._persistenceKey="(lite)",this._settings=new vA({}),this._settingsFrozen=!1,t instanceof YN?(this._databaseId=t,this._credentials=new JN):(this._app=t,this._databaseId=function(t){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new tb(Zm.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new YN(t.options.projectId)}(t),this._credentials=new $N(e))}function EA(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new tb(Zm.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new tb(Zm.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,uA("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}function SA(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(t=Zo(t),aA("collection","path",e),t instanceof gA)return hA(n=Eb.fromString.apply(Eb,no([e],r))),new bA(t,null,n);if(!(t instanceof yA||t instanceof bA))throw new tb(Zm.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");return hA(n=Eb.fromString.apply(Eb,no([t.path],r)).child(Eb.fromString(e))),new bA(t.firestore,null,n)}function CA(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(t=Zo(t),aA("doc","path",e=1===arguments.length?hb.u():e),t instanceof gA)return cA(n=Eb.fromString.apply(Eb,no([e],r))),new yA(t,null,new Kb(n));if(!(t instanceof yA||t instanceof bA))throw new tb(Zm.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");return cA(n=t._path.child(Eb.fromString.apply(Eb,no([e],r)))),new yA(t.firestore,t instanceof bA?t._converter:null,new Kb(n))}function kA(t,e){return t=Zo(t),e=Zo(e),(t instanceof yA||t instanceof bA)&&(e instanceof yA||e instanceof bA)&&t.firestore===e.firestore&&t.path===e.path&&t._converter===e._converter}function NA(t,e){return t=Zo(t),e=Zo(e),t instanceof mA&&e instanceof mA&&t.firestore===e.firestore&&Z_(t._query,e._query)&&t._converter===e._converter}var AA=(Object.defineProperty(RA.prototype,"isShuttingDown",{get:function(){return this.wc},enumerable:!1,configurable:!0}),RA.prototype.enqueueAndForget=function(t){this.enqueue(t)},RA.prototype.enqueueAndForgetEvenWhileRestricted=function(t){this.Tc(),this.Ic(t)},RA.prototype.enterRestrictedMode=function(){var t;this.wc||(this.wc=!0,(t=LC())&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.Ec))},RA.prototype.enqueue=function(t){return this.Tc(),this.wc?new Promise(function(t){}):this.Ic(t)},RA.prototype.enqueueRetryable=function(t){var e=this;this.enqueueAndForget(function(){return e.dc.push(t),e.Ac()})},RA.prototype.Ac=function(){return $i(this,void 0,void 0,function(){var e,n=this;return Zi(this,function(t){switch(t.label){case 0:if(0===this.dc.length)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.dc[0]()];case 2:return t.sent(),this.dc.shift(),this.Zi.reset(),[3,4];case 3:if(!MT(e=t.sent()))throw e;return ib("AsyncQueue","Operation failed with retryable error: "+e),[3,4];case 4:0<this.dc.length&&this.Zi.ji(function(){return n.Ac()}),t.label=5;case 5:return[2]}})})},RA.prototype.Ic=function(t){var r=this,e=this.fc.then(function(){return r.yc=!0,t().catch(function(t){throw r.mc=t,r.yc=!1,ob("INTERNAL UNHANDLED ERROR: ",(n=(e=t).message||"",n=e.stack?e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack:n)),t;var e,n}).then(function(t){return r.yc=!1,t})});return this.fc=e},RA.prototype.enqueueAfterDelay=function(t,e,n){var r=this;this.Tc(),-1<this.gc.indexOf(t)&&(e=0);n=yk.createAndSchedule(this,t,e,n,function(t){return r.Rc(t)});return this._c.push(n),n},RA.prototype.Tc=function(){this.mc&&ub()},RA.prototype.verifyOperationInProgress=function(){},RA.prototype.bc=function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,e=this.fc];case 1:t.sent(),t.label=2;case 2:if(e!==this.fc)return[3,0];t.label=3;case 3:return[2]}})})},RA.prototype.vc=function(t){for(var e=0,n=this._c;e<n.length;e++)if(n[e].timerId===t)return!0;return!1},RA.prototype.Pc=function(r){var i=this;return this.bc().then(function(){i._c.sort(function(t,e){return t.targetTimeMs-e.targetTimeMs});for(var t=0,e=i._c;t<e.length;t++){var n=e[t];if(n.skipDelay(),"all"!==r&&n.timerId===r)break}return i.bc()})},RA.prototype.Vc=function(t){this.gc.push(t)},RA.prototype.Rc=function(t){t=this._c.indexOf(t);this._c.splice(t,1)},RA);function RA(){var e=this;this.fc=Promise.resolve(),this.dc=[],this.wc=!1,this._c=[],this.mc=null,this.yc=!1,this.gc=[],this.Zi=new VC(this,"async_queue_retry"),this.Ec=function(){var t=LC();t&&ib("AsyncQueue","Visibility state changed to "+t.visibilityState),e.Zi.Gi()};var t=LC();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Ec)}function OA(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 PA,DA=(MA.prototype.onProgress=function(t,e,n){this._progressObserver={next:t,error:e,complete:n}},MA.prototype.catch=function(t){return this._taskCompletionResolver.promise.catch(t)},MA.prototype.then=function(t,e){return this._taskCompletionResolver.promise.then(t,e)},MA.prototype._completeWith=function(t){this._updateProgress(t),this._progressObserver.complete&&this._progressObserver.complete(),this._taskCompletionResolver.resolve(t)},MA.prototype._failWith=function(t){this._lastProgress.taskState="Error",this._progressObserver.next&&this._progressObserver.next(this._lastProgress),this._progressObserver.error&&this._progressObserver.error(t),this._taskCompletionResolver.reject(t)},MA.prototype._updateProgress=function(t){this._lastProgress=t,this._progressObserver.next&&this._progressObserver.next(t)},MA),xA=(Xi(LA,PA=gA),LA.prototype._terminate=function(){return this._firestoreClient||UA(this),this._firestoreClient.terminate()},LA);function LA(t,e){var n=this;return(n=PA.call(this,t,e)||this)._queue=new AA,n._persistenceKey="name"in t?t.name:"[DEFAULT]",n}function MA(){this._progressObserver={},this._taskCompletionResolver=new ET,this._lastProgress={taskState:"Running",totalBytes:0,totalDocuments:0,bytesLoaded:0,documentsLoaded:0}}function FA(t){return t._firestoreClient||UA(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function UA(t){var e,n,r,i=t._freezeSettings(),i=(e=t._databaseId,n=(null===(r=t._app)||void 0===r?void 0:r.options.appId)||"",r=t._persistenceKey,new QN(e,n,r,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling));t._firestoreClient=new RN(t._credentials,t._queue,i)}function jA(r,i,o){var t=this,a=new ET;return r.asyncQueue.enqueue(function(){return $i(t,void 0,void 0,function(){var n;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,MN(r,o)];case 1:return t.sent(),[4,FN(r,i)];case 2:return t.sent(),a.resolve(),[3,4];case 3:if(!("FirebaseError"===(e=n=t.sent()).name?e.code===Zm.FAILED_PRECONDITION||e.code===Zm.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code))throw n;return console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+n),a.reject(n),[3,4];case 4:return[2]}var e})})}).then(function(){return a.promise})}function qA(t){if(t._initialized||t._terminated)throw new tb(Zm.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.")}var VA=($A.prototype.isEqual=function(t){return this._internalPath.isEqual(t._internalPath)},$A),BA=(JA.fromBase64String=function(t){try{return new JA(Nb.fromBase64String(t))}catch(t){throw new tb(Zm.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}},JA.fromUint8Array=function(t){return new JA(Nb.fromUint8Array(t))},JA.prototype.toBase64=function(){return this._byteString.toBase64()},JA.prototype.toUint8Array=function(){return this._byteString.toUint8Array()},JA.prototype.toString=function(){return"Bytes(base64: "+this.toBase64()+")"},JA.prototype.isEqual=function(t){return this._byteString.isEqual(t._byteString)},JA),KA=function(t){this._methodName=t},WA=(Object.defineProperty(XA.prototype,"latitude",{get:function(){return this._lat},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"longitude",{get:function(){return this._long},enumerable:!1,configurable:!0}),XA.prototype.isEqual=function(t){return this._lat===t._lat&&this._long===t._long},XA.prototype.toJSON=function(){return{latitude:this._lat,longitude:this._long}},XA.prototype._compareTo=function(t){return fb(this._lat,t._lat)||fb(this._long,t._long)},XA),HA=/^__.*__$/,GA=(YA.prototype.toMutation=function(t,e){return null!==this.fieldMask?new Lw(t,this.data,this.fieldMask,e,this.fieldTransforms):new xw(t,this.data,e,this.fieldTransforms)},YA),zA=(QA.prototype.toMutation=function(t,e){return new Lw(t,this.data,this.fieldMask,e,this.fieldTransforms)},QA);function QA(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}function YA(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}function XA(t,e){if(!isFinite(t)||t<-90||90<t)throw new tb(Zm.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||180<e)throw new tb(Zm.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}function JA(t){this._byteString=t}function $A(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=0;n<t.length;++n)if(0===t[n].length)throw new tb(Zm.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Cb(t)}function ZA(t){switch(t){case 0:case 2:case 1:return 1;case 3:case 4:return;default:throw ub()}}var tR=(Object.defineProperty(rR.prototype,"path",{get:function(){return this.settings.path},enumerable:!1,configurable:!0}),Object.defineProperty(rR.prototype,"Dc",{get:function(){return this.settings.Dc},enumerable:!1,configurable:!0}),rR.prototype.Cc=function(t){return new rR(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.R,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)},rR.prototype.Nc=function(t){var e=null===(e=this.path)||void 0===e?void 0:e.child(t),e=this.Cc({path:e,xc:!1});return e.Fc(t),e},rR.prototype.kc=function(t){var e,t=null===(e=this.path)||void 0===e?void 0:e.child(t),t=this.Cc({path:t,xc:!1});return t.Sc(),t},rR.prototype.Oc=function(t){return this.Cc({path:void 0,xc:!0})},rR.prototype.$c=function(t){return PR(t,this.settings.methodName,this.settings.Mc||!1,this.path,this.settings.Lc)},rR.prototype.contains=function(e){return void 0!==this.fieldMask.find(function(t){return e.isPrefixOf(t)})||void 0!==this.fieldTransforms.find(function(t){return e.isPrefixOf(t.field)})},rR.prototype.Sc=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.Fc(this.path.get(t))},rR.prototype.Fc=function(t){if(0===t.length)throw this.$c("Document fields must not be empty");if(ZA(this.Dc)&&HA.test(t))throw this.$c('Document fields cannot begin and end with "__"')},rR),eR=(nR.prototype.Bc=function(t,e,n,r){return void 0===r&&(r=!1),new tR({Dc:t,methodName:e,Lc:n,path:Cb.emptyPath(),xc:!1,Mc:r},this.databaseId,this.R,this.ignoreUndefinedProperties)},nR);function nR(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.R=n||MC(t)}function rR(t,e,n,r,i,o){this.settings=t,this.databaseId=e,this.R=n,this.ignoreUndefinedProperties=r,void 0===i&&this.Sc(),this.fieldTransforms=i||[],this.fieldMask=o||[]}function iR(t){var e=t._freezeSettings(),n=MC(t._databaseId);return new eR(t._databaseId,!!e.ignoreUndefinedProperties,n)}function oR(t,e,n,r,i,o){void 0===o&&(o={});var a=t.Bc(o.merge||o.mergeFields?2:0,e,n,i);NR("Data must be an object, but it was:",a,r);var s,u,r=CR(r,a);if(o.merge)s=new kb(a.fieldMask),u=a.fieldTransforms;else if(o.mergeFields){for(var c=[],h=0,l=o.mergeFields;h<l.length;h++){var f=AR(e,l[h],n);if(!a.contains(f))throw new tb(Zm.INVALID_ARGUMENT,"Field '"+f+"' is specified in your field mask but missing from your input data.");DR(c,f)||c.push(f)}s=new kb(c),u=a.fieldTransforms.filter(function(t){return s.covers(t.field)})}else s=null,u=a.fieldTransforms;return new GA(new r_(r),s,u)}var aR,sR=(Xi(uR,aR=KA),uR.prototype._toFieldTransform=function(t){if(2!==t.Dc)throw 1===t.Dc?t.$c(this._methodName+"() can only appear at the top level of your update data"):t.$c(this._methodName+"() cannot be used with set() unless you pass {merge:true}");return t.fieldMask.push(t.path),null},uR.prototype.isEqual=function(t){return t instanceof uR},uR);function uR(){return null!==aR&&aR.apply(this,arguments)||this}function cR(t,e,n){return new tR({Dc:3,Lc:e.settings.Lc,methodName:t._methodName,xc:n},e.databaseId,e.R,e.ignoreUndefinedProperties)}var hR,lR,fR,pR,dR=(Xi(wR,pR=KA),wR.prototype._toFieldTransform=function(t){return new Sw(t.path,new hw)},wR.prototype.isEqual=function(t){return t instanceof wR},wR),vR=(Xi(_R,fR=KA),_R.prototype._toFieldTransform=function(t){var e=cR(this,t,!0),n=this.qc.map(function(t){return SR(t,e)}),n=new lw(n);return new Sw(t.path,n)},_R.prototype.isEqual=function(t){return this===t},_R),gR=(Xi(bR,lR=KA),bR.prototype._toFieldTransform=function(t){var e=cR(this,t,!0),n=this.qc.map(function(t){return SR(t,e)}),n=new gw(n);return new Sw(t.path,n)},bR.prototype.isEqual=function(t){return this===t},bR),yR=(Xi(mR,hR=KA),mR.prototype._toFieldTransform=function(t){var e=new _w(t.R,aw(t.R,this.Uc));return new Sw(t.path,e)},mR.prototype.isEqual=function(t){return this===t},mR);function mR(t,e){var n=this;return(n=hR.call(this,t)||this).Uc=e,n}function bR(t,e){var n=this;return(n=lR.call(this,t)||this).qc=e,n}function _R(t,e){var n=this;return(n=fR.call(this,t)||this).qc=e,n}function wR(){return null!==pR&&pR.apply(this,arguments)||this}function IR(t,r,i,e){var o=t.Bc(1,r,i);NR("Data must be an object, but it was:",o,e);var a=[],s=r_.empty();_b(e,function(t,e){var n=OR(r,t,i);e=Zo(e);t=o.kc(n);e instanceof sR?a.push(n):null!=(t=SR(e,t))&&(a.push(n),s.set(n,t))});e=new kb(a);return new zA(s,e,o.fieldTransforms)}function TR(t,e,n,r,i,o){var a=t.Bc(1,e,n),s=[AR(e,r,n)],u=[i];if(o.length%2!=0)throw new tb(Zm.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)s.push(AR(e,o[c])),u.push(o[c+1]);for(var h,l,f,p=[],d=r_.empty(),v=s.length-1;0<=v;--v)DR(p,s[v])||(h=s[v],l=Zo(l=u[v]),f=a.kc(h),l instanceof sR?p.push(h):null!=(f=SR(l,f))&&(p.push(h),d.set(h,f)));i=new kb(p);return new zA(d,i,a.fieldTransforms)}function ER(t,e,n,r){return void 0===r&&(r=!1),SR(n,t.Bc(r?4:3,e))}function SR(a,t){if(kR(a=Zo(a)))return NR("Unsupported field value:",t,a),CR(a,t);if(a instanceof KA)return function(t,e){if(!ZA(e.Dc))throw e.$c(t._methodName+"() can only be used with update() and set()");if(!e.path)throw e.$c(t._methodName+"() is not currently supported inside arrays");t=t._toFieldTransform(e);t&&e.fieldTransforms.push(t)}(a,t),null;if(void 0===a&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),a instanceof Array){if(t.settings.xc&&4!==t.Dc)throw t.$c("Nested arrays are not supported");return function(t){for(var e=[],n=0,r=0,i=a;r<i.length;r++){var o=SR(i[r],t.Oc(n));null==o&&(o={nullValue:"NULL_VALUE"}),e.push(o),n++}return{arrayValue:{values:e}}}(t)}return function(t,e){if(null===(t=Zo(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return aw(e.R,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){var n=vb.fromDate(t);return{timestampValue:RI(e.R,n)}}if(t instanceof vb)return n=new vb(t.seconds,1e3*Math.floor(t.nanoseconds/1e3)),{timestampValue:RI(e.R,n)};if(t instanceof WA)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof BA)return{bytesValue:OI(e.R,t._byteString)};if(t instanceof yA){var n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.$c("Document reference is for database "+r.projectId+"/"+r.database+" but should be for database "+n.projectId+"/"+n.database);return{referenceValue:DI(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.$c("Unsupported field value: "+lA(t))}(a,t)}function CR(t,n){var r={};return wb(t)?n.path&&0<n.path.length&&n.fieldMask.push(n.path):_b(t,function(t,e){e=SR(e,n.Nc(t));null!=e&&(r[t]=e)}),{mapValue:{fields:r}}}function kR(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof vb||t instanceof WA||t instanceof BA||t instanceof yA||t instanceof KA)}function NR(t,e,n){if(!kR(n)||("object"!=typeof(r=n)||null===r||Object.getPrototypeOf(r)!==Object.prototype&&null!==Object.getPrototypeOf(r))){n=lA(n);throw"an object"===n?e.$c(t+" a custom object"):e.$c(t+" "+n)}var r}function AR(t,e,n){if((e=Zo(e))instanceof VA)return e._internalPath;if("string"==typeof e)return OR(t,e);throw PR("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}var RR=new RegExp("[~\\*/\\[\\]]");function OR(e,n,r){if(0<=n.search(RR))throw PR("Invalid field path ("+n+"). Paths must not contain '~', '*', '/', '[', or ']'",e,!1,void 0,r);try{return(new(VA.bind.apply(VA,no([void 0],n.split(".")))))._internalPath}catch(t){throw PR("Invalid field path ("+n+"). Paths must not be empty, begin with '.', end with '.', or contain '..'",e,!1,void 0,r)}}function PR(t,e,n,r,i){var o=r&&!r.isEmpty(),a=void 0!==i,e="Function "+e+"() called with invalid data";n&&(e+=" (via `toFirestore()`)");n="";return(o||a)&&(n+=" (found",o&&(n+=" in field "+r),a&&(n+=" in document "+i),n+=")"),new tb(Zm.INVALID_ARGUMENT,(e+=". ")+t+n)}function DR(t,e){return t.some(function(t){return t.isEqual(e)})}var xR,LR=(Object.defineProperty(UR.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!1,configurable:!0}),Object.defineProperty(UR.prototype,"ref",{get:function(){return new yA(this._firestore,this._converter,this._key)},enumerable:!1,configurable:!0}),UR.prototype.exists=function(){return null!==this._document},UR.prototype.data=function(){if(this._document){if(this._converter){var t=new MR(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.toProto())}},UR.prototype.get=function(t){if(this._document){t=this._document.data.field(jR("DocumentSnapshot.get",t));if(null!==t)return this._userDataWriter.convertValue(t)}},UR),MR=(Xi(FR,xR=LR),FR.prototype.data=function(){return xR.prototype.data.call(this)},FR);function FR(){return null!==xR&&xR.apply(this,arguments)||this}function UR(t,e,n,r,i){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=i}function jR(t,e){return"string"==typeof e?OR(t,e):(e instanceof VA?e:e._delegate)._internalPath}var qR,VR,BR=(YR.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},YR),KR=(Xi(QR,VR=LR),QR.prototype.exists=function(){return VR.prototype.exists.call(this)},QR.prototype.data=function(t){if(void 0===t&&(t={}),this._document){if(this._converter){var e=new WR(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.toProto(),t.serverTimestamps)}},QR.prototype.get=function(t,e){if(void 0===e&&(e={}),this._document){t=this._document.data.field(jR("DocumentSnapshot.get",t));if(null!==t)return this._userDataWriter.convertValue(t,e.serverTimestamps)}},QR),WR=(Xi(zR,qR=KR),zR.prototype.data=function(t){return void 0===t&&(t={}),qR.prototype.data.call(this,t)},zR),HR=(Object.defineProperty(GR.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!1,configurable:!0}),Object.defineProperty(GR.prototype,"size",{get:function(){return this._snapshot.docs.size},enumerable:!1,configurable:!0}),Object.defineProperty(GR.prototype,"empty",{get:function(){return 0===this.size},enumerable:!1,configurable:!0}),GR.prototype.forEach=function(e,n){var r=this;this._snapshot.docs.forEach(function(t){e.call(n,new WR(r._firestore,r._userDataWriter,t.key,t,new BR(r._snapshot.mutatedKeys.has(t.key),r._snapshot.fromCache),r.query._converter))})},GR.prototype.docChanges=function(t){t=!!(t=void 0===t?{}:t).includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new tb(Zm.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(i,e){if(i._snapshot.oldDocs.isEmpty()){var n=0;return i._snapshot.docChanges.map(function(t){var e=new WR(i._firestore,i._userDataWriter,t.doc.key,t.doc,new BR(i._snapshot.mutatedKeys.has(t.doc.key),i._snapshot.fromCache),i.query._converter);return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=new WR(i._firestore,i._userDataWriter,t.doc.key,t.doc,new BR(i._snapshot.mutatedKeys.has(t.doc.key),i._snapshot.fromCache),i.query._converter),n=-1,r=-1;return 0!==t.type&&(n=o.indexOf(t.doc.key),o=o.delete(t.doc.key)),1!==t.type&&(r=(o=o.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 ub()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges},GR);function GR(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new BR(r.hasPendingWrites,r.fromCache),this.query=n}function zR(){return null!==qR&&qR.apply(this,arguments)||this}function QR(t,e,n,r,i,o){var a=this;return(a=VR.call(this,t,e,n,r,o)||this)._firestore=t,a._firestoreImpl=t,a.metadata=i,a}function YR(t,e){this.hasPendingWrites=t,this.fromCache=e}function XR(t,e){return t instanceof KR&&e instanceof KR?t._firestore===e._firestore&&t._key.isEqual(e._key)&&(null===t._document?null===e._document:t._document.isEqual(e._document))&&t._converter===e._converter:t instanceof HR&&e instanceof HR&&t._firestore===e._firestore&&NA(t.query,e.query)&&t.metadata.isEqual(e.metadata)&&t._snapshot.isEqual(e._snapshot)}function JR(t){if(G_(t)&&0===t.explicitOrderBy.length)throw new tb(Zm.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}Sn=function(){};function $R(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0,i=e;r<i.length;r++)t=i[r]._apply(t);return t}var ZR,tO,eO,nO,rO,iO=(Xi(pO,rO=Sn),pO.prototype._apply=function(t){var e=iR(t.firestore),e=function(t,e,n,r,i,o){if(r.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new tb(Zm.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+i+"' queries on FieldPath.documentId().");if("in"===i||"not-in"===i){gO(o,i);for(var a=[],s=0,u=o;s<u.length;s++){var c=u[s];a.push(vO(n,t,c))}h={arrayValue:{values:a}}}else h=vO(n,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||gO(o,i),h=ER(e,"where",o,"in"===i||"not-in"===i);var h=p_.create(r,i,h);return function(t,e){if(e.g()){var n=Q_(t);if(null!==n&&!n.isEqual(e.field))throw new tb(Zm.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '"+n.toString()+"' and '"+e.field.toString()+"'");n=z_(t);null!==n&&yO(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 tb(Zm.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new tb(Zm.INVALID_ARGUMENT,"Invalid query. You cannot use '"+e.op.toString()+"' filters with '"+t.toString()+"' filters.")}(t,h),h}(t._query,e,t.firestore._databaseId,this.Qc,this.Kc,this.jc);return new mA(t.firestore,t._converter,(t=t._query,e=t.filters.concat([e]),new B_(t.path,t.collectionGroup,t.explicitOrderBy.slice(),e,t.limit,t.limitType,t.startAt,t.endAt)))},pO),oO=(Xi(fO,nO=Sn),fO.prototype._apply=function(t){var e=function(t,e,n){if(null!==t.startAt)throw new tb(Zm.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new tb(Zm.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");var r=new j_(e,n);return e=r,null!==z_(n=t)||null!==(t=Q_(n))&&yO(0,t,e.field),r}(t._query,this.Qc,this.Wc);return new mA(t.firestore,t._converter,(t=t._query,e=t.explicitOrderBy.concat([e]),new B_(t.path,t.collectionGroup,e,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)))},fO),aO=(Xi(lO,eO=Sn),lO.prototype._apply=function(t){return new mA(t.firestore,t._converter,$_(t._query,this.Gc,this.zc))},lO),sO=(Xi(hO,tO=Sn),hO.prototype._apply=function(t){var e=dO(t,this.type,this.Hc,this.Jc);return new mA(t.firestore,t._converter,(t=t._query,e=e,new B_(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,e,t.endAt)))},hO),uO=(Xi(cO,ZR=Sn),cO.prototype._apply=function(t){var e=dO(t,this.type,this.Hc,this.Jc);return new mA(t.firestore,t._converter,(t=t._query,e=e,new B_(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,e)))},cO);function cO(t,e,n){var r=this;return(r=ZR.call(this)||this).type=t,r.Hc=e,r.Jc=n,r}function hO(t,e,n){var r=this;return(r=tO.call(this)||this).type=t,r.Hc=e,r.Jc=n,r}function lO(t,e,n){var r=this;return(r=eO.call(this)||this).type=t,r.Gc=e,r.zc=n,r}function fO(t,e){var n=this;return(n=nO.call(this)||this).Qc=t,n.Wc=e,n.type="orderBy",n}function pO(t,e,n){var r=this;return(r=rO.call(this)||this).Qc=t,r.Kc=e,r.jc=n,r.type="where",r}function dO(t,c,e,n){if(e[0]=Zo(e[0]),e[0]instanceof LR)return function(t,e,n,r){if(!n)throw new tb(Zm.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+c+"().");for(var i=[],o=0,a=X_(t);o<a.length;o++){var s=a[o];if(s.field.isKeyField())i.push(Jb(e,n.key));else{var u=n.data.field(s.field);if(Ub(u))throw new tb(Zm.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+s.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===u){s=s.field.canonicalString();throw new tb(Zm.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+s+"' (used as the orderBy) does not exist.")}i.push(u)}}return new D_(i,r)}(t._query,t.firestore._databaseId,e[0]._document,n);var r=iR(t.firestore);return function(t,e,n,r,i,o){var a=t.explicitOrderBy;if(i.length>a.length)throw new tb(Zm.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 s=[],u=0;u<i.length;u++){var c=i[u];if(a[u].field.isKeyField()){if("string"!=typeof c)throw new tb(Zm.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+r+"(), but got a "+typeof c);if(!Y_(t)&&-1!==c.indexOf("/"))throw new tb(Zm.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(Eb.fromString(c));if(!Kb.isDocumentKey(h))throw new tb(Zm.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 Kb(h);s.push(Jb(e,h))}else{c=ER(n,r,c);s.push(c)}}return new D_(s,o)}(t._query,t.firestore._databaseId,r,c,e,n)}function vO(t,e,n){if("string"==typeof(n=Zo(n))){if(""===n)throw new tb(Zm.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!Y_(e)&&-1!==n.indexOf("/"))throw new tb(Zm.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(Eb.fromString(n));if(!Kb.isDocumentKey(e))throw new tb(Zm.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 Jb(t,new Kb(e))}if(n instanceof yA)return Jb(t,n._key);throw new tb(Zm.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+lA(n)+".")}function gO(t,e){if(!Array.isArray(t)||0===t.length)throw new tb(Zm.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(10<t.length)throw new tb(Zm.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.")}function yO(t,e,n){if(!n.isEqual(e))throw new tb(Zm.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first argument to orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}mO.prototype.convertValue=function(t,e){switch(void 0===e&&(e="none"),Hb(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Mb(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(Fb(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw ub()}},mO.prototype.convertObject=function(t,n){var r=this,i={};return _b(t.fields||{},function(t,e){i[t]=r.convertValue(e,n)}),i},mO.prototype.convertGeoPoint=function(t){return new WA(Mb(t.latitude),Mb(t.longitude))},mO.prototype.convertArray=function(t,e){var n=this;return(t.values||[]).map(function(t){return n.convertValue(t,e)})},mO.prototype.convertServerTimestamp=function(t,e){switch(e){case"previous":var n=function t(e){e=e.mapValue.fields.__previous_value__;return Ub(e)?t(e):e}(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(jb(t));default:return null}},mO.prototype.convertTimestamp=function(t){t=Lb(t);return new vb(t.seconds,t.nanos)},mO.prototype.convertDocumentKey=function(t,e){var n=Eb.fromString(t);cb(tT(n));t=new YN(n.get(1),n.get(3)),n=new Kb(n.popFirst(5));return t.isEqual(e)||ob("Document "+n+" 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 ("+e.projectId+"/"+e.database+") instead."),n},G=mO;function mO(){}function bO(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var _O,wO=(Xi(EO,_O=G),EO.prototype.convertBytes=function(t){return new BA(t)},EO.prototype.convertReference=function(t){t=this.convertDocumentKey(t,this.firestore._databaseId);return new yA(this.firestore,null,t)},EO),IO=(TO.prototype.set=function(t,e,n){this._verifyNotCommitted();t=SO(t,this._firestore),e=bO(t._converter,e,n),n=oR(this._dataReader,"WriteBatch.set",t._key,e,null!==t._converter,n);return this._mutations.push(n.toMutation(t._key,Cw.none())),this},TO.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];this._verifyNotCommitted();t=SO(t,this._firestore),e="string"==typeof(e=Zo(e))||e instanceof VA?TR(this._dataReader,"WriteBatch.update",t._key,e,n,r):IR(this._dataReader,"WriteBatch.update",t._key,e);return this._mutations.push(e.toMutation(t._key,Cw.exists(!0))),this},TO.prototype.delete=function(t){this._verifyNotCommitted();t=SO(t,this._firestore);return this._mutations=this._mutations.concat(new Hw(t._key,Cw.none())),this},TO.prototype.commit=function(){return this._verifyNotCommitted(),this._committed=!0,0<this._mutations.length?this._commitHandler(this._mutations):Promise.resolve()},TO.prototype._verifyNotCommitted=function(){if(this._committed)throw new tb(Zm.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},TO);function TO(t,e){this._firestore=t,this._commitHandler=e,this._mutations=[],this._committed=!1,this._dataReader=iR(t)}function EO(t){var e=this;return(e=_O.call(this)||this).firestore=t,e}function SO(t,e){if((t=Zo(t)).firestore!==e)throw new tb(Zm.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}var CO,kO=(Xi(NO,CO=G),NO.prototype.convertBytes=function(t){return new BA(t)},NO.prototype.convertReference=function(t){t=this.convertDocumentKey(t,this.firestore._databaseId);return new yA(this.firestore,null,t)},NO);function NO(t){var e=this;return(e=CO.call(this)||this).firestore=t,e}function AO(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];t=fA(t,yA);var o=fA(t.firestore,xA),a=iR(o);return OO(o,[("string"==typeof(e=Zo(e))||e instanceof VA?TR(a,"updateDoc",t._key,e,n,r):IR(a,"updateDoc",t._key,e)).toMutation(t._key,Cw.exists(!0))])}function RO(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];e=Zo(e);var r={includeMetadataChanges:!1},i=0;"object"!=typeof n[i]||OA(n[i])||(r=n[i],i++);var o,a,s,u,c,h,l={includeMetadataChanges:r.includeMetadataChanges};return OA(n[i])&&(o=n[i],n[i]=null===(r=o.next)||void 0===r?void 0:r.bind(o),n[i+1]=null===(r=o.error)||void 0===r?void 0:r.bind(o),n[i+2]=null===(r=o.complete)||void 0===r?void 0:r.bind(o)),e instanceof yA?(s=fA(e.firestore,xA),u=W_(e._key.path),h={next:function(t){n[i]&&n[i](PO(s,e,t))},error:n[i+1],complete:n[i+2]}):(a=fA(e,mA),s=fA(a.firestore,xA),u=a._query,c=new kO(s),h={next:function(t){n[i]&&n[i](new HR(s,c,a,t))},error:n[i+1],complete:n[i+2]},JR(e._query)),function(n,t,e){var r=this,i=new CN(h),o=new Ok(t,i,e);return n.asyncQueue.enqueueAndForget(function(){return $i(r,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=Nk,[4,WN(n)];case 1:return[2,e.apply(void 0,[t.sent(),o])]}})})}),function(){i.Wo(),n.asyncQueue.enqueueAndForget(function(){return $i(r,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=Ak,[4,WN(n)];case 1:return[2,e.apply(void 0,[t.sent(),o])]}})})})}}(FA(s),u,l)}function OO(t,e){return function(n,r){var t=this,i=new ET;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=Yk,[4,KN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}(FA(t),e)}function PO(t,e,n){var r=n.docs.get(e._key),i=new kO(t);return new KR(t,i,e._key,r,new BR(n.hasPendingWrites,n.fromCache),e._converter)}var DO,xO=(MO.prototype.get=function(t){var e=this,n=SO(t,this._firestore),r=new wO(this._firestore);return this._transaction.lookup([n._key]).then(function(t){if(!t||1!==t.length)return ub();t=t[0];if(t.isFoundDocument())return new LR(e._firestore,r,t.key,t,n._converter);if(t.isNoDocument())return new LR(e._firestore,r,n._key,null,n._converter);throw ub()})},MO.prototype.set=function(t,e,n){t=SO(t,this._firestore),e=bO(t._converter,e,n),n=oR(this._dataReader,"Transaction.set",t._key,e,null!==t._converter,n);return this._transaction.set(t._key,n),this},MO.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];t=SO(t,this._firestore),e="string"==typeof(e=Zo(e))||e instanceof VA?TR(this._dataReader,"Transaction.update",t._key,e,n,r):IR(this._dataReader,"Transaction.update",t._key,e);return this._transaction.update(t._key,e),this},MO.prototype.delete=function(t){t=SO(t,this._firestore);return this._transaction.delete(t._key),this},Xi(LO,DO=MO),LO.prototype.get=function(t){var e=this,n=SO(t,this._firestore),r=new kO(this._firestore);return DO.prototype.get.call(this,t).then(function(t){return new KR(e._firestore,r,n._key,t._document,new BR(!1,!1),n._converter)})},LO);function LO(t,e){var n=this;return(n=DO.call(this,t,e)||this)._firestore=t,n}function MO(t,e){this._firestore=t,this._transaction=e,this._dataReader=iR(t)}function FO(){if("undefined"==typeof Uint8Array)throw new tb(Zm.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function UO(){if("undefined"==typeof atob)throw new tb(Zm.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var jO,qO=(zO.fromBase64String=function(t){return UO(),new zO(BA.fromBase64String(t))},zO.fromUint8Array=function(t){return FO(),new zO(BA.fromUint8Array(t))},zO.prototype.toBase64=function(){return UO(),this._delegate.toBase64()},zO.prototype.toUint8Array=function(){return FO(),this._delegate.toUint8Array()},zO.prototype.isEqual=function(t){return this._delegate.isEqual(t._delegate)},zO.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},zO),VO=(GO.prototype.enableIndexedDbPersistence=function(t,e){return function(t,e){qA(t=fA(t,xA));var n=FA(t),r=t._freezeSettings(),t=new _N;return jA(n,t,new mN(t,r.cacheSizeBytes,null==e?void 0:e.forceOwnership))}(t._delegate,{forceOwnership:e})},GO.prototype.enableMultiTabIndexedDbPersistence=function(t){return function(t){qA(t=fA(t,xA));var e=FA(t),n=t._freezeSettings(),t=new _N;return jA(e,t,new bN(t,n.cacheSizeBytes))}(t._delegate)},GO.prototype.clearIndexedDbPersistence=function(t){return function(n){var t=this;if(n._initialized&&!n._terminated)throw new tb(Zm.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");var r=new ET;return n._queue.enqueueAndForgetEvenWhileRestricted(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return kT.yt()?(e=n+"main",[4,kT.delete(e)]):[2,Promise.resolve()];case 1:return t.sent(),[2]}})})}(dS(n._databaseId,n._persistenceKey))];case 1:return t.sent(),r.resolve(),[3,3];case 2:return e=t.sent(),r.reject(e),[3,3];case 3:return[2]}})})}),r.promise}(t._delegate)},GO),BO=(Object.defineProperty(HO.prototype,"_databaseId",{get:function(){return this._delegate._databaseId},enumerable:!1,configurable:!0}),HO.prototype.settings=function(t){t.merge&&delete(t=Object.assign(Object.assign({},this._delegate._getSettings()),t)).merge,this._delegate._setSettings(t)},HO.prototype.useEmulator=function(t,e){var n,r;n=this._delegate,r=t,t=e,"firestore.googleapis.com"!==(e=(n=fA(n,gA))._getSettings()).host&&e.host!==r&&ab("Host has been set in both settings() and useEmulator(), emulator host will be used"),n._setSettings(Object.assign(Object.assign({},e),{host:r+":"+t,ssl:!1}))},HO.prototype.enableNetwork=function(){return function(i){var t=this;return i.asyncQueue.enqueue(function(){return $i(t,void 0,void 0,function(){var n,r;return Zi(this,function(t){switch(t.label){case 0:return[4,qN(i)];case 1:return n=t.sent(),[4,BN(i)];case 2:return r=t.sent(),[2,(n.setNetworkEnabled(!0),(e=r).$r.delete(0),$C(e))]}var e})})})}(FA(fA(this._delegate,xA)))},HO.prototype.disableNetwork=function(){return function(r){var t=this;return r.asyncQueue.enqueue(function(){return $i(t,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,qN(r)];case 1:return e=t.sent(),[4,BN(r)];case 2:return n=t.sent(),[2,(e.setNetworkEnabled(!1),function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return(e=n).$r.add(0),[4,ZC(e)];case 1:return t.sent(),e.Br.set("Offline"),[2]}})})}(n))]}})})})}(FA(fA(this._delegate,xA)))},HO.prototype.enablePersistence=function(t){var e=!1,n=!1;return t&&uA("synchronizeTabs",e=!!t.synchronizeTabs,"experimentalForceOwningTab",n=!!t.experimentalForceOwningTab),e?this.Yc.enableMultiTabIndexedDbPersistence(this):this.Yc.enableIndexedDbPersistence(this,n)},HO.prototype.clearPersistence=function(){return this.Yc.clearIndexedDbPersistence(this)},HO.prototype.terminate=function(){return this.Xc&&(this.Xc._removeServiceInstance("firestore"),this.Xc._removeServiceInstance("firestore-exp")),this._delegate._delete()},HO.prototype.waitForPendingWrites=function(){return function(n){var t=this,r=new ET;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=Zk,[4,KN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})}),r.promise}(FA(fA(this._delegate,xA)))},HO.prototype.onSnapshotsInSync=function(t){return e=this._delegate,t=t,function(n,t){var e=this,r=new CN(t);return n.asyncQueue.enqueueAndForget(function(){return $i(e,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(t,e){t.Gr.add(e),e.next()},[4,WN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})}),function(){r.Wo(),n.asyncQueue.enqueueAndForget(function(){return $i(e,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(t,e){t.Gr.delete(e)},[4,WN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})})}}(FA(fA(e,xA)),OA(t)?t:{next:t});var e},Object.defineProperty(HO.prototype,"app",{get:function(){if(!this.Xc)throw new tb(Zm.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.Xc},enumerable:!1,configurable:!0}),HO.prototype.collection=function(t){try{return new fP(this,SA(this._delegate,t))}catch(t){throw nP(t,"collection()","Firestore.collection()")}},HO.prototype.doc=function(t){try{return new tP(this,CA(this._delegate,t))}catch(t){throw nP(t,"doc()","Firestore.doc()")}},HO.prototype.collectionGroup=function(t){try{return new cP(this,function(t,e){if(t=fA(t,gA),aA("collectionGroup","collection id",e),0<=e.indexOf("/"))throw new tb(Zm.INVALID_ARGUMENT,"Invalid collection ID '"+e+"' passed to function collectionGroup(). Collection IDs must not contain '/'.");return new mA(t,null,(e=e,new B_(Eb.emptyPath(),e)))}(this._delegate,t))}catch(t){throw nP(t,"collectionGroup()","Firestore.collectionGroup()")}},HO.prototype.runTransaction=function(e){var n,r=this;return function(n,r){var t=this,i=new ET;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,jN(n).then(function(t){return t.datastore})];case 1:return e=t.sent(),new AN(n.asyncQueue,e,r,i).run(),[2]}})})}),i.promise}(FA(n=this._delegate),function(t){return t=new xO(n,t),e(new QO(r,t))})},HO.prototype.batch=function(){var e=this;return FA(this._delegate),new YO(new IO(this._delegate,function(t){return OO(e._delegate,t)}))},HO.prototype.loadBundle=function(t){throw new tb(Zm.FAILED_PRECONDITION,'"loadBundle()" does not exist, have you imported "firebase/firestore/bundle"?')},HO.prototype.namedQuery=function(t){throw new tb(Zm.FAILED_PRECONDITION,'"namedQuery()" does not exist, have you imported "firebase/firestore/bundle"?')},HO),KO=(Xi(WO,jO=G),WO.prototype.convertBytes=function(t){return new qO(new BA(t))},WO.prototype.convertReference=function(t){t=this.convertDocumentKey(t,this.firestore._databaseId);return tP.Zc(t,this.firestore,null)},WO);function WO(t){var e=this;return(e=jO.call(this)||this).firestore=t,e}function HO(t,e,n){var r=this;this._delegate=e,this.Yc=n,this.INTERNAL={delete:function(){return r.terminate()}},t instanceof YN||(this.Xc=t)}function GO(){}function zO(t){this._delegate=t}var QO=(ZO.prototype.get=function(t){var e=this,n=bP(t);return this._delegate.get(n).then(function(t){return new sP(e._firestore,new KR(e._firestore._delegate,e._userDataWriter,t._key,t._document,t.metadata,n._converter))})},ZO.prototype.set=function(t,e,n){t=bP(t);return n?(sA("Transaction.set",n),this._delegate.set(t,e,n)):this._delegate.set(t,e),this},ZO.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];var o=bP(t);return 2===arguments.length?this._delegate.update(o,e):(t=this._delegate).update.apply(t,no([o,e,n],r)),this},ZO.prototype.delete=function(t){t=bP(t);return this._delegate.delete(t),this},ZO),YO=($O.prototype.set=function(t,e,n){t=bP(t);return n?(sA("WriteBatch.set",n),this._delegate.set(t,e,n)):this._delegate.set(t,e),this},$O.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];var o=bP(t);return 2===arguments.length?this._delegate.update(o,e):(t=this._delegate).update.apply(t,no([o,e,n],r)),this},$O.prototype.delete=function(t){t=bP(t);return this._delegate.delete(t),this},$O.prototype.commit=function(){return this._delegate.commit()},$O),XO=(JO.prototype.fromFirestore=function(t,e){t=new WR(this._firestore._delegate,this._userDataWriter,t._key,t._document,t.metadata,null);return this._delegate.fromFirestore(new uP(this._firestore,t),null!=e?e:{})},JO.prototype.toFirestore=function(t,e){return e?this._delegate.toFirestore(t,e):this._delegate.toFirestore(t)},JO.tu=function(t,e){var n=JO.eu,r=n.get(t);r||(r=new WeakMap,n.set(t,r));n=r.get(e);return n||(n=new JO(t,new KO(t),e),r.set(e,n)),n},JO);function JO(t,e,n){this._firestore=t,this._userDataWriter=e,this._delegate=n}function $O(t){this._delegate=t}function ZO(t,e){this._firestore=t,this._delegate=e,this._userDataWriter=new KO(t)}XO.eu=new WeakMap;var tP=(eP.nu=function(t,e,n){if(t.length%2!=0)throw new tb(Zm.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.canonicalString()+" has "+t.length);return new eP(e,new yA(e._delegate,n,new Kb(t)))},eP.Zc=function(t,e,n){return new eP(e,new yA(e._delegate,n,t))},Object.defineProperty(eP.prototype,"id",{get:function(){return this._delegate.id},enumerable:!1,configurable:!0}),Object.defineProperty(eP.prototype,"parent",{get:function(){return new fP(this.firestore,this._delegate.parent)},enumerable:!1,configurable:!0}),Object.defineProperty(eP.prototype,"path",{get:function(){return this._delegate.path},enumerable:!1,configurable:!0}),eP.prototype.collection=function(t){try{return new fP(this.firestore,SA(this._delegate,t))}catch(t){throw nP(t,"collection()","DocumentReference.collection()")}},eP.prototype.isEqual=function(t){return(t=Zo(t))instanceof yA&&kA(this._delegate,t)},eP.prototype.set=function(t,e){e=sA("DocumentReference.set",e);try{return function(t,e,n){t=fA(t,yA);var r=fA(t.firestore,xA),e=bO(t._converter,e,n);return OO(r,[oR(iR(r),"setDoc",t._key,e,null!==t._converter,n).toMutation(t._key,Cw.none())])}(this._delegate,t,e)}catch(t){throw nP(t,"setDoc()","DocumentReference.set()")}},eP.prototype.update=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];try{return 1===arguments.length?AO(this._delegate,t):AO.apply(void 0,no([this._delegate,t,e],n))}catch(t){throw nP(t,"updateDoc()","DocumentReference.update()")}},eP.prototype.delete=function(){return OO(fA((t=this._delegate).firestore,xA),[new Hw(t._key,Cw.none())]);var t},eP.prototype.onSnapshot=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=rP(t),i=iP(t,function(t){return new sP(e.firestore,new KR(e.firestore._delegate,e._userDataWriter,t._key,t._document,t.metadata,e._delegate._converter))});return RO(this._delegate,r,i)},eP.prototype.get=function(t){var e=this;return("cache"===(null==t?void 0:t.source)?function(e){e=fA(e,yA);var n=fA(e.firestore,xA),t=FA(n),r=new kO(n);return function(n,r){var t=this,i=new ET;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(o,a,s){return $i(this,void 0,void 0,function(){var r,i;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(e=a,(n=o).persistence.runTransaction("read document","readonly",function(t){return n.Mn.mn(t,e)}))];case 1:return(i=t.sent()).isFoundDocument()?s.resolve(i):i.isNoDocument()?s.resolve(null):s.reject(new tb(Zm.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(),i=bk(r,"Failed to get document '"+a+" from cache"),s.reject(i),[3,3];case 3:return[2]}var e,n})})},[4,VN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}(t,e._key).then(function(t){return new KR(n,r,e._key,t,new BR(null!==t&&t.hasLocalMutations,!0),e._converter)})}:"server"===(null==t?void 0:t.source)?function(e){e=fA(e,yA);var n=fA(e.firestore,xA);return HN(FA(n),e._key,{source:"server"}).then(function(t){return PO(n,e,t)})}:function(e){e=fA(e,yA);var n=fA(e.firestore,xA);return HN(FA(n),e._key).then(function(t){return PO(n,e,t)})})(this._delegate).then(function(t){return new sP(e.firestore,new KR(e.firestore._delegate,e._userDataWriter,t._key,t._document,t.metadata,e._delegate._converter))})},eP.prototype.withConverter=function(t){return new eP(this.firestore,t?this._delegate.withConverter(XO.tu(this.firestore,t)):this._delegate.withConverter(null))},eP);function eP(t,e){this.firestore=t,this._delegate=e,this._userDataWriter=new KO(t)}function nP(t,e,n){return t.message=t.message.replace(e,n),t}function rP(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];if("object"==typeof r&&!OA(r))return r}return{}}function iP(t,e){var n;return{next:function(t){n.next&&n.next(e(t))},error:null===(t=(n=OA(t[0])?t[0]:OA(t[1])?t[1]:"function"==typeof t[0]?{next:t[0],error:t[1],complete:t[2]}:{next:t[1],error:t[2],complete:t[3]}).error)||void 0===t?void 0:t.bind(n),complete:null===(t=n.complete)||void 0===t?void 0:t.bind(n)}}var oP,aP,sP=(Object.defineProperty(mP.prototype,"ref",{get:function(){return new tP(this._firestore,this._delegate.ref)},enumerable:!1,configurable:!0}),Object.defineProperty(mP.prototype,"id",{get:function(){return this._delegate.id},enumerable:!1,configurable:!0}),Object.defineProperty(mP.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(mP.prototype,"exists",{get:function(){return this._delegate.exists()},enumerable:!1,configurable:!0}),mP.prototype.data=function(t){return this._delegate.data(t)},mP.prototype.get=function(t,e){return this._delegate.get(t,e)},mP.prototype.isEqual=function(t){return XR(this._delegate,t._delegate)},mP),uP=(Xi(yP,aP=sP),yP.prototype.data=function(t){return this._delegate.data(t)},yP),cP=(gP.prototype.where=function(t,e,n){try{return new gP(this.firestore,$R(this._delegate,(r=n,i=e,o=jR("where",t),new iO(o,i,r))))}catch(t){throw nP(t,/(orderBy|where)\(\)/,"Query.$1()")}var r,i,o},gP.prototype.orderBy=function(t,e){try{return new gP(this.firestore,$R(this._delegate,(n=void 0===e?"asc":e,r=jR("orderBy",t),new oO(r,n))))}catch(t){throw nP(t,/(orderBy|where)\(\)/,"Query.$1()")}var n,r},gP.prototype.limit=function(t){try{return new gP(this.firestore,$R(this._delegate,(pA("limit",e=t),new aO("limit",e,"F"))))}catch(t){throw nP(t,"limit()","Query.limit()")}var e},gP.prototype.limitToLast=function(t){try{return new gP(this.firestore,$R(this._delegate,(pA("limitToLast",e=t),new aO("limitToLast",e,"L"))))}catch(t){throw nP(t,"limitToLast()","Query.limitToLast()")}var e},gP.prototype.startAt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new gP(this.firestore,$R(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new sO("startAt",t,!0)}.apply(void 0,t)))}catch(t){throw nP(t,"startAt()","Query.startAt()")}},gP.prototype.startAfter=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new gP(this.firestore,$R(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new sO("startAfter",t,!1)}.apply(void 0,t)))}catch(t){throw nP(t,"startAfter()","Query.startAfter()")}},gP.prototype.endBefore=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new gP(this.firestore,$R(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new uO("endBefore",t,!0)}.apply(void 0,t)))}catch(t){throw nP(t,"endBefore()","Query.endBefore()")}},gP.prototype.endAt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new gP(this.firestore,$R(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new uO("endAt",t,!1)}.apply(void 0,t)))}catch(t){throw nP(t,"endAt()","Query.endAt()")}},gP.prototype.isEqual=function(t){return NA(this._delegate,t._delegate)},gP.prototype.get=function(t){var e=this;return("cache"===(null==t?void 0:t.source)?function(e){e=fA(e,mA);var n=fA(e.firestore,xA),t=FA(n),r=new kO(n);return function(n,r){var t=this,i=new ET;return n.asyncQueue.enqueueAndForget(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(i,o,a){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,PS(i,o,!0)];case 1:return r=t.sent(),e=new Bk(o,r.Bn),n=e._o(r.documents),n=e.applyChanges(n,!1),a.resolve(n.snapshot),[3,3];case 2:return n=t.sent(),r=bk(n,"Failed to execute query '"+o+" against cache"),a.reject(r),[3,3];case 3:return[2]}})})},[4,VN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}(t,e._query).then(function(t){return new HR(n,r,e,t)})}:"server"===(null==t?void 0:t.source)?function(e){e=fA(e,mA);var n=fA(e.firestore,xA),t=FA(n),r=new kO(n);return GN(t,e._query,{source:"server"}).then(function(t){return new HR(n,r,e,t)})}:function(e){e=fA(e,mA);var n=fA(e.firestore,xA),t=FA(n),r=new kO(n);return JR(e._query),GN(t,e._query).then(function(t){return new HR(n,r,e,t)})})(this._delegate).then(function(t){return new lP(e.firestore,new HR(e.firestore._delegate,e._userDataWriter,e._delegate,t._snapshot))})},gP.prototype.onSnapshot=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=rP(t),i=iP(t,function(t){return new lP(e.firestore,new HR(e.firestore._delegate,e._userDataWriter,e._delegate,t._snapshot))});return RO(this._delegate,r,i)},gP.prototype.withConverter=function(t){return new gP(this.firestore,t?this._delegate.withConverter(XO.tu(this.firestore,t)):this._delegate.withConverter(null))},gP),hP=(Object.defineProperty(vP.prototype,"type",{get:function(){return this._delegate.type},enumerable:!1,configurable:!0}),Object.defineProperty(vP.prototype,"doc",{get:function(){return new uP(this._firestore,this._delegate.doc)},enumerable:!1,configurable:!0}),Object.defineProperty(vP.prototype,"oldIndex",{get:function(){return this._delegate.oldIndex},enumerable:!1,configurable:!0}),Object.defineProperty(vP.prototype,"newIndex",{get:function(){return this._delegate.newIndex},enumerable:!1,configurable:!0}),vP),lP=(Object.defineProperty(dP.prototype,"query",{get:function(){return new cP(this._firestore,this._delegate.query)},enumerable:!1,configurable:!0}),Object.defineProperty(dP.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(dP.prototype,"size",{get:function(){return this._delegate.size},enumerable:!1,configurable:!0}),Object.defineProperty(dP.prototype,"empty",{get:function(){return this._delegate.empty},enumerable:!1,configurable:!0}),Object.defineProperty(dP.prototype,"docs",{get:function(){var e=this;return this._delegate.docs.map(function(t){return new uP(e._firestore,t)})},enumerable:!1,configurable:!0}),dP.prototype.docChanges=function(t){var e=this;return this._delegate.docChanges(t).map(function(t){return new hP(e._firestore,t)})},dP.prototype.forEach=function(e,n){var r=this;this._delegate.forEach(function(t){e.call(n,new uP(r._firestore,t))})},dP.prototype.isEqual=function(t){return XR(this._delegate,t._delegate)},dP),fP=(Xi(pP,oP=cP),Object.defineProperty(pP.prototype,"id",{get:function(){return this._delegate.id},enumerable:!1,configurable:!0}),Object.defineProperty(pP.prototype,"path",{get:function(){return this._delegate.path},enumerable:!1,configurable:!0}),Object.defineProperty(pP.prototype,"parent",{get:function(){var t=this._delegate.parent;return t?new tP(this.firestore,t):null},enumerable:!1,configurable:!0}),pP.prototype.doc=function(t){try{return new tP(this.firestore,void 0===t?CA(this._delegate):CA(this._delegate,t))}catch(t){throw nP(t,"doc()","CollectionReference.doc()")}},pP.prototype.add=function(t){var e,n,r,i=this;return e=this._delegate,n=t,t=fA(e.firestore,xA),r=CA(e),n=bO(e._converter,n),OO(t,[oR(iR(e.firestore),"addDoc",r._key,n,null!==e._converter,{}).toMutation(r._key,Cw.exists(!1))]).then(function(){return r}).then(function(t){return new tP(i.firestore,t)})},pP.prototype.isEqual=function(t){return kA(this._delegate,t._delegate)},pP.prototype.withConverter=function(t){return new pP(this.firestore,t?this._delegate.withConverter(XO.tu(this.firestore,t)):this._delegate.withConverter(null))},pP);function pP(t,e){var n=this;return(n=oP.call(this,t,e)||this).firestore=t,n._delegate=e,n}function dP(t,e){this._firestore=t,this._delegate=e}function vP(t,e){this._firestore=t,this._delegate=e}function gP(t,e){this.firestore=t,this._delegate=e,this._userDataWriter=new KO(t)}function yP(){return null!==aP&&aP.apply(this,arguments)||this}function mP(t,e){this._firestore=t,this._delegate=e}function bP(t){return fA(t,yA)}wP.documentId=function(){return new wP(Cb.keyField().canonicalString())},wP.prototype.isEqual=function(t){return(t=Zo(t))instanceof VA&&this._delegate._internalPath.isEqual(t._internalPath)},Sn=wP,_P.serverTimestamp=function(){var t=new dR("serverTimestamp");return t._methodName="FieldValue.serverTimestamp",new _P(t)},_P.delete=function(){var t=new sR("deleteField");return t._methodName="FieldValue.delete",new _P(t)},_P.arrayUnion=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new vR("arrayUnion",t)}.apply(void 0,t);return n._methodName="FieldValue.arrayUnion",new _P(n)},_P.arrayRemove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new gR("arrayRemove",t)}.apply(void 0,t);return n._methodName="FieldValue.arrayRemove",new _P(n)},_P.increment=function(t){t=new yR("increment",t);return t._methodName="FieldValue.increment",new _P(t)},_P.prototype.isEqual=function(t){return this._delegate.isEqual(t._delegate)},G=_P;function _P(t){this._delegate=t}function wP(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._delegate=new(VA.bind.apply(VA,no([void 0],t)))}function IP(t){return e=this._delegate,a=t,n=FA(e=fA(e,xA)),t=new DA,function(n,t,r){var e,i=this,o=(e=a,t=MC(t),e=function(t){if(t instanceof Uint8Array)return SN(t,void 0);if(t instanceof ArrayBuffer)return SN(new Uint8Array(t),void 0);if(t instanceof ReadableStream)return t.getReader();throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream")}("string"==typeof e?(new TextEncoder).encode(e):e),new kN(e,t));n.asyncQueue.enqueueAndForget(function(){return $i(i,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=dN,[4,KN(n)];case 1:return e.apply(void 0,[t.sent(),o,r]),[2]}})})})}(n,e._databaseId,t),t;var e,a,n}function TP(t){var e=this,n=this._delegate,t=t;return function(n,r){var t=this;return n.asyncQueue.enqueue(function(){return $i(t,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(t,e){var n=t;return n.persistence.runTransaction("Get named query","readonly",function(t){return n.Qe.getNamedQuery(t,e)})},[4,VN(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})})}(FA(n=fA(n,xA)),t).then(function(t){return t?new mA(n,null,t.query):null}).then(function(t){return t?new cP(e,t):null})}var EP,SP,CP={Firestore:BO,GeoPoint:WA,Timestamp:vb,Blob:qO,Transaction:QO,WriteBatch:YO,DocumentReference:tP,DocumentSnapshot:sP,Query:cP,QueryDocumentSnapshot:uP,QuerySnapshot:lP,CollectionReference:fP,FieldPath:Sn,FieldValue:G,setLogLevel:function(t){eb.setLogLevel(t)},CACHE_SIZE_UNLIMITED:-1};(EP=Xl).INTERNAL.registerComponent(new ta("firestore",function(t){var e=t.getProvider("app").getImmediate();return e=e,t=t.getProvider("auth-internal"),new BO(e,new xA(e,t),new VO)},"PUBLIC").setServiceProps(Object.assign({},CP))),EP.registerVersion("@firebase/firestore","2.2.5"),(SP=BO).prototype.loadBundle=IP,SP.prototype.namedQuery=TP;var kP,NP={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"},AP=(Xi(RP,kP=Error),RP);function RP(t,e,n){e=kP.call(this,e)||this;return Object.setPrototypeOf(e,RP.prototype),e.code=t,e.details=n,e}function OP(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 a=e&&e.error;if(a){var s=a.status;if("string"==typeof s){if(!NP[s])return new AP("internal","internal");r=NP[s],i=s}s=a.message;"string"==typeof s&&(i=s),void 0!==(o=a.details)&&(o=n.decode(o))}}catch(t){}return"ok"===r?null:new AP(r,i,o)}var PP=(DP.prototype.getAuthToken=function(){return $i(this,void 0,void 0,function(){var e;return Zi(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]}})})},DP.prototype.getInstanceIdToken=function(){return $i(this,void 0,void 0,function(){return Zi(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]})})},DP.prototype.getContext=function(){return $i(this,void 0,void 0,function(){var e,n;return Zi(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}]}})})},DP);function DP(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 xP(t,e){var n,r={};for(n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}var LP=(MP.prototype.encode=function(t){var e=this;if(null==t)return null;if("number"==typeof(t=t instanceof Number?t.valueOf():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 xP(t,function(t){return e.encode(t)});throw new Error("Data cannot be encoded in JSON: "+t)},MP.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?xP(t,function(t){return e.decode(t)}):t},MP);function MP(){}var FP=(Object.defineProperty(UP.prototype,"app",{get:function(){return this.app_},enumerable:!1,configurable:!0}),UP.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},UP.prototype.useEmulator=function(t,e){this.emulatorOrigin="http://"+t+":"+e},UP.prototype.useFunctionsEmulator=function(t){this.emulatorOrigin=t},UP.prototype.httpsCallable=function(e,n){var r=this;return function(t){return r.call(e,t,n||{})}},UP.prototype.postJSON=function(r,i,o){return $i(this,void 0,void 0,function(){var e,n;return Zi(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}]}})})},UP.prototype.call=function(c,h,l){return $i(this,void 0,void 0,function(){var i,o,a,s,u;return Zi(this,function(t){switch(t.label){case 0:return i=this._url(c),h=this.serializer.encode(h),o={data:h},a={},[4,this.contextProvider.getContext()];case 1:return(s=t.sent()).authToken&&(a.Authorization="Bearer "+s.authToken),s.instanceIdToken&&(a["Firebase-Instance-ID-Token"]=s.instanceIdToken),u=l.timeout||7e4,n=u,e=new Promise(function(t,e){r=setTimeout(function(){e(new AP("deadline-exceeded","deadline-exceeded"))},n)}),u=(s={timer:r,promise:e}).timer,s=s.promise,[4,Promise.race([jP(u,this.postJSON(i,o,a)),s,jP(u,this.cancelAllRequests)])];case 2:if(!(s=t.sent()))throw new AP("cancelled","Firebase Functions instance was deleted.");if(u=OP(s.status,s.json,this.serializer))throw u;if(!s.json)throw new AP("internal","Response is not valid JSON object.");if(void 0===(u=void 0===(u=s.json.data)?s.json.result:u))throw new AP("internal","Response is missing data field.");return[2,{data:this.serializer.decode(u)}]}var n,r,e})})},UP);function UP(t,e,n,r,i){var o=this;void 0===r&&(r="us-central1"),this.app_=t,this.fetchImpl=i,this.serializer=new LP,this.emulatorOrigin=null,this.INTERNAL={delete:function(){return Promise.resolve(o.deleteService())}},this.contextProvider=new PP(e,n),this.cancelAllRequests=new Promise(function(t){o.deleteService=function(){return t()}});try{var a=new URL(r);this.customDomain=a.origin,this.region="us-central1"}catch(t){this.customDomain=null,this.region=r}}function jP(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,r];case 1:return e=t.sent(),clearTimeout(n),[2,e]}})})}var qP,VP,BP;function KP(n){return new Promise(function(t,e){n.onsuccess=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function WP(n,r,i){var o,t=new Promise(function(t,e){KP(o=n[r].apply(n,i)).then(t,e)});return t.request=o,t}function HP(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 GP(e,n,r,t){t.forEach(function(t){t in r.prototype&&(e.prototype[t]=function(){return WP(this[n],t,arguments)})})}function zP(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 QP(t,r,e,n){n.forEach(function(n){n in e.prototype&&(t.prototype[n]=function(){return t=this[r],(e=WP(t,n,arguments)).then(function(t){if(t)return new XP(t,e.request)});var t,e})})}function YP(t){this._index=t}function XP(t,e){this._cursor=t,this._request=e}function JP(t){this._store=t}function $P(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 ZP(t,e,n){this._db=t,this.oldVersion=e,this.transaction=new $P(n)}function tD(t){this._db=t}function eD(t,e,n){var e=WP(indexedDB,"open",[t,e]),r=e.request;return r&&(r.onupgradeneeded=function(t){n&&n(new ZP(r.result,t.oldVersion,r.transaction))}),e.then(function(t){return new tD(t)})}function nD(t){return WP(indexedDB,"deleteDatabase",[t])}qP=Xl,VP=fetch.bind(self),BP={Functions:FP},qP.INTERNAL.registerComponent(new ta("functions",function(t,e){var n=e.instanceIdentifier,r=t.getProvider("app").getImmediate(),e=t.getProvider("auth-internal"),t=t.getProvider("messaging");return new FP(r,e,t,n,VP)},"PUBLIC").setServiceProps(BP).setMultipleInstances(!0)),Xl.registerVersion("@firebase/functions","0.6.7"),HP(YP,"_index",["name","keyPath","multiEntry","unique"]),GP(YP,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),QP(YP,"_index",IDBIndex,["openCursor","openKeyCursor"]),HP(XP,"_cursor",["direction","key","primaryKey","value"]),GP(XP,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(XP.prototype[n]=function(){var e=this,t=arguments;return Promise.resolve().then(function(){return e._cursor[n].apply(e._cursor,t),KP(e._request).then(function(t){if(t)return new XP(t,e._request)})})})}),JP.prototype.createIndex=function(){return new YP(this._store.createIndex.apply(this._store,arguments))},JP.prototype.index=function(){return new YP(this._store.index.apply(this._store,arguments))},HP(JP,"_store",["name","keyPath","indexNames","autoIncrement"]),GP(JP,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),QP(JP,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),zP(JP,"_store",IDBObjectStore,["deleteIndex"]),$P.prototype.objectStore=function(){return new JP(this._tx.objectStore.apply(this._tx,arguments))},HP($P,"_tx",["objectStoreNames","mode"]),zP($P,"_tx",IDBTransaction,["abort"]),ZP.prototype.createObjectStore=function(){return new JP(this._db.createObjectStore.apply(this._db,arguments))},HP(ZP,"_db",["name","version","objectStoreNames"]),zP(ZP,"_db",IDBDatabase,["deleteObjectStore","close"]),tD.prototype.transaction=function(){return new $P(this._db.transaction.apply(this._db,arguments))},HP(tD,"_db",["name","version","objectStoreNames"]),zP(tD,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach(function(i){[JP,YP].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)}})})}),[YP,JP].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 rD=1e4,iD="w:0.4.25",oD="FIS_v2",aD="https://firebaseinstallations.googleapis.com/v1",sD=36e5,G=((Sn={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',Sn["not-registered"]="Firebase Installation is not registered.",Sn["installation-not-found"]="Firebase Installation not found.",Sn["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',Sn["app-offline"]="Could not process request. Application offline.",Sn["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",Sn),uD=new Co("installations","Installations",G);function cD(t){return t instanceof Eo&&t.code.includes("request-failed")}function hD(t){t=t.projectId;return aD+"/projects/"+t+"/installations"}function lD(t){return{token:t.token,requestStatus:2,expiresIn:(t=t.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()}}function fD(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,r.json()];case 1:return e=t.sent(),e=e.error,[2,uD.create("request-failed",{requestName:n,serverCode:e.code,serverMessage:e.message,serverStatus:e.status})]}})})}function pD(t){t=t.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function dD(t,e){e=e.refreshToken,t=pD(t);return t.append("Authorization",oD+" "+e),t}function vD(n){return $i(this,void 0,void 0,function(){var e;return Zi(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 gD(e){return new Promise(function(t){setTimeout(t,e)})}var yD=/^[cdef][\w-]{21}$/,mD="";function bD(){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,no([],eo(t)))).replace(/\+/g,"-").replace(/\//g,"_")}(t).substr(0,22);return yD.test(t)?t:mD}catch(t){return mD}}function _D(t){return t.appName+"!"+t.appId}var wD=new Map;function ID(t,e){t=_D(t);TD(t,e),function(t,e){var n=SD();n&&n.postMessage({key:t,fid:e});CD()}(t,e)}function TD(t,e){var n,r,i=wD.get(t);if(i)try{for(var o=to(i),a=o.next();!a.done;a=o.next())(0,a.value)(e)}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}var ED=null;function SD(){return!ED&&"BroadcastChannel"in self&&((ED=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(t){TD(t.data.key,t.data.fid)}),ED}function CD(){0===wD.size&&ED&&(ED.close(),ED=null)}var kD,ND="firebase-installations-database",AD=1,RD="firebase-installations-store",OD=null;function PD(){return OD=OD||eD(ND,AD,function(t){0===t.oldVersion&&t.createObjectStore(RD)})}function DD(o,a){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return e=_D(o),[4,PD()];case 1:return r=t.sent(),n=r.transaction(RD,"readwrite"),[4,(r=n.objectStore(RD)).get(e)];case 2:return i=t.sent(),[4,r.put(a,e)];case 3:return t.sent(),[4,n.complete];case 4:return t.sent(),i&&i.fid===a.fid||ID(o,a.fid),[2,a]}})})}function xD(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return e=_D(r),[4,PD()];case 1:return n=t.sent(),[4,(n=n.transaction(RD,"readwrite")).objectStore(RD).delete(e)];case 2:return t.sent(),[4,n.complete];case 3:return t.sent(),[2]}})})}function LD(a,s){return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return e=_D(a),[4,PD()];case 1:return r=t.sent(),n=r.transaction(RD,"readwrite"),[4,(r=n.objectStore(RD)).get(e)];case 2:return i=t.sent(),void 0!==(o=s(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||ID(a,o.fid),[2,o]}})})}function MD(i){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return[4,LD(i,function(t){t=UD(t||{fid:bD(),registrationStatus:0}),t=function(t,e){{if(0!==e.registrationStatus)return 1===e.registrationStatus?{installationEntry:e,registrationPromise:function(i){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return[4,FD(i)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.registrationStatus?[3,5]:[4,gD(100)];case 3:return t.sent(),[4,FD(i)];case 4:return e=t.sent(),[3,2];case 5:return 0!==e.registrationStatus?[3,7]:[4,MD(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(uD.create("app-offline"));return{installationEntry:e,registrationPromise:n}}e={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},t=function(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,function(a,t){var s=t.fid;return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return e=hD(a),n=pD(a),o={fid:s,authVersion:oD,appId:a.appId,sdkVersion:iD},r={method:"POST",headers:n,body:JSON.stringify(o)},[4,vD(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||s,registrationStatus:2,refreshToken:o.refreshToken,authToken:lD(o.authToken)}];case 3:return[4,fD("Create Installation",i)];case 4:throw t.sent()}})})}(r,i)];case 1:return e=t.sent(),[2,DD(r,e)];case 2:return cD(n=t.sent())&&409===n.customData.serverCode?[4,xD(r)]:[3,4];case 3:return t.sent(),[3,6];case 4:return[4,DD(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!==mD?[3,3]:(r={},[4,e]);case 2:return[2,(r.installationEntry=t.sent(),r)];case 3:return[2,{installationEntry:n,registrationPromise:e}]}})})}function FD(t){return LD(t,function(t){if(!t)throw uD.create("installation-not-found");return UD(t)})}function UD(t){return 1===(e=t).registrationStatus&&e.registrationTime+rD<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}function jD(t,a){var s=t.appConfig,u=t.platformLoggerProvider;return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return e=function(t,e){e=e.fid;return hD(t)+"/"+e+"/authTokens:generate"}(s,a),n=dD(s,a),(o=u.getImmediate({optional:!0}))&&n.append("x-firebase-client",o.getPlatformInfoString()),o={installation:{sdkVersion:iD}},r={method:"POST",headers:n,body:JSON.stringify(o)},[4,vD(function(){return fetch(e,r)})];case 1:return(i=t.sent()).ok?[4,i.json()]:[3,3];case 2:return o=t.sent(),[2,lD(o)];case 3:return[4,fD("Generate Auth Token",i)];case 4:throw t.sent()}})})}function qD(i,o){return void 0===o&&(o=!1),$i(this,void 0,void 0,function(){var r,e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,LD(i.appConfig,function(t){if(!BD(t))throw uD.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+sD}(e)){if(1===n.requestStatus)return r=function(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,VD(n.appConfig)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.authToken.requestStatus?[3,5]:[4,gD(100)];case 3:return t.sent(),[4,VD(n.appConfig)];case 4:return e=t.sent(),[3,2];case 5:return 0===(e=e.authToken).requestStatus?[2,qD(n,r)]:[2,e]}})})}(i,o),t;if(!navigator.onLine)throw uD.create("app-offline");n=(e=t,n={requestStatus:1,requestTime:Date.now()},Ji(Ji({},e),{authToken:n}));return r=function(i,o){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,8]),[4,jD(i,o)];case 1:return e=t.sent(),r=Ji(Ji({},o),{authToken:e}),[4,DD(i.appConfig,r)];case 2:return t.sent(),[2,e];case 3:return!cD(n=t.sent())||401!==n.customData.serverCode&&404!==n.customData.serverCode?[3,5]:[4,xD(i.appConfig)];case 4:return t.sent(),[3,7];case 5:return r=Ji(Ji({},o),{authToken:{requestStatus:0}}),[4,DD(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 VD(t){return LD(t,function(t){if(!BD(t))throw uD.create("not-registered");var e=t.authToken;return 1===(e=e).requestStatus&&e.requestTime+rD<Date.now()?Ji(Ji({},t),{authToken:{requestStatus:0}}):t})}function BD(t){return void 0!==t&&2===t.registrationStatus}function KD(e,n){return void 0===n&&(n=!1),$i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,function(n){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,MD(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,qD(e,n)];case 2:return[2,t.sent().token]}})})}function WD(i,o){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return e=function(t,e){e=e.fid;return hD(t)+"/"+e}(i,o),r=dD(i,o),n={method:"DELETE",headers:r},[4,vD(function(){return fetch(e,n)})];case 1:return(r=t.sent()).ok?[3,3]:[4,fD("Delete Installation",r)];case 2:throw t.sent();case 3:return[2]}})})}function HD(t,r){var i=t.appConfig;return function(t,e){SD();var n=_D(t);(t=wD.get(n))||(t=new Set,wD.set(n,t)),t.add(e)}(i,r),function(){var t,e,n;e=r,n=_D(t=i),(t=wD.get(n))&&(t.delete(e),0===t.size&&wD.delete(n),CD())}}function GD(t){return uD.create("missing-app-config-values",{valueName:t})}(kD=Xl).INTERNAL.registerComponent(new ta("installations",function(t){var e=t.getProvider("app").getImmediate(),n={appConfig:function(t){var e,n;if(!t||!t.options)throw GD("App Configuration");if(!t.name)throw GD("App Name");try{for(var r=to(["projectId","apiKey","appId"]),i=r.next();!i.done;i=r.next()){var o=i.value;if(!t.options[o])throw GD(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 $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,MD(r.appConfig)];case 1:return e=t.sent(),n=e.installationEntry,(e.registrationPromise||qD(r)).catch(console.error),[2,n.fid]}})})}(n)},getToken:function(t){return KD(n,t)},delete:function(){return function(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,LD(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 uD.create("delete-pending-registration");case 2:if(2!==n.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw uD.create("app-offline");case 3:return[4,WD(e,n)];case 4:return t.sent(),[4,xD(e)];case 5:t.sent(),t.label=6;case 6:return[2]}})})}(n)},onIdChange:function(t){return HD(n,t)}}},"PUBLIC")),kD.registerVersion("@firebase/installations","0.4.25");var zD,G=((Sn={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',Sn["only-available-in-window"]="This method is available in a Window context.",Sn["only-available-in-sw"]="This method is available in a service worker context.",Sn["permission-default"]="The notification permission was not granted and dismissed instead.",Sn["permission-blocked"]="The notification permission was not granted and blocked instead.",Sn["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",Sn["failed-service-worker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",Sn["token-subscribe-failed"]="A problem occurred while subscribing the user to FCM: {$errorInfo}",Sn["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",Sn["token-unsubscribe-failed"]="A problem occurred while unsubscribing the user from FCM: {$errorInfo}",Sn["token-update-failed"]="A problem occurred while updating the user from FCM: {$errorInfo}",Sn["token-update-no-token"]="FCM returned no token when updating the user to push.",Sn["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.",Sn["invalid-sw-registration"]="The input to useServiceWorker() must be a ServiceWorkerRegistration.",Sn["invalid-bg-handler"]="The input to setBackgroundMessageHandler() must be a function.",Sn["invalid-vapid-key"]="The public VAPID key must be a string.",Sn["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.",Sn),QD=new Co("messaging","Messaging",G),YD="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",XD="https://fcmregistrations.googleapis.com/v1",JD="FCM_MSG",$D="google.c.a.c_id";function ZD(t){t=new Uint8Array(t);return btoa(String.fromCharCode.apply(String,no([],eo(t)))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(Sn=zD=zD||{}).PUSH_RECEIVED="push-received",Sn.NOTIFICATION_CLICKED="notification-clicked";var tx="fcm_token_details_db",ex=5,nx="fcm_token_object_Store";function rx(a){return $i(this,void 0,void 0,function(){var e,o,n=this;return Zi(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(tx))return[2,null];t.label=2;case 2:return o=null,[4,eD(tx,ex,function(i){return $i(n,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return i.oldVersion<2?[2]:i.objectStoreNames.contains(nx)?[4,(r=i.transaction.objectStore(nx)).index("fcmSenderId").get(a)]:[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:ZD(n.vapidKey)}}}else(3===i.oldVersion||4===i.oldVersion)&&(o={token:(n=e).fcmToken,createTime:n.createTime,subscriptionOptions:{auth:ZD(n.auth),p256dh:ZD(n.p256dh),endpoint:n.endpoint,swScope:n.swScope,vapidKey:ZD(n.vapidKey)}});return[2]}})})})];case 3:return t.sent().close(),[4,nD(tx)];case 4:return t.sent(),[4,nD("fcm_vapid_details_db")];case 5:return t.sent(),[4,nD("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 ix="firebase-messaging-database",ox=1,ax="firebase-messaging-store",sx=null;function ux(){return sx=sx||eD(ix,ox,function(t){0===t.oldVersion&&t.createObjectStore(ax)})}function cx(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return e=lx(r),[4,ux()];case 1:return[4,t.sent().transaction(ax).objectStore(ax).get(e)];case 2:return(e=t.sent())?[2,e]:[3,3];case 3:return[4,rx(r.appConfig.senderId)];case 4:return(n=t.sent())?[4,hx(r,n)]:[3,6];case 5:return t.sent(),[2,n];case 6:return[2]}})})}function hx(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return e=lx(r),[4,ux()];case 1:return n=t.sent(),[4,(n=n.transaction(ax,"readwrite")).objectStore(ax).put(i,e)];case 2:return t.sent(),[4,n.complete];case 3:return t.sent(),[2,i]}})})}function lx(t){return t.appConfig.appId}function fx(r,i){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,dx(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(px(r.appConfig)+"/"+i,e)];case 3:return[4,t.sent().json()];case 4:if((e=t.sent()).error)throw n=e.error.message,QD.create("token-unsubscribe-failed",{errorInfo:n});return[3,6];case 5:throw n=t.sent(),QD.create("token-unsubscribe-failed",{errorInfo:n});case 6:return[2]}})})}function px(t){t=t.projectId;return XD+"/projects/"+t+"/registrations"}function dx(t){var n=t.appConfig,r=t.installations;return $i(this,void 0,void 0,function(){var e;return Zi(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 vx(t){var e=t.p256dh,n=t.auth,r=t.endpoint,t=t.vapidKey,e={web:{endpoint:r,auth:n,p256dh:e}};return t!==YD&&(e.web.applicationPubKey=t),e}function gx(c,h,l){return $i(this,void 0,void 0,function(){var a,s,u;return Zi(this,function(t){switch(t.label){case 0:if("granted"!==Notification.permission)throw QD.create("permission-blocked");return[4,function(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(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,cx(c)];case 2:return a=t.sent(),s={vapidKey:l,swScope:h.scope,endpoint:u.endpoint,auth:ZD(u.getKey("auth")),p256dh:ZD(u.getKey("p256dh"))},a?[3,3]:[2,mx(c,s)];case 3:if(e=a.subscriptionOptions,r=(n=s).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,fx(c,a.token)];case 5:return t.sent(),[3,7];case 6:return u=t.sent(),console.warn(u),[3,7];case 7:return[2,mx(c,s)];case 8:return Date.now()>=a.createTime+6048e5?[2,function(i,o,a){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,5]),[4,function(o,a){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return[4,dx(o)];case 1:e=t.sent(),n=vx(a.subscriptionOptions),n={method:"PATCH",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(px(o.appConfig)+"/"+a.token,n)];case 3:return[4,t.sent().json()];case 4:return r=t.sent(),[3,6];case 5:throw i=t.sent(),QD.create("token-update-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,QD.create("token-update-failed",{errorInfo:i});if(!r.token)throw QD.create("token-update-no-token");return[2,r.token]}})})}(o,i)];case 1:return e=t.sent(),n=Ji(Ji({},i),{token:e,createTime:Date.now()}),[4,hx(o,n)];case 2:return t.sent(),[2,e];case 3:return r=t.sent(),[4,yx(o,a)];case 4:throw t.sent(),r;case 5:return[2]}})})}({token:a.token,createTime:Date.now(),subscriptionOptions:s},c,h)]:[2,a.token];case 9:return[2]}var e,n,r,i,o})})}function yx(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,cx(n)];case 1:return(e=t.sent())?[4,fx(n,e.token)]:[3,4];case 2:return t.sent(),[4,function(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return e=lx(r),[4,ux()];case 1:return n=t.sent(),[4,(n=n.transaction(ax,"readwrite")).objectStore(ax).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 mx(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,function(o,a){return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(this,function(t){switch(t.label){case 0:return[4,dx(o)];case 1:e=t.sent(),n=vx(a),n={method:"POST",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(px(o.appConfig),n)];case 3:return[4,t.sent().json()];case 4:return r=t.sent(),[3,6];case 5:throw i=t.sent(),QD.create("token-subscribe-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,QD.create("token-subscribe-failed",{errorInfo:i});if(!r.token)throw QD.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,hx(n,e)];case 2:return t.sent(),[2,e.token]}})})}function bx(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 _x(t){return"object"==typeof t&&t&&$D in t}function wx(e){return new Promise(function(t){setTimeout(t,e)})}var Ix=(Object.defineProperty(Tx.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),Tx.prototype.setBackgroundMessageHandler=function(t){if(this.isOnBackgroundMessageUsed=!1,!t||"function"!=typeof t)throw QD.create("invalid-bg-handler");this.bgMessageHandler=t},Tx.prototype.onBackgroundMessage=function(t){var e=this;return this.isOnBackgroundMessageUsed=!0,this.bgMessageHandler=t,function(){e.bgMessageHandler=null}},Tx.prototype.getToken=function(){var n;return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return this.vapidKey?[3,2]:[4,cx(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:YD,t.label=2;case 2:return[2,gx(this.firebaseDependencies,self.registration,this.vapidKey)]}})})},Tx.prototype.deleteToken=function(){return yx(this.firebaseDependencies,self.registration)},Tx.prototype.requestPermission=function(){throw QD.create("only-available-in-window")},Tx.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw QD.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw QD.create("invalid-vapid-key");this.vapidKey=t},Tx.prototype.useServiceWorker=function(){throw QD.create("only-available-in-window")},Tx.prototype.onMessage=function(){throw QD.create("only-available-in-window")},Tx.prototype.onTokenRefresh=function(){throw QD.create("only-available-in-window")},Tx.prototype.onPush=function(s){return $i(this,void 0,void 0,function(){var i,o,a;return Zi(this,function(t){switch(t.label){case 0:return(a=function(t){var e=t.data;if(!e)return null;try{return e.json()}catch(t){return null}}(s))?[4,Ex()]:(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=zD.PUSH_RECEIVED;try{for(var i=to(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,a)]:(o=!1,a.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=Ji({},(e=a).notification)).data=((n={})[JD]=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&&(a=bx(a),"function"==typeof this.bgMessageHandler?this.bgMessageHandler(a):this.bgMessageHandler.next(a)),[4,wx(1e3)]);case 4:return t.sent(),[2]}var e,n,r})})},Tx.prototype.onSubChange=function(n){var r;return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return n.newSubscription?[3,2]:[4,yx(this.firebaseDependencies,self.registration)];case 1:return t.sent(),[2];case 2:return[4,cx(this.firebaseDependencies)];case 3:return e=t.sent(),[4,yx(this.firebaseDependencies,self.registration)];case 4:return t.sent(),[4,gx(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:YD)];case 5:return t.sent(),[2]}})})},Tx.prototype.onNotificationClick=function(a){var s;return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:return(e=null===(s=null===(s=a.notification)||void 0===s?void 0:s.data)||void 0===s?void 0:s[JD])?a.action?[2]:(a.stopImmediatePropagation(),a.notification.close(),(n=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 _x(t.data)?self.location.origin:null}(e))?(r=new URL(n,self.location.href),i=new URL(self.location.origin),r.host!==i.host?[2]:[4,function(u){return $i(this,void 0,void 0,function(){var e,n,r,i,o,a,s;return Zi(this,function(t){switch(t.label){case 0:return[4,Ex()];case 1:e=t.sent();try{for(n=to(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){a={error:t}}finally{try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(a)throw a.error}}return[2,null]}})})}(r)]):[2]):[2];case 1:return(o=t.sent())?[3,4]:[4,self.clients.openWindow(n)];case 2:return o=t.sent(),[4,wx(3e3)];case 3:return t.sent(),[3,6];case 4:return[4,o.focus()];case 5:o=t.sent(),t.label=6;case 6:return o?(e.messageType=zD.NOTIFICATION_CLICKED,e.isFirebaseMessaging=!0,[2,o.postMessage(e)]):[2]}})})},Tx);function Tx(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 Ex(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}var Sx=(Object.defineProperty(Cx.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),Cx.prototype.messageEventListener=function(i){return $i(this,void 0,void 0,function(){var n,r;return Zi(this,function(t){switch(t.label){case 0:return(n=i.data).isFirebaseMessaging?(this.onMessageCallback&&n.messageType===zD.PUSH_RECEIVED&&("function"==typeof this.onMessageCallback?this.onMessageCallback((delete(e=Object.assign({},n)).messageType,delete e.isFirebaseMessaging,e)):this.onMessageCallback.next(Object.assign({},n))),_x(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})})},Cx.prototype.getVapidKey=function(){return this.vapidKey},Cx.prototype.getSwReg=function(){return this.swRegistration},Cx.prototype.getToken=function(e){return $i(this,void 0,void 0,function(){return Zi(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 QD.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,gx(this.firebaseDependencies,this.swRegistration,this.vapidKey)]}})})},Cx.prototype.updateVapidKey=function(e){return $i(this,void 0,void 0,function(){return Zi(this,function(t){return e?this.vapidKey=e:this.vapidKey||(this.vapidKey=YD),[2]})})},Cx.prototype.updateSwReg=function(e){return $i(this,void 0,void 0,function(){return Zi(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 QD.create("invalid-sw-registration");return this.swRegistration=e,[2]}})})},Cx.prototype.registerDefaultSw=function(){return $i(this,void 0,void 0,function(){var e;return Zi(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(),QD.create("failed-service-worker-registration",{browserErrorMessage:e.message});case 3:return[2]}})})},Cx.prototype.deleteToken=function(){return $i(this,void 0,void 0,function(){return Zi(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,yx(this.firebaseDependencies,this.swRegistration)]}})})},Cx.prototype.requestPermission=function(){return $i(this,void 0,void 0,function(){var e;return Zi(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?QD.create("permission-blocked"):QD.create("permission-default")}})})},Cx.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw QD.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw QD.create("invalid-vapid-key");this.vapidKey=t},Cx.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw QD.create("invalid-sw-registration");if(this.swRegistration)throw QD.create("use-sw-after-get-token");this.swRegistration=t},Cx.prototype.onMessage=function(t){var e=this;return this.onMessageCallback=t,function(){e.onMessageCallback=null}},Cx.prototype.setBackgroundMessageHandler=function(){throw QD.create("only-available-in-sw")},Cx.prototype.onBackgroundMessage=function(){throw QD.create("only-available-in-sw")},Cx.prototype.onTokenRefresh=function(){return function(){}},Cx.prototype.logEvent=function(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return e=function(t){switch(t){case zD.NOTIFICATION_CLICKED:return"notification_open";case zD.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[$D],message_name:r["google.c.a.c_l"],message_time:r["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}})})},Cx);function Cx(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",function(t){return e.messageEventListener(t)})}function kx(t){return QD.create("missing-app-config-values",{valueName:t})}G={isSupported:Nx};function Nx(){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")}Xl.INTERNAL.registerComponent(new ta("messaging",function(t){var e=t.getProvider("app").getImmediate(),t={app:e,appConfig:function(t){var e,n;if(!t||!t.options)throw kx("App Configuration Object");if(!t.name)throw kx("App Name");var r=t.options;try{for(var i=to(["projectId","apiKey","appId","messagingSenderId"]),o=i.next();!o.done;o=i.next()){var a=o.value;if(!r[a])throw kx(a)}}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(!Nx())throw QD.create("unsupported-browser");return new(self&&"ServiceWorkerGlobalScope"in self?Ix:Sx)(t)},"PUBLIC").setServiceProps(G));var Ax,Rx="firebasestorage.googleapis.com",Ox="storageBucket",Px=(Xi(Dx,Ax=Eo),Dx.prototype._codeEquals=function(t){return xx(t)===this.code},Object.defineProperty(Dx.prototype,"serverResponse",{get:function(){return this.customData.serverResponse},set:function(t){this.customData.serverResponse=t,this.customData.serverResponse?this.message=this._baseMessage+"\n"+this.customData.serverResponse:this.message=this._baseMessage},enumerable:!1,configurable:!0}),Dx);function Dx(t,e){t=Ax.call(this,xx(t),"Firebase Storage: "+e+" ("+xx(t)+")")||this;return t.customData={serverResponse:null},t._baseMessage=t.message,Object.setPrototypeOf(t,Dx.prototype),t}function xx(t){return"storage/"+t}function Lx(){return new Px("unknown","An unknown error occurred, please check the error payload for server response.")}function Mx(){return new Px("canceled","User canceled the upload/download.")}function Fx(){return new Px("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.")}function Ux(t){return new Px("invalid-argument",t)}function jx(){return new Px("app-deleted","The Firebase app was deleted.")}function qx(t){return new Px("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').")}function Vx(t,e){return new Px("invalid-format","String does not match format '"+t+"': "+e)}function Bx(t){throw new Px("internal-error","Internal error: "+t)}var Kx={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},Wx=function(t,e){this.data=t,this.contentType=e||null};function Hx(t,e){switch(t){case Kx.RAW:return new Wx(Gx(e));case Kx.BASE64:case Kx.BASE64URL:return new Wx(zx(t,e));case Kx.DATA_URL:return new Wx(function(t){t=new Qx(t);return t.base64?zx(Kx.BASE64,t.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(t){throw Vx(Kx.DATA_URL,"Malformed data URL.")}return Gx(e)}(t.rest)}(e),new Qx(e).contentType)}throw Lx()}function Gx(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 zx(e,t){switch(e){case Kx.BASE64:var n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r)throw Vx(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case Kx.BASE64URL:r=-1!==t.indexOf("+"),n=-1!==t.indexOf("/");if(r||n)throw Vx(e,"Invalid character '"+(r?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/")}var i;try{i=atob(t)}catch(t){throw Vx(e,"Invalid character found")}for(var o=new Uint8Array(i.length),a=0;a<i.length;a++)o[a]=i.charCodeAt(a);return o}var Qx=function(t){var e;if(this.base64=!1,(this.contentType=null)===(e=t.match(/^data:([^,]+)?,/)))throw Vx(Kx.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 Yx,Xx={STATE_CHANGED:"state_changed"},Jx={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function $x(t){switch(t){case"running":case"pausing":case"canceling":return Jx.RUNNING;case"paused":return Jx.PAUSED;case"success":return Jx.SUCCESS;case"canceled":return Jx.CANCELED;case"error":default:return Jx.ERROR}}(Sn=Yx=Yx||{})[Sn.NO_ERROR=0]="NO_ERROR",Sn[Sn.NETWORK_ERROR=1]="NETWORK_ERROR",Sn[Sn.ABORT=2]="ABORT";var Zx=(tL.prototype.send=function(t,e,n,r){if(this.sent_)throw Bx("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(e,t,!0),void 0!==r)for(var i in r)r.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,r[i].toString());return void 0!==n?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},tL.prototype.getErrorCode=function(){if(!this.sent_)throw Bx("cannot .getErrorCode() before sending");return this.errorCode_},tL.prototype.getStatus=function(){if(!this.sent_)throw Bx("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},tL.prototype.getResponseText=function(){if(!this.sent_)throw Bx("cannot .getResponseText() before sending");return this.xhr_.responseText},tL.prototype.abort=function(){this.xhr_.abort()},tL.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},tL.prototype.addUploadProgressListener=function(t){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",t)},tL.prototype.removeUploadProgressListener=function(t){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",t)},tL);function tL(){var e=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=Yx.NO_ERROR,this.sendPromise_=new Promise(function(t){e.xhr_.addEventListener("abort",function(){e.errorCode_=Yx.ABORT,t(e)}),e.xhr_.addEventListener("error",function(){e.errorCode_=Yx.NETWORK_ERROR,t(e)}),e.xhr_.addEventListener("load",function(){t(e)})})}var eL=(nL.prototype.createXhrIo=function(){return new Zx},nL);function nL(){}var rL=(Object.defineProperty(iL.prototype,"path",{get:function(){return this.path_},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"isRoot",{get:function(){return 0===this.path.length},enumerable:!1,configurable:!0}),iL.prototype.fullServerUrl=function(){var t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)},iL.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},iL.makeFromBucketSpec=function(e,t){var n;try{n=iL.makeFromUrl(e,t)}catch(t){return new iL(e,"")}if(""===n.path)return n;throw new Px("invalid-default-bucket","Invalid default bucket '"+e+"'.")},iL.makeFromUrl=function(t,e){var n=null,r="([A-Za-z0-9.\\-_]+)";var i=new RegExp("^gs://"+r+"(/(.*))?$","i");function o(t){t.path_=decodeURIComponent(t.path)}for(var a=e.replace(/[.]/g,"\\."),s=[{regex:i,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?://"+a+"/v[A-Za-z0-9_]+/b/"+r+"/o(/([^?#]*).*)?$","i"),indices:{bucket:1,path:3},postModify:o},{regex:new RegExp("^https?://"+(e===Rx?"(?:storage.googleapis.com|storage.cloud.google.com)":e)+"/"+r+"/([^?#]*)","i"),indices:{bucket:1,path:2},postModify:o}],u=0;u<s.length;u++){var c=s[u],h=c.regex.exec(t);if(h){n=new iL(h[c.indices.bucket],h[c.indices.path]||"");c.postModify(n);break}}if(null==n)throw new Px("invalid-url","Invalid URL '"+t+"'.");return n},iL);function iL(t,e){this.bucket=t,this.path_=e}var oL=(aL.prototype.getPromise=function(){return this.promise_},aL.prototype.cancel=function(t){},aL);function aL(t){this.promise_=Promise.reject(t)}function sL(t){return"string"==typeof t||t instanceof String}function uL(t){return cL()&&t instanceof Blob}function cL(){return"undefined"!=typeof Blob}function hL(t,e,n,r){if(r<e)throw Ux("Invalid value for '"+t+"'. Expected "+e+" or greater.");if(n<r)throw Ux("Invalid value for '"+t+"'. Expected "+n+" or less.")}function lL(t,e){var n=e.match(/^(\w+):\/\/.+/);return(null==(null==n?void 0:n[1])?"https://"+e:e)+"/v0"+t}function fL(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)}var pL=(dL.prototype.start_=function(){var e,n,t,r,i,o,a,s,u,c=this;function h(t,e){var n,r=c.resolve_,i=c.reject_,o=e.xhr;if(e.wasSuccessCode)try{var a=c.callback_(o,o.getResponseText());void 0!==a?r(a):r()}catch(t){i(t)}else null!==o?((n=Lx()).serverResponse=o.getResponseText(),c.errorCallback_?i(c.errorCallback_(o,n)):i(n)):e.canceled?i(n=(c.appDelete_?jx:Mx)()):i(n=new Px("retry-limit-exceeded","Max retry time for operation exceeded, please try again."))}function l(){return 2===a}function f(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];s||(s=!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];s||(t||l()||o?f.call.apply(f,no([null,t],e)):(r<64&&(r*=2),p(1===a?(a=2,0):1e3*(r+Math.random()))))}function v(t){u||(u=!0,s||(null!==i?(t||(a=2),clearTimeout(i),p(0)):t||(a=1)))}this.canceled_?h(0,new vL(!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 vL(!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()===Yx.NO_ERROR,n=t.getStatus();e&&!c.isRetryStatusCode_(n)?(n=-1!==c.successCodes_.indexOf(n),r(!0,new vL(n,t))):(t=t.getErrorCode()===Yx.ABORT,r(!1,new vL(!1,null,t)))}))},n=h,t=this.timeout_,i=null,u=s=o=!(r=1),p(a=0),setTimeout(function(){o=!0,v(!0)},t),v)},dL.prototype.getPromise=function(){return this.promise_},dL.prototype.cancel=function(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingXhr_&&this.pendingXhr_.abort()},dL.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},dL);function dL(t,e,n,r,i,o,a,s,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_=a,this.errorCallback_=s,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 vL=function(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n};function gL(){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(cL())return new Blob(t);throw new Px("unsupported-environment","This browser doesn't seem to support creating Blobs")}var yL=(mL.prototype.size=function(){return this.size_},mL.prototype.type=function(){return this.type_},mL.prototype.slice=function(t,e){if(uL(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 mL(r)}var i,r;return new mL(new Uint8Array(this.data_.buffer,t,e-t),!0)},mL.getBlob=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(cL()){var n=t.map(function(t){return t instanceof mL?t.data_:t});return new mL(gL.apply(null,n))}var n=t.map(function(t){return sL(t)?Hx(Kx.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 mL(i,!0)},mL.prototype.uploadData=function(){return this.data_},mL);function mL(t,e){var n=0,r="";uL(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}function bL(t){var e,n;try{e=JSON.parse(t)}catch(t){return null}return"object"!=typeof(n=e)||Array.isArray(n)?null:e}function _L(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function wL(t,e){return e}var IL=function(t,e,n,r){this.server=t,this.local=e||t,this.writable=!!n,this.xform=r||wL},TL=null;function EL(){if(TL)return TL;var t=[];t.push(new IL("bucket")),t.push(new IL("generation")),t.push(new IL("metageneration")),t.push(new IL("name","fullPath",!0));var e=new IL("name");e.xform=function(t,e){return!sL(e=e)||e.length<2?e:_L(e)},t.push(e);e=new IL("size");return e.xform=function(t,e){return void 0!==e?Number(e):e},t.push(e),t.push(new IL("timeCreated")),t.push(new IL("updated")),t.push(new IL("md5Hash",null,!0)),t.push(new IL("cacheControl",null,!0)),t.push(new IL("contentDisposition",null,!0)),t.push(new IL("contentEncoding",null,!0)),t.push(new IL("contentLanguage",null,!0)),t.push(new IL("contentType",null,!0)),t.push(new IL("metadata","customMetadata",!0)),TL=t}function SL(n,r){Object.defineProperty(n,"ref",{get:function(){var t=n.bucket,e=n.fullPath,e=new rL(t,e);return r._makeStorageReference(e)}})}function CL(t,e,n){e=bL(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 a=n[o];r[a.local]=a.xform(r,e[a.server])}return SL(r,t),r}(t,e,n)}function kL(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)}var NL="prefixes",AL="items";function RL(t,e,n){n=bL(n);if(null===n)return null;return function(t,e,n){var r={prefixes:[],items:[],nextPageToken:n.nextPageToken};if(n[NL])for(var i=0,o=n[NL];i<o.length;i++){var a=o[i].replace(/\/$/,""),s=t._makeStorageReference(new rL(e,a));r.prefixes.push(s)}if(n[AL])for(var u=0,c=n[AL];u<c.length;u++){var h=c[u],s=t._makeStorageReference(new rL(e,h.name));r.items.push(s)}return r}(t,e,n)}var OL=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 PL(t){if(!t)throw Lx()}function DL(n,r){return function(t,e){return PL(null!==(e=CL(n,e,r))),e}}function xL(n,r){return function(t,e){return PL(null!==(e=RL(n,r,e))),e}}function LL(r,i){return function(t,e){var n=CL(r,e,i);return PL(null!==n),function(r,t,i){if(null===(t=bL(t)))return null;if(!sL(t.downloadTokens))return null;if(0===(t=t.downloadTokens).length)return null;var o=encodeURIComponent;return t.split(",").map(function(t){var e=r.bucket,n=r.fullPath;return lL("/b/"+o(e)+"/o/"+o(n),i)+fL({alt:"media",token:t})})[0]}(n,e,r.host)}}function ML(i){return function(t,e){var n,r=401===t.getStatus()?new Px("unauthenticated","User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(n=i.bucket,new Px("quota-exceeded","Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(r=i.path,new Px("unauthorized","User does not have permission to access '"+r+"'.")):e;return r.serverResponse=e.serverResponse,r}}function FL(r){var i=ML(r);return function(t,e){var n=i(t,e);return 404===t.getStatus()&&(t=r.path,n=new Px("object-not-found","Object '"+t+"' does not exist.")),n.serverResponse=e.serverResponse,n}}function UL(t,e,n){var r=lL(e.fullServerUrl(),t.host),i=t.maxOperationRetryTime,i=new OL(r,"GET",DL(t,n),i);return i.errorHandler=FL(e),i}function jL(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 qL(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"};var s=function(){for(var t="",e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();a["Content-Type"]="multipart/related; boundary="+s;var u=jL(e,r,i),i="--"+s+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+kL(u,n)+"\r\n--"+s+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",s="\r\n--"+s+"--",r=yL.getBlob(i,r,s);if(null===r)throw Fx();s={name:u.fullPath},u=lL(o,t.host),o=t.maxUploadRetryTime,o=new OL(u,"POST",DL(t,n),o);return o.urlParams=s,o.headers=a,o.body=r.uploadData(),o.errorHandler=ML(e),o}var VL=function(t,e,n,r){this.current=t,this.total=e,this.finalized=!!n,this.metadata=r||null};function BL(t,e){var n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){PL(!1)}return PL(!!n&&-1!==(e||["active"]).indexOf(n)),n}function KL(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),a=jL(e,r,i),i={name:a.fullPath},o=lL(o,t.host),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":a.contentType,"Content-Type":"application/json; charset=utf-8"},n=kL(a,n),t=t.maxUploadRetryTime;t=new OL(o,"POST",function(t){var e;BL(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){PL(!1)}return PL(sL(e)),e},t);return t.urlParams=i,t.headers=r,t.body=n,t.errorHandler=ML(e),t}function WL(t,e,n,i){t=t.maxUploadRetryTime,t=new OL(n,"POST",function(t){var e=BL(t,["active","final"]),n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){PL(!1)}n||PL(!1);var r=Number(n);return PL(!isNaN(r)),new VL(r,i.size(),"final"===e)},t);return t.headers={"X-Goog-Upload-Command":"query"},t.errorHandler=ML(e),t}function HL(t,o,e,a,n,s,r,i){var u=new VL(0,0);if(r?(u.current=r.current,u.total=r.total):(u.current=0,u.total=a.size()),a.size()!==u.total)throw new Px("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=a.slice(r,n);if(null===r)throw Fx();n=o.maxUploadRetryTime,n=new OL(e,"POST",function(t,e){var n=BL(t,["active","final"]),r=u.current+h,i=a.size(),e="final"===n?DL(o,s)(t,e):null;return new VL(r,i,"final"===n,e)},n);return n.headers=c,n.body=r.uploadData(),n.progressCallback=i||null,n.errorHandler=ML(t),n}var GL=function(t,e,n){"function"==typeof t||null!=e||null!=n?(this.next=t,this.error=e,this.complete=n):(t=t,this.next=t.next,this.error=t.error,this.complete=t.complete)};function zL(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 QL=(YL.prototype._makeProgressCallback=function(){var e=this,n=this._transferred;return function(t){return e._updateProgress(n+t)}},YL.prototype._shouldDoResumable=function(t){return 262144<t.size()},YL.prototype._start=function(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this._continueUpload():this._oneShotUpload())},YL.prototype._resolveToken=function(e){var n=this;this._ref.storage._getAuthToken().then(function(t){switch(n._state){case"running":e(t);break;case"canceling":n._transition("canceled");break;case"pausing":n._transition("paused")}})},YL.prototype._createResumable=function(){var n=this;this._resolveToken(function(t){var e=KL(n._ref.storage,n._ref._location,n._mappings,n._blob,n._metadata),t=n._ref.storage._makeRequest(e,t);(n._request=t).getPromise().then(function(t){n._request=void 0,n._uploadUrl=t,n._needToFetchStatus=!1,n.completeTransitions_()},n._errorHandler)})},YL.prototype._fetchStatus=function(){var n=this,r=this._uploadUrl;this._resolveToken(function(t){var e=WL(n._ref.storage,n._ref._location,r,n._blob),t=n._ref.storage._makeRequest(e,t);(n._request=t).getPromise().then(function(t){n._request=void 0,n._updateProgress(t.current),n._needToFetchStatus=!1,t.finalized&&(n._needToFetchMetadata=!0),n.completeTransitions_()},n._errorHandler)})},YL.prototype._continueUpload=function(){var n=this,r=262144*this._chunkMultiplier,i=new VL(this._transferred,this._blob.size()),o=this._uploadUrl;this._resolveToken(function(t){var e;try{e=HL(n._ref._location,n._ref.storage,o,n._blob,r,n._mappings,i,n._makeProgressCallback())}catch(t){return n._error=t,void n._transition("error")}t=n._ref.storage._makeRequest(e,t);(n._request=t).getPromise().then(function(t){n._increaseMultiplier(),n._request=void 0,n._updateProgress(t.current),t.finalized?(n._metadata=t.metadata,n._transition("success")):n.completeTransitions_()},n._errorHandler)})},YL.prototype._increaseMultiplier=function(){262144*this._chunkMultiplier<33554432&&(this._chunkMultiplier*=2)},YL.prototype._fetchMetadata=function(){var n=this;this._resolveToken(function(t){var e=UL(n._ref.storage,n._ref._location,n._mappings),t=n._ref.storage._makeRequest(e,t);(n._request=t).getPromise().then(function(t){n._request=void 0,n._metadata=t,n._transition("success")},n._metadataErrorHandler)})},YL.prototype._oneShotUpload=function(){var n=this;this._resolveToken(function(t){var e=qL(n._ref.storage,n._ref._location,n._mappings,n._blob,n._metadata),t=n._ref.storage._makeRequest(e,t);(n._request=t).getPromise().then(function(t){n._request=void 0,n._metadata=t,n._updateProgress(n._blob.size()),n._transition("success")},n._errorHandler)})},YL.prototype._updateProgress=function(t){var e=this._transferred;this._transferred=t,this._transferred!==e&&this._notifyObservers()},YL.prototype._transition=function(t){if(this._state!==t)switch(t){case"canceling":case"pausing":this._state=t,void 0!==this._request&&this._request.cancel();break;case"running":var e="paused"===this._state;this._state=t,e&&(this._notifyObservers(),this._start());break;case"paused":this._state=t,this._notifyObservers();break;case"canceled":this._error=Mx(),this._state=t,this._notifyObservers();break;case"error":case"success":this._state=t,this._notifyObservers()}},YL.prototype.completeTransitions_=function(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}},Object.defineProperty(YL.prototype,"snapshot",{get:function(){var t=$x(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:t,metadata:this._metadata,task:this,ref:this._ref}},enumerable:!1,configurable:!0}),YL.prototype.on=function(t,e,n,r){var i=this,o=new GL(e,n,r);return this._addObserver(o),function(){i._removeObserver(o)}},YL.prototype.then=function(t,e){return this._promise.then(t,e)},YL.prototype.catch=function(t){return this.then(null,t)},YL.prototype._addObserver=function(t){this._observers.push(t),this._notifyObserver(t)},YL.prototype._removeObserver=function(t){t=this._observers.indexOf(t);-1!==t&&this._observers.splice(t,1)},YL.prototype._notifyObservers=function(){var e=this;this._finishPromise(),this._observers.slice().forEach(function(t){e._notifyObserver(t)})},YL.prototype._finishPromise=function(){if(void 0!==this._resolve){var t=!0;switch($x(this._state)){case Jx.SUCCESS:zL(this._resolve.bind(null,this.snapshot))();break;case Jx.CANCELED:case Jx.ERROR:zL(this._reject.bind(null,this._error))();break;default:t=!1}t&&(this._resolve=void 0,this._reject=void 0)}},YL.prototype._notifyObserver=function(t){switch($x(this._state)){case Jx.RUNNING:case Jx.PAUSED:t.next&&zL(t.next.bind(t,this.snapshot))();break;case Jx.SUCCESS:t.complete&&zL(t.complete.bind(t))();break;case Jx.CANCELED:case Jx.ERROR:t.error&&zL(t.error.bind(t,this._error))();break;default:t.error&&zL(t.error.bind(t,this._error))()}},YL.prototype.resume=function(){var t="paused"===this._state||"pausing"===this._state;return t&&this._transition("running"),t},YL.prototype.pause=function(){var t="running"===this._state;return t&&this._transition("pausing"),t},YL.prototype.cancel=function(){var t="running"===this._state||"pausing"===this._state;return t&&this._transition("canceling"),t},YL);function YL(t,e,n){var r=this;void 0===n&&(n=null),this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=t,this._blob=e,this._metadata=n,this._mappings=EL(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=function(t){r._request=void 0,r._chunkMultiplier=1,t._codeEquals("canceled")?(r._needToFetchStatus=!0,r.completeTransitions_()):(r._error=t,r._transition("error"))},this._metadataErrorHandler=function(t){r._request=void 0,t._codeEquals("canceled")?r.completeTransitions_():(r._error=t,r._transition("error"))},this._promise=new Promise(function(t,e){r._resolve=t,r._reject=e,r._start()}),this._promise.then(null,function(){})}var XL=(JL.prototype.toString=function(){return"gs://"+this._location.bucket+"/"+this._location.path},JL.prototype._newRef=function(t,e){return new JL(t,e)},Object.defineProperty(JL.prototype,"root",{get:function(){var t=new rL(this._location.bucket,"");return this._newRef(this._service,t)},enumerable:!1,configurable:!0}),Object.defineProperty(JL.prototype,"bucket",{get:function(){return this._location.bucket},enumerable:!1,configurable:!0}),Object.defineProperty(JL.prototype,"fullPath",{get:function(){return this._location.path},enumerable:!1,configurable:!0}),Object.defineProperty(JL.prototype,"name",{get:function(){return _L(this._location.path)},enumerable:!1,configurable:!0}),Object.defineProperty(JL.prototype,"storage",{get:function(){return this._service},enumerable:!1,configurable:!0}),Object.defineProperty(JL.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 rL(this._location.bucket,t);return new JL(this._service,t)},enumerable:!1,configurable:!0}),JL.prototype._throwIfRoot=function(t){if(""===this._location.path)throw qx(t)},JL);function JL(t,e){this._service=t,this._location=e instanceof rL?e:rL.makeFromUrl(e,t.host)}function $L(t){var e={prefixes:[],items:[]};return function r(i,o,a){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,ZL(i,{pageToken:a})];case 1:return e=t.sent(),(n=o.prefixes).push.apply(n,e.prefixes),(n=o.items).push.apply(n,e.items),null==e.nextPageToken?[3,3]:[4,r(i,o,e.nextPageToken)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}(t,e).then(function(){return e})}function ZL(c,h){return $i(this,void 0,void 0,function(){var s,u;return Zi(this,function(t){switch(t.label){case 0:return null!=h&&"number"==typeof h.maxResults&&hL("options.maxResults",1,1e3,h.maxResults),[4,c.storage._getAuthToken()];case 1:return s=t.sent(),u=h||{},e=c.storage,n=c._location,r="/",i=u.pageToken,o=u.maxResults,a={},n.isRoot?a.prefix="":a.prefix=n.path+"/",r&&0<r.length&&(a.delimiter=r),i&&(a.pageToken=i),o&&(a.maxResults=o),i=lL(n.bucketOnlyServerUrl(),e.host),o=e.maxOperationRetryTime,(o=new OL(i,"GET",xL(e,n.bucket),o)).urlParams=a,o.errorHandler=ML(n),[2,c.storage._makeRequest(o,s).getPromise()]}var e,n,r,i,o,a})})}function tM(u,c){return $i(this,void 0,void 0,function(){var s;return Zi(this,function(t){switch(t.label){case 0:return u._throwIfRoot("updateMetadata"),[4,u.storage._getAuthToken()];case 1:return s=t.sent(),e=u.storage,n=u._location,r=c,i=EL(),o=lL(n.fullServerUrl(),e.host),a=kL(r,i),r=e.maxOperationRetryTime,(r=new OL(o,"PATCH",DL(e,i),r)).headers={"Content-Type":"application/json; charset=utf-8"},r.body=a,r.errorHandler=FL(n),[2,u.storage._makeRequest(r,s).getPromise()]}var e,n,r,i,o,a})})}function eM(s){return $i(this,void 0,void 0,function(){var a;return Zi(this,function(t){switch(t.label){case 0:return s._throwIfRoot("getDownloadURL"),[4,s.storage._getAuthToken()];case 1:return a=t.sent(),e=s.storage,n=s._location,r=EL(),i=lL(n.fullServerUrl(),e.host),o=e.maxOperationRetryTime,(o=new OL(i,"GET",LL(e,r),o)).errorHandler=FL(n),[2,s.storage._makeRequest(o,a).getPromise().then(function(t){if(null===t)throw new Px("no-download-url","The given file does not have any download URLs.");return t})]}var e,n,r,i,o})})}function nM(o){return $i(this,void 0,void 0,function(){var i;return Zi(this,function(t){switch(t.label){case 0:return o._throwIfRoot("deleteObject"),[4,o.storage._getAuthToken()];case 1:return i=t.sent(),e=o.storage,n=o._location,r=lL(n.fullServerUrl(),e.host),e=e.maxOperationRetryTime,(e=new OL(r,"DELETE",function(t,e){},e)).successCodes=[200,204],e.errorHandler=FL(n),[2,o.storage._makeRequest(e,i).getPromise()]}var e,n,r})})}function rM(t,e){var n,e=(n=t._location.path,e=(e=e).split("/").filter(function(t){return 0<t.length}).join("/"),0===n.length?e:n+"/"+e),e=new rL(t._location.bucket,e);return new XL(t.storage,e)}function iM(t){return/^[A-Za-z]+:\/\//.test(t)}function oM(t,e){if(t instanceof uM){var n=t;if(null==n._bucket)throw new Px("no-default-bucket","No default bucket found. Did you set the '"+Ox+"' property when initializing the app?");n=new XL(n,n._bucket);return null!=e?oM(n,e):n}if(void 0===e)return t;if(e.includes(".."))throw Ux('`path` param cannot contain ".."');return rM(t,e)}function aM(t,e){if(e&&iM(e)){if(t instanceof uM)return new XL(t,e);throw Ux("To use ref(service, url), the first argument must be a Storage instance.")}return oM(t,e)}function sM(t,e){e=null==e?void 0:e[Ox];return null==e?null:rL.makeFromBucketSpec(e,t)}var uM=(Object.defineProperty(cM.prototype,"host",{get:function(){return this._host},set:function(t){this._host=t,null!=this._url?this._bucket=rL.makeFromBucketSpec(this._url,t):this._bucket=sM(t,this.app.options)},enumerable:!1,configurable:!0}),Object.defineProperty(cM.prototype,"maxUploadRetryTime",{get:function(){return this._maxUploadRetryTime},set:function(t){hL("time",0,Number.POSITIVE_INFINITY,t),this._maxUploadRetryTime=t},enumerable:!1,configurable:!0}),Object.defineProperty(cM.prototype,"maxOperationRetryTime",{get:function(){return this._maxOperationRetryTime},set:function(t){hL("time",0,Number.POSITIVE_INFINITY,t),this._maxOperationRetryTime=t},enumerable:!1,configurable:!0}),cM.prototype._getAuthToken=function(){return $i(this,void 0,void 0,function(){var e;return Zi(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]}})})},cM.prototype._delete=function(){return this._deleted=!0,this._requests.forEach(function(t){return t.cancel()}),this._requests.clear(),Promise.resolve()},cM.prototype._makeStorageReference=function(t){return new XL(this,t)},cM.prototype._makeRequest=function(t,e){var n=this;if(this._deleted)return new oL(jx());var r,i,o,a,s,u,c=(r=t,i=this._appId,o=e,a=this._pool,s=this._firebaseVersion,u=fL(r.urlParams),t=r.url+u,e=Object.assign({},r.headers),u=e,(i=i)&&(u["X-Firebase-GMPID"]=i),i=e,null!==(o=o)&&0<o.length&&(i.Authorization="Firebase "+o),s=s,e["X-Firebase-Storage-Version"]="webjs/"+(null!=s?s:"AppManager"),new pL(t,r.method,e,r.body,r.successCodes,r.additionalRetryCodes,r.handler,r.errorHandler,r.timeout,r.progressCallback,a));return this._requests.add(c),c.getPromise().then(function(){return n._requests.delete(c)},function(){return n._requests.delete(c)}),c},cM);function cM(t,e,n,r,i){this.app=t,this._authProvider=e,this._pool=n,this._url=r,this._firebaseVersion=i,this._bucket=null,this._host=Rx,this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=r?rL.makeFromBucketSpec(r,this._host):sM(this._host,this.app.options)}function hM(t,e,n){return t=Zo(t),e=e,n=n,(t=t)._throwIfRoot("uploadBytesResumable"),new QL(t,new yL(e),n)}function lM(t){return function(r){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return r._throwIfRoot("getMetadata"),[4,r.storage._getAuthToken()];case 1:return e=t.sent(),n=UL(r.storage,r._location,EL()),[2,r.storage._makeRequest(n,e).getPromise()]}})})}(t=Zo(t))}function fM(t,e){return aM(t=Zo(t),e)}var pM=(Object.defineProperty(dM.prototype,"bytesTransferred",{get:function(){return this._delegate.bytesTransferred},enumerable:!1,configurable:!0}),Object.defineProperty(dM.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(dM.prototype,"state",{get:function(){return this._delegate.state},enumerable:!1,configurable:!0}),Object.defineProperty(dM.prototype,"totalBytes",{get:function(){return this._delegate.totalBytes},enumerable:!1,configurable:!0}),dM);function dM(t,e,n){this._delegate=t,this.task=e,this.ref=n}var vM=(Object.defineProperty(gM.prototype,"snapshot",{get:function(){return new pM(this._delegate.snapshot,this,this._ref)},enumerable:!1,configurable:!0}),gM.prototype.then=function(e,t){var n=this;return this._delegate.then(function(t){if(e)return e(new pM(t,n,n._ref))},t)},gM.prototype.on=function(t,e,n,r){var i=this,o=void 0;return e&&(o="function"==typeof e?function(t){return e(new pM(t,i,i._ref))}:{next:e.next?function(t){return e.next(new pM(t,i,i._ref))}:void 0,complete:e.complete||void 0,error:e.error||void 0}),this._delegate.on(t,o,n||void 0,r||void 0)},gM);function gM(t,e){this._delegate=t,this._ref=e,this.cancel=this._delegate.cancel.bind(this._delegate),this.catch=this._delegate.catch.bind(this._delegate),this.pause=this._delegate.pause.bind(this._delegate),this.resume=this._delegate.resume.bind(this._delegate)}var yM=(Object.defineProperty(mM.prototype,"prefixes",{get:function(){var e=this;return this._delegate.prefixes.map(function(t){return new bM(t,e._service)})},enumerable:!1,configurable:!0}),Object.defineProperty(mM.prototype,"items",{get:function(){var e=this;return this._delegate.items.map(function(t){return new bM(t,e._service)})},enumerable:!1,configurable:!0}),Object.defineProperty(mM.prototype,"nextPageToken",{get:function(){return this._delegate.nextPageToken||null},enumerable:!1,configurable:!0}),mM);function mM(t,e){this._delegate=t,this._service=e}var bM=(Object.defineProperty(_M.prototype,"name",{get:function(){return this._delegate.name},enumerable:!1,configurable:!0}),Object.defineProperty(_M.prototype,"bucket",{get:function(){return this._delegate.bucket},enumerable:!1,configurable:!0}),Object.defineProperty(_M.prototype,"fullPath",{get:function(){return this._delegate.fullPath},enumerable:!1,configurable:!0}),_M.prototype.toString=function(){return this._delegate.toString()},_M.prototype.child=function(t){return new _M(rM(this._delegate,t),this.storage)},Object.defineProperty(_M.prototype,"root",{get:function(){return new _M(this._delegate.root,this.storage)},enumerable:!1,configurable:!0}),Object.defineProperty(_M.prototype,"parent",{get:function(){var t=this._delegate.parent;return null==t?null:new _M(t,this.storage)},enumerable:!1,configurable:!0}),_M.prototype.put=function(t,e){return this._throwIfRoot("put"),new vM(hM(this._delegate,t,e),this)},_M.prototype.putString=function(t,e,n){void 0===e&&(e=Kx.RAW),this._throwIfRoot("putString");t=Hx(e,t),n=Ji({},n);return null==n.contentType&&null!=t.contentType&&(n.contentType=t.contentType),new vM(new QL(this._delegate,new yL(t.data,!0),n),this)},_M.prototype.listAll=function(){var e=this;return $L(Zo(this._delegate)).then(function(t){return new yM(t,e.storage)})},_M.prototype.list=function(t){var e,n=this;return e=this._delegate,t=t||void 0,ZL(e=Zo(e),t).then(function(t){return new yM(t,n.storage)})},_M.prototype.getMetadata=function(){return lM(this._delegate)},_M.prototype.updateMetadata=function(t){return e=this._delegate,t=t,tM(e=Zo(e),t);var e},_M.prototype.getDownloadURL=function(){return eM(Zo(this._delegate))},_M.prototype.delete=function(){return this._throwIfRoot("delete"),nM(Zo(this._delegate))},_M.prototype._throwIfRoot=function(t){if(""===this._delegate._location.path)throw qx(t)},_M);function _M(t,e){this._delegate=t,this.storage=e}var wM=(Object.defineProperty(IM.prototype,"maxOperationRetryTime",{get:function(){return this._delegate.maxOperationRetryTime},enumerable:!1,configurable:!0}),Object.defineProperty(IM.prototype,"maxUploadRetryTime",{get:function(){return this._delegate.maxUploadRetryTime},enumerable:!1,configurable:!0}),IM.prototype.ref=function(t){if(iM(t))throw Ux("ref() expected a child path but got a URL, use refFromURL instead.");return new bM(fM(this._delegate,t),this)},IM.prototype.refFromURL=function(t){if(!iM(t))throw Ux("refFromURL() expected a full URL but got a child path, use ref() instead.");try{rL.makeFromUrl(t,this._delegate.host)}catch(t){throw Ux("refFromUrl() expected a valid full URL but got an invalid one.")}return new bM(fM(this._delegate,t),this)},IM.prototype.setMaxUploadRetryTime=function(t){this._delegate.maxUploadRetryTime=t},IM.prototype.setMaxOperationRetryTime=function(t){this._delegate.maxOperationRetryTime=t},IM.prototype.useEmulator=function(t,e){var n;n=this._delegate,t=t,e=e,n.host="http://"+t+":"+e},IM);function IM(t,e){var n=this;this.app=t,this._delegate=e,this.INTERNAL={delete:function(){return n._delegate._delete()}}}var TM,EM;function SM(t,e){var n=e.instanceIdentifier,e=t.getProvider("app").getImmediate(),t=t.getProvider("auth-internal");return new wM(e,new uM(e,t,new eL,n,Xl.SDK_VERSION))}EM={TaskState:Jx,TaskEvent:Xx,StringFormat:Kx,Storage:uM,Reference:bM},(TM=Xl).INTERNAL.registerComponent(new ta("storage",SM,"PUBLIC").setServiceProps(EM).setMultipleInstances(!0)),TM.registerVersion("@firebase/storage","0.5.1");var CM,kM,NM="0.4.11",AM="FB-PERF-TRACE-MEASURE",RM="@firebase/performance/config",OM="@firebase/performance/configexpire",G="Performance",Sn=((Sn={})["trace started"]="Trace {$traceName} was started before.",Sn["trace stopped"]="Trace {$traceName} is not running.",Sn["nonpositive trace startTime"]="Trace {$traceName} startTime should be positive.",Sn["nonpositive trace duration"]="Trace {$traceName} duration should be positive.",Sn["no window"]="Window is not available.",Sn["no app id"]="App id is not available.",Sn["no project id"]="Project id is not available.",Sn["no api key"]="Api key is not available.",Sn["invalid cc log"]="Attempted to queue invalid cc event",Sn["FB not default"]="Performance can only start when Firebase app instance is the default one.",Sn["RC response not ok"]="RC response is not ok",Sn["invalid attribute name"]="Attribute name {$attributeName} is invalid.",Sn["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",Sn["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",Sn["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",Sn),PM=new Co("performance",G,Sn),DM=new pa(G);DM.logLevel=sa.INFO;var xM,LM=(MM.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},MM.prototype.mark=function(t){this.performance&&this.performance.mark&&this.performance.mark(t)},MM.prototype.measure=function(t,e,n){this.performance&&this.performance.measure&&this.performance.measure(t,e,n)},MM.prototype.getEntriesByType=function(t){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(t):[]},MM.prototype.getEntriesByName=function(t){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(t):[]},MM.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},MM.prototype.requiredApisAvailable=function(){return fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled?!!bo()||(DM.info("IndexedDB is not supported by current browswer"),!1):(DM.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)},MM.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]})},MM.getInstance=function(){return CM=void 0===CM?new MM(kM):CM},MM);function MM(t){if(!(this.window=t))throw PM.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 FM(t,e){var n=t.length-e.length;if(n<0||1<n)throw PM.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 UM,jM,qM=(VM.prototype.getAppId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!t)throw PM.create("no app id");return t},VM.prototype.getProjectId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!t)throw PM.create("no project id");return t},VM.prototype.getApiKey=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!t)throw PM.create("no api key");return t},VM.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},VM.getInstance=function(){return xM=void 0===xM?new VM:xM},VM);function VM(){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=FM("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=FM("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}(G=jM=jM||{})[G.UNKNOWN=0]="UNKNOWN",G[G.VISIBLE=1]="VISIBLE",G[G.HIDDEN=2]="HIDDEN";var BM=["firebase_","google_","ga_"],KM=new RegExp("^[a-zA-Z]\\w*$");function WM(){switch(LM.getInstance().document.visibilityState){case"visible":return jM.VISIBLE;case"hidden":return jM.HIDDEN;default:return jM.UNKNOWN}}var HM="0.0.1",GM={loggingEnabled:!0},zM="FIREBASE_INSTALLATIONS_AUTH";function QM(t){var n,e=function(){var t=LM.getInstance().localStorage;if(!t)return;var e=t.getItem(OM);if(!e||!function(t){return Number(t)>Date.now()}(e))return;var n=t.getItem(RM);if(!n)return;try{return JSON.parse(n)}catch(t){return}}();return e?(XM(e),Promise.resolve()):(n=t,function(){var t=qM.getInstance().installationsService.getToken();return t.then(function(t){}),t}().then(function(t){var e="https://firebaseremoteconfig.googleapis.com/v1/projects/"+qM.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+qM.getInstance().getApiKey(),t=new Request(e,{method:"POST",headers:{Authorization:zM+" "+t},body:JSON.stringify({app_instance_id:n,app_instance_id_token:t,app_id:qM.getInstance().getAppId(),app_version:NM,sdk_version:HM})});return fetch(t).then(function(t){if(t.ok)return t.json();throw PM.create("RC response not ok")})}).catch(function(){DM.info(YM)}).then(XM).then(function(t){var e=LM.getInstance().localStorage;if(!t||!e)return;e.setItem(RM,JSON.stringify(t)),e.setItem(OM,String(Date.now()+60*qM.getInstance().configTimeToLive*60*1e3))},function(){}))}var YM="Could not fetch config, will use default configs";function XM(t){if(!t)return t;var e=qM.getInstance(),n=t.entries||{};return e.loggingEnabled=void 0!==n.fpr_enabled?"true"===String(n.fpr_enabled):GM.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=JM(e.tracesSamplingRate),e.logNetworkAfterSampling=JM(e.networkRequestsSamplingRate),t}function JM(t){return Math.random()<=t}var $M,ZM=1;function tF(){return ZM=2,$M=$M||function(){var n=LM.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=qM.getInstance().installationsService.getId()).then(function(t){UM=t}),t;var t}).then(QM).then(eF,eF)}function eF(){ZM=3}var nF,rF=1e4,iF=5500,oF=3,aF=1e3,sF=oF,uF=[],cF=!1;function hF(t){setTimeout(function(){var t,e;if(0!==sF)return uF.length?(t=uF.splice(0,aF),e=t.map(function(t){return{source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)}}),void function(t,r){return function(t){var e=qM.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then(function(t){return t.ok||DM.info("Call to Firebase backend failed."),t.json()}).then(function(t){var e=Number(t.nextRequestWaitMillis),n=rF;isNaN(e)||(n=Math.max(e,n));t=t.logResponseDetails;Array.isArray(t)&&0<t.length&&"RETRY_REQUEST_LATER"===t[0].responseAction&&(uF=no(no([],r),uF),DM.info("Retry transport request later.")),sF=oF,hF(n)})}({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:qM.getInstance().logSource,log_event:e},t).catch(function(){uF=no(no([],t),uF),sF--,DM.info("Tries left: "+sF+"."),hF(rF)})):hF(rF)},t)}function lF(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];!function(t){if(!t.eventTime||!t.message)throw PM.create("invalid cc log");uF=no(no([],uF),[t])}({message:n.apply(void 0,t),eventTime:Date.now()})}}function fF(t,e){(nF=nF||lF(vF))(t,e)}function pF(t){var e=qM.getInstance();!e.instrumentationEnabled&&t.isAuto||(e.dataCollectionEnabled||t.isAuto)&&LM.getInstance().requiredApisAvailable()&&(t.isAuto&&WM()!==jM.VISIBLE||(3===ZM?dF(t):tF().then(function(){return dF(t)},function(){return dF(t)})))}function dF(t){var e;!UM||(e=qM.getInstance()).loggingEnabled&&e.logTraceAfterSampling&&setTimeout(function(){return fF(t,1)},0)}function vF(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:gF(),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:gF(),trace_metric:e};return JSON.stringify(e)})(t)}function gF(){return{google_app_id:qM.getInstance().getAppId(),app_instance_id:UM,web_app_info:{sdk_version:NM,page_url:LM.getInstance().getUrl(),service_worker_status:"serviceWorker"in(t=LM.getInstance().navigator)?t.serviceWorker.controller?2:3:1,visibility_state:WM(),effective_connection_type:function(){var t=LM.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 yF=["_fp","_fcp","_fid"];var mF=(bF.prototype.start=function(){if(1!==this.state)throw PM.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},bF.prototype.stop=function(){if(2!==this.state)throw PM.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(),pF(this)},bF.prototype.record=function(t,e,n){if(t<=0)throw PM.create("nonpositive trace startTime",{traceName:this.name});if(e<=0)throw PM.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=Ji({},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])))}pF(this)},bF.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)},bF.prototype.putMetric=function(t,e){if(n=t,r=this.name,0===n.length||100<n.length||!(r&&r.startsWith("_wt_")&&-1<yF.indexOf(n))&&n.startsWith("_"))throw PM.create("invalid custom metric name",{customMetricName:t});var n,r;this.counters[t]=(t=e,(e=Math.floor(t))<t&&DM.info("Metric value should be an Integer, setting the value as : "+e+"."),e)},bF.prototype.getMetric=function(t){return this.counters[t]||0},bF.prototype.putAttribute=function(t,e){var n,r,i=!(0===(n=t).length||40<n.length)&&(!BM.some(function(t){return n.startsWith(t)})&&!!n.match(KM)),r=0!==(r=e).length&&r.length<=100;if(i&&r)this.customAttributes[t]=e;else{if(!i)throw PM.create("invalid attribute name",{attributeName:t});if(!r)throw PM.create("invalid attribute value",{attributeValue:e})}},bF.prototype.getAttribute=function(t){return this.customAttributes[t]},bF.prototype.removeAttribute=function(t){void 0!==this.customAttributes[t]&&delete this.customAttributes[t]},bF.prototype.getAttributes=function(){return Ji({},this.customAttributes)},bF.prototype.setStartTime=function(t){this.startTimeUs=t},bF.prototype.setDuration=function(t){this.durationUs=t},bF.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())))},bF.createOobTrace=function(t,e,n){var r,i=LM.getInstance().getUrl();i&&(r=new bF("_wt_"+i,!0),i=Math.floor(1e3*LM.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))),pF(r))},bF.createUserTimingTrace=function(t){pF(new bF(t,!1,t))},bF);function bF(t,e,n){void 0===e&&(e=!1),this.name=t,this.isAuto=e,this.state=1,this.customAttributes={},this.counters={},this.api=LM.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||AM+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}function _F(t){var e,n,r,i=t;i&&void 0!==i.responseStart&&(n=LM.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=qM.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 fF(e,0)},0)))}var wF=5e3;function IF(){UM&&(setTimeout(function(){var t=LM.getInstance(),e=t.getEntriesByType("navigation"),n=t.getEntriesByType("paint");{var r;t.onFirstInputDelay?(r=setTimeout(function(){mF.createOobTrace(e,n),r=void 0},wF),t.onFirstInputDelay(function(t){r&&(clearTimeout(r),mF.createOobTrace(e,n,t))})):mF.createOobTrace(e,n)}},0),setTimeout(function(){for(var t=LM.getInstance(),e=t.getEntriesByType("resource"),n=0,r=e;n<r.length;n++)_F(r[n]);t.setupObserver("resource",_F)},0),setTimeout(function(){for(var t=LM.getInstance(),e=t.getEntriesByType("measure"),n=0,r=e;n<r.length;n++)TF(r[n]);t.setupObserver("measure",TF)},0))}function TF(t){t=t.name;t.substring(0,AM.length)!==AM&&mF.createUserTimingTrace(t)}var EF=(SF.prototype.trace=function(t){return new mF(t)},Object.defineProperty(SF.prototype,"instrumentationEnabled",{get:function(){return qM.getInstance().instrumentationEnabled},set:function(t){qM.getInstance().instrumentationEnabled=t},enumerable:!1,configurable:!0}),Object.defineProperty(SF.prototype,"dataCollectionEnabled",{get:function(){return qM.getInstance().dataCollectionEnabled},set:function(t){qM.getInstance().dataCollectionEnabled=t},enumerable:!1,configurable:!0}),SF);function SF(t){this.app=t,LM.getInstance().requiredApisAvailable()&&_o().then(function(t){t&&(cF||(hF(iF),cF=!0),tF().then(IF,IF))}).catch(function(t){DM.info("Environment doesn't support IndexedDB: "+t)})}var CF;function kF(t,e){if("[DEFAULT]"!==t.name)throw PM.create("FB not default");if("undefined"==typeof window)throw PM.create("no window");return kM=window,qM.getInstance().firebaseAppInstance=t,qM.getInstance().installationsService=e,new EF(t)}(CF=Xl).INTERNAL.registerComponent(new ta("performance",function(t){var e=t.getProvider("app").getImmediate(),t=t.getProvider("installations").getImmediate();return kF(e,t)},"PUBLIC")),CF.registerVersion("@firebase/performance","0.4.11");var NF,AF,RF="firebase_id",OF="origin",PF=6e4,DF="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig",xF="https://www.googletagmanager.com/gtag/js";(G=NF=NF||{}).EVENT="event",G.SET="set",G.CONFIG="config",(G=AF=AF||{}).ADD_SHIPPING_INFO="add_shipping_info",G.ADD_PAYMENT_INFO="add_payment_info",G.ADD_TO_CART="add_to_cart",G.ADD_TO_WISHLIST="add_to_wishlist",G.BEGIN_CHECKOUT="begin_checkout",G.CHECKOUT_PROGRESS="checkout_progress",G.EXCEPTION="exception",G.GENERATE_LEAD="generate_lead",G.LOGIN="login",G.PAGE_VIEW="page_view",G.PURCHASE="purchase",G.REFUND="refund",G.REMOVE_FROM_CART="remove_from_cart",G.SCREEN_VIEW="screen_view",G.SEARCH="search",G.SELECT_CONTENT="select_content",G.SELECT_ITEM="select_item",G.SELECT_PROMOTION="select_promotion",G.SET_CHECKOUT_OPTION="set_checkout_option",G.SHARE="share",G.SIGN_UP="sign_up",G.TIMING_COMPLETE="timing_complete",G.VIEW_CART="view_cart",G.VIEW_ITEM="view_item",G.VIEW_ITEM_LIST="view_item_list",G.VIEW_PROMOTION="view_promotion",G.VIEW_SEARCH_RESULTS="view_search_results";var LF=new pa("@firebase/analytics");function MF(o,a,s,u){return function(n,r,i){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return t.trys.push([0,6,,7]),n!==NF.EVENT?[3,2]:[4,function(u,c,h,l,f){return $i(this,void 0,void 0,function(){var n,r,e,i,o,a,s;return Zi(this,function(t){switch(t.label){case 0:return(t.trys.push([0,4,,5]),n=[],f&&f.send_to)?(s=f.send_to,Array.isArray(s)||(s=[s]),[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=s;i<o.length&&(a=o[i],"break"!==e(a));i++);t.label=2;case 2:return 0===n.length&&(n=Object.values(c)),[4,Promise.all(n)];case 3:return t.sent(),u(NF.EVENT,l,f||{}),[3,5];case 4:return s=t.sent(),LF.error(s),[3,5];case 5:return[2]}})})}(o,a,s,r,i)];case 1:return t.sent(),[3,5];case 2:return n!==NF.CONFIG?[3,4]:[4,function(r,i,o,a,s,u){return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:e=a[s],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===s}))?[4,i[n.appId]]:[3,6];case 5:t.sent(),t.label=6;case 6:return[3,8];case 7:return n=t.sent(),LF.error(n),[3,8];case 8:return r(NF.CONFIG,s,u),[2]}})})}(o,a,s,u,r,i)];case 3:return t.sent(),[3,5];case 4:o(NF.SET,r),t.label=5;case 5:return[3,7];case 6:return e=t.sent(),LF.error(e),[3,7];case 7:return[2]}})})}}var G=((G={})["already-exists"]="A Firebase Analytics instance with the appId {$id}  already exists. Only one Firebase Analytics instance can be created for each appId.",G["already-initialized"]="Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.",G["interop-component-reg-failed"]="Firebase Analytics Interop Component failed to instantiate: {$reason}",G["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}",G["indexeddb-unavailable"]="IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}",G["fetch-throttle"]="The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.",G["config-fetch-failed"]="Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}",G["no-api-key"]='The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',G["no-app-id"]='The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',G),FF=new Co("analytics","Analytics",G),UF=30;function jF(t,e){void 0===t&&(t={}),void 0===e&&(e=1e3),this.throttleMetadata=t,this.intervalMillis=e}var qF=new(jF.prototype.getThrottleMetadata=function(t){return this.throttleMetadata[t]},jF.prototype.setThrottleMetadata=function(t,e){this.throttleMetadata[t]=e},jF.prototype.deleteThrottleMetadata=function(t){delete this.throttleMetadata[t]},jF);function VF(o){var a;return $i(this,void 0,void 0,function(){var e,n,r,i;return Zi(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=DF.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!==(a=i.error)&&void 0!==a&&a.message&&(r=i.error.message),[3,5];case 4:return t.sent(),[3,5];case 5:throw FF.create("config-fetch-failed",{httpStatus:n.status,responseMessage:r});case 6:return[2,n.json()]}})})}function BF(s,u,c){return void 0===u&&(u=qF),$i(this,void 0,void 0,function(){var e,n,r,i,o,a=this;return Zi(this,function(t){if(i=s.options,e=i.appId,n=i.apiKey,r=i.measurementId,!e)throw FF.create("no-app-id");if(n)return i=u.getThrottleMetadata(e)||{backoffCount:0,throttleEndTimeMillis:Date.now()},o=new HF,setTimeout(function(){return $i(a,void 0,void 0,function(){return Zi(this,function(t){return o.abort(),[2]})})},void 0!==c?c:PF),[2,function a(s,t,u,c){var h=t.throttleEndTimeMillis,l=t.backoffCount;void 0===c&&(c=qF);return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(this,function(t){switch(t.label){case 0:e=s.appId,n=s.measurementId,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,KF(u,h)];case 2:return t.sent(),[3,4];case 3:if(i=t.sent(),n)return LF.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. ['+i.message+"]"),[2,{appId:e,measurementId:n}];throw i;case 4:return t.trys.push([4,6,,7]),[4,VF(s)];case 5:return o=t.sent(),c.deleteThrottleMetadata(e),[2,o];case 6:if(WF(r=t.sent()))return i=503===Number(r.customData.httpStatus)?$o(l,c.intervalMillis,UF):$o(l,c.intervalMillis),o={throttleEndTimeMillis:Date.now()+i,backoffCount:l+1},c.setThrottleMetadata(e,o),LF.debug("Calling attemptFetch again in "+i+" millis"),[2,a(s,o,u,c)];if(c.deleteThrottleMetadata(e),n)return LF.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]}})})}({appId:e,apiKey:n,measurementId:r},i,o,u)];if(r)return[2,{measurementId:r,appId:e}];throw FF.create("no-api-key")})})}function KF(i,o){return new Promise(function(t,e){var n=Math.max(o-Date.now(),0),r=setTimeout(t,n);i.addEventListener(function(){clearTimeout(r),e(FF.create("fetch-throttle",{throttleEndTimeMillis:o}))})})}function WF(t){if(t instanceof Eo&&t.customData){t=Number(t.customData.httpStatus);return 429===t||500===t||503===t||504===t}}var HF=(GF.prototype.addEventListener=function(t){this.listeners.push(t)},GF.prototype.abort=function(){this.listeners.forEach(function(t){return t()})},GF);function GF(){this.listeners=[]}function zF(s,u,c,h,l,f){return $i(this,void 0,void 0,function(){var i,o,a;return Zi(this,function(t){switch(t.label){case 0:return(i=BF(s)).then(function(t){c[t.measurementId]=t.appId,s.options.measurementId&&t.measurementId!==s.options.measurementId&&LF.warn("The measurement ID in the local Firebase config ("+s.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 LF.error(t)}),u.push(i),o=function(){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return bo()?[3,1]:(LF.warn(FF.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),[2,!1]);case 1:return t.trys.push([1,3,,4]),[4,_o()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),LF.warn(FF.create("indexeddb-unavailable",{errorInfo:e}).message),[2,!1];case 4:return[2,!0]}})})}().then(function(t){if(t)return h.getId()}),[4,Promise.all([i,o])];case 1:return a=t.sent(),i=a[0],o=a[1],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(xF))return r}}()||(e=f,n=i.measurementId,(r=document.createElement("script")).src=xF+"?l="+e+"&id="+n,r.async=!0,document.head.appendChild(r)),l("js",new Date),(a={})[OF]="firebase",a.update=!0,a=a,null!=o&&(a[RF]=o),l(NF.CONFIG,i.measurementId,a),[2,i.measurementId]}var e,n,r})})}var QF,YF,XF={},JF=[],$F={},ZF="dataLayer",tU="gtag",eU=!1;function nU(t){if(eU)throw FF.create("already-initialized");t.dataLayerName&&(ZF=t.dataLayerName),t.gtagName&&(tU=t.gtagName)}function rU(t,e){i=[],go()&&i.push("This is a browser extension environment."),wo()||i.push("Cookies are not available."),0<i.length&&(i=i.map(function(t,e){return"("+(e+1)+") "+t}).join(" "),i=FF.create("invalid-analytics-context",{errorInfo:i}),LF.warn(i.message));var n,r,i,o,a,s,u=t.options.appId;if(!u)throw FF.create("no-app-id");if(!t.options.apiKey){if(!t.options.measurementId)throw FF.create("no-api-key");LF.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!=XF[u])throw FF.create("already-exists",{id:u});return eU||(a=ZF,s=[],Array.isArray(window[a])?s=window[a]:window[a]=s,n=XF,r=JF,i=$F,o=ZF,a=tU,s=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];window[o].push(arguments)},window[a]&&"function"==typeof window[a]&&(s=window[a]),window[a]=MF(s,n,r,i),a={gtagCore:s,wrappedGtag:window[a]},YF=a.wrappedGtag,QF=a.gtagCore,eU=!0),XF[u]=zF(t,JF,$F,e,QF,ZF),{app:t,logEvent:function(t,e,n){!function(n,r,i,o,a){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return a&&a.global?(n(NF.EVENT,i,o),[2]):[3,1];case 1:return[4,r];case 2:e=t.sent(),e=Ji(Ji({},o),{send_to:e}),n(NF.EVENT,i,e),t.label=3;case 3:return[2]}})})}(YF,XF[u],t,e,n).catch(function(t){return LF.error(t)})},setCurrentScreen:function(t,e){!function(n,r,i,o){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return o&&o.global?(n(NF.SET,{screen_name:i}),[2,Promise.resolve()]):[3,1];case 1:return[4,r];case 2:e=t.sent(),n(NF.CONFIG,e,{update:!0,screen_name:i}),t.label=3;case 3:return[2]}})})}(YF,XF[u],t,e).catch(function(t){return LF.error(t)})},setUserId:function(t,e){!function(n,r,i,o){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return o&&o.global?(n(NF.SET,{user_id:i}),[2,Promise.resolve()]):[3,1];case 1:return[4,r];case 2:e=t.sent(),n(NF.CONFIG,e,{update:!0,user_id:i}),t.label=3;case 3:return[2]}})})}(YF,XF[u],t,e).catch(function(t){return LF.error(t)})},setUserProperties:function(t,e){!function(a,s,u,c){return $i(this,void 0,void 0,function(){var e,n,r,i,o;return Zi(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 a(NF.SET,e),[2,Promise.resolve()];case 1:return[4,s];case 2:o=t.sent(),a(NF.CONFIG,o,{update:!0,user_properties:u}),t.label=3;case 3:return[2]}})})}(YF,XF[u],t,e).catch(function(t){return LF.error(t)})},setAnalyticsCollectionEnabled:function(t){!function(n,r){return $i(this,void 0,void 0,function(){var e;return Zi(this,function(t){switch(t.label){case 0:return[4,n];case 1:return e=t.sent(),window["ga-disable-"+e]=!r,[2]}})})}(XF[u],t).catch(function(t){return LF.error(t)})},INTERNAL:{delete:function(){return delete XF[u],Promise.resolve()}}}}var iU,oU="analytics";function aU(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:if(go())return[2,!1];if(!wo())return[2,!1];if(!bo())return[2,!1];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,_o()];case 2:return[2,t.sent()];case 3:return t.sent(),[2,!1];case 4:return[2]}})})}(iU=Xl).INTERNAL.registerComponent(new ta(oU,function(t){return rU(t.getProvider("app").getImmediate(),t.getProvider("installations").getImmediate())},"PUBLIC").setServiceProps({settings:nU,EventName:AF,isSupported:aU})),iU.INTERNAL.registerComponent(new ta("analytics-internal",function(t){try{return{logEvent:t.getProvider(oU).getImmediate().logEvent}}catch(t){throw FF.create("interop-component-reg-failed",{reason:t})}},"PRIVATE")),iU.registerVersion("@firebase/analytics","0.6.9");var sU=(uU.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},uU.prototype.fetch=function(i){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(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]}})})},uU);function uU(t,e,n,r){this.client=t,this.storage=e,this.storageCache=n,this.logger=r}var G=((G={})["registration-window"]="Undefined window object. This SDK only supports usage in a browser environment.",G["registration-project-id"]="Undefined project identifier. Check Firebase app initialization.",G["registration-api-key"]="Undefined API key. Check Firebase app initialization.",G["registration-app-id"]="Undefined app identifier. Check Firebase app initialization.",G["storage-open"]="Error thrown when opening storage. Original error: {$originalErrorMessage}.",G["storage-get"]="Error thrown when reading from storage. Original error: {$originalErrorMessage}.",G["storage-set"]="Error thrown when writing to storage. Original error: {$originalErrorMessage}.",G["storage-delete"]="Error thrown when deleting from storage. Original error: {$originalErrorMessage}.",G["fetch-client-network"]="Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.",G["fetch-timeout"]='The config fetch request timed out.  Configure timeout using "fetchTimeoutMillis" SDK setting.',G["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}.',G["fetch-client-parse"]="Fetch client could not parse response. Original error: {$originalErrorMessage}.",G["fetch-status"]="Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.",G),cU=new Co("remoteconfig","Remote Config",G);var hU=(lU.prototype.fetch=function(f){return $i(this,void 0,void 0,function(){var n,r,i,o,a,s,u,c,h,l;return Zi(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:(e=void 0===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"),cU.create(o,{originalErrorMessage:i.message});case 6:if(a=l.status,s=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(),cU.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?a=500:"NO_CHANGE"===c?a=304:"NO_TEMPLATE"!==c&&"EMPTY_CONFIG"!==c||(u={}),304!==a&&200!==a)throw cU.create("fetch-status",{httpStatus:a});return[2,{status:a,eTag:s,config:u}]}var e})})},lU);function lU(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 fU=(pU.prototype.addEventListener=function(t){this.listeners.push(t)},pU.prototype.abort=function(){this.listeners.forEach(function(t){return t()})},pU);function pU(){this.listeners=[]}var dU=["1","true","t","yes","y","on"],vU=(gU.prototype.asString=function(){return this._value},gU.prototype.asBoolean=function(){return"static"!==this._source&&0<=dU.indexOf(this._value.toLowerCase())},gU.prototype.asNumber=function(){if("static"===this._source)return 0;var t=Number(this._value);return t=isNaN(t)?0:t},gU.prototype.getSource=function(){return this._source},gU);function gU(t,e){void 0===e&&(e=""),this._source=t,this._value=e}var yU=(mU.prototype.setLogLevel=function(t){switch(t){case"debug":this._logger.logLevel=sa.DEBUG;break;case"silent":this._logger.logLevel=sa.SILENT;break;default:this._logger.logLevel=sa.ERROR}},Object.defineProperty(mU.prototype,"fetchTimeMillis",{get:function(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1},enumerable:!1,configurable:!0}),Object.defineProperty(mU.prototype,"lastFetchStatus",{get:function(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"},enumerable:!1,configurable:!0}),mU.prototype.activate=function(){return $i(this,void 0,void 0,function(){var e,n;return Zi(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]}})})},mU.prototype.ensureInitialized=function(){var t=this;return this._initializePromise||(this._initializePromise=this._storageCache.loadFromStorage().then(function(){t._isInitializationComplete=!0})),this._initializePromise},mU.prototype.fetch=function(){return $i(this,void 0,void 0,function(){var r,i,o,a=this;return Zi(this,function(t){switch(t.label){case 0:r=new fU,setTimeout(function(){return $i(a,void 0,void 0,function(){return Zi(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 Eo&&-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})})},mU.prototype.fetchAndActivate=function(){return $i(this,void 0,void 0,function(){return Zi(this,function(t){switch(t.label){case 0:return[4,this.fetch()];case 1:return t.sent(),[2,this.activate()]}})})},mU.prototype.getAll=function(){var n=this;return function(t,e){void 0===t&&(t={});void 0===e&&(e={});return Object.keys(Ji(Ji({},t),e))}(this._storageCache.getActiveConfig(),this.defaultConfig).reduce(function(t,e){return t[e]=n.getValue(e),t},{})},mU.prototype.getBoolean=function(t){return this.getValue(t).asBoolean()},mU.prototype.getNumber=function(t){return this.getValue(t).asNumber()},mU.prototype.getString=function(t){return this.getValue(t).asString()},mU.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 vU("remote",e[t]):this.defaultConfig&&void 0!==this.defaultConfig[t]?new vU("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 vU("static"))},mU);function mU(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 bU(t,e){t=t.target.error||void 0;return cU.create(e,{originalErrorMessage:t&&t.message})}var _U="app_namespace_store",wU="firebase_remote_config",IU=1;var TU=(EU.prototype.getLastFetchStatus=function(){return this.get("last_fetch_status")},EU.prototype.setLastFetchStatus=function(t){return this.set("last_fetch_status",t)},EU.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.get("last_successful_fetch_timestamp_millis")},EU.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.set("last_successful_fetch_timestamp_millis",t)},EU.prototype.getLastSuccessfulFetchResponse=function(){return this.get("last_successful_fetch_response")},EU.prototype.setLastSuccessfulFetchResponse=function(t){return this.set("last_successful_fetch_response",t)},EU.prototype.getActiveConfig=function(){return this.get("active_config")},EU.prototype.setActiveConfig=function(t){return this.set("active_config",t)},EU.prototype.getActiveConfigEtag=function(){return this.get("active_config_etag")},EU.prototype.setActiveConfigEtag=function(t){return this.set("active_config_etag",t)},EU.prototype.getThrottleMetadata=function(){return this.get("throttle_metadata")},EU.prototype.setThrottleMetadata=function(t){return this.set("throttle_metadata",t)},EU.prototype.deleteThrottleMetadata=function(){return this.delete("throttle_metadata")},EU.prototype.get=function(s){return $i(this,void 0,void 0,function(){var o,a=this;return Zi(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([_U],"readonly").objectStore(_U),r=a.createCompositeKey(s);try{var i=t.get(r);i.onerror=function(t){n(bU(t,"storage-get"))},i.onsuccess=function(t){t=t.target.result;e(t?t.value:void 0)}}catch(t){n(cU.create("storage-get",{originalErrorMessage:t&&t.message}))}})]}})})},EU.prototype.set=function(s,u){return $i(this,void 0,void 0,function(){var o,a=this;return Zi(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([_U],"readwrite").objectStore(_U),r=a.createCompositeKey(s);try{var i=n.put({compositeKey:r,value:u});i.onerror=function(t){e(bU(t,"storage-set"))},i.onsuccess=function(){t()}}catch(t){e(cU.create("storage-set",{originalErrorMessage:t&&t.message}))}})]}})})},EU.prototype.delete=function(s){return $i(this,void 0,void 0,function(){var o,a=this;return Zi(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([_U],"readwrite").objectStore(_U),r=a.createCompositeKey(s);try{var i=n.delete(r);i.onerror=function(t){e(bU(t,"storage-delete"))},i.onsuccess=function(){t()}}catch(t){e(cU.create("storage-delete",{originalErrorMessage:t&&t.message}))}})]}})})},EU.prototype.createCompositeKey=function(t){return[this.appId,this.appName,this.namespace,t].join()},EU);function EU(t,e,n,r){void 0===r&&(r=new Promise(function(e,n){var t=indexedDB.open(wU,IU);t.onerror=function(t){n(bU(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(_U,{keyPath:"compositeKey"})}})),this.appId=t,this.appName=e,this.namespace=n,this.openDbPromise=r}var SU=(CU.prototype.getLastFetchStatus=function(){return this.lastFetchStatus},CU.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.lastSuccessfulFetchTimestampMillis},CU.prototype.getActiveConfig=function(){return this.activeConfig},CU.prototype.loadFromStorage=function(){return $i(this,void 0,void 0,function(){var e,n,r;return Zi(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]}})})},CU.prototype.setLastFetchStatus=function(t){return this.lastFetchStatus=t,this.storage.setLastFetchStatus(t)},CU.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.lastSuccessfulFetchTimestampMillis=t,this.storage.setLastSuccessfulFetchTimestampMillis(t)},CU.prototype.setActiveConfig=function(t){return this.activeConfig=t,this.storage.setActiveConfig(t)},CU);function CU(t){this.storage=t}var kU=(NU.prototype.fetch=function(n){return $i(this,void 0,void 0,function(){var e;return Zi(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)]}})})},NU.prototype.attemptFetch=function(r,t){var a=t.throttleEndTimeMillis,s=t.backoffCount;return $i(this,void 0,void 0,function(){var e,n;return Zi(this,function(t){switch(t.label){case 0:return[4,(i=r.signal,o=a,new Promise(function(t,e){var n=Math.max(o-Date.now(),0),r=setTimeout(t,n);i.addEventListener(function(){clearTimeout(r),e(cU.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 Eo&&t.customData){t=Number(t.customData.httpStatus);return 429===t||500===t||503===t||504===t}}(n=t.sent()))throw n;return n={throttleEndTimeMillis:Date.now()+$o(s),backoffCount:s+1},[4,this.storage.setThrottleMetadata(n)];case 6:return t.sent(),[2,this.attemptFetch(r,n)];case 7:return[2]}var i,o})})},NU);function NU(t,e){this.client=t,this.storage=e}var AU,RU="@firebase/remote-config";return(AU=Xl).INTERNAL.registerComponent(new ta("remoteConfig",function(t,e){var n=e.instanceIdentifier,r=t.getProvider("app").getImmediate(),i=t.getProvider("installations").getImmediate();if("undefined"==typeof window)throw cU.create("registration-window");var o=r.options,a=o.projectId,s=o.apiKey,u=o.appId;if(!a)throw cU.create("registration-project-id");if(!s)throw cU.create("registration-api-key");if(!u)throw cU.create("registration-app-id");n=n||"firebase";e=new TU(u,r.name,n),t=new SU(e),o=new pa(RU);o.logLevel=sa.ERROR;u=new hU(i,AU.SDK_VERSION,n,a,s,u),u=new kU(u,e),u=new sU(u,e,t,o),o=new yU(r,u,t,e,o);return o.ensureInitialized(),o},"PUBLIC").setMultipleInstances(!0)),AU.registerVersion(RU,"0.1.36"),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"),Xl.registerVersion("firebase","8.4.2","cdn"),Xl});
//# sourceMappingURL=firebase.js.map
